0007-mac80211-hostapd-iw-.-update-to-LEDE-27dffa0b0c53a1a817a9a37d1647c7e70672273f.patch 624 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600
  1. From: Matthias Schiffer <mschiffer@universe-factory.net>
  2. Date: Fri, 29 Jul 2016 21:36:45 +0200
  3. Subject: mac80211, hostapd, iw, ...: update to LEDE 27dffa0b0c53a1a817a9a37d1647c7e70672273f
  4. diff --git a/package/firmware/ath10k-firmware/Makefile b/package/firmware/ath10k-firmware/Makefile
  5. index b03d644..e2cf92e 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,19 @@ 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-qca988x
  28. $(Package/ath10k-firmware-default)
  29. + DEFAULT:=PACKAGE_kmod-ath10k
  30. TITLE:=ath10k firmware for QCA988x devices
  31. endef
  32. QCA988X_FIRMWARE_FILE:=firmware-5.bin_10.2.4.97-1
  33. +QCA988X_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-16.1.bin-lede
  34. +QCA99X0_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-7.bin-lede.001
  35. +QCA9984_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-7.bin-lede.001
  36. define Download/ath10k-firmware-qca988x
  37. URL:=https://www.codeaurora.org/cgit/quic/qsdk/oss/firmware/ath10k-firmware/plain/10.2.4/
  38. @@ -44,11 +49,83 @@ define Download/ath10k-firmware-qca988x
  39. endef
  40. $(eval $(call Download,ath10k-firmware-qca988x))
  41. +define Download/ath10k-firmware-qca988x-ct
  42. + URL:=https://www.candelatech.com/downloads/
  43. + FILE:=$(QCA988X_FIRMWARE_FILE_CT)
  44. + MD5SUM:=d7e081e9782936ed544b78994c9133fb
  45. +endef
  46. +$(eval $(call Download,ath10k-firmware-qca988x-ct))
  47. +
  48. +define Download/ath10k-firmware-qca99x0-ct
  49. + URL:=https://www.candelatech.com/downloads/ath10k-10-4/
  50. + FILE:=$(QCA99X0_FIRMWARE_FILE_CT)
  51. + MD5SUM:=eb710949ff79142954aadae24616169c
  52. +endef
  53. +$(eval $(call Download,ath10k-firmware-qca99x0-ct))
  54. +
  55. +define Download/ath10k-firmware-qca9984-ct
  56. + URL:=https://www.candelatech.com/downloads/ath10k-9984-10-4/
  57. + FILE:=$(QCA9984_FIRMWARE_FILE_CT)
  58. + MD5SUM:=747cc1394f15aef97b5ea15e4c208e58
  59. +endef
  60. +$(eval $(call Download,ath10k-firmware-qca9984-ct))
  61. +
  62. define Package/ath10k-firmware-qca99x0
  63. $(Package/ath10k-firmware-default)
  64. TITLE:=ath10k firmware for QCA99x0 devices
  65. endef
  66. +define Package/ath10k-firmware-qca988x-ct
  67. +$(Package/ath10k-firmware-default)
  68. + TITLE:=ath10k CT 10.1 firmware for QCA988x devices
  69. +endef
  70. +
  71. +define Package/ath10k-firmware-qca988x-ct/description
  72. +Alternative ath10k firmware for QCA988X from Candela Technologies.
  73. +Enables IBSS and other features. See:
  74. +http://www.candelatech.com/ath10k-10.1.php
  75. +This firmware will NOT be used unless the standard ath10k-firmware-qca988x
  76. +is un-selected since the driver will try to load firmware-5.bin before
  77. +firmware-2.bin
  78. +endef
  79. +
  80. +define Package/ath10k-firmware-qca99x0-ct/description
  81. +Alternative ath10k firmware for QCA99x0 from Candela Technologies.
  82. +Enables IBSS and other features. See:
  83. +http://www.candelatech.com/ath10k-10.4.php
  84. +This firmware conflicts with the standard 99x0 firmware, so select only
  85. +one.
  86. +endef
  87. +
  88. +define Package/ath10k-firmware-qca9984-ct/description
  89. +Alternative ath10k firmware for QCA9984 from Candela Technologies.
  90. +Enables IBSS and other features. See:
  91. +http://www.candelatech.com/ath10k-10.4-9984.php
  92. +This firmware conflicts with the standard 9984 firmware, so select only
  93. +one.
  94. +endef
  95. +
  96. +define Package/ath10k-firmware-qca99x0/description
  97. +Standard ath10k firmware for QCA99x0 from QCA
  98. +This firmware conflicts with the CT 99x0 firmware, so select only
  99. +one.
  100. +endef
  101. +
  102. +define Package/ath10k-firmware-qca99x0-ct
  103. +$(Package/ath10k-firmware-default)
  104. + TITLE:=ath10k CT 10.4.3 firmware for QCA99x0 devices
  105. +endef
  106. +
  107. +define Package/ath10k-firmware-qca9984-ct
  108. +$(Package/ath10k-firmware-default)
  109. + TITLE:=ath10k CT 10.4.3 firmware for QCA9984 devices
  110. +endef
  111. +
  112. +define Package/ath10k-firmware-qca9984
  113. +$(Package/ath10k-firmware-default)
  114. + TITLE:=ath10k firmware for QCA9984 devices
  115. +endef
  116. +
  117. define Package/ath10k-firmware-qca6174
  118. $(Package/ath10k-firmware-default)
  119. TITLE:=ath10k firmware for QCA6174 devices
  120. @@ -58,8 +135,8 @@ QCA99X0_BOARD_REV:=ddcec9efd245da9365c474f513a855a55f3ac7fe
  121. QCA99X0_BOARD_FILE:=board-2.bin.$(QCA99X0_BOARD_REV)
  122. define Download/qca99x0-board
  123. - URL:=https://www.codeaurora.org/cgit/quic/qsdk/oss/firmware/ath10k-firmware/plain/ath10k/QCA99X0/hw2.0
  124. - URL_FILE:=board-2.bin?id=ddcec9efd245da9365c474f513a855a55f3ac7fe
  125. + URL:=https://source.codeaurora.org/quic/qsdk/oss/firmware/ath10k-firmware/plain/ath10k/QCA99X0/hw2.0
  126. + URL_FILE:=board-2.bin?id=$(QCA99X0_BOARD_REV)
  127. FILE:=$(QCA99X0_BOARD_FILE)
  128. MD5SUM:=a2b3c653c2363a5641200051d6333d0a
  129. endef
  130. @@ -79,6 +156,16 @@ define Package/ath10k-firmware-qca988x/install
  131. $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-5.bin
  132. endef
  133. +define Package/ath10k-firmware-qca988x-ct/install
  134. + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA988X/hw2.0
  135. + $(INSTALL_DATA) \
  136. + $(PKG_BUILD_DIR)/QCA988X/board.bin \
  137. + $(1)/lib/firmware/ath10k/QCA988X/hw2.0/
  138. + $(INSTALL_DATA) \
  139. + $(DL_DIR)/$(QCA988X_FIRMWARE_FILE_CT) \
  140. + $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-2.bin
  141. +endef
  142. +
  143. define Package/ath10k-firmware-qca6174/install
  144. $(INSTALL_DIR) $(1)/lib/firmware/ath10k
  145. $(CP) $(PKG_BUILD_DIR)/QCA6174 $(1)/lib/firmware/ath10k/
  146. @@ -97,6 +184,50 @@ define Package/ath10k-firmware-qca99x0/install
  147. $(1)/lib/firmware/ath10k/QCA99X0/hw2.0/firmware-5.bin
  148. endef
  149. +define Package/ath10k-firmware-qca99x0-ct/install
  150. + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA99X0/hw2.0
  151. + $(INSTALL_DATA) \
  152. + $(DL_DIR)/$(QCA99X0_BOARD_FILE) \
  153. + $(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board-2.bin
  154. + $(INSTALL_DATA) \
  155. + $(PKG_BUILD_DIR)/QCA99X0/hw2.0/boardData_AR900B_CUS239_5G_v2_001.bin \
  156. + $(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board.bin
  157. + $(INSTALL_DATA) \
  158. + $(DL_DIR)/$(QCA99X0_FIRMWARE_FILE_CT) \
  159. + $(1)/lib/firmware/ath10k/QCA99X0/hw2.0/firmware-5.bin
  160. +endef
  161. +
  162. +define Package/ath10k-firmware-qca9984/install
  163. + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9984/hw1.0
  164. + ln -s \
  165. + ../../cal-pci-0000:01:00.0.bin \
  166. + $(1)/lib/firmware/ath10k/QCA9984/hw1.0/board.bin
  167. + $(INSTALL_DATA) \
  168. + $(PKG_BUILD_DIR)/QCA9984/hw1.0/board-2.bin \
  169. + $(1)/lib/firmware/ath10k/QCA9984/hw1.0/board-2.bin
  170. + $(INSTALL_DATA) \
  171. + $(PKG_BUILD_DIR)/QCA9984/hw1.0/firmware-5.bin_10.4-3.2-00072 \
  172. + $(1)/lib/firmware/ath10k/QCA9984/hw1.0/firmware-5.bin
  173. +endef
  174. +
  175. +define Package/ath10k-firmware-qca9984-ct/install
  176. + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9984/hw1.0
  177. + ln -s \
  178. + ../../cal-pci-0000:01:00.0.bin \
  179. + $(1)/lib/firmware/ath10k/QCA9984/hw1.0/board.bin
  180. + $(INSTALL_DATA) \
  181. + $(PKG_BUILD_DIR)/QCA9984/hw1.0/board-2.bin \
  182. + $(1)/lib/firmware/ath10k/QCA9984/hw1.0/board-2.bin
  183. + $(INSTALL_DATA) \
  184. + $(DL_DIR)/$(QCA9984_FIRMWARE_FILE_CT) \
  185. + $(1)/lib/firmware/ath10k/QCA9984/hw1.0/firmware-5.bin
  186. +endef
  187. +
  188. $(eval $(call BuildPackage,ath10k-firmware-qca988x))
  189. $(eval $(call BuildPackage,ath10k-firmware-qca99x0))
  190. $(eval $(call BuildPackage,ath10k-firmware-qca6174))
  191. +$(eval $(call BuildPackage,ath10k-firmware-qca9984))
  192. +
  193. +$(eval $(call BuildPackage,ath10k-firmware-qca988x-ct))
  194. +$(eval $(call BuildPackage,ath10k-firmware-qca99x0-ct))
  195. +$(eval $(call BuildPackage,ath10k-firmware-qca9984-ct))
  196. diff --git a/package/firmware/linux-firmware/Makefile b/package/firmware/linux-firmware/Makefile
  197. index 2fcd93b..7a2e977 100644
  198. --- a/package/firmware/linux-firmware/Makefile
  199. +++ b/package/firmware/linux-firmware/Makefile
  200. @@ -16,10 +16,10 @@ PKG_SOURCE_PROTO:=git
  201. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  202. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION)
  203. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
  204. -PKG_SOURCE_URL:=git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
  205. -PKG_MIRROR_MD5SUM:=ca4d289ad9380471cae376fc7dd3660a
  206. +PKG_SOURCE_URL:=https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
  207. +PKG_MIRROR_MD5SUM:=8d44332359de89b1936b4ff608a72614
  208. -PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  209. +PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  210. SCAN_DEPS = *.mk
  211. diff --git a/package/firmware/linux-firmware/realtek.mk b/package/firmware/linux-firmware/realtek.mk
  212. index 0f8b1ce..4229ca0 100644
  213. --- a/package/firmware/linux-firmware/realtek.mk
  214. +++ b/package/firmware/linux-firmware/realtek.mk
  215. @@ -43,8 +43,15 @@ endef
  216. $(eval $(call BuildPackage,rtl8192de-firmware))
  217. Package/rtl8192se-firmware = $(call Package/firmware-default,RealTek RTL8192SE firmware)
  218. -define KernelPackage/rtl8192se/install
  219. +define Package/rtl8192se-firmware/install
  220. $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  221. $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8192sefw.bin $(1)/lib/firmware/rtlwifi
  222. endef
  223. $(eval $(call BuildPackage,rtl8192se-firmware))
  224. +
  225. +Package/rtl8192su-firmware = $(call Package/firmware-default,RealTek RTL8192SU firmware)
  226. +define Package/rtl8192su-firmware/install
  227. + $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  228. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8712u.bin $(1)/lib/firmware/rtlwifi
  229. +endef
  230. +$(eval $(call BuildPackage,rtl8192su-firmware))
  231. diff --git a/package/kernel/acx-mac80211/Makefile b/package/kernel/acx-mac80211/Makefile
  232. index 1820e7a..8fce374 100644
  233. --- a/package/kernel/acx-mac80211/Makefile
  234. +++ b/package/kernel/acx-mac80211/Makefile
  235. @@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk
  236. include $(INCLUDE_DIR)/kernel.mk
  237. PKG_NAME:=acx-mac80211
  238. -PKG_REV:=v20130127
  239. -PKG_VERSION:=20130909
  240. +PKG_REV:=b6fc31491020cb01d2cd1acc170cfa03ced7e726
  241. +PKG_VERSION:=20140216
  242. PKG_RELEASE:=1
  243. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
  244. -PKG_SOURCE_URL:=git://acx100.git.sourceforge.net/gitroot/acx100/acx-mac80211
  245. +PKG_SOURCE_URL:=http://git.code.sf.net/p/acx100/acx-mac80211
  246. PKG_SOURCE_PROTO:=git
  247. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  248. PKG_SOURCE_VERSION:=$(PKG_REV)
  249. @@ -190,7 +190,7 @@ define Build/Compile
  250. CROSS_COMPILE="$(TARGET_CROSS)" \
  251. SUBDIRS="$(PKG_BUILD_DIR)" \
  252. $(PKG_EXTRA_KCONFIG) \
  253. - EXTRA_CFLAGS="$(PKG_EXTRA_CFLAGS) -DCONFIG_ACX_MAC80211_VERSION=\"KERNEL_VERSION(3,14,0)\"" \
  254. + EXTRA_CFLAGS="$(PKG_EXTRA_CFLAGS) -DCONFIG_ACX_MAC80211_VERSION=\"KERNEL_VERSION(4,2,0)\"" \
  255. LINUXINCLUDE="-I$(STAGING_DIR)/usr/include/mac80211-backport/uapi -I$(STAGING_DIR)/usr/include/mac80211-backport \
  256. -I$(STAGING_DIR)/usr/include/mac80211/uapi -I$(STAGING_DIR)/usr/include/mac80211 \
  257. -I$(LINUX_DIR)/include -I$(LINUX_DIR)/include/$(LINUX_UAPI_DIR) \
  258. 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
  259. deleted file mode 100644
  260. index fa4a6be..0000000
  261. --- a/package/kernel/acx-mac80211/patches/001-pci-mem-Fix-3.8-build.patch
  262. +++ /dev/null
  263. @@ -1,129 +0,0 @@
  264. -From 8a0f5890019bf43f4bc95ef0754b062ddfcfa9cd Mon Sep 17 00:00:00 2001
  265. -From: Oliver Winker <oliver@oli1170.net>
  266. -Date: Sun, 10 Mar 2013 21:04:23 +0100
  267. -Subject: [PATCH 1/3] pci, mem: Fix 3.8 build
  268. -
  269. -__devexit and __devinit not used anymore in 3.8
  270. -
  271. -Signed-off-by: Reinhard Karcher <reinhard.karcher@gmx.net>
  272. -Signed-off-by: Oliver Winker <oliver@oli1170.net>
  273. ----
  274. - mem.c | 13 ++++++++++++-
  275. - pci.c | 26 +++++++++++++++++++++++++-
  276. - 2 files changed, 37 insertions(+), 2 deletions(-)
  277. -
  278. ---- a/mem.c
  279. -+++ b/mem.c
  280. -@@ -2216,7 +2216,11 @@ int acx100mem_ioctl_set_phy_amp_bias(str
  281. - * ==================================================
  282. - */
  283. -
  284. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  285. - static int __devinit acxmem_probe(struct platform_device *pdev)
  286. -+#else
  287. -+static int acxmem_probe(struct platform_device *pdev)
  288. -+#endif
  289. - {
  290. - acx_device_t *adev = NULL;
  291. - const char *chip_name;
  292. -@@ -2392,7 +2396,11 @@ static int __devinit acxmem_probe(struct
  293. - * pdev - ptr to PCI device structure containing info about pci
  294. - * configuration
  295. - */
  296. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  297. - static int __devexit acxmem_remove(struct platform_device *pdev)
  298. -+#else
  299. -+static int acxmem_remove(struct platform_device *pdev)
  300. -+#endif
  301. - {
  302. - struct ieee80211_hw *hw = (struct ieee80211_hw *)
  303. - platform_get_drvdata(pdev);
  304. -@@ -2594,8 +2602,11 @@ static struct platform_driver acxmem_dri
  305. - .name = "acx-mem",
  306. - },
  307. - .probe = acxmem_probe,
  308. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  309. - .remove = __devexit_p(acxmem_remove),
  310. --
  311. -+#else
  312. -+ .remove = acxmem_remove,
  313. -+#endif
  314. - #ifdef CONFIG_PM
  315. - .suspend = acxmem_e_suspend,
  316. - .resume = acxmem_e_resume
  317. ---- a/pci.c
  318. -+++ b/pci.c
  319. -@@ -1039,7 +1039,11 @@ int acx100pci_ioctl_set_phy_amp_bias(str
  320. - * id - ptr to the device id entry that matched this device
  321. - */
  322. - #ifdef CONFIG_PCI
  323. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  324. - static int __devinit acxpci_probe(struct pci_dev *pdev,
  325. -+#else
  326. -+static int acxpci_probe(struct pci_dev *pdev,
  327. -+#endif
  328. - const struct pci_device_id *id)
  329. - {
  330. - unsigned long mem_region1 = 0;
  331. -@@ -1292,7 +1296,11 @@ static int __devinit acxpci_probe(struct
  332. - *
  333. - * pdev - ptr to PCI device structure containing info about pci configuration
  334. - */
  335. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  336. - static void __devexit acxpci_remove(struct pci_dev *pdev)
  337. -+#else
  338. -+static void acxpci_remove(struct pci_dev *pdev)
  339. -+#endif
  340. - {
  341. - struct ieee80211_hw *hw
  342. - = (struct ieee80211_hw *) pci_get_drvdata(pdev);
  343. -@@ -1505,7 +1513,11 @@ static struct pci_driver acxpci_driver =
  344. - .name = "acx_pci",
  345. - .id_table = acxpci_id_tbl,
  346. - .probe = acxpci_probe,
  347. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  348. - .remove = __devexit_p(acxpci_remove),
  349. -+#else
  350. -+ .remove = acxpci_remove,
  351. -+#endif
  352. - #ifdef CONFIG_PM
  353. - .suspend = acxpci_e_suspend,
  354. - .resume = acxpci_e_resume
  355. -@@ -1603,8 +1615,12 @@ static struct vlynq_device_id acx_vlynq_
  356. - };
  357. -
  358. -
  359. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  360. - static __devinit int vlynq_probe(struct vlynq_device *vdev,
  361. -- struct vlynq_device_id *id)
  362. -+#else
  363. -+static int vlynq_probe(struct vlynq_device *vdev,
  364. -+#endif
  365. -+ struct vlynq_device_id *id)
  366. - {
  367. - int result = -EIO, i;
  368. - u32 addr;
  369. -@@ -1785,7 +1801,11 @@ static __devinit int vlynq_probe(struct
  370. - return result;
  371. - }
  372. -
  373. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  374. - static __devexit void vlynq_remove(struct vlynq_device *vdev)
  375. -+#else
  376. -+static void vlynq_remove(struct vlynq_device *vdev)
  377. -+#endif
  378. - {
  379. - struct ieee80211_hw *hw = vlynq_get_drvdata(vdev);
  380. - acx_device_t *adev = hw2adev(hw);
  381. -@@ -1851,7 +1871,11 @@ static struct vlynq_driver acxvlynq_driv
  382. - .name = "acx_vlynq",
  383. - .id_table = acx_vlynq_id,
  384. - .probe = vlynq_probe,
  385. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  386. - .remove = __devexit_p(vlynq_remove),
  387. -+#else
  388. -+ .remove = vlynq_remove,
  389. -+#endif
  390. - };
  391. - #endif /* CONFIG_VLYNQ */
  392. -
  393. 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
  394. deleted file mode 100644
  395. index c737844..0000000
  396. --- a/package/kernel/acx-mac80211/patches/003-Fix-3.10-build.patch
  397. +++ /dev/null
  398. @@ -1,31 +0,0 @@
  399. -From 1daf4bfdb072b08f3b4e412bbfa9645f88dc0a01 Mon Sep 17 00:00:00 2001
  400. -From: Oliver Winker <oliver@oli1170.net>
  401. -Date: Tue, 3 Sep 2013 20:36:36 +0200
  402. -Subject: [PATCH 3/3] Fix 3.10 build
  403. -
  404. -Signed-off-by: Reinhard Karcher <reinhard.karcher@gmx.net>
  405. -Signed-off-by: Oliver Winker <oliver@oli1170.net>
  406. ----
  407. - main.c | 7 +++++++
  408. - 1 file changed, 7 insertions(+)
  409. -
  410. ---- a/main.c
  411. -+++ b/main.c
  412. -@@ -682,10 +682,17 @@ int acx_op_config(struct ieee80211_hw *h
  413. -
  414. - if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
  415. - logf1(L_DEBUG, "IEEE80211_CONF_CHANGE_CHANNEL,"
  416. -+#if CONFIG_ACX_MAC80211_VERSION >= KERNEL_VERSION(3, 10, 0)
  417. -+ "channel->hw_value=%i\n", conf->chandef.chan->hw_value);
  418. -+
  419. -+ acx_set_channel(adev, conf->chandef.chan->hw_value,
  420. -+ conf->chandef.chan->center_freq);
  421. -+#else
  422. - "channel->hw_value=%i\n", conf->channel->hw_value);
  423. -
  424. - acx_set_channel(adev, conf->channel->hw_value,
  425. - conf->channel->center_freq);
  426. -+#endif
  427. -
  428. - changed_not_done &= ~IEEE80211_CONF_CHANGE_CHANNEL;
  429. - }
  430. 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
  431. deleted file mode 100644
  432. index 847b573..0000000
  433. --- a/package/kernel/acx-mac80211/patches/004-Fix-3.14-build.patch
  434. +++ /dev/null
  435. @@ -1,22 +0,0 @@
  436. -From d17fcac710e629463591f6bd09d76b66ec591583 Mon Sep 17 00:00:00 2001
  437. -From: Hauke Mehrtens <hauke@hauke-m.de>
  438. -Date: Wed, 5 Feb 2014 20:57:07 +0100
  439. -Subject: [PATCH] Fix 3.14 build
  440. -
  441. -Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
  442. ----
  443. - main.c | 2 ++
  444. - 1 file changed, 2 insertions(+)
  445. -
  446. ---- a/main.c
  447. -+++ b/main.c
  448. -@@ -500,7 +500,9 @@ int acx_init_ieee80211(acx_device_t *ade
  449. - hw->flags &= ~IEEE80211_HW_RX_INCLUDES_FCS;
  450. - hw->queues = 1;
  451. - hw->wiphy->max_scan_ssids = 1;
  452. -+#if CONFIG_ACX_MAC80211_VERSION < KERNEL_VERSION(3, 14, 0)
  453. - hw->channel_change_time = 10000;
  454. -+#endif
  455. -
  456. - /* OW TODO Check if RTS/CTS threshold can be included here */
  457. -
  458. diff --git a/package/kernel/acx-mac80211/patches/300-api_sync.patch b/package/kernel/acx-mac80211/patches/300-api_sync.patch
  459. new file mode 100644
  460. index 0000000..94d6135
  461. --- /dev/null
  462. +++ b/package/kernel/acx-mac80211/patches/300-api_sync.patch
  463. @@ -0,0 +1,83 @@
  464. +--- a/main.c
  465. ++++ b/main.c
  466. +@@ -497,7 +497,7 @@ int acx_free_mechanics(acx_device_t *ade
  467. +
  468. + int acx_init_ieee80211(acx_device_t *adev, struct ieee80211_hw *hw)
  469. + {
  470. +- hw->flags &= ~IEEE80211_HW_RX_INCLUDES_FCS;
  471. ++ __clear_bit(IEEE80211_HW_RX_INCLUDES_FCS, hw->flags);
  472. + hw->queues = 1;
  473. + hw->wiphy->max_scan_ssids = 1;
  474. +
  475. +@@ -525,14 +525,14 @@ int acx_init_ieee80211(acx_device_t *ade
  476. + /* We base signal quality on winlevel approach of previous driver
  477. + * TODO OW 20100615 This should into a common init code
  478. + */
  479. +- hw->flags |= IEEE80211_HW_SIGNAL_UNSPEC;
  480. ++ __set_bit(IEEE80211_HW_SIGNAL_UNSPEC, hw->flags);
  481. + hw->max_signal = 100;
  482. +
  483. + if (IS_ACX100(adev)) {
  484. +- adev->hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
  485. ++ adev->hw->wiphy->bands[NL80211_BAND_2GHZ] =
  486. + &acx100_band_2GHz;
  487. + } else if (IS_ACX111(adev))
  488. +- adev->hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
  489. ++ adev->hw->wiphy->bands[NL80211_BAND_2GHZ] =
  490. + &acx111_band_2GHz;
  491. + else {
  492. + log(L_ANY, "Error: Unknown device");
  493. +@@ -945,8 +945,8 @@ void acx_op_configure_filter(struct ieee
  494. + changed_flags, *total_flags);
  495. +
  496. + /* OWI TODO: Set also FIF_PROBE_REQ ? */
  497. +- *total_flags &= (FIF_PROMISC_IN_BSS | FIF_ALLMULTI | FIF_FCSFAIL
  498. +- | FIF_CONTROL | FIF_OTHER_BSS);
  499. ++ *total_flags &= (FIF_ALLMULTI | FIF_FCSFAIL | FIF_CONTROL
  500. ++ | FIF_OTHER_BSS);
  501. +
  502. + logf1(L_DEBUG, "2: *total_flags=0x%08x\n", *total_flags);
  503. +
  504. +@@ -1045,9 +1045,10 @@ void acx_op_tx(struct ieee80211_hw *hw,
  505. + }
  506. +
  507. + int acx_op_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  508. +- struct cfg80211_scan_request *req)
  509. ++ struct ieee80211_scan_request *hw_req)
  510. + {
  511. + acx_device_t *adev = hw2adev(hw);
  512. ++ struct cfg80211_scan_request *req = &hw_req->req;
  513. + struct sk_buff *skb;
  514. + size_t ssid_len = 0;
  515. + u8 *ssid = NULL;
  516. +@@ -1082,7 +1083,7 @@ int acx_op_hw_scan(struct ieee80211_hw *
  517. + goto out;
  518. + }
  519. + #else
  520. +- skb = ieee80211_probereq_get(adev->hw, adev->vif, ssid, ssid_len,
  521. ++ skb = ieee80211_probereq_get(adev->hw, vif->addr, ssid, ssid_len,
  522. + req->ie_len);
  523. + if (!skb) {
  524. + ret = -ENOMEM;
  525. +--- a/main.h
  526. ++++ b/main.h
  527. +@@ -62,7 +62,7 @@ void acx_op_tx(struct ieee80211_hw *hw,
  528. + #endif
  529. +
  530. + int acx_op_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  531. +- struct cfg80211_scan_request *req);
  532. ++ struct ieee80211_scan_request *req);
  533. +
  534. + int acx_recover_hw(acx_device_t *adev);
  535. +
  536. +--- a/cardsetting.c
  537. ++++ b/cardsetting.c
  538. +@@ -159,7 +159,7 @@ int acx_set_channel(acx_device_t *adev,
  539. + int res = 0;
  540. +
  541. + adev->rx_status.freq = freq;
  542. +- adev->rx_status.band = IEEE80211_BAND_2GHZ;
  543. ++ adev->rx_status.band = NL80211_BAND_2GHZ;
  544. +
  545. + adev->channel = channel;
  546. +
  547. diff --git a/package/kernel/ath10k-ct/Makefile b/package/kernel/ath10k-ct/Makefile
  548. new file mode 100644
  549. index 0000000..7a025aa
  550. --- /dev/null
  551. +++ b/package/kernel/ath10k-ct/Makefile
  552. @@ -0,0 +1,80 @@
  553. +include $(TOPDIR)/rules.mk
  554. +
  555. +PKG_NAME:=ath10k-ct
  556. +PKG_VERSION:=2016-07-21
  557. +PKG_RELEASE=1
  558. +
  559. +PKG_LICENSE:=GPLv2
  560. +PKG_LICENSE_FILES:=
  561. +
  562. +PKG_SOURCE_URL:=https://github.com/greearb/ath10k-ct.git
  563. +PKG_SOURCE_PROTO:=git
  564. +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  565. +PKG_SOURCE_VERSION:=a142524abc8eef3ba30b12f9b5ac74385c8ddc39
  566. +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
  567. +
  568. +PKG_MAINTAINER:=Ben Greear <greearb@candelatech.com>
  569. +PKG_BUILD_PARALLEL:=1
  570. +
  571. +STAMP_CONFIGURED_DEPENDS := $(STAGING_DIR)/usr/include/mac80211-backport/backport/autoconf.h
  572. +
  573. +include $(INCLUDE_DIR)/kernel.mk
  574. +include $(INCLUDE_DIR)/package.mk
  575. +
  576. +define KernelPackage/ath10k-ct
  577. + SUBMENU:=Wireless Drivers
  578. + TITLE:=ath10k-ct driver optimized for CT ath10k firmware
  579. + DEPENDS:=+kmod-mac80211 +kmod-ath +@DRIVER_11N_SUPPORT @PCI_SUPPORT
  580. + FILES:=\
  581. + $(PKG_BUILD_DIR)/ath10k/ath10k_pci.ko \
  582. + $(PKG_BUILD_DIR)/ath10k/ath10k_core.ko
  583. + AUTOLOAD:=$(call AutoLoad,50,mac80211 ath ath10k_core ath10k_pci)
  584. +endef
  585. +
  586. +NOSTDINC_FLAGS = \
  587. + -I$(PKG_BUILD_DIR) \
  588. + -I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \
  589. + -I$(STAGING_DIR)/usr/include/mac80211-backport \
  590. + -I$(STAGING_DIR)/usr/include/mac80211/uapi \
  591. + -I$(STAGING_DIR)/usr/include/mac80211 \
  592. + -include backport/autoconf.h \
  593. + -include backport/backport.h
  594. +
  595. +ifdef CONFIG_PACKAGE_MAC80211_MESH
  596. + NOSTDINC_FLAGS += -DCONFIG_MAC80211_MESH
  597. +endif
  598. +
  599. +CT_MAKEDEFS += CONFIG_ATH10K=m CONFIG_ATH10K_PCI=m
  600. +# No AHB support enabled yet. Could conditionally enable it later.
  601. +#CT_MAKEDEFS += CONFIG_ATH10K_AHB=y
  602. +#NOSTDINC_FLAGS += -DCONFIG_ATH10K_AHB
  603. +NOSTDINC_FLAGS += -DSTANDALONE_CT
  604. +
  605. +ifdef CONFIG_PACKAGE_MAC80211_DEBUGFS
  606. + CT_MAKEDEFS += CONFIG_ATH10K_DEBUGFS=y CONFIG_MAC80211_DEBUGFS=y
  607. + NOSTDINC_FLAGS += -DCONFIG_MAC80211_DEBUGFS
  608. + NOSTDINC_FLAGS += -DCONFIG_ATH10K_DEBUGFS
  609. +endif
  610. +
  611. +ifdef CONFIG_PACKAGE_ATH_DEBUG
  612. + NOSTDINC_FLAGS += -DCONFIG_ATH10K_DEBUG
  613. +endif
  614. +
  615. +define Build/Configure
  616. + cp $(STAGING_DIR)/usr/include/mac80211/ath/*.h $(PKG_BUILD_DIR)
  617. +endef
  618. +
  619. +ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
  620. + CT_MAKEDEFS += V=1
  621. +endif
  622. +
  623. +define Build/Compile
  624. + +$(MAKE) $(CT_MAKEDEFS) $(PKG_JOBS) -C "$(LINUX_DIR)" \
  625. + ARCH="$(LINUX_KARCH)" \
  626. + CROSS_COMPILE="$(TARGET_CROSS)" \
  627. + SUBDIRS="$(PKG_BUILD_DIR)/ath10k" \
  628. + NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \
  629. + modules
  630. +endef
  631. +
  632. +$(eval $(call KernelPackage,ath10k-ct))
  633. diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile
  634. index 30da1cf..f2839cd 100644
  635. --- a/package/kernel/mac80211/Makefile
  636. +++ b/package/kernel/mac80211/Makefile
  637. @@ -10,20 +10,21 @@ include $(INCLUDE_DIR)/kernel.mk
  638. PKG_NAME:=mac80211
  639. -PKG_VERSION:=2016-01-10
  640. +PKG_VERSION:=2016-06-20
  641. PKG_RELEASE:=1
  642. PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources
  643. PKG_BACKPORT_VERSION:=
  644. -PKG_MD5SUM:=be5fae2e8d6f7490f9b073374fb895ba
  645. +PKG_MD5SUM:=29c79bdc3928ef5113b17042ebda9237
  646. PKG_SOURCE:=compat-wireless-$(PKG_VERSION)$(PKG_BACKPORT_VERSION).tar.bz2
  647. PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/compat-wireless-$(PKG_VERSION)
  648. PKG_BUILD_PARALLEL:=1
  649. -PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  650. +PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  651. PKG_DRIVERS = \
  652. adm8211 \
  653. + airo \
  654. ath ath5k ath9k ath9k-common ath9k-htc ath10k \
  655. b43 b43legacy \
  656. carl9170 \
  657. @@ -52,6 +53,7 @@ PKG_CONFIG_DEPENDS:= \
  658. $(patsubst %,CONFIG_PACKAGE_kmod-%,$(PKG_DRIVERS)) \
  659. CONFIG_PACKAGE_MAC80211_DEBUGFS \
  660. CONFIG_PACKAGE_MAC80211_MESH \
  661. + CONFIG_PACKAGE_MAC80211_TRACING \
  662. CONFIG_PACKAGE_ATH_DEBUG \
  663. CONFIG_PACKAGE_ATH_DFS \
  664. CONFIG_PACKAGE_B43_DEBUG \
  665. @@ -63,7 +65,12 @@ PKG_CONFIG_DEPENDS:= \
  666. CONFIG_PACKAGE_B43_BUSES_BCMA_AND_SSB \
  667. CONFIG_PACKAGE_B43_BUSES_BCMA \
  668. CONFIG_PACKAGE_B43_BUSES_SSB \
  669. + CONFIG_PACKAGE_BRCM80211_DEBUG \
  670. + CONFIG_PACKAGE_IWLWIFI_DEBUG \
  671. + CONFIG_PACKAGE_IWLWIFI_DEBUGFS \
  672. CONFIG_PACKAGE_RTLWIFI_DEBUG \
  673. + CONFIG_ATH9K_SUPPORT_PCOEM \
  674. + CONFIG_ATH9K_TX99 \
  675. CONFIG_ATH_USER_REGD \
  676. include $(INCLUDE_DIR)/package.mk
  677. @@ -73,7 +80,7 @@ WMENU:=Wireless Drivers
  678. define KernelPackage/mac80211/Default
  679. SUBMENU:=$(WMENU)
  680. URL:=https://wireless.wiki.kernel.org/
  681. - MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  682. + MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  683. endef
  684. define KernelPackage/cfg80211
  685. @@ -92,7 +99,7 @@ endef
  686. define KernelPackage/mac80211
  687. $(call KernelPackage/mac80211/Default)
  688. TITLE:=Linux 802.11 Wireless Networking Stack
  689. - DEPENDS+= +kmod-cfg80211 +hostapd-common +kmod-crypto-core +kmod-crypto-arc4
  690. + DEPENDS+= +kmod-cfg80211 +hostapd-common
  691. KCONFIG:=\
  692. CONFIG_AVERAGE=y
  693. FILES:= $(PKG_BUILD_DIR)/net/mac80211/mac80211.ko
  694. @@ -138,10 +145,23 @@ define KernelPackage/adm8211
  695. AUTOLOAD:=$(call AutoProbe,adm8211)
  696. endef
  697. +define KernelPackage/airo
  698. + $(call KernelPackage/mac80211/Default)
  699. + TITLE:=Cisco Aironet driver
  700. + DEPENDS+=@PCI_SUPPORT +@DRIVER_WEXT_SUPPORT +kmod-cfg80211 @TARGET_x86
  701. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/cisco/airo.ko
  702. + AUTOLOAD:=$(call AutoProbe,airo)
  703. +endef
  704. +
  705. +define KernelPackage/airo/description
  706. + Kernel support for Cisco Aironet cards
  707. +endef
  708. +
  709. define KernelPackage/ath/config
  710. if PACKAGE_kmod-ath
  711. config ATH_USER_REGD
  712. bool "Force Atheros drivers to respect the user's regdomain settings"
  713. + default y
  714. help
  715. Atheros' idea of regulatory handling is that the EEPROM of the card defines
  716. the regulatory limits and the user is only allowed to restrict the settings
  717. @@ -199,6 +219,7 @@ define KernelPackage/ath9k-common
  718. $(call KernelPackage/mac80211/Default)
  719. TITLE:=Atheros 802.11n wireless devices (common code for ath9k and ath9k_htc)
  720. URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
  721. + HIDDEN:=1
  722. DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT +@KERNEL_RELAY
  723. FILES:= \
  724. $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_common.ko \
  725. @@ -226,6 +247,10 @@ define KernelPackage/ath9k/config
  726. bool "Support chips used in PC OEM cards"
  727. depends on PACKAGE_kmod-ath9k
  728. + config ATH9K_TX99
  729. + bool "Enable TX99 support"
  730. + depends on PACKAGE_kmod-ath9k
  731. +
  732. endef
  733. define KernelPackage/ath9k-htc
  734. @@ -247,7 +272,7 @@ define KernelPackage/ath10k
  735. $(call KernelPackage/mac80211/Default)
  736. TITLE:=Atheros 802.11ac wireless cards support
  737. URL:=https://wireless.wiki.kernel.org/en/users/Drivers/ath10k
  738. - DEPENDS+= @PCI_SUPPORT +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT +@KERNEL_RELAY +ath10k-firmware-qca988x
  739. + DEPENDS+= @PCI_SUPPORT +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT +@KERNEL_RELAY
  740. FILES:= \
  741. $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_core.ko \
  742. $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_pci.ko
  743. @@ -673,6 +698,7 @@ define KernelPackage/brcmfmac/config
  744. config BRCMFMAC_SDIO
  745. bool "Enable SDIO bus interface support"
  746. + default y if TARGET_brcm2708
  747. default n
  748. help
  749. Enable support for cards attached to an SDIO bus.
  750. @@ -761,7 +787,7 @@ endef
  751. define KernelPackage/iwlwifi
  752. $(call KernelPackage/mac80211/Default)
  753. - DEPENDS:= +kmod-mac80211 @PCI_SUPPORT +@DRIVER_11N_SUPPORT +iwlwifi-firmware
  754. + DEPENDS:= +kmod-mac80211 @PCI_SUPPORT +@DRIVER_11N_SUPPORT +iwlwifi-firmware @!LINUX_3_18
  755. TITLE:=Intel AGN Wireless support
  756. FILES:= \
  757. $(PKG_BUILD_DIR)/drivers/net/wireless/intel/iwlwifi/iwlwifi.ko \
  758. @@ -870,7 +896,7 @@ endef
  759. define KernelPackage/lib80211
  760. $(call KernelPackage/mac80211/Default)
  761. TITLE:=802.11 Networking stack
  762. - DEPENDS:=+kmod-cfg80211
  763. + DEPENDS:=+kmod-cfg80211 +kmod-crypto-hash
  764. FILES:= \
  765. $(PKG_BUILD_DIR)/net/wireless/lib80211.ko \
  766. $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_wep.ko \
  767. @@ -897,7 +923,7 @@ endef
  768. define KernelPackage/libipw
  769. $(call KernelPackage/mac80211/Default)
  770. TITLE:=libipw for ipw2100 and ipw2200
  771. - DEPENDS:=@PCI_SUPPORT +kmod-crypto-michael-mic +kmod-crypto-core +kmod-crypto-arc4 +kmod-lib80211 +kmod-cfg80211 +@DRIVER_WEXT_SUPPORT @!BIG_ENDIAN
  772. + DEPENDS:=@PCI_SUPPORT +kmod-crypto-michael-mic +kmod-lib80211 +kmod-cfg80211 +@DRIVER_WEXT_SUPPORT @!BIG_ENDIAN
  773. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intel/ipw2x00/libipw.ko
  774. AUTOLOAD:=$(call AutoProbe,libipw)
  775. endef
  776. @@ -978,7 +1004,7 @@ endef
  777. define KernelPackage/libertas-spi
  778. $(call KernelPackage/mac80211/Default)
  779. SUBMENU:=Wireless Drivers
  780. - DEPENDS+= +kmod-cfg80211 +kmod-lib80211 +@DRIVER_WEXT_SUPPORT +libertas-spi-firmware
  781. + DEPENDS+= +kmod-cfg80211 +kmod-lib80211 +@DRIVER_WEXT_SUPPORT @!TARGET_uml +libertas-spi-firmware
  782. KCONFIG := \
  783. CONFIG_SPI=y \
  784. CONFIG_SPI_MASTER=y
  785. @@ -1036,33 +1062,6 @@ define KernelPackage/mwifiex-pcie/description
  786. Kernel modules for Marvell 802.11n/802.11ac PCIe Wireless cards
  787. endef
  788. -
  789. -# Prism54 drivers
  790. -P54PCIFW:=2.13.12.0.arm
  791. -P54USBFW:=2.13.24.0.lm87.arm
  792. -P54SPIFW:=2.13.0.0.a.13.14.arm
  793. -
  794. -define Download/p54usb
  795. - FILE:=$(P54USBFW)
  796. - URL:=http://daemonizer.de/prism54/prism54-fw/fw-usb
  797. - MD5SUM:=8e8ab005a4f8f0123bcdc51bc25b47f6
  798. -endef
  799. -$(eval $(call Download,p54usb))
  800. -
  801. -define Download/p54pci
  802. - FILE:=$(P54PCIFW)
  803. - URL:=http://daemonizer.de/prism54/prism54-fw/fw-softmac
  804. - MD5SUM:=ff7536af2092b1c4b21315bd103ef4c4
  805. -endef
  806. -$(eval $(call Download,p54pci))
  807. -
  808. -define Download/p54spi
  809. - FILE:=$(P54SPIFW)
  810. - URL:=http://daemonizer.de/prism54/prism54-fw/stlc4560
  811. - MD5SUM:=42661f8ecbadd88012807493f596081d
  812. -endef
  813. -$(eval $(call Download,p54spi))
  814. -
  815. define KernelPackage/p54/Default
  816. $(call KernelPackage/mac80211/Default)
  817. TITLE:=Prism54 Drivers
  818. @@ -1082,7 +1081,7 @@ endef
  819. define KernelPackage/p54-pci
  820. $(call KernelPackage/p54/Default)
  821. TITLE+= (PCI)
  822. - DEPENDS+= @PCI_SUPPORT +kmod-p54-common
  823. + DEPENDS+= @PCI_SUPPORT +kmod-p54-common +p54-pci-firmware
  824. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/p54/p54pci.ko
  825. AUTOLOAD:=$(call AutoProbe,p54pci)
  826. endef
  827. @@ -1090,7 +1089,7 @@ endef
  828. define KernelPackage/p54-usb
  829. $(call KernelPackage/p54/Default)
  830. TITLE+= (USB)
  831. - DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-p54-common
  832. + DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-p54-common +p54-usb-firmware
  833. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/p54/p54usb.ko
  834. AUTOLOAD:=$(call AutoProbe,p54usb)
  835. endef
  836. @@ -1098,7 +1097,7 @@ endef
  837. define KernelPackage/p54-spi
  838. $(call KernelPackage/p54/Default)
  839. TITLE+= (SPI)
  840. - DEPENDS+= @TARGET_omap24xx +kmod-p54-common
  841. + DEPENDS+= @TARGET_omap24xx +kmod-p54-common +p54-spi-firmware
  842. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/p54/p54spi.ko
  843. AUTOLOAD:=$(call AutoProbe,p54spi)
  844. endef
  845. @@ -1453,6 +1452,7 @@ config-y:= \
  846. WLAN_VENDOR_ATH \
  847. WLAN_VENDOR_ATMEL \
  848. WLAN_VENDOR_BROADCOM \
  849. + WLAN_VENDOR_CISCO \
  850. WLAN_VENDOR_INTEL \
  851. WLAN_VENDOR_INTERSIL \
  852. WLAN_VENDOR_MARVELL \
  853. @@ -1491,6 +1491,8 @@ endif
  854. config-$(call config_package,lib80211) += LIB80211 LIB80211_CRYPT_WEP LIB80211_CRYPT_CCMP LIB80211_CRYPT_TKIP
  855. +config-$(call config_package,airo) += AIRO
  856. +
  857. config-$(call config_package,ath) += ATH_CARDS ATH_COMMON
  858. config-$(CONFIG_PACKAGE_ATH_DEBUG) += ATH_DEBUG ATH10K_DEBUG
  859. config-$(CONFIG_PACKAGE_ATH_DFS) += ATH9K_DFS_CERTIFIED ATH10K_DFS_CERTIFIED
  860. @@ -1501,6 +1503,7 @@ config-$(CONFIG_TARGET_ar71xx) += ATH9K_AHB
  861. config-$(CONFIG_PCI) += ATH9K_PCI
  862. config-$(CONFIG_ATH_USER_REGD) += ATH_USER_REGD
  863. config-$(CONFIG_ATH9K_SUPPORT_PCOEM) += ATH9K_PCOEM
  864. +config-$(CONFIG_ATH9K_TX99) += ATH9K_TX99
  865. config-$(call config_package,ath9k-htc) += ATH9K_HTC
  866. config-$(call config_package,ath10k) += ATH10K ATH10K_PCI
  867. @@ -1742,21 +1745,6 @@ define KernelPackage/ipw2200/install
  868. $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(IPW2200_NAME)-$(IPW2200_VERSION)/ipw2200*.fw $(1)/lib/firmware
  869. endef
  870. -define KernelPackage/p54-pci/install
  871. - $(INSTALL_DIR) $(1)/lib/firmware
  872. - $(INSTALL_DATA) $(DL_DIR)/$(P54PCIFW) $(1)/lib/firmware/isl3886pci
  873. -endef
  874. -
  875. -define KernelPackage/p54-usb/install
  876. - $(INSTALL_DIR) $(1)/lib/firmware
  877. - $(INSTALL_DATA) $(DL_DIR)/$(P54USBFW) $(1)/lib/firmware/isl3887usb
  878. -endef
  879. -
  880. -define KernelPackage/p54-spi/install
  881. - $(INSTALL_DIR) $(1)/lib/firmware
  882. - $(INSTALL_DATA) $(DL_DIR)/$(P54SPIFW) $(1)/lib/firmware/3826.arm
  883. -endef
  884. -
  885. define KernelPackage/zd1211rw/install
  886. $(INSTALL_DIR) $(1)/lib/firmware/zd1211
  887. $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(ZD1211FW_NAME)/zd1211* $(1)/lib/firmware/zd1211
  888. @@ -1764,6 +1752,7 @@ endef
  889. $(eval $(call KernelPackage,adm8211))
  890. +$(eval $(call KernelPackage,airo))
  891. $(eval $(call KernelPackage,ath))
  892. $(eval $(call KernelPackage,ath10k))
  893. $(eval $(call KernelPackage,ath5k))
  894. diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
  895. index fb2f928..e3d612e 100644
  896. --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
  897. +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
  898. @@ -23,6 +23,7 @@ drv_mac80211_init_device_config() {
  899. config_add_int rxantenna txantenna antenna_gain txpower distance
  900. config_add_boolean noscan ht_coex
  901. config_add_array ht_capab
  902. + config_add_array channels
  903. config_add_boolean \
  904. rxldpc \
  905. short_gi_80 \
  906. @@ -89,6 +90,7 @@ mac80211_hostapd_setup_base() {
  907. json_select config
  908. [ "$auto_channel" -gt 0 ] && channel=acs_survey
  909. + [ "$auto_channel" -gt 0 ] && json_get_values channel_list channels
  910. json_get_vars noscan ht_coex
  911. json_get_values ht_capab_list ht_capab
  912. @@ -218,7 +220,6 @@ mac80211_hostapd_setup_base() {
  913. vht_max_a_mpdu_len_exp:7 \
  914. vht_max_mpdu:11454 \
  915. rx_stbc:4 \
  916. - tx_stbc:4 \
  917. vht_link_adapt:3 \
  918. vht160:2
  919. @@ -230,13 +231,13 @@ mac80211_hostapd_setup_base() {
  920. cap_rx_stbc=$((($vht_cap >> 8) & 7))
  921. [ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc="$rx_stbc"
  922. - ht_cap_mask="$(( ($vht_cap & ~(0x700)) | ($cap_rx_stbc << 8) ))"
  923. + vht_cap="$(( ($vht_cap & ~(0x700)) | ($cap_rx_stbc << 8) ))"
  924. mac80211_add_capabilities vht_capab $vht_cap \
  925. RXLDPC:0x10::$rxldpc \
  926. SHORT-GI-80:0x20::$short_gi_80 \
  927. SHORT-GI-160:0x40::$short_gi_160 \
  928. - TX-STBC-2BY1:0x80::$tx_stbc \
  929. + TX-STBC-2BY1:0x80::$tx_stbc_2by1 \
  930. SU-BEAMFORMER:0x800::$su_beamformer \
  931. SU-BEAMFORMEE:0x1000::$su_beamformee \
  932. MU-BEAMFORMER:0x80000::$mu_beamformer \
  933. @@ -245,10 +246,10 @@ mac80211_hostapd_setup_base() {
  934. HTC-VHT:0x400000::$htc_vht \
  935. RX-ANTENNA-PATTERN:0x10000000::$rx_antenna_pattern \
  936. TX-ANTENNA-PATTERN:0x20000000::$tx_antenna_pattern \
  937. - RX-STBC1:0x700:0x100:1 \
  938. - RX-STBC12:0x700:0x200:1 \
  939. - RX-STBC123:0x700:0x300:1 \
  940. - RX-STBC1234:0x700:0x400:1 \
  941. + RX-STBC-1:0x700:0x100:1 \
  942. + RX-STBC-12:0x700:0x200:1 \
  943. + RX-STBC-123:0x700:0x300:1 \
  944. + RX-STBC-1234:0x700:0x400:1 \
  945. # supported Channel widths
  946. vht160_hw=0
  947. @@ -301,6 +302,7 @@ mac80211_hostapd_setup_base() {
  948. hostapd_prepare_device_config "$hostapd_conf_file" nl80211
  949. cat >> "$hostapd_conf_file" <<EOF
  950. ${channel:+channel=$channel}
  951. +${channel_list:+chanlist=$channel_list}
  952. ${noscan:+noscan=$noscan}
  953. $base_cfg
  954. @@ -391,11 +393,10 @@ mac80211_generate_mac() {
  955. find_phy() {
  956. [ -n "$phy" -a -d /sys/class/ieee80211/$phy ] && return 0
  957. [ -n "$path" ] && {
  958. - for phy in /sys/devices/$path/ieee80211/phy*; do
  959. - [ -e "$phy" ] && {
  960. - phy="${phy##*/}"
  961. - return 0
  962. - }
  963. + for phy in $(ls /sys/class/ieee80211 2>/dev/null); do
  964. + case "$(readlink -f /sys/class/ieee80211/$phy/device)" in
  965. + *$path) return 0;;
  966. + esac
  967. done
  968. }
  969. [ -n "$macaddr" ] && {
  970. @@ -481,7 +482,7 @@ mac80211_prepare_vif() {
  971. # All interfaces must have unique mac addresses
  972. # which can either be explicitly set in the device
  973. # section, or automatically generated
  974. - ifconfig "$ifname" hw ether "$macaddr"
  975. + ip link set dev "$ifname" address "$macaddr"
  976. fi
  977. json_select ..
  978. @@ -496,7 +497,7 @@ mac80211_setup_supplicant() {
  979. mac80211_setup_adhoc_htmode() {
  980. case "$htmode" in
  981. VHT20|HT20) ibss_htmode=HT20;;
  982. - HT40*|VHT40|VHT80|VHT160)
  983. + HT40*|VHT40|VHT160)
  984. case "$hwmode" in
  985. a)
  986. case "$(( ($channel / 4) % 2 ))" in
  987. @@ -520,6 +521,9 @@ mac80211_setup_adhoc_htmode() {
  988. esac
  989. [ "$auto_channel" -gt 0 ] && ibss_htmode="HT40+"
  990. ;;
  991. + VHT80)
  992. + ibss_htmode="80MHZ"
  993. + ;;
  994. NONE|NOHT)
  995. ibss_htmode="NOHT"
  996. ;;
  997. @@ -580,7 +584,7 @@ mac80211_setup_vif() {
  998. json_get_vars mode
  999. json_get_var vif_txpower txpower
  1000. - ifconfig "$ifname" up || {
  1001. + ip link set dev "$ifname" up || {
  1002. wireless_setup_vif_failed IFUP_ERROR
  1003. json_select ..
  1004. return
  1005. @@ -643,7 +647,7 @@ mac80211_interface_cleanup() {
  1006. local phy="$1"
  1007. for wdev in $(list_phy_interfaces "$phy"); do
  1008. - ifconfig "$wdev" down 2>/dev/null
  1009. + ip link set dev "$wdev" down 2>/dev/null
  1010. iw dev "$wdev" del
  1011. done
  1012. }
  1013. diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
  1014. index ea229d6..06f3b8b 100644
  1015. --- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh
  1016. +++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
  1017. @@ -9,11 +9,10 @@ lookup_phy() {
  1018. local devpath
  1019. config_get devpath "$device" path
  1020. [ -n "$devpath" ] && {
  1021. - for _phy in /sys/devices/$devpath/ieee80211/phy*; do
  1022. - [ -e "$_phy" ] && {
  1023. - phy="${_phy##*/}"
  1024. - return
  1025. - }
  1026. + for phy in $(ls /sys/class/ieee80211 2>/dev/null); do
  1027. + case "$(readlink -f /sys/class/ieee80211/$phy/device)" in
  1028. + *$devpath) return;;
  1029. + esac
  1030. done
  1031. }
  1032. @@ -102,6 +101,9 @@ detect_mac80211() {
  1033. fi
  1034. if [ -n "$path" ]; then
  1035. path="${path##/sys/devices/}"
  1036. + case "$path" in
  1037. + platform*/pci*) path="${path##platform/}";;
  1038. + esac
  1039. dev_id=" option path '$path'"
  1040. else
  1041. dev_id=" option macaddr $(cat /sys/class/ieee80211/${dev}/macaddress)"
  1042. diff --git a/package/kernel/mac80211/files/regdb.txt b/package/kernel/mac80211/files/regdb.txt
  1043. index 463ace3..c4a9b2d 100644
  1044. --- a/package/kernel/mac80211/files/regdb.txt
  1045. +++ b/package/kernel/mac80211/files/regdb.txt
  1046. @@ -136,19 +136,35 @@ country BF: DFS-FCC
  1047. (5490 - 5730 @ 160), (24), DFS
  1048. (5735 - 5835 @ 80), (30)
  1049. +# Bulgarian rules as defined by the Communications Regulation Commission in the
  1050. +# following documents:
  1051. +#
  1052. +# Rules for carrying out electronic communications through radio equipment using
  1053. +# radio spectrum, which does not need to be individually assigned (the Rules):
  1054. +# http://www.crc.bg/files/_bg/Pravila_09_06_2015.pdf
  1055. +#
  1056. +# List of radio equipment that uses harmonized within the European Union bands
  1057. +# and electronic communications terminal equipment (the List):
  1058. +# http://www.crc.bg/files/_bg/Spisak_2015.pdf
  1059. +#
  1060. +# Note: The transmit power limits in the 5250-5350 MHz and 5470-5725 MHz bands
  1061. +# can be raised by 3 dBm if TPC is enabled. Refer to BDS EN 301 893 for details.
  1062. country BG: DFS-ETSI
  1063. + # Wideband data transmission systems (WDTS) in the 2.4GHz ISM band, ref:
  1064. + # I.22 of the List, BDS EN 300 328
  1065. (2402 - 2482 @ 40), (20)
  1066. - (5170 - 5250 @ 80), (20), AUTO-BW
  1067. + # 5 GHz Radio Local Area Networks (RLANs), ref:
  1068. + # II.H01 of the List, BDS EN 301 893
  1069. + (5170 - 5250 @ 80), (23), AUTO-BW
  1070. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  1071. + # II.H01 of the List, I.54 from the List, BDS EN 301 893
  1072. (5490 - 5710 @ 160), (27), DFS
  1073. - # 5 GHz Short Range Devices, ref:
  1074. - # Etsi EN 300 440-1
  1075. - # Etsi EN 300 440-2
  1076. - # http://crc.bg/files/_bg/Spisak_2015.pdf
  1077. - # http://crc.bg/files/_bg/Pravila_2015_resh24.pdf
  1078. + # Short range devices (SRDs) in the 5725-5875 MHz frequency range, ref:
  1079. + # I.43 of the List, BDS EN 300 440-2, BDS EN 300 440-1
  1080. (5725 - 5875 @ 80), (14)
  1081. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  1082. - (57000 - 66000 @ 2160), (40)
  1083. + # 60 GHz Multiple-Gigabit RLAN Systems, ref:
  1084. + # II.H03 of the List, BDS EN 302 567-2
  1085. + (57000 - 66000 @ 2160), (40), NO-OUTDOOR
  1086. country BH: DFS-JP
  1087. (2402 - 2482 @ 40), (20)
  1088. @@ -275,6 +291,12 @@ country CR: DFS-FCC
  1089. (5490 - 5730 @ 20), (24), DFS
  1090. (5735 - 5835 @ 20), (30)
  1091. +# http://www.mincom.gob.cu/?q=marcoregulatorio
  1092. +# - Redes Informáticas
  1093. +# Resolución 127, 2011 - Reglamento Banda 2,4 GHz.
  1094. +country CU: DFS-FCC
  1095. + (2400 - 2483.5 @ 40), (200 mW)
  1096. +
  1097. country CX: DFS-FCC
  1098. (2402 - 2482 @ 40), (20)
  1099. (5170 - 5250 @ 80), (24), AUTO-BW
  1100. @@ -302,28 +324,41 @@ country CZ: DFS-ETSI
  1101. # 60 GHz band channels 1-4, ref: Etsi En 302 567
  1102. (57000 - 66000 @ 2160), (40)
  1103. -# Data from "Frequenznutzungsplan" (as published in April 2008), downloaded from
  1104. -# http://www.bundesnetzagentur.de/cae/servlet/contentblob/38448/publicationFile/2659/Frequenznutzungsplan2008_Id17448pdf.pdf
  1105. -# For the 5GHz range also see
  1106. -# http://www.bundesnetzagentur.de/cae/servlet/contentblob/38216/publicationFile/6579/WLAN5GHzVfg7_2010_28042010pdf.pdf
  1107. -# The values have been reduced by a factor of 2 (3db) for non TPC devices
  1108. -# (in other words: devices with TPC can use twice the tx power of this table).
  1109. -# Note that the docs do not require TPC for 5150--5250; the reduction to
  1110. -# 100mW thus is not strictly required -- however the conservative 100mW
  1111. +# Allocation for the 2.4 GHz band (Vfg 10 / 2013, Allgemeinzuteilung von
  1112. +# Frequenzen für die Nutzung in lokalen Netzwerken; Wireless Local Area
  1113. +# Networks (WLAN-Funkanwendungen).
  1114. +# https://www.bundesnetzagentur.de/SharedDocs/Downloads/DE/Sachgebiete/Telekommunikation/Unternehmen_Institutionen/Frequenzen/Allgemeinzuteilungen/2013_10_WLAN_2,4GHz_pdf.pdf
  1115. +#
  1116. +# Allocation for the 5 GHz band (Vfg. 7 / 2010, Allgemeinzuteilung von
  1117. +# Frequenzen in den Bereichen 5150 MHz - 5350 MHz und 5470 MHz - 5725 MHz für
  1118. +# Funkanwendungen zur breitbandigen Datenübertragung, WAS/WLAN („Wireless
  1119. +# Access Systems including Wireless Local Area Networks“).
  1120. +# https://www.bundesnetzagentur.de/SharedDocs/Downloads/DE/Sachgebiete/Telekommunikation/Unternehmen_Institutionen/Frequenzen/Allgemeinzuteilungen/2010_07_WLAN_5GHz_pdf.pdf
  1121. +# The values for the 5 GHz have been reduced by a factor of 2 (3db) for non TPC
  1122. +# devices (in other words: devices with TPC can use twice the tx power of this
  1123. +# table). Note that the docs do not require TPC for 5150--5250; the reduction
  1124. +# to 100mW thus is not strictly required -- however the conservative 100mW
  1125. # limit is used here as the non-interference with radar and satellite
  1126. # apps relies on the attenuation by the building walls only in the
  1127. # absence of DFS; the neighbour countries have 100mW limit here as well.
  1128. +#
  1129. +# The ETSI EN 300 440-1 standard for short range devices in the 5 GHz band has
  1130. +# been implemented in Germany:
  1131. +# https://www.bundesnetzagentur.de/SharedDocs/Downloads/DE/Sachgebiete/Telekommunikation/Unternehmen_Institutionen/Frequenzen/Allgemeinzuteilungen/2014_69_SRD_pdf.pdf
  1132. +#
  1133. +# Allocation for the 60 GHz band (Allgemeinzuteilung von Frequenzen im
  1134. +# Bereich 57 GHz - 66 GHz für Funkanwendungen für weitbandige
  1135. +# Datenübertragungssysteme; „Multiple Gigabit WAS/RLAN Systems (MGWS)“).
  1136. +# https://www.bundesnetzagentur.de/SharedDocs/Downloads/DE/Sachgebiete/Telekommunikation/Unternehmen_Institutionen/Frequenzen/Allgemeinzuteilungen/2011_08_MGWS_pdf.pdf
  1137. country DE: DFS-ETSI
  1138. - # entries 279004 and 280006
  1139. (2400 - 2483.5 @ 40), (100 mW)
  1140. - # entry 303005
  1141. (5150 - 5250 @ 80), (100 mW), NO-OUTDOOR, AUTO-BW
  1142. - # entries 304002 and 305002
  1143. (5250 - 5350 @ 80), (100 mW), NO-OUTDOOR, DFS, AUTO-BW
  1144. - # entries 308002, 309001 and 310003
  1145. (5470 - 5725 @ 160), (500 mW), DFS
  1146. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  1147. + # short range devices (ETSI EN 300 440-1)
  1148. + (5725 - 5875 @ 80), (25 mW)
  1149. + # 60 GHz band channels 1-4 (ETSI EN 302 567)
  1150. (57000 - 66000 @ 2160), (40)
  1151. country DK: DFS-ETSI
  1152. @@ -629,6 +664,9 @@ country KR: DFS-JP
  1153. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  1154. (5490 - 5710 @ 160), (30), DFS
  1155. (5735 - 5835 @ 80), (30)
  1156. + # 60 GHz band channels 1-4,
  1157. + # 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
  1158. + (57000 - 66000 @ 2160), (43)
  1159. country KW: DFS-ETSI
  1160. (2402 - 2482 @ 40), (20)
  1161. @@ -844,11 +882,18 @@ country NI: DFS-FCC
  1162. (5490 - 5730 @ 160), (24), DFS
  1163. (5735 - 5835 @ 80), (30)
  1164. +# Regulation on the use of frequency space without a license and
  1165. +# without notification 2015
  1166. +#
  1167. +# http://wetten.overheid.nl/BWBR0036378/2015-03-05
  1168. +
  1169. country NL: DFS-ETSI
  1170. (2402 - 2482 @ 40), (20)
  1171. (5170 - 5250 @ 80), (20), NO-OUTDOOR, AUTO-BW
  1172. (5250 - 5330 @ 80), (20), NO-OUTDOOR, DFS, AUTO-BW
  1173. (5490 - 5710 @ 160), (27), DFS
  1174. + # short range devices (ETSI EN 300 440-1)
  1175. + (5725 - 5875 @ 80), (25 mW)
  1176. # 60 GHz band channels 1-4, ref: Etsi En 302 567
  1177. (57000 - 66000 @ 2160), (40)
  1178. 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
  1179. deleted file mode 100644
  1180. index 9adfd8f..0000000
  1181. --- a/package/kernel/mac80211/patches/004-backports-add-skb_free_frag.patch
  1182. +++ /dev/null
  1183. @@ -1,21 +0,0 @@
  1184. -From: Felix Fietkau <nbd@openwrt.org>
  1185. -Date: Thu, 28 Jan 2016 15:16:35 +0100
  1186. -Subject: [PATCH] backports: add skb_free_frag()
  1187. -
  1188. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  1189. ----
  1190. -
  1191. ---- a/backport-include/linux/skbuff.h
  1192. -+++ b/backport-include/linux/skbuff.h
  1193. -@@ -300,4 +300,11 @@ int skb_ensure_writable(struct sk_buff *
  1194. -
  1195. - #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) */
  1196. -
  1197. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
  1198. -+static inline void skb_free_frag(void *data)
  1199. -+{
  1200. -+ put_page(virt_to_head_page(data));
  1201. -+}
  1202. -+#endif
  1203. -+
  1204. - #endif /* __BACKPORT_SKBUFF_H */
  1205. diff --git a/package/kernel/mac80211/patches/004-fix_duplicate_skcipher_backport.patch b/package/kernel/mac80211/patches/004-fix_duplicate_skcipher_backport.patch
  1206. new file mode 100644
  1207. index 0000000..38b3179
  1208. --- /dev/null
  1209. +++ b/package/kernel/mac80211/patches/004-fix_duplicate_skcipher_backport.patch
  1210. @@ -0,0 +1,11 @@
  1211. +--- a/compat/Makefile
  1212. ++++ b/compat/Makefile
  1213. +@@ -35,8 +35,6 @@ compat-$(CPTCFG_KERNEL_4_6) += backport-
  1214. +
  1215. + compat-$(CPTCFG_BPAUTO_BUILD_CRYPTO_CCM) += crypto-ccm.o
  1216. + compat-$(CPTCFG_BPAUTO_CRYPTO_SKCIPHER) += crypto-skcipher.o
  1217. +-skcipher-objs += crypto-skcipher.o
  1218. +-obj-$(CPTCFG_BPAUTO_CRYPTO_SKCIPHER) += skcipher.o
  1219. + compat-$(CPTCFG_BPAUTO_BUILD_WANT_DEV_COREDUMP) += drivers-base-devcoredump.o
  1220. + compat-$(CPTCFG_BPAUTO_RHASHTABLE) += lib-rhashtable.o
  1221. + cordic-objs += lib-cordic.o
  1222. 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
  1223. new file mode 100644
  1224. index 0000000..29bccc1
  1225. --- /dev/null
  1226. +++ b/package/kernel/mac80211/patches/005-backport_skb_get_hash_perturb.patch
  1227. @@ -0,0 +1,22 @@
  1228. +--- a/backport-include/linux/skbuff.h
  1229. ++++ b/backport-include/linux/skbuff.h
  1230. +@@ -305,6 +305,19 @@ static inline void skb_free_frag(void *d
  1231. + {
  1232. + put_page(virt_to_head_page(data));
  1233. + }
  1234. ++
  1235. ++#include <net/flow_keys.h>
  1236. ++#include <linux/jhash.h>
  1237. ++
  1238. ++static inline u32 skb_get_hash_perturb(struct sk_buff *skb, u32 key)
  1239. ++{
  1240. ++ struct flow_keys keys;
  1241. ++
  1242. ++ skb_flow_dissect(skb, &keys);
  1243. ++ return jhash_3words((__force u32)keys.dst,
  1244. ++ (__force u32)keys.src ^ keys.ip_proto,
  1245. ++ (__force u32)keys.ports, key);
  1246. ++}
  1247. + #endif
  1248. +
  1249. + #endif /* __BACKPORT_SKBUFF_H */
  1250. 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
  1251. deleted file mode 100644
  1252. index 9b672a8..0000000
  1253. --- a/package/kernel/mac80211/patches/005-backports-add-napi_alloc_frag.patch
  1254. +++ /dev/null
  1255. @@ -1,20 +0,0 @@
  1256. -From: Felix Fietkau <nbd@openwrt.org>
  1257. -Date: Thu, 28 Jan 2016 15:19:22 +0100
  1258. -Subject: [PATCH] backports: add napi_alloc_frag
  1259. -
  1260. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  1261. ----
  1262. -
  1263. ---- a/backport-include/linux/netdevice.h
  1264. -+++ b/backport-include/linux/netdevice.h
  1265. -@@ -232,6 +232,10 @@ static inline void backport_unregister_n
  1266. - #define unregister_netdevice_many LINUX_BACKPORT(unregister_netdevice_many)
  1267. - #endif
  1268. -
  1269. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
  1270. -+#define napi_alloc_frag netdev_alloc_frag
  1271. -+#endif
  1272. -+
  1273. - /*
  1274. - * Complicated way of saying: We only backport netdev_rss_key stuff on kernels
  1275. - * that either already have net_get_random_once() (>= 3.13) or where we've been
  1276. diff --git a/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch b/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
  1277. index fd1e1cf..8be5fa1 100644
  1278. --- a/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
  1279. +++ b/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
  1280. @@ -1,6 +1,6 @@
  1281. --- a/.local-symbols
  1282. +++ b/.local-symbols
  1283. -@@ -476,44 +476,6 @@ USB_IPHETH=
  1284. +@@ -481,45 +481,6 @@ USB_IPHETH=
  1285. USB_SIERRA_NET=
  1286. USB_VL600=
  1287. USB_NET_CH9200=
  1288. @@ -37,6 +37,7 @@
  1289. -BCMA_DRIVER_PCI=
  1290. -BCMA_DRIVER_PCI_HOSTMODE=
  1291. -BCMA_DRIVER_MIPS=
  1292. +-BCMA_PFLASH=
  1293. -BCMA_SFLASH=
  1294. -BCMA_NFLASH=
  1295. -BCMA_DRIVER_GMAC_CMN=
  1296. @@ -56,7 +57,7 @@
  1297. return (bus->chipco.dev ? bus->chipco.dev : bus->pcicore.dev);
  1298. #else
  1299. return bus->chipco.dev;
  1300. -@@ -4903,7 +4903,7 @@ static int b43_wireless_core_init(struct
  1301. +@@ -4883,7 +4883,7 @@ static int b43_wireless_core_init(struct
  1302. }
  1303. if (sprom->boardflags_lo & B43_BFL_XTAL_NOSLOW)
  1304. hf |= B43_HF_DSCRQ; /* Disable slowclock requests from ucode. */
  1305. diff --git a/package/kernel/mac80211/patches/080-disable_clk_backport.patch b/package/kernel/mac80211/patches/080-disable_clk_backport.patch
  1306. deleted file mode 100644
  1307. index 3765591..0000000
  1308. --- a/package/kernel/mac80211/patches/080-disable_clk_backport.patch
  1309. +++ /dev/null
  1310. @@ -1,20 +0,0 @@
  1311. ---- a/compat/compat-3.6.c
  1312. -+++ b/compat/compat-3.6.c
  1313. -@@ -147,17 +147,3 @@ int sg_alloc_table_from_pages(struct sg_
  1314. - return 0;
  1315. - }
  1316. - EXPORT_SYMBOL_GPL(sg_alloc_table_from_pages);
  1317. --
  1318. --/* whoopsie ! */
  1319. --#ifndef CONFIG_COMMON_CLK
  1320. --int clk_enable(struct clk *clk)
  1321. --{
  1322. -- return 0;
  1323. --}
  1324. --EXPORT_SYMBOL_GPL(clk_enable);
  1325. --
  1326. --void clk_disable(struct clk *clk)
  1327. --{
  1328. --}
  1329. --EXPORT_SYMBOL_GPL(clk_disable);
  1330. --#endif
  1331. diff --git a/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch b/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
  1332. index 02f46c7..fbe22e5 100644
  1333. --- a/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
  1334. +++ b/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
  1335. @@ -309,7 +309,7 @@
  1336. #endif /* AES_GMAC_H */
  1337. --- a/net/mac80211/key.h
  1338. +++ b/net/mac80211/key.h
  1339. -@@ -84,7 +84,7 @@ struct ieee80211_key {
  1340. +@@ -88,7 +88,7 @@ struct ieee80211_key {
  1341. * Management frames.
  1342. */
  1343. u8 rx_pn[IEEE80211_NUM_TIDS + 1][IEEE80211_CCMP_PN_LEN];
  1344. @@ -320,7 +320,7 @@
  1345. struct {
  1346. --- a/net/mac80211/wpa.c
  1347. +++ b/net/mac80211/wpa.c
  1348. -@@ -307,7 +307,8 @@ ieee80211_crypto_tkip_decrypt(struct iee
  1349. +@@ -304,7 +304,8 @@ ieee80211_crypto_tkip_decrypt(struct iee
  1350. }
  1351. @@ -330,7 +330,7 @@
  1352. {
  1353. __le16 mask_fc;
  1354. int a4_included, mgmt;
  1355. -@@ -337,14 +338,8 @@ static void ccmp_special_blocks(struct s
  1356. +@@ -334,14 +335,8 @@ static void ccmp_special_blocks(struct s
  1357. else
  1358. qos_tid = 0;
  1359. @@ -347,7 +347,7 @@
  1360. /* Nonce: Nonce Flags | A2 | PN
  1361. * Nonce Flags: Priority (b0..b3) | Management (b4) | Reserved (b5..b7)
  1362. -@@ -352,6 +347,8 @@ static void ccmp_special_blocks(struct s
  1363. +@@ -349,6 +344,8 @@ static void ccmp_special_blocks(struct s
  1364. b_0[1] = qos_tid | (mgmt << 4);
  1365. memcpy(&b_0[2], hdr->addr2, ETH_ALEN);
  1366. memcpy(&b_0[8], pn, IEEE80211_CCMP_PN_LEN);
  1367. @@ -356,7 +356,7 @@
  1368. /* AAD (extra authenticate-only data) / masked 802.11 header
  1369. * FC | A1 | A2 | A3 | SC | [A4] | [QC] */
  1370. -@@ -463,7 +460,7 @@ static int ccmp_encrypt_skb(struct ieee8
  1371. +@@ -460,7 +457,7 @@ static int ccmp_encrypt_skb(struct ieee8
  1372. return 0;
  1373. pos += IEEE80211_CCMP_HDR_LEN;
  1374. @@ -365,7 +365,7 @@
  1375. ieee80211_aes_ccm_encrypt(key->u.ccmp.tfm, b_0, aad, pos, len,
  1376. skb_put(skb, mic_len), mic_len);
  1377. -@@ -534,7 +531,7 @@ ieee80211_crypto_ccmp_decrypt(struct iee
  1378. +@@ -537,7 +534,7 @@ ieee80211_crypto_ccmp_decrypt(struct iee
  1379. u8 aad[2 * AES_BLOCK_SIZE];
  1380. u8 b_0[AES_BLOCK_SIZE];
  1381. /* hardware didn't decrypt/verify MIC */
  1382. 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
  1383. index d1d9fbd..3ca166f 100644
  1384. --- a/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch
  1385. +++ b/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch
  1386. @@ -2,7 +2,7 @@ Used for AP+STA support in OpenWrt - preserve AP mode keys across STA reconnects
  1387. --- a/net/mac80211/cfg.c
  1388. +++ b/net/mac80211/cfg.c
  1389. -@@ -846,7 +846,6 @@ static int ieee80211_stop_ap(struct wiph
  1390. +@@ -850,7 +850,6 @@ static int ieee80211_stop_ap(struct wiph
  1391. sdata->u.ap.driver_smps_mode = IEEE80211_SMPS_OFF;
  1392. __sta_info_flush(sdata, true);
  1393. diff --git a/package/kernel/mac80211/patches/150-disable_addr_notifier.patch b/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
  1394. index 2855a88..16fab84 100644
  1395. --- a/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
  1396. +++ b/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
  1397. @@ -18,9 +18,9 @@
  1398. static int ieee80211_ifa6_changed(struct notifier_block *nb,
  1399. unsigned long data, void *arg)
  1400. {
  1401. -@@ -1087,14 +1087,14 @@ int ieee80211_register_hw(struct ieee802
  1402. -
  1403. - rtnl_unlock();
  1404. +@@ -1090,14 +1090,14 @@ int ieee80211_register_hw(struct ieee802
  1405. + if (result)
  1406. + goto fail_flows;
  1407. -#ifdef CONFIG_INET
  1408. +#ifdef __disabled__CONFIG_INET
  1409. @@ -35,7 +35,7 @@
  1410. local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed;
  1411. result = register_inet6addr_notifier(&local->ifa6_notifier);
  1412. if (result)
  1413. -@@ -1103,13 +1103,13 @@ int ieee80211_register_hw(struct ieee802
  1414. +@@ -1106,13 +1106,13 @@ int ieee80211_register_hw(struct ieee802
  1415. return 0;
  1416. @@ -51,8 +51,8 @@
  1417. +#if defined(__disabled__CONFIG_INET) || defined(__disabled__CONFIG_IPV6)
  1418. fail_ifa:
  1419. #endif
  1420. - rtnl_lock();
  1421. -@@ -1137,10 +1137,10 @@ void ieee80211_unregister_hw(struct ieee
  1422. + ieee80211_txq_teardown_flows(local);
  1423. +@@ -1142,10 +1142,10 @@ void ieee80211_unregister_hw(struct ieee
  1424. tasklet_kill(&local->tx_pending_tasklet);
  1425. tasklet_kill(&local->tasklet);
  1426. diff --git a/package/kernel/mac80211/patches/210-ap_scan.patch b/package/kernel/mac80211/patches/210-ap_scan.patch
  1427. index a99cbd2..29f05c4 100644
  1428. --- a/package/kernel/mac80211/patches/210-ap_scan.patch
  1429. +++ b/package/kernel/mac80211/patches/210-ap_scan.patch
  1430. @@ -1,6 +1,6 @@
  1431. --- a/net/mac80211/cfg.c
  1432. +++ b/net/mac80211/cfg.c
  1433. -@@ -1999,7 +1999,7 @@ static int ieee80211_scan(struct wiphy *
  1434. +@@ -2008,7 +2008,7 @@ static int ieee80211_scan(struct wiphy *
  1435. * the frames sent while scanning on other channel will be
  1436. * lost)
  1437. */
  1438. diff --git a/package/kernel/mac80211/patches/220-fq_disable_hack.patch b/package/kernel/mac80211/patches/220-fq_disable_hack.patch
  1439. new file mode 100644
  1440. index 0000000..7f420be
  1441. --- /dev/null
  1442. +++ b/package/kernel/mac80211/patches/220-fq_disable_hack.patch
  1443. @@ -0,0 +1,15 @@
  1444. +mac80211 fq has been found to cause a regression in multi-stream TCP
  1445. +performance. Disable it until the cause has been found and fixed
  1446. +
  1447. +--- a/include/net/fq_impl.h
  1448. ++++ b/include/net/fq_impl.h
  1449. +@@ -104,6 +104,9 @@ static struct fq_flow *fq_flow_classify(
  1450. +
  1451. + lockdep_assert_held(&fq->lock);
  1452. +
  1453. ++ /* HACK: disable fq for now until TCP issues are fixed */
  1454. ++ return get_default_func(fq, tin, 0, skb);
  1455. ++
  1456. + hash = skb_get_hash_perturb(skb, fq->perturbation);
  1457. + idx = reciprocal_scale(hash, fq->flows_cnt);
  1458. + flow = &fq->flows[idx];
  1459. 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
  1460. index bddb15a..098bda7 100644
  1461. --- a/package/kernel/mac80211/patches/300-ath9k-force-rx_clear-when-disabling-rx.patch
  1462. +++ b/package/kernel/mac80211/patches/300-ath9k-force-rx_clear-when-disabling-rx.patch
  1463. @@ -3,15 +3,16 @@ Date: Sun, 7 Jun 2015 13:53:35 +0200
  1464. Subject: [PATCH] ath9k: force rx_clear when disabling rx
  1465. This makes stopping Rx more reliable and should reduce the frequency of
  1466. -Rx related DMA stop warnings
  1467. +Rx related DMA stop warnings. Don't use rx_clear in TX99 mode.
  1468. Cc: stable@vger.kernel.org
  1469. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  1470. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  1471. +Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
  1472. ---
  1473. --- a/drivers/net/wireless/ath/ath9k/mac.c
  1474. +++ b/drivers/net/wireless/ath/ath9k/mac.c
  1475. -@@ -677,13 +677,15 @@ void ath9k_hw_startpcureceive(struct ath
  1476. +@@ -677,13 +677,18 @@ void ath9k_hw_startpcureceive(struct ath
  1477. ath9k_ani_reset(ah, is_scanning);
  1478. @@ -24,8 +25,11 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  1479. void ath9k_hw_abortpcurecv(struct ath_hw *ah)
  1480. {
  1481. - REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_ABORT | AR_DIAG_RX_DIS);
  1482. -+ REG_SET_BIT(ah, AR_DIAG_SW,
  1483. -+ AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT | AR_DIAG_FORCE_RX_CLEAR);
  1484. ++ u32 reg = AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT;
  1485. ++
  1486. ++ if (!config_enabled(CPTCFG_ATH9K_TX99))
  1487. ++ reg |= AR_DIAG_FORCE_RX_CLEAR;
  1488. ++ REG_SET_BIT(ah, AR_DIAG_SW, reg);
  1489. ath9k_hw_disable_mib_counters(ah);
  1490. }
  1491. 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
  1492. new file mode 100644
  1493. index 0000000..7caa9be
  1494. --- /dev/null
  1495. +++ b/package/kernel/mac80211/patches/302-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch
  1496. @@ -0,0 +1,37 @@
  1497. +From: Felix Fietkau <nbd@nbd.name>
  1498. +Date: Sat, 14 May 2016 14:51:02 +0200
  1499. +Subject: [PATCH] Revert "ath9k: interpret requested txpower in EIRP
  1500. + domain"
  1501. +
  1502. +This reverts commit 71f5137bf010c6faffab50c0ec15374c59c4a411.
  1503. +---
  1504. +
  1505. +--- a/drivers/net/wireless/ath/ath9k/hw.c
  1506. ++++ b/drivers/net/wireless/ath/ath9k/hw.c
  1507. +@@ -2914,7 +2914,8 @@ void ath9k_hw_apply_txpower(struct ath_h
  1508. + {
  1509. + struct ath_regulatory *reg = ath9k_hw_regulatory(ah);
  1510. + struct ieee80211_channel *channel;
  1511. +- int chan_pwr, new_pwr;
  1512. ++ int chan_pwr, new_pwr, max_gain;
  1513. ++ int ant_gain, ant_reduction = 0;
  1514. +
  1515. + if (!chan)
  1516. + return;
  1517. +@@ -2922,10 +2923,15 @@ void ath9k_hw_apply_txpower(struct ath_h
  1518. + channel = chan->chan;
  1519. + chan_pwr = min_t(int, channel->max_power * 2, MAX_RATE_POWER);
  1520. + new_pwr = min_t(int, chan_pwr, reg->power_limit);
  1521. ++ max_gain = chan_pwr - new_pwr + channel->max_antenna_gain * 2;
  1522. ++
  1523. ++ ant_gain = get_antenna_gain(ah, chan);
  1524. ++ if (ant_gain > max_gain)
  1525. ++ ant_reduction = ant_gain - max_gain;
  1526. +
  1527. + ah->eep_ops->set_txpower(ah, chan,
  1528. + ath9k_regd_get_ctl(reg, chan),
  1529. +- get_antenna_gain(ah, chan), new_pwr, test);
  1530. ++ ant_reduction, new_pwr, test);
  1531. + }
  1532. +
  1533. + void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test)
  1534. 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
  1535. deleted file mode 100644
  1536. index 22b987a..0000000
  1537. --- a/package/kernel/mac80211/patches/302-ath9k_hw-add-low-power-tx-gain-table-for-AR953x.patch
  1538. +++ /dev/null
  1539. @@ -1,95 +0,0 @@
  1540. -From: Felix Fietkau <nbd@openwrt.org>
  1541. -Date: Thu, 14 Jan 2016 03:14:03 +0100
  1542. -Subject: [PATCH] ath9k_hw: add low power tx gain table for AR953x
  1543. -
  1544. -Used in some newer TP-Link AR9533 devices.
  1545. -
  1546. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  1547. ----
  1548. -
  1549. ---- a/drivers/net/wireless/ath/ath9k/ar9003_hw.c
  1550. -+++ b/drivers/net/wireless/ath/ath9k/ar9003_hw.c
  1551. -@@ -698,6 +698,9 @@ static void ar9003_tx_gain_table_mode2(s
  1552. - else if (AR_SREV_9340(ah))
  1553. - INIT_INI_ARRAY(&ah->iniModesTxGain,
  1554. - ar9340Modes_low_ob_db_tx_gain_table_1p0);
  1555. -+ else if (AR_SREV_9531_11(ah))
  1556. -+ INIT_INI_ARRAY(&ah->iniModesTxGain,
  1557. -+ qca953x_1p1_modes_no_xpa_low_power_tx_gain_table);
  1558. - else if (AR_SREV_9485_11_OR_LATER(ah))
  1559. - INIT_INI_ARRAY(&ah->iniModesTxGain,
  1560. - ar9485Modes_low_ob_db_tx_gain_1_1);
  1561. ---- a/drivers/net/wireless/ath/ath9k/ar953x_initvals.h
  1562. -+++ b/drivers/net/wireless/ath/ath9k/ar953x_initvals.h
  1563. -@@ -757,6 +757,71 @@ static const u32 qca953x_1p1_modes_xpa_t
  1564. - {0x00016448, 0x6c927a70},
  1565. - };
  1566. -
  1567. -+static const u32 qca953x_1p1_modes_no_xpa_low_power_tx_gain_table[][2] = {
  1568. -+ /* Addr allmodes */
  1569. -+ {0x0000a2dc, 0xfff55592},
  1570. -+ {0x0000a2e0, 0xfff99924},
  1571. -+ {0x0000a2e4, 0xfffe1e00},
  1572. -+ {0x0000a2e8, 0xffffe000},
  1573. -+ {0x0000a410, 0x000050d6},
  1574. -+ {0x0000a500, 0x00000069},
  1575. -+ {0x0000a504, 0x0400006b},
  1576. -+ {0x0000a508, 0x0800006d},
  1577. -+ {0x0000a50c, 0x0c000269},
  1578. -+ {0x0000a510, 0x1000026b},
  1579. -+ {0x0000a514, 0x1400026d},
  1580. -+ {0x0000a518, 0x18000669},
  1581. -+ {0x0000a51c, 0x1c00066b},
  1582. -+ {0x0000a520, 0x1d000a68},
  1583. -+ {0x0000a524, 0x21000a6a},
  1584. -+ {0x0000a528, 0x25000a6c},
  1585. -+ {0x0000a52c, 0x29000a6e},
  1586. -+ {0x0000a530, 0x2d0012a9},
  1587. -+ {0x0000a534, 0x310012ab},
  1588. -+ {0x0000a538, 0x350012ad},
  1589. -+ {0x0000a53c, 0x39001b0a},
  1590. -+ {0x0000a540, 0x3d001b0c},
  1591. -+ {0x0000a544, 0x41001b0e},
  1592. -+ {0x0000a548, 0x43001bae},
  1593. -+ {0x0000a54c, 0x45001914},
  1594. -+ {0x0000a550, 0x47001916},
  1595. -+ {0x0000a554, 0x49001b96},
  1596. -+ {0x0000a558, 0x49001b96},
  1597. -+ {0x0000a55c, 0x49001b96},
  1598. -+ {0x0000a560, 0x49001b96},
  1599. -+ {0x0000a564, 0x49001b96},
  1600. -+ {0x0000a568, 0x49001b96},
  1601. -+ {0x0000a56c, 0x49001b96},
  1602. -+ {0x0000a570, 0x49001b96},
  1603. -+ {0x0000a574, 0x49001b96},
  1604. -+ {0x0000a578, 0x49001b96},
  1605. -+ {0x0000a57c, 0x49001b96},
  1606. -+ {0x0000a600, 0x00000000},
  1607. -+ {0x0000a604, 0x00000000},
  1608. -+ {0x0000a608, 0x00000000},
  1609. -+ {0x0000a60c, 0x00000000},
  1610. -+ {0x0000a610, 0x00000000},
  1611. -+ {0x0000a614, 0x00000000},
  1612. -+ {0x0000a618, 0x00804201},
  1613. -+ {0x0000a61c, 0x01408201},
  1614. -+ {0x0000a620, 0x01408502},
  1615. -+ {0x0000a624, 0x01408502},
  1616. -+ {0x0000a628, 0x01408502},
  1617. -+ {0x0000a62c, 0x01408502},
  1618. -+ {0x0000a630, 0x01408502},
  1619. -+ {0x0000a634, 0x01408502},
  1620. -+ {0x0000a638, 0x01408502},
  1621. -+ {0x0000a63c, 0x01408502},
  1622. -+ {0x0000b2dc, 0xfff55592},
  1623. -+ {0x0000b2e0, 0xfff99924},
  1624. -+ {0x0000b2e4, 0xfffe1e00},
  1625. -+ {0x0000b2e8, 0xffffe000},
  1626. -+ {0x00016044, 0x044922db},
  1627. -+ {0x00016048, 0x6c927a70},
  1628. -+ {0x00016444, 0x044922db},
  1629. -+ {0x00016448, 0x6c927a70},
  1630. -+};
  1631. -+
  1632. - static const u32 qca953x_2p0_baseband_core[][2] = {
  1633. - /* Addr allmodes */
  1634. - {0x00009800, 0xafe68e30},
  1635. 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
  1636. new file mode 100644
  1637. index 0000000..73accd8
  1638. --- /dev/null
  1639. +++ b/package/kernel/mac80211/patches/303-ath10k-Ensure-txrx-compl-task-is-stopped-when-cleani.patch
  1640. @@ -0,0 +1,21 @@
  1641. +From: Ben Greear <greearb@candelatech.com>
  1642. +Date: Fri, 1 Apr 2016 14:12:08 -0700
  1643. +Subject: [PATCH] ath10k: Ensure txrx-compl-task is stopped when cleaning
  1644. + htt-tx.
  1645. +
  1646. +Otherwise, the txrx-compl-task may access some bad memory?
  1647. +
  1648. +Signed-off-by: Ben Greear <greearb@candelatech.com>
  1649. +---
  1650. +
  1651. +--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
  1652. ++++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
  1653. +@@ -388,6 +388,8 @@ void ath10k_htt_tx_free(struct ath10k_ht
  1654. + {
  1655. + int size;
  1656. +
  1657. ++ tasklet_kill(&htt->txrx_compl_task);
  1658. ++
  1659. + idr_for_each(&htt->pending_tx, ath10k_htt_tx_clean_up_pending, htt->ar);
  1660. + idr_destroy(&htt->pending_tx);
  1661. +
  1662. 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
  1663. deleted file mode 100644
  1664. index 7bb7435..0000000
  1665. --- a/package/kernel/mac80211/patches/303-rt2x00-fix-monitor-mode-regression.patch
  1666. +++ /dev/null
  1667. @@ -1,156 +0,0 @@
  1668. -From: Eli Cooper <elicooper@gmx.com>
  1669. -Date: Thu, 14 Jan 2016 00:07:12 +0800
  1670. -Subject: [PATCH] rt2x00: fix monitor mode regression
  1671. -
  1672. -Since commit df1404650ccbfeb76a84f301f22316be0d00a864 monitor mode for rt2x00
  1673. -has been made effectively useless because the hardware filter is configured to
  1674. -drop packets whose intended recipient is not the device, regardless of the
  1675. -presence of monitor mode interfaces.
  1676. -
  1677. -This patch fixes this regression by adding explicit monitor mode support, and
  1678. -configuring the hardware filter accordingly.
  1679. -
  1680. -Signed-off-by: Eli Cooper <elicooper@gmx.com>
  1681. ----
  1682. -
  1683. ---- a/drivers/net/wireless/ralink/rt2x00/rt2400pci.c
  1684. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2400pci.c
  1685. -@@ -273,8 +273,10 @@ static void rt2400pci_config_filter(stru
  1686. - !(filter_flags & FIF_PLCPFAIL));
  1687. - rt2x00_set_field32(&reg, RXCSR0_DROP_CONTROL,
  1688. - !(filter_flags & FIF_CONTROL));
  1689. -- rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME, 1);
  1690. -+ rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME,
  1691. -+ !rt2x00dev->is_monitoring);
  1692. - rt2x00_set_field32(&reg, RXCSR0_DROP_TODS,
  1693. -+ !rt2x00dev->is_monitoring &&
  1694. - !rt2x00dev->intf_ap_count);
  1695. - rt2x00_set_field32(&reg, RXCSR0_DROP_VERSION_ERROR, 1);
  1696. - rt2x00mmio_register_write(rt2x00dev, RXCSR0, reg);
  1697. ---- a/drivers/net/wireless/ralink/rt2x00/rt2500pci.c
  1698. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2500pci.c
  1699. -@@ -274,8 +274,10 @@ static void rt2500pci_config_filter(stru
  1700. - !(filter_flags & FIF_PLCPFAIL));
  1701. - rt2x00_set_field32(&reg, RXCSR0_DROP_CONTROL,
  1702. - !(filter_flags & FIF_CONTROL));
  1703. -- rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME, 1);
  1704. -+ rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME,
  1705. -+ !rt2x00dev->is_monitoring);
  1706. - rt2x00_set_field32(&reg, RXCSR0_DROP_TODS,
  1707. -+ !rt2x00dev->is_monitoring &&
  1708. - !rt2x00dev->intf_ap_count);
  1709. - rt2x00_set_field32(&reg, RXCSR0_DROP_VERSION_ERROR, 1);
  1710. - rt2x00_set_field32(&reg, RXCSR0_DROP_MCAST,
  1711. ---- a/drivers/net/wireless/ralink/rt2x00/rt2500usb.c
  1712. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2500usb.c
  1713. -@@ -437,8 +437,10 @@ static void rt2500usb_config_filter(stru
  1714. - !(filter_flags & FIF_PLCPFAIL));
  1715. - rt2x00_set_field16(&reg, TXRX_CSR2_DROP_CONTROL,
  1716. - !(filter_flags & FIF_CONTROL));
  1717. -- rt2x00_set_field16(&reg, TXRX_CSR2_DROP_NOT_TO_ME, 1);
  1718. -+ rt2x00_set_field16(&reg, TXRX_CSR2_DROP_NOT_TO_ME,
  1719. -+ !rt2x00dev->is_monitoring);
  1720. - rt2x00_set_field16(&reg, TXRX_CSR2_DROP_TODS,
  1721. -+ !rt2x00dev->is_monitoring &&
  1722. - !rt2x00dev->intf_ap_count);
  1723. - rt2x00_set_field16(&reg, TXRX_CSR2_DROP_VERSION_ERROR, 1);
  1724. - rt2x00_set_field16(&reg, TXRX_CSR2_DROP_MULTICAST,
  1725. ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  1726. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  1727. -@@ -1490,7 +1490,8 @@ void rt2800_config_filter(struct rt2x00_
  1728. - !(filter_flags & FIF_FCSFAIL));
  1729. - rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_PHY_ERROR,
  1730. - !(filter_flags & FIF_PLCPFAIL));
  1731. -- rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_TO_ME, 1);
  1732. -+ rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_TO_ME,
  1733. -+ !rt2x00dev->is_monitoring);
  1734. - rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_MY_BSSD, 0);
  1735. - rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_VER_ERROR, 1);
  1736. - rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_MULTICAST,
  1737. ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  1738. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  1739. -@@ -844,11 +844,13 @@ struct rt2x00_dev {
  1740. - * - Open sta interface count.
  1741. - * - Association count.
  1742. - * - Beaconing enabled count.
  1743. -+ * - Whether the device is monitoring.
  1744. - */
  1745. - unsigned int intf_ap_count;
  1746. - unsigned int intf_sta_count;
  1747. - unsigned int intf_associated;
  1748. - unsigned int intf_beaconing;
  1749. -+ bool is_monitoring;
  1750. -
  1751. - /*
  1752. - * Interface combinations
  1753. ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00config.c
  1754. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00config.c
  1755. -@@ -244,6 +244,16 @@ void rt2x00lib_config(struct rt2x00_dev
  1756. - (ieee80211_flags & IEEE80211_CONF_CHANGE_PS))
  1757. - cancel_delayed_work_sync(&rt2x00dev->autowakeup_work);
  1758. -
  1759. -+ if (ieee80211_flags & IEEE80211_CONF_CHANGE_MONITOR) {
  1760. -+ if (conf->flags & IEEE80211_CONF_MONITOR) {
  1761. -+ rt2x00_dbg(rt2x00dev, "Monitor mode is enabled\n");
  1762. -+ rt2x00dev->is_monitoring = true;
  1763. -+ } else {
  1764. -+ rt2x00_dbg(rt2x00dev, "Monitor mode is disabled\n");
  1765. -+ rt2x00dev->is_monitoring = false;
  1766. -+ }
  1767. -+ }
  1768. -+
  1769. - /*
  1770. - * Start configuration.
  1771. - */
  1772. ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  1773. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  1774. -@@ -1204,6 +1204,7 @@ int rt2x00lib_start(struct rt2x00_dev *r
  1775. - rt2x00dev->intf_ap_count = 0;
  1776. - rt2x00dev->intf_sta_count = 0;
  1777. - rt2x00dev->intf_associated = 0;
  1778. -+ rt2x00dev->is_monitoring = false;
  1779. -
  1780. - /* Enable the radio */
  1781. - retval = rt2x00lib_enable_radio(rt2x00dev);
  1782. ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
  1783. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
  1784. -@@ -385,11 +385,6 @@ void rt2x00mac_configure_filter(struct i
  1785. - *total_flags |= FIF_PSPOLL;
  1786. - }
  1787. -
  1788. -- /*
  1789. -- * Check if there is any work left for us.
  1790. -- */
  1791. -- if (rt2x00dev->packet_filter == *total_flags)
  1792. -- return;
  1793. - rt2x00dev->packet_filter = *total_flags;
  1794. -
  1795. - rt2x00dev->ops->lib->config_filter(rt2x00dev, *total_flags);
  1796. ---- a/drivers/net/wireless/ralink/rt2x00/rt61pci.c
  1797. -+++ b/drivers/net/wireless/ralink/rt2x00/rt61pci.c
  1798. -@@ -530,8 +530,10 @@ static void rt61pci_config_filter(struct
  1799. - !(filter_flags & FIF_PLCPFAIL));
  1800. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_CONTROL,
  1801. - !(filter_flags & (FIF_CONTROL | FIF_PSPOLL)));
  1802. -- rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME, 1);
  1803. -+ rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME,
  1804. -+ !rt2x00dev->is_monitoring);
  1805. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_TO_DS,
  1806. -+ !rt2x00dev->is_monitoring &&
  1807. - !rt2x00dev->intf_ap_count);
  1808. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_VERSION_ERROR, 1);
  1809. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_MULTICAST,
  1810. ---- a/drivers/net/wireless/ralink/rt2x00/rt73usb.c
  1811. -+++ b/drivers/net/wireless/ralink/rt2x00/rt73usb.c
  1812. -@@ -480,8 +480,10 @@ static void rt73usb_config_filter(struct
  1813. - !(filter_flags & FIF_PLCPFAIL));
  1814. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_CONTROL,
  1815. - !(filter_flags & (FIF_CONTROL | FIF_PSPOLL)));
  1816. -- rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME, 1);
  1817. -+ rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME,
  1818. -+ !rt2x00dev->is_monitoring);
  1819. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_TO_DS,
  1820. -+ !rt2x00dev->is_monitoring &&
  1821. - !rt2x00dev->intf_ap_count);
  1822. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_VERSION_ERROR, 1);
  1823. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_MULTICAST,
  1824. 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
  1825. new file mode 100644
  1826. index 0000000..7dec1fb
  1827. --- /dev/null
  1828. +++ b/package/kernel/mac80211/patches/304-ath10k-Ensure-peer_map-references-are-cleaned-up.patch
  1829. @@ -0,0 +1,60 @@
  1830. +From: Ben Greear <greearb@candelatech.com>
  1831. +Date: Fri, 1 Apr 2016 14:12:09 -0700
  1832. +Subject: [PATCH] ath10k: Ensure peer_map references are cleaned up.
  1833. +
  1834. +While debugging OS crashes due to firmware crashes, I enabled
  1835. +kasan, and it noticed that peer objects were being used-after-freed.
  1836. +
  1837. +Looks like there are two places we could be leaving stale references
  1838. +in the peer-map, so clean that up.
  1839. +
  1840. +Signed-off-by: Ben Greear <greearb@candelatech.com>
  1841. +---
  1842. +
  1843. +--- a/drivers/net/wireless/ath/ath10k/mac.c
  1844. ++++ b/drivers/net/wireless/ath/ath10k/mac.c
  1845. +@@ -802,6 +802,7 @@ static void ath10k_peer_cleanup(struct a
  1846. + {
  1847. + struct ath10k_peer *peer, *tmp;
  1848. + int peer_id;
  1849. ++ int i;
  1850. +
  1851. + lockdep_assert_held(&ar->conf_mutex);
  1852. +
  1853. +@@ -818,6 +819,17 @@ static void ath10k_peer_cleanup(struct a
  1854. + ar->peer_map[peer_id] = NULL;
  1855. + }
  1856. +
  1857. ++ /* Double check that peer is properly un-referenced from
  1858. ++ * the peer_map
  1859. ++ */
  1860. ++ for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) {
  1861. ++ if (ar->peer_map[i] == peer) {
  1862. ++ ath10k_warn(ar, "removing stale peer_map entry for %pM (ptr %p idx %d)\n",
  1863. ++ peer->addr, peer, i);
  1864. ++ ar->peer_map[i] = NULL;
  1865. ++ }
  1866. ++ }
  1867. ++
  1868. + list_del(&peer->list);
  1869. + kfree(peer);
  1870. + ar->num_peers--;
  1871. +@@ -828,6 +840,7 @@ static void ath10k_peer_cleanup(struct a
  1872. + static void ath10k_peer_cleanup_all(struct ath10k *ar)
  1873. + {
  1874. + struct ath10k_peer *peer, *tmp;
  1875. ++ int i;
  1876. +
  1877. + lockdep_assert_held(&ar->conf_mutex);
  1878. +
  1879. +@@ -836,6 +849,10 @@ static void ath10k_peer_cleanup_all(stru
  1880. + list_del(&peer->list);
  1881. + kfree(peer);
  1882. + }
  1883. ++
  1884. ++ for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++)
  1885. ++ ar->peer_map[i] = NULL;
  1886. ++
  1887. + spin_unlock_bh(&ar->data_lock);
  1888. +
  1889. + ar->num_peers = 0;
  1890. 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
  1891. deleted file mode 100644
  1892. index 049059a..0000000
  1893. --- a/package/kernel/mac80211/patches/304-ath9k-avoid-ANI-restart-if-no-trigger.patch
  1894. +++ /dev/null
  1895. @@ -1,32 +0,0 @@
  1896. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  1897. -Date: Fri, 15 Jan 2016 18:17:17 +0800
  1898. -Subject: [PATCH] ath9k: avoid ANI restart if no trigger
  1899. -
  1900. -Fixes commit 54da20d83f0e ("ath9k_hw: improve ANI processing and rx desensitizing parameters")
  1901. -
  1902. -Call ath9k_ani_restart() only when the phy error rate reach the
  1903. -ANI immunity threshold. Sync the logic with internal code base.
  1904. -
  1905. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  1906. ----
  1907. -
  1908. ---- a/drivers/net/wireless/ath/ath9k/ani.c
  1909. -+++ b/drivers/net/wireless/ath/ath9k/ani.c
  1910. -@@ -444,14 +444,16 @@ void ath9k_hw_ani_monitor(struct ath_hw
  1911. - ofdmPhyErrRate < ah->config.ofdm_trig_low) {
  1912. - ath9k_hw_ani_lower_immunity(ah);
  1913. - aniState->ofdmsTurn = !aniState->ofdmsTurn;
  1914. -+ ath9k_ani_restart(ah);
  1915. - } else if (ofdmPhyErrRate > ah->config.ofdm_trig_high) {
  1916. - ath9k_hw_ani_ofdm_err_trigger(ah);
  1917. - aniState->ofdmsTurn = false;
  1918. -+ ath9k_ani_restart(ah);
  1919. - } else if (cckPhyErrRate > ah->config.cck_trig_high) {
  1920. - ath9k_hw_ani_cck_err_trigger(ah);
  1921. - aniState->ofdmsTurn = true;
  1922. -+ ath9k_ani_restart(ah);
  1923. - }
  1924. -- ath9k_ani_restart(ah);
  1925. - }
  1926. - }
  1927. - EXPORT_SYMBOL(ath9k_hw_ani_monitor);
  1928. 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
  1929. new file mode 100644
  1930. index 0000000..7248a8c
  1931. --- /dev/null
  1932. +++ b/package/kernel/mac80211/patches/305-ath10k-Clean-up-peer-when-sta-goes-away.patch
  1933. @@ -0,0 +1,32 @@
  1934. +From: Ben Greear <greearb@candelatech.com>
  1935. +Date: Fri, 1 Apr 2016 14:12:11 -0700
  1936. +Subject: [PATCH] ath10k: Clean up peer when sta goes away.
  1937. +
  1938. +If WMI and/or firmware has issues removing the peer object,
  1939. +then we still need to clean up the peer object in the driver.
  1940. +
  1941. +Signed-off-by: Ben Greear <greearb@candelatech.com>
  1942. +---
  1943. +
  1944. +--- a/drivers/net/wireless/ath/ath10k/mac.c
  1945. ++++ b/drivers/net/wireless/ath/ath10k/mac.c
  1946. +@@ -5992,9 +5992,17 @@ static int ath10k_sta_state(struct ieee8
  1947. + continue;
  1948. +
  1949. + if (peer->sta == sta) {
  1950. +- ath10k_warn(ar, "found sta peer %pM entry on vdev %i after it was supposedly removed\n",
  1951. +- sta->addr, arvif->vdev_id);
  1952. ++ ath10k_warn(ar, "found sta peer %pM (ptr %p id %d) entry on vdev %i after it was supposedly removed\n",
  1953. ++ sta->addr, peer, i, arvif->vdev_id);
  1954. + peer->sta = NULL;
  1955. ++
  1956. ++ /* Clean up the peer object as well since we
  1957. ++ * must have failed to do this above.
  1958. ++ */
  1959. ++ list_del(&peer->list);
  1960. ++ ar->peer_map[i] = NULL;
  1961. ++ kfree(peer);
  1962. ++ ar->num_peers--;
  1963. + }
  1964. + }
  1965. + spin_unlock_bh(&ar->data_lock);
  1966. 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
  1967. deleted file mode 100644
  1968. index a1ac67c..0000000
  1969. --- a/package/kernel/mac80211/patches/305-ath9k-clean-up-ANI-per-channel-pointer-checking.patch
  1970. +++ /dev/null
  1971. @@ -1,91 +0,0 @@
  1972. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  1973. -Date: Fri, 15 Jan 2016 18:17:18 +0800
  1974. -Subject: [PATCH] ath9k: clean up ANI per-channel pointer checking
  1975. -
  1976. -commit c24bd3620c50 ("ath9k: Do not maintain ANI state per-channel")
  1977. -removed per-channel handling, the code to check 'curchan' also
  1978. -should be removed as never used.
  1979. -
  1980. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  1981. ----
  1982. -
  1983. ---- a/drivers/net/wireless/ath/ath9k/ani.c
  1984. -+++ b/drivers/net/wireless/ath/ath9k/ani.c
  1985. -@@ -126,12 +126,8 @@ static void ath9k_hw_update_mibstats(str
  1986. -
  1987. - static void ath9k_ani_restart(struct ath_hw *ah)
  1988. - {
  1989. -- struct ar5416AniState *aniState;
  1990. --
  1991. -- if (!ah->curchan)
  1992. -- return;
  1993. -+ struct ar5416AniState *aniState = &ah->ani;
  1994. -
  1995. -- aniState = &ah->ani;
  1996. - aniState->listenTime = 0;
  1997. -
  1998. - ENABLE_REGWRITE_BUFFER(ah);
  1999. -@@ -221,12 +217,7 @@ static void ath9k_hw_set_ofdm_nil(struct
  2000. -
  2001. - static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hw *ah)
  2002. - {
  2003. -- struct ar5416AniState *aniState;
  2004. --
  2005. -- if (!ah->curchan)
  2006. -- return;
  2007. --
  2008. -- aniState = &ah->ani;
  2009. -+ struct ar5416AniState *aniState = &ah->ani;
  2010. -
  2011. - if (aniState->ofdmNoiseImmunityLevel < ATH9K_ANI_OFDM_MAX_LEVEL)
  2012. - ath9k_hw_set_ofdm_nil(ah, aniState->ofdmNoiseImmunityLevel + 1, false);
  2013. -@@ -281,12 +272,7 @@ static void ath9k_hw_set_cck_nil(struct
  2014. -
  2015. - static void ath9k_hw_ani_cck_err_trigger(struct ath_hw *ah)
  2016. - {
  2017. -- struct ar5416AniState *aniState;
  2018. --
  2019. -- if (!ah->curchan)
  2020. -- return;
  2021. --
  2022. -- aniState = &ah->ani;
  2023. -+ struct ar5416AniState *aniState = &ah->ani;
  2024. -
  2025. - if (aniState->cckNoiseImmunityLevel < ATH9K_ANI_CCK_MAX_LEVEL)
  2026. - ath9k_hw_set_cck_nil(ah, aniState->cckNoiseImmunityLevel + 1,
  2027. -@@ -299,9 +285,7 @@ static void ath9k_hw_ani_cck_err_trigger
  2028. - */
  2029. - static void ath9k_hw_ani_lower_immunity(struct ath_hw *ah)
  2030. - {
  2031. -- struct ar5416AniState *aniState;
  2032. --
  2033. -- aniState = &ah->ani;
  2034. -+ struct ar5416AniState *aniState = &ah->ani;
  2035. -
  2036. - /* lower OFDM noise immunity */
  2037. - if (aniState->ofdmNoiseImmunityLevel > 0 &&
  2038. -@@ -329,7 +313,7 @@ void ath9k_ani_reset(struct ath_hw *ah,
  2039. - struct ath_common *common = ath9k_hw_common(ah);
  2040. - int ofdm_nil, cck_nil;
  2041. -
  2042. -- if (!ah->curchan)
  2043. -+ if (!chan)
  2044. - return;
  2045. -
  2046. - BUG_ON(aniState == NULL);
  2047. -@@ -416,14 +400,10 @@ static bool ath9k_hw_ani_read_counters(s
  2048. -
  2049. - void ath9k_hw_ani_monitor(struct ath_hw *ah, struct ath9k_channel *chan)
  2050. - {
  2051. -- struct ar5416AniState *aniState;
  2052. -+ struct ar5416AniState *aniState = &ah->ani;
  2053. - struct ath_common *common = ath9k_hw_common(ah);
  2054. - u32 ofdmPhyErrRate, cckPhyErrRate;
  2055. -
  2056. -- if (!ah->curchan)
  2057. -- return;
  2058. --
  2059. -- aniState = &ah->ani;
  2060. - if (!ath9k_hw_ani_read_counters(ah))
  2061. - return;
  2062. -
  2063. 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
  2064. deleted file mode 100644
  2065. index cf8194a..0000000
  2066. --- a/package/kernel/mac80211/patches/306-ath9k-do-not-reset-while-BB-panic-0x4000409-on-ar956.patch
  2067. +++ /dev/null
  2068. @@ -1,31 +0,0 @@
  2069. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  2070. -Date: Fri, 15 Jan 2016 18:17:19 +0800
  2071. -Subject: [PATCH] ath9k: do not reset while BB panic(0x4000409) on ar9561
  2072. -
  2073. -BB panic(0x4000409) observed while AP enabling/disabling
  2074. -bursting.
  2075. -
  2076. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  2077. ----
  2078. -
  2079. ---- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  2080. -+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  2081. -@@ -2071,7 +2071,8 @@ void ar9003_hw_attach_phy_ops(struct ath
  2082. - * to be disabled.
  2083. - *
  2084. - * 0x04000409: Packet stuck on receive.
  2085. -- * Full chip reset is required for all chips except AR9340.
  2086. -+ * Full chip reset is required for all chips except
  2087. -+ * AR9340, AR9531 and AR9561.
  2088. - */
  2089. -
  2090. - /*
  2091. -@@ -2100,7 +2101,7 @@ bool ar9003_hw_bb_watchdog_check(struct
  2092. - case 0x04000b09:
  2093. - return true;
  2094. - case 0x04000409:
  2095. -- if (AR_SREV_9340(ah) || AR_SREV_9531(ah))
  2096. -+ if (AR_SREV_9340(ah) || AR_SREV_9531(ah) || AR_SREV_9561(ah))
  2097. - return false;
  2098. - else
  2099. - return true;
  2100. 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
  2101. new file mode 100644
  2102. index 0000000..4a8f143
  2103. --- /dev/null
  2104. +++ b/package/kernel/mac80211/patches/306-mac80211-add-hdrlen-to-ieee80211_tx_data.patch
  2105. @@ -0,0 +1,203 @@
  2106. +From: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  2107. +Date: Fri, 19 Feb 2016 11:01:49 +0100
  2108. +Subject: [PATCH] mac80211: add hdrlen to ieee80211_tx_data
  2109. +
  2110. +Add hdrlen to ieee80211_tx_data and use this
  2111. +when wep/ccmd/tkip. This is preparation for
  2112. +aligned4 code.
  2113. +
  2114. +Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  2115. +---
  2116. +
  2117. +--- a/net/mac80211/ieee80211_i.h
  2118. ++++ b/net/mac80211/ieee80211_i.h
  2119. +@@ -173,6 +173,7 @@ struct ieee80211_tx_data {
  2120. + struct ieee80211_tx_rate rate;
  2121. +
  2122. + unsigned int flags;
  2123. ++ unsigned int hdrlen;
  2124. + };
  2125. +
  2126. +
  2127. +--- a/net/mac80211/tx.c
  2128. ++++ b/net/mac80211/tx.c
  2129. +@@ -922,7 +922,7 @@ ieee80211_tx_h_fragment(struct ieee80211
  2130. + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  2131. + struct ieee80211_hdr *hdr = (void *)skb->data;
  2132. + int frag_threshold = tx->local->hw.wiphy->frag_threshold;
  2133. +- int hdrlen;
  2134. ++ int hdrlen = tx->hdrlen;
  2135. + int fragnum;
  2136. +
  2137. + /* no matter what happens, tx->skb moves to tx->skbs */
  2138. +@@ -943,8 +943,6 @@ ieee80211_tx_h_fragment(struct ieee80211
  2139. + if (WARN_ON(info->flags & IEEE80211_TX_CTL_AMPDU))
  2140. + return TX_DROP;
  2141. +
  2142. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2143. +-
  2144. + /* internal error, why isn't DONTFRAG set? */
  2145. + if (WARN_ON(skb->len + FCS_LEN <= frag_threshold))
  2146. + return TX_DROP;
  2147. +@@ -1176,6 +1174,8 @@ ieee80211_tx_prepare(struct ieee80211_su
  2148. +
  2149. + hdr = (struct ieee80211_hdr *) skb->data;
  2150. +
  2151. ++ tx->hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2152. ++
  2153. + if (likely(sta)) {
  2154. + if (!IS_ERR(sta))
  2155. + tx->sta = sta;
  2156. +--- a/net/mac80211/util.c
  2157. ++++ b/net/mac80211/util.c
  2158. +@@ -1226,6 +1226,7 @@ void ieee80211_send_auth(struct ieee8021
  2159. + struct ieee80211_local *local = sdata->local;
  2160. + struct sk_buff *skb;
  2161. + struct ieee80211_mgmt *mgmt;
  2162. ++ unsigned int hdrlen;
  2163. + int err;
  2164. +
  2165. + /* 24 + 6 = header + auth_algo + auth_transaction + status_code */
  2166. +@@ -1250,8 +1251,10 @@ void ieee80211_send_auth(struct ieee8021
  2167. + memcpy(skb_put(skb, extra_len), extra, extra_len);
  2168. +
  2169. + if (auth_alg == WLAN_AUTH_SHARED_KEY && transaction == 3) {
  2170. ++ hdrlen = ieee80211_hdrlen(mgmt->frame_control);
  2171. + mgmt->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
  2172. +- err = ieee80211_wep_encrypt(local, skb, key, key_len, key_idx);
  2173. ++ err = ieee80211_wep_encrypt(local, skb, hdrlen, key,
  2174. ++ key_len, key_idx);
  2175. + WARN_ON(err);
  2176. + }
  2177. +
  2178. +--- a/net/mac80211/wep.c
  2179. ++++ b/net/mac80211/wep.c
  2180. +@@ -89,11 +89,11 @@ static void ieee80211_wep_get_iv(struct
  2181. +
  2182. + static u8 *ieee80211_wep_add_iv(struct ieee80211_local *local,
  2183. + struct sk_buff *skb,
  2184. ++ unsigned int hdrlen,
  2185. + int keylen, int keyidx)
  2186. + {
  2187. + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  2188. + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  2189. +- unsigned int hdrlen;
  2190. + u8 *newhdr;
  2191. +
  2192. + hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
  2193. +@@ -101,7 +101,6 @@ static u8 *ieee80211_wep_add_iv(struct i
  2194. + if (WARN_ON(skb_headroom(skb) < IEEE80211_WEP_IV_LEN))
  2195. + return NULL;
  2196. +
  2197. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2198. + newhdr = skb_push(skb, IEEE80211_WEP_IV_LEN);
  2199. + memmove(newhdr, newhdr + IEEE80211_WEP_IV_LEN, hdrlen);
  2200. +
  2201. +@@ -160,6 +159,7 @@ int ieee80211_wep_encrypt_data(struct cr
  2202. + */
  2203. + int ieee80211_wep_encrypt(struct ieee80211_local *local,
  2204. + struct sk_buff *skb,
  2205. ++ unsigned int hdrlen,
  2206. + const u8 *key, int keylen, int keyidx)
  2207. + {
  2208. + u8 *iv;
  2209. +@@ -169,7 +169,7 @@ int ieee80211_wep_encrypt(struct ieee802
  2210. + if (WARN_ON(skb_tailroom(skb) < IEEE80211_WEP_ICV_LEN))
  2211. + return -1;
  2212. +
  2213. +- iv = ieee80211_wep_add_iv(local, skb, keylen, keyidx);
  2214. ++ iv = ieee80211_wep_add_iv(local, skb, hdrlen, keylen, keyidx);
  2215. + if (!iv)
  2216. + return -1;
  2217. +
  2218. +@@ -306,13 +306,14 @@ static int wep_encrypt_skb(struct ieee80
  2219. + struct ieee80211_key_conf *hw_key = info->control.hw_key;
  2220. +
  2221. + if (!hw_key) {
  2222. +- if (ieee80211_wep_encrypt(tx->local, skb, tx->key->conf.key,
  2223. ++ if (ieee80211_wep_encrypt(tx->local, skb, tx->hdrlen,
  2224. ++ tx->key->conf.key,
  2225. + tx->key->conf.keylen,
  2226. + tx->key->conf.keyidx))
  2227. + return -1;
  2228. + } else if ((hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV) ||
  2229. + (hw_key->flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE)) {
  2230. +- if (!ieee80211_wep_add_iv(tx->local, skb,
  2231. ++ if (!ieee80211_wep_add_iv(tx->local, skb, tx->hdrlen,
  2232. + tx->key->conf.keylen,
  2233. + tx->key->conf.keyidx))
  2234. + return -1;
  2235. +--- a/net/mac80211/wep.h
  2236. ++++ b/net/mac80211/wep.h
  2237. +@@ -22,6 +22,7 @@ int ieee80211_wep_encrypt_data(struct cr
  2238. + size_t klen, u8 *data, size_t data_len);
  2239. + int ieee80211_wep_encrypt(struct ieee80211_local *local,
  2240. + struct sk_buff *skb,
  2241. ++ unsigned int hdrlen,
  2242. + const u8 *key, int keylen, int keyidx);
  2243. + int ieee80211_wep_decrypt_data(struct crypto_cipher *tfm, u8 *rc4key,
  2244. + size_t klen, u8 *data, size_t data_len);
  2245. +--- a/net/mac80211/wpa.c
  2246. ++++ b/net/mac80211/wpa.c
  2247. +@@ -43,7 +43,7 @@ ieee80211_tx_h_michael_mic_add(struct ie
  2248. + skb->len < 24 || !ieee80211_is_data_present(hdr->frame_control))
  2249. + return TX_CONTINUE;
  2250. +
  2251. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2252. ++ hdrlen = tx->hdrlen;
  2253. + if (skb->len < hdrlen)
  2254. + return TX_DROP;
  2255. +
  2256. +@@ -186,7 +186,6 @@ mic_fail_no_key:
  2257. +
  2258. + static int tkip_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
  2259. + {
  2260. +- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
  2261. + struct ieee80211_key *key = tx->key;
  2262. + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  2263. + unsigned int hdrlen;
  2264. +@@ -201,7 +200,7 @@ static int tkip_encrypt_skb(struct ieee8
  2265. + return 0;
  2266. + }
  2267. +
  2268. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2269. ++ hdrlen = tx->hdrlen;
  2270. + len = skb->len - hdrlen;
  2271. +
  2272. + if (info->control.hw_key)
  2273. +@@ -418,7 +417,7 @@ static int ccmp_encrypt_skb(struct ieee8
  2274. + return 0;
  2275. + }
  2276. +
  2277. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2278. ++ hdrlen = tx->hdrlen;
  2279. + len = skb->len - hdrlen;
  2280. +
  2281. + if (info->control.hw_key)
  2282. +@@ -651,7 +650,7 @@ static int gcmp_encrypt_skb(struct ieee8
  2283. + return 0;
  2284. + }
  2285. +
  2286. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2287. ++ hdrlen = tx->hdrlen;
  2288. + len = skb->len - hdrlen;
  2289. +
  2290. + if (info->control.hw_key)
  2291. +@@ -791,7 +790,6 @@ static ieee80211_tx_result
  2292. + ieee80211_crypto_cs_encrypt(struct ieee80211_tx_data *tx,
  2293. + struct sk_buff *skb)
  2294. + {
  2295. +- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  2296. + struct ieee80211_key *key = tx->key;
  2297. + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  2298. + int hdrlen;
  2299. +@@ -807,8 +805,7 @@ ieee80211_crypto_cs_encrypt(struct ieee8
  2300. + pskb_expand_head(skb, iv_len, 0, GFP_ATOMIC)))
  2301. + return TX_DROP;
  2302. +
  2303. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2304. +-
  2305. ++ hdrlen = tx->hdrlen;
  2306. + pos = skb_push(skb, iv_len);
  2307. + memmove(pos, pos + iv_len, hdrlen);
  2308. +
  2309. 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
  2310. deleted file mode 100644
  2311. index 80b781c..0000000
  2312. --- a/package/kernel/mac80211/patches/307-ath9k-fix-inconsistent-use-of-tab-and-space-in-inden.patch
  2313. +++ /dev/null
  2314. @@ -1,27 +0,0 @@
  2315. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  2316. -Date: Fri, 15 Jan 2016 18:17:20 +0800
  2317. -Subject: [PATCH] ath9k: fix inconsistent use of tab and space in
  2318. - indentation
  2319. -
  2320. -Minor changes for indenting.
  2321. -
  2322. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  2323. ----
  2324. -
  2325. ---- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
  2326. -+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
  2327. -@@ -5485,11 +5485,11 @@ unsigned int ar9003_get_paprd_scale_fact
  2328. - AR9300_PAPRD_SCALE_1);
  2329. - else {
  2330. - if (chan->channel >= 5700)
  2331. -- return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt20),
  2332. -- AR9300_PAPRD_SCALE_1);
  2333. -+ return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt20),
  2334. -+ AR9300_PAPRD_SCALE_1);
  2335. - else if (chan->channel >= 5400)
  2336. - return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt40),
  2337. -- AR9300_PAPRD_SCALE_2);
  2338. -+ AR9300_PAPRD_SCALE_2);
  2339. - else
  2340. - return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt40),
  2341. - AR9300_PAPRD_SCALE_1);
  2342. 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
  2343. new file mode 100644
  2344. index 0000000..eeb881e
  2345. --- /dev/null
  2346. +++ b/package/kernel/mac80211/patches/307-mac80211-add-NEED_ALIGNED4_SKBS-hw-flag.patch
  2347. @@ -0,0 +1,235 @@
  2348. +From: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  2349. +Date: Fri, 19 Feb 2016 11:01:50 +0100
  2350. +Subject: [PATCH] mac80211: add NEED_ALIGNED4_SKBS hw flag
  2351. +
  2352. +HW/driver should set NEED_ALIGNED4_SKBS flag in case
  2353. +require aligned skbs to four-byte boundaries.
  2354. +This affect only TX direction.
  2355. +
  2356. +Padding is added after ieee80211_hdr, before IV/LLC.
  2357. +
  2358. +Before we have to do memmove(hdrlen) twice in the
  2359. +dirver. Once before we pass this to HW and next
  2360. +in tx completion (to be sure monitor will report
  2361. +this tx frame correctly).
  2362. +
  2363. +With this patch we can skip this memmove() and save CPU.
  2364. +
  2365. +Currently this was tested with ath9k, both hw/sw crypt for
  2366. +wep/tkip/ccmp.
  2367. +
  2368. +Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  2369. +---
  2370. +
  2371. +--- a/include/net/mac80211.h
  2372. ++++ b/include/net/mac80211.h
  2373. +@@ -2014,6 +2014,9 @@ struct ieee80211_txq {
  2374. + * @IEEE80211_HW_TX_FRAG_LIST: Hardware (or driver) supports sending frag_list
  2375. + * skbs, needed for zero-copy software A-MSDU.
  2376. + *
  2377. ++ * @IEEE80211_HW_NEEDS_ALIGNED4_SKBS: Driver need aligned skbs to four-byte.
  2378. ++ * Padding will be added after ieee80211_hdr, before IV/LLC.
  2379. ++ *
  2380. + * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
  2381. + */
  2382. + enum ieee80211_hw_flags {
  2383. +@@ -2054,6 +2057,7 @@ enum ieee80211_hw_flags {
  2384. + IEEE80211_HW_USES_RSS,
  2385. + IEEE80211_HW_TX_AMSDU,
  2386. + IEEE80211_HW_TX_FRAG_LIST,
  2387. ++ IEEE80211_HW_NEEDS_ALIGNED4_SKBS,
  2388. +
  2389. + /* keep last, obviously */
  2390. + NUM_IEEE80211_HW_FLAGS
  2391. +--- a/net/mac80211/debugfs.c
  2392. ++++ b/net/mac80211/debugfs.c
  2393. +@@ -302,6 +302,7 @@ static const char *hw_flag_names[] = {
  2394. + FLAG(USES_RSS),
  2395. + FLAG(TX_AMSDU),
  2396. + FLAG(TX_FRAG_LIST),
  2397. ++ FLAG(NEEDS_ALIGNED4_SKBS),
  2398. + #undef FLAG
  2399. + };
  2400. +
  2401. +--- a/net/mac80211/ieee80211_i.h
  2402. ++++ b/net/mac80211/ieee80211_i.h
  2403. +@@ -1497,6 +1497,29 @@ ieee80211_have_rx_timestamp(struct ieee8
  2404. + return false;
  2405. + }
  2406. +
  2407. ++static inline unsigned int
  2408. ++ieee80211_hdr_padsize(struct ieee80211_hw *hw, unsigned int hdrlen)
  2409. ++{
  2410. ++ /*
  2411. ++ * While hdrlen is already aligned to two-byte boundaries,
  2412. ++ * simple check with & 2 will return correct padsize.
  2413. ++ */
  2414. ++ if (ieee80211_hw_check(hw, NEEDS_ALIGNED4_SKBS))
  2415. ++ return hdrlen & 2;
  2416. ++ return 0;
  2417. ++}
  2418. ++
  2419. ++static inline unsigned int
  2420. ++ieee80211_padded_hdrlen(struct ieee80211_hw *hw, __le16 fc)
  2421. ++{
  2422. ++ unsigned int hdrlen;
  2423. ++
  2424. ++ hdrlen = ieee80211_hdrlen(fc);
  2425. ++ hdrlen += ieee80211_hdr_padsize(hw, hdrlen);
  2426. ++
  2427. ++ return hdrlen;
  2428. ++}
  2429. ++
  2430. + u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local,
  2431. + struct ieee80211_rx_status *status,
  2432. + unsigned int mpdu_len,
  2433. +--- a/net/mac80211/sta_info.h
  2434. ++++ b/net/mac80211/sta_info.h
  2435. +@@ -279,7 +279,7 @@ struct ieee80211_fast_tx {
  2436. + u8 hdr_len;
  2437. + u8 sa_offs, da_offs, pn_offs;
  2438. + u8 band;
  2439. +- u8 hdr[30 + 2 + IEEE80211_FAST_XMIT_MAX_IV +
  2440. ++ u8 hdr[30 + 2 + 2 + IEEE80211_FAST_XMIT_MAX_IV +
  2441. + sizeof(rfc1042_header)] __aligned(2);
  2442. +
  2443. + struct rcu_head rcu_head;
  2444. +--- a/net/mac80211/status.c
  2445. ++++ b/net/mac80211/status.c
  2446. +@@ -683,9 +683,22 @@ void ieee80211_tx_monitor(struct ieee802
  2447. + struct sk_buff *skb2;
  2448. + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  2449. + struct ieee80211_sub_if_data *sdata;
  2450. ++ struct ieee80211_hdr *hdr = (void *)skb->data;
  2451. + struct net_device *prev_dev = NULL;
  2452. ++ unsigned int hdrlen, padsize;
  2453. + int rtap_len;
  2454. +
  2455. ++ /* Remove padding if was added */
  2456. ++ if (ieee80211_hw_check(&local->hw, NEEDS_ALIGNED4_SKBS)) {
  2457. ++ hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2458. ++ padsize = ieee80211_hdr_padsize(&local->hw, hdrlen);
  2459. ++
  2460. ++ if (padsize && skb->len > hdrlen + padsize) {
  2461. ++ memmove(skb->data + padsize, skb->data, hdrlen);
  2462. ++ skb_pull(skb, padsize);
  2463. ++ }
  2464. ++ }
  2465. ++
  2466. + /* send frame to monitor interfaces now */
  2467. + rtap_len = ieee80211_tx_radiotap_len(info);
  2468. + if (WARN_ON_ONCE(skb_headroom(skb) < rtap_len)) {
  2469. +--- a/net/mac80211/tkip.c
  2470. ++++ b/net/mac80211/tkip.c
  2471. +@@ -201,10 +201,12 @@ void ieee80211_get_tkip_p2k(struct ieee8
  2472. + {
  2473. + struct ieee80211_key *key = (struct ieee80211_key *)
  2474. + container_of(keyconf, struct ieee80211_key, conf);
  2475. ++ struct ieee80211_hw *hw = &key->local->hw;
  2476. + const u8 *tk = &key->conf.key[NL80211_TKIP_DATA_OFFSET_ENCR_KEY];
  2477. + struct tkip_ctx *ctx = &key->u.tkip.tx;
  2478. + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  2479. +- const u8 *data = (u8 *)hdr + ieee80211_hdrlen(hdr->frame_control);
  2480. ++ const u8 *data = (u8 *)hdr + ieee80211_padded_hdrlen(hw,
  2481. ++ hdr->frame_control);
  2482. + u32 iv32 = get_unaligned_le32(&data[4]);
  2483. + u16 iv16 = data[2] | (data[0] << 8);
  2484. +
  2485. +--- a/net/mac80211/tx.c
  2486. ++++ b/net/mac80211/tx.c
  2487. +@@ -1173,8 +1173,7 @@ ieee80211_tx_prepare(struct ieee80211_su
  2488. + info->flags &= ~IEEE80211_TX_INTFL_NEED_TXPROCESSING;
  2489. +
  2490. + hdr = (struct ieee80211_hdr *) skb->data;
  2491. +-
  2492. +- tx->hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2493. ++ tx->hdrlen = ieee80211_padded_hdrlen(&local->hw, hdr->frame_control);
  2494. +
  2495. + if (likely(sta)) {
  2496. + if (!IS_ERR(sta))
  2497. +@@ -2108,7 +2107,7 @@ netdev_tx_t ieee80211_monitor_start_xmit
  2498. + goto fail;
  2499. +
  2500. + hdr = (struct ieee80211_hdr *)(skb->data + len_rthdr);
  2501. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2502. ++ hdrlen = ieee80211_padded_hdrlen(&local->hw, hdr->frame_control);
  2503. +
  2504. + if (skb->len < len_rthdr + hdrlen)
  2505. + goto fail;
  2506. +@@ -2334,7 +2333,7 @@ static struct sk_buff *ieee80211_build_h
  2507. + struct ieee80211_chanctx_conf *chanctx_conf;
  2508. + struct ieee80211_sub_if_data *ap_sdata;
  2509. + enum nl80211_band band;
  2510. +- int ret;
  2511. ++ int padsize, ret;
  2512. +
  2513. + if (IS_ERR(sta))
  2514. + sta = NULL;
  2515. +@@ -2554,6 +2553,9 @@ static struct sk_buff *ieee80211_build_h
  2516. + hdrlen += 2;
  2517. + }
  2518. +
  2519. ++ /* Check aligned4 skb required */
  2520. ++ padsize = ieee80211_hdr_padsize(&sdata->local->hw, hdrlen);
  2521. ++
  2522. + /*
  2523. + * Drop unicast frames to unauthorised stations unless they are
  2524. + * EAPOL frames from the local station.
  2525. +@@ -2640,6 +2642,7 @@ static struct sk_buff *ieee80211_build_h
  2526. + h_pos -= skip_header_bytes;
  2527. +
  2528. + head_need = hdrlen + encaps_len + meshhdrlen - skb_headroom(skb);
  2529. ++ head_need += padsize;
  2530. +
  2531. + /*
  2532. + * So we need to modify the skb header and hence need a copy of
  2533. +@@ -2678,6 +2681,9 @@ static struct sk_buff *ieee80211_build_h
  2534. + }
  2535. + #endif
  2536. +
  2537. ++ if (padsize)
  2538. ++ memset(skb_push(skb, padsize), 0, padsize);
  2539. ++
  2540. + if (ieee80211_is_data_qos(fc)) {
  2541. + __le16 *qos_control;
  2542. +
  2543. +@@ -2691,8 +2697,8 @@ static struct sk_buff *ieee80211_build_h
  2544. + } else
  2545. + memcpy(skb_push(skb, hdrlen), &hdr, hdrlen);
  2546. +
  2547. +- nh_pos += hdrlen;
  2548. +- h_pos += hdrlen;
  2549. ++ nh_pos += hdrlen + padsize;
  2550. ++ h_pos += hdrlen + padsize;
  2551. +
  2552. + /* Update skb pointers to various headers since this modified frame
  2553. + * is going to go through Linux networking code that may potentially
  2554. +@@ -2861,6 +2867,9 @@ void ieee80211_check_fast_xmit(struct st
  2555. + fc |= cpu_to_le16(IEEE80211_STYPE_QOS_DATA);
  2556. + }
  2557. +
  2558. ++ /* Check aligned4 skb required */
  2559. ++ build.hdr_len += ieee80211_hdr_padsize(&local->hw, build.hdr_len);
  2560. ++
  2561. + /* We store the key here so there's no point in using rcu_dereference()
  2562. + * but that's fine because the code that changes the pointers will call
  2563. + * this function after doing so. For a single CPU that would be enough,
  2564. +--- a/net/mac80211/util.c
  2565. ++++ b/net/mac80211/util.c
  2566. +@@ -1224,6 +1224,7 @@ void ieee80211_send_auth(struct ieee8021
  2567. + u32 tx_flags)
  2568. + {
  2569. + struct ieee80211_local *local = sdata->local;
  2570. ++ struct ieee80211_hw *hw = &local->hw;
  2571. + struct sk_buff *skb;
  2572. + struct ieee80211_mgmt *mgmt;
  2573. + unsigned int hdrlen;
  2574. +@@ -1251,7 +1252,7 @@ void ieee80211_send_auth(struct ieee8021
  2575. + memcpy(skb_put(skb, extra_len), extra, extra_len);
  2576. +
  2577. + if (auth_alg == WLAN_AUTH_SHARED_KEY && transaction == 3) {
  2578. +- hdrlen = ieee80211_hdrlen(mgmt->frame_control);
  2579. ++ hdrlen = ieee80211_padded_hdrlen(hw, mgmt->frame_control);
  2580. + mgmt->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
  2581. + err = ieee80211_wep_encrypt(local, skb, hdrlen, key,
  2582. + key_len, key_idx);
  2583. 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
  2584. new file mode 100644
  2585. index 0000000..8590aad
  2586. --- /dev/null
  2587. +++ b/package/kernel/mac80211/patches/308-ath10k-Fix-sending-NULL-Qos-NULL-data-frames-for-QCA.patch
  2588. @@ -0,0 +1,72 @@
  2589. +From: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
  2590. +Date: Thu, 23 Jun 2016 22:10:01 +0530
  2591. +Subject: [PATCH] ath10k: Fix sending NULL/ Qos NULL data frames for
  2592. + QCA99X0 and later
  2593. +
  2594. +For chipsets like QCA99X0, IPQ4019 and later we are not getting proper
  2595. +NULL func status (always acked/successs !!) when hostapd does a
  2596. +PROBE_CLIENT via nullfunc frames when the station is powered off
  2597. +abruptly (inactive timer probes client via null func after the inactive
  2598. +time reaches beyond the threshold). Fix this by disabling the workaround
  2599. +(getting the ACK status of NULL func frames by sending via HTT mgmt-tx
  2600. + path) introduced by the change ("ath10k: fix beacon loss handling ")
  2601. +for QCA99X0 and later chipsets. The normal tx path provides the proper
  2602. +ACK status for NULL data frames. As of now disable this workaround for
  2603. +chipsets QCA99X0 and later, once the 10.1 firmware is obselete we can
  2604. +completely get rid of this workaround for all the chipsets
  2605. +
  2606. +Signed-off-by: Tamizh chelvam <c_traja@qti.qualcomm.com>
  2607. +Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
  2608. +---
  2609. +
  2610. +--- a/drivers/net/wireless/ath/ath10k/core.c
  2611. ++++ b/drivers/net/wireless/ath/ath10k/core.c
  2612. +@@ -181,6 +181,7 @@ static const struct ath10k_hw_params ath
  2613. + .board = QCA99X0_HW_2_0_BOARD_DATA_FILE,
  2614. + .board_size = QCA99X0_BOARD_DATA_SZ,
  2615. + .board_ext_size = QCA99X0_BOARD_EXT_DATA_SZ,
  2616. ++ .disable_null_func_workaround = true,
  2617. + },
  2618. + },
  2619. + {
  2620. +@@ -204,6 +205,7 @@ static const struct ath10k_hw_params ath
  2621. + .board = QCA9984_HW_1_0_BOARD_DATA_FILE,
  2622. + .board_size = QCA99X0_BOARD_DATA_SZ,
  2623. + .board_ext_size = QCA99X0_BOARD_EXT_DATA_SZ,
  2624. ++ .disable_null_func_workaround = true,
  2625. + },
  2626. + },
  2627. + {
  2628. +@@ -262,6 +264,7 @@ static const struct ath10k_hw_params ath
  2629. + .board = QCA4019_HW_1_0_BOARD_DATA_FILE,
  2630. + .board_size = QCA4019_BOARD_DATA_SZ,
  2631. + .board_ext_size = QCA4019_BOARD_EXT_DATA_SZ,
  2632. ++ .disable_null_func_workaround = true,
  2633. + },
  2634. + },
  2635. + };
  2636. +--- a/drivers/net/wireless/ath/ath10k/core.h
  2637. ++++ b/drivers/net/wireless/ath/ath10k/core.h
  2638. +@@ -750,6 +750,12 @@ struct ath10k {
  2639. + const char *board;
  2640. + size_t board_size;
  2641. + size_t board_ext_size;
  2642. ++ /* Workaround of sending NULL data frames via
  2643. ++ * HTT mgmt TX and getting the proper ACK status does
  2644. ++ * not works for chipsets QCA99X0 and later, while
  2645. ++ * Tx data path reports the ACK status properly.
  2646. ++ */
  2647. ++ bool disable_null_func_workaround;
  2648. + } fw;
  2649. + } hw_params;
  2650. +
  2651. +--- a/drivers/net/wireless/ath/ath10k/mac.c
  2652. ++++ b/drivers/net/wireless/ath/ath10k/mac.c
  2653. +@@ -3253,6 +3253,7 @@ ath10k_mac_tx_h_get_txmode(struct ath10k
  2654. + * mode though because AP don't sleep.
  2655. + */
  2656. + if (ar->htt.target_version_major < 3 &&
  2657. ++ !ar->hw_params.fw.disable_null_func_workaround &&
  2658. + (ieee80211_is_nullfunc(fc) || ieee80211_is_qos_nullfunc(fc)) &&
  2659. + !test_bit(ATH10K_FW_FEATURE_HAS_WMI_MGMT_TX,
  2660. + ar->running_fw->fw_file.fw_features))
  2661. 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
  2662. deleted file mode 100644
  2663. index d408866..0000000
  2664. --- a/package/kernel/mac80211/patches/308-ath9k-fix-data-bus-error-on-ar9300-and-ar9580.patch
  2665. +++ /dev/null
  2666. @@ -1,65 +0,0 @@
  2667. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  2668. -Date: Fri, 15 Jan 2016 18:17:21 +0800
  2669. -Subject: [PATCH] ath9k: fix data bus error on ar9300 and ar9580
  2670. -
  2671. -One crash issue be found on ar9300: RTC_RC reg read leads crash, leading
  2672. -the data bus error, due to RTC_RC reg write not happen properly.
  2673. -
  2674. -Warm Reset trigger in continuous beacon stuck for one of the customer for
  2675. -other chip, noticed the MAC was stuck in RTC reset. After analysis noticed
  2676. -DMA did not complete when RTC was put in reset.
  2677. -
  2678. -So, before resetting the MAC need to make sure there are no pending DMA
  2679. -transactions because this reset does not reset all parts of the chip.
  2680. -
  2681. -The 12th and 11th bit of MAC _DMA_CFG register used to do that.
  2682. - 12 cfg_halt_ack 0x0
  2683. - 0 DMA has not yet halted
  2684. - 1 DMA has halted
  2685. - 11 cfg_halt_req 0x0
  2686. - 0 DMA logic operates normally
  2687. - 1 Request DMA logic to stop so software can reset the MAC
  2688. -
  2689. -The Bit [12] of this register indicates when the halt has taken effect or
  2690. -not. the DMA halt IS NOT recoverable; once software sets bit [11] to
  2691. -request a DMA halt, software must wait for bit [12] to be set and reset
  2692. -the MAC.
  2693. -
  2694. -So, the same thing we implemented for ar9580 chip.
  2695. -
  2696. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  2697. ----
  2698. -
  2699. ---- a/drivers/net/wireless/ath/ath9k/hw.c
  2700. -+++ b/drivers/net/wireless/ath/ath9k/hw.c
  2701. -@@ -1368,6 +1368,16 @@ static bool ath9k_hw_set_reset(struct at
  2702. - if (ath9k_hw_mci_is_enabled(ah))
  2703. - ar9003_mci_check_gpm_offset(ah);
  2704. -
  2705. -+ /* DMA HALT added to resolve ar9300 and ar9580 bus error during
  2706. -+ * RTC_RC reg read
  2707. -+ */
  2708. -+ if (AR_SREV_9300(ah) || AR_SREV_9580(ah)) {
  2709. -+ REG_SET_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  2710. -+ ath9k_hw_wait(ah, AR_CFG, AR_CFG_HALT_ACK, AR_CFG_HALT_ACK,
  2711. -+ 20 * AH_WAIT_TIMEOUT);
  2712. -+ REG_CLR_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  2713. -+ }
  2714. -+
  2715. - REG_WRITE(ah, AR_RTC_RC, rst_flags);
  2716. -
  2717. - REGWRITE_BUFFER_FLUSH(ah);
  2718. ---- a/drivers/net/wireless/ath/ath9k/reg.h
  2719. -+++ b/drivers/net/wireless/ath/ath9k/reg.h
  2720. -@@ -34,8 +34,10 @@
  2721. - #define AR_CFG_SWRG 0x00000010
  2722. - #define AR_CFG_AP_ADHOC_INDICATION 0x00000020
  2723. - #define AR_CFG_PHOK 0x00000100
  2724. --#define AR_CFG_CLK_GATE_DIS 0x00000400
  2725. - #define AR_CFG_EEBS 0x00000200
  2726. -+#define AR_CFG_CLK_GATE_DIS 0x00000400
  2727. -+#define AR_CFG_HALT_REQ 0x00000800
  2728. -+#define AR_CFG_HALT_ACK 0x00001000
  2729. - #define AR_CFG_PCI_MASTER_REQ_Q_THRESH 0x00060000
  2730. - #define AR_CFG_PCI_MASTER_REQ_Q_THRESH_S 17
  2731. -
  2732. 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
  2733. deleted file mode 100644
  2734. index d9511c8..0000000
  2735. --- a/package/kernel/mac80211/patches/309-01-brcmfmac-add-missing-include.patch
  2736. +++ /dev/null
  2737. @@ -1,19 +0,0 @@
  2738. -From: Felix Fietkau <nbd@openwrt.org>
  2739. -Date: Fri, 15 Jan 2016 15:59:45 +0100
  2740. -Subject: [PATCH] brcmfmac: add missing include
  2741. -
  2742. -linux/module.h is required for defining module parameters
  2743. -
  2744. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  2745. ----
  2746. -
  2747. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  2748. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  2749. -@@ -17,6 +17,7 @@
  2750. - #include <linux/kernel.h>
  2751. - #include <linux/string.h>
  2752. - #include <linux/netdevice.h>
  2753. -+#include <linux/module.h>
  2754. - #include <brcmu_wifi.h>
  2755. - #include <brcmu_utils.h>
  2756. - #include "core.h"
  2757. 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
  2758. deleted file mode 100644
  2759. index 711e019..0000000
  2760. --- a/package/kernel/mac80211/patches/309-02-brcmfmac-fix-sdio-sg-table-alloc-crash.patch
  2761. +++ /dev/null
  2762. @@ -1,118 +0,0 @@
  2763. -From: Hante Meuleman <meuleman@broadcom.com>
  2764. -Date: Tue, 19 Jan 2016 12:39:24 +0100
  2765. -Subject: [PATCH] brcmfmac: fix sdio sg table alloc crash
  2766. -
  2767. -With commit 7d34b0560567 ("brcmfmac: Move all module parameters to
  2768. -one place") a bug was introduced causing a null pointer exception.
  2769. -This patch fixes the bug by initializing the sg table till after
  2770. -the settings have been initialized.
  2771. -
  2772. -Fixes: 7d34b0560567 ("brcmfmac: Move all module parameters to one place")
  2773. -Reported-by: Marc Zyngier <marc.zyngier@arm.com>
  2774. -Tested-by: Marc Zyngier <marc.zyngier@arm.com>
  2775. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  2776. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  2777. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  2778. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  2779. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  2780. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  2781. ----
  2782. -
  2783. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  2784. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  2785. -@@ -879,11 +879,24 @@ int brcmf_sdiod_abort(struct brcmf_sdio_
  2786. - return 0;
  2787. - }
  2788. -
  2789. --static void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev)
  2790. -+void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev)
  2791. - {
  2792. -+ struct sdio_func *func;
  2793. -+ struct mmc_host *host;
  2794. -+ uint max_blocks;
  2795. - uint nents;
  2796. - int err;
  2797. -
  2798. -+ func = sdiodev->func[2];
  2799. -+ host = func->card->host;
  2800. -+ sdiodev->sg_support = host->max_segs > 1;
  2801. -+ max_blocks = min_t(uint, host->max_blk_count, 511u);
  2802. -+ sdiodev->max_request_size = min_t(uint, host->max_req_size,
  2803. -+ max_blocks * func->cur_blksize);
  2804. -+ sdiodev->max_segment_count = min_t(uint, host->max_segs,
  2805. -+ SG_MAX_SINGLE_ALLOC);
  2806. -+ sdiodev->max_segment_size = host->max_seg_size;
  2807. -+
  2808. - if (!sdiodev->sg_support)
  2809. - return;
  2810. -
  2811. -@@ -1021,9 +1034,6 @@ static void brcmf_sdiod_host_fixup(struc
  2812. -
  2813. - static int brcmf_sdiod_probe(struct brcmf_sdio_dev *sdiodev)
  2814. - {
  2815. -- struct sdio_func *func;
  2816. -- struct mmc_host *host;
  2817. -- uint max_blocks;
  2818. - int ret = 0;
  2819. -
  2820. - sdiodev->num_funcs = 2;
  2821. -@@ -1054,26 +1064,6 @@ static int brcmf_sdiod_probe(struct brcm
  2822. - goto out;
  2823. - }
  2824. -
  2825. -- /*
  2826. -- * determine host related variables after brcmf_sdiod_probe()
  2827. -- * as func->cur_blksize is properly set and F2 init has been
  2828. -- * completed successfully.
  2829. -- */
  2830. -- func = sdiodev->func[2];
  2831. -- host = func->card->host;
  2832. -- sdiodev->sg_support = host->max_segs > 1;
  2833. -- max_blocks = min_t(uint, host->max_blk_count, 511u);
  2834. -- sdiodev->max_request_size = min_t(uint, host->max_req_size,
  2835. -- max_blocks * func->cur_blksize);
  2836. -- sdiodev->max_segment_count = min_t(uint, host->max_segs,
  2837. -- SG_MAX_SINGLE_ALLOC);
  2838. -- sdiodev->max_segment_size = host->max_seg_size;
  2839. --
  2840. -- /* allocate scatter-gather table. sg support
  2841. -- * will be disabled upon allocation failure.
  2842. -- */
  2843. -- brcmf_sdiod_sgtable_alloc(sdiodev);
  2844. --
  2845. - ret = brcmf_sdiod_freezer_attach(sdiodev);
  2846. - if (ret)
  2847. - goto out;
  2848. -@@ -1084,7 +1074,7 @@ static int brcmf_sdiod_probe(struct brcm
  2849. - ret = -ENODEV;
  2850. - goto out;
  2851. - }
  2852. -- brcmf_sdiod_host_fixup(host);
  2853. -+ brcmf_sdiod_host_fixup(sdiodev->func[2]->card->host);
  2854. - out:
  2855. - if (ret)
  2856. - brcmf_sdiod_remove(sdiodev);
  2857. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  2858. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  2859. -@@ -4114,6 +4114,11 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
  2860. - goto fail;
  2861. - }
  2862. -
  2863. -+ /* allocate scatter-gather table. sg support
  2864. -+ * will be disabled upon allocation failure.
  2865. -+ */
  2866. -+ brcmf_sdiod_sgtable_alloc(bus->sdiodev);
  2867. -+
  2868. - /* Query the F2 block size, set roundup accordingly */
  2869. - bus->blocksize = bus->sdiodev->func[2]->cur_blksize;
  2870. - bus->roundup = min(max_roundup, bus->blocksize);
  2871. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
  2872. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
  2873. -@@ -342,6 +342,7 @@ int brcmf_sdiod_ramrw(struct brcmf_sdio_
  2874. -
  2875. - /* Issue an abort to the specified function */
  2876. - int brcmf_sdiod_abort(struct brcmf_sdio_dev *sdiodev, uint fn);
  2877. -+void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev);
  2878. - void brcmf_sdiod_change_state(struct brcmf_sdio_dev *sdiodev,
  2879. - enum brcmf_sdiod_state state);
  2880. - #ifdef CONFIG_PM_SLEEP
  2881. 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
  2882. new file mode 100644
  2883. index 0000000..41c27ca
  2884. --- /dev/null
  2885. +++ b/package/kernel/mac80211/patches/309-cfg80211-fix-proto-in-ieee80211_data_to_8023-for-fra.patch
  2886. @@ -0,0 +1,37 @@
  2887. +From: Felix Fietkau <nbd@nbd.name>
  2888. +Date: Wed, 29 Jun 2016 10:02:32 +0200
  2889. +Subject: [PATCH] cfg80211: fix proto in ieee80211_data_to_8023 for frames
  2890. + without LLC header
  2891. +
  2892. +The PDU length of incoming LLC frames is set to the total skb payload size
  2893. +in __ieee80211_data_to_8023() of net/wireless/util.c which incorrectly
  2894. +includes the length of the IEEE 802.11 header.
  2895. +
  2896. +The resulting LLC frame header has a too large PDU length, causing the
  2897. +llc_fixup_skb() function of net/llc/llc_input.c to reject the incoming
  2898. +skb, effectively breaking STP.
  2899. +
  2900. +Solve the problem by properly substracting the IEEE 802.11 frame header size
  2901. +from the PDU length, allowing the LLC processor to pick up the incoming
  2902. +control messages.
  2903. +
  2904. +Special thanks to Gerry Rozema for tracking down the regression and proposing
  2905. +a suitable patch.
  2906. +
  2907. +Fixes: 2d1c304cb2d5 ("cfg80211: add function for 802.3 conversion with separate output buffer")
  2908. +Cc: stable@vger.kernel.org
  2909. +Reported-by: Gerry Rozema <gerryr@rozeware.com>
  2910. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  2911. +---
  2912. +
  2913. +--- a/net/wireless/util.c
  2914. ++++ b/net/wireless/util.c
  2915. +@@ -509,7 +509,7 @@ static int __ieee80211_data_to_8023(stru
  2916. + * replace EtherType */
  2917. + hdrlen += ETH_ALEN + 2;
  2918. + else
  2919. +- tmp.h_proto = htons(skb->len);
  2920. ++ tmp.h_proto = htons(skb->len - hdrlen);
  2921. +
  2922. + pskb_pull(skb, hdrlen);
  2923. +
  2924. 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
  2925. deleted file mode 100644
  2926. index 287d6e1..0000000
  2927. --- a/package/kernel/mac80211/patches/310-ath9k_hw-ignore-eeprom-magic-mismatch-on-flash-based.patch
  2928. +++ /dev/null
  2929. @@ -1,38 +0,0 @@
  2930. -From: Felix Fietkau <nbd@openwrt.org>
  2931. -Date: Thu, 21 Jan 2016 16:28:44 +0100
  2932. -Subject: [PATCH] ath9k_hw: ignore eeprom magic mismatch on flash based devices
  2933. -
  2934. -Many AR913x based devices (maybe others too) do not have a valid EEPROM
  2935. -magic in their calibration data partition.
  2936. -
  2937. -Fixes: 6fa658fd5ab2 ("ath9k: Simplify and fix eeprom endianness swapping")
  2938. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  2939. ----
  2940. -
  2941. ---- a/drivers/net/wireless/ath/ath9k/eeprom.c
  2942. -+++ b/drivers/net/wireless/ath/ath9k/eeprom.c
  2943. -@@ -150,18 +150,18 @@ int ath9k_hw_nvram_swap_data(struct ath_
  2944. - return -EIO;
  2945. - }
  2946. -
  2947. -- if (magic == AR5416_EEPROM_MAGIC) {
  2948. -- *swap_needed = false;
  2949. -- } else if (swab16(magic) == AR5416_EEPROM_MAGIC) {
  2950. -+ *swap_needed = false;
  2951. -+ if (swab16(magic) == AR5416_EEPROM_MAGIC) {
  2952. - if (ah->ah_flags & AH_NO_EEP_SWAP) {
  2953. - ath_info(common,
  2954. - "Ignoring endianness difference in EEPROM magic bytes.\n");
  2955. --
  2956. -- *swap_needed = false;
  2957. - } else {
  2958. - *swap_needed = true;
  2959. - }
  2960. -- } else {
  2961. -+ } else if (magic != AR5416_EEPROM_MAGIC) {
  2962. -+ if (ath9k_hw_use_flash(ah))
  2963. -+ return 0;
  2964. -+
  2965. - ath_err(common,
  2966. - "Invalid EEPROM Magic (0x%04x).\n", magic);
  2967. - return -EINVAL;
  2968. 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
  2969. new file mode 100644
  2970. index 0000000..25929c9
  2971. --- /dev/null
  2972. +++ b/package/kernel/mac80211/patches/310-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch
  2973. @@ -0,0 +1,81 @@
  2974. +From: Chaitanya T K <chaitanya.mgit@gmail.com>
  2975. +Date: Mon, 27 Jun 2016 15:23:26 +0530
  2976. +Subject: [PATCH] mac80211: minstrel: Enable STBC and LDPC for VHT Rates
  2977. +
  2978. +If peer support reception of STBC and LDPC, enable them for better
  2979. +performance.
  2980. +
  2981. +Signed-off-by: Chaitanya TK <chaitanya.mgit@gmail.com>
  2982. +---
  2983. +
  2984. +--- a/include/linux/ieee80211.h
  2985. ++++ b/include/linux/ieee80211.h
  2986. +@@ -1550,6 +1550,7 @@ struct ieee80211_vht_operation {
  2987. + #define IEEE80211_VHT_CAP_RXSTBC_3 0x00000300
  2988. + #define IEEE80211_VHT_CAP_RXSTBC_4 0x00000400
  2989. + #define IEEE80211_VHT_CAP_RXSTBC_MASK 0x00000700
  2990. ++#define IEEE80211_VHT_CAP_RXSTBC_SHIFT 8
  2991. + #define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800
  2992. + #define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000
  2993. + #define IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT 13
  2994. +--- a/net/mac80211/rc80211_minstrel_ht.c
  2995. ++++ b/net/mac80211/rc80211_minstrel_ht.c
  2996. +@@ -1166,13 +1166,14 @@ minstrel_ht_update_caps(void *priv, stru
  2997. + struct minstrel_ht_sta_priv *msp = priv_sta;
  2998. + struct minstrel_ht_sta *mi = &msp->ht;
  2999. + struct ieee80211_mcs_info *mcs = &sta->ht_cap.mcs;
  3000. +- u16 sta_cap = sta->ht_cap.cap;
  3001. ++ u16 ht_cap = sta->ht_cap.cap;
  3002. + struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap;
  3003. + int use_vht;
  3004. + int n_supported = 0;
  3005. + int ack_dur;
  3006. + int stbc;
  3007. + int i;
  3008. ++ bool ldpc = false;
  3009. +
  3010. + /* fall back to the old minstrel for legacy stations */
  3011. + if (!sta->ht_cap.ht_supported)
  3012. +@@ -1210,16 +1211,24 @@ minstrel_ht_update_caps(void *priv, stru
  3013. + }
  3014. + mi->sample_tries = 4;
  3015. +
  3016. +- /* TODO tx_flags for vht - ATM the RC API is not fine-grained enough */
  3017. + if (!use_vht) {
  3018. +- stbc = (sta_cap & IEEE80211_HT_CAP_RX_STBC) >>
  3019. ++ stbc = (ht_cap & IEEE80211_HT_CAP_RX_STBC) >>
  3020. + IEEE80211_HT_CAP_RX_STBC_SHIFT;
  3021. +- mi->tx_flags |= stbc << IEEE80211_TX_CTL_STBC_SHIFT;
  3022. +
  3023. +- if (sta_cap & IEEE80211_HT_CAP_LDPC_CODING)
  3024. +- mi->tx_flags |= IEEE80211_TX_CTL_LDPC;
  3025. ++ if (ht_cap & IEEE80211_HT_CAP_LDPC_CODING)
  3026. ++ ldpc = true;
  3027. ++ } else {
  3028. ++ stbc = (vht_cap->cap & IEEE80211_VHT_CAP_RXSTBC_MASK) >>
  3029. ++ IEEE80211_VHT_CAP_RXSTBC_SHIFT;
  3030. ++
  3031. ++ if (vht_cap->cap & IEEE80211_VHT_CAP_RXLDPC)
  3032. ++ ldpc = true;
  3033. + }
  3034. +
  3035. ++ mi->tx_flags |= stbc << IEEE80211_TX_CTL_STBC_SHIFT;
  3036. ++ if (ldpc)
  3037. ++ mi->tx_flags |= IEEE80211_TX_CTL_LDPC;
  3038. ++
  3039. + for (i = 0; i < ARRAY_SIZE(mi->groups); i++) {
  3040. + u32 gflags = minstrel_mcs_groups[i].flags;
  3041. + int bw, nss;
  3042. +@@ -1232,10 +1241,10 @@ minstrel_ht_update_caps(void *priv, stru
  3043. +
  3044. + if (gflags & IEEE80211_TX_RC_SHORT_GI) {
  3045. + if (gflags & IEEE80211_TX_RC_40_MHZ_WIDTH) {
  3046. +- if (!(sta_cap & IEEE80211_HT_CAP_SGI_40))
  3047. ++ if (!(ht_cap & IEEE80211_HT_CAP_SGI_40))
  3048. + continue;
  3049. + } else {
  3050. +- if (!(sta_cap & IEEE80211_HT_CAP_SGI_20))
  3051. ++ if (!(ht_cap & IEEE80211_HT_CAP_SGI_20))
  3052. + continue;
  3053. + }
  3054. + }
  3055. 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
  3056. new file mode 100644
  3057. index 0000000..4cf26a6
  3058. --- /dev/null
  3059. +++ b/package/kernel/mac80211/patches/311-ath10k-disable-wake_tx_queue-for-older-devices.patch
  3060. @@ -0,0 +1,73 @@
  3061. +From: Michal Kazior <michal.kazior@tieto.com>
  3062. +Date: Tue, 17 May 2016 14:47:01 +0200
  3063. +Subject: [PATCH] ath10k: disable wake_tx_queue for older devices
  3064. +
  3065. +Some setups suffer performance regressions with
  3066. +current wake_tx_queue implementation.
  3067. +
  3068. +Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
  3069. +---
  3070. +
  3071. +--- a/drivers/net/wireless/ath/ath10k/core.h
  3072. ++++ b/drivers/net/wireless/ath/ath10k/core.h
  3073. +@@ -667,6 +667,7 @@ struct ath10k_fw_components {
  3074. + struct ath10k {
  3075. + struct ath_common ath_common;
  3076. + struct ieee80211_hw *hw;
  3077. ++ struct ieee80211_ops *ops;
  3078. + struct device *dev;
  3079. + u8 mac_addr[ETH_ALEN];
  3080. +
  3081. +--- a/drivers/net/wireless/ath/ath10k/mac.c
  3082. ++++ b/drivers/net/wireless/ath/ath10k/mac.c
  3083. +@@ -7497,21 +7497,32 @@ static const struct ieee80211_channel at
  3084. + struct ath10k *ath10k_mac_create(size_t priv_size)
  3085. + {
  3086. + struct ieee80211_hw *hw;
  3087. ++ struct ieee80211_ops *ops;
  3088. + struct ath10k *ar;
  3089. +
  3090. +- hw = ieee80211_alloc_hw(sizeof(struct ath10k) + priv_size, &ath10k_ops);
  3091. +- if (!hw)
  3092. ++ ops = kmemdup(&ath10k_ops, sizeof(ath10k_ops), GFP_KERNEL);
  3093. ++ if (!ops)
  3094. ++ return NULL;
  3095. ++
  3096. ++ hw = ieee80211_alloc_hw(sizeof(struct ath10k) + priv_size, ops);
  3097. ++ if (!hw) {
  3098. ++ kfree(ops);
  3099. + return NULL;
  3100. ++ }
  3101. +
  3102. + ar = hw->priv;
  3103. + ar->hw = hw;
  3104. ++ ar->ops = ops;
  3105. +
  3106. + return ar;
  3107. + }
  3108. +
  3109. + void ath10k_mac_destroy(struct ath10k *ar)
  3110. + {
  3111. ++ struct ieee80211_ops *ops = ar->ops;
  3112. ++
  3113. + ieee80211_free_hw(ar->hw);
  3114. ++ kfree(ops);
  3115. + }
  3116. +
  3117. + static const struct ieee80211_iface_limit ath10k_if_limits[] = {
  3118. +@@ -7945,6 +7956,15 @@ int ath10k_mac_register(struct ath10k *a
  3119. + ath10k_warn(ar, "failed to initialise DFS pattern detector\n");
  3120. + }
  3121. +
  3122. ++ /* Current wake_tx_queue implementation imposes a significant
  3123. ++ * performance penalty in some setups. The tx scheduling code needs
  3124. ++ * more work anyway so disable the wake_tx_queue unless firmware
  3125. ++ * supports the pull-push mechanism.
  3126. ++ */
  3127. ++ if (!test_bit(ATH10K_FW_FEATURE_PEER_FLOW_CONTROL,
  3128. ++ ar->running_fw->fw_file.fw_features))
  3129. ++ ar->ops->wake_tx_queue = NULL;
  3130. ++
  3131. + ret = ath_regd_init(&ar->ath_common.regulatory, ar->hw->wiphy,
  3132. + ath10k_reg_notifier);
  3133. + if (ret) {
  3134. 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
  3135. deleted file mode 100644
  3136. index 070efa9..0000000
  3137. --- a/package/kernel/mac80211/patches/311-ath9k-do-not-limit-the-number-of-DFS-interfaces-to-1.patch
  3138. +++ /dev/null
  3139. @@ -1,55 +0,0 @@
  3140. -From: Felix Fietkau <nbd@openwrt.org>
  3141. -Date: Fri, 22 Jan 2016 01:05:56 +0100
  3142. -Subject: [PATCH] ath9k: do not limit the number of DFS interfaces to 1
  3143. -
  3144. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  3145. ----
  3146. -
  3147. ---- a/drivers/net/wireless/ath/ath9k/init.c
  3148. -+++ b/drivers/net/wireless/ath/ath9k/init.c
  3149. -@@ -751,14 +751,6 @@ static const struct ieee80211_iface_comb
  3150. -
  3151. - #endif /* CPTCFG_ATH9K_CHANNEL_CONTEXT */
  3152. -
  3153. --static const struct ieee80211_iface_limit if_dfs_limits[] = {
  3154. -- { .max = 1, .types = BIT(NL80211_IFTYPE_AP) |
  3155. --#ifdef CPTCFG_MAC80211_MESH
  3156. -- BIT(NL80211_IFTYPE_MESH_POINT) |
  3157. --#endif
  3158. -- BIT(NL80211_IFTYPE_ADHOC) },
  3159. --};
  3160. --
  3161. - static const struct ieee80211_iface_combination if_comb[] = {
  3162. - {
  3163. - .limits = if_limits,
  3164. -@@ -766,6 +758,11 @@ static const struct ieee80211_iface_comb
  3165. - .max_interfaces = 2048,
  3166. - .num_different_channels = 1,
  3167. - .beacon_int_infra_match = true,
  3168. -+#ifdef CPTCFG_ATH9K_DFS_CERTIFIED
  3169. -+ .radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) |
  3170. -+ BIT(NL80211_CHAN_WIDTH_20) |
  3171. -+ BIT(NL80211_CHAN_WIDTH_40),
  3172. -+#endif
  3173. - },
  3174. - {
  3175. - .limits = wds_limits,
  3176. -@@ -774,18 +771,6 @@ static const struct ieee80211_iface_comb
  3177. - .num_different_channels = 1,
  3178. - .beacon_int_infra_match = true,
  3179. - },
  3180. --#ifdef CPTCFG_ATH9K_DFS_CERTIFIED
  3181. -- {
  3182. -- .limits = if_dfs_limits,
  3183. -- .n_limits = ARRAY_SIZE(if_dfs_limits),
  3184. -- .max_interfaces = 1,
  3185. -- .num_different_channels = 1,
  3186. -- .beacon_int_infra_match = true,
  3187. -- .radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) |
  3188. -- BIT(NL80211_CHAN_WIDTH_20) |
  3189. -- BIT(NL80211_CHAN_WIDTH_40),
  3190. -- }
  3191. --#endif
  3192. - };
  3193. -
  3194. - #ifdef CPTCFG_ATH9K_CHANNEL_CONTEXT
  3195. 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
  3196. new file mode 100644
  3197. index 0000000..df43105
  3198. --- /dev/null
  3199. +++ b/package/kernel/mac80211/patches/312-ath9k-Correct-TSF-adjustment-to-align-the-beacon-tim.patch
  3200. @@ -0,0 +1,45 @@
  3201. +From: Benjamin Berg <benjamin.berg@open-mesh.com>
  3202. +Date: Mon, 4 Jul 2016 14:37:20 +0200
  3203. +Subject: [PATCH] ath9k: Correct TSF adjustment to align the beacon time
  3204. + correctly
  3205. +
  3206. +Beacons were not send out at (timestamp % beacon_time == 0) for interfaces
  3207. +other than the primary one. To send out beacons with the correct timestamp
  3208. +according to 10.1.3.2 of the 802.11 standard the tsf_adjustment has to be
  3209. +set to the negative time difference instead of positive. This way the
  3210. +later beacons get corrected to have a lower (and similar) timestamp with
  3211. +regard to the beacon from slot 0.
  3212. +
  3213. +I am not aware about any issues that have been caused by this.
  3214. +
  3215. +Signed-off-by: Benjamin Berg <benjamin.berg@open-mesh.com>
  3216. +---
  3217. +
  3218. +--- a/drivers/net/wireless/ath/ath9k/beacon.c
  3219. ++++ b/drivers/net/wireless/ath/ath9k/beacon.c
  3220. +@@ -279,17 +279,21 @@ static void ath9k_set_tsfadjust(struct a
  3221. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  3222. + struct ath_vif *avp = (void *)vif->drv_priv;
  3223. + struct ath_beacon_config *cur_conf = &avp->chanctx->beacon;
  3224. +- u32 tsfadjust;
  3225. ++ s64 tsfadjust;
  3226. +
  3227. + if (avp->av_bslot == 0)
  3228. + return;
  3229. +
  3230. ++ /* tsf_adjust is added to the TSF value. We send out the beacon late,
  3231. ++ * so need to adjust the TSF starting point to be later in time (i.e.
  3232. ++ * the theoretical first beacon has a TSF of 0 after correction).
  3233. ++ */
  3234. + tsfadjust = cur_conf->beacon_interval * avp->av_bslot;
  3235. +- tsfadjust = TU_TO_USEC(tsfadjust) / ATH_BCBUF;
  3236. ++ tsfadjust = -TU_TO_USEC(tsfadjust) / ATH_BCBUF;
  3237. + avp->tsf_adjust = cpu_to_le64(tsfadjust);
  3238. +
  3239. +- ath_dbg(common, CONFIG, "tsfadjust is: %llu for bslot: %d\n",
  3240. +- (unsigned long long)tsfadjust, avp->av_bslot);
  3241. ++ ath_dbg(common, CONFIG, "tsfadjust is: %lld for bslot: %d\n",
  3242. ++ (signed long long)tsfadjust, avp->av_bslot);
  3243. + }
  3244. +
  3245. + bool ath9k_csa_is_finished(struct ath_softc *sc, struct ieee80211_vif *vif)
  3246. 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
  3247. deleted file mode 100644
  3248. index 61cafc7..0000000
  3249. --- a/package/kernel/mac80211/patches/312-mac80211-fix-txq-queue-related-crashes.patch
  3250. +++ /dev/null
  3251. @@ -1,27 +0,0 @@
  3252. -From: Michal Kazior <michal.kazior@tieto.com>
  3253. -Date: Thu, 21 Jan 2016 14:23:07 +0100
  3254. -Subject: [PATCH] mac80211: fix txq queue related crashes
  3255. -
  3256. -The driver can access the queue simultanously
  3257. -while mac80211 tears down the interface. Without
  3258. -spinlock protection this could lead to corrupting
  3259. -sk_buff_head and subsequently to an invalid
  3260. -pointer dereference.
  3261. -
  3262. -Fixes: ba8c3d6f16a1 ("mac80211: add an intermediate software queue implementation")
  3263. -Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
  3264. ----
  3265. -
  3266. ---- a/net/mac80211/iface.c
  3267. -+++ b/net/mac80211/iface.c
  3268. -@@ -977,7 +977,10 @@ static void ieee80211_do_stop(struct iee
  3269. - if (sdata->vif.txq) {
  3270. - struct txq_info *txqi = to_txq_info(sdata->vif.txq);
  3271. -
  3272. -+ spin_lock_bh(&txqi->queue.lock);
  3273. - ieee80211_purge_tx_queue(&local->hw, &txqi->queue);
  3274. -+ spin_unlock_bh(&txqi->queue.lock);
  3275. -+
  3276. - atomic_set(&sdata->txqs_len[txqi->txq.ac], 0);
  3277. - }
  3278. -
  3279. 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
  3280. new file mode 100644
  3281. index 0000000..ef0afbe
  3282. --- /dev/null
  3283. +++ b/package/kernel/mac80211/patches/313-ath9k-Handle-channel-context-in-get_-set_-reset_tsf.patch
  3284. @@ -0,0 +1,70 @@
  3285. +From: Benjamin Berg <benjamin.berg@open-mesh.com>
  3286. +Date: Mon, 4 Jul 2016 14:37:21 +0200
  3287. +Subject: [PATCH] ath9k: Handle channel context in get_/set_/reset_tsf
  3288. +
  3289. +The ath9k TSF handling routines need to be aware of the channel context that
  3290. +is being modified. With this change the TSF related values that are stored
  3291. +in each channel context will be correctly tracked and the harware will only
  3292. +be updated if the modified context is currently the active one.
  3293. +
  3294. +Without this change the TSF modifications done using these routines would
  3295. +for example be lost during a hardware reset as done by ath_complete_reset.
  3296. +
  3297. +Signed-off-by: Benjamin Berg <benjamin.berg@open-mesh.com>
  3298. +---
  3299. +
  3300. +--- a/drivers/net/wireless/ath/ath9k/main.c
  3301. ++++ b/drivers/net/wireless/ath/ath9k/main.c
  3302. +@@ -1823,11 +1823,18 @@ static void ath9k_bss_info_changed(struc
  3303. + static u64 ath9k_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
  3304. + {
  3305. + struct ath_softc *sc = hw->priv;
  3306. ++ struct ath_vif *avp = (void *)vif->drv_priv;
  3307. + u64 tsf;
  3308. +
  3309. + mutex_lock(&sc->mutex);
  3310. + ath9k_ps_wakeup(sc);
  3311. +- tsf = ath9k_hw_gettsf64(sc->sc_ah);
  3312. ++ /* Get current TSF either from HW or kernel time. */
  3313. ++ if (sc->cur_chan == avp->chanctx) {
  3314. ++ tsf = ath9k_hw_gettsf64(sc->sc_ah);
  3315. ++ } else {
  3316. ++ tsf = sc->cur_chan->tsf_val +
  3317. ++ ath9k_hw_get_tsf_offset(&sc->cur_chan->tsf_ts, NULL);
  3318. ++ }
  3319. + ath9k_ps_restore(sc);
  3320. + mutex_unlock(&sc->mutex);
  3321. +
  3322. +@@ -1839,10 +1846,14 @@ static void ath9k_set_tsf(struct ieee802
  3323. + u64 tsf)
  3324. + {
  3325. + struct ath_softc *sc = hw->priv;
  3326. ++ struct ath_vif *avp = (void *)vif->drv_priv;
  3327. +
  3328. + mutex_lock(&sc->mutex);
  3329. + ath9k_ps_wakeup(sc);
  3330. +- ath9k_hw_settsf64(sc->sc_ah, tsf);
  3331. ++ getrawmonotonic(&avp->chanctx->tsf_ts);
  3332. ++ if (sc->cur_chan == avp->chanctx)
  3333. ++ ath9k_hw_settsf64(sc->sc_ah, tsf);
  3334. ++ avp->chanctx->tsf_val = tsf;
  3335. + ath9k_ps_restore(sc);
  3336. + mutex_unlock(&sc->mutex);
  3337. + }
  3338. +@@ -1850,11 +1861,15 @@ static void ath9k_set_tsf(struct ieee802
  3339. + static void ath9k_reset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
  3340. + {
  3341. + struct ath_softc *sc = hw->priv;
  3342. ++ struct ath_vif *avp = (void *)vif->drv_priv;
  3343. +
  3344. + mutex_lock(&sc->mutex);
  3345. +
  3346. + ath9k_ps_wakeup(sc);
  3347. +- ath9k_hw_reset_tsf(sc->sc_ah);
  3348. ++ getrawmonotonic(&avp->chanctx->tsf_ts);
  3349. ++ if (sc->cur_chan == avp->chanctx)
  3350. ++ ath9k_hw_reset_tsf(sc->sc_ah);
  3351. ++ avp->chanctx->tsf_val = 0;
  3352. + ath9k_ps_restore(sc);
  3353. +
  3354. + mutex_unlock(&sc->mutex);
  3355. 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
  3356. deleted file mode 100644
  3357. index 844d43b..0000000
  3358. --- a/package/kernel/mac80211/patches/313-mac80211-fix-unnecessary-frame-drops-in-mesh-fwding.patch
  3359. +++ /dev/null
  3360. @@ -1,57 +0,0 @@
  3361. -From: Michal Kazior <michal.kazior@tieto.com>
  3362. -Date: Mon, 25 Jan 2016 14:43:24 +0100
  3363. -Subject: [PATCH] mac80211: fix unnecessary frame drops in mesh fwding
  3364. -
  3365. -The ieee80211_queue_stopped() expects hw queue
  3366. -number but it was given raw WMM AC number instead.
  3367. -
  3368. -This could cause frame drops and problems with
  3369. -traffic in some cases - most notably if driver
  3370. -doesn't map AC numbers to queue numbers 1:1 and
  3371. -uses ieee80211_stop_queues() and
  3372. -ieee80211_wake_queue() only without ever calling
  3373. -ieee80211_wake_queues().
  3374. -
  3375. -On ath10k it was possible to hit this problem in
  3376. -the following case:
  3377. -
  3378. - 1. wlan0 uses queue 0
  3379. - (ath10k maps queues per vif)
  3380. - 2. offchannel uses queue 15
  3381. - 3. queues 1-14 are unused
  3382. - 4. ieee80211_stop_queues()
  3383. - 5. ieee80211_wake_queue(q=0)
  3384. - 6. ieee80211_wake_queue(q=15)
  3385. - (other queues are not woken up because both
  3386. - driver and mac80211 know other queues are
  3387. - unused)
  3388. - 7. ieee80211_rx_h_mesh_fwding()
  3389. - 8. ieee80211_select_queue_80211() returns 2
  3390. - 9. ieee80211_queue_stopped(q=2) returns true
  3391. - 10. frame is dropped (oops!)
  3392. -
  3393. -Fixes: d3c1597b8d1b ("mac80211: fix forwarded mesh frame queue mapping")
  3394. -Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
  3395. ----
  3396. -
  3397. ---- a/net/mac80211/rx.c
  3398. -+++ b/net/mac80211/rx.c
  3399. -@@ -2235,7 +2235,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
  3400. - struct ieee80211_local *local = rx->local;
  3401. - struct ieee80211_sub_if_data *sdata = rx->sdata;
  3402. - struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
  3403. -- u16 q, hdrlen;
  3404. -+ u16 ac, q, hdrlen;
  3405. -
  3406. - hdr = (struct ieee80211_hdr *) skb->data;
  3407. - hdrlen = ieee80211_hdrlen(hdr->frame_control);
  3408. -@@ -2304,7 +2304,8 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
  3409. - ether_addr_equal(sdata->vif.addr, hdr->addr3))
  3410. - return RX_CONTINUE;
  3411. -
  3412. -- q = ieee80211_select_queue_80211(sdata, skb, hdr);
  3413. -+ ac = ieee80211_select_queue_80211(sdata, skb, hdr);
  3414. -+ q = sdata->vif.hw_queue[ac];
  3415. - if (ieee80211_queue_stopped(&local->hw, q)) {
  3416. - IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_congestion);
  3417. - return RX_DROP_MONITOR;
  3418. 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
  3419. new file mode 100644
  3420. index 0000000..e725a8b
  3421. --- /dev/null
  3422. +++ b/package/kernel/mac80211/patches/314-ath9k-Use-tsf-offset-helper-in-ath9k_hw_reset.patch
  3423. @@ -0,0 +1,65 @@
  3424. +From: Benjamin Berg <benjamin.berg@open-mesh.com>
  3425. +Date: Mon, 4 Jul 2016 14:37:22 +0200
  3426. +Subject: [PATCH] ath9k: Use tsf offset helper in ath9k_hw_reset
  3427. +
  3428. +These changes make ath9k_hw_reset more consistent with other places that
  3429. +handle the TSF value by using the same helper routine.
  3430. +
  3431. +A slight improvement is to not assume that a fixed time of 1.5ms has
  3432. +passed for the initval writes when compared to the first write attempt.
  3433. +Instead the TSF value is re-calculated which will yield a higher accuracy
  3434. +of the restored TSF timer.
  3435. +
  3436. +Signed-off-by: Benjamin Berg <benjamin.berg@open-mesh.com>
  3437. +---
  3438. +
  3439. +--- a/drivers/net/wireless/ath/ath9k/hw.c
  3440. ++++ b/drivers/net/wireless/ath/ath9k/hw.c
  3441. +@@ -1832,8 +1832,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  3442. + u32 saveLedState;
  3443. + u32 saveDefAntenna;
  3444. + u32 macStaId1;
  3445. ++ struct timespec tsf_ts;
  3446. ++ u32 tsf_offset;
  3447. + u64 tsf = 0;
  3448. +- s64 usec = 0;
  3449. + int r;
  3450. + bool start_mci_reset = false;
  3451. + bool save_fullsleep = ah->chip_fullsleep;
  3452. +@@ -1877,8 +1878,8 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  3453. + macStaId1 = REG_READ(ah, AR_STA_ID1) & AR_STA_ID1_BASE_RATE_11B;
  3454. +
  3455. + /* Save TSF before chip reset, a cold reset clears it */
  3456. ++ getrawmonotonic(&tsf_ts);
  3457. + tsf = ath9k_hw_gettsf64(ah);
  3458. +- usec = ktime_to_us(ktime_get_raw());
  3459. +
  3460. + saveLedState = REG_READ(ah, AR_CFG_LED) &
  3461. + (AR_CFG_LED_ASSOC_CTL | AR_CFG_LED_MODE_SEL |
  3462. +@@ -1911,8 +1912,8 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  3463. + }
  3464. +
  3465. + /* Restore TSF */
  3466. +- usec = ktime_to_us(ktime_get_raw()) - usec;
  3467. +- ath9k_hw_settsf64(ah, tsf + usec);
  3468. ++ tsf_offset = ath9k_hw_get_tsf_offset(&tsf_ts, NULL);
  3469. ++ ath9k_hw_settsf64(ah, tsf + tsf_offset);
  3470. +
  3471. + if (AR_SREV_9280_20_OR_LATER(ah))
  3472. + REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL, AR_GPIO_JTAG_DISABLE);
  3473. +@@ -1932,12 +1933,11 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  3474. + /*
  3475. + * Some AR91xx SoC devices frequently fail to accept TSF writes
  3476. + * right after the chip reset. When that happens, write a new
  3477. +- * value after the initvals have been applied, with an offset
  3478. +- * based on measured time difference
  3479. ++ * value after the initvals have been applied.
  3480. + */
  3481. + if (AR_SREV_9100(ah) && (ath9k_hw_gettsf64(ah) < tsf)) {
  3482. +- tsf += 1500;
  3483. +- ath9k_hw_settsf64(ah, tsf);
  3484. ++ tsf_offset = ath9k_hw_get_tsf_offset(&tsf_ts, NULL);
  3485. ++ ath9k_hw_settsf64(ah, tsf + tsf_offset);
  3486. + }
  3487. +
  3488. + ath9k_hw_init_mfp(ah);
  3489. 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
  3490. deleted file mode 100644
  3491. index 5b3efbd..0000000
  3492. --- a/package/kernel/mac80211/patches/314-mac80211-Requeue-work-after-scan-complete-for-all-VI.patch
  3493. +++ /dev/null
  3494. @@ -1,103 +0,0 @@
  3495. -From: Sachin Kulkarni <Sachin.Kulkarni@imgtec.com>
  3496. -Date: Tue, 12 Jan 2016 14:30:19 +0530
  3497. -Subject: [PATCH] mac80211: Requeue work after scan complete for all VIF
  3498. - types.
  3499. -
  3500. -During a sw scan ieee80211_iface_work ignores work items for all vifs.
  3501. -However after the scan complete work is requeued only for STA, ADHOC
  3502. -and MESH iftypes.
  3503. -
  3504. -This occasionally results in event processing getting delayed/not
  3505. -processed for iftype AP when it coexists with a STA. This can result
  3506. -in data halt and eventually disconnection on the AP interface.
  3507. -
  3508. -Signed-off-by: Sachin Kulkarni <Sachin.Kulkarni@imgtec.com>
  3509. -Cc: linux-wireless@vger.kernel.org
  3510. -Cc: johannes@sipsolutions.net
  3511. ----
  3512. -
  3513. ---- a/net/mac80211/ibss.c
  3514. -+++ b/net/mac80211/ibss.c
  3515. -@@ -1731,7 +1731,6 @@ void ieee80211_ibss_notify_scan_complete
  3516. - if (sdata->vif.type != NL80211_IFTYPE_ADHOC)
  3517. - continue;
  3518. - sdata->u.ibss.last_scan_completed = jiffies;
  3519. -- ieee80211_queue_work(&local->hw, &sdata->work);
  3520. - }
  3521. - mutex_unlock(&local->iflist_mtx);
  3522. - }
  3523. ---- a/net/mac80211/mesh.c
  3524. -+++ b/net/mac80211/mesh.c
  3525. -@@ -1369,17 +1369,6 @@ out:
  3526. - sdata_unlock(sdata);
  3527. - }
  3528. -
  3529. --void ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local)
  3530. --{
  3531. -- struct ieee80211_sub_if_data *sdata;
  3532. --
  3533. -- rcu_read_lock();
  3534. -- list_for_each_entry_rcu(sdata, &local->interfaces, list)
  3535. -- if (ieee80211_vif_is_mesh(&sdata->vif) &&
  3536. -- ieee80211_sdata_running(sdata))
  3537. -- ieee80211_queue_work(&local->hw, &sdata->work);
  3538. -- rcu_read_unlock();
  3539. --}
  3540. -
  3541. - void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata)
  3542. - {
  3543. ---- a/net/mac80211/mesh.h
  3544. -+++ b/net/mac80211/mesh.h
  3545. -@@ -362,14 +362,10 @@ static inline bool mesh_path_sel_is_hwmp
  3546. - return sdata->u.mesh.mesh_pp_id == IEEE80211_PATH_PROTOCOL_HWMP;
  3547. - }
  3548. -
  3549. --void ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local);
  3550. --
  3551. - void mesh_path_flush_by_iface(struct ieee80211_sub_if_data *sdata);
  3552. - void mesh_sync_adjust_tbtt(struct ieee80211_sub_if_data *sdata);
  3553. - void ieee80211s_stop(void);
  3554. - #else
  3555. --static inline void
  3556. --ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local) {}
  3557. - static inline bool mesh_path_sel_is_hwmp(struct ieee80211_sub_if_data *sdata)
  3558. - { return false; }
  3559. - static inline void mesh_path_flush_by_iface(struct ieee80211_sub_if_data *sdata)
  3560. ---- a/net/mac80211/mlme.c
  3561. -+++ b/net/mac80211/mlme.c
  3562. -@@ -3978,8 +3978,6 @@ static void ieee80211_restart_sta_timer(
  3563. - if (!ieee80211_hw_check(&sdata->local->hw, CONNECTION_MONITOR))
  3564. - ieee80211_queue_work(&sdata->local->hw,
  3565. - &sdata->u.mgd.monitor_work);
  3566. -- /* and do all the other regular work too */
  3567. -- ieee80211_queue_work(&sdata->local->hw, &sdata->work);
  3568. - }
  3569. - }
  3570. -
  3571. ---- a/net/mac80211/scan.c
  3572. -+++ b/net/mac80211/scan.c
  3573. -@@ -314,6 +314,7 @@ static void __ieee80211_scan_completed(s
  3574. - bool was_scanning = local->scanning;
  3575. - struct cfg80211_scan_request *scan_req;
  3576. - struct ieee80211_sub_if_data *scan_sdata;
  3577. -+ struct ieee80211_sub_if_data *sdata;
  3578. -
  3579. - lockdep_assert_held(&local->mtx);
  3580. -
  3581. -@@ -373,7 +374,15 @@ static void __ieee80211_scan_completed(s
  3582. -
  3583. - ieee80211_mlme_notify_scan_completed(local);
  3584. - ieee80211_ibss_notify_scan_completed(local);
  3585. -- ieee80211_mesh_notify_scan_completed(local);
  3586. -+
  3587. -+ /* Requeue all the work that might have been ignored while
  3588. -+ * the scan was in progress
  3589. -+ */
  3590. -+ list_for_each_entry_rcu(sdata, &local->interfaces, list) {
  3591. -+ if (ieee80211_sdata_running(sdata))
  3592. -+ ieee80211_queue_work(&sdata->local->hw, &sdata->work);
  3593. -+ }
  3594. -+
  3595. - if (was_scanning)
  3596. - ieee80211_start_next_roc(local);
  3597. - }
  3598. 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
  3599. new file mode 100644
  3600. index 0000000..c95ab7e
  3601. --- /dev/null
  3602. +++ b/package/kernel/mac80211/patches/315-ath9k-Expose-tsf_adjustment-in-mac80211-tsf-getters-.patch
  3603. @@ -0,0 +1,32 @@
  3604. +From: Benjamin Berg <benjamin.berg@open-mesh.com>
  3605. +Date: Mon, 4 Jul 2016 14:37:23 +0200
  3606. +Subject: [PATCH] ath9k: Expose tsf_adjustment in mac80211 tsf getters and
  3607. + setters.
  3608. +
  3609. +The ath9k driver modifies the TSF for VIFs for the purpose of sending
  3610. +beacons in a staggered fashion. This patch exposes this VIF specific
  3611. +adjustment of the TSF value to mac80211. Without the change the TSF
  3612. +routines handle the hardware TSF value instead of the actual TSF value as
  3613. +seen on the air.
  3614. +
  3615. +Signed-off-by: Benjamin Berg <benjamin.berg@open-mesh.com>
  3616. +---
  3617. +
  3618. +--- a/drivers/net/wireless/ath/ath9k/main.c
  3619. ++++ b/drivers/net/wireless/ath/ath9k/main.c
  3620. +@@ -1835,6 +1835,7 @@ static u64 ath9k_get_tsf(struct ieee8021
  3621. + tsf = sc->cur_chan->tsf_val +
  3622. + ath9k_hw_get_tsf_offset(&sc->cur_chan->tsf_ts, NULL);
  3623. + }
  3624. ++ tsf += le64_to_cpu(avp->tsf_adjust);
  3625. + ath9k_ps_restore(sc);
  3626. + mutex_unlock(&sc->mutex);
  3627. +
  3628. +@@ -1850,6 +1851,7 @@ static void ath9k_set_tsf(struct ieee802
  3629. +
  3630. + mutex_lock(&sc->mutex);
  3631. + ath9k_ps_wakeup(sc);
  3632. ++ tsf -= le64_to_cpu(avp->tsf_adjust);
  3633. + getrawmonotonic(&avp->chanctx->tsf_ts);
  3634. + if (sc->cur_chan == avp->chanctx)
  3635. + ath9k_hw_settsf64(sc->sc_ah, tsf);
  3636. 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
  3637. deleted file mode 100644
  3638. index 52fecb9..0000000
  3639. --- a/package/kernel/mac80211/patches/315-mac80211-fix-ibss-scan-parameters.patch
  3640. +++ /dev/null
  3641. @@ -1,57 +0,0 @@
  3642. -From: Sara Sharon <sara.sharon@intel.com>
  3643. -Date: Mon, 25 Jan 2016 15:46:35 +0200
  3644. -Subject: [PATCH] mac80211: fix ibss scan parameters
  3645. -
  3646. -When joining IBSS a full scan should be initiated in order to search
  3647. -for existing cell, unless the fixed_channel parameter was set.
  3648. -A default channel to create the IBSS on if no cell was found is
  3649. -provided as well.
  3650. -However - a scan is initiated only on the default channel provided
  3651. -regardless of whether ifibss->fixed_channel is set or not, with the
  3652. -obvious result of the cell not joining existing IBSS cell that is
  3653. -on another channel.
  3654. -
  3655. -Fixes: 76bed0f43b27 ("mac80211: IBSS fix scan request")
  3656. -Signed-off-by: Sara Sharon <sara.sharon@intel.com>
  3657. -Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
  3658. ----
  3659. -
  3660. ---- a/net/mac80211/ibss.c
  3661. -+++ b/net/mac80211/ibss.c
  3662. -@@ -7,6 +7,7 @@
  3663. - * Copyright 2007, Michael Wu <flamingice@sourmilk.net>
  3664. - * Copyright 2009, Johannes Berg <johannes@sipsolutions.net>
  3665. - * Copyright 2013-2014 Intel Mobile Communications GmbH
  3666. -+ * Copyright(c) 2016 Intel Deutschland GmbH
  3667. - *
  3668. - * This program is free software; you can redistribute it and/or modify
  3669. - * it under the terms of the GNU General Public License version 2 as
  3670. -@@ -1483,14 +1484,21 @@ static void ieee80211_sta_find_ibss(stru
  3671. -
  3672. - sdata_info(sdata, "Trigger new scan to find an IBSS to join\n");
  3673. -
  3674. -- num = ieee80211_ibss_setup_scan_channels(local->hw.wiphy,
  3675. -- &ifibss->chandef,
  3676. -- channels,
  3677. -- ARRAY_SIZE(channels));
  3678. - scan_width = cfg80211_chandef_to_scan_width(&ifibss->chandef);
  3679. -- ieee80211_request_ibss_scan(sdata, ifibss->ssid,
  3680. -- ifibss->ssid_len, channels, num,
  3681. -- scan_width);
  3682. -+
  3683. -+ if (ifibss->fixed_channel) {
  3684. -+ num = ieee80211_ibss_setup_scan_channels(local->hw.wiphy,
  3685. -+ &ifibss->chandef,
  3686. -+ channels,
  3687. -+ ARRAY_SIZE(channels));
  3688. -+ ieee80211_request_ibss_scan(sdata, ifibss->ssid,
  3689. -+ ifibss->ssid_len, channels,
  3690. -+ num, scan_width);
  3691. -+ } else {
  3692. -+ ieee80211_request_ibss_scan(sdata, ifibss->ssid,
  3693. -+ ifibss->ssid_len, NULL,
  3694. -+ 0, scan_width);
  3695. -+ }
  3696. - } else {
  3697. - int interval = IEEE80211_SCAN_INTERVAL;
  3698. -
  3699. 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
  3700. new file mode 100644
  3701. index 0000000..36aaa10
  3702. --- /dev/null
  3703. +++ b/package/kernel/mac80211/patches/316-ath9k-Remove-some-defined-constants-to-decrease-verb.patch
  3704. @@ -0,0 +1,137 @@
  3705. +From: Benjamin Berg <benjamin.berg@open-mesh.com>
  3706. +Date: Mon, 4 Jul 2016 14:37:24 +0200
  3707. +Subject: [PATCH] ath9k: Remove some #defined constants to decrease
  3708. + verbosity
  3709. +
  3710. +The removed ATH9K_SLOT_TIME_X constants simply map the value in microseconds
  3711. +to the same integer. These constants were not used consistently, so fix the
  3712. +inconsistency issue by replacing all occurances with the integer equivalent.
  3713. +
  3714. +Signed-off-by: Benjamin Berg <benjamin.berg@open-mesh.com>
  3715. +---
  3716. +
  3717. +--- a/drivers/net/wireless/ath/ath9k/beacon.c
  3718. ++++ b/drivers/net/wireless/ath/ath9k/beacon.c
  3719. +@@ -50,7 +50,7 @@ static void ath9k_beaconq_config(struct
  3720. + txq = sc->tx.txq_map[IEEE80211_AC_BE];
  3721. + ath9k_hw_get_txq_props(ah, txq->axq_qnum, &qi_be);
  3722. + qi.tqi_aifs = qi_be.tqi_aifs;
  3723. +- if (ah->slottime == ATH9K_SLOT_TIME_20)
  3724. ++ if (ah->slottime == 20)
  3725. + qi.tqi_cwmin = 2*qi_be.tqi_cwmin;
  3726. + else
  3727. + qi.tqi_cwmin = 4*qi_be.tqi_cwmin;
  3728. +--- a/drivers/net/wireless/ath/ath9k/dynack.c
  3729. ++++ b/drivers/net/wireless/ath/ath9k/dynack.c
  3730. +@@ -280,7 +280,7 @@ EXPORT_SYMBOL(ath_dynack_sample_ack_ts);
  3731. + void ath_dynack_node_init(struct ath_hw *ah, struct ath_node *an)
  3732. + {
  3733. + /* ackto = slottime + sifs + air delay */
  3734. +- u32 ackto = ATH9K_SLOT_TIME_9 + 16 + 64;
  3735. ++ u32 ackto = 9 + 16 + 64;
  3736. + struct ath_dynack *da = &ah->dynack;
  3737. +
  3738. + an->ackto = ackto;
  3739. +@@ -315,7 +315,7 @@ EXPORT_SYMBOL(ath_dynack_node_deinit);
  3740. + void ath_dynack_reset(struct ath_hw *ah)
  3741. + {
  3742. + /* ackto = slottime + sifs + air delay */
  3743. +- u32 ackto = ATH9K_SLOT_TIME_9 + 16 + 64;
  3744. ++ u32 ackto = 9 + 16 + 64;
  3745. + struct ath_dynack *da = &ah->dynack;
  3746. +
  3747. + da->lto = jiffies;
  3748. +--- a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
  3749. ++++ b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
  3750. +@@ -45,7 +45,7 @@ void ath9k_htc_beaconq_config(struct ath
  3751. + * Long slot time : 2x cwmin
  3752. + * Short slot time : 4x cwmin
  3753. + */
  3754. +- if (ah->slottime == ATH9K_SLOT_TIME_20)
  3755. ++ if (ah->slottime == 20)
  3756. + qi.tqi_cwmin = 2*qi_be.tqi_cwmin;
  3757. + else
  3758. + qi.tqi_cwmin = 4*qi_be.tqi_cwmin;
  3759. +--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
  3760. ++++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
  3761. +@@ -678,7 +678,7 @@ static int ath9k_init_priv(struct ath9k_
  3762. +
  3763. + for (i = 0; i < ATH9K_HTC_MAX_BCN_VIF; i++)
  3764. + priv->beacon.bslot[i] = NULL;
  3765. +- priv->beacon.slottime = ATH9K_SLOT_TIME_9;
  3766. ++ priv->beacon.slottime = 9;
  3767. +
  3768. + ath9k_cmn_init_channels_rates(common);
  3769. + ath9k_cmn_init_crypto(ah);
  3770. +--- a/drivers/net/wireless/ath/ath9k/hw.c
  3771. ++++ b/drivers/net/wireless/ath/ath9k/hw.c
  3772. +@@ -454,7 +454,7 @@ static void ath9k_hw_init_defaults(struc
  3773. + if (AR_SREV_9100(ah))
  3774. + ah->sta_id1_defaults |= AR_STA_ID1_AR9100_BA_FIX;
  3775. +
  3776. +- ah->slottime = ATH9K_SLOT_TIME_9;
  3777. ++ ah->slottime = 9;
  3778. + ah->globaltxtimeout = (u32) -1;
  3779. + ah->power_mode = ATH9K_PM_UNDEFINED;
  3780. + ah->htc_reset_init = true;
  3781. +--- a/drivers/net/wireless/ath/ath9k/init.c
  3782. ++++ b/drivers/net/wireless/ath/ath9k/init.c
  3783. +@@ -372,7 +372,7 @@ static void ath9k_init_misc(struct ath_s
  3784. +
  3785. + common->last_rssi = ATH_RSSI_DUMMY_MARKER;
  3786. + memcpy(common->bssidmask, ath_bcast_mac, ETH_ALEN);
  3787. +- sc->beacon.slottime = ATH9K_SLOT_TIME_9;
  3788. ++ sc->beacon.slottime = 9;
  3789. +
  3790. + for (i = 0; i < ARRAY_SIZE(sc->beacon.bslot); i++)
  3791. + sc->beacon.bslot[i] = NULL;
  3792. +--- a/drivers/net/wireless/ath/ath9k/mac.h
  3793. ++++ b/drivers/net/wireless/ath/ath9k/mac.h
  3794. +@@ -65,10 +65,6 @@
  3795. + #define INIT_SSH_RETRY 32
  3796. + #define INIT_SLG_RETRY 32
  3797. +
  3798. +-#define ATH9K_SLOT_TIME_6 6
  3799. +-#define ATH9K_SLOT_TIME_9 9
  3800. +-#define ATH9K_SLOT_TIME_20 20
  3801. +-
  3802. + #define ATH9K_TXERR_XRETRY 0x01
  3803. + #define ATH9K_TXERR_FILT 0x02
  3804. + #define ATH9K_TXERR_FIFO 0x04
  3805. +--- a/drivers/net/wireless/ath/ath9k/main.c
  3806. ++++ b/drivers/net/wireless/ath/ath9k/main.c
  3807. +@@ -926,7 +926,7 @@ static void ath9k_vif_iter(struct ath9k_
  3808. + }
  3809. +
  3810. + if (!vif->bss_conf.use_short_slot)
  3811. +- iter_data->slottime = ATH9K_SLOT_TIME_20;
  3812. ++ iter_data->slottime = 20;
  3813. +
  3814. + switch (vif->type) {
  3815. + case NL80211_IFTYPE_AP:
  3816. +@@ -999,7 +999,7 @@ void ath9k_calculate_iter_data(struct at
  3817. + */
  3818. + memset(iter_data, 0, sizeof(*iter_data));
  3819. + eth_broadcast_addr(iter_data->mask);
  3820. +- iter_data->slottime = ATH9K_SLOT_TIME_9;
  3821. ++ iter_data->slottime = 9;
  3822. +
  3823. + list_for_each_entry(avp, &ctx->vifs, list)
  3824. + ath9k_vif_iter(iter_data, avp->vif->addr, avp->vif);
  3825. +@@ -1061,7 +1061,7 @@ static void ath9k_set_offchannel_state(s
  3826. + ah->opmode = vif->type;
  3827. + ah->imask &= ~ATH9K_INT_SWBA;
  3828. + ah->imask &= ~ATH9K_INT_TSFOOR;
  3829. +- ah->slottime = ATH9K_SLOT_TIME_9;
  3830. ++ ah->slottime = 9;
  3831. +
  3832. + ath_hw_setbssidmask(common);
  3833. + ath9k_hw_setopmode(ah);
  3834. +@@ -1788,6 +1788,7 @@ static void ath9k_bss_info_changed(struc
  3835. + slottime = 9;
  3836. + else
  3837. + slottime = 20;
  3838. ++
  3839. + if (vif->type == NL80211_IFTYPE_AP) {
  3840. + /*
  3841. + * Defer update, so that connected stations can adjust
  3842. 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
  3843. deleted file mode 100644
  3844. index e78df36..0000000
  3845. --- a/package/kernel/mac80211/patches/316-net-mac80211-agg-rx.c-fix-use-of-uninitialised-value.patch
  3846. +++ /dev/null
  3847. @@ -1,50 +0,0 @@
  3848. -From: Chris Bainbridge <chris.bainbridge@gmail.com>
  3849. -Date: Wed, 27 Jan 2016 15:46:18 +0000
  3850. -Subject: [PATCH] net/mac80211/agg-rx.c: fix use of uninitialised values
  3851. -
  3852. -Use kzalloc instead of kmalloc for struct tid_ampdu_rx. Fixes:
  3853. -
  3854. -[ 7.976605] UBSAN: Undefined behaviour in net/mac80211/rx.c:932:29
  3855. -[ 7.976608] load of value 2 is not a valid value for type '_Bool'
  3856. -[ 7.976611] CPU: 3 PID: 1134 Comm: kworker/u16:7 Not tainted 4.5.0-rc1+ #265
  3857. -[ 7.976613] Hardware name: Apple Inc. MacBookPro10,2/Mac-AFD8A9D944EA4843, BIOS MBP102.88Z.0106.B0A.1509130955 09/13/2015
  3858. -[ 7.976616] Workqueue: phy0 rt2x00usb_work_rxdone
  3859. -[ 7.976619] 0000000000000004 ffff880254a7ba50 ffffffff8181d866 0000000000000007
  3860. -[ 7.976622] ffff880254a7ba78 ffff880254a7ba68 ffffffff8188422d ffffffff8379b500
  3861. -[ 7.976626] ffff880254a7bab8 ffffffff81884747 0000000000000202 0000000348620032
  3862. -[ 7.976629] Call Trace:
  3863. -[ 7.976633] [<ffffffff8181d866>] dump_stack+0x45/0x5f
  3864. -[ 7.976637] [<ffffffff8188422d>] ubsan_epilogue+0xd/0x40
  3865. -[ 7.976642] [<ffffffff81884747>] __ubsan_handle_load_invalid_value+0x67/0x70
  3866. -[ 7.976646] [<ffffffff82227b4d>] ieee80211_sta_reorder_release.isra.16+0x5ed/0x730
  3867. -[ 7.976650] [<ffffffff8222ca14>] ieee80211_prepare_and_rx_handle+0xd04/0x1c00
  3868. -[ 7.976654] [<ffffffff81cb27ce>] ? usb_hcd_map_urb_for_dma+0x65e/0x960
  3869. -[ 7.976659] [<ffffffff8222db03>] __ieee80211_rx_handle_packet+0x1f3/0x750
  3870. -[ 7.976663] [<ffffffff8222e4a7>] ieee80211_rx_napi+0x447/0x990
  3871. -[ 7.976667] [<ffffffff81c5fb85>] rt2x00lib_rxdone+0x305/0xbd0
  3872. -[ 7.976670] [<ffffffff811ac23f>] ? dequeue_task_fair+0x64f/0x1de0
  3873. -[ 7.976674] [<ffffffff811a1516>] ? sched_clock_cpu+0xe6/0x150
  3874. -[ 7.976678] [<ffffffff81c6c45c>] rt2x00usb_work_rxdone+0x7c/0x140
  3875. -[ 7.976682] [<ffffffff8117aef6>] process_one_work+0x226/0x860
  3876. -[ 7.976686] [<ffffffff8117b58c>] worker_thread+0x5c/0x680
  3877. -[ 7.976690] [<ffffffff8117b530>] ? process_one_work+0x860/0x860
  3878. -[ 7.976693] [<ffffffff81184f86>] kthread+0xf6/0x150
  3879. -[ 7.976697] [<ffffffff81184e90>] ? kthread_worker_fn+0x310/0x310
  3880. -[ 7.976700] [<ffffffff822a94df>] ret_from_fork+0x3f/0x70
  3881. -[ 7.976703] [<ffffffff81184e90>] ? kthread_worker_fn+0x310/0x310
  3882. -
  3883. -Link: https://lkml.org/lkml/2016/1/26/230
  3884. -Signed-off-by: Chris Bainbridge <chris.bainbridge@gmail.com>
  3885. ----
  3886. -
  3887. ---- a/net/mac80211/agg-rx.c
  3888. -+++ b/net/mac80211/agg-rx.c
  3889. -@@ -327,7 +327,7 @@ void __ieee80211_start_rx_ba_session(str
  3890. - }
  3891. -
  3892. - /* prepare A-MPDU MLME for Rx aggregation */
  3893. -- tid_agg_rx = kmalloc(sizeof(struct tid_ampdu_rx), GFP_KERNEL);
  3894. -+ tid_agg_rx = kzalloc(sizeof(struct tid_ampdu_rx), GFP_KERNEL);
  3895. - if (!tid_agg_rx)
  3896. - goto end;
  3897. -
  3898. 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
  3899. new file mode 100644
  3900. index 0000000..360dfbf
  3901. --- /dev/null
  3902. +++ b/package/kernel/mac80211/patches/317-ath9k-Fix-beacon-configuration-for-addition-removal-.patch
  3903. @@ -0,0 +1,544 @@
  3904. +From: Benjamin Berg <benjamin.berg@open-mesh.com>
  3905. +Date: Mon, 4 Jul 2016 14:37:25 +0200
  3906. +Subject: [PATCH] ath9k: Fix beacon configuration for addition/removal of
  3907. + interfaces
  3908. +
  3909. +This patch fixes some issues with interface reconfiguration. It could
  3910. +for example happen that an AP interface in beacon slot 0 was removed
  3911. +leaving an IBSS station in one of the other slots. When this happens
  3912. +the driver never sends out the beacon as it only tries to send a beacon
  3913. +from slot 0.
  3914. +
  3915. +Appart from that the tracking of required changes to the beacon config is
  3916. +relatively complicated and prone to errors.
  3917. +
  3918. +The approach taken here is to solve reconfiguration issues is to
  3919. +reconfigure the beacons when any interface changes. This means that
  3920. +the complexity of deciding whether an interface change may modify the
  3921. +beacon configuration is gone. It also means that the beacon config will
  3922. +be reliably updated when an interface is removed.
  3923. +
  3924. +The issue that a single non-AP interface might not be in beacon
  3925. +slot 0 and wouldn't be send out is solved by moving it into the
  3926. +first slot. The TSF value in hardware is adjusted accordingly so
  3927. +that the timestamp of the beacons stay consistent.
  3928. +
  3929. +Signed-off-by: Benjamin Berg <benjamin.berg@open-mesh.com>
  3930. +---
  3931. +
  3932. +--- a/drivers/net/wireless/ath/ath9k/ath9k.h
  3933. ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  3934. +@@ -637,6 +637,8 @@ struct ath9k_vif_iter_data {
  3935. + int nwds; /* number of WDS vifs */
  3936. + int nadhocs; /* number of adhoc vifs */
  3937. + int nocbs; /* number of OCB vifs */
  3938. ++ int nbcnvifs; /* number of beaconing vifs */
  3939. ++ struct ieee80211_vif *primary_beacon_vif;
  3940. + struct ieee80211_vif *primary_sta;
  3941. + };
  3942. +
  3943. +@@ -685,10 +687,11 @@ struct ath_beacon {
  3944. + };
  3945. +
  3946. + void ath9k_beacon_tasklet(unsigned long data);
  3947. +-void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif,
  3948. +- u32 changed);
  3949. ++void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *main_vif,
  3950. ++ bool beacons);
  3951. + void ath9k_beacon_assign_slot(struct ath_softc *sc, struct ieee80211_vif *vif);
  3952. + void ath9k_beacon_remove_slot(struct ath_softc *sc, struct ieee80211_vif *vif);
  3953. ++void ath9k_beacon_ensure_primary_slot(struct ath_softc *sc);
  3954. + void ath9k_set_beacon(struct ath_softc *sc);
  3955. + bool ath9k_csa_is_finished(struct ath_softc *sc, struct ieee80211_vif *vif);
  3956. + void ath9k_csa_update(struct ath_softc *sc);
  3957. +--- a/drivers/net/wireless/ath/ath9k/beacon.c
  3958. ++++ b/drivers/net/wireless/ath/ath9k/beacon.c
  3959. +@@ -209,7 +209,6 @@ void ath9k_beacon_assign_slot(struct ath
  3960. + }
  3961. +
  3962. + sc->beacon.bslot[avp->av_bslot] = vif;
  3963. +- sc->nbcnvifs++;
  3964. +
  3965. + ath_dbg(common, CONFIG, "Added interface at beacon slot: %d\n",
  3966. + avp->av_bslot);
  3967. +@@ -220,15 +219,12 @@ void ath9k_beacon_remove_slot(struct ath
  3968. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  3969. + struct ath_vif *avp = (void *)vif->drv_priv;
  3970. + struct ath_buf *bf = avp->av_bcbuf;
  3971. +- struct ath_beacon_config *cur_conf = &sc->cur_chan->beacon;
  3972. +
  3973. + ath_dbg(common, CONFIG, "Removing interface at beacon slot: %d\n",
  3974. + avp->av_bslot);
  3975. +
  3976. + tasklet_disable(&sc->bcon_tasklet);
  3977. +
  3978. +- cur_conf->enable_beacon &= ~BIT(avp->av_bslot);
  3979. +-
  3980. + if (bf && bf->bf_mpdu) {
  3981. + struct sk_buff *skb = bf->bf_mpdu;
  3982. + dma_unmap_single(sc->dev, bf->bf_buf_addr,
  3983. +@@ -240,12 +236,73 @@ void ath9k_beacon_remove_slot(struct ath
  3984. +
  3985. + avp->av_bcbuf = NULL;
  3986. + sc->beacon.bslot[avp->av_bslot] = NULL;
  3987. +- sc->nbcnvifs--;
  3988. + list_add_tail(&bf->list, &sc->beacon.bbuf);
  3989. +
  3990. + tasklet_enable(&sc->bcon_tasklet);
  3991. + }
  3992. +
  3993. ++void ath9k_beacon_ensure_primary_slot(struct ath_softc *sc)
  3994. ++{
  3995. ++ struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  3996. ++ struct ieee80211_vif *vif;
  3997. ++ struct ath_vif *avp;
  3998. ++ s64 tsfadjust;
  3999. ++ u32 offset;
  4000. ++ int first_slot = ATH_BCBUF;
  4001. ++ int slot;
  4002. ++
  4003. ++ tasklet_disable(&sc->bcon_tasklet);
  4004. ++
  4005. ++ /* Find first taken slot. */
  4006. ++ for (slot = 0; slot < ATH_BCBUF; slot++) {
  4007. ++ if (sc->beacon.bslot[slot]) {
  4008. ++ first_slot = slot;
  4009. ++ break;
  4010. ++ }
  4011. ++ }
  4012. ++ if (first_slot == 0)
  4013. ++ goto out;
  4014. ++
  4015. ++ /* Re-enumarate all slots, moving them forward. */
  4016. ++ for (slot = 0; slot < ATH_BCBUF; slot++) {
  4017. ++ if (slot + first_slot < ATH_BCBUF) {
  4018. ++ vif = sc->beacon.bslot[slot + first_slot];
  4019. ++ sc->beacon.bslot[slot] = vif;
  4020. ++
  4021. ++ if (vif) {
  4022. ++ avp = (void *)vif->drv_priv;
  4023. ++ avp->av_bslot = slot;
  4024. ++ }
  4025. ++ } else {
  4026. ++ sc->beacon.bslot[slot] = NULL;
  4027. ++ }
  4028. ++ }
  4029. ++
  4030. ++ vif = sc->beacon.bslot[0];
  4031. ++ if (WARN_ON(!vif))
  4032. ++ goto out;
  4033. ++
  4034. ++ /* Get the tsf_adjust value for the new first slot. */
  4035. ++ avp = (void *)vif->drv_priv;
  4036. ++ tsfadjust = le64_to_cpu(avp->tsf_adjust);
  4037. ++
  4038. ++ ath_dbg(common, CONFIG,
  4039. ++ "Adjusting global TSF after beacon slot reassignment: %lld\n",
  4040. ++ (signed long long)tsfadjust);
  4041. ++
  4042. ++ /* Modify TSF as required and update the HW. */
  4043. ++ avp->chanctx->tsf_val += tsfadjust;
  4044. ++ if (sc->cur_chan == avp->chanctx) {
  4045. ++ offset = ath9k_hw_get_tsf_offset(&avp->chanctx->tsf_ts, NULL);
  4046. ++ ath9k_hw_settsf64(sc->sc_ah, avp->chanctx->tsf_val + offset);
  4047. ++ }
  4048. ++
  4049. ++ /* The slots tsf_adjust will be updated by ath9k_beacon_config later. */
  4050. ++
  4051. ++out:
  4052. ++ tasklet_enable(&sc->bcon_tasklet);
  4053. ++}
  4054. ++
  4055. + static int ath9k_beacon_choose_slot(struct ath_softc *sc)
  4056. + {
  4057. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  4058. +@@ -274,26 +331,33 @@ static int ath9k_beacon_choose_slot(stru
  4059. + return slot;
  4060. + }
  4061. +
  4062. +-static void ath9k_set_tsfadjust(struct ath_softc *sc, struct ieee80211_vif *vif)
  4063. ++static void ath9k_set_tsfadjust(struct ath_softc *sc,
  4064. ++ struct ath_beacon_config *cur_conf)
  4065. + {
  4066. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  4067. +- struct ath_vif *avp = (void *)vif->drv_priv;
  4068. +- struct ath_beacon_config *cur_conf = &avp->chanctx->beacon;
  4069. + s64 tsfadjust;
  4070. ++ int slot;
  4071. +
  4072. +- if (avp->av_bslot == 0)
  4073. +- return;
  4074. ++ for (slot = 0; slot < ATH_BCBUF; slot++) {
  4075. ++ struct ath_vif *avp;
  4076. +
  4077. +- /* tsf_adjust is added to the TSF value. We send out the beacon late,
  4078. +- * so need to adjust the TSF starting point to be later in time (i.e.
  4079. +- * the theoretical first beacon has a TSF of 0 after correction).
  4080. +- */
  4081. +- tsfadjust = cur_conf->beacon_interval * avp->av_bslot;
  4082. +- tsfadjust = -TU_TO_USEC(tsfadjust) / ATH_BCBUF;
  4083. +- avp->tsf_adjust = cpu_to_le64(tsfadjust);
  4084. ++ if (!sc->beacon.bslot[slot])
  4085. ++ continue;
  4086. +
  4087. +- ath_dbg(common, CONFIG, "tsfadjust is: %lld for bslot: %d\n",
  4088. +- (signed long long)tsfadjust, avp->av_bslot);
  4089. ++ avp = (void *)sc->beacon.bslot[slot]->drv_priv;
  4090. ++
  4091. ++ /* tsf_adjust is added to the TSF value. We send out the
  4092. ++ * beacon late, so need to adjust the TSF starting point to be
  4093. ++ * later in time (i.e. the theoretical first beacon has a TSF
  4094. ++ * of 0 after correction).
  4095. ++ */
  4096. ++ tsfadjust = cur_conf->beacon_interval * avp->av_bslot;
  4097. ++ tsfadjust = -TU_TO_USEC(tsfadjust) / ATH_BCBUF;
  4098. ++ avp->tsf_adjust = cpu_to_le64(tsfadjust);
  4099. ++
  4100. ++ ath_dbg(common, CONFIG, "tsfadjust is: %lld for bslot: %d\n",
  4101. ++ (signed long long)tsfadjust, avp->av_bslot);
  4102. ++ }
  4103. + }
  4104. +
  4105. + bool ath9k_csa_is_finished(struct ath_softc *sc, struct ieee80211_vif *vif)
  4106. +@@ -447,20 +511,28 @@ void ath9k_beacon_tasklet(unsigned long
  4107. + * Both nexttbtt and intval have to be in usecs.
  4108. + */
  4109. + static void ath9k_beacon_init(struct ath_softc *sc, u32 nexttbtt,
  4110. +- u32 intval, bool reset_tsf)
  4111. ++ u32 intval)
  4112. + {
  4113. + struct ath_hw *ah = sc->sc_ah;
  4114. +
  4115. + ath9k_hw_disable_interrupts(ah);
  4116. +- if (reset_tsf)
  4117. +- ath9k_hw_reset_tsf(ah);
  4118. + ath9k_beaconq_config(sc);
  4119. + ath9k_hw_beaconinit(ah, nexttbtt, intval);
  4120. ++ ah->imask |= ATH9K_INT_SWBA;
  4121. + sc->beacon.bmisscnt = 0;
  4122. + ath9k_hw_set_interrupts(ah);
  4123. + ath9k_hw_enable_interrupts(ah);
  4124. + }
  4125. +
  4126. ++static void ath9k_beacon_stop(struct ath_softc *sc)
  4127. ++{
  4128. ++ ath9k_hw_disable_interrupts(sc->sc_ah);
  4129. ++ sc->sc_ah->imask &= ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS);
  4130. ++ sc->beacon.bmisscnt = 0;
  4131. ++ ath9k_hw_set_interrupts(sc->sc_ah);
  4132. ++ ath9k_hw_enable_interrupts(sc->sc_ah);
  4133. ++}
  4134. ++
  4135. + /*
  4136. + * For multi-bss ap support beacons are either staggered evenly over N slots or
  4137. + * burst together. For the former arrange for the SWBA to be delivered for each
  4138. +@@ -472,7 +544,7 @@ static void ath9k_beacon_config_ap(struc
  4139. + struct ath_hw *ah = sc->sc_ah;
  4140. +
  4141. + ath9k_cmn_beacon_config_ap(ah, conf, ATH_BCBUF);
  4142. +- ath9k_beacon_init(sc, conf->nexttbtt, conf->intval, false);
  4143. ++ ath9k_beacon_init(sc, conf->nexttbtt, conf->intval);
  4144. + }
  4145. +
  4146. + static void ath9k_beacon_config_sta(struct ath_hw *ah,
  4147. +@@ -501,7 +573,7 @@ static void ath9k_beacon_config_adhoc(st
  4148. +
  4149. + ath9k_cmn_beacon_config_adhoc(ah, conf);
  4150. +
  4151. +- ath9k_beacon_init(sc, conf->nexttbtt, conf->intval, conf->ibss_creator);
  4152. ++ ath9k_beacon_init(sc, conf->nexttbtt, conf->intval);
  4153. +
  4154. + /*
  4155. + * Set the global 'beacon has been configured' flag for the
  4156. +@@ -511,44 +583,6 @@ static void ath9k_beacon_config_adhoc(st
  4157. + set_bit(ATH_OP_BEACONS, &common->op_flags);
  4158. + }
  4159. +
  4160. +-static bool ath9k_allow_beacon_config(struct ath_softc *sc,
  4161. +- struct ieee80211_vif *vif)
  4162. +-{
  4163. +- struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  4164. +- struct ath_vif *avp = (void *)vif->drv_priv;
  4165. +-
  4166. +- if (ath9k_is_chanctx_enabled()) {
  4167. +- /*
  4168. +- * If the VIF is not present in the current channel context,
  4169. +- * then we can't do the usual opmode checks. Allow the
  4170. +- * beacon config for the VIF to be updated in this case and
  4171. +- * return immediately.
  4172. +- */
  4173. +- if (sc->cur_chan != avp->chanctx)
  4174. +- return true;
  4175. +- }
  4176. +-
  4177. +- if (sc->sc_ah->opmode == NL80211_IFTYPE_AP) {
  4178. +- if (vif->type != NL80211_IFTYPE_AP) {
  4179. +- ath_dbg(common, CONFIG,
  4180. +- "An AP interface is already present !\n");
  4181. +- return false;
  4182. +- }
  4183. +- }
  4184. +-
  4185. +- if (sc->sc_ah->opmode == NL80211_IFTYPE_STATION) {
  4186. +- if ((vif->type == NL80211_IFTYPE_STATION) &&
  4187. +- test_bit(ATH_OP_BEACONS, &common->op_flags) &&
  4188. +- vif != sc->cur_chan->primary_sta) {
  4189. +- ath_dbg(common, CONFIG,
  4190. +- "Beacon already configured for a station interface\n");
  4191. +- return false;
  4192. +- }
  4193. +- }
  4194. +-
  4195. +- return true;
  4196. +-}
  4197. +-
  4198. + static void ath9k_cache_beacon_config(struct ath_softc *sc,
  4199. + struct ath_chanctx *ctx,
  4200. + struct ieee80211_bss_conf *bss_conf)
  4201. +@@ -584,87 +618,79 @@ static void ath9k_cache_beacon_config(st
  4202. + if (cur_conf->dtim_period == 0)
  4203. + cur_conf->dtim_period = 1;
  4204. +
  4205. ++ ath9k_set_tsfadjust(sc, cur_conf);
  4206. + }
  4207. +
  4208. +-void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif,
  4209. +- u32 changed)
  4210. ++void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *main_vif,
  4211. ++ bool beacons)
  4212. + {
  4213. +- struct ieee80211_bss_conf *bss_conf = &vif->bss_conf;
  4214. +- struct ath_hw *ah = sc->sc_ah;
  4215. +- struct ath_common *common = ath9k_hw_common(ah);
  4216. +- struct ath_vif *avp = (void *)vif->drv_priv;
  4217. +- struct ath_chanctx *ctx = avp->chanctx;
  4218. ++ struct ath_hw *ah = sc->sc_ah;
  4219. ++ struct ath_common *common = ath9k_hw_common(ah);
  4220. ++ struct ath_vif *avp;
  4221. ++ struct ath_chanctx *ctx;
  4222. + struct ath_beacon_config *cur_conf;
  4223. + unsigned long flags;
  4224. ++ bool enabled;
  4225. + bool skip_beacon = false;
  4226. +
  4227. +- if (!ctx)
  4228. ++ if (!beacons) {
  4229. ++ clear_bit(ATH_OP_BEACONS, &common->op_flags);
  4230. ++ ath9k_beacon_stop(sc);
  4231. + return;
  4232. ++ }
  4233. +
  4234. +- cur_conf = &avp->chanctx->beacon;
  4235. +- if (vif->type == NL80211_IFTYPE_AP)
  4236. +- ath9k_set_tsfadjust(sc, vif);
  4237. +-
  4238. +- if (!ath9k_allow_beacon_config(sc, vif))
  4239. ++ if (WARN_ON(!main_vif))
  4240. + return;
  4241. +
  4242. +- if (vif->type == NL80211_IFTYPE_STATION) {
  4243. +- ath9k_cache_beacon_config(sc, ctx, bss_conf);
  4244. +- if (ctx != sc->cur_chan)
  4245. +- return;
  4246. ++ avp = (void *)main_vif->drv_priv;
  4247. ++ ctx = avp->chanctx;
  4248. ++ cur_conf = &ctx->beacon;
  4249. ++ enabled = cur_conf->enable_beacon;
  4250. ++ cur_conf->enable_beacon = beacons;
  4251. ++
  4252. ++ if (sc->sc_ah->opmode == NL80211_IFTYPE_STATION) {
  4253. ++ ath9k_cache_beacon_config(sc, ctx, &main_vif->bss_conf);
  4254. +
  4255. + ath9k_set_beacon(sc);
  4256. + set_bit(ATH_OP_BEACONS, &common->op_flags);
  4257. + return;
  4258. + }
  4259. +
  4260. +- /*
  4261. +- * Take care of multiple interfaces when
  4262. +- * enabling/disabling SWBA.
  4263. +- */
  4264. +- if (changed & BSS_CHANGED_BEACON_ENABLED) {
  4265. +- bool enabled = cur_conf->enable_beacon;
  4266. +-
  4267. +- if (!bss_conf->enable_beacon) {
  4268. +- cur_conf->enable_beacon &= ~BIT(avp->av_bslot);
  4269. +- } else {
  4270. +- cur_conf->enable_beacon |= BIT(avp->av_bslot);
  4271. +- if (!enabled)
  4272. +- ath9k_cache_beacon_config(sc, ctx, bss_conf);
  4273. +- }
  4274. +- }
  4275. +-
  4276. +- if (ctx != sc->cur_chan)
  4277. +- return;
  4278. ++ /* Update the beacon configuration. */
  4279. ++ ath9k_cache_beacon_config(sc, ctx, &main_vif->bss_conf);
  4280. +
  4281. + /*
  4282. + * Configure the HW beacon registers only when we have a valid
  4283. + * beacon interval.
  4284. + */
  4285. + if (cur_conf->beacon_interval) {
  4286. +- /*
  4287. +- * If we are joining an existing IBSS network, start beaconing
  4288. +- * only after a TSF-sync has taken place. Ensure that this
  4289. +- * happens by setting the appropriate flags.
  4290. ++ /* Special case to sync the TSF when joining an existing IBSS.
  4291. ++ * This is only done if no AP interface is active.
  4292. ++ * Note that mac80211 always resets the TSF when creating a new
  4293. ++ * IBSS interface.
  4294. + */
  4295. +- if ((changed & BSS_CHANGED_IBSS) && !bss_conf->ibss_creator &&
  4296. +- bss_conf->enable_beacon) {
  4297. ++ if (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC &&
  4298. ++ !enabled && beacons && !main_vif->bss_conf.ibss_creator) {
  4299. + spin_lock_irqsave(&sc->sc_pm_lock, flags);
  4300. + sc->ps_flags |= PS_BEACON_SYNC | PS_WAIT_FOR_BEACON;
  4301. + spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
  4302. + skip_beacon = true;
  4303. +- } else {
  4304. +- ath9k_set_beacon(sc);
  4305. + }
  4306. +
  4307. + /*
  4308. + * Do not set the ATH_OP_BEACONS flag for IBSS joiner mode
  4309. + * here, it is done in ath9k_beacon_config_adhoc().
  4310. + */
  4311. +- if (cur_conf->enable_beacon && !skip_beacon)
  4312. ++ if (beacons && !skip_beacon) {
  4313. + set_bit(ATH_OP_BEACONS, &common->op_flags);
  4314. +- else
  4315. ++ ath9k_set_beacon(sc);
  4316. ++ } else {
  4317. + clear_bit(ATH_OP_BEACONS, &common->op_flags);
  4318. ++ ath9k_beacon_stop(sc);
  4319. ++ }
  4320. ++ } else {
  4321. ++ clear_bit(ATH_OP_BEACONS, &common->op_flags);
  4322. ++ ath9k_beacon_stop(sc);
  4323. + }
  4324. + }
  4325. +
  4326. +--- a/drivers/net/wireless/ath/ath9k/common.h
  4327. ++++ b/drivers/net/wireless/ath/ath9k/common.h
  4328. +@@ -50,6 +50,7 @@
  4329. + #define IEEE80211_MS_TO_TU(x) (((x) * 1000) / 1024)
  4330. +
  4331. + struct ath_beacon_config {
  4332. ++ struct ieee80211_vif *main_vif;
  4333. + int beacon_interval;
  4334. + u16 dtim_period;
  4335. + u16 bmiss_timeout;
  4336. +--- a/drivers/net/wireless/ath/ath9k/main.c
  4337. ++++ b/drivers/net/wireless/ath/ath9k/main.c
  4338. +@@ -910,6 +910,22 @@ static bool ath9k_uses_beacons(int type)
  4339. + }
  4340. + }
  4341. +
  4342. ++static void ath9k_vif_iter_set_beacon(struct ath9k_vif_iter_data *iter_data,
  4343. ++ struct ieee80211_vif *vif)
  4344. ++{
  4345. ++ /* Use the first (configured) interface, but prefering AP interfaces. */
  4346. ++ if (!iter_data->primary_beacon_vif) {
  4347. ++ iter_data->primary_beacon_vif = vif;
  4348. ++ } else {
  4349. ++ if (iter_data->primary_beacon_vif->type != NL80211_IFTYPE_AP &&
  4350. ++ vif->type == NL80211_IFTYPE_AP)
  4351. ++ iter_data->primary_beacon_vif = vif;
  4352. ++ }
  4353. ++
  4354. ++ iter_data->beacons = true;
  4355. ++ iter_data->nbcnvifs += 1;
  4356. ++}
  4357. ++
  4358. + static void ath9k_vif_iter(struct ath9k_vif_iter_data *iter_data,
  4359. + u8 *mac, struct ieee80211_vif *vif)
  4360. + {
  4361. +@@ -931,6 +947,8 @@ static void ath9k_vif_iter(struct ath9k_
  4362. + switch (vif->type) {
  4363. + case NL80211_IFTYPE_AP:
  4364. + iter_data->naps++;
  4365. ++ if (vif->bss_conf.enable_beacon)
  4366. ++ ath9k_vif_iter_set_beacon(iter_data, vif);
  4367. + break;
  4368. + case NL80211_IFTYPE_STATION:
  4369. + iter_data->nstations++;
  4370. +@@ -943,12 +961,12 @@ static void ath9k_vif_iter(struct ath9k_
  4371. + case NL80211_IFTYPE_ADHOC:
  4372. + iter_data->nadhocs++;
  4373. + if (vif->bss_conf.enable_beacon)
  4374. +- iter_data->beacons = true;
  4375. ++ ath9k_vif_iter_set_beacon(iter_data, vif);
  4376. + break;
  4377. + case NL80211_IFTYPE_MESH_POINT:
  4378. + iter_data->nmeshes++;
  4379. + if (vif->bss_conf.enable_beacon)
  4380. +- iter_data->beacons = true;
  4381. ++ ath9k_vif_iter_set_beacon(iter_data, vif);
  4382. + break;
  4383. + case NL80211_IFTYPE_WDS:
  4384. + iter_data->nwds++;
  4385. +@@ -1081,7 +1099,6 @@ void ath9k_calculate_summary_state(struc
  4386. + struct ath_hw *ah = sc->sc_ah;
  4387. + struct ath_common *common = ath9k_hw_common(ah);
  4388. + struct ath9k_vif_iter_data iter_data;
  4389. +- struct ath_beacon_config *cur_conf;
  4390. +
  4391. + ath_chanctx_check_active(sc, ctx);
  4392. +
  4393. +@@ -1103,13 +1120,12 @@ void ath9k_calculate_summary_state(struc
  4394. + ath_hw_setbssidmask(common);
  4395. +
  4396. + if (iter_data.naps > 0) {
  4397. +- cur_conf = &ctx->beacon;
  4398. + ath9k_hw_set_tsfadjust(ah, true);
  4399. + ah->opmode = NL80211_IFTYPE_AP;
  4400. +- if (cur_conf->enable_beacon)
  4401. +- iter_data.beacons = true;
  4402. + } else {
  4403. + ath9k_hw_set_tsfadjust(ah, false);
  4404. ++ if (iter_data.beacons)
  4405. ++ ath9k_beacon_ensure_primary_slot(sc);
  4406. +
  4407. + if (iter_data.nmeshes)
  4408. + ah->opmode = NL80211_IFTYPE_MESH_POINT;
  4409. +@@ -1134,7 +1150,6 @@ void ath9k_calculate_summary_state(struc
  4410. + ctx->switch_after_beacon = true;
  4411. + }
  4412. +
  4413. +- ah->imask &= ~ATH9K_INT_SWBA;
  4414. + if (ah->opmode == NL80211_IFTYPE_STATION) {
  4415. + bool changed = (iter_data.primary_sta != ctx->primary_sta);
  4416. +
  4417. +@@ -1151,16 +1166,12 @@ void ath9k_calculate_summary_state(struc
  4418. + if (ath9k_hw_mci_is_enabled(sc->sc_ah))
  4419. + ath9k_mci_update_wlan_channels(sc, true);
  4420. + }
  4421. +- } else if (iter_data.beacons) {
  4422. +- ah->imask |= ATH9K_INT_SWBA;
  4423. + }
  4424. ++ sc->nbcnvifs = iter_data.nbcnvifs;
  4425. ++ ath9k_beacon_config(sc, iter_data.primary_beacon_vif,
  4426. ++ iter_data.beacons);
  4427. + ath9k_hw_set_interrupts(ah);
  4428. +
  4429. +- if (iter_data.beacons)
  4430. +- set_bit(ATH_OP_BEACONS, &common->op_flags);
  4431. +- else
  4432. +- clear_bit(ATH_OP_BEACONS, &common->op_flags);
  4433. +-
  4434. + if (ah->slottime != iter_data.slottime) {
  4435. + ah->slottime = iter_data.slottime;
  4436. + ath9k_hw_init_global_settings(ah);
  4437. +@@ -1777,9 +1788,7 @@ static void ath9k_bss_info_changed(struc
  4438. + if ((changed & BSS_CHANGED_BEACON_ENABLED) ||
  4439. + (changed & BSS_CHANGED_BEACON_INT) ||
  4440. + (changed & BSS_CHANGED_BEACON_INFO)) {
  4441. +- ath9k_beacon_config(sc, vif, changed);
  4442. +- if (changed & BSS_CHANGED_BEACON_ENABLED)
  4443. +- ath9k_calculate_summary_state(sc, avp->chanctx);
  4444. ++ ath9k_calculate_summary_state(sc, avp->chanctx);
  4445. + }
  4446. +
  4447. + if ((avp->chanctx == sc->cur_chan) &&
  4448. 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
  4449. deleted file mode 100644
  4450. index 5bf53b9..0000000
  4451. --- a/package/kernel/mac80211/patches/317-mac80211-minstrel_ht-fix-out-of-bound-in-minstrel_ht.patch
  4452. +++ /dev/null
  4453. @@ -1,45 +0,0 @@
  4454. -From: Konstantin Khlebnikov <koct9i@gmail.com>
  4455. -Date: Fri, 29 Jan 2016 11:35:12 +0300
  4456. -Subject: [PATCH] mac80211: minstrel_ht: fix out-of-bound in
  4457. - minstrel_ht_set_best_prob_rate
  4458. -
  4459. -Patch fixes this splat
  4460. -
  4461. -BUG: KASAN: slab-out-of-bounds in minstrel_ht_update_stats.isra.7+0x6e1/0x9e0
  4462. -[mac80211] at addr ffff8800cee640f4 Read of size 4 by task swapper/3/0
  4463. -
  4464. -Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>
  4465. -Link: http://lkml.kernel.org/r/CALYGNiNyJhSaVnE35qS6UCGaSb2Dx1_i5HcRavuOX14oTz2P+w@mail.gmail.com
  4466. ----
  4467. -
  4468. ---- a/net/mac80211/rc80211_minstrel_ht.c
  4469. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  4470. -@@ -414,15 +414,16 @@ minstrel_ht_set_best_prob_rate(struct mi
  4471. - (max_tp_group != MINSTREL_CCK_GROUP))
  4472. - return;
  4473. -
  4474. -+ max_gpr_group = mg->max_group_prob_rate / MCS_GROUP_RATES;
  4475. -+ max_gpr_idx = mg->max_group_prob_rate % MCS_GROUP_RATES;
  4476. -+ max_gpr_prob = mi->groups[max_gpr_group].rates[max_gpr_idx].prob_ewma;
  4477. -+
  4478. - if (mrs->prob_ewma > MINSTREL_FRAC(75, 100)) {
  4479. - cur_tp_avg = minstrel_ht_get_tp_avg(mi, cur_group, cur_idx,
  4480. - mrs->prob_ewma);
  4481. - if (cur_tp_avg > tmp_tp_avg)
  4482. - mi->max_prob_rate = index;
  4483. -
  4484. -- max_gpr_group = mg->max_group_prob_rate / MCS_GROUP_RATES;
  4485. -- max_gpr_idx = mg->max_group_prob_rate % MCS_GROUP_RATES;
  4486. -- max_gpr_prob = mi->groups[max_gpr_group].rates[max_gpr_idx].prob_ewma;
  4487. - max_gpr_tp_avg = minstrel_ht_get_tp_avg(mi, max_gpr_group,
  4488. - max_gpr_idx,
  4489. - max_gpr_prob);
  4490. -@@ -431,7 +432,7 @@ minstrel_ht_set_best_prob_rate(struct mi
  4491. - } else {
  4492. - if (mrs->prob_ewma > tmp_prob)
  4493. - mi->max_prob_rate = index;
  4494. -- if (mrs->prob_ewma > mg->rates[mg->max_group_prob_rate].prob_ewma)
  4495. -+ if (mrs->prob_ewma > max_gpr_prob)
  4496. - mg->max_group_prob_rate = index;
  4497. - }
  4498. - }
  4499. 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
  4500. new file mode 100644
  4501. index 0000000..d946ecc
  4502. --- /dev/null
  4503. +++ b/package/kernel/mac80211/patches/318-brcmfmac-slightly-simplify-building-interface-combin.patch
  4504. @@ -0,0 +1,108 @@
  4505. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4506. +Date: Tue, 7 Jun 2016 21:10:18 +0200
  4507. +Subject: [PATCH] brcmfmac: slightly simplify building interface combinations
  4508. +MIME-Version: 1.0
  4509. +Content-Type: text/plain; charset=UTF-8
  4510. +Content-Transfer-Encoding: 8bit
  4511. +
  4512. +This change reorders some operations in brcmf_setup_ifmodes in hope to
  4513. +make it simpler:
  4514. +1) It allocates arrays right before filling them. This way it's easier
  4515. + to follow requested array length as it's immediately followed by
  4516. + code filling it. It's easier to check e.g. why we need 4 entries for
  4517. + P2P. Other than that it deduplicates some checks (e.g. for P2P).
  4518. +2) It reorders code to first prepare limits and then define a new combo.
  4519. + Previously this was mixed (e.g. we were setting num of channels
  4520. + before preparing limits).
  4521. +3) It modifies mbss code to use i variable just like other combos do.
  4522. +
  4523. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4524. +Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  4525. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4526. +---
  4527. +
  4528. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  4529. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  4530. +@@ -6284,29 +6284,15 @@ static int brcmf_setup_ifmodes(struct wi
  4531. + if (!combo)
  4532. + goto err;
  4533. +
  4534. +- c0_limits = kcalloc(p2p ? 3 : 2, sizeof(*c0_limits), GFP_KERNEL);
  4535. +- if (!c0_limits)
  4536. +- goto err;
  4537. +-
  4538. +- if (p2p) {
  4539. +- p2p_limits = kcalloc(4, sizeof(*p2p_limits), GFP_KERNEL);
  4540. +- if (!p2p_limits)
  4541. +- goto err;
  4542. +- }
  4543. +-
  4544. +- if (mbss) {
  4545. +- mbss_limits = kcalloc(1, sizeof(*mbss_limits), GFP_KERNEL);
  4546. +- if (!mbss_limits)
  4547. +- goto err;
  4548. +- }
  4549. +-
  4550. + wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
  4551. + BIT(NL80211_IFTYPE_ADHOC) |
  4552. + BIT(NL80211_IFTYPE_AP);
  4553. +
  4554. + c = 0;
  4555. + i = 0;
  4556. +- combo[c].num_different_channels = 1;
  4557. ++ c0_limits = kcalloc(p2p ? 3 : 2, sizeof(*c0_limits), GFP_KERNEL);
  4558. ++ if (!c0_limits)
  4559. ++ goto err;
  4560. + c0_limits[i].max = 1;
  4561. + c0_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  4562. + if (p2p) {
  4563. +@@ -6324,6 +6310,7 @@ static int brcmf_setup_ifmodes(struct wi
  4564. + c0_limits[i].max = 1;
  4565. + c0_limits[i++].types = BIT(NL80211_IFTYPE_AP);
  4566. + }
  4567. ++ combo[c].num_different_channels = 1;
  4568. + combo[c].max_interfaces = i;
  4569. + combo[c].n_limits = i;
  4570. + combo[c].limits = c0_limits;
  4571. +@@ -6331,7 +6318,9 @@ static int brcmf_setup_ifmodes(struct wi
  4572. + if (p2p) {
  4573. + c++;
  4574. + i = 0;
  4575. +- combo[c].num_different_channels = 1;
  4576. ++ p2p_limits = kcalloc(4, sizeof(*p2p_limits), GFP_KERNEL);
  4577. ++ if (!p2p_limits)
  4578. ++ goto err;
  4579. + p2p_limits[i].max = 1;
  4580. + p2p_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  4581. + p2p_limits[i].max = 1;
  4582. +@@ -6340,6 +6329,7 @@ static int brcmf_setup_ifmodes(struct wi
  4583. + p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT);
  4584. + p2p_limits[i].max = 1;
  4585. + p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  4586. ++ combo[c].num_different_channels = 1;
  4587. + combo[c].max_interfaces = i;
  4588. + combo[c].n_limits = i;
  4589. + combo[c].limits = p2p_limits;
  4590. +@@ -6347,14 +6337,19 @@ static int brcmf_setup_ifmodes(struct wi
  4591. +
  4592. + if (mbss) {
  4593. + c++;
  4594. ++ i = 0;
  4595. ++ mbss_limits = kcalloc(1, sizeof(*mbss_limits), GFP_KERNEL);
  4596. ++ if (!mbss_limits)
  4597. ++ goto err;
  4598. ++ mbss_limits[i].max = 4;
  4599. ++ mbss_limits[i++].types = BIT(NL80211_IFTYPE_AP);
  4600. + combo[c].beacon_int_infra_match = true;
  4601. + combo[c].num_different_channels = 1;
  4602. +- mbss_limits[0].max = 4;
  4603. +- mbss_limits[0].types = BIT(NL80211_IFTYPE_AP);
  4604. + combo[c].max_interfaces = 4;
  4605. +- combo[c].n_limits = 1;
  4606. ++ combo[c].n_limits = i;
  4607. + combo[c].limits = mbss_limits;
  4608. + }
  4609. ++
  4610. + wiphy->n_iface_combinations = n_combos;
  4611. + wiphy->iface_combinations = combo;
  4612. + return 0;
  4613. 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
  4614. deleted file mode 100644
  4615. index 655dc4b..0000000
  4616. --- a/package/kernel/mac80211/patches/318-mac80211-move-A-MSDU-skb_linearize-call-to-ieee80211.patch
  4617. +++ /dev/null
  4618. @@ -1,35 +0,0 @@
  4619. -From: Felix Fietkau <nbd@openwrt.org>
  4620. -Date: Tue, 2 Feb 2016 14:39:08 +0100
  4621. -Subject: [PATCH] mac80211: move A-MSDU skb_linearize call to
  4622. - ieee80211_amsdu_to_8023s
  4623. -
  4624. -Prepararation for zero-copy A-MSDU support with page fragment SKBs
  4625. -
  4626. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  4627. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  4628. ----
  4629. -
  4630. ---- a/net/mac80211/rx.c
  4631. -+++ b/net/mac80211/rx.c
  4632. -@@ -2203,9 +2203,6 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx
  4633. - skb->dev = dev;
  4634. - __skb_queue_head_init(&frame_list);
  4635. -
  4636. -- if (skb_linearize(skb))
  4637. -- return RX_DROP_UNUSABLE;
  4638. --
  4639. - ieee80211_amsdu_to_8023s(skb, &frame_list, dev->dev_addr,
  4640. - rx->sdata->vif.type,
  4641. - rx->local->hw.extra_tx_headroom, true);
  4642. ---- a/net/wireless/util.c
  4643. -+++ b/net/wireless/util.c
  4644. -@@ -657,6 +657,9 @@ void ieee80211_amsdu_to_8023s(struct sk_
  4645. - int remaining, err;
  4646. - u8 dst[ETH_ALEN], src[ETH_ALEN];
  4647. -
  4648. -+ if (skb_linearize(skb))
  4649. -+ goto out;
  4650. -+
  4651. - if (has_80211_header) {
  4652. - err = ieee80211_data_to_8023(skb, addr, iftype);
  4653. - if (err)
  4654. 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
  4655. new file mode 100644
  4656. index 0000000..073d012
  4657. --- /dev/null
  4658. +++ b/package/kernel/mac80211/patches/319-0001-brcmfmac-fix-lockup-when-removing-P2P-interface-afte.patch
  4659. @@ -0,0 +1,154 @@
  4660. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4661. +Date: Fri, 17 Jun 2016 12:29:21 +0200
  4662. +Subject: [PATCH] brcmfmac: fix lockup when removing P2P interface after
  4663. + event timeout
  4664. +MIME-Version: 1.0
  4665. +Content-Type: text/plain; charset=UTF-8
  4666. +Content-Transfer-Encoding: 8bit
  4667. +
  4668. +Removing P2P interface is handled by sending a proper request to the
  4669. +firmware. On success firmware triggers an event and driver's handler
  4670. +removes a matching interface.
  4671. +
  4672. +However on event timeout we remove interface directly from the cfg80211
  4673. +callback. Current code doesn't handle this case correctly as it always
  4674. +assumes rtnl to be unlocked.
  4675. +
  4676. +Fix it by adding an extra rtnl_locked parameter to functions and calling
  4677. +unregister_netdevice when needed.
  4678. +
  4679. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4680. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4681. +---
  4682. +
  4683. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  4684. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  4685. +@@ -548,12 +548,16 @@ fail:
  4686. + return -EBADE;
  4687. + }
  4688. +
  4689. +-static void brcmf_net_detach(struct net_device *ndev)
  4690. ++static void brcmf_net_detach(struct net_device *ndev, bool rtnl_locked)
  4691. + {
  4692. +- if (ndev->reg_state == NETREG_REGISTERED)
  4693. +- unregister_netdev(ndev);
  4694. +- else
  4695. ++ if (ndev->reg_state == NETREG_REGISTERED) {
  4696. ++ if (rtnl_locked)
  4697. ++ unregister_netdevice(ndev);
  4698. ++ else
  4699. ++ unregister_netdev(ndev);
  4700. ++ } else {
  4701. + brcmf_cfg80211_free_netdev(ndev);
  4702. ++ }
  4703. + }
  4704. +
  4705. + void brcmf_net_setcarrier(struct brcmf_if *ifp, bool on)
  4706. +@@ -651,7 +655,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  4707. + brcmf_err("ERROR: netdev:%s already exists\n",
  4708. + ifp->ndev->name);
  4709. + netif_stop_queue(ifp->ndev);
  4710. +- brcmf_net_detach(ifp->ndev);
  4711. ++ brcmf_net_detach(ifp->ndev, false);
  4712. + drvr->iflist[bsscfgidx] = NULL;
  4713. + } else {
  4714. + brcmf_dbg(INFO, "netdev:%s ignore IF event\n",
  4715. +@@ -699,7 +703,8 @@ struct brcmf_if *brcmf_add_if(struct brc
  4716. + return ifp;
  4717. + }
  4718. +
  4719. +-static void brcmf_del_if(struct brcmf_pub *drvr, s32 bsscfgidx)
  4720. ++static void brcmf_del_if(struct brcmf_pub *drvr, s32 bsscfgidx,
  4721. ++ bool rtnl_locked)
  4722. + {
  4723. + struct brcmf_if *ifp;
  4724. +
  4725. +@@ -729,7 +734,7 @@ static void brcmf_del_if(struct brcmf_pu
  4726. + cancel_work_sync(&ifp->multicast_work);
  4727. + cancel_work_sync(&ifp->ndoffload_work);
  4728. + }
  4729. +- brcmf_net_detach(ifp->ndev);
  4730. ++ brcmf_net_detach(ifp->ndev, rtnl_locked);
  4731. + } else {
  4732. + /* Only p2p device interfaces which get dynamically created
  4733. + * end up here. In this case the p2p module should be informed
  4734. +@@ -743,14 +748,14 @@ static void brcmf_del_if(struct brcmf_pu
  4735. + }
  4736. + }
  4737. +
  4738. +-void brcmf_remove_interface(struct brcmf_if *ifp)
  4739. ++void brcmf_remove_interface(struct brcmf_if *ifp, bool rtnl_locked)
  4740. + {
  4741. + if (!ifp || WARN_ON(ifp->drvr->iflist[ifp->bsscfgidx] != ifp))
  4742. + return;
  4743. + brcmf_dbg(TRACE, "Enter, bsscfgidx=%d, ifidx=%d\n", ifp->bsscfgidx,
  4744. + ifp->ifidx);
  4745. + brcmf_fws_del_interface(ifp);
  4746. +- brcmf_del_if(ifp->drvr, ifp->bsscfgidx);
  4747. ++ brcmf_del_if(ifp->drvr, ifp->bsscfgidx, rtnl_locked);
  4748. + }
  4749. +
  4750. + #ifdef CONFIG_INET
  4751. +@@ -1057,9 +1062,9 @@ fail:
  4752. + brcmf_fws_deinit(drvr);
  4753. + }
  4754. + if (ifp)
  4755. +- brcmf_net_detach(ifp->ndev);
  4756. ++ brcmf_net_detach(ifp->ndev, false);
  4757. + if (p2p_ifp)
  4758. +- brcmf_net_detach(p2p_ifp->ndev);
  4759. ++ brcmf_net_detach(p2p_ifp->ndev, false);
  4760. + drvr->iflist[0] = NULL;
  4761. + drvr->iflist[1] = NULL;
  4762. + if (drvr->settings->ignore_probe_fail)
  4763. +@@ -1128,7 +1133,7 @@ void brcmf_detach(struct device *dev)
  4764. +
  4765. + /* make sure primary interface removed last */
  4766. + for (i = BRCMF_MAX_IFS-1; i > -1; i--)
  4767. +- brcmf_remove_interface(drvr->iflist[i]);
  4768. ++ brcmf_remove_interface(drvr->iflist[i], false);
  4769. +
  4770. + brcmf_cfg80211_detach(drvr->config);
  4771. +
  4772. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  4773. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  4774. +@@ -216,7 +216,7 @@ struct brcmf_if *brcmf_get_ifp(struct br
  4775. + int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  4776. + struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
  4777. + bool is_p2pdev, char *name, u8 *mac_addr);
  4778. +-void brcmf_remove_interface(struct brcmf_if *ifp);
  4779. ++void brcmf_remove_interface(struct brcmf_if *ifp, bool rtnl_locked);
  4780. + void brcmf_txflowblock_if(struct brcmf_if *ifp,
  4781. + enum brcmf_netif_stop_reason reason, bool state);
  4782. + void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
  4783. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  4784. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  4785. +@@ -183,7 +183,7 @@ static void brcmf_fweh_handle_if_event(s
  4786. + err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data);
  4787. +
  4788. + if (ifp && ifevent->action == BRCMF_E_IF_DEL)
  4789. +- brcmf_remove_interface(ifp);
  4790. ++ brcmf_remove_interface(ifp, false);
  4791. + }
  4792. +
  4793. + /**
  4794. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  4795. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  4796. +@@ -2289,7 +2289,7 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  4797. + err = 0;
  4798. + }
  4799. + if (err)
  4800. +- brcmf_remove_interface(vif->ifp);
  4801. ++ brcmf_remove_interface(vif->ifp, true);
  4802. +
  4803. + brcmf_cfg80211_arm_vif_event(cfg, NULL);
  4804. + if (vif->wdev.iftype != NL80211_IFTYPE_P2P_DEVICE)
  4805. +@@ -2395,7 +2395,7 @@ void brcmf_p2p_detach(struct brcmf_p2p_i
  4806. + if (vif != NULL) {
  4807. + brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  4808. + brcmf_p2p_deinit_discovery(p2p);
  4809. +- brcmf_remove_interface(vif->ifp);
  4810. ++ brcmf_remove_interface(vif->ifp, false);
  4811. + }
  4812. + /* just set it all to zero */
  4813. + memset(p2p, 0, sizeof(*p2p));
  4814. 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
  4815. new file mode 100644
  4816. index 0000000..6d3f3c6
  4817. --- /dev/null
  4818. +++ b/package/kernel/mac80211/patches/319-0002-brcmfmac-use-const-char-for-interface-name-in-brcmf_.patch
  4819. @@ -0,0 +1,40 @@
  4820. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4821. +Date: Fri, 17 Jun 2016 12:48:44 +0200
  4822. +Subject: [PATCH] brcmfmac: use const char * for interface name in
  4823. + brcmf_add_if
  4824. +MIME-Version: 1.0
  4825. +Content-Type: text/plain; charset=UTF-8
  4826. +Content-Transfer-Encoding: 8bit
  4827. +
  4828. +This function can work just fine with const pointer, it only calls
  4829. +alloc_netdev which take const as well. Moreover it makes this function
  4830. +more flexible as some cfg80211 callback may provide const char * as
  4831. +well, e.g. add_virtual_intf. This will be needed for more advanced
  4832. +interface management.
  4833. +
  4834. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4835. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4836. +---
  4837. +
  4838. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  4839. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  4840. +@@ -638,7 +638,7 @@ fail:
  4841. + }
  4842. +
  4843. + struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
  4844. +- bool is_p2pdev, char *name, u8 *mac_addr)
  4845. ++ bool is_p2pdev, const char *name, u8 *mac_addr)
  4846. + {
  4847. + struct brcmf_if *ifp;
  4848. + struct net_device *ndev;
  4849. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  4850. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  4851. +@@ -215,7 +215,7 @@ char *brcmf_ifname(struct brcmf_if *ifp)
  4852. + struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx);
  4853. + int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  4854. + struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
  4855. +- bool is_p2pdev, char *name, u8 *mac_addr);
  4856. ++ bool is_p2pdev, const char *name, u8 *mac_addr);
  4857. + void brcmf_remove_interface(struct brcmf_if *ifp, bool rtnl_locked);
  4858. + void brcmf_txflowblock_if(struct brcmf_if *ifp,
  4859. + enum brcmf_netif_stop_reason reason, bool state);
  4860. 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
  4861. new file mode 100644
  4862. index 0000000..eeda766
  4863. --- /dev/null
  4864. +++ b/package/kernel/mac80211/patches/319-0003-brcmfmac-include-also-core.h-header-in-cfg80211.h.patch
  4865. @@ -0,0 +1,33 @@
  4866. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4867. +Date: Sat, 18 Jun 2016 18:49:38 +0200
  4868. +Subject: [PATCH] brcmfmac: include also core.h header in cfg80211.h
  4869. +MIME-Version: 1.0
  4870. +Content-Type: text/plain; charset=UTF-8
  4871. +Content-Transfer-Encoding: 8bit
  4872. +
  4873. +This header provides two inline functions using struct brcmf_if so we
  4874. +need core.h to avoid:
  4875. +
  4876. +drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h: In function ‘ndev_to_prof’:
  4877. +drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h:368:13: error: dereferencing pointer to incomplete type
  4878. + return &ifp->vif->profile;
  4879. + ^
  4880. +drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h: In function ‘ndev_to_vif’:
  4881. +drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h:374:12: error: dereferencing pointer to incomplete type
  4882. + return ifp->vif;
  4883. + ^
  4884. +
  4885. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4886. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4887. +---
  4888. +
  4889. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  4890. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  4891. +@@ -20,6 +20,7 @@
  4892. + /* for brcmu_d11inf */
  4893. + #include <brcmu_d11.h>
  4894. +
  4895. ++#include "core.h"
  4896. + #include "fwil_types.h"
  4897. + #include "p2p.h"
  4898. +
  4899. 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
  4900. new file mode 100644
  4901. index 0000000..3819248
  4902. --- /dev/null
  4903. +++ b/package/kernel/mac80211/patches/319-0004-brcmfmac-add-missing-break-when-deleting-P2P_DEVICE.patch
  4904. @@ -0,0 +1,27 @@
  4905. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4906. +Date: Sun, 19 Jun 2016 01:55:57 +0200
  4907. +Subject: [PATCH] brcmfmac: add missing break when deleting P2P_DEVICE
  4908. +MIME-Version: 1.0
  4909. +Content-Type: text/plain; charset=UTF-8
  4910. +Content-Transfer-Encoding: 8bit
  4911. +
  4912. +We obviously don't want to fall through in that switch. With this change
  4913. +1) We wait for event (triggered by p2p_disc) as expected
  4914. +2) We remove interface manually on timeout
  4915. +3) We return 0 on success instead of -ENOTSUPP
  4916. +
  4917. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4918. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4919. +---
  4920. +
  4921. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  4922. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  4923. +@@ -2263,6 +2263,8 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  4924. + return 0;
  4925. + brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  4926. + brcmf_p2p_deinit_discovery(p2p);
  4927. ++ break;
  4928. ++
  4929. + default:
  4930. + return -ENOTSUPP;
  4931. + }
  4932. 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
  4933. new file mode 100644
  4934. index 0000000..12d7eb4
  4935. --- /dev/null
  4936. +++ b/package/kernel/mac80211/patches/319-0005-brcmfmac-delete-interface-directly-in-code-that-sent.patch
  4937. @@ -0,0 +1,75 @@
  4938. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4939. +Date: Wed, 29 Jun 2016 21:54:26 +0200
  4940. +Subject: [PATCH] brcmfmac: delete interface directly in code that sent fw
  4941. + request
  4942. +MIME-Version: 1.0
  4943. +Content-Type: text/plain; charset=UTF-8
  4944. +Content-Transfer-Encoding: 8bit
  4945. +
  4946. +So far when receiving event about in-firmware-interface removal our
  4947. +event worker was notifying listener and afterwards it was removing Linux
  4948. +interface.
  4949. +
  4950. +First of all it was resulting in slightly unexpected order. The listener
  4951. +(del_virtual_intf callback) was (usually) returning with success before
  4952. +we even called unregister_netdev(ice).
  4953. +
  4954. +Please note this couldn't be simply fixed by changing order of calls in
  4955. +brcmf_fweh_handle_if_event as unregistering interface earlier could free
  4956. +struct brcmf_if.
  4957. +
  4958. +Another problem of current implementation are possible lockups. Focus on
  4959. +the time slot between calling event handler and removing Linux
  4960. +interface. During that time original caller may leave (unlocking rtnl
  4961. +semaphore) *and* another call to the same code may be done (locking it
  4962. +again). If that happens our event handler will stuck at removing Linux
  4963. +interface, it won't handle another event and will block process holding
  4964. +rtnl lock.
  4965. +
  4966. +This can be simply solved by unregistering interface in a proper
  4967. +callback, right after receiving confirmation event from firmware. This
  4968. +only required modifying worker to don't unregister on its own if there
  4969. +is someone waiting for the event.
  4970. +
  4971. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4972. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4973. +---
  4974. +
  4975. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  4976. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  4977. +@@ -18,6 +18,7 @@
  4978. + #include "brcmu_wifi.h"
  4979. + #include "brcmu_utils.h"
  4980. +
  4981. ++#include "cfg80211.h"
  4982. + #include "core.h"
  4983. + #include "debug.h"
  4984. + #include "tracepoint.h"
  4985. +@@ -182,8 +183,13 @@ static void brcmf_fweh_handle_if_event(s
  4986. +
  4987. + err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data);
  4988. +
  4989. +- if (ifp && ifevent->action == BRCMF_E_IF_DEL)
  4990. +- brcmf_remove_interface(ifp, false);
  4991. ++ if (ifp && ifevent->action == BRCMF_E_IF_DEL) {
  4992. ++ bool armed = brcmf_cfg80211_vif_event_armed(drvr->config);
  4993. ++
  4994. ++ /* Default handling in case no-one waits for this event */
  4995. ++ if (!armed)
  4996. ++ brcmf_remove_interface(ifp, false);
  4997. ++ }
  4998. + }
  4999. +
  5000. + /**
  5001. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  5002. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  5003. +@@ -2290,8 +2290,7 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  5004. + else
  5005. + err = 0;
  5006. + }
  5007. +- if (err)
  5008. +- brcmf_remove_interface(vif->ifp, true);
  5009. ++ brcmf_remove_interface(vif->ifp, true);
  5010. +
  5011. + brcmf_cfg80211_arm_vif_event(cfg, NULL);
  5012. + if (vif->wdev.iftype != NL80211_IFTYPE_P2P_DEVICE)
  5013. 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
  5014. new file mode 100644
  5015. index 0000000..2f7165e
  5016. --- /dev/null
  5017. +++ b/package/kernel/mac80211/patches/319-0006-brcmfmac-support-removing-AP-interfaces-with-interfa.patch
  5018. @@ -0,0 +1,84 @@
  5019. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  5020. +Date: Wed, 29 Jun 2016 21:54:27 +0200
  5021. +Subject: [PATCH] brcmfmac: support removing AP interfaces with
  5022. + "interface_remove"
  5023. +MIME-Version: 1.0
  5024. +Content-Type: text/plain; charset=UTF-8
  5025. +Content-Transfer-Encoding: 8bit
  5026. +
  5027. +New firmwares (e.g. 10.10.69.36 for BCM4366) support "interface_remove"
  5028. +for removing interfaces. Try to use this method on cfg80211 request. In
  5029. +case of older firmwares (e.g. 7.35.177.56 for BCM43602 as I tested) this
  5030. +will just result in firmware rejecting command and this won't change any
  5031. +behavior.
  5032. +
  5033. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  5034. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  5035. +---
  5036. +
  5037. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  5038. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  5039. +@@ -785,12 +785,48 @@ s32 brcmf_notify_escan_complete(struct b
  5040. + return err;
  5041. + }
  5042. +
  5043. ++static int brcmf_cfg80211_del_ap_iface(struct wiphy *wiphy,
  5044. ++ struct wireless_dev *wdev)
  5045. ++{
  5046. ++ struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy);
  5047. ++ struct net_device *ndev = wdev->netdev;
  5048. ++ struct brcmf_if *ifp = netdev_priv(ndev);
  5049. ++ int ret;
  5050. ++ int err;
  5051. ++
  5052. ++ brcmf_cfg80211_arm_vif_event(cfg, ifp->vif);
  5053. ++
  5054. ++ err = brcmf_fil_bsscfg_data_set(ifp, "interface_remove", NULL, 0);
  5055. ++ if (err) {
  5056. ++ brcmf_err("interface_remove failed %d\n", err);
  5057. ++ goto err_unarm;
  5058. ++ }
  5059. ++
  5060. ++ /* wait for firmware event */
  5061. ++ ret = brcmf_cfg80211_wait_vif_event(cfg, BRCMF_E_IF_DEL,
  5062. ++ BRCMF_VIF_EVENT_TIMEOUT);
  5063. ++ if (!ret) {
  5064. ++ brcmf_err("timeout occurred\n");
  5065. ++ err = -EIO;
  5066. ++ goto err_unarm;
  5067. ++ }
  5068. ++
  5069. ++ brcmf_remove_interface(ifp, true);
  5070. ++
  5071. ++err_unarm:
  5072. ++ brcmf_cfg80211_arm_vif_event(cfg, NULL);
  5073. ++ return err;
  5074. ++}
  5075. ++
  5076. + static
  5077. + int brcmf_cfg80211_del_iface(struct wiphy *wiphy, struct wireless_dev *wdev)
  5078. + {
  5079. + struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy);
  5080. + struct net_device *ndev = wdev->netdev;
  5081. +
  5082. ++ if (ndev && ndev == cfg_to_ndev(cfg))
  5083. ++ return -ENOTSUPP;
  5084. ++
  5085. + /* vif event pending in firmware */
  5086. + if (brcmf_cfg80211_vif_event_armed(cfg))
  5087. + return -EBUSY;
  5088. +@@ -807,12 +843,13 @@ int brcmf_cfg80211_del_iface(struct wiph
  5089. + switch (wdev->iftype) {
  5090. + case NL80211_IFTYPE_ADHOC:
  5091. + case NL80211_IFTYPE_STATION:
  5092. +- case NL80211_IFTYPE_AP:
  5093. + case NL80211_IFTYPE_AP_VLAN:
  5094. + case NL80211_IFTYPE_WDS:
  5095. + case NL80211_IFTYPE_MONITOR:
  5096. + case NL80211_IFTYPE_MESH_POINT:
  5097. + return -EOPNOTSUPP;
  5098. ++ case NL80211_IFTYPE_AP:
  5099. ++ return brcmf_cfg80211_del_ap_iface(wiphy, wdev);
  5100. + case NL80211_IFTYPE_P2P_CLIENT:
  5101. + case NL80211_IFTYPE_P2P_GO:
  5102. + case NL80211_IFTYPE_P2P_DEVICE:
  5103. 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
  5104. deleted file mode 100644
  5105. index b646ab3..0000000
  5106. --- a/package/kernel/mac80211/patches/319-cfg80211-add-function-for-802.3-conversion-with-sepa.patch
  5107. +++ /dev/null
  5108. @@ -1,186 +0,0 @@
  5109. -From: Felix Fietkau <nbd@openwrt.org>
  5110. -Date: Tue, 2 Feb 2016 14:39:09 +0100
  5111. -Subject: [PATCH] cfg80211: add function for 802.3 conversion with separate
  5112. - output buffer
  5113. -
  5114. -Use skb_copy_bits in preparation for allowing fragmented skbs
  5115. -
  5116. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  5117. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  5118. ----
  5119. -
  5120. ---- a/net/wireless/util.c
  5121. -+++ b/net/wireless/util.c
  5122. -@@ -393,9 +393,9 @@ unsigned int ieee80211_get_hdrlen_from_s
  5123. - }
  5124. - EXPORT_SYMBOL(ieee80211_get_hdrlen_from_skb);
  5125. -
  5126. --unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr)
  5127. -+static unsigned int __ieee80211_get_mesh_hdrlen(u8 flags)
  5128. - {
  5129. -- int ae = meshhdr->flags & MESH_FLAGS_AE;
  5130. -+ int ae = flags & MESH_FLAGS_AE;
  5131. - /* 802.11-2012, 8.2.4.7.3 */
  5132. - switch (ae) {
  5133. - default:
  5134. -@@ -407,21 +407,31 @@ unsigned int ieee80211_get_mesh_hdrlen(s
  5135. - return 18;
  5136. - }
  5137. - }
  5138. -+
  5139. -+unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr)
  5140. -+{
  5141. -+ return __ieee80211_get_mesh_hdrlen(meshhdr->flags);
  5142. -+}
  5143. - EXPORT_SYMBOL(ieee80211_get_mesh_hdrlen);
  5144. -
  5145. --int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
  5146. -- enum nl80211_iftype iftype)
  5147. -+static int __ieee80211_data_to_8023(struct sk_buff *skb, struct ethhdr *ehdr,
  5148. -+ const u8 *addr, enum nl80211_iftype iftype)
  5149. - {
  5150. - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
  5151. -- u16 hdrlen, ethertype;
  5152. -- u8 *payload;
  5153. -- u8 dst[ETH_ALEN];
  5154. -- u8 src[ETH_ALEN] __aligned(2);
  5155. -+ struct {
  5156. -+ u8 hdr[ETH_ALEN] __aligned(2);
  5157. -+ __be16 proto;
  5158. -+ } payload;
  5159. -+ struct ethhdr tmp;
  5160. -+ u16 hdrlen;
  5161. -+ u8 mesh_flags = 0;
  5162. -
  5163. - if (unlikely(!ieee80211_is_data_present(hdr->frame_control)))
  5164. - return -1;
  5165. -
  5166. - hdrlen = ieee80211_hdrlen(hdr->frame_control);
  5167. -+ if (skb->len < hdrlen + 8)
  5168. -+ return -1;
  5169. -
  5170. - /* convert IEEE 802.11 header + possible LLC headers into Ethernet
  5171. - * header
  5172. -@@ -432,8 +442,11 @@ int ieee80211_data_to_8023(struct sk_buf
  5173. - * 1 0 BSSID SA DA n/a
  5174. - * 1 1 RA TA DA SA
  5175. - */
  5176. -- memcpy(dst, ieee80211_get_DA(hdr), ETH_ALEN);
  5177. -- memcpy(src, ieee80211_get_SA(hdr), ETH_ALEN);
  5178. -+ memcpy(tmp.h_dest, ieee80211_get_DA(hdr), ETH_ALEN);
  5179. -+ memcpy(tmp.h_source, ieee80211_get_SA(hdr), ETH_ALEN);
  5180. -+
  5181. -+ if (iftype == NL80211_IFTYPE_MESH_POINT)
  5182. -+ skb_copy_bits(skb, hdrlen, &mesh_flags, 1);
  5183. -
  5184. - switch (hdr->frame_control &
  5185. - cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) {
  5186. -@@ -450,44 +463,31 @@ int ieee80211_data_to_8023(struct sk_buf
  5187. - iftype != NL80211_IFTYPE_STATION))
  5188. - return -1;
  5189. - if (iftype == NL80211_IFTYPE_MESH_POINT) {
  5190. -- struct ieee80211s_hdr *meshdr =
  5191. -- (struct ieee80211s_hdr *) (skb->data + hdrlen);
  5192. -- /* make sure meshdr->flags is on the linear part */
  5193. -- if (!pskb_may_pull(skb, hdrlen + 1))
  5194. -- return -1;
  5195. -- if (meshdr->flags & MESH_FLAGS_AE_A4)
  5196. -+ if (mesh_flags & MESH_FLAGS_AE_A4)
  5197. - return -1;
  5198. -- if (meshdr->flags & MESH_FLAGS_AE_A5_A6) {
  5199. -+ if (mesh_flags & MESH_FLAGS_AE_A5_A6) {
  5200. - skb_copy_bits(skb, hdrlen +
  5201. - offsetof(struct ieee80211s_hdr, eaddr1),
  5202. -- dst, ETH_ALEN);
  5203. -- skb_copy_bits(skb, hdrlen +
  5204. -- offsetof(struct ieee80211s_hdr, eaddr2),
  5205. -- src, ETH_ALEN);
  5206. -+ tmp.h_dest, 2 * ETH_ALEN);
  5207. - }
  5208. -- hdrlen += ieee80211_get_mesh_hdrlen(meshdr);
  5209. -+ hdrlen += __ieee80211_get_mesh_hdrlen(mesh_flags);
  5210. - }
  5211. - break;
  5212. - case cpu_to_le16(IEEE80211_FCTL_FROMDS):
  5213. - if ((iftype != NL80211_IFTYPE_STATION &&
  5214. - iftype != NL80211_IFTYPE_P2P_CLIENT &&
  5215. - iftype != NL80211_IFTYPE_MESH_POINT) ||
  5216. -- (is_multicast_ether_addr(dst) &&
  5217. -- ether_addr_equal(src, addr)))
  5218. -+ (is_multicast_ether_addr(tmp.h_dest) &&
  5219. -+ ether_addr_equal(tmp.h_source, addr)))
  5220. - return -1;
  5221. - if (iftype == NL80211_IFTYPE_MESH_POINT) {
  5222. -- struct ieee80211s_hdr *meshdr =
  5223. -- (struct ieee80211s_hdr *) (skb->data + hdrlen);
  5224. -- /* make sure meshdr->flags is on the linear part */
  5225. -- if (!pskb_may_pull(skb, hdrlen + 1))
  5226. -- return -1;
  5227. -- if (meshdr->flags & MESH_FLAGS_AE_A5_A6)
  5228. -+ if (mesh_flags & MESH_FLAGS_AE_A5_A6)
  5229. - return -1;
  5230. -- if (meshdr->flags & MESH_FLAGS_AE_A4)
  5231. -+ if (mesh_flags & MESH_FLAGS_AE_A4)
  5232. - skb_copy_bits(skb, hdrlen +
  5233. - offsetof(struct ieee80211s_hdr, eaddr1),
  5234. -- src, ETH_ALEN);
  5235. -- hdrlen += ieee80211_get_mesh_hdrlen(meshdr);
  5236. -+ tmp.h_source, ETH_ALEN);
  5237. -+ hdrlen += __ieee80211_get_mesh_hdrlen(mesh_flags);
  5238. - }
  5239. - break;
  5240. - case cpu_to_le16(0):
  5241. -@@ -498,33 +498,33 @@ int ieee80211_data_to_8023(struct sk_buf
  5242. - break;
  5243. - }
  5244. -
  5245. -- if (!pskb_may_pull(skb, hdrlen + 8))
  5246. -- return -1;
  5247. --
  5248. -- payload = skb->data + hdrlen;
  5249. -- ethertype = (payload[6] << 8) | payload[7];
  5250. -+ skb_copy_bits(skb, hdrlen, &payload, sizeof(payload));
  5251. -+ tmp.h_proto = payload.proto;
  5252. -
  5253. -- if (likely((ether_addr_equal(payload, rfc1042_header) &&
  5254. -- ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) ||
  5255. -- ether_addr_equal(payload, bridge_tunnel_header))) {
  5256. -+ if (likely((ether_addr_equal(payload.hdr, rfc1042_header) &&
  5257. -+ tmp.h_proto != htons(ETH_P_AARP) &&
  5258. -+ tmp.h_proto != htons(ETH_P_IPX)) ||
  5259. -+ ether_addr_equal(payload.hdr, bridge_tunnel_header)))
  5260. - /* remove RFC1042 or Bridge-Tunnel encapsulation and
  5261. - * replace EtherType */
  5262. -- skb_pull(skb, hdrlen + 6);
  5263. -- memcpy(skb_push(skb, ETH_ALEN), src, ETH_ALEN);
  5264. -- memcpy(skb_push(skb, ETH_ALEN), dst, ETH_ALEN);
  5265. -- } else {
  5266. -- struct ethhdr *ehdr;
  5267. -- __be16 len;
  5268. -+ hdrlen += ETH_ALEN + 2;
  5269. -+ else
  5270. -+ tmp.h_proto = htons(skb->len);
  5271. -
  5272. -- skb_pull(skb, hdrlen);
  5273. -- len = htons(skb->len);
  5274. -+ pskb_pull(skb, hdrlen);
  5275. -+
  5276. -+ if (!ehdr)
  5277. - ehdr = (struct ethhdr *) skb_push(skb, sizeof(struct ethhdr));
  5278. -- memcpy(ehdr->h_dest, dst, ETH_ALEN);
  5279. -- memcpy(ehdr->h_source, src, ETH_ALEN);
  5280. -- ehdr->h_proto = len;
  5281. -- }
  5282. -+ memcpy(ehdr, &tmp, sizeof(tmp));
  5283. -+
  5284. - return 0;
  5285. - }
  5286. -+
  5287. -+int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
  5288. -+ enum nl80211_iftype iftype)
  5289. -+{
  5290. -+ return __ieee80211_data_to_8023(skb, NULL, addr, iftype);
  5291. -+}
  5292. - EXPORT_SYMBOL(ieee80211_data_to_8023);
  5293. -
  5294. - int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr,
  5295. 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
  5296. new file mode 100644
  5297. index 0000000..aaa6706
  5298. --- /dev/null
  5299. +++ b/package/kernel/mac80211/patches/320-ath9k-fix-using-sta-drv_priv-before-initializing-it.patch
  5300. @@ -0,0 +1,33 @@
  5301. +From: Felix Fietkau <nbd@nbd.name>
  5302. +Date: Tue, 2 Aug 2016 13:00:01 +0200
  5303. +Subject: [PATCH] ath9k: fix using sta->drv_priv before initializing it
  5304. +
  5305. +A station pointer can be passed to the driver on tx, before it has been
  5306. +marked as associated. Since ath9k_sta_state was initializing the entry
  5307. +too late, it resulted in some spurious crashes.
  5308. +
  5309. +Fixes: df3c6eb34da5 ("ath9k: Use sta_state() callback")
  5310. +Cc: stable@vger.kernel.org
  5311. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  5312. +---
  5313. +
  5314. +--- a/drivers/net/wireless/ath/ath9k/main.c
  5315. ++++ b/drivers/net/wireless/ath/ath9k/main.c
  5316. +@@ -1563,13 +1563,13 @@ static int ath9k_sta_state(struct ieee80
  5317. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  5318. + int ret = 0;
  5319. +
  5320. +- if (old_state == IEEE80211_STA_AUTH &&
  5321. +- new_state == IEEE80211_STA_ASSOC) {
  5322. ++ if (old_state == IEEE80211_STA_NOTEXIST &&
  5323. ++ new_state == IEEE80211_STA_NONE) {
  5324. + ret = ath9k_sta_add(hw, vif, sta);
  5325. + ath_dbg(common, CONFIG,
  5326. + "Add station: %pM\n", sta->addr);
  5327. +- } else if (old_state == IEEE80211_STA_ASSOC &&
  5328. +- new_state == IEEE80211_STA_AUTH) {
  5329. ++ } else if (old_state == IEEE80211_STA_NONE &&
  5330. ++ new_state == IEEE80211_STA_NOTEXIST) {
  5331. + ret = ath9k_sta_remove(hw, vif, sta);
  5332. + ath_dbg(common, CONFIG,
  5333. + "Remove station: %pM\n", sta->addr);
  5334. 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
  5335. deleted file mode 100644
  5336. index 2eeed22..0000000
  5337. --- a/package/kernel/mac80211/patches/320-cfg80211-add-support-for-non-linear-skbs-in-ieee8021.patch
  5338. +++ /dev/null
  5339. @@ -1,159 +0,0 @@
  5340. -From: Felix Fietkau <nbd@openwrt.org>
  5341. -Date: Tue, 2 Feb 2016 14:39:10 +0100
  5342. -Subject: [PATCH] cfg80211: add support for non-linear skbs in
  5343. - ieee80211_amsdu_to_8023s
  5344. -
  5345. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  5346. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  5347. ----
  5348. -
  5349. ---- a/net/wireless/util.c
  5350. -+++ b/net/wireless/util.c
  5351. -@@ -644,73 +644,75 @@ int ieee80211_data_from_8023(struct sk_b
  5352. - }
  5353. - EXPORT_SYMBOL(ieee80211_data_from_8023);
  5354. -
  5355. -+static struct sk_buff *
  5356. -+__ieee80211_amsdu_copy(struct sk_buff *skb, unsigned int hlen,
  5357. -+ int offset, int len)
  5358. -+{
  5359. -+ struct sk_buff *frame;
  5360. -+
  5361. -+ if (skb->len - offset < len)
  5362. -+ return NULL;
  5363. -+
  5364. -+ /*
  5365. -+ * Allocate and reserve two bytes more for payload
  5366. -+ * alignment since sizeof(struct ethhdr) is 14.
  5367. -+ */
  5368. -+ frame = dev_alloc_skb(hlen + sizeof(struct ethhdr) + 2 + len);
  5369. -+
  5370. -+ skb_reserve(frame, hlen + sizeof(struct ethhdr) + 2);
  5371. -+ skb_copy_bits(skb, offset, skb_put(frame, len), len);
  5372. -+
  5373. -+ return frame;
  5374. -+}
  5375. -
  5376. - void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
  5377. - const u8 *addr, enum nl80211_iftype iftype,
  5378. - const unsigned int extra_headroom,
  5379. - bool has_80211_header)
  5380. - {
  5381. -+ unsigned int hlen = ALIGN(extra_headroom, 4);
  5382. - struct sk_buff *frame = NULL;
  5383. - u16 ethertype;
  5384. - u8 *payload;
  5385. -- const struct ethhdr *eth;
  5386. -- int remaining, err;
  5387. -- u8 dst[ETH_ALEN], src[ETH_ALEN];
  5388. --
  5389. -- if (skb_linearize(skb))
  5390. -- goto out;
  5391. -+ int offset = 0, remaining, err;
  5392. -+ struct ethhdr eth;
  5393. -+ bool reuse_skb = true;
  5394. -+ bool last = false;
  5395. -
  5396. - if (has_80211_header) {
  5397. -- err = ieee80211_data_to_8023(skb, addr, iftype);
  5398. -+ err = __ieee80211_data_to_8023(skb, &eth, addr, iftype);
  5399. - if (err)
  5400. - goto out;
  5401. --
  5402. -- /* skip the wrapping header */
  5403. -- eth = (struct ethhdr *) skb_pull(skb, sizeof(struct ethhdr));
  5404. -- if (!eth)
  5405. -- goto out;
  5406. -- } else {
  5407. -- eth = (struct ethhdr *) skb->data;
  5408. - }
  5409. -
  5410. -- while (skb != frame) {
  5411. -+ while (!last) {
  5412. -+ unsigned int subframe_len;
  5413. -+ int len;
  5414. - u8 padding;
  5415. -- __be16 len = eth->h_proto;
  5416. -- unsigned int subframe_len = sizeof(struct ethhdr) + ntohs(len);
  5417. --
  5418. -- remaining = skb->len;
  5419. -- memcpy(dst, eth->h_dest, ETH_ALEN);
  5420. -- memcpy(src, eth->h_source, ETH_ALEN);
  5421. -
  5422. -+ skb_copy_bits(skb, offset, &eth, sizeof(eth));
  5423. -+ len = ntohs(eth.h_proto);
  5424. -+ subframe_len = sizeof(struct ethhdr) + len;
  5425. - padding = (4 - subframe_len) & 0x3;
  5426. -+
  5427. - /* the last MSDU has no padding */
  5428. -+ remaining = skb->len - offset;
  5429. - if (subframe_len > remaining)
  5430. - goto purge;
  5431. -
  5432. -- skb_pull(skb, sizeof(struct ethhdr));
  5433. -+ offset += sizeof(struct ethhdr);
  5434. - /* reuse skb for the last subframe */
  5435. -- if (remaining <= subframe_len + padding)
  5436. -+ last = remaining <= subframe_len + padding;
  5437. -+ if (!skb_is_nonlinear(skb) && last) {
  5438. -+ skb_pull(skb, offset);
  5439. - frame = skb;
  5440. -- else {
  5441. -- unsigned int hlen = ALIGN(extra_headroom, 4);
  5442. -- /*
  5443. -- * Allocate and reserve two bytes more for payload
  5444. -- * alignment since sizeof(struct ethhdr) is 14.
  5445. -- */
  5446. -- frame = dev_alloc_skb(hlen + subframe_len + 2);
  5447. -+ reuse_skb = true;
  5448. -+ } else {
  5449. -+ frame = __ieee80211_amsdu_copy(skb, hlen, offset, len);
  5450. - if (!frame)
  5451. - goto purge;
  5452. -
  5453. -- skb_reserve(frame, hlen + sizeof(struct ethhdr) + 2);
  5454. -- memcpy(skb_put(frame, ntohs(len)), skb->data,
  5455. -- ntohs(len));
  5456. --
  5457. -- eth = (struct ethhdr *)skb_pull(skb, ntohs(len) +
  5458. -- padding);
  5459. -- if (!eth) {
  5460. -- dev_kfree_skb(frame);
  5461. -- goto purge;
  5462. -- }
  5463. -+ offset += len + padding;
  5464. - }
  5465. -
  5466. - skb_reset_network_header(frame);
  5467. -@@ -719,24 +721,20 @@ void ieee80211_amsdu_to_8023s(struct sk_
  5468. -
  5469. - payload = frame->data;
  5470. - ethertype = (payload[6] << 8) | payload[7];
  5471. --
  5472. - if (likely((ether_addr_equal(payload, rfc1042_header) &&
  5473. - ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) ||
  5474. - ether_addr_equal(payload, bridge_tunnel_header))) {
  5475. -- /* remove RFC1042 or Bridge-Tunnel
  5476. -- * encapsulation and replace EtherType */
  5477. -- skb_pull(frame, 6);
  5478. -- memcpy(skb_push(frame, ETH_ALEN), src, ETH_ALEN);
  5479. -- memcpy(skb_push(frame, ETH_ALEN), dst, ETH_ALEN);
  5480. -- } else {
  5481. -- memcpy(skb_push(frame, sizeof(__be16)), &len,
  5482. -- sizeof(__be16));
  5483. -- memcpy(skb_push(frame, ETH_ALEN), src, ETH_ALEN);
  5484. -- memcpy(skb_push(frame, ETH_ALEN), dst, ETH_ALEN);
  5485. -+ eth.h_proto = htons(ethertype);
  5486. -+ skb_pull(frame, ETH_ALEN + 2);
  5487. - }
  5488. -+
  5489. -+ memcpy(skb_push(frame, sizeof(eth)), &eth, sizeof(eth));
  5490. - __skb_queue_tail(list, frame);
  5491. - }
  5492. -
  5493. -+ if (!reuse_skb)
  5494. -+ dev_kfree_skb(skb);
  5495. -+
  5496. - return;
  5497. -
  5498. - purge:
  5499. 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
  5500. new file mode 100644
  5501. index 0000000..9caa76d
  5502. --- /dev/null
  5503. +++ b/package/kernel/mac80211/patches/321-ath9k_hw-reset-AHB-WMAC-interface-on-AR91xx.patch
  5504. @@ -0,0 +1,25 @@
  5505. +From: Felix Fietkau <nbd@nbd.name>
  5506. +Date: Sat, 9 Jul 2016 15:25:24 +0200
  5507. +Subject: [PATCH] ath9k_hw: reset AHB-WMAC interface on AR91xx
  5508. +
  5509. +Should fix a few stability issues
  5510. +
  5511. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  5512. +---
  5513. +
  5514. +--- a/drivers/net/wireless/ath/ath9k/hw.c
  5515. ++++ b/drivers/net/wireless/ath/ath9k/hw.c
  5516. +@@ -1398,8 +1398,12 @@ static bool ath9k_hw_set_reset(struct at
  5517. + if (!AR_SREV_9100(ah))
  5518. + REG_WRITE(ah, AR_RC, 0);
  5519. +
  5520. +- if (AR_SREV_9100(ah))
  5521. ++ if (AR_SREV_9100(ah)) {
  5522. ++ /* Reset the AHB-WMAC interface */
  5523. ++ if (ah->external_reset)
  5524. ++ ah->external_reset();
  5525. + udelay(50);
  5526. ++ }
  5527. +
  5528. + return true;
  5529. + }
  5530. 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
  5531. deleted file mode 100644
  5532. index c4155a1..0000000
  5533. --- a/package/kernel/mac80211/patches/321-mac80211-Parse-legacy-and-HT-rate-in-injected-frames.patch
  5534. +++ /dev/null
  5535. @@ -1,155 +0,0 @@
  5536. -From: Sven Eckelmann <sven@narfation.org>
  5537. -Date: Tue, 26 Jan 2016 17:11:13 +0100
  5538. -Subject: [PATCH] mac80211: Parse legacy and HT rate in injected frames
  5539. -
  5540. -Drivers/devices without their own rate control algorithm can get the
  5541. -information what rates they should use from either the radiotap header of
  5542. -injected frames or from the rate control algorithm. But the parsing of the
  5543. -legacy rate information from the radiotap header was removed in commit
  5544. -e6a9854b05c1 ("mac80211/drivers: rewrite the rate control API").
  5545. -
  5546. -The removal of this feature heavily reduced the usefulness of frame
  5547. -injection when wanting to simulate specific transmission behavior. Having
  5548. -rate parsing together with MCS rates and retry support allows a fine
  5549. -grained selection of the tx behavior of injected frames for these kind of
  5550. -tests.
  5551. -
  5552. -Signed-off-by: Sven Eckelmann <sven@narfation.org>
  5553. -Cc: Simon Wunderlich <sw@simonwunderlich.de>
  5554. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  5555. ----
  5556. -
  5557. ---- a/include/net/mac80211.h
  5558. -+++ b/include/net/mac80211.h
  5559. -@@ -708,12 +708,14 @@ enum mac80211_tx_info_flags {
  5560. - * protocol frame (e.g. EAP)
  5561. - * @IEEE80211_TX_CTRL_PS_RESPONSE: This frame is a response to a poll
  5562. - * frame (PS-Poll or uAPSD).
  5563. -+ * @IEEE80211_TX_CTRL_RATE_INJECT: This frame is injected with rate information
  5564. - *
  5565. - * These flags are used in tx_info->control.flags.
  5566. - */
  5567. - enum mac80211_tx_control_flags {
  5568. - IEEE80211_TX_CTRL_PORT_CTRL_PROTO = BIT(0),
  5569. - IEEE80211_TX_CTRL_PS_RESPONSE = BIT(1),
  5570. -+ IEEE80211_TX_CTRL_RATE_INJECT = BIT(2),
  5571. - };
  5572. -
  5573. - /*
  5574. ---- a/net/mac80211/tx.c
  5575. -+++ b/net/mac80211/tx.c
  5576. -@@ -710,6 +710,10 @@ ieee80211_tx_h_rate_ctrl(struct ieee8021
  5577. -
  5578. - info->control.short_preamble = txrc.short_preamble;
  5579. -
  5580. -+ /* don't ask rate control when rate already injected via radiotap */
  5581. -+ if (info->control.flags & IEEE80211_TX_CTRL_RATE_INJECT)
  5582. -+ return TX_CONTINUE;
  5583. -+
  5584. - if (tx->sta)
  5585. - assoc = test_sta_flag(tx->sta, WLAN_STA_ASSOC);
  5586. -
  5587. -@@ -1665,15 +1669,24 @@ void ieee80211_xmit(struct ieee80211_sub
  5588. - ieee80211_tx(sdata, sta, skb, false);
  5589. - }
  5590. -
  5591. --static bool ieee80211_parse_tx_radiotap(struct sk_buff *skb)
  5592. -+static bool ieee80211_parse_tx_radiotap(struct ieee80211_local *local,
  5593. -+ struct sk_buff *skb)
  5594. - {
  5595. - struct ieee80211_radiotap_iterator iterator;
  5596. - struct ieee80211_radiotap_header *rthdr =
  5597. - (struct ieee80211_radiotap_header *) skb->data;
  5598. - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  5599. -+ struct ieee80211_supported_band *sband =
  5600. -+ local->hw.wiphy->bands[info->band];
  5601. - int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len,
  5602. - NULL);
  5603. - u16 txflags;
  5604. -+ u16 rate = 0;
  5605. -+ bool rate_found = false;
  5606. -+ u8 rate_retries = 0;
  5607. -+ u16 rate_flags = 0;
  5608. -+ u8 mcs_known, mcs_flags;
  5609. -+ int i;
  5610. -
  5611. - info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT |
  5612. - IEEE80211_TX_CTL_DONTFRAG;
  5613. -@@ -1724,6 +1737,35 @@ static bool ieee80211_parse_tx_radiotap(
  5614. - info->flags |= IEEE80211_TX_CTL_NO_ACK;
  5615. - break;
  5616. -
  5617. -+ case IEEE80211_RADIOTAP_RATE:
  5618. -+ rate = *iterator.this_arg;
  5619. -+ rate_flags = 0;
  5620. -+ rate_found = true;
  5621. -+ break;
  5622. -+
  5623. -+ case IEEE80211_RADIOTAP_DATA_RETRIES:
  5624. -+ rate_retries = *iterator.this_arg;
  5625. -+ break;
  5626. -+
  5627. -+ case IEEE80211_RADIOTAP_MCS:
  5628. -+ mcs_known = iterator.this_arg[0];
  5629. -+ mcs_flags = iterator.this_arg[1];
  5630. -+ if (!(mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_MCS))
  5631. -+ break;
  5632. -+
  5633. -+ rate_found = true;
  5634. -+ rate = iterator.this_arg[2];
  5635. -+ rate_flags = IEEE80211_TX_RC_MCS;
  5636. -+
  5637. -+ if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_GI &&
  5638. -+ mcs_flags & IEEE80211_RADIOTAP_MCS_SGI)
  5639. -+ rate_flags |= IEEE80211_TX_RC_SHORT_GI;
  5640. -+
  5641. -+ if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_BW &&
  5642. -+ mcs_flags & IEEE80211_RADIOTAP_MCS_BW_40)
  5643. -+ rate_flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
  5644. -+ break;
  5645. -+
  5646. - /*
  5647. - * Please update the file
  5648. - * Documentation/networking/mac80211-injection.txt
  5649. -@@ -1738,6 +1780,32 @@ static bool ieee80211_parse_tx_radiotap(
  5650. - if (ret != -ENOENT) /* ie, if we didn't simply run out of fields */
  5651. - return false;
  5652. -
  5653. -+ if (rate_found) {
  5654. -+ info->control.flags |= IEEE80211_TX_CTRL_RATE_INJECT;
  5655. -+
  5656. -+ for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) {
  5657. -+ info->control.rates[i].idx = -1;
  5658. -+ info->control.rates[i].flags = 0;
  5659. -+ info->control.rates[i].count = 0;
  5660. -+ }
  5661. -+
  5662. -+ if (rate_flags & IEEE80211_TX_RC_MCS) {
  5663. -+ info->control.rates[0].idx = rate;
  5664. -+ } else {
  5665. -+ for (i = 0; i < sband->n_bitrates; i++) {
  5666. -+ if (rate * 5 != sband->bitrates[i].bitrate)
  5667. -+ continue;
  5668. -+
  5669. -+ info->control.rates[0].idx = i;
  5670. -+ break;
  5671. -+ }
  5672. -+ }
  5673. -+
  5674. -+ info->control.rates[0].flags = rate_flags;
  5675. -+ info->control.rates[0].count = min_t(u8, rate_retries + 1,
  5676. -+ local->hw.max_rate_tries);
  5677. -+ }
  5678. -+
  5679. - /*
  5680. - * remove the radiotap header
  5681. - * iterator->_max_length was sanity-checked against
  5682. -@@ -1819,7 +1887,7 @@ netdev_tx_t ieee80211_monitor_start_xmit
  5683. - IEEE80211_TX_CTL_INJECTED;
  5684. -
  5685. - /* process and remove the injection radiotap header */
  5686. -- if (!ieee80211_parse_tx_radiotap(skb))
  5687. -+ if (!ieee80211_parse_tx_radiotap(local, skb))
  5688. - goto fail;
  5689. -
  5690. - rcu_read_lock();
  5691. 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
  5692. new file mode 100644
  5693. index 0000000..5d4e849
  5694. --- /dev/null
  5695. +++ b/package/kernel/mac80211/patches/322-ath9k_hw-issue-external-reset-for-QCA9550.patch
  5696. @@ -0,0 +1,125 @@
  5697. +From: Felix Fietkau <nbd@nbd.name>
  5698. +Date: Sat, 9 Jul 2016 15:26:44 +0200
  5699. +Subject: [PATCH] ath9k_hw: issue external reset for QCA9550
  5700. +
  5701. +The RTC interface on the SoC needs to be reset along with the rest of
  5702. +the WMAC.
  5703. +
  5704. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  5705. +---
  5706. +
  5707. +--- a/drivers/net/wireless/ath/ath9k/hw.c
  5708. ++++ b/drivers/net/wireless/ath/ath9k/hw.c
  5709. +@@ -1275,39 +1275,56 @@ void ath9k_hw_get_delta_slope_vals(struc
  5710. + *coef_exponent = coef_exp - 16;
  5711. + }
  5712. +
  5713. +-/* AR9330 WAR:
  5714. +- * call external reset function to reset WMAC if:
  5715. +- * - doing a cold reset
  5716. +- * - we have pending frames in the TX queues.
  5717. +- */
  5718. +-static bool ath9k_hw_ar9330_reset_war(struct ath_hw *ah, int type)
  5719. ++static bool ath9k_hw_need_external_reset(struct ath_hw *ah, int type)
  5720. + {
  5721. +- int i, npend = 0;
  5722. ++ int i;
  5723. +
  5724. +- for (i = 0; i < AR_NUM_QCU; i++) {
  5725. +- npend = ath9k_hw_numtxpending(ah, i);
  5726. +- if (npend)
  5727. +- break;
  5728. ++ if (type == ATH9K_RESET_COLD)
  5729. ++ return true;
  5730. ++
  5731. ++ if (AR_SREV_9550(ah))
  5732. ++ return true;
  5733. ++
  5734. ++ /* AR9330 WAR:
  5735. ++ * call external reset function to reset WMAC if:
  5736. ++ * - doing a cold reset
  5737. ++ * - we have pending frames in the TX queues.
  5738. ++ */
  5739. ++ if (AR_SREV_9330(ah)) {
  5740. ++ for (i = 0; i < AR_NUM_QCU; i++) {
  5741. ++ if (ath9k_hw_numtxpending(ah, i))
  5742. ++ return true;
  5743. ++ }
  5744. + }
  5745. +
  5746. +- if (ah->external_reset &&
  5747. +- (npend || type == ATH9K_RESET_COLD)) {
  5748. +- int reset_err = 0;
  5749. ++ return false;
  5750. ++}
  5751. +
  5752. +- ath_dbg(ath9k_hw_common(ah), RESET,
  5753. +- "reset MAC via external reset\n");
  5754. ++static bool ath9k_hw_external_reset(struct ath_hw *ah, int type)
  5755. ++{
  5756. ++ int err;
  5757. +
  5758. +- reset_err = ah->external_reset();
  5759. +- if (reset_err) {
  5760. +- ath_err(ath9k_hw_common(ah),
  5761. +- "External reset failed, err=%d\n",
  5762. +- reset_err);
  5763. +- return false;
  5764. +- }
  5765. ++ if (!ah->external_reset || !ath9k_hw_need_external_reset(ah, type))
  5766. ++ return true;
  5767. +
  5768. +- REG_WRITE(ah, AR_RTC_RESET, 1);
  5769. ++ ath_dbg(ath9k_hw_common(ah), RESET,
  5770. ++ "reset MAC via external reset\n");
  5771. ++
  5772. ++ err = ah->external_reset();
  5773. ++ if (err) {
  5774. ++ ath_err(ath9k_hw_common(ah),
  5775. ++ "External reset failed, err=%d\n", err);
  5776. ++ return false;
  5777. ++ }
  5778. ++
  5779. ++ if (AR_SREV_9550(ah)) {
  5780. ++ REG_WRITE(ah, AR_RTC_RESET, 0);
  5781. ++ udelay(10);
  5782. + }
  5783. +
  5784. ++ REG_WRITE(ah, AR_RTC_RESET, 1);
  5785. ++ udelay(10);
  5786. ++
  5787. + return true;
  5788. + }
  5789. +
  5790. +@@ -1360,24 +1377,23 @@ static bool ath9k_hw_set_reset(struct at
  5791. + rst_flags |= AR_RTC_RC_MAC_COLD;
  5792. + }
  5793. +
  5794. +- if (AR_SREV_9330(ah)) {
  5795. +- if (!ath9k_hw_ar9330_reset_war(ah, type))
  5796. +- return false;
  5797. +- }
  5798. +-
  5799. + if (ath9k_hw_mci_is_enabled(ah))
  5800. + ar9003_mci_check_gpm_offset(ah);
  5801. +
  5802. + /* DMA HALT added to resolve ar9300 and ar9580 bus error during
  5803. +- * RTC_RC reg read
  5804. ++ * RTC_RC reg read. Also needed for AR9550 external reset
  5805. + */
  5806. +- if (AR_SREV_9300(ah) || AR_SREV_9580(ah)) {
  5807. ++ if (AR_SREV_9300(ah) || AR_SREV_9580(ah) || AR_SREV_9550(ah)) {
  5808. + REG_SET_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  5809. + ath9k_hw_wait(ah, AR_CFG, AR_CFG_HALT_ACK, AR_CFG_HALT_ACK,
  5810. + 20 * AH_WAIT_TIMEOUT);
  5811. +- REG_CLR_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  5812. + }
  5813. +
  5814. ++ ath9k_hw_external_reset(ah, type);
  5815. ++
  5816. ++ if (AR_SREV_9300(ah) || AR_SREV_9580(ah))
  5817. ++ REG_CLR_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  5818. ++
  5819. + REG_WRITE(ah, AR_RTC_RC, rst_flags);
  5820. +
  5821. + REGWRITE_BUFFER_FLUSH(ah);
  5822. 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
  5823. deleted file mode 100644
  5824. index e7bfb9c..0000000
  5825. --- a/package/kernel/mac80211/patches/322-mac80211-add-A-MSDU-tx-support.patch
  5826. +++ /dev/null
  5827. @@ -1,317 +0,0 @@
  5828. -From: Felix Fietkau <nbd@openwrt.org>
  5829. -Date: Fri, 5 Feb 2016 01:38:51 +0100
  5830. -Subject: [PATCH] mac80211: add A-MSDU tx support
  5831. -
  5832. -Requires software tx queueing support. frag_list support (for zero-copy)
  5833. -is optional.
  5834. -
  5835. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  5836. ----
  5837. -
  5838. ---- a/include/net/mac80211.h
  5839. -+++ b/include/net/mac80211.h
  5840. -@@ -709,6 +709,7 @@ enum mac80211_tx_info_flags {
  5841. - * @IEEE80211_TX_CTRL_PS_RESPONSE: This frame is a response to a poll
  5842. - * frame (PS-Poll or uAPSD).
  5843. - * @IEEE80211_TX_CTRL_RATE_INJECT: This frame is injected with rate information
  5844. -+ * @IEEE80211_TX_CTRL_AMSDU: This frame is an A-MSDU frame
  5845. - *
  5846. - * These flags are used in tx_info->control.flags.
  5847. - */
  5848. -@@ -716,6 +717,7 @@ enum mac80211_tx_control_flags {
  5849. - IEEE80211_TX_CTRL_PORT_CTRL_PROTO = BIT(0),
  5850. - IEEE80211_TX_CTRL_PS_RESPONSE = BIT(1),
  5851. - IEEE80211_TX_CTRL_RATE_INJECT = BIT(2),
  5852. -+ IEEE80211_TX_CTRL_AMSDU = BIT(3),
  5853. - };
  5854. -
  5855. - /*
  5856. -@@ -1728,6 +1730,7 @@ struct ieee80211_sta_rates {
  5857. - * size is min(max_amsdu_len, 7935) bytes.
  5858. - * Both additional HT limits must be enforced by the low level driver.
  5859. - * This is defined by the spec (IEEE 802.11-2012 section 8.3.2.2 NOTE 2).
  5860. -+ * @max_rc_amsdu_len: Maximum A-MSDU size in bytes recommended by rate control.
  5861. - * @txq: per-TID data TX queues (if driver uses the TXQ abstraction)
  5862. - */
  5863. - struct ieee80211_sta {
  5864. -@@ -1748,6 +1751,7 @@ struct ieee80211_sta {
  5865. - bool mfp;
  5866. - u8 max_amsdu_subframes;
  5867. - u16 max_amsdu_len;
  5868. -+ u16 max_rc_amsdu_len;
  5869. -
  5870. - struct ieee80211_txq *txq[IEEE80211_NUM_TIDS];
  5871. -
  5872. -@@ -1961,6 +1965,15 @@ struct ieee80211_txq {
  5873. - * order and does not need to manage its own reorder buffer or BA session
  5874. - * timeout.
  5875. - *
  5876. -+ * @IEEE80211_HW_TX_AMSDU: Hardware (or driver) supports software aggregated
  5877. -+ * A-MSDU frames. Requires software tx queueing and fast-xmit support.
  5878. -+ * When not using minstrel/minstrel_ht rate control, the driver should
  5879. -+ * limit the maximum A-MSDU size based on the current tx rate by setting
  5880. -+ * max_rc_amsdu_len in struct ieee80211_sta.
  5881. -+ *
  5882. -+ * @IEEE80211_HW_TX_FRAG_LIST: Hardware (or driver) supports sending frag_list
  5883. -+ * skbs, needed for zero-copy software A-MSDU.
  5884. -+ *
  5885. - * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
  5886. - */
  5887. - enum ieee80211_hw_flags {
  5888. -@@ -1998,6 +2011,8 @@ enum ieee80211_hw_flags {
  5889. - IEEE80211_HW_BEACON_TX_STATUS,
  5890. - IEEE80211_HW_NEEDS_UNIQUE_STA_ADDR,
  5891. - IEEE80211_HW_SUPPORTS_REORDERING_BUFFER,
  5892. -+ IEEE80211_HW_TX_AMSDU,
  5893. -+ IEEE80211_HW_TX_FRAG_LIST,
  5894. -
  5895. - /* keep last, obviously */
  5896. - NUM_IEEE80211_HW_FLAGS
  5897. -@@ -2070,6 +2085,9 @@ enum ieee80211_hw_flags {
  5898. - * size is smaller (an example is LinkSys WRT120N with FW v1.0.07
  5899. - * build 002 Jun 18 2012).
  5900. - *
  5901. -+ * @max_tx_fragments: maximum number of tx buffers per (A)-MSDU, sum
  5902. -+ * of 1 + skb_shinfo(skb)->nr_frags for each skb in the frag_list.
  5903. -+ *
  5904. - * @offchannel_tx_hw_queue: HW queue ID to use for offchannel TX
  5905. - * (if %IEEE80211_HW_QUEUE_CONTROL is set)
  5906. - *
  5907. -@@ -2124,6 +2142,7 @@ struct ieee80211_hw {
  5908. - u8 max_rate_tries;
  5909. - u8 max_rx_aggregation_subframes;
  5910. - u8 max_tx_aggregation_subframes;
  5911. -+ u8 max_tx_fragments;
  5912. - u8 offchannel_tx_hw_queue;
  5913. - u8 radiotap_mcs_details;
  5914. - u16 radiotap_vht_details;
  5915. ---- a/net/mac80211/agg-tx.c
  5916. -+++ b/net/mac80211/agg-tx.c
  5917. -@@ -935,6 +935,7 @@ void ieee80211_process_addba_resp(struct
  5918. - size_t len)
  5919. - {
  5920. - struct tid_ampdu_tx *tid_tx;
  5921. -+ struct ieee80211_txq *txq;
  5922. - u16 capab, tid;
  5923. - u8 buf_size;
  5924. - bool amsdu;
  5925. -@@ -945,6 +946,10 @@ void ieee80211_process_addba_resp(struct
  5926. - buf_size = (capab & IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK) >> 6;
  5927. - buf_size = min(buf_size, local->hw.max_tx_aggregation_subframes);
  5928. -
  5929. -+ txq = sta->sta.txq[tid];
  5930. -+ if (!amsdu && txq)
  5931. -+ set_bit(IEEE80211_TXQ_NO_AMSDU, &to_txq_info(txq)->flags);
  5932. -+
  5933. - mutex_lock(&sta->ampdu_mlme.mtx);
  5934. -
  5935. - tid_tx = rcu_dereference_protected_tid_tx(sta, tid);
  5936. ---- a/net/mac80211/debugfs.c
  5937. -+++ b/net/mac80211/debugfs.c
  5938. -@@ -127,6 +127,8 @@ static const char *hw_flag_names[NUM_IEE
  5939. - FLAG(BEACON_TX_STATUS),
  5940. - FLAG(NEEDS_UNIQUE_STA_ADDR),
  5941. - FLAG(SUPPORTS_REORDERING_BUFFER),
  5942. -+ FLAG(TX_AMSDU),
  5943. -+ FLAG(TX_FRAG_LIST),
  5944. -
  5945. - /* keep last for the build bug below */
  5946. - (void *)0x1
  5947. ---- a/net/mac80211/ieee80211_i.h
  5948. -+++ b/net/mac80211/ieee80211_i.h
  5949. -@@ -799,6 +799,7 @@ struct mac80211_qos_map {
  5950. - enum txq_info_flags {
  5951. - IEEE80211_TXQ_STOP,
  5952. - IEEE80211_TXQ_AMPDU,
  5953. -+ IEEE80211_TXQ_NO_AMSDU,
  5954. - };
  5955. -
  5956. - struct txq_info {
  5957. ---- a/net/mac80211/tx.c
  5958. -+++ b/net/mac80211/tx.c
  5959. -@@ -1318,6 +1318,10 @@ struct sk_buff *ieee80211_tx_dequeue(str
  5960. - out:
  5961. - spin_unlock_bh(&txqi->queue.lock);
  5962. -
  5963. -+ if (skb && skb_has_frag_list(skb) &&
  5964. -+ !ieee80211_hw_check(&local->hw, TX_FRAG_LIST))
  5965. -+ skb_linearize(skb);
  5966. -+
  5967. - return skb;
  5968. - }
  5969. - EXPORT_SYMBOL(ieee80211_tx_dequeue);
  5970. -@@ -2757,6 +2761,163 @@ void ieee80211_clear_fast_xmit(struct st
  5971. - kfree_rcu(fast_tx, rcu_head);
  5972. - }
  5973. -
  5974. -+static bool ieee80211_amsdu_realloc_pad(struct ieee80211_local *local,
  5975. -+ struct sk_buff *skb, int headroom,
  5976. -+ int *subframe_len)
  5977. -+{
  5978. -+ int amsdu_len = *subframe_len + sizeof(struct ethhdr);
  5979. -+ int padding = (4 - amsdu_len) & 3;
  5980. -+
  5981. -+ if (skb_headroom(skb) < headroom || skb_tailroom(skb) < padding) {
  5982. -+ I802_DEBUG_INC(local->tx_expand_skb_head);
  5983. -+
  5984. -+ if (pskb_expand_head(skb, headroom, padding, GFP_ATOMIC)) {
  5985. -+ wiphy_debug(local->hw.wiphy,
  5986. -+ "failed to reallocate TX buffer\n");
  5987. -+ return false;
  5988. -+ }
  5989. -+ }
  5990. -+
  5991. -+ if (padding) {
  5992. -+ *subframe_len += padding;
  5993. -+ memset(skb_put(skb, padding), 0, padding);
  5994. -+ }
  5995. -+
  5996. -+ return true;
  5997. -+}
  5998. -+
  5999. -+static bool ieee80211_amsdu_prepare_head(struct ieee80211_sub_if_data *sdata,
  6000. -+ struct ieee80211_fast_tx *fast_tx,
  6001. -+ struct sk_buff *skb)
  6002. -+{
  6003. -+ struct ieee80211_local *local = sdata->local;
  6004. -+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  6005. -+ struct ieee80211_hdr *hdr;
  6006. -+ struct ethhdr amsdu_hdr;
  6007. -+ int hdr_len = fast_tx->hdr_len - sizeof(rfc1042_header);
  6008. -+ int subframe_len = skb->len - hdr_len;
  6009. -+ void *data;
  6010. -+ u8 *qc;
  6011. -+
  6012. -+ if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE)
  6013. -+ return false;
  6014. -+
  6015. -+ if (info->control.flags & IEEE80211_TX_CTRL_AMSDU)
  6016. -+ return true;
  6017. -+
  6018. -+ if (!ieee80211_amsdu_realloc_pad(local, skb, sizeof(amsdu_hdr),
  6019. -+ &subframe_len))
  6020. -+ return false;
  6021. -+
  6022. -+ amsdu_hdr.h_proto = cpu_to_be16(subframe_len);
  6023. -+ memcpy(amsdu_hdr.h_source, skb->data + fast_tx->sa_offs, ETH_ALEN);
  6024. -+ memcpy(amsdu_hdr.h_dest, skb->data + fast_tx->da_offs, ETH_ALEN);
  6025. -+
  6026. -+ data = skb_push(skb, sizeof(amsdu_hdr));
  6027. -+ memmove(data, data + sizeof(amsdu_hdr), hdr_len);
  6028. -+ memcpy(data + hdr_len, &amsdu_hdr, sizeof(amsdu_hdr));
  6029. -+
  6030. -+ hdr = data;
  6031. -+ qc = ieee80211_get_qos_ctl(hdr);
  6032. -+ *qc |= IEEE80211_QOS_CTL_A_MSDU_PRESENT;
  6033. -+
  6034. -+ info->control.flags |= IEEE80211_TX_CTRL_AMSDU;
  6035. -+
  6036. -+ return true;
  6037. -+}
  6038. -+
  6039. -+static bool ieee80211_amsdu_aggregate(struct ieee80211_sub_if_data *sdata,
  6040. -+ struct sta_info *sta,
  6041. -+ struct ieee80211_fast_tx *fast_tx,
  6042. -+ struct sk_buff *skb)
  6043. -+{
  6044. -+ struct ieee80211_local *local = sdata->local;
  6045. -+ u8 tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK;
  6046. -+ struct ieee80211_txq *txq = sta->sta.txq[tid];
  6047. -+ struct txq_info *txqi;
  6048. -+ struct sk_buff **frag_tail, *head;
  6049. -+ int subframe_len = skb->len - ETH_ALEN;
  6050. -+ u8 max_subframes = sta->sta.max_amsdu_subframes;
  6051. -+ int max_frags = local->hw.max_tx_fragments;
  6052. -+ int max_amsdu_len = sta->sta.max_amsdu_len;
  6053. -+ __be16 len;
  6054. -+ void *data;
  6055. -+ bool ret = false;
  6056. -+ int n = 1, nfrags;
  6057. -+
  6058. -+ if (!ieee80211_hw_check(&local->hw, TX_AMSDU))
  6059. -+ return false;
  6060. -+
  6061. -+ if (!txq)
  6062. -+ return false;
  6063. -+
  6064. -+ txqi = to_txq_info(txq);
  6065. -+ if (test_bit(IEEE80211_TXQ_NO_AMSDU, &txqi->flags))
  6066. -+ return false;
  6067. -+
  6068. -+ if (sta->sta.max_rc_amsdu_len)
  6069. -+ max_amsdu_len = min_t(int, max_amsdu_len,
  6070. -+ sta->sta.max_rc_amsdu_len);
  6071. -+
  6072. -+ spin_lock_bh(&txqi->queue.lock);
  6073. -+
  6074. -+ head = skb_peek_tail(&txqi->queue);
  6075. -+ if (!head)
  6076. -+ goto out;
  6077. -+
  6078. -+ if (skb->len + head->len > max_amsdu_len)
  6079. -+ goto out;
  6080. -+
  6081. -+ /*
  6082. -+ * HT A-MPDU limits maximum MPDU size to 4095 bytes. Since aggregation
  6083. -+ * sessions are started/stopped without txq flush, use the limit here
  6084. -+ * to avoid having to de-aggregate later.
  6085. -+ */
  6086. -+ if (skb->len + head->len > 4095 &&
  6087. -+ !sta->sta.vht_cap.vht_supported)
  6088. -+ goto out;
  6089. -+
  6090. -+ if (!ieee80211_amsdu_prepare_head(sdata, fast_tx, head))
  6091. -+ goto out;
  6092. -+
  6093. -+ nfrags = 1 + skb_shinfo(skb)->nr_frags;
  6094. -+ nfrags += 1 + skb_shinfo(head)->nr_frags;
  6095. -+ frag_tail = &skb_shinfo(head)->frag_list;
  6096. -+ while (*frag_tail) {
  6097. -+ nfrags += 1 + skb_shinfo(*frag_tail)->nr_frags;
  6098. -+ frag_tail = &(*frag_tail)->next;
  6099. -+ n++;
  6100. -+ }
  6101. -+
  6102. -+ if (max_subframes && n > max_subframes)
  6103. -+ goto out;
  6104. -+
  6105. -+ if (max_frags && nfrags > max_frags)
  6106. -+ goto out;
  6107. -+
  6108. -+ if (!ieee80211_amsdu_realloc_pad(local, skb, sizeof(rfc1042_header) + 2,
  6109. -+ &subframe_len))
  6110. -+ return false;
  6111. -+
  6112. -+ ret = true;
  6113. -+ data = skb_push(skb, ETH_ALEN + 2);
  6114. -+ memmove(data, data + ETH_ALEN + 2, 2 * ETH_ALEN);
  6115. -+
  6116. -+ data += 2 * ETH_ALEN;
  6117. -+ len = cpu_to_be16(subframe_len);
  6118. -+ memcpy(data, &len, 2);
  6119. -+ memcpy(data + 2, rfc1042_header, sizeof(rfc1042_header));
  6120. -+
  6121. -+ head->len += skb->len;
  6122. -+ head->data_len += skb->len;
  6123. -+ *frag_tail = skb;
  6124. -+
  6125. -+out:
  6126. -+ spin_unlock_bh(&txqi->queue.lock);
  6127. -+
  6128. -+ return ret;
  6129. -+}
  6130. -+
  6131. - static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata,
  6132. - struct net_device *dev, struct sta_info *sta,
  6133. - struct ieee80211_fast_tx *fast_tx,
  6134. -@@ -2811,6 +2972,10 @@ static bool ieee80211_xmit_fast(struct i
  6135. -
  6136. - ieee80211_tx_stats(dev, skb->len + extra_head);
  6137. -
  6138. -+ if ((hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) &&
  6139. -+ ieee80211_amsdu_aggregate(sdata, sta, fast_tx, skb))
  6140. -+ return true;
  6141. -+
  6142. - /* will not be crypto-handled beyond what we do here, so use false
  6143. - * as the may-encrypt argument for the resize to not account for
  6144. - * more room than we already have in 'extra_head'
  6145. 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
  6146. deleted file mode 100644
  6147. index 9277b2c..0000000
  6148. --- a/package/kernel/mac80211/patches/323-0000-brcmfmac-fix-setting-primary-channel-for-80-MHz-widt.patch
  6149. +++ /dev/null
  6150. @@ -1,64 +0,0 @@
  6151. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  6152. -Date: Wed, 20 Jan 2016 16:46:04 +0100
  6153. -Subject: [PATCH] brcmfmac: fix setting primary channel for 80 MHz width
  6154. -MIME-Version: 1.0
  6155. -Content-Type: text/plain; charset=UTF-8
  6156. -Content-Transfer-Encoding: 8bit
  6157. -
  6158. -First of all it changes the way we calculate primary channel offset. If
  6159. -we use e.g. 80 MHz channel with primary frequency 5180 MHz (which means
  6160. -center frequency is 5210 MHz) it makes sense to calculate primary offset
  6161. -as -30 MHz.
  6162. -Then it fixes values we compare primary_offset with. We were comparing
  6163. -offset in MHz against -2 or 2 which was resulting in picking a wrong
  6164. -primary channel.
  6165. -
  6166. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  6167. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6168. ----
  6169. -
  6170. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  6171. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  6172. -@@ -247,7 +247,7 @@ static u16 chandef_to_chanspec(struct br
  6173. - brcmf_dbg(TRACE, "chandef: control %d center %d width %d\n",
  6174. - ch->chan->center_freq, ch->center_freq1, ch->width);
  6175. - ch_inf.chnum = ieee80211_frequency_to_channel(ch->center_freq1);
  6176. -- primary_offset = ch->center_freq1 - ch->chan->center_freq;
  6177. -+ primary_offset = ch->chan->center_freq - ch->center_freq1;
  6178. - switch (ch->width) {
  6179. - case NL80211_CHAN_WIDTH_20:
  6180. - case NL80211_CHAN_WIDTH_20_NOHT:
  6181. -@@ -256,24 +256,21 @@ static u16 chandef_to_chanspec(struct br
  6182. - break;
  6183. - case NL80211_CHAN_WIDTH_40:
  6184. - ch_inf.bw = BRCMU_CHAN_BW_40;
  6185. -- if (primary_offset < 0)
  6186. -+ if (primary_offset > 0)
  6187. - ch_inf.sb = BRCMU_CHAN_SB_U;
  6188. - else
  6189. - ch_inf.sb = BRCMU_CHAN_SB_L;
  6190. - break;
  6191. - case NL80211_CHAN_WIDTH_80:
  6192. - ch_inf.bw = BRCMU_CHAN_BW_80;
  6193. -- if (primary_offset < 0) {
  6194. -- if (primary_offset < -CH_10MHZ_APART)
  6195. -- ch_inf.sb = BRCMU_CHAN_SB_UU;
  6196. -- else
  6197. -- ch_inf.sb = BRCMU_CHAN_SB_UL;
  6198. -- } else {
  6199. -- if (primary_offset > CH_10MHZ_APART)
  6200. -- ch_inf.sb = BRCMU_CHAN_SB_LL;
  6201. -- else
  6202. -- ch_inf.sb = BRCMU_CHAN_SB_LU;
  6203. -- }
  6204. -+ if (primary_offset == -30)
  6205. -+ ch_inf.sb = BRCMU_CHAN_SB_LL;
  6206. -+ else if (primary_offset == -10)
  6207. -+ ch_inf.sb = BRCMU_CHAN_SB_LU;
  6208. -+ else if (primary_offset == 10)
  6209. -+ ch_inf.sb = BRCMU_CHAN_SB_UL;
  6210. -+ else
  6211. -+ ch_inf.sb = BRCMU_CHAN_SB_UU;
  6212. - break;
  6213. - case NL80211_CHAN_WIDTH_80P80:
  6214. - case NL80211_CHAN_WIDTH_160:
  6215. 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
  6216. deleted file mode 100644
  6217. index d7018da..0000000
  6218. --- a/package/kernel/mac80211/patches/323-0001-brcmfmac-analyze-descriptors-of-current-component-on.patch
  6219. +++ /dev/null
  6220. @@ -1,51 +0,0 @@
  6221. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  6222. -Date: Tue, 26 Jan 2016 17:57:01 +0100
  6223. -Subject: [PATCH] brcmfmac: analyze descriptors of current component only
  6224. -MIME-Version: 1.0
  6225. -Content-Type: text/plain; charset=UTF-8
  6226. -Content-Transfer-Encoding: 8bit
  6227. -
  6228. -So far we were looking for address descriptors without a check for
  6229. -crossing current component border. In case of dealing with unsupported
  6230. -descriptor or descriptor missing at all the code would incorrectly get
  6231. -data from another component.
  6232. -
  6233. -Consider this binary-described component from BCM4366 EROM:
  6234. -4bf83b01 TAG==CI CID==0x83b
  6235. -20080201 TAG==CI PORTS==0+1 WRAPPERS==0+1
  6236. -18400035 TAG==ADDR SZ_SZD TYPE_SLAVE
  6237. -00050000
  6238. -18107085 TAG==ADDR SZ_4K TYPE_SWRAP
  6239. -
  6240. -Driver was assigning invalid base address to this core:
  6241. -brcmfmac: [6 ] core 0x83b:32 base 0x18109000 wrap 0x18107000
  6242. -which came from totally different component defined in EROM:
  6243. -43b36701 TAG==CI CID==0x367
  6244. -00000201 TAG==CI PORTS==0+1 WRAPPERS==0+0
  6245. -18109005 TAG==ADDR SZ_4K TYPE_SLAVE
  6246. -
  6247. -This change will also allow us to support components without wrapper
  6248. -address in the future.
  6249. -
  6250. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  6251. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6252. ----
  6253. -
  6254. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  6255. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  6256. -@@ -803,7 +803,14 @@ static int brcmf_chip_dmp_get_regaddr(st
  6257. - *eromaddr -= 4;
  6258. - return -EFAULT;
  6259. - }
  6260. -- } while (desc != DMP_DESC_ADDRESS);
  6261. -+ } while (desc != DMP_DESC_ADDRESS &&
  6262. -+ desc != DMP_DESC_COMPONENT);
  6263. -+
  6264. -+ /* stop if we crossed current component border */
  6265. -+ if (desc == DMP_DESC_COMPONENT) {
  6266. -+ *eromaddr -= 4;
  6267. -+ return 0;
  6268. -+ }
  6269. -
  6270. - /* skip upper 32-bit address descriptor */
  6271. - if (val & DMP_DESC_ADDRSIZE_GT32)
  6272. 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
  6273. deleted file mode 100644
  6274. index 045ab49..0000000
  6275. --- a/package/kernel/mac80211/patches/323-0002-brcmfmac-allow-storing-PMU-core-without-wrapper-addr.patch
  6276. +++ /dev/null
  6277. @@ -1,28 +0,0 @@
  6278. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  6279. -Date: Tue, 26 Jan 2016 17:57:02 +0100
  6280. -Subject: [PATCH] brcmfmac: allow storing PMU core without wrapper address
  6281. -MIME-Version: 1.0
  6282. -Content-Type: text/plain; charset=UTF-8
  6283. -Content-Transfer-Encoding: 8bit
  6284. -
  6285. -Separated PMU core can be found in new devices and should be used for
  6286. -accessing PMU registers (which were routed through ChipCommon so far).
  6287. -This core is one of exceptions that doesn't have or need wrapper address
  6288. -to be still safely accessible.
  6289. -
  6290. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  6291. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6292. ----
  6293. -
  6294. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  6295. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  6296. -@@ -883,7 +883,8 @@ int brcmf_chip_dmp_erom_scan(struct brcm
  6297. - rev = (val & DMP_COMP_REVISION) >> DMP_COMP_REVISION_S;
  6298. -
  6299. - /* need core with ports */
  6300. -- if (nmw + nsw == 0)
  6301. -+ if (nmw + nsw == 0 &&
  6302. -+ id != BCMA_CORE_PMU)
  6303. - continue;
  6304. -
  6305. - /* try to obtain register address info */
  6306. 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
  6307. deleted file mode 100644
  6308. index 7b7ba4f..0000000
  6309. --- a/package/kernel/mac80211/patches/323-0003-brcmfmac-read-extended-capabilities-of-ChipCommon-co.patch
  6310. +++ /dev/null
  6311. @@ -1,43 +0,0 @@
  6312. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  6313. -Date: Tue, 26 Jan 2016 17:57:03 +0100
  6314. -Subject: [PATCH] brcmfmac: read extended capabilities of ChipCommon core
  6315. -MIME-Version: 1.0
  6316. -Content-Type: text/plain; charset=UTF-8
  6317. -Content-Transfer-Encoding: 8bit
  6318. -
  6319. -This is an extra bitfield with info about some present hardware.
  6320. -
  6321. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  6322. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6323. ----
  6324. -
  6325. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  6326. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  6327. -@@ -1025,6 +1025,9 @@ static int brcmf_chip_setup(struct brcmf
  6328. - /* get chipcommon capabilites */
  6329. - pub->cc_caps = chip->ops->read32(chip->ctx,
  6330. - CORE_CC_REG(base, capabilities));
  6331. -+ pub->cc_caps_ext = chip->ops->read32(chip->ctx,
  6332. -+ CORE_CC_REG(base,
  6333. -+ capabilities_ext));
  6334. -
  6335. - /* get pmu caps & rev */
  6336. - if (pub->cc_caps & CC_CAP_PMU) {
  6337. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
  6338. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
  6339. -@@ -27,6 +27,7 @@
  6340. - * @chip: chip identifier.
  6341. - * @chiprev: chip revision.
  6342. - * @cc_caps: chipcommon core capabilities.
  6343. -+ * @cc_caps_ext: chipcommon core extended capabilities.
  6344. - * @pmucaps: PMU capabilities.
  6345. - * @pmurev: PMU revision.
  6346. - * @rambase: RAM base address (only applicable for ARM CR4 chips).
  6347. -@@ -38,6 +39,7 @@ struct brcmf_chip {
  6348. - u32 chip;
  6349. - u32 chiprev;
  6350. - u32 cc_caps;
  6351. -+ u32 cc_caps_ext;
  6352. - u32 pmucaps;
  6353. - u32 pmurev;
  6354. - u32 rambase;
  6355. 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
  6356. deleted file mode 100644
  6357. index 2af6fd9..0000000
  6358. --- a/package/kernel/mac80211/patches/323-0004-brcmfmac-access-PMU-registers-using-standalone-PMU-c.patch
  6359. +++ /dev/null
  6360. @@ -1,148 +0,0 @@
  6361. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  6362. -Date: Tue, 26 Jan 2016 17:57:04 +0100
  6363. -Subject: [PATCH] brcmfmac: access PMU registers using standalone PMU core if
  6364. - available
  6365. -MIME-Version: 1.0
  6366. -Content-Type: text/plain; charset=UTF-8
  6367. -Content-Transfer-Encoding: 8bit
  6368. -
  6369. -On recent Broadcom chipsets PMU is present as separated core and it
  6370. -can't be accessed using ChipCommon anymore as it fails with e.g.:
  6371. -[ 18.198412] Unhandled fault: imprecise external abort (0x1406) at 0xb6da200f
  6372. -
  6373. -Add a new helper function that will return a proper core that should be
  6374. -used for accessing PMU registers.
  6375. -
  6376. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  6377. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6378. ----
  6379. -
  6380. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  6381. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  6382. -@@ -1014,6 +1014,7 @@ static int brcmf_chip_setup(struct brcmf
  6383. - {
  6384. - struct brcmf_chip *pub;
  6385. - struct brcmf_core_priv *cc;
  6386. -+ struct brcmf_core *pmu;
  6387. - u32 base;
  6388. - u32 val;
  6389. - int ret = 0;
  6390. -@@ -1030,9 +1031,10 @@ static int brcmf_chip_setup(struct brcmf
  6391. - capabilities_ext));
  6392. -
  6393. - /* get pmu caps & rev */
  6394. -+ pmu = brcmf_chip_get_pmu(pub); /* after reading cc_caps_ext */
  6395. - if (pub->cc_caps & CC_CAP_PMU) {
  6396. - val = chip->ops->read32(chip->ctx,
  6397. -- CORE_CC_REG(base, pmucapabilities));
  6398. -+ CORE_CC_REG(pmu->base, pmucapabilities));
  6399. - pub->pmurev = val & PCAP_REV_MASK;
  6400. - pub->pmucaps = val;
  6401. - }
  6402. -@@ -1131,6 +1133,23 @@ struct brcmf_core *brcmf_chip_get_chipco
  6403. - return &cc->pub;
  6404. - }
  6405. -
  6406. -+struct brcmf_core *brcmf_chip_get_pmu(struct brcmf_chip *pub)
  6407. -+{
  6408. -+ struct brcmf_core *cc = brcmf_chip_get_chipcommon(pub);
  6409. -+ struct brcmf_core *pmu;
  6410. -+
  6411. -+ /* See if there is separated PMU core available */
  6412. -+ if (cc->rev >= 35 &&
  6413. -+ pub->cc_caps_ext & BCMA_CC_CAP_EXT_AOB_PRESENT) {
  6414. -+ pmu = brcmf_chip_get_core(pub, BCMA_CORE_PMU);
  6415. -+ if (pmu)
  6416. -+ return pmu;
  6417. -+ }
  6418. -+
  6419. -+ /* Fallback to ChipCommon core for older hardware */
  6420. -+ return cc;
  6421. -+}
  6422. -+
  6423. - bool brcmf_chip_iscoreup(struct brcmf_core *pub)
  6424. - {
  6425. - struct brcmf_core_priv *core;
  6426. -@@ -1301,6 +1320,7 @@ bool brcmf_chip_sr_capable(struct brcmf_
  6427. - {
  6428. - u32 base, addr, reg, pmu_cc3_mask = ~0;
  6429. - struct brcmf_chip_priv *chip;
  6430. -+ struct brcmf_core *pmu = brcmf_chip_get_pmu(pub);
  6431. -
  6432. - brcmf_dbg(TRACE, "Enter\n");
  6433. -
  6434. -@@ -1320,9 +1340,9 @@ bool brcmf_chip_sr_capable(struct brcmf_
  6435. - case BRCM_CC_4335_CHIP_ID:
  6436. - case BRCM_CC_4339_CHIP_ID:
  6437. - /* read PMU chipcontrol register 3 */
  6438. -- addr = CORE_CC_REG(base, chipcontrol_addr);
  6439. -+ addr = CORE_CC_REG(pmu->base, chipcontrol_addr);
  6440. - chip->ops->write32(chip->ctx, addr, 3);
  6441. -- addr = CORE_CC_REG(base, chipcontrol_data);
  6442. -+ addr = CORE_CC_REG(pmu->base, chipcontrol_data);
  6443. - reg = chip->ops->read32(chip->ctx, addr);
  6444. - return (reg & pmu_cc3_mask) != 0;
  6445. - case BRCM_CC_43430_CHIP_ID:
  6446. -@@ -1330,12 +1350,12 @@ bool brcmf_chip_sr_capable(struct brcmf_
  6447. - reg = chip->ops->read32(chip->ctx, addr);
  6448. - return reg != 0;
  6449. - default:
  6450. -- addr = CORE_CC_REG(base, pmucapabilities_ext);
  6451. -+ addr = CORE_CC_REG(pmu->base, pmucapabilities_ext);
  6452. - reg = chip->ops->read32(chip->ctx, addr);
  6453. - if ((reg & PCAPEXT_SR_SUPPORTED_MASK) == 0)
  6454. - return false;
  6455. -
  6456. -- addr = CORE_CC_REG(base, retention_ctl);
  6457. -+ addr = CORE_CC_REG(pmu->base, retention_ctl);
  6458. - reg = chip->ops->read32(chip->ctx, addr);
  6459. - return (reg & (PMU_RCTL_MACPHY_DISABLE_MASK |
  6460. - PMU_RCTL_LOGIC_DISABLE_MASK)) == 0;
  6461. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
  6462. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
  6463. -@@ -85,6 +85,7 @@ struct brcmf_chip *brcmf_chip_attach(voi
  6464. - void brcmf_chip_detach(struct brcmf_chip *chip);
  6465. - struct brcmf_core *brcmf_chip_get_core(struct brcmf_chip *chip, u16 coreid);
  6466. - struct brcmf_core *brcmf_chip_get_chipcommon(struct brcmf_chip *chip);
  6467. -+struct brcmf_core *brcmf_chip_get_pmu(struct brcmf_chip *pub);
  6468. - bool brcmf_chip_iscoreup(struct brcmf_core *core);
  6469. - void brcmf_chip_coredisable(struct brcmf_core *core, u32 prereset, u32 reset);
  6470. - void brcmf_chip_resetcore(struct brcmf_core *core, u32 prereset, u32 reset,
  6471. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  6472. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  6473. -@@ -3615,7 +3615,6 @@ brcmf_sdio_drivestrengthinit(struct brcm
  6474. - const struct sdiod_drive_str *str_tab = NULL;
  6475. - u32 str_mask;
  6476. - u32 str_shift;
  6477. -- u32 base;
  6478. - u32 i;
  6479. - u32 drivestrength_sel = 0;
  6480. - u32 cc_data_temp;
  6481. -@@ -3658,14 +3657,15 @@ brcmf_sdio_drivestrengthinit(struct brcm
  6482. - }
  6483. -
  6484. - if (str_tab != NULL) {
  6485. -+ struct brcmf_core *pmu = brcmf_chip_get_pmu(ci);
  6486. -+
  6487. - for (i = 0; str_tab[i].strength != 0; i++) {
  6488. - if (drivestrength >= str_tab[i].strength) {
  6489. - drivestrength_sel = str_tab[i].sel;
  6490. - break;
  6491. - }
  6492. - }
  6493. -- base = brcmf_chip_get_chipcommon(ci)->base;
  6494. -- addr = CORE_CC_REG(base, chipcontrol_addr);
  6495. -+ addr = CORE_CC_REG(pmu->base, chipcontrol_addr);
  6496. - brcmf_sdiod_regwl(sdiodev, addr, 1, NULL);
  6497. - cc_data_temp = brcmf_sdiod_regrl(sdiodev, addr, NULL);
  6498. - cc_data_temp &= ~str_mask;
  6499. -@@ -3835,8 +3835,7 @@ brcmf_sdio_probe_attach(struct brcmf_sdi
  6500. - goto fail;
  6501. -
  6502. - /* set PMUControl so a backplane reset does PMU state reload */
  6503. -- reg_addr = CORE_CC_REG(brcmf_chip_get_chipcommon(bus->ci)->base,
  6504. -- pmucontrol);
  6505. -+ reg_addr = CORE_CC_REG(brcmf_chip_get_pmu(bus->ci)->base, pmucontrol);
  6506. - reg_val = brcmf_sdiod_regrl(bus->sdiodev, reg_addr, &err);
  6507. - if (err)
  6508. - goto fail;
  6509. 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
  6510. deleted file mode 100644
  6511. index 35887fc..0000000
  6512. --- a/package/kernel/mac80211/patches/323-0005-brcmfmac-add-support-for-14e4-4365-PCI-ID-with-BCM43.patch
  6513. +++ /dev/null
  6514. @@ -1,38 +0,0 @@
  6515. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  6516. -Date: Tue, 26 Jan 2016 17:57:05 +0100
  6517. -Subject: [PATCH] brcmfmac: add support for 14e4:4365 PCI ID with BCM4366
  6518. - chipset
  6519. -MIME-Version: 1.0
  6520. -Content-Type: text/plain; charset=UTF-8
  6521. -Content-Transfer-Encoding: 8bit
  6522. -
  6523. -On Broadcom ARM routers BCM4366 cards are available with 14e4:4365 ID.
  6524. -Unfortunately this ID was already used by Broadcom for cards with
  6525. -BCM43142, a totally different chipset requiring SoftMAC driver. To avoid
  6526. -a conflict between brcmfmac and bcma use more specific ID entry with
  6527. -subvendor and subdevice specified.
  6528. -
  6529. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  6530. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6531. ----
  6532. -
  6533. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  6534. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  6535. -@@ -1951,6 +1951,9 @@ static const struct dev_pm_ops brcmf_pci
  6536. -
  6537. - #define BRCMF_PCIE_DEVICE(dev_id) { BRCM_PCIE_VENDOR_ID_BROADCOM, dev_id,\
  6538. - PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_NETWORK_OTHER << 8, 0xffff00, 0 }
  6539. -+#define BRCMF_PCIE_DEVICE_SUB(dev_id, subvend, subdev) { \
  6540. -+ BRCM_PCIE_VENDOR_ID_BROADCOM, dev_id,\
  6541. -+ subvend, subdev, PCI_CLASS_NETWORK_OTHER << 8, 0xffff00, 0 }
  6542. -
  6543. - static struct pci_device_id brcmf_pcie_devid_table[] = {
  6544. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4350_DEVICE_ID),
  6545. -@@ -1966,6 +1969,7 @@ static struct pci_device_id brcmf_pcie_d
  6546. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_DEVICE_ID),
  6547. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_2G_DEVICE_ID),
  6548. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_5G_DEVICE_ID),
  6549. -+ BRCMF_PCIE_DEVICE_SUB(0x4365, BRCM_PCIE_VENDOR_ID_BROADCOM, 0x4365),
  6550. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_DEVICE_ID),
  6551. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_2G_DEVICE_ID),
  6552. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_5G_DEVICE_ID),
  6553. 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
  6554. new file mode 100644
  6555. index 0000000..59ac29b
  6556. --- /dev/null
  6557. +++ b/package/kernel/mac80211/patches/323-ath9k-Fix-programming-of-minCCA-power-threshold.patch
  6558. @@ -0,0 +1,26 @@
  6559. +From: Sven Eckelmann <sven@narfation.org>
  6560. +Date: Fri, 17 Jun 2016 11:58:20 +0200
  6561. +Subject: [PATCH] ath9k: Fix programming of minCCA power threshold
  6562. +
  6563. +The function ar9003_hw_apply_minccapwr_thresh takes as second parameter not
  6564. +a pointer to the channel but a boolean value describing whether the channel
  6565. +is 2.4GHz or not. This broke (according to the origin commit) the ETSI
  6566. +regulatory compliance on 5GHz channels.
  6567. +
  6568. +Fixes: 3533bf6b15a0 ("ath9k: Fix regulatory compliance")
  6569. +Signed-off-by: Sven Eckelmann <sven@narfation.org>
  6570. +Cc: Simon Wunderlich <sw@simonwunderlich.de>
  6571. +Cc: Sujith Manoharan <c_manoha@qca.qualcomm.com>
  6572. +---
  6573. +
  6574. +--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
  6575. ++++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
  6576. +@@ -4175,7 +4175,7 @@ static void ath9k_hw_ar9300_set_board_va
  6577. + if (!AR_SREV_9330(ah) && !AR_SREV_9340(ah) && !AR_SREV_9531(ah))
  6578. + ar9003_hw_internal_regulator_apply(ah);
  6579. + ar9003_hw_apply_tuning_caps(ah);
  6580. +- ar9003_hw_apply_minccapwr_thresh(ah, chan);
  6581. ++ ar9003_hw_apply_minccapwr_thresh(ah, is2ghz);
  6582. + ar9003_hw_txend_to_xpa_off_apply(ah, is2ghz);
  6583. + ar9003_hw_thermometer_apply(ah);
  6584. + ar9003_hw_thermo_cal_apply(ah);
  6585. 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
  6586. new file mode 100644
  6587. index 0000000..b6f4868
  6588. --- /dev/null
  6589. +++ b/package/kernel/mac80211/patches/324-ath9k_hw-fix-spectral-scan-on-AR9285-and-newer.patch
  6590. @@ -0,0 +1,86 @@
  6591. +From: Felix Fietkau <nbd@nbd.name>
  6592. +Date: Mon, 11 Jul 2016 10:34:37 +0200
  6593. +Subject: [PATCH] ath9k_hw: fix spectral scan on AR9285 and newer
  6594. +
  6595. +The register layout of AR_PHY_SPECTRAL_SCAN has changed, only AR9280
  6596. +uses the old layout
  6597. +
  6598. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  6599. +---
  6600. +
  6601. +--- a/drivers/net/wireless/ath/ath9k/ar9002_phy.c
  6602. ++++ b/drivers/net/wireless/ath/ath9k/ar9002_phy.c
  6603. +@@ -476,6 +476,7 @@ static void ar9002_hw_set_bt_ant_diversi
  6604. + static void ar9002_hw_spectral_scan_config(struct ath_hw *ah,
  6605. + struct ath_spec_scan *param)
  6606. + {
  6607. ++ u32 repeat_bit;
  6608. + u8 count;
  6609. +
  6610. + if (!param->enabled) {
  6611. +@@ -486,12 +487,15 @@ static void ar9002_hw_spectral_scan_conf
  6612. + REG_SET_BIT(ah, AR_PHY_RADAR_0, AR_PHY_RADAR_0_FFT_ENA);
  6613. + REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN, AR_PHY_SPECTRAL_SCAN_ENABLE);
  6614. +
  6615. ++ if (AR_SREV_9280(ah))
  6616. ++ repeat_bit = AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT;
  6617. ++ else
  6618. ++ repeat_bit = AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_KIWI;
  6619. ++
  6620. + if (param->short_repeat)
  6621. +- REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN,
  6622. +- AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT);
  6623. ++ REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN, repeat_bit);
  6624. + else
  6625. +- REG_CLR_BIT(ah, AR_PHY_SPECTRAL_SCAN,
  6626. +- AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT);
  6627. ++ REG_CLR_BIT(ah, AR_PHY_SPECTRAL_SCAN, repeat_bit);
  6628. +
  6629. + /* on AR92xx, the highest bit of count will make the the chip send
  6630. + * spectral samples endlessly. Check if this really was intended,
  6631. +@@ -499,15 +503,25 @@ static void ar9002_hw_spectral_scan_conf
  6632. + */
  6633. + count = param->count;
  6634. + if (param->endless) {
  6635. +- if (AR_SREV_9271(ah))
  6636. +- count = 0;
  6637. +- else
  6638. ++ if (AR_SREV_9280(ah))
  6639. + count = 0x80;
  6640. ++ else
  6641. ++ count = 0;
  6642. + } else if (count & 0x80)
  6643. + count = 0x7f;
  6644. ++ else if (!count)
  6645. ++ count = 1;
  6646. ++
  6647. ++ if (AR_SREV_9280(ah)) {
  6648. ++ REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN,
  6649. ++ AR_PHY_SPECTRAL_SCAN_COUNT, count);
  6650. ++ } else {
  6651. ++ REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN,
  6652. ++ AR_PHY_SPECTRAL_SCAN_COUNT_KIWI, count);
  6653. ++ REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN,
  6654. ++ AR_PHY_SPECTRAL_SCAN_PHYERR_MASK_SELECT);
  6655. ++ }
  6656. +
  6657. +- REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN,
  6658. +- AR_PHY_SPECTRAL_SCAN_COUNT, count);
  6659. + REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN,
  6660. + AR_PHY_SPECTRAL_SCAN_PERIOD, param->period);
  6661. + REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN,
  6662. +--- a/drivers/net/wireless/ath/ath9k/ar9002_phy.h
  6663. ++++ b/drivers/net/wireless/ath/ath9k/ar9002_phy.h
  6664. +@@ -177,8 +177,11 @@
  6665. + #define AR_PHY_SPECTRAL_SCAN_PERIOD_S 8
  6666. + #define AR_PHY_SPECTRAL_SCAN_COUNT 0x00FF0000 /* Number of reports, reg 68, bits 16-23*/
  6667. + #define AR_PHY_SPECTRAL_SCAN_COUNT_S 16
  6668. ++#define AR_PHY_SPECTRAL_SCAN_COUNT_KIWI 0x0FFF0000 /* Number of reports, reg 68, bits 16-27*/
  6669. ++#define AR_PHY_SPECTRAL_SCAN_COUNT_KIWI_S 16
  6670. + #define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT 0x01000000 /* Short repeat, reg 68, bit 24*/
  6671. +-#define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_S 24 /* Short repeat, reg 68, bit 24*/
  6672. ++#define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_KIWI 0x10000000 /* Short repeat, reg 68, bit 28*/
  6673. ++#define AR_PHY_SPECTRAL_SCAN_PHYERR_MASK_SELECT 0x40000000
  6674. +
  6675. + #define AR_PHY_RX_DELAY 0x9914
  6676. + #define AR_PHY_SEARCH_START_DELAY 0x9918
  6677. 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
  6678. deleted file mode 100644
  6679. index 6ce60f1..0000000
  6680. --- a/package/kernel/mac80211/patches/324-brcmfmac-treat-NULL-character-in-NVRAM-as-separator.patch
  6681. +++ /dev/null
  6682. @@ -1,32 +0,0 @@
  6683. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  6684. -Date: Sun, 31 Jan 2016 12:14:34 +0100
  6685. -Subject: [PATCH] brcmfmac: treat NULL character in NVRAM as separator
  6686. -MIME-Version: 1.0
  6687. -Content-Type: text/plain; charset=UTF-8
  6688. -Content-Transfer-Encoding: 8bit
  6689. -
  6690. -Platform NVRAM (stored on a flash partition) has entries separated by a
  6691. -NULL (\0) char. Our parsing code switches from VALUE state to IDLE
  6692. -whenever it meets a NULL (\0). When that happens our IDLE handler should
  6693. -simply consume it and analyze whatever is placed ahead.
  6694. -
  6695. -This fixes harmless warnings spamming debugging output:
  6696. -[ 155.165624] brcmfmac: brcmf_nvram_handle_idle warning: ln=1:col=20: ignoring invalid character
  6697. -[ 155.180806] brcmfmac: brcmf_nvram_handle_idle warning: ln=1:col=44: ignoring invalid character
  6698. -[ 155.195971] brcmfmac: brcmf_nvram_handle_idle warning: ln=1:col=63: ignoring invalid character
  6699. -
  6700. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  6701. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6702. ----
  6703. -
  6704. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  6705. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  6706. -@@ -93,7 +93,7 @@ static enum nvram_parser_state brcmf_nvr
  6707. - c = nvp->data[nvp->pos];
  6708. - if (c == '\n')
  6709. - return COMMENT;
  6710. -- if (is_whitespace(c))
  6711. -+ if (is_whitespace(c) || c == '\0')
  6712. - goto proceed;
  6713. - if (c == '#')
  6714. - return COMMENT;
  6715. 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
  6716. new file mode 100644
  6717. index 0000000..6685f33
  6718. --- /dev/null
  6719. +++ b/package/kernel/mac80211/patches/325-ath9k_hw-fix-duplicate-and-partially-wrong-definitio.patch
  6720. @@ -0,0 +1,57 @@
  6721. +From: Felix Fietkau <nbd@nbd.name>
  6722. +Date: Mon, 11 Jul 2016 11:31:39 +0200
  6723. +Subject: [PATCH] ath9k_hw: fix duplicate (and partially wrong) definition
  6724. + of AR_CH0_THERM
  6725. +
  6726. +AR_PHY_65NM_CH0_THERM and AR_CH0_THERM were supposed to refer to the
  6727. +same register, however they had different SREV checks.
  6728. +
  6729. +Remove the duplicate and use the checks. Since there were other SREV
  6730. +checks present in the only place that uses this, this will probaby not
  6731. +affect runtime behavior.
  6732. +
  6733. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  6734. +---
  6735. +
  6736. +--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.h
  6737. ++++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.h
  6738. +@@ -689,13 +689,6 @@
  6739. + #define AR_CH0_TOP_XPABIASLVL (AR_SREV_9550(ah) ? 0x3c0 : 0x300)
  6740. + #define AR_CH0_TOP_XPABIASLVL_S (AR_SREV_9550(ah) ? 6 : 8)
  6741. +
  6742. +-#define AR_CH0_THERM (AR_SREV_9300(ah) ? 0x16290 : \
  6743. +- ((AR_SREV_9485(ah) ? 0x1628c : 0x16294)))
  6744. +-#define AR_CH0_THERM_XPABIASLVL_MSB 0x3
  6745. +-#define AR_CH0_THERM_XPABIASLVL_MSB_S 0
  6746. +-#define AR_CH0_THERM_XPASHORT2GND 0x4
  6747. +-#define AR_CH0_THERM_XPASHORT2GND_S 2
  6748. +-
  6749. + #define AR_SWITCH_TABLE_COM_ALL (0xffff)
  6750. + #define AR_SWITCH_TABLE_COM_ALL_S (0)
  6751. + #define AR_SWITCH_TABLE_COM_AR9462_ALL (0xffffff)
  6752. +@@ -712,15 +705,17 @@
  6753. + #define AR_SWITCH_TABLE_ALL (0xfff)
  6754. + #define AR_SWITCH_TABLE_ALL_S (0)
  6755. +
  6756. +-#define AR_PHY_65NM_CH0_THERM (AR_SREV_9300(ah) ? 0x16290 :\
  6757. +- ((AR_SREV_9462(ah) || AR_SREV_9565(ah)) ? 0x16294 : 0x1628c))
  6758. ++#define AR_CH0_THERM (AR_SREV_9300(ah) ? 0x16290 :\
  6759. ++ ((AR_SREV_9462(ah) || AR_SREV_9565(ah)) ? 0x16294 : 0x1628c))
  6760. ++#define AR_CH0_THERM_XPABIASLVL_MSB 0x3
  6761. ++#define AR_CH0_THERM_XPABIASLVL_MSB_S 0
  6762. ++#define AR_CH0_THERM_XPASHORT2GND 0x4
  6763. ++#define AR_CH0_THERM_XPASHORT2GND_S 2
  6764. +
  6765. +-#define AR_PHY_65NM_CH0_THERM_LOCAL 0x80000000
  6766. +-#define AR_PHY_65NM_CH0_THERM_LOCAL_S 31
  6767. +-#define AR_PHY_65NM_CH0_THERM_START 0x20000000
  6768. +-#define AR_PHY_65NM_CH0_THERM_START_S 29
  6769. +-#define AR_PHY_65NM_CH0_THERM_SAR_ADC_OUT 0x0000ff00
  6770. +-#define AR_PHY_65NM_CH0_THERM_SAR_ADC_OUT_S 8
  6771. ++#define AR_CH0_THERM_LOCAL 0x80000000
  6772. ++#define AR_CH0_THERM_START 0x20000000
  6773. ++#define AR_CH0_THERM_SAR_ADC_OUT 0x0000ff00
  6774. ++#define AR_CH0_THERM_SAR_ADC_OUT_S 8
  6775. +
  6776. + #define AR_CH0_TOP2 (AR_SREV_9300(ah) ? 0x1628c : \
  6777. + (AR_SREV_9462(ah) ? 0x16290 : 0x16284))
  6778. 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
  6779. deleted file mode 100644
  6780. index 012dea1..0000000
  6781. --- a/package/kernel/mac80211/patches/325-brcmfmac-sdio-Increase-the-default-timeouts-a-bit.patch
  6782. +++ /dev/null
  6783. @@ -1,41 +0,0 @@
  6784. -From: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
  6785. -Date: Mon, 25 Jan 2016 11:47:29 +0100
  6786. -Subject: [PATCH] brcmfmac: sdio: Increase the default timeouts a bit
  6787. -
  6788. -On a Radxa Rock2 board with a Ampak AP6335 (Broadcom 4339 core) it seems
  6789. -the card responds very quickly most of the time, unfortunately during
  6790. -initialisation it sometimes seems to take just a bit over 2 seconds to
  6791. -respond.
  6792. -
  6793. -This results intialization failing with message like:
  6794. - brcmf_c_preinit_dcmds: Retreiving cur_etheraddr failed, -52
  6795. - brcmf_bus_start: failed: -52
  6796. - brcmf_sdio_firmware_callback: dongle is not responding
  6797. -
  6798. -Increasing the timeout to allow for a bit more headroom allows the
  6799. -card to initialize reliably.
  6800. -
  6801. -A quick search online after diagnosing/fixing this showed that Google
  6802. -has a similar patch in their ChromeOS tree, so this doesn't seem
  6803. -specific to the board I'm using.
  6804. -
  6805. -Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
  6806. -Reviewed-by: Julian Calaby <julian.calaby@gmail.com>
  6807. -Acked-by: Arend van Spriel <arend@broadcom.com>
  6808. -Reviewed-by: Douglas Anderson <dianders@chromium.org>
  6809. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6810. ----
  6811. -
  6812. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  6813. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  6814. -@@ -45,8 +45,8 @@
  6815. - #include "chip.h"
  6816. - #include "firmware.h"
  6817. -
  6818. --#define DCMD_RESP_TIMEOUT msecs_to_jiffies(2000)
  6819. --#define CTL_DONE_TIMEOUT msecs_to_jiffies(2000)
  6820. -+#define DCMD_RESP_TIMEOUT msecs_to_jiffies(2500)
  6821. -+#define CTL_DONE_TIMEOUT msecs_to_jiffies(2500)
  6822. -
  6823. - #ifdef DEBUG
  6824. -
  6825. 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
  6826. deleted file mode 100644
  6827. index 71f7a40..0000000
  6828. --- a/package/kernel/mac80211/patches/326-ath9k-make-NF-load-complete-quickly-and-reliably.patch
  6829. +++ /dev/null
  6830. @@ -1,87 +0,0 @@
  6831. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  6832. -Date: Fri, 5 Feb 2016 09:45:50 +0800
  6833. -Subject: [PATCH] ath9k: make NF load complete quickly and reliably
  6834. -
  6835. -Make NF load complete quickly and reliably. NF load execution
  6836. -is delayed by HW to end of frame if frame Rx or Tx is ongoing.
  6837. -Increasing timeout to max frame duration. If NF cal is ongoing
  6838. -before NF load, stop it before load, and restart it afterwards.
  6839. -
  6840. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  6841. ----
  6842. -
  6843. ---- a/drivers/net/wireless/ath/ath9k/calib.c
  6844. -+++ b/drivers/net/wireless/ath/ath9k/calib.c
  6845. -@@ -241,6 +241,7 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  6846. - u8 chainmask = (ah->rxchainmask << 3) | ah->rxchainmask;
  6847. - struct ath_common *common = ath9k_hw_common(ah);
  6848. - s16 default_nf = ath9k_hw_get_default_nf(ah, chan);
  6849. -+ u32 bb_agc_ctl = REG_READ(ah, AR_PHY_AGC_CONTROL);
  6850. -
  6851. - if (ah->caldata)
  6852. - h = ah->caldata->nfCalHist;
  6853. -@@ -264,6 +265,16 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  6854. - }
  6855. -
  6856. - /*
  6857. -+ * stop NF cal if ongoing to ensure NF load completes immediately
  6858. -+ * (or after end rx/tx frame if ongoing)
  6859. -+ */
  6860. -+ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_NF) {
  6861. -+ REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF);
  6862. -+ REG_RMW_BUFFER_FLUSH(ah);
  6863. -+ ENABLE_REG_RMW_BUFFER(ah);
  6864. -+ }
  6865. -+
  6866. -+ /*
  6867. - * Load software filtered NF value into baseband internal minCCApwr
  6868. - * variable.
  6869. - */
  6870. -@@ -276,18 +287,33 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  6871. -
  6872. - /*
  6873. - * Wait for load to complete, should be fast, a few 10s of us.
  6874. -- * The max delay was changed from an original 250us to 10000us
  6875. -- * since 250us often results in NF load timeout and causes deaf
  6876. -- * condition during stress testing 12/12/2009
  6877. -+ * The max delay was changed from an original 250us to 22.2 msec.
  6878. -+ * This would increase timeout to the longest possible frame
  6879. -+ * (11n max length 22.1 msec)
  6880. - */
  6881. -- for (j = 0; j < 10000; j++) {
  6882. -+ for (j = 0; j < 22200; j++) {
  6883. - if ((REG_READ(ah, AR_PHY_AGC_CONTROL) &
  6884. -- AR_PHY_AGC_CONTROL_NF) == 0)
  6885. -+ AR_PHY_AGC_CONTROL_NF) == 0)
  6886. - break;
  6887. - udelay(10);
  6888. - }
  6889. -
  6890. - /*
  6891. -+ * Restart NF so it can continue.
  6892. -+ */
  6893. -+ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_NF) {
  6894. -+ ENABLE_REG_RMW_BUFFER(ah);
  6895. -+ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_ENABLE_NF)
  6896. -+ REG_SET_BIT(ah, AR_PHY_AGC_CONTROL,
  6897. -+ AR_PHY_AGC_CONTROL_ENABLE_NF);
  6898. -+ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_NO_UPDATE_NF)
  6899. -+ REG_SET_BIT(ah, AR_PHY_AGC_CONTROL,
  6900. -+ AR_PHY_AGC_CONTROL_NO_UPDATE_NF);
  6901. -+ REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF);
  6902. -+ REG_RMW_BUFFER_FLUSH(ah);
  6903. -+ }
  6904. -+
  6905. -+ /*
  6906. - * We timed out waiting for the noisefloor to load, probably due to an
  6907. - * in-progress rx. Simply return here and allow the load plenty of time
  6908. - * to complete before the next calibration interval. We need to avoid
  6909. -@@ -296,7 +322,7 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  6910. - * here, the baseband nf cal will just be capped by our present
  6911. - * noisefloor until the next calibration timer.
  6912. - */
  6913. -- if (j == 10000) {
  6914. -+ if (j == 22200) {
  6915. - ath_dbg(common, ANY,
  6916. - "Timeout while waiting for nf to load: AR_PHY_AGC_CONTROL=0x%x\n",
  6917. - REG_READ(ah, AR_PHY_AGC_CONTROL));
  6918. 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
  6919. new file mode 100644
  6920. index 0000000..999d993
  6921. --- /dev/null
  6922. +++ b/package/kernel/mac80211/patches/326-ath9k_hw-simplify-ar9003_hw_per_calibration.patch
  6923. @@ -0,0 +1,88 @@
  6924. +From: Felix Fietkau <nbd@nbd.name>
  6925. +Date: Mon, 11 Jul 2016 11:34:47 +0200
  6926. +Subject: [PATCH] ath9k_hw: simplify ar9003_hw_per_calibration
  6927. +
  6928. +Reduce indentation, use a variable to save a few pointer dereferences
  6929. +
  6930. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  6931. +---
  6932. +
  6933. +--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  6934. ++++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  6935. +@@ -75,50 +75,49 @@ static bool ar9003_hw_per_calibration(st
  6936. + struct ath9k_cal_list *currCal)
  6937. + {
  6938. + struct ath9k_hw_cal_data *caldata = ah->caldata;
  6939. +- /* Cal is assumed not done until explicitly set below */
  6940. +- bool iscaldone = false;
  6941. ++ const struct ath9k_percal_data *cur_caldata = currCal->calData;
  6942. +
  6943. + /* Calibration in progress. */
  6944. + if (currCal->calState == CAL_RUNNING) {
  6945. + /* Check to see if it has finished. */
  6946. +- if (!(REG_READ(ah, AR_PHY_TIMING4) & AR_PHY_TIMING4_DO_CAL)) {
  6947. +- /*
  6948. +- * Accumulate cal measures for active chains
  6949. +- */
  6950. +- currCal->calData->calCollect(ah);
  6951. +- ah->cal_samples++;
  6952. ++ if (REG_READ(ah, AR_PHY_TIMING4) & AR_PHY_TIMING4_DO_CAL)
  6953. ++ return false;
  6954. +
  6955. +- if (ah->cal_samples >=
  6956. +- currCal->calData->calNumSamples) {
  6957. +- unsigned int i, numChains = 0;
  6958. +- for (i = 0; i < AR9300_MAX_CHAINS; i++) {
  6959. +- if (rxchainmask & (1 << i))
  6960. +- numChains++;
  6961. +- }
  6962. ++ /*
  6963. ++ * Accumulate cal measures for active chains
  6964. ++ */
  6965. ++ cur_caldata->calCollect(ah);
  6966. ++ ah->cal_samples++;
  6967. +
  6968. +- /*
  6969. +- * Process accumulated data
  6970. +- */
  6971. +- currCal->calData->calPostProc(ah, numChains);
  6972. ++ if (ah->cal_samples >= cur_caldata->calNumSamples) {
  6973. ++ unsigned int i, numChains = 0;
  6974. ++ for (i = 0; i < AR9300_MAX_CHAINS; i++) {
  6975. ++ if (rxchainmask & (1 << i))
  6976. ++ numChains++;
  6977. ++ }
  6978. +
  6979. +- /* Calibration has finished. */
  6980. +- caldata->CalValid |= currCal->calData->calType;
  6981. +- currCal->calState = CAL_DONE;
  6982. +- iscaldone = true;
  6983. +- } else {
  6984. ++ /*
  6985. ++ * Process accumulated data
  6986. ++ */
  6987. ++ cur_caldata->calPostProc(ah, numChains);
  6988. ++
  6989. ++ /* Calibration has finished. */
  6990. ++ caldata->CalValid |= cur_caldata->calType;
  6991. ++ currCal->calState = CAL_DONE;
  6992. ++ return true;
  6993. ++ } else {
  6994. + /*
  6995. + * Set-up collection of another sub-sample until we
  6996. + * get desired number
  6997. + */
  6998. + ar9003_hw_setup_calibration(ah, currCal);
  6999. +- }
  7000. + }
  7001. +- } else if (!(caldata->CalValid & currCal->calData->calType)) {
  7002. ++ } else if (!(caldata->CalValid & cur_caldata->calType)) {
  7003. + /* If current cal is marked invalid in channel, kick it off */
  7004. + ath9k_hw_reset_calibration(ah, currCal);
  7005. + }
  7006. +
  7007. +- return iscaldone;
  7008. ++ return false;
  7009. + }
  7010. +
  7011. + static int ar9003_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan,
  7012. 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
  7013. new file mode 100644
  7014. index 0000000..b7f3823
  7015. --- /dev/null
  7016. +++ b/package/kernel/mac80211/patches/327-ath9k_hw-get-rid-of-some-duplicate-code-in-calibrati.patch
  7017. @@ -0,0 +1,94 @@
  7018. +From: Felix Fietkau <nbd@nbd.name>
  7019. +Date: Mon, 11 Jul 2016 11:35:20 +0200
  7020. +Subject: [PATCH] ath9k_hw: get rid of some duplicate code in calibration
  7021. + init
  7022. +
  7023. +Remove a misleading debug message as well
  7024. +
  7025. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  7026. +---
  7027. +
  7028. +--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  7029. ++++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  7030. +@@ -1373,6 +1373,26 @@ static void ar9003_hw_cl_cal_post_proc(s
  7031. + }
  7032. + }
  7033. +
  7034. ++static void ar9003_hw_init_cal_common(struct ath_hw *ah)
  7035. ++{
  7036. ++ struct ath9k_hw_cal_data *caldata = ah->caldata;
  7037. ++
  7038. ++ /* Initialize list pointers */
  7039. ++ ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL;
  7040. ++
  7041. ++ INIT_CAL(&ah->iq_caldata);
  7042. ++ INSERT_CAL(ah, &ah->iq_caldata);
  7043. ++
  7044. ++ /* Initialize current pointer to first element in list */
  7045. ++ ah->cal_list_curr = ah->cal_list;
  7046. ++
  7047. ++ if (ah->cal_list_curr)
  7048. ++ ath9k_hw_reset_calibration(ah, ah->cal_list_curr);
  7049. ++
  7050. ++ if (caldata)
  7051. ++ caldata->CalValid = 0;
  7052. ++}
  7053. ++
  7054. + static bool ar9003_hw_init_cal_pcoem(struct ath_hw *ah,
  7055. + struct ath9k_channel *chan)
  7056. + {
  7057. +@@ -1532,21 +1552,7 @@ skip_tx_iqcal:
  7058. + /* Revert chainmask to runtime parameters */
  7059. + ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask);
  7060. +
  7061. +- /* Initialize list pointers */
  7062. +- ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL;
  7063. +-
  7064. +- INIT_CAL(&ah->iq_caldata);
  7065. +- INSERT_CAL(ah, &ah->iq_caldata);
  7066. +- ath_dbg(common, CALIBRATE, "enabling IQ Calibration\n");
  7067. +-
  7068. +- /* Initialize current pointer to first element in list */
  7069. +- ah->cal_list_curr = ah->cal_list;
  7070. +-
  7071. +- if (ah->cal_list_curr)
  7072. +- ath9k_hw_reset_calibration(ah, ah->cal_list_curr);
  7073. +-
  7074. +- if (caldata)
  7075. +- caldata->CalValid = 0;
  7076. ++ ar9003_hw_init_cal_common(ah);
  7077. +
  7078. + return true;
  7079. + }
  7080. +@@ -1577,8 +1583,6 @@ static bool do_ar9003_agc_cal(struct ath
  7081. + static bool ar9003_hw_init_cal_soc(struct ath_hw *ah,
  7082. + struct ath9k_channel *chan)
  7083. + {
  7084. +- struct ath_common *common = ath9k_hw_common(ah);
  7085. +- struct ath9k_hw_cal_data *caldata = ah->caldata;
  7086. + bool txiqcal_done = false;
  7087. + bool status = true;
  7088. + bool run_agc_cal = false, sep_iq_cal = false;
  7089. +@@ -1676,21 +1680,7 @@ skip_tx_iqcal:
  7090. + /* Revert chainmask to runtime parameters */
  7091. + ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask);
  7092. +
  7093. +- /* Initialize list pointers */
  7094. +- ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL;
  7095. +-
  7096. +- INIT_CAL(&ah->iq_caldata);
  7097. +- INSERT_CAL(ah, &ah->iq_caldata);
  7098. +- ath_dbg(common, CALIBRATE, "enabling IQ Calibration\n");
  7099. +-
  7100. +- /* Initialize current pointer to first element in list */
  7101. +- ah->cal_list_curr = ah->cal_list;
  7102. +-
  7103. +- if (ah->cal_list_curr)
  7104. +- ath9k_hw_reset_calibration(ah, ah->cal_list_curr);
  7105. +-
  7106. +- if (caldata)
  7107. +- caldata->CalValid = 0;
  7108. ++ ar9003_hw_init_cal_common(ah);
  7109. +
  7110. + return true;
  7111. + }
  7112. 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
  7113. deleted file mode 100644
  7114. index f7f9df9..0000000
  7115. --- a/package/kernel/mac80211/patches/327-mac80211-Remove-MPP-table-entries-with-MPath.patch
  7116. +++ /dev/null
  7117. @@ -1,54 +0,0 @@
  7118. -From: Henning Rogge <hrogge@gmail.com>
  7119. -Date: Wed, 3 Feb 2016 13:58:36 +0100
  7120. -Subject: [PATCH] mac80211: Remove MPP table entries with MPath
  7121. -
  7122. -Make the mesh_path_del() function remove all mpp table entries
  7123. -that are proxied by the removed mesh path.
  7124. -
  7125. -Acked-by: Bob Copeland <me@bobcopeland.com>
  7126. -Signed-off-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
  7127. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  7128. ----
  7129. -
  7130. ---- a/net/mac80211/mesh_pathtbl.c
  7131. -+++ b/net/mac80211/mesh_pathtbl.c
  7132. -@@ -835,6 +835,29 @@ void mesh_path_flush_by_nexthop(struct s
  7133. - rcu_read_unlock();
  7134. - }
  7135. -
  7136. -+static void mpp_flush_by_proxy(struct ieee80211_sub_if_data *sdata,
  7137. -+ const u8 *proxy)
  7138. -+{
  7139. -+ struct mesh_table *tbl;
  7140. -+ struct mesh_path *mpp;
  7141. -+ struct mpath_node *node;
  7142. -+ int i;
  7143. -+
  7144. -+ rcu_read_lock();
  7145. -+ read_lock_bh(&pathtbl_resize_lock);
  7146. -+ tbl = resize_dereference_mpp_paths();
  7147. -+ for_each_mesh_entry(tbl, node, i) {
  7148. -+ mpp = node->mpath;
  7149. -+ if (ether_addr_equal(mpp->mpp, proxy)) {
  7150. -+ spin_lock(&tbl->hashwlock[i]);
  7151. -+ __mesh_path_del(tbl, node);
  7152. -+ spin_unlock(&tbl->hashwlock[i]);
  7153. -+ }
  7154. -+ }
  7155. -+ read_unlock_bh(&pathtbl_resize_lock);
  7156. -+ rcu_read_unlock();
  7157. -+}
  7158. -+
  7159. - static void table_flush_by_iface(struct mesh_table *tbl,
  7160. - struct ieee80211_sub_if_data *sdata)
  7161. - {
  7162. -@@ -892,6 +915,9 @@ int mesh_path_del(struct ieee80211_sub_i
  7163. - int hash_idx;
  7164. - int err = 0;
  7165. -
  7166. -+ /* flush relevant mpp entries first */
  7167. -+ mpp_flush_by_proxy(sdata, addr);
  7168. -+
  7169. - read_lock_bh(&pathtbl_resize_lock);
  7170. - tbl = resize_dereference_mesh_paths();
  7171. - hash_idx = mesh_table_hash(addr, sdata, tbl);
  7172. diff --git a/package/kernel/mac80211/patches/328-ath9k_hw-implement-temperature-compensation-support-.patch b/package/kernel/mac80211/patches/328-ath9k_hw-implement-temperature-compensation-support-.patch
  7173. new file mode 100644
  7174. index 0000000..cff32ad
  7175. --- /dev/null
  7176. +++ b/package/kernel/mac80211/patches/328-ath9k_hw-implement-temperature-compensation-support-.patch
  7177. @@ -0,0 +1,97 @@
  7178. +From: Felix Fietkau <nbd@nbd.name>
  7179. +Date: Mon, 11 Jul 2016 11:35:55 +0200
  7180. +Subject: [PATCH] ath9k_hw: implement temperature compensation support for
  7181. + AR9003+
  7182. +
  7183. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  7184. +---
  7185. +
  7186. +--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  7187. ++++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  7188. +@@ -33,6 +33,7 @@ struct coeff {
  7189. +
  7190. + enum ar9003_cal_types {
  7191. + IQ_MISMATCH_CAL = BIT(0),
  7192. ++ TEMP_COMP_CAL = BIT(1),
  7193. + };
  7194. +
  7195. + static void ar9003_hw_setup_calibration(struct ath_hw *ah,
  7196. +@@ -58,6 +59,12 @@ static void ar9003_hw_setup_calibration(
  7197. + /* Kick-off cal */
  7198. + REG_SET_BIT(ah, AR_PHY_TIMING4, AR_PHY_TIMING4_DO_CAL);
  7199. + break;
  7200. ++ case TEMP_COMP_CAL:
  7201. ++ ath_dbg(common, CALIBRATE,
  7202. ++ "starting Temperature Compensation Calibration\n");
  7203. ++ REG_SET_BIT(ah, AR_CH0_THERM, AR_CH0_THERM_LOCAL);
  7204. ++ REG_SET_BIT(ah, AR_CH0_THERM, AR_CH0_THERM_START);
  7205. ++ break;
  7206. + default:
  7207. + ath_err(common, "Invalid calibration type\n");
  7208. + break;
  7209. +@@ -86,7 +93,8 @@ static bool ar9003_hw_per_calibration(st
  7210. + /*
  7211. + * Accumulate cal measures for active chains
  7212. + */
  7213. +- cur_caldata->calCollect(ah);
  7214. ++ if (cur_caldata->calCollect)
  7215. ++ cur_caldata->calCollect(ah);
  7216. + ah->cal_samples++;
  7217. +
  7218. + if (ah->cal_samples >= cur_caldata->calNumSamples) {
  7219. +@@ -99,7 +107,8 @@ static bool ar9003_hw_per_calibration(st
  7220. + /*
  7221. + * Process accumulated data
  7222. + */
  7223. +- cur_caldata->calPostProc(ah, numChains);
  7224. ++ if (cur_caldata->calPostProc)
  7225. ++ cur_caldata->calPostProc(ah, numChains);
  7226. +
  7227. + /* Calibration has finished. */
  7228. + caldata->CalValid |= cur_caldata->calType;
  7229. +@@ -314,9 +323,16 @@ static const struct ath9k_percal_data iq
  7230. + ar9003_hw_iqcalibrate
  7231. + };
  7232. +
  7233. ++static const struct ath9k_percal_data temp_cal_single_sample = {
  7234. ++ TEMP_COMP_CAL,
  7235. ++ MIN_CAL_SAMPLES,
  7236. ++ PER_MAX_LOG_COUNT,
  7237. ++};
  7238. ++
  7239. + static void ar9003_hw_init_cal_settings(struct ath_hw *ah)
  7240. + {
  7241. + ah->iq_caldata.calData = &iq_cal_single_sample;
  7242. ++ ah->temp_caldata.calData = &temp_cal_single_sample;
  7243. +
  7244. + if (AR_SREV_9300_20_OR_LATER(ah)) {
  7245. + ah->enabled_cals |= TX_IQ_CAL;
  7246. +@@ -324,7 +340,7 @@ static void ar9003_hw_init_cal_settings(
  7247. + ah->enabled_cals |= TX_IQ_ON_AGC_CAL;
  7248. + }
  7249. +
  7250. +- ah->supp_cals = IQ_MISMATCH_CAL;
  7251. ++ ah->supp_cals = IQ_MISMATCH_CAL | TEMP_COMP_CAL;
  7252. + }
  7253. +
  7254. + #define OFF_UPPER_LT 24
  7255. +@@ -1383,6 +1399,9 @@ static void ar9003_hw_init_cal_common(st
  7256. + INIT_CAL(&ah->iq_caldata);
  7257. + INSERT_CAL(ah, &ah->iq_caldata);
  7258. +
  7259. ++ INIT_CAL(&ah->temp_caldata);
  7260. ++ INSERT_CAL(ah, &ah->temp_caldata);
  7261. ++
  7262. + /* Initialize current pointer to first element in list */
  7263. + ah->cal_list_curr = ah->cal_list;
  7264. +
  7265. +--- a/drivers/net/wireless/ath/ath9k/hw.h
  7266. ++++ b/drivers/net/wireless/ath/ath9k/hw.h
  7267. +@@ -830,6 +830,7 @@ struct ath_hw {
  7268. + /* Calibration */
  7269. + u32 supp_cals;
  7270. + struct ath9k_cal_list iq_caldata;
  7271. ++ struct ath9k_cal_list temp_caldata;
  7272. + struct ath9k_cal_list adcgain_caldata;
  7273. + struct ath9k_cal_list adcdc_caldata;
  7274. + struct ath9k_cal_list *cal_list;
  7275. 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
  7276. deleted file mode 100644
  7277. index 740993c..0000000
  7278. --- a/package/kernel/mac80211/patches/328-mac80211-let-unused-MPP-table-entries-timeout.patch
  7279. +++ /dev/null
  7280. @@ -1,104 +0,0 @@
  7281. -From: Henning Rogge <hrogge@gmail.com>
  7282. -Date: Wed, 3 Feb 2016 13:58:37 +0100
  7283. -Subject: [PATCH] mac80211: let unused MPP table entries timeout
  7284. -
  7285. -Remember the last time when a mpp table entry is used for
  7286. -rx or tx and remove them after MESH_PATH_EXPIRE time.
  7287. -
  7288. -Acked-by: Bob Copeland <me@bobcopeland.com>
  7289. -Signed-off-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
  7290. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  7291. ----
  7292. -
  7293. ---- a/net/mac80211/mesh_pathtbl.c
  7294. -+++ b/net/mac80211/mesh_pathtbl.c
  7295. -@@ -942,6 +942,46 @@ enddel:
  7296. - }
  7297. -
  7298. - /**
  7299. -+ * mpp_path_del - delete a mesh proxy path from the table
  7300. -+ *
  7301. -+ * @addr: addr address (ETH_ALEN length)
  7302. -+ * @sdata: local subif
  7303. -+ *
  7304. -+ * Returns: 0 if successful
  7305. -+ */
  7306. -+static int mpp_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr)
  7307. -+{
  7308. -+ struct mesh_table *tbl;
  7309. -+ struct mesh_path *mpath;
  7310. -+ struct mpath_node *node;
  7311. -+ struct hlist_head *bucket;
  7312. -+ int hash_idx;
  7313. -+ int err = 0;
  7314. -+
  7315. -+ read_lock_bh(&pathtbl_resize_lock);
  7316. -+ tbl = resize_dereference_mpp_paths();
  7317. -+ hash_idx = mesh_table_hash(addr, sdata, tbl);
  7318. -+ bucket = &tbl->hash_buckets[hash_idx];
  7319. -+
  7320. -+ spin_lock(&tbl->hashwlock[hash_idx]);
  7321. -+ hlist_for_each_entry(node, bucket, list) {
  7322. -+ mpath = node->mpath;
  7323. -+ if (mpath->sdata == sdata &&
  7324. -+ ether_addr_equal(addr, mpath->dst)) {
  7325. -+ __mesh_path_del(tbl, node);
  7326. -+ goto enddel;
  7327. -+ }
  7328. -+ }
  7329. -+
  7330. -+ err = -ENXIO;
  7331. -+enddel:
  7332. -+ mesh_paths_generation++;
  7333. -+ spin_unlock(&tbl->hashwlock[hash_idx]);
  7334. -+ read_unlock_bh(&pathtbl_resize_lock);
  7335. -+ return err;
  7336. -+}
  7337. -+
  7338. -+/**
  7339. - * mesh_path_tx_pending - sends pending frames in a mesh path queue
  7340. - *
  7341. - * @mpath: mesh path to activate
  7342. -@@ -1157,6 +1197,17 @@ void mesh_path_expire(struct ieee80211_s
  7343. - time_after(jiffies, mpath->exp_time + MESH_PATH_EXPIRE))
  7344. - mesh_path_del(mpath->sdata, mpath->dst);
  7345. - }
  7346. -+
  7347. -+ tbl = rcu_dereference(mpp_paths);
  7348. -+ for_each_mesh_entry(tbl, node, i) {
  7349. -+ if (node->mpath->sdata != sdata)
  7350. -+ continue;
  7351. -+ mpath = node->mpath;
  7352. -+ if ((!(mpath->flags & MESH_PATH_FIXED)) &&
  7353. -+ time_after(jiffies, mpath->exp_time + MESH_PATH_EXPIRE))
  7354. -+ mpp_path_del(mpath->sdata, mpath->dst);
  7355. -+ }
  7356. -+
  7357. - rcu_read_unlock();
  7358. - }
  7359. -
  7360. ---- a/net/mac80211/rx.c
  7361. -+++ b/net/mac80211/rx.c
  7362. -@@ -2291,6 +2291,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
  7363. - spin_lock_bh(&mppath->state_lock);
  7364. - if (!ether_addr_equal(mppath->mpp, mpp_addr))
  7365. - memcpy(mppath->mpp, mpp_addr, ETH_ALEN);
  7366. -+ mppath->exp_time = jiffies;
  7367. - spin_unlock_bh(&mppath->state_lock);
  7368. - }
  7369. - rcu_read_unlock();
  7370. ---- a/net/mac80211/tx.c
  7371. -+++ b/net/mac80211/tx.c
  7372. -@@ -2171,8 +2171,11 @@ static struct sk_buff *ieee80211_build_h
  7373. - mpp_lookup = true;
  7374. - }
  7375. -
  7376. -- if (mpp_lookup)
  7377. -+ if (mpp_lookup) {
  7378. - mppath = mpp_path_lookup(sdata, skb->data);
  7379. -+ if (mppath)
  7380. -+ mppath->exp_time = jiffies;
  7381. -+ }
  7382. -
  7383. - if (mppath && mpath)
  7384. - mesh_path_del(mpath->sdata, mpath->dst);
  7385. 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
  7386. deleted file mode 100644
  7387. index 0c36b1d..0000000
  7388. --- a/package/kernel/mac80211/patches/329-mac80211-Unify-mesh-and-mpp-path-removal-function.patch
  7389. +++ /dev/null
  7390. @@ -1,143 +0,0 @@
  7391. -From: Henning Rogge <hrogge@gmail.com>
  7392. -Date: Wed, 3 Feb 2016 13:58:38 +0100
  7393. -Subject: [PATCH] mac80211: Unify mesh and mpp path removal function
  7394. -
  7395. -mpp_path_del() and mesh_path_del() are mostly the same function.
  7396. -Move common code into a new static function.
  7397. -
  7398. -Acked-by: Bob Copeland <me@bobcopeland.com>
  7399. -Signed-off-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
  7400. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  7401. ----
  7402. -
  7403. ---- a/net/mac80211/mesh_pathtbl.c
  7404. -+++ b/net/mac80211/mesh_pathtbl.c
  7405. -@@ -55,16 +55,21 @@ int mpp_paths_generation;
  7406. - static DEFINE_RWLOCK(pathtbl_resize_lock);
  7407. -
  7408. -
  7409. -+static inline struct mesh_table *resize_dereference_paths(
  7410. -+ struct mesh_table __rcu *table)
  7411. -+{
  7412. -+ return rcu_dereference_protected(table,
  7413. -+ lockdep_is_held(&pathtbl_resize_lock));
  7414. -+}
  7415. -+
  7416. - static inline struct mesh_table *resize_dereference_mesh_paths(void)
  7417. - {
  7418. -- return rcu_dereference_protected(mesh_paths,
  7419. -- lockdep_is_held(&pathtbl_resize_lock));
  7420. -+ return resize_dereference_paths(mesh_paths);
  7421. - }
  7422. -
  7423. - static inline struct mesh_table *resize_dereference_mpp_paths(void)
  7424. - {
  7425. -- return rcu_dereference_protected(mpp_paths,
  7426. -- lockdep_is_held(&pathtbl_resize_lock));
  7427. -+ return resize_dereference_paths(mpp_paths);
  7428. - }
  7429. -
  7430. - /*
  7431. -@@ -899,14 +904,17 @@ void mesh_path_flush_by_iface(struct iee
  7432. - }
  7433. -
  7434. - /**
  7435. -- * mesh_path_del - delete a mesh path from the table
  7436. -+ * table_path_del - delete a path from the mesh or mpp table
  7437. - *
  7438. -- * @addr: dst address (ETH_ALEN length)
  7439. -+ * @tbl: mesh or mpp path table
  7440. - * @sdata: local subif
  7441. -+ * @addr: dst address (ETH_ALEN length)
  7442. - *
  7443. - * Returns: 0 if successful
  7444. - */
  7445. --int mesh_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr)
  7446. -+static int table_path_del(struct mesh_table __rcu *rcu_tbl,
  7447. -+ struct ieee80211_sub_if_data *sdata,
  7448. -+ const u8 *addr)
  7449. - {
  7450. - struct mesh_table *tbl;
  7451. - struct mesh_path *mpath;
  7452. -@@ -915,11 +923,7 @@ int mesh_path_del(struct ieee80211_sub_i
  7453. - int hash_idx;
  7454. - int err = 0;
  7455. -
  7456. -- /* flush relevant mpp entries first */
  7457. -- mpp_flush_by_proxy(sdata, addr);
  7458. --
  7459. -- read_lock_bh(&pathtbl_resize_lock);
  7460. -- tbl = resize_dereference_mesh_paths();
  7461. -+ tbl = resize_dereference_paths(rcu_tbl);
  7462. - hash_idx = mesh_table_hash(addr, sdata, tbl);
  7463. - bucket = &tbl->hash_buckets[hash_idx];
  7464. -
  7465. -@@ -935,9 +939,30 @@ int mesh_path_del(struct ieee80211_sub_i
  7466. -
  7467. - err = -ENXIO;
  7468. - enddel:
  7469. -- mesh_paths_generation++;
  7470. - spin_unlock(&tbl->hashwlock[hash_idx]);
  7471. -+ return err;
  7472. -+}
  7473. -+
  7474. -+/**
  7475. -+ * mesh_path_del - delete a mesh path from the table
  7476. -+ *
  7477. -+ * @addr: dst address (ETH_ALEN length)
  7478. -+ * @sdata: local subif
  7479. -+ *
  7480. -+ * Returns: 0 if successful
  7481. -+ */
  7482. -+int mesh_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr)
  7483. -+{
  7484. -+ int err = 0;
  7485. -+
  7486. -+ /* flush relevant mpp entries first */
  7487. -+ mpp_flush_by_proxy(sdata, addr);
  7488. -+
  7489. -+ read_lock_bh(&pathtbl_resize_lock);
  7490. -+ err = table_path_del(mesh_paths, sdata, addr);
  7491. -+ mesh_paths_generation++;
  7492. - read_unlock_bh(&pathtbl_resize_lock);
  7493. -+
  7494. - return err;
  7495. - }
  7496. -
  7497. -@@ -951,33 +976,13 @@ enddel:
  7498. - */
  7499. - static int mpp_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr)
  7500. - {
  7501. -- struct mesh_table *tbl;
  7502. -- struct mesh_path *mpath;
  7503. -- struct mpath_node *node;
  7504. -- struct hlist_head *bucket;
  7505. -- int hash_idx;
  7506. - int err = 0;
  7507. -
  7508. - read_lock_bh(&pathtbl_resize_lock);
  7509. -- tbl = resize_dereference_mpp_paths();
  7510. -- hash_idx = mesh_table_hash(addr, sdata, tbl);
  7511. -- bucket = &tbl->hash_buckets[hash_idx];
  7512. --
  7513. -- spin_lock(&tbl->hashwlock[hash_idx]);
  7514. -- hlist_for_each_entry(node, bucket, list) {
  7515. -- mpath = node->mpath;
  7516. -- if (mpath->sdata == sdata &&
  7517. -- ether_addr_equal(addr, mpath->dst)) {
  7518. -- __mesh_path_del(tbl, node);
  7519. -- goto enddel;
  7520. -- }
  7521. -- }
  7522. --
  7523. -- err = -ENXIO;
  7524. --enddel:
  7525. -- mesh_paths_generation++;
  7526. -- spin_unlock(&tbl->hashwlock[hash_idx]);
  7527. -+ err = table_path_del(mpp_paths, sdata, addr);
  7528. -+ mpp_paths_generation++;
  7529. - read_unlock_bh(&pathtbl_resize_lock);
  7530. -+
  7531. - return err;
  7532. - }
  7533. -
  7534. 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
  7535. new file mode 100644
  7536. index 0000000..38e541c
  7537. --- /dev/null
  7538. +++ b/package/kernel/mac80211/patches/329-mac80211-fix-check-for-buffered-powersave-frames-wit.patch
  7539. @@ -0,0 +1,21 @@
  7540. +From: Felix Fietkau <nbd@nbd.name>
  7541. +Date: Mon, 11 Jul 2016 15:07:06 +0200
  7542. +Subject: [PATCH] mac80211: fix check for buffered powersave frames with txq
  7543. +
  7544. +The logic was inverted here, set the bit if frames are pending.
  7545. +
  7546. +Fixes: ba8c3d6f16a1 ("mac80211: add an intermediate software queue implementation")
  7547. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  7548. +---
  7549. +
  7550. +--- a/net/mac80211/rx.c
  7551. ++++ b/net/mac80211/rx.c
  7552. +@@ -1268,7 +1268,7 @@ static void sta_ps_start(struct sta_info
  7553. + for (tid = 0; tid < ARRAY_SIZE(sta->sta.txq); tid++) {
  7554. + struct txq_info *txqi = to_txq_info(sta->sta.txq[tid]);
  7555. +
  7556. +- if (!txqi->tin.backlog_packets)
  7557. ++ if (txqi->tin.backlog_packets)
  7558. + set_bit(tid, &sta->txq_buffered_tids);
  7559. + else
  7560. + clear_bit(tid, &sta->txq_buffered_tids);
  7561. 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
  7562. new file mode 100644
  7563. index 0000000..a6031b9
  7564. --- /dev/null
  7565. +++ b/package/kernel/mac80211/patches/330-ath10k-fix-rx-status-reporting-for-A-MSDU-subframes.patch
  7566. @@ -0,0 +1,36 @@
  7567. +From: Felix Fietkau <nbd@nbd.name>
  7568. +Date: Sun, 17 Jul 2016 12:49:59 +0200
  7569. +Subject: [PATCH] ath10k: fix rx status reporting for A-MSDU subframes
  7570. +
  7571. +Patch by Nagarajan, Ashok Raj <arnagara@qti.qualcomm.com>
  7572. +
  7573. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  7574. +---
  7575. +
  7576. +--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
  7577. ++++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
  7578. +@@ -1525,7 +1525,7 @@ static void ath10k_htt_rx_h_filter(struc
  7579. + static int ath10k_htt_rx_handle_amsdu(struct ath10k_htt *htt)
  7580. + {
  7581. + struct ath10k *ar = htt->ar;
  7582. +- static struct ieee80211_rx_status rx_status;
  7583. ++ struct ieee80211_rx_status *rx_status = &htt->rx_status;
  7584. + struct sk_buff_head amsdu;
  7585. + int ret;
  7586. +
  7587. +@@ -1549,11 +1549,11 @@ static int ath10k_htt_rx_handle_amsdu(st
  7588. + return ret;
  7589. + }
  7590. +
  7591. +- ath10k_htt_rx_h_ppdu(ar, &amsdu, &rx_status, 0xffff);
  7592. ++ ath10k_htt_rx_h_ppdu(ar, &amsdu, rx_status, 0xffff);
  7593. + ath10k_htt_rx_h_unchain(ar, &amsdu, ret > 0);
  7594. +- ath10k_htt_rx_h_filter(ar, &amsdu, &rx_status);
  7595. +- ath10k_htt_rx_h_mpdu(ar, &amsdu, &rx_status);
  7596. +- ath10k_htt_rx_h_deliver(ar, &amsdu, &rx_status);
  7597. ++ ath10k_htt_rx_h_filter(ar, &amsdu, rx_status);
  7598. ++ ath10k_htt_rx_h_mpdu(ar, &amsdu, rx_status);
  7599. ++ ath10k_htt_rx_h_deliver(ar, &amsdu, rx_status);
  7600. +
  7601. + return 0;
  7602. + }
  7603. 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
  7604. deleted file mode 100644
  7605. index 4dc6d66..0000000
  7606. --- a/package/kernel/mac80211/patches/330-mac80211-minstrel-Change-expected-throughput-unit-ba.patch
  7607. +++ /dev/null
  7608. @@ -1,51 +0,0 @@
  7609. -From: Sven Eckelmann <sven.eckelmann@open-mesh.com>
  7610. -Date: Tue, 2 Feb 2016 08:12:26 +0100
  7611. -Subject: [PATCH] mac80211: minstrel: Change expected throughput unit back to
  7612. - Kbps
  7613. -
  7614. -The change from cur_tp to the function
  7615. -minstrel_get_tp_avg/minstrel_ht_get_tp_avg changed the unit used for the
  7616. -current throughput. For example in minstrel_ht the correct
  7617. -conversion between them would be:
  7618. -
  7619. - mrs->cur_tp / 10 == minstrel_ht_get_tp_avg(..).
  7620. -
  7621. -This factor 10 must also be included in the calculation of
  7622. -minstrel_get_expected_throughput and minstrel_ht_get_expected_throughput to
  7623. -return values with the unit [Kbps] instead of [10Kbps]. Otherwise routing
  7624. -algorithms like B.A.T.M.A.N. V will make incorrect decision based on these
  7625. -values. Its kernel based implementation expects expected_throughput always
  7626. -to have the unit [Kbps] and not sometimes [10Kbps] and sometimes [Kbps].
  7627. -
  7628. -The same requirement has iw or olsrdv2's nl80211 based statistics module
  7629. -which retrieve the same data via NL80211_STA_INFO_TX_BITRATE.
  7630. -
  7631. -Cc: stable@vger.kernel.org
  7632. -Fixes: 6a27b2c40b48 ("mac80211: restructure per-rate throughput calculation into function")
  7633. -Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
  7634. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  7635. ----
  7636. -
  7637. ---- a/net/mac80211/rc80211_minstrel.c
  7638. -+++ b/net/mac80211/rc80211_minstrel.c
  7639. -@@ -711,7 +711,7 @@ static u32 minstrel_get_expected_through
  7640. - * computing cur_tp
  7641. - */
  7642. - tmp_mrs = &mi->r[idx].stats;
  7643. -- tmp_cur_tp = minstrel_get_tp_avg(&mi->r[idx], tmp_mrs->prob_ewma);
  7644. -+ tmp_cur_tp = minstrel_get_tp_avg(&mi->r[idx], tmp_mrs->prob_ewma) * 10;
  7645. - tmp_cur_tp = tmp_cur_tp * 1200 * 8 / 1024;
  7646. -
  7647. - return tmp_cur_tp;
  7648. ---- a/net/mac80211/rc80211_minstrel_ht.c
  7649. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  7650. -@@ -1335,7 +1335,8 @@ static u32 minstrel_ht_get_expected_thro
  7651. - prob = mi->groups[i].rates[j].prob_ewma;
  7652. -
  7653. - /* convert tp_avg from pkt per second in kbps */
  7654. -- tp_avg = minstrel_ht_get_tp_avg(mi, i, j, prob) * AVG_PKT_SIZE * 8 / 1024;
  7655. -+ tp_avg = minstrel_ht_get_tp_avg(mi, i, j, prob) * 10;
  7656. -+ tp_avg = tp_avg * AVG_PKT_SIZE * 8 / 1024;
  7657. -
  7658. - return tp_avg;
  7659. - }
  7660. 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
  7661. deleted file mode 100644
  7662. index 1fd016f..0000000
  7663. --- a/package/kernel/mac80211/patches/331-brcmfmac-Increase-nr-of-supported-flowrings.patch
  7664. +++ /dev/null
  7665. @@ -1,307 +0,0 @@
  7666. -From: Hante Meuleman <meuleman@broadcom.com>
  7667. -Date: Sun, 7 Feb 2016 18:08:24 +0100
  7668. -Subject: [PATCH] brcmfmac: Increase nr of supported flowrings.
  7669. -MIME-Version: 1.0
  7670. -Content-Type: text/plain; charset=UTF-8
  7671. -Content-Transfer-Encoding: 8bit
  7672. -
  7673. -New generation devices have firmware which has more than 256 flowrings.
  7674. -E.g. following debugging message comes from 14e4:4365 BCM4366:
  7675. -[ 194.606245] brcmfmac: brcmf_pcie_init_ringbuffers Nr of flowrings is 264
  7676. -
  7677. -At various code places (related to flowrings) we were using u8 which
  7678. -could lead to storing wrong number or infinite loops when indexing with
  7679. -this type. This issue was quite easy to spot in brcmf_flowring_detach
  7680. -where it led to infinite loop e.g. on failed initialization.
  7681. -
  7682. -This patch switches code to proper types and increases the maximum
  7683. -number of supported flowrings to 512.
  7684. -
  7685. -Originally this change was sent in September 2015, but back it was
  7686. -causing a regression on BCM43602 resulting in:
  7687. -Unable to handle kernel NULL pointer dereference at virtual address ...
  7688. -
  7689. -The reason for this regression was missing update (s/u8/u16) of struct
  7690. -brcmf_flowring_ring. This problem was handled in 9f64df9 ("brcmfmac: Fix
  7691. -bug in flowring management."). Starting with that it's safe to apply
  7692. -this original patch as it doesn't cause a regression anymore.
  7693. -
  7694. -This patch fixes an infinite loop on BCM4366 which is supported since
  7695. -4.4 so it makes sense to apply it to stable 4.4+.
  7696. -
  7697. -Cc: <stable@vger.kernel.org> # 4.4+
  7698. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  7699. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  7700. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  7701. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  7702. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  7703. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  7704. ----
  7705. -
  7706. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c
  7707. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c
  7708. -@@ -32,7 +32,7 @@
  7709. - #define BRCMF_FLOWRING_LOW (BRCMF_FLOWRING_HIGH - 256)
  7710. - #define BRCMF_FLOWRING_INVALID_IFIDX 0xff
  7711. -
  7712. --#define BRCMF_FLOWRING_HASH_AP(da, fifo, ifidx) (da[5] + fifo + ifidx * 16)
  7713. -+#define BRCMF_FLOWRING_HASH_AP(da, fifo, ifidx) (da[5] * 2 + fifo + ifidx * 16)
  7714. - #define BRCMF_FLOWRING_HASH_STA(fifo, ifidx) (fifo + ifidx * 16)
  7715. -
  7716. - static const u8 brcmf_flowring_prio2fifo[] = {
  7717. -@@ -68,7 +68,7 @@ u32 brcmf_flowring_lookup(struct brcmf_f
  7718. - u8 prio, u8 ifidx)
  7719. - {
  7720. - struct brcmf_flowring_hash *hash;
  7721. -- u8 hash_idx;
  7722. -+ u16 hash_idx;
  7723. - u32 i;
  7724. - bool found;
  7725. - bool sta;
  7726. -@@ -88,6 +88,7 @@ u32 brcmf_flowring_lookup(struct brcmf_f
  7727. - }
  7728. - hash_idx = sta ? BRCMF_FLOWRING_HASH_STA(fifo, ifidx) :
  7729. - BRCMF_FLOWRING_HASH_AP(mac, fifo, ifidx);
  7730. -+ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1);
  7731. - found = false;
  7732. - hash = flow->hash;
  7733. - for (i = 0; i < BRCMF_FLOWRING_HASHSIZE; i++) {
  7734. -@@ -98,6 +99,7 @@ u32 brcmf_flowring_lookup(struct brcmf_f
  7735. - break;
  7736. - }
  7737. - hash_idx++;
  7738. -+ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1);
  7739. - }
  7740. - if (found)
  7741. - return hash[hash_idx].flowid;
  7742. -@@ -111,7 +113,7 @@ u32 brcmf_flowring_create(struct brcmf_f
  7743. - {
  7744. - struct brcmf_flowring_ring *ring;
  7745. - struct brcmf_flowring_hash *hash;
  7746. -- u8 hash_idx;
  7747. -+ u16 hash_idx;
  7748. - u32 i;
  7749. - bool found;
  7750. - u8 fifo;
  7751. -@@ -131,6 +133,7 @@ u32 brcmf_flowring_create(struct brcmf_f
  7752. - }
  7753. - hash_idx = sta ? BRCMF_FLOWRING_HASH_STA(fifo, ifidx) :
  7754. - BRCMF_FLOWRING_HASH_AP(mac, fifo, ifidx);
  7755. -+ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1);
  7756. - found = false;
  7757. - hash = flow->hash;
  7758. - for (i = 0; i < BRCMF_FLOWRING_HASHSIZE; i++) {
  7759. -@@ -140,6 +143,7 @@ u32 brcmf_flowring_create(struct brcmf_f
  7760. - break;
  7761. - }
  7762. - hash_idx++;
  7763. -+ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1);
  7764. - }
  7765. - if (found) {
  7766. - for (i = 0; i < flow->nrofrings; i++) {
  7767. -@@ -169,7 +173,7 @@ u32 brcmf_flowring_create(struct brcmf_f
  7768. - }
  7769. -
  7770. -
  7771. --u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u8 flowid)
  7772. -+u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u16 flowid)
  7773. - {
  7774. - struct brcmf_flowring_ring *ring;
  7775. -
  7776. -@@ -179,7 +183,7 @@ u8 brcmf_flowring_tid(struct brcmf_flowr
  7777. - }
  7778. -
  7779. -
  7780. --static void brcmf_flowring_block(struct brcmf_flowring *flow, u8 flowid,
  7781. -+static void brcmf_flowring_block(struct brcmf_flowring *flow, u16 flowid,
  7782. - bool blocked)
  7783. - {
  7784. - struct brcmf_flowring_ring *ring;
  7785. -@@ -228,10 +232,10 @@ static void brcmf_flowring_block(struct
  7786. - }
  7787. -
  7788. -
  7789. --void brcmf_flowring_delete(struct brcmf_flowring *flow, u8 flowid)
  7790. -+void brcmf_flowring_delete(struct brcmf_flowring *flow, u16 flowid)
  7791. - {
  7792. - struct brcmf_flowring_ring *ring;
  7793. -- u8 hash_idx;
  7794. -+ u16 hash_idx;
  7795. - struct sk_buff *skb;
  7796. -
  7797. - ring = flow->rings[flowid];
  7798. -@@ -253,7 +257,7 @@ void brcmf_flowring_delete(struct brcmf_
  7799. - }
  7800. -
  7801. -
  7802. --u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  7803. -+u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u16 flowid,
  7804. - struct sk_buff *skb)
  7805. - {
  7806. - struct brcmf_flowring_ring *ring;
  7807. -@@ -279,7 +283,7 @@ u32 brcmf_flowring_enqueue(struct brcmf_
  7808. - }
  7809. -
  7810. -
  7811. --struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u8 flowid)
  7812. -+struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u16 flowid)
  7813. - {
  7814. - struct brcmf_flowring_ring *ring;
  7815. - struct sk_buff *skb;
  7816. -@@ -300,7 +304,7 @@ struct sk_buff *brcmf_flowring_dequeue(s
  7817. - }
  7818. -
  7819. -
  7820. --void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u8 flowid,
  7821. -+void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u16 flowid,
  7822. - struct sk_buff *skb)
  7823. - {
  7824. - struct brcmf_flowring_ring *ring;
  7825. -@@ -311,7 +315,7 @@ void brcmf_flowring_reinsert(struct brcm
  7826. - }
  7827. -
  7828. -
  7829. --u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u8 flowid)
  7830. -+u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u16 flowid)
  7831. - {
  7832. - struct brcmf_flowring_ring *ring;
  7833. -
  7834. -@@ -326,7 +330,7 @@ u32 brcmf_flowring_qlen(struct brcmf_flo
  7835. - }
  7836. -
  7837. -
  7838. --void brcmf_flowring_open(struct brcmf_flowring *flow, u8 flowid)
  7839. -+void brcmf_flowring_open(struct brcmf_flowring *flow, u16 flowid)
  7840. - {
  7841. - struct brcmf_flowring_ring *ring;
  7842. -
  7843. -@@ -340,10 +344,10 @@ void brcmf_flowring_open(struct brcmf_fl
  7844. - }
  7845. -
  7846. -
  7847. --u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u8 flowid)
  7848. -+u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u16 flowid)
  7849. - {
  7850. - struct brcmf_flowring_ring *ring;
  7851. -- u8 hash_idx;
  7852. -+ u16 hash_idx;
  7853. -
  7854. - ring = flow->rings[flowid];
  7855. - hash_idx = ring->hash_id;
  7856. -@@ -384,7 +388,7 @@ void brcmf_flowring_detach(struct brcmf_
  7857. - struct brcmf_pub *drvr = bus_if->drvr;
  7858. - struct brcmf_flowring_tdls_entry *search;
  7859. - struct brcmf_flowring_tdls_entry *remove;
  7860. -- u8 flowid;
  7861. -+ u16 flowid;
  7862. -
  7863. - for (flowid = 0; flowid < flow->nrofrings; flowid++) {
  7864. - if (flow->rings[flowid])
  7865. -@@ -408,7 +412,7 @@ void brcmf_flowring_configure_addr_mode(
  7866. - struct brcmf_bus *bus_if = dev_get_drvdata(flow->dev);
  7867. - struct brcmf_pub *drvr = bus_if->drvr;
  7868. - u32 i;
  7869. -- u8 flowid;
  7870. -+ u16 flowid;
  7871. -
  7872. - if (flow->addr_mode[ifidx] != addr_mode) {
  7873. - for (i = 0; i < ARRAY_SIZE(flow->hash); i++) {
  7874. -@@ -434,7 +438,7 @@ void brcmf_flowring_delete_peer(struct b
  7875. - struct brcmf_flowring_tdls_entry *prev;
  7876. - struct brcmf_flowring_tdls_entry *search;
  7877. - u32 i;
  7878. -- u8 flowid;
  7879. -+ u16 flowid;
  7880. - bool sta;
  7881. -
  7882. - sta = (flow->addr_mode[ifidx] == ADDR_INDIRECT);
  7883. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.h
  7884. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.h
  7885. -@@ -16,7 +16,7 @@
  7886. - #define BRCMFMAC_FLOWRING_H
  7887. -
  7888. -
  7889. --#define BRCMF_FLOWRING_HASHSIZE 256
  7890. -+#define BRCMF_FLOWRING_HASHSIZE 512 /* has to be 2^x */
  7891. - #define BRCMF_FLOWRING_INVALID_ID 0xFFFFFFFF
  7892. -
  7893. -
  7894. -@@ -24,7 +24,7 @@ struct brcmf_flowring_hash {
  7895. - u8 mac[ETH_ALEN];
  7896. - u8 fifo;
  7897. - u8 ifidx;
  7898. -- u8 flowid;
  7899. -+ u16 flowid;
  7900. - };
  7901. -
  7902. - enum ring_status {
  7903. -@@ -61,16 +61,16 @@ u32 brcmf_flowring_lookup(struct brcmf_f
  7904. - u8 prio, u8 ifidx);
  7905. - u32 brcmf_flowring_create(struct brcmf_flowring *flow, u8 da[ETH_ALEN],
  7906. - u8 prio, u8 ifidx);
  7907. --void brcmf_flowring_delete(struct brcmf_flowring *flow, u8 flowid);
  7908. --void brcmf_flowring_open(struct brcmf_flowring *flow, u8 flowid);
  7909. --u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u8 flowid);
  7910. --u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  7911. -+void brcmf_flowring_delete(struct brcmf_flowring *flow, u16 flowid);
  7912. -+void brcmf_flowring_open(struct brcmf_flowring *flow, u16 flowid);
  7913. -+u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u16 flowid);
  7914. -+u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u16 flowid,
  7915. - struct sk_buff *skb);
  7916. --struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u8 flowid);
  7917. --void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u8 flowid,
  7918. -+struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u16 flowid);
  7919. -+void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u16 flowid,
  7920. - struct sk_buff *skb);
  7921. --u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u8 flowid);
  7922. --u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u8 flowid);
  7923. -+u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u16 flowid);
  7924. -+u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u16 flowid);
  7925. - struct brcmf_flowring *brcmf_flowring_attach(struct device *dev, u16 nrofrings);
  7926. - void brcmf_flowring_detach(struct brcmf_flowring *flow);
  7927. - void brcmf_flowring_configure_addr_mode(struct brcmf_flowring *flow, int ifidx,
  7928. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  7929. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  7930. -@@ -677,7 +677,7 @@ static u32 brcmf_msgbuf_flowring_create(
  7931. - }
  7932. -
  7933. -
  7934. --static void brcmf_msgbuf_txflow(struct brcmf_msgbuf *msgbuf, u8 flowid)
  7935. -+static void brcmf_msgbuf_txflow(struct brcmf_msgbuf *msgbuf, u16 flowid)
  7936. - {
  7937. - struct brcmf_flowring *flow = msgbuf->flow;
  7938. - struct brcmf_commonring *commonring;
  7939. -@@ -1310,7 +1310,7 @@ int brcmf_proto_msgbuf_rx_trigger(struct
  7940. - }
  7941. -
  7942. -
  7943. --void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u8 flowid)
  7944. -+void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u16 flowid)
  7945. - {
  7946. - struct brcmf_msgbuf *msgbuf = (struct brcmf_msgbuf *)drvr->proto->pd;
  7947. - struct msgbuf_tx_flowring_delete_req *delete;
  7948. -@@ -1415,6 +1415,13 @@ int brcmf_proto_msgbuf_attach(struct brc
  7949. - u32 count;
  7950. -
  7951. - if_msgbuf = drvr->bus_if->msgbuf;
  7952. -+
  7953. -+ if (if_msgbuf->nrof_flowrings >= BRCMF_FLOWRING_HASHSIZE) {
  7954. -+ brcmf_err("driver not configured for this many flowrings %d\n",
  7955. -+ if_msgbuf->nrof_flowrings);
  7956. -+ if_msgbuf->nrof_flowrings = BRCMF_FLOWRING_HASHSIZE - 1;
  7957. -+ }
  7958. -+
  7959. - msgbuf = kzalloc(sizeof(*msgbuf), GFP_KERNEL);
  7960. - if (!msgbuf)
  7961. - goto fail;
  7962. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.h
  7963. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.h
  7964. -@@ -33,7 +33,7 @@
  7965. -
  7966. -
  7967. - int brcmf_proto_msgbuf_rx_trigger(struct device *dev);
  7968. --void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u8 flowid);
  7969. -+void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u16 flowid);
  7970. - int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr);
  7971. - void brcmf_proto_msgbuf_detach(struct brcmf_pub *drvr);
  7972. - #else
  7973. 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
  7974. new file mode 100644
  7975. index 0000000..5d8a8fb
  7976. --- /dev/null
  7977. +++ b/package/kernel/mac80211/patches/331-mac80211-End-the-MPSP-even-if-EOSP-frame-was-not-rec.patch
  7978. @@ -0,0 +1,42 @@
  7979. +From: Masashi Honma <masashi.honma@gmail.com>
  7980. +Date: Wed, 13 Jul 2016 16:04:35 +0900
  7981. +Subject: [PATCH] mac80211: End the MPSP even if EOSP frame was not received
  7982. +
  7983. +The mesh STA sends QoS frame with EOSP (end of service period)
  7984. +subfiled=1 to end the MPSP(mesh peer service period). Previously, if
  7985. +the frame was not acked by peer, the mesh STA did not end the MPSP.
  7986. +This patch ends the MPSP even if the QoS frame was no acked.
  7987. +
  7988. +Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
  7989. +---
  7990. +
  7991. +--- a/net/mac80211/status.c
  7992. ++++ b/net/mac80211/status.c
  7993. +@@ -784,6 +784,13 @@ void ieee80211_tx_status(struct ieee8021
  7994. + clear_sta_flag(sta, WLAN_STA_SP);
  7995. +
  7996. + acked = !!(info->flags & IEEE80211_TX_STAT_ACK);
  7997. ++
  7998. ++ /* mesh Peer Service Period support */
  7999. ++ if (ieee80211_vif_is_mesh(&sta->sdata->vif) &&
  8000. ++ ieee80211_is_data_qos(fc))
  8001. ++ ieee80211_mpsp_trigger_process(
  8002. ++ ieee80211_get_qos_ctl(hdr), sta, true, acked);
  8003. ++
  8004. + if (!acked && test_sta_flag(sta, WLAN_STA_PS_STA)) {
  8005. + /*
  8006. + * The STA is in power save mode, so assume
  8007. +@@ -794,13 +801,6 @@ void ieee80211_tx_status(struct ieee8021
  8008. + return;
  8009. + }
  8010. +
  8011. +- /* mesh Peer Service Period support */
  8012. +- if (ieee80211_vif_is_mesh(&sta->sdata->vif) &&
  8013. +- ieee80211_is_data_qos(fc))
  8014. +- ieee80211_mpsp_trigger_process(
  8015. +- ieee80211_get_qos_ctl(hdr),
  8016. +- sta, true, acked);
  8017. +-
  8018. + if (ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL) &&
  8019. + (ieee80211_is_data(hdr->frame_control)) &&
  8020. + (rates_idx != -1))
  8021. diff --git a/package/kernel/mac80211/patches/332-ath10k-implement-NAPI-support.patch b/package/kernel/mac80211/patches/332-ath10k-implement-NAPI-support.patch
  8022. new file mode 100644
  8023. index 0000000..c6cc145
  8024. --- /dev/null
  8025. +++ b/package/kernel/mac80211/patches/332-ath10k-implement-NAPI-support.patch
  8026. @@ -0,0 +1,642 @@
  8027. +From: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
  8028. +Date: Thu, 21 Jul 2016 11:50:00 +0530
  8029. +Subject: [PATCH] ath10k: implement NAPI support
  8030. +
  8031. +Add NAPI support for rx and tx completion. NAPI poll is scheduled
  8032. +from interrupt handler. The design is as below
  8033. +
  8034. + - on interrupt
  8035. + - schedule napi and mask interrupts
  8036. + - on poll
  8037. + - process all pipes (no actual Tx/Rx)
  8038. + - process Rx within budget
  8039. + - if quota exceeds budget reschedule napi poll by returning budget
  8040. + - process Tx completions and update budget if necessary
  8041. + - process Tx fetch indications (pull-push)
  8042. + - push any other pending Tx (if possible)
  8043. + - before resched or napi completion replenish htt rx ring buffer
  8044. + - if work done < budget, complete napi poll and unmask interrupts
  8045. +
  8046. +This change also get rid of two tasklets (intr_tq and txrx_compl_task).
  8047. +
  8048. +Measured peak throughput with NAPI on IPQ4019 platform in controlled
  8049. +environment. No noticeable reduction in throughput is seen and also
  8050. +observed improvements in CPU usage. Approx. 15% CPU usage got reduced
  8051. +in UDP uplink case.
  8052. +
  8053. +DL: AP DUT Tx
  8054. +UL: AP DUT Rx
  8055. +
  8056. +IPQ4019 (avg. cpu usage %)
  8057. +========
  8058. + TOT +NAPI
  8059. + =========== =============
  8060. +TCP DL 644 Mbps (42%) 645 Mbps (36%)
  8061. +TCP UL 673 Mbps (30%) 675 Mbps (26%)
  8062. +UDP DL 682 Mbps (49%) 680 Mbps (49%)
  8063. +UDP UL 720 Mbps (28%) 717 Mbps (11%)
  8064. +
  8065. +Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
  8066. +---
  8067. +
  8068. +--- a/drivers/net/wireless/ath/ath10k/ahb.c
  8069. ++++ b/drivers/net/wireless/ath/ath10k/ahb.c
  8070. +@@ -462,13 +462,13 @@ static void ath10k_ahb_halt_chip(struct
  8071. + static irqreturn_t ath10k_ahb_interrupt_handler(int irq, void *arg)
  8072. + {
  8073. + struct ath10k *ar = arg;
  8074. +- struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
  8075. +
  8076. + if (!ath10k_pci_irq_pending(ar))
  8077. + return IRQ_NONE;
  8078. +
  8079. + ath10k_pci_disable_and_clear_legacy_irq(ar);
  8080. +- tasklet_schedule(&ar_pci->intr_tq);
  8081. ++ ath10k_pci_irq_msi_fw_mask(ar);
  8082. ++ napi_schedule(&ar->napi);
  8083. +
  8084. + return IRQ_HANDLED;
  8085. + }
  8086. +@@ -831,7 +831,7 @@ static int ath10k_ahb_probe(struct platf
  8087. + goto err_resource_deinit;
  8088. + }
  8089. +
  8090. +- ath10k_pci_init_irq_tasklets(ar);
  8091. ++ ath10k_pci_init_napi(ar);
  8092. +
  8093. + ret = ath10k_ahb_request_irq_legacy(ar);
  8094. + if (ret)
  8095. +--- a/drivers/net/wireless/ath/ath10k/core.c
  8096. ++++ b/drivers/net/wireless/ath/ath10k/core.c
  8097. +@@ -2226,6 +2226,8 @@ struct ath10k *ath10k_core_create(size_t
  8098. + INIT_WORK(&ar->register_work, ath10k_core_register_work);
  8099. + INIT_WORK(&ar->restart_work, ath10k_core_restart);
  8100. +
  8101. ++ init_dummy_netdev(&ar->napi_dev);
  8102. ++
  8103. + ret = ath10k_debug_create(ar);
  8104. + if (ret)
  8105. + goto err_free_aux_wq;
  8106. +--- a/drivers/net/wireless/ath/ath10k/core.h
  8107. ++++ b/drivers/net/wireless/ath/ath10k/core.h
  8108. +@@ -65,6 +65,10 @@
  8109. + #define ATH10K_KEEPALIVE_MAX_IDLE 3895
  8110. + #define ATH10K_KEEPALIVE_MAX_UNRESPONSIVE 3900
  8111. +
  8112. ++/* NAPI poll budget */
  8113. ++#define ATH10K_NAPI_BUDGET 64
  8114. ++#define ATH10K_NAPI_QUOTA_LIMIT 60
  8115. ++
  8116. + struct ath10k;
  8117. +
  8118. + enum ath10k_bus {
  8119. +@@ -933,6 +937,10 @@ struct ath10k {
  8120. + struct ath10k_thermal thermal;
  8121. + struct ath10k_wow wow;
  8122. +
  8123. ++ /* NAPI */
  8124. ++ struct net_device napi_dev;
  8125. ++ struct napi_struct napi;
  8126. ++
  8127. + /* must be last */
  8128. + u8 drv_priv[0] __aligned(sizeof(void *));
  8129. + };
  8130. +--- a/drivers/net/wireless/ath/ath10k/htt.h
  8131. ++++ b/drivers/net/wireless/ath/ath10k/htt.h
  8132. +@@ -1666,7 +1666,6 @@ struct ath10k_htt {
  8133. +
  8134. + /* This is used to group tx/rx completions separately and process them
  8135. + * in batches to reduce cache stalls */
  8136. +- struct tasklet_struct txrx_compl_task;
  8137. + struct sk_buff_head rx_compl_q;
  8138. + struct sk_buff_head rx_in_ord_compl_q;
  8139. + struct sk_buff_head tx_fetch_ind_q;
  8140. +@@ -1799,5 +1798,6 @@ int ath10k_htt_tx(struct ath10k_htt *htt
  8141. + struct sk_buff *msdu);
  8142. + void ath10k_htt_rx_pktlog_completion_handler(struct ath10k *ar,
  8143. + struct sk_buff *skb);
  8144. ++int ath10k_htt_txrx_compl_task(struct ath10k *ar, int budget);
  8145. +
  8146. + #endif
  8147. +--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
  8148. ++++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
  8149. +@@ -34,7 +34,6 @@
  8150. + #define HTT_RX_RING_REFILL_RESCHED_MS 5
  8151. +
  8152. + static int ath10k_htt_rx_get_csum_state(struct sk_buff *skb);
  8153. +-static void ath10k_htt_txrx_compl_task(unsigned long ptr);
  8154. +
  8155. + static struct sk_buff *
  8156. + ath10k_htt_rx_find_skb_paddr(struct ath10k *ar, u32 paddr)
  8157. +@@ -226,7 +225,6 @@ int ath10k_htt_rx_ring_refill(struct ath
  8158. + void ath10k_htt_rx_free(struct ath10k_htt *htt)
  8159. + {
  8160. + del_timer_sync(&htt->rx_ring.refill_retry_timer);
  8161. +- tasklet_kill(&htt->txrx_compl_task);
  8162. +
  8163. + skb_queue_purge(&htt->rx_compl_q);
  8164. + skb_queue_purge(&htt->rx_in_ord_compl_q);
  8165. +@@ -520,9 +518,6 @@ int ath10k_htt_rx_alloc(struct ath10k_ht
  8166. + skb_queue_head_init(&htt->tx_fetch_ind_q);
  8167. + atomic_set(&htt->num_mpdus_ready, 0);
  8168. +
  8169. +- tasklet_init(&htt->txrx_compl_task, ath10k_htt_txrx_compl_task,
  8170. +- (unsigned long)htt);
  8171. +-
  8172. + ath10k_dbg(ar, ATH10K_DBG_BOOT, "htt rx ring size %d fill_level %d\n",
  8173. + htt->rx_ring.size, htt->rx_ring.fill_level);
  8174. + return 0;
  8175. +@@ -958,7 +953,7 @@ static void ath10k_process_rx(struct ath
  8176. + trace_ath10k_rx_hdr(ar, skb->data, skb->len);
  8177. + trace_ath10k_rx_payload(ar, skb->data, skb->len);
  8178. +
  8179. +- ieee80211_rx(ar->hw, skb);
  8180. ++ ieee80211_rx_napi(ar->hw, NULL, skb, &ar->napi);
  8181. + }
  8182. +
  8183. + static int ath10k_htt_rx_nwifi_hdrlen(struct ath10k *ar,
  8184. +@@ -1527,7 +1522,7 @@ static int ath10k_htt_rx_handle_amsdu(st
  8185. + struct ath10k *ar = htt->ar;
  8186. + struct ieee80211_rx_status *rx_status = &htt->rx_status;
  8187. + struct sk_buff_head amsdu;
  8188. +- int ret;
  8189. ++ int ret, num_msdus;
  8190. +
  8191. + __skb_queue_head_init(&amsdu);
  8192. +
  8193. +@@ -1549,13 +1544,14 @@ static int ath10k_htt_rx_handle_amsdu(st
  8194. + return ret;
  8195. + }
  8196. +
  8197. ++ num_msdus = skb_queue_len(&amsdu);
  8198. + ath10k_htt_rx_h_ppdu(ar, &amsdu, rx_status, 0xffff);
  8199. + ath10k_htt_rx_h_unchain(ar, &amsdu, ret > 0);
  8200. + ath10k_htt_rx_h_filter(ar, &amsdu, rx_status);
  8201. + ath10k_htt_rx_h_mpdu(ar, &amsdu, rx_status);
  8202. + ath10k_htt_rx_h_deliver(ar, &amsdu, rx_status);
  8203. +
  8204. +- return 0;
  8205. ++ return num_msdus;
  8206. + }
  8207. +
  8208. + static void ath10k_htt_rx_proc_rx_ind(struct ath10k_htt *htt,
  8209. +@@ -1579,15 +1575,6 @@ static void ath10k_htt_rx_proc_rx_ind(st
  8210. + mpdu_count += mpdu_ranges[i].mpdu_count;
  8211. +
  8212. + atomic_add(mpdu_count, &htt->num_mpdus_ready);
  8213. +-
  8214. +- tasklet_schedule(&htt->txrx_compl_task);
  8215. +-}
  8216. +-
  8217. +-static void ath10k_htt_rx_frag_handler(struct ath10k_htt *htt)
  8218. +-{
  8219. +- atomic_inc(&htt->num_mpdus_ready);
  8220. +-
  8221. +- tasklet_schedule(&htt->txrx_compl_task);
  8222. + }
  8223. +
  8224. + static void ath10k_htt_rx_tx_compl_ind(struct ath10k *ar,
  8225. +@@ -1772,14 +1759,15 @@ static void ath10k_htt_rx_h_rx_offload_p
  8226. + RX_FLAG_MMIC_STRIPPED;
  8227. + }
  8228. +
  8229. +-static void ath10k_htt_rx_h_rx_offload(struct ath10k *ar,
  8230. +- struct sk_buff_head *list)
  8231. ++static int ath10k_htt_rx_h_rx_offload(struct ath10k *ar,
  8232. ++ struct sk_buff_head *list)
  8233. + {
  8234. + struct ath10k_htt *htt = &ar->htt;
  8235. + struct ieee80211_rx_status *status = &htt->rx_status;
  8236. + struct htt_rx_offload_msdu *rx;
  8237. + struct sk_buff *msdu;
  8238. + size_t offset;
  8239. ++ int num_msdu = 0;
  8240. +
  8241. + while ((msdu = __skb_dequeue(list))) {
  8242. + /* Offloaded frames don't have Rx descriptor. Instead they have
  8243. +@@ -1819,10 +1807,12 @@ static void ath10k_htt_rx_h_rx_offload(s
  8244. + ath10k_htt_rx_h_rx_offload_prot(status, msdu);
  8245. + ath10k_htt_rx_h_channel(ar, status, NULL, rx->vdev_id);
  8246. + ath10k_process_rx(ar, status, msdu);
  8247. ++ num_msdu++;
  8248. + }
  8249. ++ return num_msdu;
  8250. + }
  8251. +
  8252. +-static void ath10k_htt_rx_in_ord_ind(struct ath10k *ar, struct sk_buff *skb)
  8253. ++static int ath10k_htt_rx_in_ord_ind(struct ath10k *ar, struct sk_buff *skb)
  8254. + {
  8255. + struct ath10k_htt *htt = &ar->htt;
  8256. + struct htt_resp *resp = (void *)skb->data;
  8257. +@@ -1835,12 +1825,12 @@ static void ath10k_htt_rx_in_ord_ind(str
  8258. + u8 tid;
  8259. + bool offload;
  8260. + bool frag;
  8261. +- int ret;
  8262. ++ int ret, num_msdus = 0;
  8263. +
  8264. + lockdep_assert_held(&htt->rx_ring.lock);
  8265. +
  8266. + if (htt->rx_confused)
  8267. +- return;
  8268. ++ return -EIO;
  8269. +
  8270. + skb_pull(skb, sizeof(resp->hdr));
  8271. + skb_pull(skb, sizeof(resp->rx_in_ord_ind));
  8272. +@@ -1859,7 +1849,7 @@ static void ath10k_htt_rx_in_ord_ind(str
  8273. +
  8274. + if (skb->len < msdu_count * sizeof(*resp->rx_in_ord_ind.msdu_descs)) {
  8275. + ath10k_warn(ar, "dropping invalid in order rx indication\n");
  8276. +- return;
  8277. ++ return -EINVAL;
  8278. + }
  8279. +
  8280. + /* The event can deliver more than 1 A-MSDU. Each A-MSDU is later
  8281. +@@ -1870,14 +1860,14 @@ static void ath10k_htt_rx_in_ord_ind(str
  8282. + if (ret < 0) {
  8283. + ath10k_warn(ar, "failed to pop paddr list: %d\n", ret);
  8284. + htt->rx_confused = true;
  8285. +- return;
  8286. ++ return -EIO;
  8287. + }
  8288. +
  8289. + /* Offloaded frames are very different and need to be handled
  8290. + * separately.
  8291. + */
  8292. + if (offload)
  8293. +- ath10k_htt_rx_h_rx_offload(ar, &list);
  8294. ++ num_msdus = ath10k_htt_rx_h_rx_offload(ar, &list);
  8295. +
  8296. + while (!skb_queue_empty(&list)) {
  8297. + __skb_queue_head_init(&amsdu);
  8298. +@@ -1890,6 +1880,7 @@ static void ath10k_htt_rx_in_ord_ind(str
  8299. + * better to report something than nothing though. This
  8300. + * should still give an idea about rx rate to the user.
  8301. + */
  8302. ++ num_msdus += skb_queue_len(&amsdu);
  8303. + ath10k_htt_rx_h_ppdu(ar, &amsdu, status, vdev_id);
  8304. + ath10k_htt_rx_h_filter(ar, &amsdu, status);
  8305. + ath10k_htt_rx_h_mpdu(ar, &amsdu, status);
  8306. +@@ -1902,9 +1893,10 @@ static void ath10k_htt_rx_in_ord_ind(str
  8307. + ath10k_warn(ar, "failed to extract amsdu: %d\n", ret);
  8308. + htt->rx_confused = true;
  8309. + __skb_queue_purge(&list);
  8310. +- return;
  8311. ++ return -EIO;
  8312. + }
  8313. + }
  8314. ++ return num_msdus;
  8315. + }
  8316. +
  8317. + static void ath10k_htt_rx_tx_fetch_resp_id_confirm(struct ath10k *ar,
  8318. +@@ -2267,7 +2259,6 @@ bool ath10k_htt_t2h_msg_handler(struct a
  8319. + }
  8320. + case HTT_T2H_MSG_TYPE_TX_COMPL_IND:
  8321. + ath10k_htt_rx_tx_compl_ind(htt->ar, skb);
  8322. +- tasklet_schedule(&htt->txrx_compl_task);
  8323. + break;
  8324. + case HTT_T2H_MSG_TYPE_SEC_IND: {
  8325. + struct ath10k *ar = htt->ar;
  8326. +@@ -2284,7 +2275,7 @@ bool ath10k_htt_t2h_msg_handler(struct a
  8327. + case HTT_T2H_MSG_TYPE_RX_FRAG_IND: {
  8328. + ath10k_dbg_dump(ar, ATH10K_DBG_HTT_DUMP, NULL, "htt event: ",
  8329. + skb->data, skb->len);
  8330. +- ath10k_htt_rx_frag_handler(htt);
  8331. ++ atomic_inc(&htt->num_mpdus_ready);
  8332. + break;
  8333. + }
  8334. + case HTT_T2H_MSG_TYPE_TEST:
  8335. +@@ -2322,8 +2313,7 @@ bool ath10k_htt_t2h_msg_handler(struct a
  8336. + break;
  8337. + }
  8338. + case HTT_T2H_MSG_TYPE_RX_IN_ORD_PADDR_IND: {
  8339. +- skb_queue_tail(&htt->rx_in_ord_compl_q, skb);
  8340. +- tasklet_schedule(&htt->txrx_compl_task);
  8341. ++ __skb_queue_tail(&htt->rx_in_ord_compl_q, skb);
  8342. + return false;
  8343. + }
  8344. + case HTT_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND:
  8345. +@@ -2349,7 +2339,6 @@ bool ath10k_htt_t2h_msg_handler(struct a
  8346. + break;
  8347. + }
  8348. + skb_queue_tail(&htt->tx_fetch_ind_q, tx_fetch_ind);
  8349. +- tasklet_schedule(&htt->txrx_compl_task);
  8350. + break;
  8351. + }
  8352. + case HTT_T2H_MSG_TYPE_TX_FETCH_CONFIRM:
  8353. +@@ -2378,27 +2367,77 @@ void ath10k_htt_rx_pktlog_completion_han
  8354. + }
  8355. + EXPORT_SYMBOL(ath10k_htt_rx_pktlog_completion_handler);
  8356. +
  8357. +-static void ath10k_htt_txrx_compl_task(unsigned long ptr)
  8358. ++int ath10k_htt_txrx_compl_task(struct ath10k *ar, int budget)
  8359. + {
  8360. +- struct ath10k_htt *htt = (struct ath10k_htt *)ptr;
  8361. +- struct ath10k *ar = htt->ar;
  8362. ++ struct ath10k_htt *htt = &ar->htt;
  8363. + struct htt_tx_done tx_done = {};
  8364. +- struct sk_buff_head rx_ind_q;
  8365. + struct sk_buff_head tx_ind_q;
  8366. + struct sk_buff *skb;
  8367. + unsigned long flags;
  8368. +- int num_mpdus;
  8369. ++ int quota = 0, done, num_rx_msdus;
  8370. ++ bool resched_napi = false;
  8371. +
  8372. +- __skb_queue_head_init(&rx_ind_q);
  8373. + __skb_queue_head_init(&tx_ind_q);
  8374. +
  8375. +- spin_lock_irqsave(&htt->rx_in_ord_compl_q.lock, flags);
  8376. +- skb_queue_splice_init(&htt->rx_in_ord_compl_q, &rx_ind_q);
  8377. +- spin_unlock_irqrestore(&htt->rx_in_ord_compl_q.lock, flags);
  8378. ++ /* Since in-ord-ind can deliver more than 1 A-MSDU in single event,
  8379. ++ * process it first to utilize full available quota.
  8380. ++ */
  8381. ++ while (quota < budget) {
  8382. ++ if (skb_queue_empty(&htt->rx_in_ord_compl_q))
  8383. ++ break;
  8384. +
  8385. +- spin_lock_irqsave(&htt->tx_fetch_ind_q.lock, flags);
  8386. +- skb_queue_splice_init(&htt->tx_fetch_ind_q, &tx_ind_q);
  8387. +- spin_unlock_irqrestore(&htt->tx_fetch_ind_q.lock, flags);
  8388. ++ skb = __skb_dequeue(&htt->rx_in_ord_compl_q);
  8389. ++ if (!skb) {
  8390. ++ resched_napi = true;
  8391. ++ goto exit;
  8392. ++ }
  8393. ++
  8394. ++ spin_lock_bh(&htt->rx_ring.lock);
  8395. ++ num_rx_msdus = ath10k_htt_rx_in_ord_ind(ar, skb);
  8396. ++ spin_unlock_bh(&htt->rx_ring.lock);
  8397. ++ if (num_rx_msdus < 0) {
  8398. ++ resched_napi = true;
  8399. ++ goto exit;
  8400. ++ }
  8401. ++
  8402. ++ dev_kfree_skb_any(skb);
  8403. ++ if (num_rx_msdus > 0)
  8404. ++ quota += num_rx_msdus;
  8405. ++
  8406. ++ if ((quota > ATH10K_NAPI_QUOTA_LIMIT) &&
  8407. ++ !skb_queue_empty(&htt->rx_in_ord_compl_q)) {
  8408. ++ resched_napi = true;
  8409. ++ goto exit;
  8410. ++ }
  8411. ++ }
  8412. ++
  8413. ++ while (quota < budget) {
  8414. ++ /* no more data to receive */
  8415. ++ if (!atomic_read(&htt->num_mpdus_ready))
  8416. ++ break;
  8417. ++
  8418. ++ num_rx_msdus = ath10k_htt_rx_handle_amsdu(htt);
  8419. ++ if (num_rx_msdus < 0) {
  8420. ++ resched_napi = true;
  8421. ++ goto exit;
  8422. ++ }
  8423. ++
  8424. ++ quota += num_rx_msdus;
  8425. ++ atomic_dec(&htt->num_mpdus_ready);
  8426. ++ if ((quota > ATH10K_NAPI_QUOTA_LIMIT) &&
  8427. ++ atomic_read(&htt->num_mpdus_ready)) {
  8428. ++ resched_napi = true;
  8429. ++ goto exit;
  8430. ++ }
  8431. ++ }
  8432. ++
  8433. ++ /* From NAPI documentation:
  8434. ++ * The napi poll() function may also process TX completions, in which
  8435. ++ * case if it processes the entire TX ring then it should count that
  8436. ++ * work as the rest of the budget.
  8437. ++ */
  8438. ++ if ((quota < budget) && !kfifo_is_empty(&htt->txdone_fifo))
  8439. ++ quota = budget;
  8440. +
  8441. + /* kfifo_get: called only within txrx_tasklet so it's neatly serialized.
  8442. + * From kfifo_get() documentation:
  8443. +@@ -2408,27 +2447,22 @@ static void ath10k_htt_txrx_compl_task(u
  8444. + while (kfifo_get(&htt->txdone_fifo, &tx_done))
  8445. + ath10k_txrx_tx_unref(htt, &tx_done);
  8446. +
  8447. ++ spin_lock_irqsave(&htt->tx_fetch_ind_q.lock, flags);
  8448. ++ skb_queue_splice_init(&htt->tx_fetch_ind_q, &tx_ind_q);
  8449. ++ spin_unlock_irqrestore(&htt->tx_fetch_ind_q.lock, flags);
  8450. ++
  8451. + while ((skb = __skb_dequeue(&tx_ind_q))) {
  8452. + ath10k_htt_rx_tx_fetch_ind(ar, skb);
  8453. + dev_kfree_skb_any(skb);
  8454. + }
  8455. +
  8456. +- num_mpdus = atomic_read(&htt->num_mpdus_ready);
  8457. +-
  8458. +- while (num_mpdus) {
  8459. +- if (ath10k_htt_rx_handle_amsdu(htt))
  8460. +- break;
  8461. +-
  8462. +- num_mpdus--;
  8463. +- atomic_dec(&htt->num_mpdus_ready);
  8464. +- }
  8465. +-
  8466. +- while ((skb = __skb_dequeue(&rx_ind_q))) {
  8467. +- spin_lock_bh(&htt->rx_ring.lock);
  8468. +- ath10k_htt_rx_in_ord_ind(ar, skb);
  8469. +- spin_unlock_bh(&htt->rx_ring.lock);
  8470. +- dev_kfree_skb_any(skb);
  8471. +- }
  8472. +-
  8473. ++exit:
  8474. + ath10k_htt_rx_msdu_buff_replenish(htt);
  8475. ++ /* In case of rx failure or more data to read, report budget
  8476. ++ * to reschedule NAPI poll
  8477. ++ */
  8478. ++ done = resched_napi ? budget : quota;
  8479. ++
  8480. ++ return done;
  8481. + }
  8482. ++EXPORT_SYMBOL(ath10k_htt_txrx_compl_task);
  8483. +--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
  8484. ++++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
  8485. +@@ -388,8 +388,6 @@ void ath10k_htt_tx_free(struct ath10k_ht
  8486. + {
  8487. + int size;
  8488. +
  8489. +- tasklet_kill(&htt->txrx_compl_task);
  8490. +-
  8491. + idr_for_each(&htt->pending_tx, ath10k_htt_tx_clean_up_pending, htt->ar);
  8492. + idr_destroy(&htt->pending_tx);
  8493. +
  8494. +--- a/drivers/net/wireless/ath/ath10k/pci.c
  8495. ++++ b/drivers/net/wireless/ath/ath10k/pci.c
  8496. +@@ -1502,12 +1502,10 @@ void ath10k_pci_hif_send_complete_check(
  8497. + ath10k_ce_per_engine_service(ar, pipe);
  8498. + }
  8499. +
  8500. +-void ath10k_pci_kill_tasklet(struct ath10k *ar)
  8501. ++static void ath10k_pci_rx_retry_sync(struct ath10k *ar)
  8502. + {
  8503. + struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
  8504. +
  8505. +- tasklet_kill(&ar_pci->intr_tq);
  8506. +-
  8507. + del_timer_sync(&ar_pci->rx_post_retry);
  8508. + }
  8509. +
  8510. +@@ -1566,7 +1564,7 @@ void ath10k_pci_hif_get_default_pipe(str
  8511. + ul_pipe, dl_pipe);
  8512. + }
  8513. +
  8514. +-static void ath10k_pci_irq_msi_fw_mask(struct ath10k *ar)
  8515. ++void ath10k_pci_irq_msi_fw_mask(struct ath10k *ar)
  8516. + {
  8517. + u32 val;
  8518. +
  8519. +@@ -1747,7 +1745,7 @@ void ath10k_pci_ce_deinit(struct ath10k
  8520. +
  8521. + void ath10k_pci_flush(struct ath10k *ar)
  8522. + {
  8523. +- ath10k_pci_kill_tasklet(ar);
  8524. ++ ath10k_pci_rx_retry_sync(ar);
  8525. + ath10k_pci_buffer_cleanup(ar);
  8526. + }
  8527. +
  8528. +@@ -2754,35 +2752,53 @@ static irqreturn_t ath10k_pci_interrupt_
  8529. + return IRQ_NONE;
  8530. + }
  8531. +
  8532. +- if (ar_pci->oper_irq_mode == ATH10K_PCI_IRQ_LEGACY) {
  8533. +- if (!ath10k_pci_irq_pending(ar))
  8534. +- return IRQ_NONE;
  8535. +-
  8536. +- ath10k_pci_disable_and_clear_legacy_irq(ar);
  8537. +- }
  8538. ++ if ((ar_pci->oper_irq_mode == ATH10K_PCI_IRQ_LEGACY) &&
  8539. ++ !ath10k_pci_irq_pending(ar))
  8540. ++ return IRQ_NONE;
  8541. +
  8542. +- tasklet_schedule(&ar_pci->intr_tq);
  8543. ++ ath10k_pci_disable_and_clear_legacy_irq(ar);
  8544. ++ ath10k_pci_irq_msi_fw_mask(ar);
  8545. ++ napi_schedule(&ar->napi);
  8546. +
  8547. + return IRQ_HANDLED;
  8548. + }
  8549. +
  8550. +-static void ath10k_pci_tasklet(unsigned long data)
  8551. ++static int ath10k_pci_napi_poll(struct napi_struct *ctx, int budget)
  8552. + {
  8553. +- struct ath10k *ar = (struct ath10k *)data;
  8554. +- struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
  8555. ++ struct ath10k *ar = container_of(ctx, struct ath10k, napi);
  8556. ++ int done = 0;
  8557. +
  8558. + if (ath10k_pci_has_fw_crashed(ar)) {
  8559. +- ath10k_pci_irq_disable(ar);
  8560. + ath10k_pci_fw_crashed_clear(ar);
  8561. + ath10k_pci_fw_crashed_dump(ar);
  8562. +- return;
  8563. ++ napi_complete(ctx);
  8564. ++ return done;
  8565. + }
  8566. +
  8567. + ath10k_ce_per_engine_service_any(ar);
  8568. +
  8569. +- /* Re-enable legacy irq that was disabled in the irq handler */
  8570. +- if (ar_pci->oper_irq_mode == ATH10K_PCI_IRQ_LEGACY)
  8571. ++ done = ath10k_htt_txrx_compl_task(ar, budget);
  8572. ++
  8573. ++ if (done < budget) {
  8574. ++ napi_complete(ctx);
  8575. ++ /* In case of MSI, it is possible that interrupts are received
  8576. ++ * while NAPI poll is inprogress. So pending interrupts that are
  8577. ++ * received after processing all copy engine pipes by NAPI poll
  8578. ++ * will not be handled again. This is causing failure to
  8579. ++ * complete boot sequence in x86 platform. So before enabling
  8580. ++ * interrupts safer to check for pending interrupts for
  8581. ++ * immediate servicing.
  8582. ++ */
  8583. ++ if (CE_INTERRUPT_SUMMARY(ar)) {
  8584. ++ napi_reschedule(&ar->napi);
  8585. ++ goto out;
  8586. ++ }
  8587. + ath10k_pci_enable_legacy_irq(ar);
  8588. ++ ath10k_pci_irq_msi_fw_unmask(ar);
  8589. ++ }
  8590. ++
  8591. ++out:
  8592. ++ return done;
  8593. + }
  8594. +
  8595. + static int ath10k_pci_request_irq_msi(struct ath10k *ar)
  8596. +@@ -2840,11 +2856,11 @@ static void ath10k_pci_free_irq(struct a
  8597. + free_irq(ar_pci->pdev->irq, ar);
  8598. + }
  8599. +
  8600. +-void ath10k_pci_init_irq_tasklets(struct ath10k *ar)
  8601. ++void ath10k_pci_init_napi(struct ath10k *ar)
  8602. + {
  8603. +- struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
  8604. +-
  8605. +- tasklet_init(&ar_pci->intr_tq, ath10k_pci_tasklet, (unsigned long)ar);
  8606. ++ netif_napi_add(&ar->napi_dev, &ar->napi, ath10k_pci_napi_poll,
  8607. ++ ATH10K_NAPI_BUDGET);
  8608. ++ napi_enable(&ar->napi);
  8609. + }
  8610. +
  8611. + static int ath10k_pci_init_irq(struct ath10k *ar)
  8612. +@@ -2852,7 +2868,7 @@ static int ath10k_pci_init_irq(struct at
  8613. + struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
  8614. + int ret;
  8615. +
  8616. +- ath10k_pci_init_irq_tasklets(ar);
  8617. ++ ath10k_pci_init_napi(ar);
  8618. +
  8619. + if (ath10k_pci_irq_mode != ATH10K_PCI_IRQ_AUTO)
  8620. + ath10k_info(ar, "limiting irq mode to: %d\n",
  8621. +@@ -3113,7 +3129,8 @@ int ath10k_pci_setup_resource(struct ath
  8622. +
  8623. + void ath10k_pci_release_resource(struct ath10k *ar)
  8624. + {
  8625. +- ath10k_pci_kill_tasklet(ar);
  8626. ++ ath10k_pci_rx_retry_sync(ar);
  8627. ++ netif_napi_del(&ar->napi);
  8628. + ath10k_pci_ce_deinit(ar);
  8629. + ath10k_pci_free_pipes(ar);
  8630. + }
  8631. +@@ -3274,7 +3291,7 @@ static int ath10k_pci_probe(struct pci_d
  8632. +
  8633. + err_free_irq:
  8634. + ath10k_pci_free_irq(ar);
  8635. +- ath10k_pci_kill_tasklet(ar);
  8636. ++ ath10k_pci_rx_retry_sync(ar);
  8637. +
  8638. + err_deinit_irq:
  8639. + ath10k_pci_deinit_irq(ar);
  8640. +--- a/drivers/net/wireless/ath/ath10k/pci.h
  8641. ++++ b/drivers/net/wireless/ath/ath10k/pci.h
  8642. +@@ -177,8 +177,6 @@ struct ath10k_pci {
  8643. + /* Operating interrupt mode */
  8644. + enum ath10k_pci_irq_mode oper_irq_mode;
  8645. +
  8646. +- struct tasklet_struct intr_tq;
  8647. +-
  8648. + struct ath10k_pci_pipe pipe_info[CE_COUNT_MAX];
  8649. +
  8650. + /* Copy Engine used for Diagnostic Accesses */
  8651. +@@ -294,8 +292,7 @@ void ath10k_pci_free_pipes(struct ath10k
  8652. + void ath10k_pci_free_pipes(struct ath10k *ar);
  8653. + void ath10k_pci_rx_replenish_retry(unsigned long ptr);
  8654. + void ath10k_pci_ce_deinit(struct ath10k *ar);
  8655. +-void ath10k_pci_init_irq_tasklets(struct ath10k *ar);
  8656. +-void ath10k_pci_kill_tasklet(struct ath10k *ar);
  8657. ++void ath10k_pci_init_napi(struct ath10k *ar);
  8658. + int ath10k_pci_init_pipes(struct ath10k *ar);
  8659. + int ath10k_pci_init_config(struct ath10k *ar);
  8660. + void ath10k_pci_rx_post(struct ath10k *ar);
  8661. +@@ -303,6 +300,7 @@ void ath10k_pci_flush(struct ath10k *ar)
  8662. + void ath10k_pci_enable_legacy_irq(struct ath10k *ar);
  8663. + bool ath10k_pci_irq_pending(struct ath10k *ar);
  8664. + void ath10k_pci_disable_and_clear_legacy_irq(struct ath10k *ar);
  8665. ++void ath10k_pci_irq_msi_fw_mask(struct ath10k *ar);
  8666. + int ath10k_pci_wait_for_target_init(struct ath10k *ar);
  8667. + int ath10k_pci_setup_resource(struct ath10k *ar);
  8668. + void ath10k_pci_release_resource(struct ath10k *ar);
  8669. 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
  8670. deleted file mode 100644
  8671. index e414f23..0000000
  8672. --- a/package/kernel/mac80211/patches/332-cfg80211-fix-faulty-variable-initialization-in-ieee8.patch
  8673. +++ /dev/null
  8674. @@ -1,22 +0,0 @@
  8675. -From: Felix Fietkau <nbd@openwrt.org>
  8676. -Date: Mon, 8 Feb 2016 14:24:36 +0100
  8677. -Subject: [PATCH] cfg80211: fix faulty variable initialization in
  8678. - ieee80211_amsdu_to_8023s
  8679. -
  8680. -reuse_skb is set to true if the code decides to use the last segment.
  8681. -Fixes a memory leak
  8682. -
  8683. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  8684. ----
  8685. -
  8686. ---- a/net/wireless/util.c
  8687. -+++ b/net/wireless/util.c
  8688. -@@ -676,7 +676,7 @@ void ieee80211_amsdu_to_8023s(struct sk_
  8689. - u8 *payload;
  8690. - int offset = 0, remaining, err;
  8691. - struct ethhdr eth;
  8692. -- bool reuse_skb = true;
  8693. -+ bool reuse_skb = false;
  8694. - bool last = false;
  8695. -
  8696. - if (has_80211_header) {
  8697. 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
  8698. new file mode 100644
  8699. index 0000000..d008ceb
  8700. --- /dev/null
  8701. +++ b/package/kernel/mac80211/patches/333-ath9k-fix-client-mode-beacon-configuration.patch
  8702. @@ -0,0 +1,69 @@
  8703. +From: Felix Fietkau <nbd@nbd.name>
  8704. +Date: Tue, 26 Jul 2016 08:05:10 +0200
  8705. +Subject: [PATCH] ath9k: fix client mode beacon configuration
  8706. +
  8707. +For pure station mode, iter_data.primary_beacon_vif was used and passed
  8708. +to ath_beacon_config, but not set to the station vif.
  8709. +This was causing the following warning:
  8710. +
  8711. +[ 100.310919] ------------[ cut here ]------------
  8712. +[ 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]()
  8713. +[ 100.402028] CPU: 0 PID: 7 Comm: kworker/u2:1 Tainted: G W 4.4.15 #5
  8714. +[ 100.409676] Workqueue: phy0 ieee80211_ibss_leave [mac80211]
  8715. +[ 100.415351] Stack : 8736e98c 870b4b20 87a25b54 800a6800 8782a080 80400d63 8039b96c 00000007
  8716. +[ 100.415351] 803c5edc 87875914 80400000 800a47cc 87a25b54 800a6800 803a0fd8 80400000
  8717. +[ 100.415351] 00000003 87875914 80400000 80094ae0 87a25b54 8787594c 00000000 801ef308
  8718. +[ 100.415351] 803ffe70 801ef300 87193d58 87b3a400 87b3ad00 70687930 00000000 00000000
  8719. +[ 100.415351] 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  8720. +[ 100.415351] ...
  8721. +[ 100.451703] Call Trace:
  8722. +[ 100.454235] [<800a6800>] vprintk_default+0x24/0x30
  8723. +[ 100.459110] [<800a47cc>] printk+0x2c/0x38
  8724. +[ 100.463190] [<800a6800>] vprintk_default+0x24/0x30
  8725. +[ 100.468072] [<80094ae0>] print_worker_info+0x148/0x174
  8726. +[ 100.473378] [<801ef308>] serial8250_console_putchar+0x0/0x44
  8727. +[ 100.479122] [<801ef300>] wait_for_xmitr+0xc4/0xcc
  8728. +[ 100.484014] [<87193d58>] ieee80211_ibss_leave+0xb90/0x1900 [mac80211]
  8729. +[ 100.490590] [<80081604>] warn_slowpath_common+0xa0/0xd0
  8730. +[ 100.495922] [<801a359c>] dump_stack+0x14/0x28
  8731. +[ 100.500350] [<80071a00>] show_stack+0x50/0x84
  8732. +[ 100.504784] [<80081604>] warn_slowpath_common+0xa0/0xd0
  8733. +[ 100.510106] [<87024c60>] ath9k_calculate_summary_state+0x250/0x60c [ath9k]
  8734. +[ 100.517105] [<800816b8>] warn_slowpath_null+0x18/0x24
  8735. +[ 100.522256] [<87024c60>] ath9k_calculate_summary_state+0x250/0x60c [ath9k]
  8736. +[ 100.529273] [<87025418>] ath9k_set_txpower+0x148/0x498 [ath9k]
  8737. +[ 100.535302] [<871d2c64>] cleanup_module+0xa74/0xd4c [mac80211]
  8738. +[ 100.541237] [<801ef308>] serial8250_console_putchar+0x0/0x44
  8739. +[ 100.547042] [<800a5d18>] wake_up_klogd+0x54/0x68
  8740. +[ 100.551730] [<800a6650>] vprintk_emit+0x404/0x43c
  8741. +[ 100.556623] [<871b9db8>] ieee80211_sta_rx_notify+0x258/0x32c [mac80211]
  8742. +[ 100.563475] [<871ba6a4>] ieee80211_sta_rx_queued_mgmt+0x63c/0x734 [mac80211]
  8743. +[ 100.570693] [<871aa49c>] ieee80211_tx_prepare_skb+0x210/0x230 [mac80211]
  8744. +[ 100.577609] [<800af5d4>] mod_timer+0x15c/0x190
  8745. +[ 100.582220] [<871ba8b8>] ieee80211_sta_work+0xfc/0xe1c [mac80211]
  8746. +[ 100.588539] [<871940b4>] ieee80211_ibss_leave+0xeec/0x1900 [mac80211]
  8747. +[ 100.595122] [<8009ec84>] dequeue_task_fair+0x44/0x130
  8748. +[ 100.600281] [<80092a34>] process_one_work+0x1f8/0x334
  8749. +[ 100.605454] [<80093830>] worker_thread+0x2b4/0x408
  8750. +[ 100.610317] [<8009357c>] worker_thread+0x0/0x408
  8751. +[ 100.615019] [<8009357c>] worker_thread+0x0/0x408
  8752. +[ 100.619705] [<80097b68>] kthread+0xdc/0xe8
  8753. +[ 100.623886] [<80097a8c>] kthread+0x0/0xe8
  8754. +[ 100.627961] [<80060878>] ret_from_kernel_thread+0x14/0x1c
  8755. +[ 100.633448]
  8756. +[ 100.634956] ---[ end trace aafbe57e9ae6862f ]---
  8757. +
  8758. +Fixes: cfda2d8e2314 ("ath9k: Fix beacon configuration for addition/removal of interfaces")
  8759. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  8760. +---
  8761. +
  8762. +--- a/drivers/net/wireless/ath/ath9k/main.c
  8763. ++++ b/drivers/net/wireless/ath/ath9k/main.c
  8764. +@@ -1154,6 +1154,7 @@ void ath9k_calculate_summary_state(struc
  8765. + bool changed = (iter_data.primary_sta != ctx->primary_sta);
  8766. +
  8767. + if (iter_data.primary_sta) {
  8768. ++ iter_data.primary_beacon_vif = iter_data.primary_sta;
  8769. + iter_data.beacons = true;
  8770. + ath9k_set_assoc_state(sc, iter_data.primary_sta,
  8771. + changed);
  8772. 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
  8773. deleted file mode 100644
  8774. index 6e2d0cf..0000000
  8775. --- a/package/kernel/mac80211/patches/333-cfg80211-reuse-existing-page-fragments-in-A-MSDU-rx.patch
  8776. +++ /dev/null
  8777. @@ -1,132 +0,0 @@
  8778. -From: Felix Fietkau <nbd@openwrt.org>
  8779. -Date: Mon, 8 Feb 2016 14:33:19 +0100
  8780. -Subject: [PATCH] cfg80211: reuse existing page fragments in A-MSDU rx
  8781. -
  8782. -This massively reduces data copying and thus improves rx performance
  8783. -
  8784. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  8785. ----
  8786. -
  8787. ---- a/net/wireless/util.c
  8788. -+++ b/net/wireless/util.c
  8789. -@@ -644,23 +644,93 @@ int ieee80211_data_from_8023(struct sk_b
  8790. - }
  8791. - EXPORT_SYMBOL(ieee80211_data_from_8023);
  8792. -
  8793. -+static void
  8794. -+__frame_add_frag(struct sk_buff *skb, struct page *page,
  8795. -+ void *ptr, int len, int size)
  8796. -+{
  8797. -+ struct skb_shared_info *sh = skb_shinfo(skb);
  8798. -+ int page_offset;
  8799. -+
  8800. -+ atomic_inc(&page->_count);
  8801. -+ page_offset = ptr - page_address(page);
  8802. -+ skb_add_rx_frag(skb, sh->nr_frags, page, page_offset, len, size);
  8803. -+}
  8804. -+
  8805. -+static void
  8806. -+__ieee80211_amsdu_copy_frag(struct sk_buff *skb, struct sk_buff *frame,
  8807. -+ int offset, int len)
  8808. -+{
  8809. -+ struct skb_shared_info *sh = skb_shinfo(skb);
  8810. -+ const skb_frag_t *frag = &sh->frags[-1];
  8811. -+ struct page *frag_page;
  8812. -+ void *frag_ptr;
  8813. -+ int frag_len, frag_size;
  8814. -+ int head_size = skb->len - skb->data_len;
  8815. -+ int cur_len;
  8816. -+
  8817. -+ frag_page = virt_to_head_page(skb->head);
  8818. -+ frag_ptr = skb->data;
  8819. -+ frag_size = head_size;
  8820. -+
  8821. -+ while (offset >= frag_size) {
  8822. -+ offset -= frag_size;
  8823. -+ frag++;
  8824. -+ frag_page = skb_frag_page(frag);
  8825. -+ frag_ptr = skb_frag_address(frag);
  8826. -+ frag_size = skb_frag_size(frag);
  8827. -+ }
  8828. -+
  8829. -+ frag_ptr += offset;
  8830. -+ frag_len = frag_size - offset;
  8831. -+
  8832. -+ cur_len = min(len, frag_len);
  8833. -+
  8834. -+ __frame_add_frag(frame, frag_page, frag_ptr, cur_len, frag_size);
  8835. -+ len -= cur_len;
  8836. -+
  8837. -+ while (len > 0) {
  8838. -+ frag++;
  8839. -+ frag_len = skb_frag_size(frag);
  8840. -+ cur_len = min(len, frag_len);
  8841. -+ __frame_add_frag(frame, skb_frag_page(frag),
  8842. -+ skb_frag_address(frag), cur_len, frag_len);
  8843. -+ len -= cur_len;
  8844. -+ }
  8845. -+}
  8846. -+
  8847. - static struct sk_buff *
  8848. - __ieee80211_amsdu_copy(struct sk_buff *skb, unsigned int hlen,
  8849. -- int offset, int len)
  8850. -+ int offset, int len, bool reuse_frag)
  8851. - {
  8852. - struct sk_buff *frame;
  8853. -+ int cur_len = len;
  8854. -
  8855. - if (skb->len - offset < len)
  8856. - return NULL;
  8857. -
  8858. - /*
  8859. -+ * When reusing framents, copy some data to the head to simplify
  8860. -+ * ethernet header handling and speed up protocol header processing
  8861. -+ * in the stack later.
  8862. -+ */
  8863. -+ if (reuse_frag)
  8864. -+ cur_len = min_t(int, len, 32);
  8865. -+
  8866. -+ /*
  8867. - * Allocate and reserve two bytes more for payload
  8868. - * alignment since sizeof(struct ethhdr) is 14.
  8869. - */
  8870. -- frame = dev_alloc_skb(hlen + sizeof(struct ethhdr) + 2 + len);
  8871. -+ frame = dev_alloc_skb(hlen + sizeof(struct ethhdr) + 2 + cur_len);
  8872. -
  8873. - skb_reserve(frame, hlen + sizeof(struct ethhdr) + 2);
  8874. -- skb_copy_bits(skb, offset, skb_put(frame, len), len);
  8875. -+ skb_copy_bits(skb, offset, skb_put(frame, cur_len), cur_len);
  8876. -+
  8877. -+ len -= cur_len;
  8878. -+ if (!len)
  8879. -+ return frame;
  8880. -+
  8881. -+ offset += cur_len;
  8882. -+ __ieee80211_amsdu_copy_frag(skb, frame, offset, len);
  8883. -
  8884. - return frame;
  8885. - }
  8886. -@@ -676,6 +746,7 @@ void ieee80211_amsdu_to_8023s(struct sk_
  8887. - u8 *payload;
  8888. - int offset = 0, remaining, err;
  8889. - struct ethhdr eth;
  8890. -+ bool reuse_frag = skb->head_frag && !skb_has_frag_list(skb);
  8891. - bool reuse_skb = false;
  8892. - bool last = false;
  8893. -
  8894. -@@ -703,12 +774,13 @@ void ieee80211_amsdu_to_8023s(struct sk_
  8895. - offset += sizeof(struct ethhdr);
  8896. - /* reuse skb for the last subframe */
  8897. - last = remaining <= subframe_len + padding;
  8898. -- if (!skb_is_nonlinear(skb) && last) {
  8899. -+ if (!skb_is_nonlinear(skb) && !reuse_frag && last) {
  8900. - skb_pull(skb, offset);
  8901. - frame = skb;
  8902. - reuse_skb = true;
  8903. - } else {
  8904. -- frame = __ieee80211_amsdu_copy(skb, hlen, offset, len);
  8905. -+ frame = __ieee80211_amsdu_copy(skb, hlen, offset, len,
  8906. -+ reuse_frag);
  8907. - if (!frame)
  8908. - goto purge;
  8909. -
  8910. 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
  8911. new file mode 100644
  8912. index 0000000..dfcc6e4
  8913. --- /dev/null
  8914. +++ b/package/kernel/mac80211/patches/334-mac80211-fix-purging-multicast-PS-buffer-queue.patch
  8915. @@ -0,0 +1,54 @@
  8916. +From: Felix Fietkau <nbd@nbd.name>
  8917. +Date: Tue, 2 Aug 2016 11:11:13 +0200
  8918. +Subject: [PATCH] mac80211: fix purging multicast PS buffer queue
  8919. +
  8920. +The code currently assumes that buffered multicast PS frames don't have
  8921. +a pending ACK frame for tx status reporting.
  8922. +However, hostapd sends a broadcast deauth frame on teardown for which tx
  8923. +status is requested. This can lead to the "Have pending ack frames"
  8924. +warning on module reload.
  8925. +Fix this by using ieee80211_free_txskb/ieee80211_purge_tx_queue.
  8926. +
  8927. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  8928. +---
  8929. +
  8930. +--- a/net/mac80211/cfg.c
  8931. ++++ b/net/mac80211/cfg.c
  8932. +@@ -868,7 +868,7 @@ static int ieee80211_stop_ap(struct wiph
  8933. +
  8934. + /* free all potentially still buffered bcast frames */
  8935. + local->total_ps_buffered -= skb_queue_len(&sdata->u.ap.ps.bc_buf);
  8936. +- skb_queue_purge(&sdata->u.ap.ps.bc_buf);
  8937. ++ ieee80211_purge_tx_queue(&local->hw, &sdata->u.ap.ps.bc_buf);
  8938. +
  8939. + mutex_lock(&local->mtx);
  8940. + ieee80211_vif_copy_chanctx_to_vlans(sdata, true);
  8941. +--- a/net/mac80211/tx.c
  8942. ++++ b/net/mac80211/tx.c
  8943. +@@ -368,7 +368,7 @@ static void purge_old_ps_buffers(struct
  8944. + skb = skb_dequeue(&ps->bc_buf);
  8945. + if (skb) {
  8946. + purged++;
  8947. +- dev_kfree_skb(skb);
  8948. ++ ieee80211_free_txskb(&local->hw, skb);
  8949. + }
  8950. + total += skb_queue_len(&ps->bc_buf);
  8951. + }
  8952. +@@ -451,7 +451,7 @@ ieee80211_tx_h_multicast_ps_buf(struct i
  8953. + if (skb_queue_len(&ps->bc_buf) >= AP_MAX_BC_BUFFER) {
  8954. + ps_dbg(tx->sdata,
  8955. + "BC TX buffer full - dropping the oldest frame\n");
  8956. +- dev_kfree_skb(skb_dequeue(&ps->bc_buf));
  8957. ++ ieee80211_free_txskb(&tx->local->hw, skb_dequeue(&ps->bc_buf));
  8958. + } else
  8959. + tx->local->total_ps_buffered++;
  8960. +
  8961. +@@ -4276,7 +4276,7 @@ ieee80211_get_buffered_bc(struct ieee802
  8962. + sdata = IEEE80211_DEV_TO_SUB_IF(skb->dev);
  8963. + if (!ieee80211_tx_prepare(sdata, &tx, NULL, skb))
  8964. + break;
  8965. +- dev_kfree_skb_any(skb);
  8966. ++ ieee80211_free_txskb(hw, skb);
  8967. + }
  8968. +
  8969. + info = IEEE80211_SKB_CB(skb);
  8970. 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
  8971. deleted file mode 100644
  8972. index f8f4f09..0000000
  8973. --- a/package/kernel/mac80211/patches/334-mac80211-fix-wiphy-supported_band-access.patch
  8974. +++ /dev/null
  8975. @@ -1,36 +0,0 @@
  8976. -From: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  8977. -Date: Wed, 10 Feb 2016 16:08:17 +0100
  8978. -Subject: [PATCH] mac80211: fix wiphy supported_band access
  8979. -
  8980. -Fix wiphy supported_band access in tx radiotap parsing. In particular,
  8981. -info->band is always set to 0 (IEEE80211_BAND_2GHZ) since it has not
  8982. -assigned yet. This cause a kernel crash on 5GHz only devices.
  8983. -Move ieee80211_parse_tx_radiotap() after info->band assignment
  8984. -
  8985. -Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  8986. ----
  8987. -
  8988. ---- a/net/mac80211/tx.c
  8989. -+++ b/net/mac80211/tx.c
  8990. -@@ -1890,10 +1890,6 @@ netdev_tx_t ieee80211_monitor_start_xmit
  8991. - info->flags = IEEE80211_TX_CTL_REQ_TX_STATUS |
  8992. - IEEE80211_TX_CTL_INJECTED;
  8993. -
  8994. -- /* process and remove the injection radiotap header */
  8995. -- if (!ieee80211_parse_tx_radiotap(local, skb))
  8996. -- goto fail;
  8997. --
  8998. - rcu_read_lock();
  8999. -
  9000. - /*
  9001. -@@ -1955,6 +1951,10 @@ netdev_tx_t ieee80211_monitor_start_xmit
  9002. - goto fail_rcu;
  9003. -
  9004. - info->band = chandef->chan->band;
  9005. -+ /* process and remove the injection radiotap header */
  9006. -+ if (!ieee80211_parse_tx_radiotap(local, skb))
  9007. -+ goto fail_rcu;
  9008. -+
  9009. - ieee80211_xmit(sdata, NULL, skb);
  9010. - rcu_read_unlock();
  9011. -
  9012. 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
  9013. new file mode 100644
  9014. index 0000000..dbb5b90
  9015. --- /dev/null
  9016. +++ b/package/kernel/mac80211/patches/335-ath9k-use-ieee80211_tx_status_noskb-where-possible.patch
  9017. @@ -0,0 +1,305 @@
  9018. +From: Felix Fietkau <nbd@nbd.name>
  9019. +Date: Tue, 2 Aug 2016 12:12:18 +0200
  9020. +Subject: [PATCH] ath9k: use ieee80211_tx_status_noskb where possible
  9021. +
  9022. +It removes the need for undoing the padding changes to skb->data and it
  9023. +improves performance by eliminating one tx status lookup per MPDU in the
  9024. +status path. It is also useful for preparing a follow-up fix to better
  9025. +handle powersave filtering.
  9026. +
  9027. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  9028. +---
  9029. +
  9030. +--- a/drivers/net/wireless/ath/ath9k/xmit.c
  9031. ++++ b/drivers/net/wireless/ath/ath9k/xmit.c
  9032. +@@ -50,9 +50,11 @@ static u16 bits_per_symbol[][2] = {
  9033. + static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq,
  9034. + struct ath_atx_tid *tid, struct sk_buff *skb);
  9035. + static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb,
  9036. +- int tx_flags, struct ath_txq *txq);
  9037. ++ int tx_flags, struct ath_txq *txq,
  9038. ++ struct ieee80211_sta *sta);
  9039. + static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf,
  9040. + struct ath_txq *txq, struct list_head *bf_q,
  9041. ++ struct ieee80211_sta *sta,
  9042. + struct ath_tx_status *ts, int txok);
  9043. + static void ath_tx_txqaddbuf(struct ath_softc *sc, struct ath_txq *txq,
  9044. + struct list_head *head, bool internal);
  9045. +@@ -77,6 +79,22 @@ enum {
  9046. + /* Aggregation logic */
  9047. + /*********************/
  9048. +
  9049. ++static void ath_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
  9050. ++{
  9051. ++ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  9052. ++ struct ieee80211_sta *sta = info->status.status_driver_data[0];
  9053. ++
  9054. ++ if (info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS) {
  9055. ++ ieee80211_tx_status(hw, skb);
  9056. ++ return;
  9057. ++ }
  9058. ++
  9059. ++ if (sta)
  9060. ++ ieee80211_tx_status_noskb(hw, sta, info);
  9061. ++
  9062. ++ dev_kfree_skb(skb);
  9063. ++}
  9064. ++
  9065. + void ath_txq_lock(struct ath_softc *sc, struct ath_txq *txq)
  9066. + __acquires(&txq->axq_lock)
  9067. + {
  9068. +@@ -92,6 +110,7 @@ void ath_txq_unlock(struct ath_softc *sc
  9069. + void ath_txq_unlock_complete(struct ath_softc *sc, struct ath_txq *txq)
  9070. + __releases(&txq->axq_lock)
  9071. + {
  9072. ++ struct ieee80211_hw *hw = sc->hw;
  9073. + struct sk_buff_head q;
  9074. + struct sk_buff *skb;
  9075. +
  9076. +@@ -100,7 +119,7 @@ void ath_txq_unlock_complete(struct ath_
  9077. + spin_unlock_bh(&txq->axq_lock);
  9078. +
  9079. + while ((skb = __skb_dequeue(&q)))
  9080. +- ieee80211_tx_status(sc->hw, skb);
  9081. ++ ath_tx_status(hw, skb);
  9082. + }
  9083. +
  9084. + static void ath_tx_queue_tid(struct ath_softc *sc, struct ath_txq *txq,
  9085. +@@ -268,7 +287,7 @@ static void ath_tx_flush_tid(struct ath_
  9086. + }
  9087. +
  9088. + list_add_tail(&bf->list, &bf_head);
  9089. +- ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0);
  9090. ++ ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, &ts, 0);
  9091. + }
  9092. +
  9093. + if (sendbar) {
  9094. +@@ -333,12 +352,12 @@ static void ath_tid_drain(struct ath_sof
  9095. + bf = fi->bf;
  9096. +
  9097. + if (!bf) {
  9098. +- ath_tx_complete(sc, skb, ATH_TX_ERROR, txq);
  9099. ++ ath_tx_complete(sc, skb, ATH_TX_ERROR, txq, NULL);
  9100. + continue;
  9101. + }
  9102. +
  9103. + list_add_tail(&bf->list, &bf_head);
  9104. +- ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0);
  9105. ++ ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, &ts, 0);
  9106. + }
  9107. + }
  9108. +
  9109. +@@ -441,12 +460,11 @@ static void ath_tx_count_frames(struct a
  9110. +
  9111. + static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
  9112. + struct ath_buf *bf, struct list_head *bf_q,
  9113. ++ struct ieee80211_sta *sta,
  9114. + struct ath_tx_status *ts, int txok)
  9115. + {
  9116. + struct ath_node *an = NULL;
  9117. + struct sk_buff *skb;
  9118. +- struct ieee80211_sta *sta;
  9119. +- struct ieee80211_hw *hw = sc->hw;
  9120. + struct ieee80211_hdr *hdr;
  9121. + struct ieee80211_tx_info *tx_info;
  9122. + struct ath_atx_tid *tid = NULL;
  9123. +@@ -475,12 +493,7 @@ static void ath_tx_complete_aggr(struct
  9124. + for (i = 0; i < ts->ts_rateindex; i++)
  9125. + retries += rates[i].count;
  9126. +
  9127. +- rcu_read_lock();
  9128. +-
  9129. +- sta = ieee80211_find_sta_by_ifaddr(hw, hdr->addr1, hdr->addr2);
  9130. + if (!sta) {
  9131. +- rcu_read_unlock();
  9132. +-
  9133. + INIT_LIST_HEAD(&bf_head);
  9134. + while (bf) {
  9135. + bf_next = bf->bf_next;
  9136. +@@ -488,7 +501,7 @@ static void ath_tx_complete_aggr(struct
  9137. + if (!bf->bf_state.stale || bf_next != NULL)
  9138. + list_move_tail(&bf->list, &bf_head);
  9139. +
  9140. +- ath_tx_complete_buf(sc, bf, txq, &bf_head, ts, 0);
  9141. ++ ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, ts, 0);
  9142. +
  9143. + bf = bf_next;
  9144. + }
  9145. +@@ -598,7 +611,7 @@ static void ath_tx_complete_aggr(struct
  9146. + ts);
  9147. + }
  9148. +
  9149. +- ath_tx_complete_buf(sc, bf, txq, &bf_head, ts,
  9150. ++ ath_tx_complete_buf(sc, bf, txq, &bf_head, sta, ts,
  9151. + !txfail);
  9152. + } else {
  9153. + if (tx_info->flags & IEEE80211_TX_STATUS_EOSP) {
  9154. +@@ -619,7 +632,8 @@ static void ath_tx_complete_aggr(struct
  9155. + ath_tx_update_baw(sc, tid, seqno);
  9156. +
  9157. + ath_tx_complete_buf(sc, bf, txq,
  9158. +- &bf_head, ts, 0);
  9159. ++ &bf_head, NULL, ts,
  9160. ++ 0);
  9161. + bar_index = max_t(int, bar_index,
  9162. + ATH_BA_INDEX(seq_first, seqno));
  9163. + break;
  9164. +@@ -663,8 +677,6 @@ static void ath_tx_complete_aggr(struct
  9165. + ath_txq_lock(sc, txq);
  9166. + }
  9167. +
  9168. +- rcu_read_unlock();
  9169. +-
  9170. + if (needreset)
  9171. + ath9k_queue_reset(sc, RESET_TYPE_TX_ERROR);
  9172. + }
  9173. +@@ -679,7 +691,10 @@ static void ath_tx_process_buffer(struct
  9174. + struct ath_tx_status *ts, struct ath_buf *bf,
  9175. + struct list_head *bf_head)
  9176. + {
  9177. ++ struct ieee80211_hw *hw = sc->hw;
  9178. + struct ieee80211_tx_info *info;
  9179. ++ struct ieee80211_sta *sta;
  9180. ++ struct ieee80211_hdr *hdr;
  9181. + bool txok, flush;
  9182. +
  9183. + txok = !(ts->ts_status & ATH9K_TXERR_MASK);
  9184. +@@ -692,6 +707,10 @@ static void ath_tx_process_buffer(struct
  9185. +
  9186. + ts->duration = ath9k_hw_get_duration(sc->sc_ah, bf->bf_desc,
  9187. + ts->ts_rateindex);
  9188. ++
  9189. ++ hdr = (struct ieee80211_hdr *) bf->bf_mpdu->data;
  9190. ++ sta = ieee80211_find_sta_by_ifaddr(hw, hdr->addr1, hdr->addr2);
  9191. ++
  9192. + if (!bf_isampdu(bf)) {
  9193. + if (!flush) {
  9194. + info = IEEE80211_SKB_CB(bf->bf_mpdu);
  9195. +@@ -700,9 +719,9 @@ static void ath_tx_process_buffer(struct
  9196. + ath_tx_rc_status(sc, bf, ts, 1, txok ? 0 : 1, txok);
  9197. + ath_dynack_sample_tx_ts(sc->sc_ah, bf->bf_mpdu, ts);
  9198. + }
  9199. +- ath_tx_complete_buf(sc, bf, txq, bf_head, ts, txok);
  9200. ++ ath_tx_complete_buf(sc, bf, txq, bf_head, sta, ts, txok);
  9201. + } else
  9202. +- ath_tx_complete_aggr(sc, txq, bf, bf_head, ts, txok);
  9203. ++ ath_tx_complete_aggr(sc, txq, bf, bf_head, sta, ts, txok);
  9204. +
  9205. + if (!flush)
  9206. + ath_txq_schedule(sc, txq);
  9207. +@@ -938,7 +957,7 @@ ath_tx_get_tid_subframe(struct ath_softc
  9208. + list_add(&bf->list, &bf_head);
  9209. + __skb_unlink(skb, *q);
  9210. + ath_tx_update_baw(sc, tid, seqno);
  9211. +- ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0);
  9212. ++ ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, &ts, 0);
  9213. + continue;
  9214. + }
  9215. +
  9216. +@@ -1847,6 +1866,7 @@ static void ath_drain_txq_list(struct at
  9217. + */
  9218. + void ath_draintxq(struct ath_softc *sc, struct ath_txq *txq)
  9219. + {
  9220. ++ rcu_read_lock();
  9221. + ath_txq_lock(sc, txq);
  9222. +
  9223. + if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) {
  9224. +@@ -1865,6 +1885,7 @@ void ath_draintxq(struct ath_softc *sc,
  9225. + ath_drain_txq_list(sc, txq, &txq->axq_q);
  9226. +
  9227. + ath_txq_unlock_complete(sc, txq);
  9228. ++ rcu_read_unlock();
  9229. + }
  9230. +
  9231. + bool ath_drain_all_txq(struct ath_softc *sc)
  9232. +@@ -2487,7 +2508,8 @@ void ath_tx_cabq(struct ieee80211_hw *hw
  9233. + /*****************/
  9234. +
  9235. + static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb,
  9236. +- int tx_flags, struct ath_txq *txq)
  9237. ++ int tx_flags, struct ath_txq *txq,
  9238. ++ struct ieee80211_sta *sta)
  9239. + {
  9240. + struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
  9241. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  9242. +@@ -2507,15 +2529,17 @@ static void ath_tx_complete(struct ath_s
  9243. + tx_info->flags |= IEEE80211_TX_STAT_ACK;
  9244. + }
  9245. +
  9246. +- padpos = ieee80211_hdrlen(hdr->frame_control);
  9247. +- padsize = padpos & 3;
  9248. +- if (padsize && skb->len>padpos+padsize) {
  9249. +- /*
  9250. +- * Remove MAC header padding before giving the frame back to
  9251. +- * mac80211.
  9252. +- */
  9253. +- memmove(skb->data + padsize, skb->data, padpos);
  9254. +- skb_pull(skb, padsize);
  9255. ++ if (tx_info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS) {
  9256. ++ padpos = ieee80211_hdrlen(hdr->frame_control);
  9257. ++ padsize = padpos & 3;
  9258. ++ if (padsize && skb->len>padpos+padsize) {
  9259. ++ /*
  9260. ++ * Remove MAC header padding before giving the frame back to
  9261. ++ * mac80211.
  9262. ++ */
  9263. ++ memmove(skb->data + padsize, skb->data, padpos);
  9264. ++ skb_pull(skb, padsize);
  9265. ++ }
  9266. + }
  9267. +
  9268. + spin_lock_irqsave(&sc->sc_pm_lock, flags);
  9269. +@@ -2530,12 +2554,14 @@ static void ath_tx_complete(struct ath_s
  9270. + }
  9271. + spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
  9272. +
  9273. +- __skb_queue_tail(&txq->complete_q, skb);
  9274. + ath_txq_skb_done(sc, txq, skb);
  9275. ++ tx_info->status.status_driver_data[0] = sta;
  9276. ++ __skb_queue_tail(&txq->complete_q, skb);
  9277. + }
  9278. +
  9279. + static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf,
  9280. + struct ath_txq *txq, struct list_head *bf_q,
  9281. ++ struct ieee80211_sta *sta,
  9282. + struct ath_tx_status *ts, int txok)
  9283. + {
  9284. + struct sk_buff *skb = bf->bf_mpdu;
  9285. +@@ -2563,7 +2589,7 @@ static void ath_tx_complete_buf(struct a
  9286. + complete(&sc->paprd_complete);
  9287. + } else {
  9288. + ath_debug_stat_tx(sc, bf, ts, txq, tx_flags);
  9289. +- ath_tx_complete(sc, skb, tx_flags, txq);
  9290. ++ ath_tx_complete(sc, skb, tx_flags, txq, sta);
  9291. + }
  9292. + skip_tx_complete:
  9293. + /* At this point, skb (bf->bf_mpdu) is consumed...make sure we don't
  9294. +@@ -2715,10 +2741,12 @@ void ath_tx_tasklet(struct ath_softc *sc
  9295. + u32 qcumask = ((1 << ATH9K_NUM_TX_QUEUES) - 1) & ah->intr_txqs;
  9296. + int i;
  9297. +
  9298. ++ rcu_read_lock();
  9299. + for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) {
  9300. + if (ATH_TXQ_SETUP(sc, i) && (qcumask & (1 << i)))
  9301. + ath_tx_processq(sc, &sc->tx.txq[i]);
  9302. + }
  9303. ++ rcu_read_unlock();
  9304. + }
  9305. +
  9306. + void ath_tx_edma_tasklet(struct ath_softc *sc)
  9307. +@@ -2732,6 +2760,7 @@ void ath_tx_edma_tasklet(struct ath_soft
  9308. + struct list_head *fifo_list;
  9309. + int status;
  9310. +
  9311. ++ rcu_read_lock();
  9312. + for (;;) {
  9313. + if (test_bit(ATH_OP_HW_RESET, &common->op_flags))
  9314. + break;
  9315. +@@ -2802,6 +2831,7 @@ void ath_tx_edma_tasklet(struct ath_soft
  9316. + ath_tx_process_buffer(sc, txq, &ts, bf, &bf_head);
  9317. + ath_txq_unlock_complete(sc, txq);
  9318. + }
  9319. ++ rcu_read_unlock();
  9320. + }
  9321. +
  9322. + /*****************/
  9323. 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
  9324. deleted file mode 100644
  9325. index acaacf7..0000000
  9326. --- a/package/kernel/mac80211/patches/335-mac80211-minstrel_ht-set-A-MSDU-tx-limits-based-on-s.patch
  9327. +++ /dev/null
  9328. @@ -1,61 +0,0 @@
  9329. -From: Felix Fietkau <nbd@openwrt.org>
  9330. -Date: Thu, 18 Feb 2016 19:30:05 +0100
  9331. -Subject: [PATCH] mac80211: minstrel_ht: set A-MSDU tx limits based on selected
  9332. - max_prob_rate
  9333. -
  9334. -Prevents excessive A-MSDU aggregation at low data rates or bad
  9335. -conditions.
  9336. -
  9337. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  9338. ----
  9339. -
  9340. ---- a/net/mac80211/rc80211_minstrel_ht.c
  9341. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  9342. -@@ -883,6 +883,39 @@ minstrel_ht_set_rate(struct minstrel_pri
  9343. - ratetbl->rate[offset].flags = flags;
  9344. - }
  9345. -
  9346. -+static int
  9347. -+minstrel_ht_get_max_amsdu_len(struct minstrel_ht_sta *mi)
  9348. -+{
  9349. -+ int group = mi->max_prob_rate / MCS_GROUP_RATES;
  9350. -+ const struct mcs_group *g = &minstrel_mcs_groups[group];
  9351. -+ int rate = mi->max_prob_rate % MCS_GROUP_RATES;
  9352. -+
  9353. -+ /* Disable A-MSDU if max_prob_rate is bad */
  9354. -+ if (mi->groups[group].rates[rate].prob_ewma < MINSTREL_FRAC(50, 100))
  9355. -+ return 1;
  9356. -+
  9357. -+ /* If the rate is slower than single-stream MCS1, make A-MSDU limit small */
  9358. -+ if (g->duration[rate] > MCS_DURATION(1, 0, 52))
  9359. -+ return 500;
  9360. -+
  9361. -+ /*
  9362. -+ * If the rate is slower than single-stream MCS4, limit A-MSDU to usual
  9363. -+ * data packet size
  9364. -+ */
  9365. -+ if (g->duration[rate] > MCS_DURATION(1, 0, 104))
  9366. -+ return 1500;
  9367. -+
  9368. -+ /*
  9369. -+ * If the rate is slower than single-stream MCS7, limit A-MSDU to twice
  9370. -+ * the usual data packet size
  9371. -+ */
  9372. -+ if (g->duration[rate] > MCS_DURATION(1, 0, 260))
  9373. -+ return 3000;
  9374. -+
  9375. -+ /* unlimited */
  9376. -+ return 0;
  9377. -+}
  9378. -+
  9379. - static void
  9380. - minstrel_ht_update_rates(struct minstrel_priv *mp, struct minstrel_ht_sta *mi)
  9381. - {
  9382. -@@ -907,6 +940,7 @@ minstrel_ht_update_rates(struct minstrel
  9383. - minstrel_ht_set_rate(mp, mi, rates, i++, mi->max_prob_rate);
  9384. - }
  9385. -
  9386. -+ mi->sta->max_rc_amsdu_len = minstrel_ht_get_max_amsdu_len(mi);
  9387. - rates->rate[i].idx = -1;
  9388. - rate_control_set_rates(mp->hw, mi->sta, rates);
  9389. - }
  9390. 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
  9391. new file mode 100644
  9392. index 0000000..67a6c63
  9393. --- /dev/null
  9394. +++ b/package/kernel/mac80211/patches/336-ath9k-improve-powersave-filter-handling.patch
  9395. @@ -0,0 +1,70 @@
  9396. +From: Felix Fietkau <nbd@nbd.name>
  9397. +Date: Tue, 2 Aug 2016 12:13:35 +0200
  9398. +Subject: [PATCH] ath9k: improve powersave filter handling
  9399. +
  9400. +For non-aggregated frames, ath9k was leaving handling of powersave
  9401. +filtered packets to mac80211. This can be too slow if the intermediate
  9402. +queue is already filled with packets and mac80211 does not immediately
  9403. +send a new packet via drv_tx().
  9404. +
  9405. +Improve response time with filtered frames by triggering clearing the
  9406. +powersave filter internally.
  9407. +
  9408. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  9409. +---
  9410. +
  9411. +--- a/drivers/net/wireless/ath/ath9k/xmit.c
  9412. ++++ b/drivers/net/wireless/ath/ath9k/xmit.c
  9413. +@@ -461,13 +461,13 @@ static void ath_tx_count_frames(struct a
  9414. + static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
  9415. + struct ath_buf *bf, struct list_head *bf_q,
  9416. + struct ieee80211_sta *sta,
  9417. ++ struct ath_atx_tid *tid,
  9418. + struct ath_tx_status *ts, int txok)
  9419. + {
  9420. + struct ath_node *an = NULL;
  9421. + struct sk_buff *skb;
  9422. + struct ieee80211_hdr *hdr;
  9423. + struct ieee80211_tx_info *tx_info;
  9424. +- struct ath_atx_tid *tid = NULL;
  9425. + struct ath_buf *bf_next, *bf_last = bf->bf_lastbf;
  9426. + struct list_head bf_head;
  9427. + struct sk_buff_head bf_pending;
  9428. +@@ -509,7 +509,6 @@ static void ath_tx_complete_aggr(struct
  9429. + }
  9430. +
  9431. + an = (struct ath_node *)sta->drv_priv;
  9432. +- tid = ath_get_skb_tid(sc, an, skb);
  9433. + seq_first = tid->seq_start;
  9434. + isba = ts->ts_flags & ATH9K_TX_BA;
  9435. +
  9436. +@@ -695,6 +694,7 @@ static void ath_tx_process_buffer(struct
  9437. + struct ieee80211_tx_info *info;
  9438. + struct ieee80211_sta *sta;
  9439. + struct ieee80211_hdr *hdr;
  9440. ++ struct ath_atx_tid *tid = NULL;
  9441. + bool txok, flush;
  9442. +
  9443. + txok = !(ts->ts_status & ATH9K_TXERR_MASK);
  9444. +@@ -710,6 +710,12 @@ static void ath_tx_process_buffer(struct
  9445. +
  9446. + hdr = (struct ieee80211_hdr *) bf->bf_mpdu->data;
  9447. + sta = ieee80211_find_sta_by_ifaddr(hw, hdr->addr1, hdr->addr2);
  9448. ++ if (sta) {
  9449. ++ struct ath_node *an = (struct ath_node *)sta->drv_priv;
  9450. ++ tid = ath_get_skb_tid(sc, an, bf->bf_mpdu);
  9451. ++ if (ts->ts_status & (ATH9K_TXERR_FILT | ATH9K_TXERR_XRETRY))
  9452. ++ tid->clear_ps_filter = true;
  9453. ++ }
  9454. +
  9455. + if (!bf_isampdu(bf)) {
  9456. + if (!flush) {
  9457. +@@ -721,7 +727,7 @@ static void ath_tx_process_buffer(struct
  9458. + }
  9459. + ath_tx_complete_buf(sc, bf, txq, bf_head, sta, ts, txok);
  9460. + } else
  9461. +- ath_tx_complete_aggr(sc, txq, bf, bf_head, sta, ts, txok);
  9462. ++ ath_tx_complete_aggr(sc, txq, bf, bf_head, sta, tid, ts, txok);
  9463. +
  9464. + if (!flush)
  9465. + ath_txq_schedule(sc, txq);
  9466. 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
  9467. deleted file mode 100644
  9468. index 32a2ad6..0000000
  9469. --- a/package/kernel/mac80211/patches/336-mac80211-minstrel_ht-set-default-tx-aggregation-time.patch
  9470. +++ /dev/null
  9471. @@ -1,31 +0,0 @@
  9472. -From: Felix Fietkau <nbd@openwrt.org>
  9473. -Date: Thu, 18 Feb 2016 19:45:33 +0100
  9474. -Subject: [PATCH] mac80211: minstrel_ht: set default tx aggregation timeout to
  9475. - 0
  9476. -
  9477. -The value 5000 was put here with the addition of the timeout field to
  9478. -ieee80211_start_tx_ba_session. It was originally added in mac80211 to
  9479. -save resources for drivers like iwlwifi, which only supports a limited
  9480. -number of concurrent aggregation sessions.
  9481. -
  9482. -Since iwlwifi does not use minstrel_ht and other drivers don't need
  9483. -this, 0 is a better default - especially since there have been
  9484. -recent reports of aggregation setup related issues reproduced with
  9485. -ath9k. This should improve stability without causing any adverse
  9486. -effects.
  9487. -
  9488. -Cc: stable@vger.kernel.org
  9489. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  9490. ----
  9491. -
  9492. ---- a/net/mac80211/rc80211_minstrel_ht.c
  9493. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  9494. -@@ -692,7 +692,7 @@ minstrel_aggr_check(struct ieee80211_sta
  9495. - if (likely(sta->ampdu_mlme.tid_tx[tid]))
  9496. - return;
  9497. -
  9498. -- ieee80211_start_tx_ba_session(pubsta, tid, 5000);
  9499. -+ ieee80211_start_tx_ba_session(pubsta, tid, 0);
  9500. - }
  9501. -
  9502. - static void
  9503. 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
  9504. deleted file mode 100644
  9505. index 229351b..0000000
  9506. --- a/package/kernel/mac80211/patches/337-mac80211-minstrel_ht-fix-a-logic-error-in-RTS-CTS-ha.patch
  9507. +++ /dev/null
  9508. @@ -1,26 +0,0 @@
  9509. -From: Felix Fietkau <nbd@openwrt.org>
  9510. -Date: Wed, 24 Feb 2016 12:03:13 +0100
  9511. -Subject: [PATCH] mac80211: minstrel_ht: fix a logic error in RTS/CTS handling
  9512. -MIME-Version: 1.0
  9513. -Content-Type: text/plain; charset=UTF-8
  9514. -Content-Transfer-Encoding: 8bit
  9515. -
  9516. -RTS/CTS needs to be enabled if the rate is a fallback rate *or* if it's
  9517. -a dual-stream rate and the sta is in dynamic SMPS mode.
  9518. -
  9519. -Fixes: a3ebb4e1b763 ("mac80211: minstrel_ht: handle peers in dynamic SMPS")
  9520. -Reported-by: Matías Richart <mrichart@fing.edu.uy>
  9521. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  9522. ----
  9523. -
  9524. ---- a/net/mac80211/rc80211_minstrel_ht.c
  9525. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  9526. -@@ -872,7 +872,7 @@ minstrel_ht_set_rate(struct minstrel_pri
  9527. - * - if station is in dynamic SMPS (and streams > 1)
  9528. - * - for fallback rates, to increase chances of getting through
  9529. - */
  9530. -- if (offset > 0 &&
  9531. -+ if (offset > 0 ||
  9532. - (mi->sta->smps_mode == IEEE80211_SMPS_DYNAMIC &&
  9533. - group->streams > 1)) {
  9534. - ratetbl->rate[offset].count = ratetbl->rate[offset].count_rts;
  9535. 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
  9536. deleted file mode 100644
  9537. index 56cd94a..0000000
  9538. --- a/package/kernel/mac80211/patches/338-mac80211-Fix-Public-Action-frame-RX-in-AP-mode.patch
  9539. +++ /dev/null
  9540. @@ -1,35 +0,0 @@
  9541. -From: Jouni Malinen <jouni@qca.qualcomm.com>
  9542. -Date: Tue, 1 Mar 2016 00:29:00 +0200
  9543. -Subject: [PATCH] mac80211: Fix Public Action frame RX in AP mode
  9544. -
  9545. -Public Action frames use special rules for how the BSSID field (Address
  9546. -3) is set. A wildcard BSSID is used in cases where the transmitter and
  9547. -recipient are not members of the same BSS. As such, we need to accept
  9548. -Public Action frames with wildcard BSSID.
  9549. -
  9550. -Commit db8e17324553 ("mac80211: ignore frames between TDLS peers when
  9551. -operating as AP") added a rule that drops Action frames to TDLS-peers
  9552. -based on an Action frame having different DA (Address 1) and BSSID
  9553. -(Address 3) values. This is not correct since it misses the possibility
  9554. -of BSSID being a wildcard BSSID in which case the Address 1 would not
  9555. -necessarily match.
  9556. -
  9557. -Fix this by allowing mac80211 to accept wildcard BSSID in an Action
  9558. -frame when in AP mode.
  9559. -
  9560. -Fixes: db8e17324553 ("mac80211: ignore frames between TDLS peers when operating as AP")
  9561. -Cc: stable@vger.kernel.org
  9562. -Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
  9563. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  9564. ----
  9565. -
  9566. ---- a/net/mac80211/rx.c
  9567. -+++ b/net/mac80211/rx.c
  9568. -@@ -3374,6 +3374,7 @@ static bool ieee80211_accept_frame(struc
  9569. - return false;
  9570. - /* ignore action frames to TDLS-peers */
  9571. - if (ieee80211_is_action(hdr->frame_control) &&
  9572. -+ !is_broadcast_ether_addr(bssid) &&
  9573. - !ether_addr_equal(bssid, hdr->addr1))
  9574. - return false;
  9575. - }
  9576. 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
  9577. deleted file mode 100644
  9578. index 15d6cd0..0000000
  9579. --- a/package/kernel/mac80211/patches/339-cfg80211-add-radiotap-VHT-info-to-rtap_namespace_siz.patch
  9580. +++ /dev/null
  9581. @@ -1,21 +0,0 @@
  9582. -From: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  9583. -Date: Fri, 19 Feb 2016 11:43:04 +0100
  9584. -Subject: [PATCH] cfg80211: add radiotap VHT info to rtap_namespace_sizes
  9585. -
  9586. -Add IEEE80211_RADIOTAP_VHT entry to rtap_namespace_sizes array in order to
  9587. -define alignment and size of VHT info in tx radiotap
  9588. -
  9589. -Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  9590. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  9591. ----
  9592. -
  9593. ---- a/net/wireless/radiotap.c
  9594. -+++ b/net/wireless/radiotap.c
  9595. -@@ -43,6 +43,7 @@ static const struct radiotap_align_size
  9596. - [IEEE80211_RADIOTAP_DATA_RETRIES] = { .align = 1, .size = 1, },
  9597. - [IEEE80211_RADIOTAP_MCS] = { .align = 1, .size = 3, },
  9598. - [IEEE80211_RADIOTAP_AMPDU_STATUS] = { .align = 4, .size = 8, },
  9599. -+ [IEEE80211_RADIOTAP_VHT] = { .align = 2, .size = 12, },
  9600. - /*
  9601. - * add more here as they are defined in radiotap.h
  9602. - */
  9603. 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
  9604. deleted file mode 100644
  9605. index de1b386..0000000
  9606. --- a/package/kernel/mac80211/patches/340-mac80211-fix-parsing-of-40Mhz-in-injected-radiotap-h.patch
  9607. +++ /dev/null
  9608. @@ -1,36 +0,0 @@
  9609. -From: Sven Eckelmann <sven@narfation.org>
  9610. -Date: Wed, 24 Feb 2016 16:25:49 +0100
  9611. -Subject: [PATCH] mac80211: fix parsing of 40Mhz in injected radiotap
  9612. - header
  9613. -
  9614. -The MCS bandwidth part of the radiotap header is 2 bits wide. The full 2
  9615. -bit have to compared against IEEE80211_RADIOTAP_MCS_BW_40 and not only if
  9616. -the first bit is set. Otherwise IEEE80211_RADIOTAP_MCS_BW_40 can be
  9617. -confused with IEEE80211_RADIOTAP_MCS_BW_20U.
  9618. -
  9619. -Fixes: 5ec3aed9ba4c ("mac80211: Parse legacy and HT rate in injected frames")
  9620. -Signed-off-by: Sven Eckelmann <sven@narfation.org>
  9621. ----
  9622. -
  9623. ---- a/net/mac80211/tx.c
  9624. -+++ b/net/mac80211/tx.c
  9625. -@@ -1689,7 +1689,7 @@ static bool ieee80211_parse_tx_radiotap(
  9626. - bool rate_found = false;
  9627. - u8 rate_retries = 0;
  9628. - u16 rate_flags = 0;
  9629. -- u8 mcs_known, mcs_flags;
  9630. -+ u8 mcs_known, mcs_flags, mcs_bw;
  9631. - int i;
  9632. -
  9633. - info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT |
  9634. -@@ -1765,8 +1765,9 @@ static bool ieee80211_parse_tx_radiotap(
  9635. - mcs_flags & IEEE80211_RADIOTAP_MCS_SGI)
  9636. - rate_flags |= IEEE80211_TX_RC_SHORT_GI;
  9637. -
  9638. -+ mcs_bw = mcs_flags & IEEE80211_RADIOTAP_MCS_BW_MASK;
  9639. - if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_BW &&
  9640. -- mcs_flags & IEEE80211_RADIOTAP_MCS_BW_40)
  9641. -+ mcs_bw == IEEE80211_RADIOTAP_MCS_BW_40)
  9642. - rate_flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
  9643. - break;
  9644. -
  9645. 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
  9646. deleted file mode 100644
  9647. index ac1f251..0000000
  9648. --- a/package/kernel/mac80211/patches/341-mac80211-parse-VHT-info-in-injected-frames.patch
  9649. +++ /dev/null
  9650. @@ -1,65 +0,0 @@
  9651. -From: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  9652. -Date: Tue, 23 Feb 2016 15:43:35 +0100
  9653. -Subject: [PATCH] mac80211: parse VHT info in injected frames
  9654. -
  9655. -Add VHT radiotap parsing support to ieee80211_parse_tx_radiotap().
  9656. -That capability has been tested using a d-link dir-860l rev b1 running
  9657. -OpenWrt trunk and mt76 driver
  9658. -
  9659. -Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  9660. ----
  9661. -
  9662. ---- a/net/mac80211/tx.c
  9663. -+++ b/net/mac80211/tx.c
  9664. -@@ -1690,6 +1690,8 @@ static bool ieee80211_parse_tx_radiotap(
  9665. - u8 rate_retries = 0;
  9666. - u16 rate_flags = 0;
  9667. - u8 mcs_known, mcs_flags, mcs_bw;
  9668. -+ u16 vht_known;
  9669. -+ u8 vht_mcs = 0, vht_nss = 0;
  9670. - int i;
  9671. -
  9672. - info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT |
  9673. -@@ -1771,6 +1773,32 @@ static bool ieee80211_parse_tx_radiotap(
  9674. - rate_flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
  9675. - break;
  9676. -
  9677. -+ case IEEE80211_RADIOTAP_VHT:
  9678. -+ vht_known = get_unaligned_le16(iterator.this_arg);
  9679. -+ rate_found = true;
  9680. -+
  9681. -+ rate_flags = IEEE80211_TX_RC_VHT_MCS;
  9682. -+ if ((vht_known & IEEE80211_RADIOTAP_VHT_KNOWN_GI) &&
  9683. -+ (iterator.this_arg[2] &
  9684. -+ IEEE80211_RADIOTAP_VHT_FLAG_SGI))
  9685. -+ rate_flags |= IEEE80211_TX_RC_SHORT_GI;
  9686. -+ if (vht_known &
  9687. -+ IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH) {
  9688. -+ if (iterator.this_arg[3] == 1)
  9689. -+ rate_flags |=
  9690. -+ IEEE80211_TX_RC_40_MHZ_WIDTH;
  9691. -+ else if (iterator.this_arg[3] == 4)
  9692. -+ rate_flags |=
  9693. -+ IEEE80211_TX_RC_80_MHZ_WIDTH;
  9694. -+ else if (iterator.this_arg[3] == 11)
  9695. -+ rate_flags |=
  9696. -+ IEEE80211_TX_RC_160_MHZ_WIDTH;
  9697. -+ }
  9698. -+
  9699. -+ vht_mcs = iterator.this_arg[4] >> 4;
  9700. -+ vht_nss = iterator.this_arg[4] & 0xF;
  9701. -+ break;
  9702. -+
  9703. - /*
  9704. - * Please update the file
  9705. - * Documentation/networking/mac80211-injection.txt
  9706. -@@ -1796,6 +1824,9 @@ static bool ieee80211_parse_tx_radiotap(
  9707. -
  9708. - if (rate_flags & IEEE80211_TX_RC_MCS) {
  9709. - info->control.rates[0].idx = rate;
  9710. -+ } else if (rate_flags & IEEE80211_TX_RC_VHT_MCS) {
  9711. -+ ieee80211_rate_set_vht(info->control.rates, vht_mcs,
  9712. -+ vht_nss);
  9713. - } else {
  9714. - for (i = 0; i < sband->n_bitrates; i++) {
  9715. - if (rate * 5 != sband->bitrates[i].bitrate)
  9716. 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
  9717. deleted file mode 100644
  9718. index d7452c2..0000000
  9719. --- a/package/kernel/mac80211/patches/342-mac80211-do-not-pass-injected-frames-without-a-valid.patch
  9720. +++ /dev/null
  9721. @@ -1,23 +0,0 @@
  9722. -From: Felix Fietkau <nbd@openwrt.org>
  9723. -Date: Wed, 2 Mar 2016 15:51:40 +0100
  9724. -Subject: [PATCH] mac80211: do not pass injected frames without a valid rate to
  9725. - the driver
  9726. -
  9727. -Fall back to rate control if the requested bitrate was not found.
  9728. -
  9729. -Fixes: dfdfc2beb0dd ("mac80211: Parse legacy and HT rate in injected frames")
  9730. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  9731. ----
  9732. -
  9733. ---- a/net/mac80211/tx.c
  9734. -+++ b/net/mac80211/tx.c
  9735. -@@ -1837,6 +1837,9 @@ static bool ieee80211_parse_tx_radiotap(
  9736. - }
  9737. - }
  9738. -
  9739. -+ if (info->control.rates[0].idx < 0)
  9740. -+ info->control.flags &= ~IEEE80211_TX_CTRL_RATE_INJECT;
  9741. -+
  9742. - info->control.rates[0].flags = rate_flags;
  9743. - info->control.rates[0].count = min_t(u8, rate_retries + 1,
  9744. - local->hw.max_rate_tries);
  9745. 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
  9746. deleted file mode 100644
  9747. index 55ff817..0000000
  9748. --- a/package/kernel/mac80211/patches/343-mac80211-minstrel_ht-improve-sample-rate-skip-logic.patch
  9749. +++ /dev/null
  9750. @@ -1,77 +0,0 @@
  9751. -From: Felix Fietkau <nbd@openwrt.org>
  9752. -Date: Thu, 3 Mar 2016 23:20:06 +0100
  9753. -Subject: [PATCH] mac80211: minstrel_ht: improve sample rate skip logic
  9754. -
  9755. -There were a few issues that were slowing down the process of finding
  9756. -the optimal rate, especially on devices with multi-rate retry
  9757. -limitations:
  9758. -
  9759. -When max_tp_rate[0] was slower than max_tp_rate[1], the code did not
  9760. -sample max_tp_rate[1], which would often allow it to switch places with
  9761. -max_tp_rate[0] (e.g. if only the first sampling attempts were bad, but the
  9762. -rate is otherwise good).
  9763. -
  9764. -Also, sample attempts of rates between max_tp_rate[0] and [1] were being
  9765. -ignored in this case, because the code only checked if the rate was
  9766. -slower than [1].
  9767. -
  9768. -Fix this by checking against the fastest / second fastest max_tp_rate
  9769. -instead of assuming a specific order between the two.
  9770. -
  9771. -In my tests this patch significantly reduces the time until minstrel_ht
  9772. -finds the optimal rate right after assoc
  9773. -
  9774. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  9775. ----
  9776. -
  9777. ---- a/net/mac80211/rc80211_minstrel_ht.c
  9778. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  9779. -@@ -958,6 +958,7 @@ minstrel_get_sample_rate(struct minstrel
  9780. - struct minstrel_rate_stats *mrs;
  9781. - struct minstrel_mcs_group_data *mg;
  9782. - unsigned int sample_dur, sample_group, cur_max_tp_streams;
  9783. -+ int tp_rate1, tp_rate2;
  9784. - int sample_idx = 0;
  9785. -
  9786. - if (mi->sample_wait > 0) {
  9787. -@@ -979,14 +980,22 @@ minstrel_get_sample_rate(struct minstrel
  9788. - mrs = &mg->rates[sample_idx];
  9789. - sample_idx += sample_group * MCS_GROUP_RATES;
  9790. -
  9791. -+ /* Set tp_rate1, tp_rate2 to the highest / second highest max_tp_rate */
  9792. -+ if (minstrel_get_duration(mi->max_tp_rate[0]) >
  9793. -+ minstrel_get_duration(mi->max_tp_rate[1])) {
  9794. -+ tp_rate1 = mi->max_tp_rate[1];
  9795. -+ tp_rate2 = mi->max_tp_rate[0];
  9796. -+ } else {
  9797. -+ tp_rate1 = mi->max_tp_rate[0];
  9798. -+ tp_rate2 = mi->max_tp_rate[1];
  9799. -+ }
  9800. -+
  9801. - /*
  9802. - * Sampling might add some overhead (RTS, no aggregation)
  9803. -- * to the frame. Hence, don't use sampling for the currently
  9804. -- * used rates.
  9805. -+ * to the frame. Hence, don't use sampling for the highest currently
  9806. -+ * used highest throughput or probability rate.
  9807. - */
  9808. -- if (sample_idx == mi->max_tp_rate[0] ||
  9809. -- sample_idx == mi->max_tp_rate[1] ||
  9810. -- sample_idx == mi->max_prob_rate)
  9811. -+ if (sample_idx == mi->max_tp_rate[0] || sample_idx == mi->max_prob_rate)
  9812. - return -1;
  9813. -
  9814. - /*
  9815. -@@ -1001,10 +1010,10 @@ minstrel_get_sample_rate(struct minstrel
  9816. - * if the link is working perfectly.
  9817. - */
  9818. -
  9819. -- cur_max_tp_streams = minstrel_mcs_groups[mi->max_tp_rate[0] /
  9820. -+ cur_max_tp_streams = minstrel_mcs_groups[tp_rate1 /
  9821. - MCS_GROUP_RATES].streams;
  9822. - sample_dur = minstrel_get_duration(sample_idx);
  9823. -- if (sample_dur >= minstrel_get_duration(mi->max_tp_rate[1]) &&
  9824. -+ if (sample_dur >= minstrel_get_duration(tp_rate2) &&
  9825. - (cur_max_tp_streams - 1 <
  9826. - minstrel_mcs_groups[sample_group].streams ||
  9827. - sample_dur >= minstrel_get_duration(mi->max_prob_rate))) {
  9828. 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
  9829. deleted file mode 100644
  9830. index 3de0f64..0000000
  9831. --- a/package/kernel/mac80211/patches/344-0008-brcmfmac-use-device-memsize-config-from-fw-if-define.patch
  9832. +++ /dev/null
  9833. @@ -1,73 +0,0 @@
  9834. -From: Hante Meuleman <meuleman@broadcom.com>
  9835. -Date: Wed, 17 Feb 2016 11:26:57 +0100
  9836. -Subject: [PATCH] brcmfmac: use device memsize config from fw if defined
  9837. -
  9838. -Newer type pcie devices have memory which get shared between fw and
  9839. -hw. The division of this memory is done firmware compile time. As a
  9840. -result the ramsize as used by driver needs to be adjusted for this.
  9841. -This is done by reading the memory size from the firmware.
  9842. -
  9843. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  9844. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  9845. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  9846. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  9847. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  9848. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9849. ----
  9850. -
  9851. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  9852. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  9853. -@@ -207,6 +207,10 @@ static struct brcmf_firmware_mapping brc
  9854. - #define BRCMF_PCIE_CFGREG_REG_BAR3_CONFIG 0x4F4
  9855. - #define BRCMF_PCIE_LINK_STATUS_CTRL_ASPM_ENAB 3
  9856. -
  9857. -+/* Magic number at a magic location to find RAM size */
  9858. -+#define BRCMF_RAMSIZE_MAGIC 0x534d4152 /* SMAR */
  9859. -+#define BRCMF_RAMSIZE_OFFSET 0x6c
  9860. -+
  9861. -
  9862. - struct brcmf_pcie_console {
  9863. - u32 base_addr;
  9864. -@@ -1412,6 +1416,28 @@ static const struct brcmf_bus_ops brcmf_
  9865. - };
  9866. -
  9867. -
  9868. -+static void
  9869. -+brcmf_pcie_adjust_ramsize(struct brcmf_pciedev_info *devinfo, u8 *data,
  9870. -+ u32 data_len)
  9871. -+{
  9872. -+ __le32 *field;
  9873. -+ u32 newsize;
  9874. -+
  9875. -+ if (data_len < BRCMF_RAMSIZE_OFFSET + 8)
  9876. -+ return;
  9877. -+
  9878. -+ field = (__le32 *)&data[BRCMF_RAMSIZE_OFFSET];
  9879. -+ if (le32_to_cpup(field) != BRCMF_RAMSIZE_MAGIC)
  9880. -+ return;
  9881. -+ field++;
  9882. -+ newsize = le32_to_cpup(field);
  9883. -+
  9884. -+ brcmf_dbg(PCIE, "Found ramsize info in FW, adjusting to 0x%x\n",
  9885. -+ newsize);
  9886. -+ devinfo->ci->ramsize = newsize;
  9887. -+}
  9888. -+
  9889. -+
  9890. - static int
  9891. - brcmf_pcie_init_share_ram_info(struct brcmf_pciedev_info *devinfo,
  9892. - u32 sharedram_addr)
  9893. -@@ -1694,6 +1720,13 @@ static void brcmf_pcie_setup(struct devi
  9894. -
  9895. - brcmf_pcie_attach(devinfo);
  9896. -
  9897. -+ /* Some of the firmwares have the size of the memory of the device
  9898. -+ * defined inside the firmware. This is because part of the memory in
  9899. -+ * the device is shared and the devision is determined by FW. Parse
  9900. -+ * the firmware and adjust the chip memory size now.
  9901. -+ */
  9902. -+ brcmf_pcie_adjust_ramsize(devinfo, (u8 *)fw->data, fw->size);
  9903. -+
  9904. - ret = brcmf_pcie_download_fw_nvram(devinfo, fw, nvram, nvram_len);
  9905. - if (ret)
  9906. - goto fail;
  9907. 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
  9908. deleted file mode 100644
  9909. index ca03ffe..0000000
  9910. --- a/package/kernel/mac80211/patches/344-0009-brcmfmac-use-bar1-window-size-as-provided-by-pci-sub.patch
  9911. +++ /dev/null
  9912. @@ -1,58 +0,0 @@
  9913. -From: Hante Meuleman <meuleman@broadcom.com>
  9914. -Date: Wed, 17 Feb 2016 11:26:58 +0100
  9915. -Subject: [PATCH] brcmfmac: use bar1 window size as provided by pci subsystem
  9916. -
  9917. -The PCIE bar1 window size is specified by chip. Currently the
  9918. -ioremap of bar1 was using a define which always matched the size
  9919. -of bar1, but newer chips can have a different bar1 sizes. With
  9920. -this patch the ioremap will be called with the by chip provided
  9921. -window size.
  9922. -
  9923. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  9924. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  9925. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  9926. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  9927. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  9928. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9929. ----
  9930. -
  9931. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  9932. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  9933. -@@ -72,7 +72,6 @@ static struct brcmf_firmware_mapping brc
  9934. -
  9935. - #define BRCMF_PCIE_FW_UP_TIMEOUT 2000 /* msec */
  9936. -
  9937. --#define BRCMF_PCIE_TCM_MAP_SIZE (4096 * 1024)
  9938. - #define BRCMF_PCIE_REG_MAP_SIZE (32 * 1024)
  9939. -
  9940. - /* backplane addres space accessed by BAR0 */
  9941. -@@ -252,7 +251,6 @@ struct brcmf_pciedev_info {
  9942. - char nvram_name[BRCMF_FW_NAME_LEN];
  9943. - void __iomem *regs;
  9944. - void __iomem *tcm;
  9945. -- u32 tcm_size;
  9946. - u32 ram_base;
  9947. - u32 ram_size;
  9948. - struct brcmf_chip *ci;
  9949. -@@ -1592,8 +1590,7 @@ static int brcmf_pcie_get_resource(struc
  9950. - }
  9951. -
  9952. - devinfo->regs = ioremap_nocache(bar0_addr, BRCMF_PCIE_REG_MAP_SIZE);
  9953. -- devinfo->tcm = ioremap_nocache(bar1_addr, BRCMF_PCIE_TCM_MAP_SIZE);
  9954. -- devinfo->tcm_size = BRCMF_PCIE_TCM_MAP_SIZE;
  9955. -+ devinfo->tcm = ioremap_nocache(bar1_addr, bar1_size);
  9956. -
  9957. - if (!devinfo->regs || !devinfo->tcm) {
  9958. - brcmf_err("ioremap() failed (%p,%p)\n", devinfo->regs,
  9959. -@@ -1602,8 +1599,9 @@ static int brcmf_pcie_get_resource(struc
  9960. - }
  9961. - brcmf_dbg(PCIE, "Phys addr : reg space = %p base addr %#016llx\n",
  9962. - devinfo->regs, (unsigned long long)bar0_addr);
  9963. -- brcmf_dbg(PCIE, "Phys addr : mem space = %p base addr %#016llx\n",
  9964. -- devinfo->tcm, (unsigned long long)bar1_addr);
  9965. -+ brcmf_dbg(PCIE, "Phys addr : mem space = %p base addr %#016llx size 0x%x\n",
  9966. -+ devinfo->tcm, (unsigned long long)bar1_addr,
  9967. -+ (unsigned int)bar1_size);
  9968. -
  9969. - return 0;
  9970. - }
  9971. 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
  9972. deleted file mode 100644
  9973. index e4a8f30..0000000
  9974. --- a/package/kernel/mac80211/patches/344-0010-brcmfmac-add-support-for-the-PCIE-4366c0-chip.patch
  9975. +++ /dev/null
  9976. @@ -1,34 +0,0 @@
  9977. -From: Hante Meuleman <meuleman@broadcom.com>
  9978. -Date: Wed, 17 Feb 2016 11:26:59 +0100
  9979. -Subject: [PATCH] brcmfmac: add support for the PCIE 4366c0 chip
  9980. -
  9981. -A newer version of the 4366 PCIE chip has been released. Add
  9982. -support for this version of the chip.
  9983. -
  9984. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  9985. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  9986. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  9987. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  9988. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9989. ----
  9990. -
  9991. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  9992. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  9993. -@@ -53,6 +53,7 @@ BRCMF_FW_NVRAM_DEF(4358, "brcmfmac4358-p
  9994. - BRCMF_FW_NVRAM_DEF(4359, "brcmfmac4359-pcie.bin", "brcmfmac4359-pcie.txt");
  9995. - BRCMF_FW_NVRAM_DEF(4365B, "brcmfmac4365b-pcie.bin", "brcmfmac4365b-pcie.txt");
  9996. - BRCMF_FW_NVRAM_DEF(4366B, "brcmfmac4366b-pcie.bin", "brcmfmac4366b-pcie.txt");
  9997. -+BRCMF_FW_NVRAM_DEF(4366C, "brcmfmac4366c-pcie.bin", "brcmfmac4366c-pcie.txt");
  9998. - BRCMF_FW_NVRAM_DEF(4371, "brcmfmac4371-pcie.bin", "brcmfmac4371-pcie.txt");
  9999. -
  10000. - static struct brcmf_firmware_mapping brcmf_pcie_fwnames[] = {
  10001. -@@ -66,7 +67,8 @@ static struct brcmf_firmware_mapping brc
  10002. - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4358_CHIP_ID, 0xFFFFFFFF, 4358),
  10003. - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4359_CHIP_ID, 0xFFFFFFFF, 4359),
  10004. - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4365_CHIP_ID, 0xFFFFFFFF, 4365B),
  10005. -- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4366_CHIP_ID, 0xFFFFFFFF, 4366B),
  10006. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4366_CHIP_ID, 0x0000000F, 4366B),
  10007. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4366_CHIP_ID, 0xFFFFFFF0, 4366C),
  10008. - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4371_CHIP_ID, 0xFFFFFFFF, 4371),
  10009. - };
  10010. -
  10011. 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
  10012. deleted file mode 100644
  10013. index c529ff2..0000000
  10014. --- a/package/kernel/mac80211/patches/344-0012-brcmfmac-increase-timeout-for-tx-eapol.patch
  10015. +++ /dev/null
  10016. @@ -1,30 +0,0 @@
  10017. -From: Hante Meuleman <meuleman@broadcom.com>
  10018. -Date: Wed, 17 Feb 2016 11:27:01 +0100
  10019. -Subject: [PATCH] brcmfmac: increase timeout for tx eapol
  10020. -
  10021. -When keys get set and updated this has to happen after eapol got
  10022. -transmitted (without key or old key) before the key can be updated.
  10023. -To make sure the order of sending eapol and configuring key is done
  10024. -correctly a timeout for tx of eapol is applied. This timeout is set
  10025. -to 50 msec, which is not always enough. Especially in AP mode and
  10026. -key updates the timeout may need to be much longer because client(s)
  10027. -can be in powersave. Increase the timeout from 50 to 950 msec.
  10028. -
  10029. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  10030. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10031. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  10032. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10033. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10034. ----
  10035. -
  10036. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  10037. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  10038. -@@ -40,7 +40,7 @@ MODULE_AUTHOR("Broadcom Corporation");
  10039. - MODULE_DESCRIPTION("Broadcom 802.11 wireless LAN fullmac driver.");
  10040. - MODULE_LICENSE("Dual BSD/GPL");
  10041. -
  10042. --#define MAX_WAIT_FOR_8021X_TX msecs_to_jiffies(50)
  10043. -+#define MAX_WAIT_FOR_8021X_TX msecs_to_jiffies(950)
  10044. -
  10045. - /* AMPDU rx reordering definitions */
  10046. - #define BRCMF_RXREORDER_FLOWID_OFFSET 0
  10047. 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
  10048. deleted file mode 100644
  10049. index f293401..0000000
  10050. --- a/package/kernel/mac80211/patches/345-brcmfmac-insert-default-boardrev-in-nvram-data-if-mi.patch
  10051. +++ /dev/null
  10052. @@ -1,114 +0,0 @@
  10053. -From: Hante Meuleman <hante.meuleman@broadcom.com>
  10054. -Date: Mon, 11 Apr 2016 11:35:23 +0200
  10055. -Subject: [PATCH] brcmfmac: insert default boardrev in nvram data if
  10056. - missing
  10057. -
  10058. -Some nvram files/stores come without the boardrev information,
  10059. -but firmware requires this to be set. When not found in nvram then
  10060. -add a default boardrev string to the nvram data.
  10061. -
  10062. -Reported-by: Rafal Milecki <zajec5@gmail.com>
  10063. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  10064. -Reviewed-by: Franky (Zhenhui) Lin <franky.lin@broadcom.com>
  10065. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  10066. -Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
  10067. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10068. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10069. ----
  10070. -
  10071. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  10072. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  10073. -@@ -29,6 +29,7 @@
  10074. - #define BRCMF_FW_MAX_NVRAM_SIZE 64000
  10075. - #define BRCMF_FW_NVRAM_DEVPATH_LEN 19 /* devpath0=pcie/1/4/ */
  10076. - #define BRCMF_FW_NVRAM_PCIEDEV_LEN 10 /* pcie/1/4/ + \0 */
  10077. -+#define BRCMF_FW_DEFAULT_BOARDREV "boardrev=0xff"
  10078. -
  10079. - enum nvram_parser_state {
  10080. - IDLE,
  10081. -@@ -51,6 +52,7 @@ enum nvram_parser_state {
  10082. - * @entry: start position of key,value entry.
  10083. - * @multi_dev_v1: detect pcie multi device v1 (compressed).
  10084. - * @multi_dev_v2: detect pcie multi device v2.
  10085. -+ * @boardrev_found: nvram contains boardrev information.
  10086. - */
  10087. - struct nvram_parser {
  10088. - enum nvram_parser_state state;
  10089. -@@ -63,6 +65,7 @@ struct nvram_parser {
  10090. - u32 entry;
  10091. - bool multi_dev_v1;
  10092. - bool multi_dev_v2;
  10093. -+ bool boardrev_found;
  10094. - };
  10095. -
  10096. - /**
  10097. -@@ -125,6 +128,8 @@ static enum nvram_parser_state brcmf_nvr
  10098. - nvp->multi_dev_v1 = true;
  10099. - if (strncmp(&nvp->data[nvp->entry], "pcie/", 5) == 0)
  10100. - nvp->multi_dev_v2 = true;
  10101. -+ if (strncmp(&nvp->data[nvp->entry], "boardrev", 8) == 0)
  10102. -+ nvp->boardrev_found = true;
  10103. - } else if (!is_nvram_char(c) || c == ' ') {
  10104. - brcmf_dbg(INFO, "warning: ln=%d:col=%d: '=' expected, skip invalid key entry\n",
  10105. - nvp->line, nvp->column);
  10106. -@@ -284,6 +289,8 @@ static void brcmf_fw_strip_multi_v1(stru
  10107. - while (i < nvp->nvram_len) {
  10108. - if ((nvp->nvram[i] - '0' == id) && (nvp->nvram[i + 1] == ':')) {
  10109. - i += 2;
  10110. -+ if (strncmp(&nvp->nvram[i], "boardrev", 8) == 0)
  10111. -+ nvp->boardrev_found = true;
  10112. - while (nvp->nvram[i] != 0) {
  10113. - nvram[j] = nvp->nvram[i];
  10114. - i++;
  10115. -@@ -335,6 +342,8 @@ static void brcmf_fw_strip_multi_v2(stru
  10116. - while (i < nvp->nvram_len - len) {
  10117. - if (strncmp(&nvp->nvram[i], prefix, len) == 0) {
  10118. - i += len;
  10119. -+ if (strncmp(&nvp->nvram[i], "boardrev", 8) == 0)
  10120. -+ nvp->boardrev_found = true;
  10121. - while (nvp->nvram[i] != 0) {
  10122. - nvram[j] = nvp->nvram[i];
  10123. - i++;
  10124. -@@ -356,6 +365,18 @@ fail:
  10125. - nvp->nvram_len = 0;
  10126. - }
  10127. -
  10128. -+static void brcmf_fw_add_defaults(struct nvram_parser *nvp)
  10129. -+{
  10130. -+ if (nvp->boardrev_found)
  10131. -+ return;
  10132. -+
  10133. -+ memcpy(&nvp->nvram[nvp->nvram_len], &BRCMF_FW_DEFAULT_BOARDREV,
  10134. -+ strlen(BRCMF_FW_DEFAULT_BOARDREV));
  10135. -+ nvp->nvram_len += strlen(BRCMF_FW_DEFAULT_BOARDREV);
  10136. -+ nvp->nvram[nvp->nvram_len] = '\0';
  10137. -+ nvp->nvram_len++;
  10138. -+}
  10139. -+
  10140. - /* brcmf_nvram_strip :Takes a buffer of "<var>=<value>\n" lines read from a fil
  10141. - * and ending in a NUL. Removes carriage returns, empty lines, comment lines,
  10142. - * and converts newlines to NULs. Shortens buffer as needed and pads with NULs.
  10143. -@@ -377,16 +398,21 @@ static void *brcmf_fw_nvram_strip(const
  10144. - if (nvp.state == END)
  10145. - break;
  10146. - }
  10147. -- if (nvp.multi_dev_v1)
  10148. -+ if (nvp.multi_dev_v1) {
  10149. -+ nvp.boardrev_found = false;
  10150. - brcmf_fw_strip_multi_v1(&nvp, domain_nr, bus_nr);
  10151. -- else if (nvp.multi_dev_v2)
  10152. -+ } else if (nvp.multi_dev_v2) {
  10153. -+ nvp.boardrev_found = false;
  10154. - brcmf_fw_strip_multi_v2(&nvp, domain_nr, bus_nr);
  10155. -+ }
  10156. -
  10157. - if (nvp.nvram_len == 0) {
  10158. - kfree(nvp.nvram);
  10159. - return NULL;
  10160. - }
  10161. -
  10162. -+ brcmf_fw_add_defaults(&nvp);
  10163. -+
  10164. - pad = nvp.nvram_len;
  10165. - *new_length = roundup(nvp.nvram_len + 1, 4);
  10166. - while (pad != *new_length) {
  10167. diff --git a/package/kernel/mac80211/patches/402-ath_regd_optional.patch b/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  10168. index 7351353..4634283 100644
  10169. --- a/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  10170. +++ b/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  10171. @@ -8,7 +8,7 @@
  10172. + return;
  10173. +#endif
  10174. +
  10175. - for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
  10176. + for (band = 0; band < NUM_NL80211_BANDS; band++) {
  10177. if (!wiphy->bands[band])
  10178. continue;
  10179. @@ -374,6 +378,10 @@ ath_reg_apply_ir_flags(struct wiphy *wip
  10180. @@ -19,7 +19,7 @@
  10181. + return;
  10182. +#endif
  10183. +
  10184. - sband = wiphy->bands[IEEE80211_BAND_2GHZ];
  10185. + sband = wiphy->bands[NL80211_BAND_2GHZ];
  10186. if (!sband)
  10187. return;
  10188. @@ -402,6 +410,10 @@ static void ath_reg_apply_radar_flags(st
  10189. @@ -30,7 +30,7 @@
  10190. + return;
  10191. +#endif
  10192. +
  10193. - if (!wiphy->bands[IEEE80211_BAND_5GHZ])
  10194. + if (!wiphy->bands[NL80211_BAND_5GHZ])
  10195. return;
  10196. @@ -633,6 +645,11 @@ ath_regd_init_wiphy(struct ath_regulator
  10197. @@ -59,7 +59,7 @@
  10198. ---help---
  10199. --- a/.local-symbols
  10200. +++ b/.local-symbols
  10201. -@@ -125,6 +125,7 @@ ADM8211=
  10202. +@@ -127,6 +127,7 @@ ADM8211=
  10203. ATH_COMMON=
  10204. WLAN_VENDOR_ATH=
  10205. ATH_DEBUG=
  10206. 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
  10207. index 1a62484..f2f52f9 100644
  10208. --- a/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch
  10209. +++ b/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch
  10210. @@ -1,6 +1,6 @@
  10211. --- a/drivers/net/wireless/ath/ath9k/init.c
  10212. +++ b/drivers/net/wireless/ath/ath9k/init.c
  10213. -@@ -722,6 +722,7 @@ static const struct ieee80211_iface_limi
  10214. +@@ -727,6 +727,7 @@ static const struct ieee80211_iface_limi
  10215. BIT(NL80211_IFTYPE_AP) },
  10216. { .max = 1, .types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  10217. BIT(NL80211_IFTYPE_P2P_GO) },
  10218. diff --git a/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch b/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch
  10219. index a7f9d9f..f21eed1 100644
  10220. --- a/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch
  10221. +++ b/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch
  10222. @@ -1,6 +1,6 @@
  10223. --- a/drivers/net/wireless/ath/ath9k/debug.c
  10224. +++ b/drivers/net/wireless/ath/ath9k/debug.c
  10225. -@@ -1301,6 +1301,53 @@ void ath9k_deinit_debug(struct ath_softc
  10226. +@@ -1315,6 +1315,53 @@ void ath9k_deinit_debug(struct ath_softc
  10227. ath9k_cmn_spectral_deinit_debug(&sc->spec_priv);
  10228. }
  10229. @@ -54,7 +54,7 @@
  10230. int ath9k_init_debug(struct ath_hw *ah)
  10231. {
  10232. struct ath_common *common = ath9k_hw_common(ah);
  10233. -@@ -1320,6 +1367,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  10234. +@@ -1334,6 +1381,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  10235. ath9k_tx99_init_debug(sc);
  10236. ath9k_cmn_spectral_init_debug(&sc->spec_priv, sc->debug.debugfs_phy);
  10237. diff --git a/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch b/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch
  10238. index 5892c3e..1825d77 100644
  10239. --- a/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch
  10240. +++ b/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch
  10241. @@ -1,6 +1,6 @@
  10242. --- a/drivers/net/wireless/ath/ath9k/init.c
  10243. +++ b/drivers/net/wireless/ath/ath9k/init.c
  10244. -@@ -1024,23 +1024,23 @@ static int __init ath9k_init(void)
  10245. +@@ -1030,23 +1030,23 @@ static int __init ath9k_init(void)
  10246. {
  10247. int error;
  10248. diff --git a/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch b/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch
  10249. index 6766111..15b8d7b 100644
  10250. --- a/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch
  10251. +++ b/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch
  10252. @@ -8,4 +8,4 @@
  10253. +#define ATH_RXBUF 256
  10254. #define ATH_TXBUF 512
  10255. #define ATH_TXBUF_RESERVE 5
  10256. - #define ATH_MAX_QDEPTH (ATH_TXBUF / 4 - ATH_TXBUF_RESERVE)
  10257. + #define ATH_TXMAXTRY 13
  10258. diff --git a/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch b/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch
  10259. index 5ecf528..c98072b 100644
  10260. --- a/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch
  10261. +++ b/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch
  10262. @@ -1,6 +1,6 @@
  10263. --- a/drivers/net/wireless/ath/ath9k/debug.c
  10264. +++ b/drivers/net/wireless/ath/ath9k/debug.c
  10265. -@@ -1348,6 +1348,52 @@ static const struct file_operations fops
  10266. +@@ -1362,6 +1362,52 @@ static const struct file_operations fops
  10267. .owner = THIS_MODULE
  10268. };
  10269. @@ -53,7 +53,7 @@
  10270. int ath9k_init_debug(struct ath_hw *ah)
  10271. {
  10272. struct ath_common *common = ath9k_hw_common(ah);
  10273. -@@ -1369,6 +1415,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  10274. +@@ -1383,6 +1429,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  10275. debugfs_create_file("eeprom", S_IRUSR, sc->debug.debugfs_phy, sc,
  10276. &fops_eeprom);
  10277. @@ -90,7 +90,7 @@
  10278. ichan->channel = chan->center_freq;
  10279. ichan->chan = chan;
  10280. @@ -308,7 +310,19 @@ static void ath9k_cmn_update_ichannel(st
  10281. - if (chan->band == IEEE80211_BAND_5GHZ)
  10282. + if (chan->band == NL80211_BAND_5GHZ)
  10283. flags |= CHANNEL_5GHZ;
  10284. - switch (chandef->width) {
  10285. diff --git a/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch b/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
  10286. index c84d1bc..167eeff 100644
  10287. --- a/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
  10288. +++ b/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
  10289. @@ -20,7 +20,7 @@
  10290. #define AR9160_DEVID_PCI 0x0027
  10291. --- a/drivers/net/wireless/ath/ath9k/pci.c
  10292. +++ b/drivers/net/wireless/ath/ath9k/pci.c
  10293. -@@ -751,6 +751,7 @@ static const struct pci_device_id ath_pc
  10294. +@@ -761,6 +761,7 @@ static const struct pci_device_id ath_pc
  10295. .driver_data = ATH9K_PCI_BT_ANT_DIV },
  10296. #endif
  10297. diff --git a/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
  10298. index e151a12..c40598d 100644
  10299. --- a/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
  10300. +++ b/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
  10301. @@ -1,6 +1,6 @@
  10302. --- a/include/net/cfg80211.h
  10303. +++ b/include/net/cfg80211.h
  10304. -@@ -2363,6 +2363,7 @@ struct cfg80211_qos_map {
  10305. +@@ -2410,6 +2410,7 @@ struct cfg80211_qos_map {
  10306. * (as advertised by the nl80211 feature flag.)
  10307. * @get_tx_power: store the current TX power into the dbm variable;
  10308. * return 0 if successful
  10309. @@ -8,7 +8,7 @@
  10310. *
  10311. * @set_wds_peer: set the WDS peer for a WDS interface
  10312. *
  10313. -@@ -2624,6 +2625,7 @@ struct cfg80211_ops {
  10314. +@@ -2671,6 +2672,7 @@ struct cfg80211_ops {
  10315. enum nl80211_tx_power_setting type, int mbm);
  10316. int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
  10317. int *dbm);
  10318. @@ -18,7 +18,7 @@
  10319. const u8 *addr);
  10320. --- a/include/net/mac80211.h
  10321. +++ b/include/net/mac80211.h
  10322. -@@ -1286,6 +1286,7 @@ enum ieee80211_smps_mode {
  10323. +@@ -1317,6 +1317,7 @@ enum ieee80211_smps_mode {
  10324. *
  10325. * @power_level: requested transmit power (in dBm), backward compatibility
  10326. * value only that is set to the minimum of all interfaces
  10327. @@ -26,7 +26,7 @@
  10328. *
  10329. * @chandef: the channel definition to tune to
  10330. * @radar_enabled: whether radar detection is enabled
  10331. -@@ -1306,6 +1307,7 @@ enum ieee80211_smps_mode {
  10332. +@@ -1337,6 +1338,7 @@ enum ieee80211_smps_mode {
  10333. struct ieee80211_conf {
  10334. u32 flags;
  10335. int power_level, dynamic_ps_timeout;
  10336. @@ -36,9 +36,9 @@
  10337. u8 ps_dtim_period;
  10338. --- a/include/uapi/linux/nl80211.h
  10339. +++ b/include/uapi/linux/nl80211.h
  10340. -@@ -1790,6 +1790,9 @@ enum nl80211_commands {
  10341. - * between scans. The scan plans are executed sequentially.
  10342. - * Each scan plan is a nested attribute of &enum nl80211_sched_scan_plan.
  10343. +@@ -1829,6 +1829,9 @@ enum nl80211_commands {
  10344. + * %NL80211_ATTR_EXT_CAPA_MASK, to specify the extended capabilities per
  10345. + * interface type.
  10346. *
  10347. + * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce
  10348. + * transmit power to stay within regulatory limits. u32, dBi.
  10349. @@ -46,9 +46,9 @@
  10350. * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  10351. * @NL80211_ATTR_MAX: highest attribute number currently defined
  10352. * @__NL80211_ATTR_AFTER_LAST: internal use
  10353. -@@ -2164,6 +2167,8 @@ enum nl80211_attrs {
  10354. - NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS,
  10355. - NL80211_ATTR_SCHED_SCAN_PLANS,
  10356. +@@ -2213,6 +2216,8 @@ enum nl80211_attrs {
  10357. +
  10358. + NL80211_ATTR_IFTYPE_EXT_CAPA,
  10359. + NL80211_ATTR_WIPHY_ANTENNA_GAIN,
  10360. +
  10361. @@ -57,7 +57,7 @@
  10362. __NL80211_ATTR_AFTER_LAST,
  10363. --- a/net/mac80211/cfg.c
  10364. +++ b/net/mac80211/cfg.c
  10365. -@@ -2229,6 +2229,19 @@ static int ieee80211_get_tx_power(struct
  10366. +@@ -2238,6 +2238,19 @@ static int ieee80211_get_tx_power(struct
  10367. return 0;
  10368. }
  10369. @@ -77,7 +77,7 @@
  10370. static int ieee80211_set_wds_peer(struct wiphy *wiphy, struct net_device *dev,
  10371. const u8 *addr)
  10372. {
  10373. -@@ -3403,6 +3416,7 @@ const struct cfg80211_ops mac80211_confi
  10374. +@@ -3412,6 +3425,7 @@ const struct cfg80211_ops mac80211_confi
  10375. .set_wiphy_params = ieee80211_set_wiphy_params,
  10376. .set_tx_power = ieee80211_set_tx_power,
  10377. .get_tx_power = ieee80211_get_tx_power,
  10378. @@ -87,7 +87,7 @@
  10379. CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd)
  10380. --- a/net/mac80211/ieee80211_i.h
  10381. +++ b/net/mac80211/ieee80211_i.h
  10382. -@@ -1318,6 +1318,7 @@ struct ieee80211_local {
  10383. +@@ -1338,6 +1338,7 @@ struct ieee80211_local {
  10384. int dynamic_ps_forced_timeout;
  10385. int user_power_level; /* in dBm, for all interfaces */
  10386. @@ -119,7 +119,7 @@
  10387. if (local->hw.conf.power_level != power) {
  10388. changed |= IEEE80211_CONF_CHANGE_POWER;
  10389. local->hw.conf.power_level = power;
  10390. -@@ -586,6 +592,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
  10391. +@@ -588,6 +594,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
  10392. IEEE80211_RADIOTAP_MCS_HAVE_BW;
  10393. local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI |
  10394. IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH;
  10395. @@ -129,15 +129,15 @@
  10396. local->user_power_level = IEEE80211_UNSET_POWER_LEVEL;
  10397. --- a/net/wireless/nl80211.c
  10398. +++ b/net/wireless/nl80211.c
  10399. -@@ -403,6 +403,7 @@ static const struct nla_policy nl80211_p
  10400. - [NL80211_ATTR_NETNS_FD] = { .type = NLA_U32 },
  10401. - [NL80211_ATTR_SCHED_SCAN_DELAY] = { .type = NLA_U32 },
  10402. - [NL80211_ATTR_REG_INDOOR] = { .type = NLA_FLAG },
  10403. +@@ -407,6 +407,7 @@ static const struct nla_policy nl80211_p
  10404. + [NL80211_ATTR_PBSS] = { .type = NLA_FLAG },
  10405. + [NL80211_ATTR_BSS_SELECT] = { .type = NLA_NESTED },
  10406. + [NL80211_ATTR_STA_SUPPORT_P2P_PS] = { .type = NLA_U8 },
  10407. + [NL80211_ATTR_WIPHY_ANTENNA_GAIN] = { .type = NLA_U32 },
  10408. };
  10409. /* policy for the key attributes */
  10410. -@@ -2220,6 +2221,20 @@ static int nl80211_set_wiphy(struct sk_b
  10411. +@@ -2294,6 +2295,20 @@ static int nl80211_set_wiphy(struct sk_b
  10412. if (result)
  10413. return result;
  10414. }
  10415. diff --git a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  10416. index 5a5e464..0b25749 100644
  10417. --- a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  10418. +++ b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  10419. @@ -1,16 +1,16 @@
  10420. --- a/drivers/net/wireless/ath/ath9k/ath9k.h
  10421. +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  10422. @@ -814,6 +814,9 @@ static inline int ath9k_dump_btcoex(stru
  10423. + #ifdef CPTCFG_MAC80211_LEDS
  10424. void ath_init_leds(struct ath_softc *sc);
  10425. void ath_deinit_leds(struct ath_softc *sc);
  10426. - void ath_fill_led_pin(struct ath_softc *sc);
  10427. +int ath_create_gpio_led(struct ath_softc *sc, int gpio, const char *name,
  10428. -+ const char *trigger, bool active_low);
  10429. ++ const char *trigger, bool active_low);
  10430. +
  10431. #else
  10432. static inline void ath_init_leds(struct ath_softc *sc)
  10433. {
  10434. -@@ -953,6 +956,13 @@ void ath_ant_comb_scan(struct ath_softc
  10435. +@@ -950,6 +953,13 @@ void ath_ant_comb_scan(struct ath_softc
  10436. #define ATH9K_NUM_CHANCTX 2 /* supports 2 operating channels */
  10437. @@ -24,7 +24,7 @@
  10438. struct ath_softc {
  10439. struct ieee80211_hw *hw;
  10440. struct device *dev;
  10441. -@@ -1005,9 +1015,8 @@ struct ath_softc {
  10442. +@@ -1002,9 +1012,8 @@ struct ath_softc {
  10443. spinlock_t chan_lock;
  10444. #ifdef CPTCFG_MAC80211_LEDS
  10445. @@ -38,24 +38,33 @@
  10446. #ifdef CPTCFG_ATH9K_DEBUGFS
  10447. --- a/drivers/net/wireless/ath/ath9k/gpio.c
  10448. +++ b/drivers/net/wireless/ath/ath9k/gpio.c
  10449. -@@ -24,45 +24,102 @@
  10450. - static void ath_led_brightness(struct led_classdev *led_cdev,
  10451. - enum led_brightness brightness)
  10452. +@@ -22,7 +22,7 @@
  10453. +
  10454. + #ifdef CPTCFG_MAC80211_LEDS
  10455. +
  10456. +-void ath_fill_led_pin(struct ath_softc *sc)
  10457. ++static void ath_fill_led_pin(struct ath_softc *sc)
  10458. {
  10459. -- struct ath_softc *sc = container_of(led_cdev, struct ath_softc, led_cdev);
  10460. -- u32 val = (brightness == LED_OFF);
  10461. + struct ath_hw *ah = sc->sc_ah;
  10462. +
  10463. +@@ -39,61 +39,111 @@ void ath_fill_led_pin(struct ath_softc *
  10464. + else
  10465. + ah->led_pin = ATH_LED_PIN_DEF;
  10466. + }
  10467. ++}
  10468. ++
  10469. ++static void ath_led_brightness(struct led_classdev *led_cdev,
  10470. ++ enum led_brightness brightness)
  10471. ++{
  10472. + struct ath_led *led = container_of(led_cdev, struct ath_led, cdev);
  10473. + struct ath_softc *sc = led->sc;
  10474. -
  10475. -- if (sc->sc_ah->config.led_active_high)
  10476. -- val = !val;
  10477. ++
  10478. + ath9k_ps_wakeup(sc);
  10479. + ath9k_hw_set_gpio(sc->sc_ah, led->gpio->gpio,
  10480. + (brightness != LED_OFF) ^ led->gpio->active_low);
  10481. + ath9k_ps_restore(sc);
  10482. +}
  10483. -
  10484. -- ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, val);
  10485. ++
  10486. +static int ath_add_led(struct ath_softc *sc, struct ath_led *led)
  10487. +{
  10488. + const struct gpio_led *gpio = led->gpio;
  10489. @@ -71,30 +80,40 @@
  10490. +
  10491. + led->sc = sc;
  10492. + list_add(&led->list, &sc->leds);
  10493. -+
  10494. -+ /* Configure gpio for output */
  10495. -+ ath9k_hw_cfg_output(sc->sc_ah, gpio->gpio,
  10496. -+ AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
  10497. -+
  10498. +
  10499. + /* Configure gpio for output */
  10500. +- ath9k_hw_gpio_request_out(ah, ah->led_pin, "ath9k-led",
  10501. ++ ath9k_hw_gpio_request_out(sc->sc_ah, gpio->gpio, gpio->name,
  10502. + AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
  10503. +
  10504. +- /* LED off, active low */
  10505. +- ath9k_hw_set_gpio(ah, ah->led_pin, ah->config.led_active_high ? 0 : 1);
  10506. + /* LED off */
  10507. + ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low);
  10508. +
  10509. + return 0;
  10510. -+}
  10511. -+
  10512. + }
  10513. +
  10514. +-static void ath_led_brightness(struct led_classdev *led_cdev,
  10515. +- enum led_brightness brightness)
  10516. +int ath_create_gpio_led(struct ath_softc *sc, int gpio_num, const char *name,
  10517. + const char *trigger, bool active_low)
  10518. -+{
  10519. + {
  10520. +- struct ath_softc *sc = container_of(led_cdev, struct ath_softc, led_cdev);
  10521. +- u32 val = (brightness == LED_OFF);
  10522. + struct ath_led *led;
  10523. + struct gpio_led *gpio;
  10524. + char *_name;
  10525. + int ret;
  10526. -+
  10527. +
  10528. +- if (sc->sc_ah->config.led_active_high)
  10529. +- val = !val;
  10530. + led = kzalloc(sizeof(*led) + sizeof(*gpio) + strlen(name) + 1,
  10531. + GFP_KERNEL);
  10532. + if (!led)
  10533. + return -ENOMEM;
  10534. -+
  10535. +
  10536. +- ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, val);
  10537. + led->gpio = gpio = (struct gpio_led *) (led + 1);
  10538. + _name = (char *) (led->gpio + 1);
  10539. +
  10540. @@ -115,15 +134,18 @@
  10541. {
  10542. - if (!sc->led_registered)
  10543. - return;
  10544. -+ struct ath_led *led;
  10545. -
  10546. +-
  10547. - ath_led_brightness(&sc->led_cdev, LED_OFF);
  10548. - led_classdev_unregister(&sc->led_cdev);
  10549. ++ struct ath_led *led;
  10550. +
  10551. +- ath9k_hw_gpio_free(sc->sc_ah, sc->sc_ah->led_pin);
  10552. + while (!list_empty(&sc->leds)) {
  10553. + led = list_first_entry(&sc->leds, struct ath_led, list);
  10554. + list_del(&led->list);
  10555. + ath_led_brightness(&led->cdev, LED_OFF);
  10556. + led_classdev_unregister(&led->cdev);
  10557. ++ ath9k_hw_gpio_free(sc->sc_ah, led->gpio->gpio);
  10558. + kfree(led);
  10559. + }
  10560. }
  10561. @@ -139,6 +161,8 @@
  10562. if (AR_SREV_9100(sc->sc_ah))
  10563. return;
  10564. + ath_fill_led_pin(sc);
  10565. +
  10566. - if (!ath9k_led_blink)
  10567. - sc->led_cdev.default_trigger =
  10568. - ieee80211_get_radio_led_name(sc->hw);
  10569. @@ -159,13 +183,14 @@
  10570. + trigger = ieee80211_get_radio_led_name(sc->hw);
  10571. - sc->led_registered = true;
  10572. -+ ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, !sc->sc_ah->config.led_active_high);
  10573. ++ ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger,
  10574. ++ !sc->sc_ah->config.led_active_high);
  10575. }
  10576. + #endif
  10577. - void ath_fill_led_pin(struct ath_softc *sc)
  10578. --- a/drivers/net/wireless/ath/ath9k/init.c
  10579. +++ b/drivers/net/wireless/ath/ath9k/init.c
  10580. -@@ -936,7 +936,7 @@ int ath9k_init_device(u16 devid, struct
  10581. +@@ -942,7 +942,7 @@ int ath9k_init_device(u16 devid, struct
  10582. #ifdef CPTCFG_MAC80211_LEDS
  10583. /* must be initialized before ieee80211_register_hw */
  10584. @@ -176,7 +201,7 @@
  10585. #endif
  10586. --- a/drivers/net/wireless/ath/ath9k/debug.c
  10587. +++ b/drivers/net/wireless/ath/ath9k/debug.c
  10588. -@@ -1393,6 +1393,61 @@ static const struct file_operations fops
  10589. +@@ -1407,6 +1407,61 @@ static const struct file_operations fops
  10590. .llseek = default_llseek,
  10591. };
  10592. @@ -238,7 +263,7 @@
  10593. int ath9k_init_debug(struct ath_hw *ah)
  10594. {
  10595. -@@ -1417,6 +1472,10 @@ int ath9k_init_debug(struct ath_hw *ah)
  10596. +@@ -1431,6 +1486,10 @@ int ath9k_init_debug(struct ath_hw *ah)
  10597. &fops_eeprom);
  10598. debugfs_create_file("chanbw", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
  10599. sc, &fops_chanbw);
  10600. diff --git a/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch b/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch
  10601. index 7c10ea6..f656697 100644
  10602. --- a/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch
  10603. +++ b/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch
  10604. @@ -1,6 +1,6 @@
  10605. --- a/include/linux/ath9k_platform.h
  10606. +++ b/include/linux/ath9k_platform.h
  10607. -@@ -41,6 +41,9 @@ struct ath9k_platform_data {
  10608. +@@ -45,6 +45,9 @@ struct ath9k_platform_data {
  10609. int (*external_reset)(void);
  10610. bool use_eeprom;
  10611. @@ -20,7 +20,7 @@
  10612. /********************************/
  10613. /* LED functions */
  10614. -@@ -88,6 +89,24 @@ int ath_create_gpio_led(struct ath_softc
  10615. +@@ -108,6 +109,24 @@ int ath_create_gpio_led(struct ath_softc
  10616. return ret;
  10617. }
  10618. @@ -45,7 +45,7 @@
  10619. void ath_deinit_leds(struct ath_softc *sc)
  10620. {
  10621. struct ath_led *led;
  10622. -@@ -103,8 +122,10 @@ void ath_deinit_leds(struct ath_softc *s
  10623. +@@ -124,8 +143,10 @@ void ath_deinit_leds(struct ath_softc *s
  10624. void ath_init_leds(struct ath_softc *sc)
  10625. {
  10626. @@ -56,10 +56,10 @@
  10627. INIT_LIST_HEAD(&sc->leds);
  10628. -@@ -120,6 +141,12 @@ void ath_init_leds(struct ath_softc *sc)
  10629. - trigger = ieee80211_get_radio_led_name(sc->hw);
  10630. +@@ -144,6 +165,12 @@ void ath_init_leds(struct ath_softc *sc)
  10631. - ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, !sc->sc_ah->config.led_active_high);
  10632. + ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger,
  10633. + !sc->sc_ah->config.led_active_high);
  10634. +
  10635. + if (!pdata)
  10636. + return;
  10637. @@ -67,5 +67,5 @@
  10638. + for (i = 0; i < pdata->num_leds; i++)
  10639. + ath_create_platform_led(sc, &pdata->leds[i]);
  10640. }
  10641. + #endif
  10642. - void ath_fill_led_pin(struct ath_softc *sc)
  10643. 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
  10644. index 6d62a2b..50d8a7a 100644
  10645. --- a/package/kernel/mac80211/patches/532-ath9k_get_led_polarity_from_platform_data.patch
  10646. +++ b/package/kernel/mac80211/patches/532-ath9k_get_led_polarity_from_platform_data.patch
  10647. @@ -1,6 +1,6 @@
  10648. --- a/include/linux/ath9k_platform.h
  10649. +++ b/include/linux/ath9k_platform.h
  10650. -@@ -36,6 +36,7 @@ struct ath9k_platform_data {
  10651. +@@ -40,6 +40,7 @@ struct ath9k_platform_data {
  10652. bool tx_gain_buffalo;
  10653. bool disable_2ghz;
  10654. bool disable_5ghz;
  10655. @@ -10,7 +10,7 @@
  10656. int (*external_reset)(void);
  10657. --- a/drivers/net/wireless/ath/ath9k/init.c
  10658. +++ b/drivers/net/wireless/ath/ath9k/init.c
  10659. -@@ -577,6 +577,7 @@ static int ath9k_init_softc(u16 devid, s
  10660. +@@ -580,6 +580,7 @@ static int ath9k_init_softc(u16 devid, s
  10661. ah->external_reset = pdata->external_reset;
  10662. ah->disable_2ghz = pdata->disable_2ghz;
  10663. ah->disable_5ghz = pdata->disable_5ghz;
  10664. 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
  10665. index 3c5e9f5..c2d2781 100644
  10666. --- a/package/kernel/mac80211/patches/541-ath9k_rx_dma_stop_check.patch
  10667. +++ b/package/kernel/mac80211/patches/541-ath9k_rx_dma_stop_check.patch
  10668. @@ -1,6 +1,6 @@
  10669. --- a/drivers/net/wireless/ath/ath9k/mac.c
  10670. +++ b/drivers/net/wireless/ath/ath9k/mac.c
  10671. -@@ -695,7 +695,7 @@ bool ath9k_hw_stopdmarecv(struct ath_hw
  10672. +@@ -698,7 +698,7 @@ bool ath9k_hw_stopdmarecv(struct ath_hw
  10673. {
  10674. #define AH_RX_STOP_DMA_TIMEOUT 10000 /* usec */
  10675. struct ath_common *common = ath9k_hw_common(ah);
  10676. @@ -9,7 +9,7 @@
  10677. int i;
  10678. /* Enable access to the DMA observation bus */
  10679. -@@ -725,6 +725,16 @@ bool ath9k_hw_stopdmarecv(struct ath_hw
  10680. +@@ -728,6 +728,16 @@ bool ath9k_hw_stopdmarecv(struct ath_hw
  10681. }
  10682. if (i == 0) {
  10683. diff --git a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  10684. index e83c6bf..4615643 100644
  10685. --- a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  10686. +++ b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  10687. @@ -1,6 +1,6 @@
  10688. --- a/drivers/net/wireless/ath/ath9k/debug.c
  10689. +++ b/drivers/net/wireless/ath/ath9k/debug.c
  10690. -@@ -1449,6 +1449,50 @@ static const struct file_operations fops
  10691. +@@ -1463,6 +1463,50 @@ static const struct file_operations fops
  10692. #endif
  10693. @@ -51,7 +51,7 @@
  10694. int ath9k_init_debug(struct ath_hw *ah)
  10695. {
  10696. struct ath_common *common = ath9k_hw_common(ah);
  10697. -@@ -1476,6 +1520,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  10698. +@@ -1490,6 +1534,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  10699. debugfs_create_file("gpio_led", S_IWUSR,
  10700. sc->debug.debugfs_phy, sc, &fops_gpio_led);
  10701. #endif
  10702. @@ -62,7 +62,7 @@
  10703. debugfs_create_devm_seqfile(sc->dev, "interrupt", sc->debug.debugfs_phy,
  10704. --- a/drivers/net/wireless/ath/ath9k/hw.h
  10705. +++ b/drivers/net/wireless/ath/ath9k/hw.h
  10706. -@@ -519,6 +519,12 @@ enum {
  10707. +@@ -520,6 +520,12 @@ enum {
  10708. ATH9K_RESET_COLD,
  10709. };
  10710. @@ -75,7 +75,7 @@
  10711. struct ath9k_hw_version {
  10712. u32 magic;
  10713. u16 devid;
  10714. -@@ -804,6 +810,8 @@ struct ath_hw {
  10715. +@@ -805,6 +811,8 @@ struct ath_hw {
  10716. u32 rfkill_polarity;
  10717. u32 ah_flags;
  10718. @@ -84,7 +84,7 @@
  10719. bool reset_power_on;
  10720. bool htc_reset_init;
  10721. -@@ -1066,6 +1074,7 @@ void ath9k_hw_check_nav(struct ath_hw *a
  10722. +@@ -1068,6 +1076,7 @@ void ath9k_hw_check_nav(struct ath_hw *a
  10723. bool ath9k_hw_check_alive(struct ath_hw *ah);
  10724. bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode);
  10725. @@ -94,7 +94,7 @@
  10726. struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah,
  10727. --- a/drivers/net/wireless/ath/ath9k/hw.c
  10728. +++ b/drivers/net/wireless/ath/ath9k/hw.c
  10729. -@@ -1819,6 +1819,20 @@ u32 ath9k_hw_get_tsf_offset(struct times
  10730. +@@ -1841,6 +1841,20 @@ u32 ath9k_hw_get_tsf_offset(struct times
  10731. }
  10732. EXPORT_SYMBOL(ath9k_hw_get_tsf_offset);
  10733. @@ -115,7 +115,7 @@
  10734. int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
  10735. struct ath9k_hw_cal_data *caldata, bool fastcc)
  10736. {
  10737. -@@ -2027,6 +2041,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  10738. +@@ -2049,6 +2063,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  10739. ar9003_hw_disable_phy_restart(ah);
  10740. ath9k_hw_apply_gpio_override(ah);
  10741. diff --git a/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch b/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  10742. index d7bb5a1..656ed43 100644
  10743. --- a/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  10744. +++ b/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  10745. @@ -1,6 +1,6 @@
  10746. --- a/drivers/net/wireless/ath/ath9k/hw.h
  10747. +++ b/drivers/net/wireless/ath/ath9k/hw.h
  10748. -@@ -720,6 +720,7 @@ struct ath_spec_scan {
  10749. +@@ -721,6 +721,7 @@ struct ath_spec_scan {
  10750. * @config_pci_powersave:
  10751. * @calibrate: periodic calibration for NF, ANI, IQ, ADC gain, ADC-DC
  10752. *
  10753. @@ -8,7 +8,7 @@
  10754. * @spectral_scan_config: set parameters for spectral scan and enable/disable it
  10755. * @spectral_scan_trigger: trigger a spectral scan run
  10756. * @spectral_scan_wait: wait for a spectral scan run to finish
  10757. -@@ -742,6 +743,7 @@ struct ath_hw_ops {
  10758. +@@ -743,6 +744,7 @@ struct ath_hw_ops {
  10759. struct ath_hw_antcomb_conf *antconf);
  10760. void (*antdiv_comb_conf_set)(struct ath_hw *ah,
  10761. struct ath_hw_antcomb_conf *antconf);
  10762. @@ -18,7 +18,7 @@
  10763. void (*spectral_scan_trigger)(struct ath_hw *ah);
  10764. --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  10765. +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  10766. -@@ -1998,6 +1998,26 @@ void ar9003_hw_init_rate_txpower(struct
  10767. +@@ -1945,6 +1945,26 @@ void ar9003_hw_init_rate_txpower(struct
  10768. }
  10769. }
  10770. @@ -45,7 +45,7 @@
  10771. void ar9003_hw_attach_phy_ops(struct ath_hw *ah)
  10772. {
  10773. struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah);
  10774. -@@ -2034,6 +2054,7 @@ void ar9003_hw_attach_phy_ops(struct ath
  10775. +@@ -1981,6 +2001,7 @@ void ar9003_hw_attach_phy_ops(struct ath
  10776. priv_ops->set_radar_params = ar9003_hw_set_radar_params;
  10777. priv_ops->fast_chan_change = ar9003_hw_fast_chan_change;
  10778. @@ -55,9 +55,9 @@
  10779. ops->spectral_scan_config = ar9003_hw_spectral_scan_config;
  10780. --- a/drivers/net/wireless/ath/ath9k/init.c
  10781. +++ b/drivers/net/wireless/ath/ath9k/init.c
  10782. -@@ -711,7 +711,8 @@ static void ath9k_init_txpower_limits(st
  10783. +@@ -716,7 +716,8 @@ static void ath9k_init_txpower_limits(st
  10784. if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)
  10785. - ath9k_init_band_txpower(sc, IEEE80211_BAND_5GHZ);
  10786. + ath9k_init_band_txpower(sc, NL80211_BAND_5GHZ);
  10787. - ah->curchan = curchan;
  10788. + if (curchan)
  10789. @@ -65,7 +65,7 @@
  10790. }
  10791. static const struct ieee80211_iface_limit if_limits[] = {
  10792. -@@ -897,6 +898,18 @@ static void ath9k_set_hw_capab(struct at
  10793. +@@ -903,6 +904,18 @@ static void ath9k_set_hw_capab(struct at
  10794. SET_IEEE80211_PERM_ADDR(hw, common->macaddr);
  10795. }
  10796. @@ -84,7 +84,7 @@
  10797. int ath9k_init_device(u16 devid, struct ath_softc *sc,
  10798. const struct ath_bus_ops *bus_ops)
  10799. {
  10800. -@@ -942,6 +955,8 @@ int ath9k_init_device(u16 devid, struct
  10801. +@@ -948,6 +961,8 @@ int ath9k_init_device(u16 devid, struct
  10802. ARRAY_SIZE(ath9k_tpt_blink));
  10803. #endif
  10804. @@ -110,7 +110,7 @@
  10805. static inline void ath9k_hw_set_bt_ant_diversity(struct ath_hw *ah, bool enable)
  10806. --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  10807. +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  10808. -@@ -1327,9 +1327,30 @@ void ar5008_hw_init_rate_txpower(struct
  10809. +@@ -1325,9 +1325,30 @@ void ar5008_hw_init_rate_txpower(struct
  10810. }
  10811. }
  10812. @@ -141,7 +141,7 @@
  10813. static const u32 ar5416_cca_regs[6] = {
  10814. AR_PHY_CCA,
  10815. AR_PHY_CH1_CCA,
  10816. -@@ -1344,6 +1365,8 @@ int ar5008_hw_attach_phy_ops(struct ath_
  10817. +@@ -1342,6 +1363,8 @@ int ar5008_hw_attach_phy_ops(struct ath_
  10818. if (ret)
  10819. return ret;
  10820. @@ -175,7 +175,7 @@
  10821. #define AR_PHY_TIMING2 0x9810
  10822. #define AR_PHY_TIMING3 0x9814
  10823. #define AR_PHY_TIMING3_DSC_MAN 0xFFFE0000
  10824. -@@ -390,6 +399,8 @@
  10825. +@@ -393,6 +402,8 @@
  10826. #define AR_PHY_RFBUS_GRANT 0x9C20
  10827. #define AR_PHY_RFBUS_GRANT_EN 0x00000001
  10828. 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
  10829. index 8768c5d..b9c962e 100644
  10830. --- a/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch
  10831. +++ b/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch
  10832. @@ -20,9 +20,9 @@
  10833. /******************/
  10834. /* Chip Revisions */
  10835. /******************/
  10836. -@@ -1397,6 +1410,9 @@ static bool ath9k_hw_set_reset(struct at
  10837. - if (AR_SREV_9100(ah))
  10838. +@@ -1417,6 +1430,9 @@ static bool ath9k_hw_set_reset(struct at
  10839. udelay(50);
  10840. + }
  10841. + if (AR_SREV_9330(ah) || AR_SREV_9340(ah))
  10842. + ath9k_hw_disable_pll_lock_detect(ah);
  10843. @@ -30,7 +30,7 @@
  10844. return true;
  10845. }
  10846. -@@ -1496,6 +1512,9 @@ static bool ath9k_hw_chip_reset(struct a
  10847. +@@ -1516,6 +1532,9 @@ static bool ath9k_hw_chip_reset(struct a
  10848. ar9003_hw_internal_regulator_apply(ah);
  10849. ath9k_hw_init_pll(ah, chan);
  10850. @@ -40,7 +40,7 @@
  10851. return true;
  10852. }
  10853. -@@ -1797,8 +1816,14 @@ static int ath9k_hw_do_fastcc(struct ath
  10854. +@@ -1819,8 +1838,14 @@ static int ath9k_hw_do_fastcc(struct ath
  10855. if (AR_SREV_9271(ah))
  10856. ar9002_hw_load_ani_reg(ah, chan);
  10857. @@ -55,7 +55,7 @@
  10858. return -EINVAL;
  10859. }
  10860. -@@ -2052,6 +2077,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  10861. +@@ -2074,6 +2099,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  10862. ath9k_hw_set_radar_params(ah);
  10863. }
  10864. diff --git a/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch b/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
  10865. index 3d24ccd..b639f97 100644
  10866. --- a/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
  10867. +++ b/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
  10868. @@ -1,6 +1,6 @@
  10869. --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  10870. +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  10871. -@@ -956,55 +956,6 @@ static bool ar5008_hw_ani_control_new(st
  10872. +@@ -954,55 +954,6 @@ static bool ar5008_hw_ani_control_new(st
  10873. * on == 0 means more noise imm
  10874. */
  10875. u32 on = param ? 1 : 0;
  10876. @@ -58,7 +58,7 @@
  10877. REG_SET_BIT(ah, AR_PHY_SFCORR_LOW,
  10878. --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  10879. +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  10880. -@@ -41,20 +41,6 @@ static const int cycpwrThr1_table[] =
  10881. +@@ -42,20 +42,6 @@ static const int cycpwrThr1_table[] =
  10882. /* level: 0 1 2 3 4 5 6 7 8 */
  10883. { -6, -4, -2, 0, 2, 4, 6, 8 }; /* lvl 0-7, default 3 */
  10884. @@ -79,7 +79,7 @@
  10885. static const u8 ofdm2pwr[] = {
  10886. ALL_TARGET_LEGACY_6_24,
  10887. ALL_TARGET_LEGACY_6_24,
  10888. -@@ -1089,11 +1075,6 @@ static bool ar9003_hw_ani_control(struct
  10889. +@@ -1095,11 +1081,6 @@ static bool ar9003_hw_ani_control(struct
  10890. struct ath_common *common = ath9k_hw_common(ah);
  10891. struct ath9k_channel *chan = ah->curchan;
  10892. struct ar5416AniState *aniState = &ah->ani;
  10893. @@ -91,7 +91,7 @@
  10894. s32 value, value2;
  10895. switch (cmd & ah->ani_function) {
  10896. -@@ -1107,61 +1088,6 @@ static bool ar9003_hw_ani_control(struct
  10897. +@@ -1113,61 +1094,6 @@ static bool ar9003_hw_ani_control(struct
  10898. */
  10899. u32 on = param ? 1 : 0;
  10900. diff --git a/package/kernel/mac80211/patches/546-ath9k_platform_led_name.patch b/package/kernel/mac80211/patches/546-ath9k_platform_led_name.patch
  10901. new file mode 100644
  10902. index 0000000..ced72c6
  10903. --- /dev/null
  10904. +++ b/package/kernel/mac80211/patches/546-ath9k_platform_led_name.patch
  10905. @@ -0,0 +1,39 @@
  10906. +From: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  10907. +Date: Sun, 31 Jan 2016 20:45:57 +0100
  10908. +Subject: [PATCH v4 1/8] mac80211: ath9k: enable platform WLAN LED name
  10909. +
  10910. +Enable platform-supplied WLAN LED name for ath9k device. It replaces generic
  10911. +'ath9k-phy*' label with string set during platform initialization.
  10912. +
  10913. +Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  10914. +---
  10915. + drivers/net/wireless/ath/ath9k/gpio.c | 10 +++++++---
  10916. + include/linux/ath9k_platform.h | 1 +
  10917. + 2 files changed, 8 insertions(+), 3 deletions(-)
  10918. +
  10919. +--- a/drivers/net/wireless/ath/ath9k/gpio.c
  10920. ++++ b/drivers/net/wireless/ath/ath9k/gpio.c
  10921. +@@ -155,8 +155,11 @@ void ath_init_leds(struct ath_softc *sc)
  10922. +
  10923. + ath_fill_led_pin(sc);
  10924. +
  10925. +- snprintf(led_name, sizeof(led_name), "ath9k-%s",
  10926. +- wiphy_name(sc->hw->wiphy));
  10927. ++ if (pdata && pdata->led_name)
  10928. ++ strncpy(led_name, pdata->led_name, sizeof(led_name));
  10929. ++ else
  10930. ++ snprintf(led_name, sizeof(led_name), "ath9k-%s",
  10931. ++ wiphy_name(sc->hw->wiphy));
  10932. +
  10933. + if (ath9k_led_blink)
  10934. + trigger = sc->led_default_trigger;
  10935. +--- a/include/linux/ath9k_platform.h
  10936. ++++ b/include/linux/ath9k_platform.h
  10937. +@@ -49,6 +49,7 @@ struct ath9k_platform_data {
  10938. +
  10939. + int num_leds;
  10940. + const struct gpio_led *leds;
  10941. ++ const char *led_name;
  10942. + };
  10943. +
  10944. + #endif /* _LINUX_ATH9K_PLATFORM_H */
  10945. diff --git a/package/kernel/mac80211/patches/547-ath9k_led_defstate_fix.patch b/package/kernel/mac80211/patches/547-ath9k_led_defstate_fix.patch
  10946. new file mode 100644
  10947. index 0000000..5d84cf0
  10948. --- /dev/null
  10949. +++ b/package/kernel/mac80211/patches/547-ath9k_led_defstate_fix.patch
  10950. @@ -0,0 +1,29 @@
  10951. +From: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  10952. +Date: Sun, 31 Jan 2016 20:48:49 +0100
  10953. +Subject: [PATCH v4 2/8] mac80211: ath9k: set default state for platform LEDs
  10954. +
  10955. +Support default state for platform LEDs connected to ath9k device.
  10956. +Now LEDs are correctly set on or off at ath9k module initialization.
  10957. +Very useful if power LED is connected to wireless chip.
  10958. +
  10959. +Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  10960. +---
  10961. + gpio.c | 7 +++++--
  10962. + 1 file changed, 5 insertions(+), 2 deletions(-)
  10963. +
  10964. +--- a/drivers/net/wireless/ath/ath9k/gpio.c
  10965. ++++ b/drivers/net/wireless/ath/ath9k/gpio.c
  10966. +@@ -74,8 +74,11 @@ static int ath_add_led(struct ath_softc
  10967. + ath9k_hw_gpio_request_out(sc->sc_ah, gpio->gpio, gpio->name,
  10968. + AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
  10969. +
  10970. +- /* LED off */
  10971. +- ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low);
  10972. ++ /* Set default LED state */
  10973. ++ if (gpio->default_state == LEDS_GPIO_DEFSTATE_ON)
  10974. ++ ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, !gpio->active_low);
  10975. ++ else
  10976. ++ ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low);
  10977. +
  10978. + return 0;
  10979. + }
  10980. diff --git a/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch b/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch
  10981. new file mode 100644
  10982. index 0000000..de7c0ac
  10983. --- /dev/null
  10984. +++ b/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch
  10985. @@ -0,0 +1,234 @@
  10986. +From: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  10987. +Date: Sun, 31 Jan 2016 21:01:31 +0100
  10988. +Subject: [PATCH v4 4/8] mac80211: ath9k: enable access to GPIO
  10989. +
  10990. +Enable access to GPIO chip and its pins for Atheros AR92xx
  10991. +wireless devices. For now AR9285 and AR9287 are supported.
  10992. +
  10993. +Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  10994. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  10995. +---
  10996. +--- a/drivers/net/wireless/ath/ath9k/ath9k.h
  10997. ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  10998. +@@ -24,6 +24,7 @@
  10999. + #include <linux/completion.h>
  11000. + #include <linux/time.h>
  11001. + #include <linux/hw_random.h>
  11002. ++#include <linux/gpio/driver.h>
  11003. +
  11004. + #include "common.h"
  11005. + #include "debug.h"
  11006. +@@ -960,6 +961,14 @@ struct ath_led {
  11007. + struct led_classdev cdev;
  11008. + };
  11009. +
  11010. ++#ifdef CONFIG_GPIOLIB
  11011. ++struct ath9k_gpio_chip {
  11012. ++ struct ath_softc *sc;
  11013. ++ char label[32];
  11014. ++ struct gpio_chip gchip;
  11015. ++};
  11016. ++#endif
  11017. ++
  11018. + struct ath_softc {
  11019. + struct ieee80211_hw *hw;
  11020. + struct device *dev;
  11021. +@@ -1014,6 +1023,9 @@ struct ath_softc {
  11022. + #ifdef CPTCFG_MAC80211_LEDS
  11023. + const char *led_default_trigger;
  11024. + struct list_head leds;
  11025. ++#ifdef CONFIG_GPIOLIB
  11026. ++ struct ath9k_gpio_chip *gpiochip;
  11027. ++#endif
  11028. + #endif
  11029. +
  11030. + #ifdef CPTCFG_ATH9K_DEBUGFS
  11031. +--- a/drivers/net/wireless/ath/ath9k/gpio.c
  11032. ++++ b/drivers/net/wireless/ath/ath9k/gpio.c
  11033. +@@ -16,13 +16,135 @@
  11034. +
  11035. + #include "ath9k.h"
  11036. + #include <linux/ath9k_platform.h>
  11037. ++#include <linux/gpio.h>
  11038. ++
  11039. ++#ifdef CPTCFG_MAC80211_LEDS
  11040. ++
  11041. ++#ifdef CONFIG_GPIOLIB
  11042. ++
  11043. ++/***************/
  11044. ++/* GPIO Chip */
  11045. ++/***************/
  11046. ++
  11047. ++/* gpio_chip handler : set GPIO to input */
  11048. ++static int ath9k_gpio_pin_cfg_input(struct gpio_chip *chip, unsigned offset)
  11049. ++{
  11050. ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip,
  11051. ++ gchip);
  11052. ++
  11053. ++ ath9k_hw_gpio_request_in(gc->sc->sc_ah, offset, "ath9k-gpio");
  11054. ++
  11055. ++ return 0;
  11056. ++}
  11057. ++
  11058. ++/* gpio_chip handler : set GPIO to output */
  11059. ++static int ath9k_gpio_pin_cfg_output(struct gpio_chip *chip, unsigned offset,
  11060. ++ int value)
  11061. ++{
  11062. ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip,
  11063. ++ gchip);
  11064. ++
  11065. ++ ath9k_hw_gpio_request_out(gc->sc->sc_ah, offset, "ath9k-gpio",
  11066. ++ AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
  11067. ++ ath9k_hw_set_gpio(gc->sc->sc_ah, offset, value);
  11068. ++
  11069. ++ return 0;
  11070. ++}
  11071. ++
  11072. ++/* gpio_chip handler : query GPIO direction (0=out, 1=in) */
  11073. ++static int ath9k_gpio_pin_get_dir(struct gpio_chip *chip, unsigned offset)
  11074. ++{
  11075. ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip,
  11076. ++ gchip);
  11077. ++ struct ath_hw *ah = gc->sc->sc_ah;
  11078. ++
  11079. ++ return !((REG_READ(ah, AR_GPIO_OE_OUT) >> (offset * 2)) & 3);
  11080. ++}
  11081. ++
  11082. ++/* gpio_chip handler : get GPIO pin value */
  11083. ++static int ath9k_gpio_pin_get(struct gpio_chip *chip, unsigned offset)
  11084. ++{
  11085. ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip,
  11086. ++ gchip);
  11087. ++
  11088. ++ return ath9k_hw_gpio_get(gc->sc->sc_ah, offset);
  11089. ++}
  11090. ++
  11091. ++/* gpio_chip handler : set GPIO pin to value */
  11092. ++static void ath9k_gpio_pin_set(struct gpio_chip *chip, unsigned offset,
  11093. ++ int value)
  11094. ++{
  11095. ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip,
  11096. ++ gchip);
  11097. ++
  11098. ++ ath9k_hw_set_gpio(gc->sc->sc_ah, offset, value);
  11099. ++}
  11100. ++
  11101. ++/* register GPIO chip */
  11102. ++static void ath9k_register_gpio_chip(struct ath_softc *sc)
  11103. ++{
  11104. ++ struct ath9k_gpio_chip *gc;
  11105. ++ struct ath_hw *ah = sc->sc_ah;
  11106. ++
  11107. ++ gc = kzalloc(sizeof(struct ath9k_gpio_chip), GFP_KERNEL);
  11108. ++ if (!gc)
  11109. ++ return;
  11110. ++
  11111. ++ snprintf(gc->label, sizeof(gc->label), "ath9k-%s",
  11112. ++ wiphy_name(sc->hw->wiphy));
  11113. ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0)
  11114. ++ gc->gchip.parent = sc->dev;
  11115. ++#else
  11116. ++ gc->gchip.dev = sc->dev;
  11117. ++#endif
  11118. ++ gc->gchip.label = gc->label;
  11119. ++ gc->gchip.base = -1; /* determine base automatically */
  11120. ++ gc->gchip.ngpio = ah->caps.num_gpio_pins;
  11121. ++ gc->gchip.direction_input = ath9k_gpio_pin_cfg_input;
  11122. ++ gc->gchip.direction_output = ath9k_gpio_pin_cfg_output;
  11123. ++ gc->gchip.get_direction = ath9k_gpio_pin_get_dir;
  11124. ++ gc->gchip.get = ath9k_gpio_pin_get;
  11125. ++ gc->gchip.set = ath9k_gpio_pin_set;
  11126. ++
  11127. ++ if (gpiochip_add(&gc->gchip)) {
  11128. ++ kfree(gc);
  11129. ++ return;
  11130. ++ }
  11131. ++
  11132. ++ gc->gchip.owner = NULL;
  11133. ++ sc->gpiochip = gc;
  11134. ++ gc->sc = sc;
  11135. ++}
  11136. ++
  11137. ++/* remove GPIO chip */
  11138. ++static void ath9k_unregister_gpio_chip(struct ath_softc *sc)
  11139. ++{
  11140. ++ struct ath9k_gpio_chip *gc = sc->gpiochip;
  11141. ++
  11142. ++ if (!gc)
  11143. ++ return;
  11144. ++
  11145. ++ gpiochip_remove(&gc->gchip);
  11146. ++ kfree(gc);
  11147. ++ sc->gpiochip = NULL;
  11148. ++}
  11149. ++
  11150. ++#else /* CONFIG_GPIOLIB */
  11151. ++
  11152. ++static inline void ath9k_register_gpio_chip(struct ath_softc *sc)
  11153. ++{
  11154. ++}
  11155. ++
  11156. ++static inline void ath9k_unregister_gpio_chip(struct ath_softc *sc)
  11157. ++{
  11158. ++}
  11159. ++
  11160. ++#endif /* CONFIG_GPIOLIB */
  11161. +
  11162. + /********************************/
  11163. + /* LED functions */
  11164. + /********************************/
  11165. +
  11166. +-#ifdef CPTCFG_MAC80211_LEDS
  11167. +-
  11168. + static void ath_fill_led_pin(struct ath_softc *sc)
  11169. + {
  11170. + struct ath_hw *ah = sc->sc_ah;
  11171. +@@ -80,6 +202,12 @@ static int ath_add_led(struct ath_softc
  11172. + else
  11173. + ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low);
  11174. +
  11175. ++#ifdef CONFIG_GPIOLIB
  11176. ++ /* If there is GPIO chip configured, reserve LED pin */
  11177. ++ if (sc->gpiochip)
  11178. ++ gpio_request(sc->gpiochip->gchip.base + gpio->gpio, gpio->name);
  11179. ++#endif
  11180. ++
  11181. + return 0;
  11182. + }
  11183. +
  11184. +@@ -136,12 +264,18 @@ void ath_deinit_leds(struct ath_softc *s
  11185. +
  11186. + while (!list_empty(&sc->leds)) {
  11187. + led = list_first_entry(&sc->leds, struct ath_led, list);
  11188. ++#ifdef CONFIG_GPIOLIB
  11189. ++ /* If there is GPIO chip configured, free LED pin */
  11190. ++ if (sc->gpiochip)
  11191. ++ gpio_free(sc->gpiochip->gchip.base + led->gpio->gpio);
  11192. ++#endif
  11193. + list_del(&led->list);
  11194. + ath_led_brightness(&led->cdev, LED_OFF);
  11195. + led_classdev_unregister(&led->cdev);
  11196. + ath9k_hw_gpio_free(sc->sc_ah, led->gpio->gpio);
  11197. + kfree(led);
  11198. + }
  11199. ++ ath9k_unregister_gpio_chip(sc);
  11200. + }
  11201. +
  11202. + void ath_init_leds(struct ath_softc *sc)
  11203. +@@ -158,6 +292,8 @@ void ath_init_leds(struct ath_softc *sc)
  11204. +
  11205. + ath_fill_led_pin(sc);
  11206. +
  11207. ++ ath9k_register_gpio_chip(sc);
  11208. ++
  11209. + if (pdata && pdata->led_name)
  11210. + strncpy(led_name, pdata->led_name, sizeof(led_name));
  11211. + else
  11212. +@@ -178,6 +314,7 @@ void ath_init_leds(struct ath_softc *sc)
  11213. + for (i = 0; i < pdata->num_leds; i++)
  11214. + ath_create_platform_led(sc, &pdata->leds[i]);
  11215. + }
  11216. ++
  11217. + #endif
  11218. +
  11219. + /*******************/
  11220. diff --git a/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch b/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch
  11221. new file mode 100644
  11222. index 0000000..b9d1883
  11223. --- /dev/null
  11224. +++ b/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch
  11225. @@ -0,0 +1,149 @@
  11226. +From: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  11227. +Subject: [PATCH v5 5/8] mac80211: ath9k: enable GPIO buttons
  11228. +
  11229. +Enable platform-defined GPIO button support for ath9k device.
  11230. +Key poller is activated for attached platform buttons.
  11231. +Requires ath9k GPIO chip access.
  11232. +
  11233. +Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  11234. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  11235. +---
  11236. +--- a/drivers/net/wireless/ath/ath9k/ath9k.h
  11237. ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  11238. +@@ -1025,6 +1025,7 @@ struct ath_softc {
  11239. + struct list_head leds;
  11240. + #ifdef CONFIG_GPIOLIB
  11241. + struct ath9k_gpio_chip *gpiochip;
  11242. ++ struct platform_device *btnpdev; /* gpio-keys-polled */
  11243. + #endif
  11244. + #endif
  11245. +
  11246. +--- a/drivers/net/wireless/ath/ath9k/gpio.c
  11247. ++++ b/drivers/net/wireless/ath/ath9k/gpio.c
  11248. +@@ -17,6 +17,8 @@
  11249. + #include "ath9k.h"
  11250. + #include <linux/ath9k_platform.h>
  11251. + #include <linux/gpio.h>
  11252. ++#include <linux/platform_device.h>
  11253. ++#include <linux/gpio_keys.h>
  11254. +
  11255. + #ifdef CPTCFG_MAC80211_LEDS
  11256. +
  11257. +@@ -129,6 +131,64 @@ static void ath9k_unregister_gpio_chip(s
  11258. + sc->gpiochip = NULL;
  11259. + }
  11260. +
  11261. ++/******************/
  11262. ++/* GPIO Buttons */
  11263. ++/******************/
  11264. ++
  11265. ++/* add GPIO buttons */
  11266. ++static void ath9k_init_buttons(struct ath_softc *sc)
  11267. ++{
  11268. ++ struct ath9k_platform_data *pdata = sc->dev->platform_data;
  11269. ++ struct platform_device *pdev;
  11270. ++ struct gpio_keys_platform_data gkpdata;
  11271. ++ struct gpio_keys_button *bt;
  11272. ++ int i;
  11273. ++
  11274. ++ if (!sc->gpiochip)
  11275. ++ return;
  11276. ++
  11277. ++ if (!pdata || !pdata->btns || !pdata->num_btns)
  11278. ++ return;
  11279. ++
  11280. ++ bt = devm_kmemdup(sc->dev, pdata->btns,
  11281. ++ pdata->num_btns * sizeof(struct gpio_keys_button),
  11282. ++ GFP_KERNEL);
  11283. ++ if (!bt)
  11284. ++ return;
  11285. ++
  11286. ++ for (i = 0; i < pdata->num_btns; i++) {
  11287. ++ ath9k_hw_gpio_request_in(sc->sc_ah, pdata->btns[i].gpio,
  11288. ++ "ath9k-gpio");
  11289. ++ bt[i].gpio = sc->gpiochip->gchip.base + pdata->btns[i].gpio;
  11290. ++ }
  11291. ++
  11292. ++ memset(&gkpdata, 0, sizeof(struct gpio_keys_platform_data));
  11293. ++ gkpdata.buttons = bt;
  11294. ++ gkpdata.nbuttons = pdata->num_btns;
  11295. ++ gkpdata.poll_interval = pdata->btn_poll_interval;
  11296. ++
  11297. ++ pdev = platform_device_register_data(sc->dev, "gpio-keys-polled",
  11298. ++ PLATFORM_DEVID_AUTO, &gkpdata,
  11299. ++ sizeof(gkpdata));
  11300. ++ if (!IS_ERR_OR_NULL(pdev))
  11301. ++ sc->btnpdev = pdev;
  11302. ++ else {
  11303. ++ sc->btnpdev = NULL;
  11304. ++ devm_kfree(sc->dev, bt);
  11305. ++ }
  11306. ++}
  11307. ++
  11308. ++/* remove GPIO buttons */
  11309. ++static void ath9k_deinit_buttons(struct ath_softc *sc)
  11310. ++{
  11311. ++ if (!sc->gpiochip || !sc->btnpdev)
  11312. ++ return;
  11313. ++
  11314. ++ platform_device_unregister(sc->btnpdev);
  11315. ++
  11316. ++ sc->btnpdev = NULL;
  11317. ++}
  11318. ++
  11319. + #else /* CONFIG_GPIOLIB */
  11320. +
  11321. + static inline void ath9k_register_gpio_chip(struct ath_softc *sc)
  11322. +@@ -139,6 +199,14 @@ static inline void ath9k_unregister_gpio
  11323. + {
  11324. + }
  11325. +
  11326. ++static inline void ath9k_init_buttons(struct ath_softc *sc)
  11327. ++{
  11328. ++}
  11329. ++
  11330. ++static inline void ath9k_deinit_buttons(struct ath_softc *sc)
  11331. ++{
  11332. ++}
  11333. ++
  11334. + #endif /* CONFIG_GPIOLIB */
  11335. +
  11336. + /********************************/
  11337. +@@ -262,6 +330,7 @@ void ath_deinit_leds(struct ath_softc *s
  11338. + {
  11339. + struct ath_led *led;
  11340. +
  11341. ++ ath9k_deinit_buttons(sc);
  11342. + while (!list_empty(&sc->leds)) {
  11343. + led = list_first_entry(&sc->leds, struct ath_led, list);
  11344. + #ifdef CONFIG_GPIOLIB
  11345. +@@ -293,6 +362,7 @@ void ath_init_leds(struct ath_softc *sc)
  11346. + ath_fill_led_pin(sc);
  11347. +
  11348. + ath9k_register_gpio_chip(sc);
  11349. ++ ath9k_init_buttons(sc);
  11350. +
  11351. + if (pdata && pdata->led_name)
  11352. + strncpy(led_name, pdata->led_name, sizeof(led_name));
  11353. +@@ -308,7 +378,7 @@ void ath_init_leds(struct ath_softc *sc)
  11354. + ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger,
  11355. + !sc->sc_ah->config.led_active_high);
  11356. +
  11357. +- if (!pdata)
  11358. ++ if (!pdata || !pdata->leds || !pdata->num_leds)
  11359. + return;
  11360. +
  11361. + for (i = 0; i < pdata->num_leds; i++)
  11362. +--- a/include/linux/ath9k_platform.h
  11363. ++++ b/include/linux/ath9k_platform.h
  11364. +@@ -50,6 +50,10 @@ struct ath9k_platform_data {
  11365. + int num_leds;
  11366. + const struct gpio_led *leds;
  11367. + const char *led_name;
  11368. ++
  11369. ++ unsigned num_btns;
  11370. ++ const struct gpio_keys_button *btns;
  11371. ++ unsigned btn_poll_interval;
  11372. + };
  11373. +
  11374. + #endif /* _LINUX_ATH9K_PLATFORM_H */
  11375. 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
  11376. index 8245909..db70a33 100644
  11377. --- a/package/kernel/mac80211/patches/600-0002-rt2x00-rt2800lib-introduce-RT2800_HAS_HIGH_SHARED_ME.patch
  11378. +++ b/package/kernel/mac80211/patches/600-0002-rt2x00-rt2800lib-introduce-RT2800_HAS_HIGH_SHARED_ME.patch
  11379. @@ -24,7 +24,7 @@ Changes since v1:
  11380. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  11381. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  11382. -@@ -7722,6 +7722,7 @@ static int rt2800_probe_rt(struct rt2x00
  11383. +@@ -7726,6 +7726,7 @@ static int rt2800_probe_rt(struct rt2x00
  11384. int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev)
  11385. {
  11386. @@ -32,7 +32,7 @@ Changes since v1:
  11387. int retval;
  11388. u32 reg;
  11389. -@@ -7729,6 +7730,9 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  11390. +@@ -7733,6 +7734,9 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  11391. if (retval)
  11392. return retval;
  11393. 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
  11394. index 7abfcd1..a3b62bc 100644
  11395. --- a/package/kernel/mac80211/patches/600-0003-rt2x00-rt2800-serialize-shared-memory-access.patch
  11396. +++ b/package/kernel/mac80211/patches/600-0003-rt2x00-rt2800-serialize-shared-memory-access.patch
  11397. @@ -239,7 +239,7 @@ Changes since v1: ---
  11398. msleep(1);
  11399. /*
  11400. -@@ -7726,6 +7774,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  11401. +@@ -7730,6 +7778,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  11402. int retval;
  11403. u32 reg;
  11404. @@ -248,7 +248,7 @@ Changes since v1: ---
  11405. retval = rt2800_probe_rt(rt2x00dev);
  11406. if (retval)
  11407. return retval;
  11408. -@@ -7809,8 +7859,11 @@ void rt2800_get_key_seq(struct ieee80211
  11409. +@@ -7813,8 +7863,11 @@ void rt2800_get_key_seq(struct ieee80211
  11410. return;
  11411. offset = MAC_IVEIV_ENTRY(key->hw_key_idx);
  11412. 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
  11413. index 02b2acf..f41a160 100644
  11414. --- a/package/kernel/mac80211/patches/600-0005-rt2x00-rt2800lib-add-hw_beacon_count-field-to-struct.patch
  11415. +++ b/package/kernel/mac80211/patches/600-0005-rt2x00-rt2800lib-add-hw_beacon_count-field-to-struct.patch
  11416. @@ -41,7 +41,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  11417. rt2800_clear_beacon_register(rt2x00dev, i);
  11418. if (rt2x00_is_usb(rt2x00dev)) {
  11419. -@@ -7827,6 +7828,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  11420. +@@ -7831,6 +7832,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  11421. if (rt2x00_rt(rt2x00dev, RT3593))
  11422. __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  11423. 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
  11424. index e909272..5099c64 100644
  11425. --- a/package/kernel/mac80211/patches/600-0007-rt2x00-rt2800lib-fix-max-supported-beacon-count-for-.patch
  11426. +++ b/package/kernel/mac80211/patches/600-0007-rt2x00-rt2800lib-fix-max-supported-beacon-count-for-.patch
  11427. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  11428. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  11429. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  11430. -@@ -7852,7 +7852,10 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  11431. +@@ -7856,7 +7856,10 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  11432. if (rt2x00_rt(rt2x00dev, RT3593))
  11433. __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  11434. 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
  11435. index 7fe38e0..a2e7015 100644
  11436. --- a/package/kernel/mac80211/patches/600-0009-rt2x00-rt2800lib-enable-support-for-RT3883.patch
  11437. +++ b/package/kernel/mac80211/patches/600-0009-rt2x00-rt2800lib-enable-support-for-RT3883.patch
  11438. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  11439. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  11440. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  11441. -@@ -7822,6 +7822,7 @@ static int rt2800_probe_rt(struct rt2x00
  11442. +@@ -7826,6 +7826,7 @@ static int rt2800_probe_rt(struct rt2x00
  11443. case RT3390:
  11444. case RT3572:
  11445. case RT3593:
  11446. 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
  11447. index 253a0c0..89bd0ac 100644
  11448. --- a/package/kernel/mac80211/patches/600-0010-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch
  11449. +++ b/package/kernel/mac80211/patches/600-0010-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch
  11450. @@ -98,7 +98,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  11451. static const struct rf_channel rf_vals_5592_xtal20[] = {
  11452. /* Channel, N, K, mod, R */
  11453. {1, 482, 4, 10, 3},
  11454. -@@ -7669,6 +7729,11 @@ static int rt2800_probe_hw_mode(struct r
  11455. +@@ -7673,6 +7733,11 @@ static int rt2800_probe_hw_mode(struct r
  11456. spec->channels = rf_vals_3x;
  11457. break;
  11458. 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
  11459. index f15c22b..b7efc9f 100644
  11460. --- a/package/kernel/mac80211/patches/600-0011-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch
  11461. +++ b/package/kernel/mac80211/patches/600-0011-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch
  11462. @@ -18,7 +18,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  11463. case RF5360:
  11464. case RF5362:
  11465. case RF5370:
  11466. -@@ -7848,6 +7849,7 @@ static int rt2800_probe_hw_mode(struct r
  11467. +@@ -7852,6 +7853,7 @@ static int rt2800_probe_hw_mode(struct r
  11468. case RF3053:
  11469. case RF3070:
  11470. case RF3290:
  11471. 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
  11472. index 6ce224a..220e35f 100644
  11473. --- a/package/kernel/mac80211/patches/600-0026-rt2x00-rt2800lib-use-correct-beacon-count-for-RT3883.patch
  11474. +++ b/package/kernel/mac80211/patches/600-0026-rt2x00-rt2800lib-use-correct-beacon-count-for-RT3883.patch
  11475. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  11476. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  11477. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  11478. -@@ -8403,7 +8403,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  11479. +@@ -8407,7 +8407,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  11480. if (rt2x00_rt(rt2x00dev, RT3593))
  11481. __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  11482. 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
  11483. index 25753af..2ffa5a4 100644
  11484. --- a/package/kernel/mac80211/patches/600-0032-rt2x00-rt2800lib-enable-RT2800_HAS_HIGH_SHARED_MEM-f.patch
  11485. +++ b/package/kernel/mac80211/patches/600-0032-rt2x00-rt2800lib-enable-RT2800_HAS_HIGH_SHARED_MEM-f.patch
  11486. @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  11487. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  11488. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  11489. -@@ -8416,7 +8416,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  11490. +@@ -8420,7 +8420,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  11491. if (retval)
  11492. return retval;
  11493. 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
  11494. index 7a183a4..daa5dc6 100644
  11495. --- a/package/kernel/mac80211/patches/602-rt2x00-introduce-rt2x00_platform_h.patch
  11496. +++ b/package/kernel/mac80211/patches/602-rt2x00-introduce-rt2x00_platform_h.patch
  11497. @@ -22,10 +22,10 @@
  11498. +#endif /* _RT2X00_PLATFORM_H */
  11499. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  11500. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  11501. -@@ -38,6 +38,7 @@
  11502. - #include <linux/kfifo.h>
  11503. +@@ -39,6 +39,7 @@
  11504. #include <linux/hrtimer.h>
  11505. #include <linux/average.h>
  11506. + #include <linux/usb.h>
  11507. +#include <linux/rt2x00_platform.h>
  11508. #include <net/mac80211.h>
  11509. diff --git a/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch b/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
  11510. index bc056cd..8ae5da3 100644
  11511. --- a/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
  11512. +++ b/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
  11513. @@ -1,6 +1,6 @@
  11514. --- a/.local-symbols
  11515. +++ b/.local-symbols
  11516. -@@ -329,6 +329,7 @@ RT2X00_LIB_FIRMWARE=
  11517. +@@ -331,6 +331,7 @@ RT2X00_LIB_FIRMWARE=
  11518. RT2X00_LIB_CRYPTO=
  11519. RT2X00_LIB_LEDS=
  11520. RT2X00_LIB_DEBUGFS=
  11521. @@ -105,7 +105,7 @@
  11522. .drv_init_registers = rt2800mmio_init_registers,
  11523. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  11524. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  11525. -@@ -697,6 +697,7 @@ enum rt2x00_capability_flags {
  11526. +@@ -699,6 +699,7 @@ enum rt2x00_capability_flags {
  11527. REQUIRE_HT_TX_DESC,
  11528. REQUIRE_PS_AUTOWAKE,
  11529. REQUIRE_DELAYED_RFKILL,
  11530. @@ -127,7 +127,7 @@
  11531. DECLARE_KFIFO_PTR(txstatus_fifo, u32);
  11532. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  11533. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  11534. -@@ -1335,6 +1335,10 @@ int rt2x00lib_probe_dev(struct rt2x00_de
  11535. +@@ -1334,6 +1334,10 @@ int rt2x00lib_probe_dev(struct rt2x00_de
  11536. INIT_DELAYED_WORK(&rt2x00dev->autowakeup_work, rt2x00lib_autowakeup);
  11537. INIT_WORK(&rt2x00dev->sleep_work, rt2x00lib_sleep);
  11538. @@ -138,7 +138,7 @@
  11539. /*
  11540. * Let the driver probe the device to detect the capabilities.
  11541. */
  11542. -@@ -1475,6 +1479,11 @@ void rt2x00lib_remove_dev(struct rt2x00_
  11543. +@@ -1477,6 +1481,11 @@ void rt2x00lib_remove_dev(struct rt2x00_
  11544. * Free the driver data.
  11545. */
  11546. kfree(rt2x00dev->drv_data);
  11547. 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
  11548. index d923e05..a2e1faf 100644
  11549. --- a/package/kernel/mac80211/patches/607-rt2x00-allow_disabling_bands_through_platform_data.patch
  11550. +++ b/package/kernel/mac80211/patches/607-rt2x00-allow_disabling_bands_through_platform_data.patch
  11551. @@ -37,7 +37,7 @@
  11552. num_rates += 4;
  11553. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  11554. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  11555. -@@ -405,6 +405,7 @@ struct hw_mode_spec {
  11556. +@@ -406,6 +406,7 @@ struct hw_mode_spec {
  11557. unsigned int supported_bands;
  11558. #define SUPPORT_BAND_2GHZ 0x00000001
  11559. #define SUPPORT_BAND_5GHZ 0x00000002
  11560. 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
  11561. index a645ba1..6704ff8 100644
  11562. --- a/package/kernel/mac80211/patches/608-add_platform_data_mac_addr.patch
  11563. +++ b/package/kernel/mac80211/patches/608-add_platform_data_mac_addr.patch
  11564. @@ -31,7 +31,7 @@
  11565. {
  11566. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  11567. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  11568. -@@ -1414,6 +1414,7 @@ static inline void rt2x00debug_dump_fram
  11569. +@@ -1416,6 +1416,7 @@ static inline void rt2x00debug_dump_fram
  11570. */
  11571. u32 rt2x00lib_get_bssidx(struct rt2x00_dev *rt2x00dev,
  11572. struct ieee80211_vif *vif);
  11573. 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
  11574. index c69d330..9f10fe3 100644
  11575. --- a/package/kernel/mac80211/patches/610-rt2x00-fix-rt3352-ext-pa.patch
  11576. +++ b/package/kernel/mac80211/patches/610-rt2x00-fix-rt3352-ext-pa.patch
  11577. @@ -200,7 +200,7 @@
  11578. * EEPROM frequency
  11579. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  11580. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  11581. -@@ -717,6 +717,8 @@ enum rt2x00_capability_flags {
  11582. +@@ -719,6 +719,8 @@ enum rt2x00_capability_flags {
  11583. CAPABILITY_DOUBLE_ANTENNA,
  11584. CAPABILITY_BT_COEXIST,
  11585. CAPABILITY_VCO_RECALIBRATION,
  11586. 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
  11587. index b44fe90..860fdc0 100644
  11588. --- a/package/kernel/mac80211/patches/611-rt2x00-rf_vals-rt3352-xtal20.patch
  11589. +++ b/package/kernel/mac80211/patches/611-rt2x00-rf_vals-rt3352-xtal20.patch
  11590. @@ -28,7 +28,7 @@
  11591. static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
  11592. {
  11593. struct hw_mode_spec *spec = &rt2x00dev->spec;
  11594. -@@ -8272,7 +8293,10 @@ static int rt2800_probe_hw_mode(struct r
  11595. +@@ -8276,7 +8297,10 @@ static int rt2800_probe_hw_mode(struct r
  11596. case RF5390:
  11597. case RF5392:
  11598. spec->num_channels = 14;
  11599. @@ -40,7 +40,7 @@
  11600. break;
  11601. case RF3052:
  11602. -@@ -8456,6 +8480,19 @@ static int rt2800_probe_rt(struct rt2x00
  11603. +@@ -8460,6 +8484,19 @@ static int rt2800_probe_rt(struct rt2x00
  11604. return 0;
  11605. }
  11606. @@ -60,7 +60,7 @@
  11607. int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev)
  11608. {
  11609. struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
  11610. -@@ -8498,6 +8535,15 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  11611. +@@ -8502,6 +8539,15 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  11612. rt2800_register_write(rt2x00dev, GPIO_CTRL, reg);
  11613. /*
  11614. @@ -78,7 +78,7 @@
  11615. retval = rt2800_probe_hw_mode(rt2x00dev);
  11616. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  11617. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  11618. -@@ -400,6 +400,7 @@ static inline struct rt2x00_intf* vif_to
  11619. +@@ -401,6 +401,7 @@ static inline struct rt2x00_intf* vif_to
  11620. * @channels: Device/chipset specific channel values (See &struct rf_channel).
  11621. * @channels_info: Additional information for channels (See &struct channel_info).
  11622. * @ht: Driver HT Capabilities (See &ieee80211_sta_ht_cap).
  11623. @@ -86,7 +86,7 @@
  11624. */
  11625. struct hw_mode_spec {
  11626. unsigned int supported_bands;
  11627. -@@ -416,6 +417,7 @@ struct hw_mode_spec {
  11628. +@@ -417,6 +418,7 @@ struct hw_mode_spec {
  11629. const struct channel_info *channels_info;
  11630. struct ieee80211_sta_ht_cap ht;
  11631. diff --git a/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch b/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
  11632. index 8e3bd2a..e7b2a8c 100644
  11633. --- a/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
  11634. +++ b/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
  11635. @@ -8,7 +8,7 @@
  11636. #include "rt2x00.h"
  11637. #include "rt2800lib.h"
  11638. -@@ -8482,13 +8483,14 @@ static int rt2800_probe_rt(struct rt2x00
  11639. +@@ -8486,13 +8487,14 @@ static int rt2800_probe_rt(struct rt2x00
  11640. int rt2800_probe_clk(struct rt2x00_dev *rt2x00dev)
  11641. {
  11642. diff --git a/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch b/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch
  11643. index faa5879..44bd8a1 100644
  11644. --- a/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch
  11645. +++ b/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch
  11646. @@ -240,7 +240,7 @@
  11647. case RF5360:
  11648. case RF5362:
  11649. case RF5370:
  11650. -@@ -8287,6 +8398,7 @@ static int rt2800_probe_hw_mode(struct r
  11651. +@@ -8291,6 +8402,7 @@ static int rt2800_probe_hw_mode(struct r
  11652. case RF3290:
  11653. case RF3320:
  11654. case RF3322:
  11655. @@ -248,7 +248,7 @@
  11656. case RF5360:
  11657. case RF5362:
  11658. case RF5370:
  11659. -@@ -8426,6 +8538,7 @@ static int rt2800_probe_hw_mode(struct r
  11660. +@@ -8430,6 +8542,7 @@ static int rt2800_probe_hw_mode(struct r
  11661. case RF3070:
  11662. case RF3290:
  11663. case RF3853:
  11664. @@ -256,7 +256,7 @@
  11665. case RF5360:
  11666. case RF5362:
  11667. case RF5370:
  11668. -@@ -8466,6 +8579,7 @@ static int rt2800_probe_rt(struct rt2x00
  11669. +@@ -8470,6 +8583,7 @@ static int rt2800_probe_rt(struct rt2x00
  11670. case RT3572:
  11671. case RT3593:
  11672. case RT3883:
  11673. @@ -266,7 +266,7 @@
  11674. case RT5592:
  11675. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  11676. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  11677. -@@ -169,6 +169,7 @@ struct rt2x00_chip {
  11678. +@@ -170,6 +170,7 @@ struct rt2x00_chip {
  11679. #define RT3572 0x3572
  11680. #define RT3593 0x3593
  11681. #define RT3883 0x3883 /* WSOC */
  11682. 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
  11683. index 55452b9..dba6033 100644
  11684. --- a/package/kernel/mac80211/patches/620-rt2x00-add-AP+STA-support.patch
  11685. +++ b/package/kernel/mac80211/patches/620-rt2x00-add-AP+STA-support.patch
  11686. @@ -1,6 +1,6 @@
  11687. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  11688. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  11689. -@@ -1284,7 +1284,7 @@ static inline void rt2x00lib_set_if_comb
  11690. +@@ -1283,7 +1283,7 @@ static inline void rt2x00lib_set_if_comb
  11691. */
  11692. if_limit = &rt2x00dev->if_limits_ap;
  11693. if_limit->max = rt2x00dev->ops->max_ap_intf;
  11694. diff --git a/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch b/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
  11695. index fd885cc..02f3053 100644
  11696. --- a/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
  11697. +++ b/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
  11698. @@ -1,6 +1,6 @@
  11699. --- a/drivers/net/wireless/marvell/libertas/cfg.c
  11700. +++ b/drivers/net/wireless/marvell/libertas/cfg.c
  11701. -@@ -2084,6 +2084,8 @@ struct wireless_dev *lbs_cfg_alloc(struc
  11702. +@@ -2122,6 +2122,8 @@ struct wireless_dev *lbs_cfg_alloc(struc
  11703. goto err_wiphy_new;
  11704. }
  11705. diff --git a/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch b/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
  11706. index b67a95f..ad30608 100644
  11707. --- a/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
  11708. +++ b/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
  11709. @@ -1,6 +1,6 @@
  11710. --- a/drivers/net/wireless/marvell/libertas/cfg.c
  11711. +++ b/drivers/net/wireless/marvell/libertas/cfg.c
  11712. -@@ -2174,6 +2174,8 @@ int lbs_cfg_register(struct lbs_private
  11713. +@@ -2212,6 +2212,8 @@ int lbs_cfg_register(struct lbs_private
  11714. wdev->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
  11715. wdev->wiphy->reg_notifier = lbs_reg_notifier;
  11716. diff --git a/package/kernel/mac80211/patches/804-b43-sync-with-bcma.patch b/package/kernel/mac80211/patches/804-b43-sync-with-bcma.patch
  11717. deleted file mode 100644
  11718. index 74cd448..0000000
  11719. --- a/package/kernel/mac80211/patches/804-b43-sync-with-bcma.patch
  11720. +++ /dev/null
  11721. @@ -1,17 +0,0 @@
  11722. ---- a/drivers/net/wireless/broadcom/b43/main.c
  11723. -+++ b/drivers/net/wireless/broadcom/b43/main.c
  11724. -@@ -1215,10 +1215,10 @@ void b43_wireless_core_phy_pll_reset(str
  11725. - case B43_BUS_BCMA:
  11726. - bcma_cc = &dev->dev->bdev->bus->drv_cc;
  11727. -
  11728. -- bcma_cc_write32(bcma_cc, BCMA_CC_CHIPCTL_ADDR, 0);
  11729. -- bcma_cc_mask32(bcma_cc, BCMA_CC_CHIPCTL_DATA, ~0x4);
  11730. -- bcma_cc_set32(bcma_cc, BCMA_CC_CHIPCTL_DATA, 0x4);
  11731. -- bcma_cc_mask32(bcma_cc, BCMA_CC_CHIPCTL_DATA, ~0x4);
  11732. -+ bcma_cc_write32(bcma_cc, BCMA_CC_PMU_CHIPCTL_ADDR, 0);
  11733. -+ bcma_cc_mask32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, ~0x4);
  11734. -+ bcma_cc_set32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, 0x4);
  11735. -+ bcma_cc_mask32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, ~0x4);
  11736. - break;
  11737. - #endif
  11738. - #ifdef CPTCFG_B43_SSB
  11739. diff --git a/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch b/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch
  11740. index 06c731f..f8f555f 100644
  11741. --- a/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch
  11742. +++ b/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch
  11743. @@ -9,7 +9,7 @@
  11744. antenna = b43_antenna_to_phyctl(antenna);
  11745. ctl = b43_shm_read16(dev, B43_SHM_SHARED, B43_SHM_SH_BEACPHYCTL);
  11746. /* We can't send beacons with short preamble. Would get PHY errors. */
  11747. -@@ -3300,8 +3300,8 @@ static int b43_chip_init(struct b43_wlde
  11748. +@@ -3297,8 +3297,8 @@ static int b43_chip_init(struct b43_wlde
  11749. /* Select the antennae */
  11750. if (phy->ops->set_rx_antenna)
  11751. @@ -20,7 +20,7 @@
  11752. if (phy->type == B43_PHYTYPE_B) {
  11753. value16 = b43_read16(dev, 0x005E);
  11754. -@@ -4001,7 +4001,6 @@ static int b43_op_config(struct ieee8021
  11755. +@@ -3998,7 +3998,6 @@ static int b43_op_config(struct ieee8021
  11756. struct b43_wldev *dev = wl->current_dev;
  11757. struct b43_phy *phy = &dev->phy;
  11758. struct ieee80211_conf *conf = &hw->conf;
  11759. @@ -28,7 +28,7 @@
  11760. int err = 0;
  11761. mutex_lock(&wl->mutex);
  11762. -@@ -4044,11 +4043,9 @@ static int b43_op_config(struct ieee8021
  11763. +@@ -4041,11 +4040,9 @@ static int b43_op_config(struct ieee8021
  11764. }
  11765. /* Antennas for RX and management frame TX. */
  11766. @@ -42,7 +42,7 @@
  11767. if (wl->radio_enabled != phy->radio_on) {
  11768. if (wl->radio_enabled) {
  11769. -@@ -5209,6 +5206,47 @@ static int b43_op_get_survey(struct ieee
  11770. +@@ -5189,6 +5186,47 @@ static int b43_op_get_survey(struct ieee
  11771. return 0;
  11772. }
  11773. @@ -90,7 +90,7 @@
  11774. static const struct ieee80211_ops b43_hw_ops = {
  11775. .tx = b43_op_tx,
  11776. .conf_tx = b43_op_conf_tx,
  11777. -@@ -5230,6 +5268,8 @@ static const struct ieee80211_ops b43_hw
  11778. +@@ -5210,6 +5248,8 @@ static const struct ieee80211_ops b43_hw
  11779. .sw_scan_complete = b43_op_sw_scan_complete_notifier,
  11780. .get_survey = b43_op_get_survey,
  11781. .rfkill_poll = b43_rfkill_poll,
  11782. @@ -99,7 +99,7 @@
  11783. };
  11784. /* Hard-reset the chip. Do not call this directly.
  11785. -@@ -5538,6 +5578,8 @@ static int b43_one_core_attach(struct b4
  11786. +@@ -5513,6 +5553,8 @@ static int b43_one_core_attach(struct b4
  11787. if (!wldev)
  11788. goto out;
  11789. @@ -108,7 +108,7 @@
  11790. wldev->use_pio = b43_modparam_pio;
  11791. wldev->dev = dev;
  11792. wldev->wl = wl;
  11793. -@@ -5628,6 +5670,9 @@ static struct b43_wl *b43_wireless_init(
  11794. +@@ -5603,6 +5645,9 @@ static struct b43_wl *b43_wireless_init(
  11795. hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
  11796. 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
  11797. new file mode 100644
  11798. index 0000000..ae571c9
  11799. --- /dev/null
  11800. +++ b/package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch
  11801. @@ -0,0 +1,97 @@
  11802. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  11803. +Date: Mon, 8 Jun 2015 16:11:40 +0200
  11804. +Subject: [PATCH] brcmfmac: register wiphy(s) during module_init
  11805. +MIME-Version: 1.0
  11806. +Content-Type: text/plain; charset=UTF-8
  11807. +Content-Transfer-Encoding: 8bit
  11808. +
  11809. +This is needed by OpenWrt which expects all PHYs to be created after
  11810. +module loads successfully.
  11811. +
  11812. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  11813. +---
  11814. +
  11815. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  11816. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  11817. +@@ -1213,6 +1213,7 @@ int __init brcmf_core_init(void)
  11818. + {
  11819. + if (!schedule_work(&brcmf_driver_work))
  11820. + return -EBUSY;
  11821. ++ flush_work(&brcmf_driver_work);
  11822. +
  11823. + return 0;
  11824. + }
  11825. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  11826. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  11827. +@@ -444,6 +444,7 @@ struct brcmf_fw {
  11828. + u16 bus_nr;
  11829. + void (*done)(struct device *dev, const struct firmware *fw,
  11830. + void *nvram_image, u32 nvram_len);
  11831. ++ struct completion *completion;
  11832. + };
  11833. +
  11834. + static void brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx)
  11835. +@@ -478,6 +479,8 @@ static void brcmf_fw_request_nvram_done(
  11836. + goto fail;
  11837. +
  11838. + fwctx->done(fwctx->dev, fwctx->code, nvram, nvram_length);
  11839. ++ if (fwctx->completion)
  11840. ++ complete(fwctx->completion);
  11841. + kfree(fwctx);
  11842. + return;
  11843. +
  11844. +@@ -485,6 +488,8 @@ fail:
  11845. + brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev));
  11846. + release_firmware(fwctx->code);
  11847. + device_release_driver(fwctx->dev);
  11848. ++ if (fwctx->completion)
  11849. ++ complete(fwctx->completion);
  11850. + kfree(fwctx);
  11851. + }
  11852. +
  11853. +@@ -500,6 +505,8 @@ static void brcmf_fw_request_code_done(c
  11854. + /* only requested code so done here */
  11855. + if (!(fwctx->flags & BRCMF_FW_REQUEST_NVRAM)) {
  11856. + fwctx->done(fwctx->dev, fw, NULL, 0);
  11857. ++ if (fwctx->completion)
  11858. ++ complete(fwctx->completion);
  11859. + kfree(fwctx);
  11860. + return;
  11861. + }
  11862. +@@ -517,6 +524,8 @@ static void brcmf_fw_request_code_done(c
  11863. + fail:
  11864. + brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev));
  11865. + device_release_driver(fwctx->dev);
  11866. ++ if (fwctx->completion)
  11867. ++ complete(fwctx->completion);
  11868. + kfree(fwctx);
  11869. + }
  11870. +
  11871. +@@ -528,6 +537,8 @@ int brcmf_fw_get_firmwares_pcie(struct d
  11872. + u16 domain_nr, u16 bus_nr)
  11873. + {
  11874. + struct brcmf_fw *fwctx;
  11875. ++ struct completion completion;
  11876. ++ int err;
  11877. +
  11878. + brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(dev));
  11879. + if (!fw_cb || !code)
  11880. +@@ -548,9 +559,17 @@ int brcmf_fw_get_firmwares_pcie(struct d
  11881. + fwctx->domain_nr = domain_nr;
  11882. + fwctx->bus_nr = bus_nr;
  11883. +
  11884. +- return request_firmware_nowait(THIS_MODULE, true, code, dev,
  11885. ++ init_completion(&completion);
  11886. ++ fwctx->completion = &completion;
  11887. ++
  11888. ++ err = request_firmware_nowait(THIS_MODULE, true, code, dev,
  11889. + GFP_KERNEL, fwctx,
  11890. + brcmf_fw_request_code_done);
  11891. ++ if (!err)
  11892. ++ wait_for_completion_timeout(fwctx->completion,
  11893. ++ msecs_to_jiffies(5000));
  11894. ++ fwctx->completion = NULL;
  11895. ++ return err;
  11896. + }
  11897. +
  11898. + int brcmf_fw_get_firmwares(struct device *dev, u16 flags,
  11899. 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
  11900. deleted file mode 100644
  11901. index 00181f6..0000000
  11902. --- a/package/kernel/mac80211/patches/861-brcmfmac-register-wiphy-s-during-module_init.patch
  11903. +++ /dev/null
  11904. @@ -1,97 +0,0 @@
  11905. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  11906. -Date: Mon, 8 Jun 2015 16:11:40 +0200
  11907. -Subject: [PATCH] brcmfmac: register wiphy(s) during module_init
  11908. -MIME-Version: 1.0
  11909. -Content-Type: text/plain; charset=UTF-8
  11910. -Content-Transfer-Encoding: 8bit
  11911. -
  11912. -This is needed by OpenWrt which expects all PHYs to be created after
  11913. -module loads successfully.
  11914. -
  11915. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  11916. ----
  11917. -
  11918. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  11919. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  11920. -@@ -1332,6 +1332,7 @@ static int __init brcmfmac_module_init(v
  11921. - #endif
  11922. - if (!schedule_work(&brcmf_driver_work))
  11923. - return -EBUSY;
  11924. -+ flush_work(&brcmf_driver_work);
  11925. -
  11926. - return 0;
  11927. - }
  11928. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  11929. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  11930. -@@ -444,6 +444,7 @@ struct brcmf_fw {
  11931. - u16 bus_nr;
  11932. - void (*done)(struct device *dev, const struct firmware *fw,
  11933. - void *nvram_image, u32 nvram_len);
  11934. -+ struct completion *completion;
  11935. - };
  11936. -
  11937. - static void brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx)
  11938. -@@ -478,6 +479,8 @@ static void brcmf_fw_request_nvram_done(
  11939. - goto fail;
  11940. -
  11941. - fwctx->done(fwctx->dev, fwctx->code, nvram, nvram_length);
  11942. -+ if (fwctx->completion)
  11943. -+ complete(fwctx->completion);
  11944. - kfree(fwctx);
  11945. - return;
  11946. -
  11947. -@@ -485,6 +488,8 @@ fail:
  11948. - brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev));
  11949. - release_firmware(fwctx->code);
  11950. - device_release_driver(fwctx->dev);
  11951. -+ if (fwctx->completion)
  11952. -+ complete(fwctx->completion);
  11953. - kfree(fwctx);
  11954. - }
  11955. -
  11956. -@@ -500,6 +505,8 @@ static void brcmf_fw_request_code_done(c
  11957. - /* only requested code so done here */
  11958. - if (!(fwctx->flags & BRCMF_FW_REQUEST_NVRAM)) {
  11959. - fwctx->done(fwctx->dev, fw, NULL, 0);
  11960. -+ if (fwctx->completion)
  11961. -+ complete(fwctx->completion);
  11962. - kfree(fwctx);
  11963. - return;
  11964. - }
  11965. -@@ -517,6 +524,8 @@ static void brcmf_fw_request_code_done(c
  11966. - fail:
  11967. - brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev));
  11968. - device_release_driver(fwctx->dev);
  11969. -+ if (fwctx->completion)
  11970. -+ complete(fwctx->completion);
  11971. - kfree(fwctx);
  11972. - }
  11973. -
  11974. -@@ -528,6 +537,8 @@ int brcmf_fw_get_firmwares_pcie(struct d
  11975. - u16 domain_nr, u16 bus_nr)
  11976. - {
  11977. - struct brcmf_fw *fwctx;
  11978. -+ struct completion completion;
  11979. -+ int err;
  11980. -
  11981. - brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(dev));
  11982. - if (!fw_cb || !code)
  11983. -@@ -548,9 +559,17 @@ int brcmf_fw_get_firmwares_pcie(struct d
  11984. - fwctx->domain_nr = domain_nr;
  11985. - fwctx->bus_nr = bus_nr;
  11986. -
  11987. -- return request_firmware_nowait(THIS_MODULE, true, code, dev,
  11988. -+ init_completion(&completion);
  11989. -+ fwctx->completion = &completion;
  11990. -+
  11991. -+ err = request_firmware_nowait(THIS_MODULE, true, code, dev,
  11992. - GFP_KERNEL, fwctx,
  11993. - brcmf_fw_request_code_done);
  11994. -+ if (!err)
  11995. -+ wait_for_completion_timeout(fwctx->completion,
  11996. -+ msecs_to_jiffies(5000));
  11997. -+ fwctx->completion = NULL;
  11998. -+ return err;
  11999. - }
  12000. -
  12001. - int brcmf_fw_get_firmwares(struct device *dev, u16 flags,
  12002. 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
  12003. new file mode 100644
  12004. index 0000000..8721155
  12005. --- /dev/null
  12006. +++ b/package/kernel/mac80211/patches/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch
  12007. @@ -0,0 +1,50 @@
  12008. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  12009. +Date: Thu, 9 Jul 2015 00:07:59 +0200
  12010. +Subject: [PATCH] brcmfmac: workaround bug with some inconsistent BSSes state
  12011. +MIME-Version: 1.0
  12012. +Content-Type: text/plain; charset=UTF-8
  12013. +Content-Transfer-Encoding: 8bit
  12014. +
  12015. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  12016. +---
  12017. +
  12018. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  12019. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  12020. +@@ -665,9 +665,37 @@ static struct wireless_dev *brcmf_cfg802
  12021. + u32 *flags,
  12022. + struct vif_params *params)
  12023. + {
  12024. ++ struct net_device *dev;
  12025. + struct wireless_dev *wdev;
  12026. + int err;
  12027. +
  12028. ++ /*
  12029. ++ * There is a bug with in-firmware BSS management. When adding virtual
  12030. ++ * interface brcmfmac first tells firmware to create new BSS and then
  12031. ++ * it creates new struct net_device.
  12032. ++ *
  12033. ++ * If creating/registering netdev(ice) fails, BSS remains in some bugged
  12034. ++ * state. It conflicts with existing BSSes by overtaking their auth
  12035. ++ * requests.
  12036. ++ *
  12037. ++ * It results in one BSS (addresss X) sending beacons and another BSS
  12038. ++ * (address Y) replying to authentication requests. This makes interface
  12039. ++ * unusable as AP.
  12040. ++ *
  12041. ++ * To workaround this bug we may try to guess if register_netdev(ice)
  12042. ++ * will fail. The most obvious case is using interface name that already
  12043. ++ * exists. This is actually quite likely with brcmfmac & some user space
  12044. ++ * scripts as brcmfmac doesn't allow deleting virtual interfaces.
  12045. ++ * So this bug can be triggered even by something trivial like:
  12046. ++ * iw dev wlan0 delete
  12047. ++ * iw phy phy0 interface add wlan0 type __ap
  12048. ++ */
  12049. ++ dev = dev_get_by_name(&init_net, name);
  12050. ++ if (dev) {
  12051. ++ dev_put(dev);
  12052. ++ return ERR_PTR(-ENFILE);
  12053. ++ }
  12054. ++
  12055. + brcmf_dbg(TRACE, "enter: %s type %d\n", name, type);
  12056. + err = brcmf_vif_add_validate(wiphy_to_cfg(wiphy), type);
  12057. + if (err) {
  12058. diff --git a/package/kernel/mac80211/patches/862-brcmfmac-Disable-power-management.patch b/package/kernel/mac80211/patches/862-brcmfmac-Disable-power-management.patch
  12059. new file mode 100644
  12060. index 0000000..f301fe1
  12061. --- /dev/null
  12062. +++ b/package/kernel/mac80211/patches/862-brcmfmac-Disable-power-management.patch
  12063. @@ -0,0 +1,27 @@
  12064. +From 66ae1b1750720a33e29792a177b1e696f4f005fb Mon Sep 17 00:00:00 2001
  12065. +From: Phil Elwell <phil@raspberrypi.org>
  12066. +Date: Wed, 9 Mar 2016 17:25:59 +0000
  12067. +Subject: [PATCH] brcmfmac: Disable power management
  12068. +
  12069. +Disable wireless power saving in the brcmfmac WLAN driver. This is a
  12070. +temporary measure until the connectivity loss resulting from power
  12071. +saving is resolved.
  12072. +
  12073. +Signed-off-by: Phil Elwell <phil@raspberrypi.org>
  12074. +---
  12075. + drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c | 2 ++
  12076. + 1 file changed, 2 insertions(+)
  12077. +
  12078. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  12079. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  12080. +@@ -2783,6 +2783,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip
  12081. + * preference in cfg struct to apply this to
  12082. + * FW later while initializing the dongle
  12083. + */
  12084. ++#if defined(CONFIG_BCM2708) || defined(CONFIG_BCM2709)
  12085. ++ pr_info("power management disabled\n");
  12086. ++ enabled = false;
  12087. ++#endif
  12088. + cfg->pwr_save = enabled;
  12089. + if (!check_vif_up(ifp->vif)) {
  12090. +
  12091. 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
  12092. deleted file mode 100644
  12093. index 4295b4b..0000000
  12094. --- a/package/kernel/mac80211/patches/862-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch
  12095. +++ /dev/null
  12096. @@ -1,50 +0,0 @@
  12097. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  12098. -Date: Thu, 9 Jul 2015 00:07:59 +0200
  12099. -Subject: [PATCH] brcmfmac: workaround bug with some inconsistent BSSes state
  12100. -MIME-Version: 1.0
  12101. -Content-Type: text/plain; charset=UTF-8
  12102. -Content-Transfer-Encoding: 8bit
  12103. -
  12104. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  12105. ----
  12106. -
  12107. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  12108. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  12109. -@@ -615,9 +615,37 @@ static struct wireless_dev *brcmf_cfg802
  12110. - u32 *flags,
  12111. - struct vif_params *params)
  12112. - {
  12113. -+ struct net_device *dev;
  12114. - struct wireless_dev *wdev;
  12115. - int err;
  12116. -
  12117. -+ /*
  12118. -+ * There is a bug with in-firmware BSS management. When adding virtual
  12119. -+ * interface brcmfmac first tells firmware to create new BSS and then
  12120. -+ * it creates new struct net_device.
  12121. -+ *
  12122. -+ * If creating/registering netdev(ice) fails, BSS remains in some bugged
  12123. -+ * state. It conflicts with existing BSSes by overtaking their auth
  12124. -+ * requests.
  12125. -+ *
  12126. -+ * It results in one BSS (addresss X) sending beacons and another BSS
  12127. -+ * (address Y) replying to authentication requests. This makes interface
  12128. -+ * unusable as AP.
  12129. -+ *
  12130. -+ * To workaround this bug we may try to guess if register_netdev(ice)
  12131. -+ * will fail. The most obvious case is using interface name that already
  12132. -+ * exists. This is actually quite likely with brcmfmac & some user space
  12133. -+ * scripts as brcmfmac doesn't allow deleting virtual interfaces.
  12134. -+ * So this bug can be triggered even by something trivial like:
  12135. -+ * iw dev wlan0 delete
  12136. -+ * iw phy phy0 interface add wlan0 type __ap
  12137. -+ */
  12138. -+ dev = dev_get_by_name(&init_net, name);
  12139. -+ if (dev) {
  12140. -+ dev_put(dev);
  12141. -+ return ERR_PTR(-EEXIST);
  12142. -+ }
  12143. -+
  12144. - brcmf_dbg(TRACE, "enter: %s type %d\n", name, type);
  12145. - err = brcmf_vif_add_validate(wiphy_to_cfg(wiphy), type);
  12146. - if (err) {
  12147. 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
  12148. index f2e21ea..be210f2 100644
  12149. --- a/package/kernel/mac80211/patches/910-01-add-support-for-mt7620.patch
  12150. +++ b/package/kernel/mac80211/patches/910-01-add-support-for-mt7620.patch
  12151. @@ -1184,7 +1184,7 @@
  12152. break;
  12153. default:
  12154. rt2x00_err(rt2x00dev, "Invalid RF chipset 0x%04x detected\n",
  12155. -@@ -8423,6 +9363,7 @@ static int rt2800_probe_hw_mode(struct r
  12156. +@@ -8427,6 +9367,7 @@ static int rt2800_probe_hw_mode(struct r
  12157. case RF5372:
  12158. case RF5390:
  12159. case RF5392:
  12160. @@ -1192,7 +1192,7 @@
  12161. spec->num_channels = 14;
  12162. if (spec->clk_is_20mhz)
  12163. spec->channels = rf_vals_xtal20mhz_3x;
  12164. -@@ -8563,6 +9504,7 @@ static int rt2800_probe_hw_mode(struct r
  12165. +@@ -8567,6 +9508,7 @@ static int rt2800_probe_hw_mode(struct r
  12166. case RF5372:
  12167. case RF5390:
  12168. case RF5392:
  12169. diff --git a/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch b/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
  12170. index 8c6d720..e842d61 100644
  12171. --- a/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
  12172. +++ b/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
  12173. @@ -14,7 +14,7 @@ Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
  12174. --- a/drivers/net/wireless/ath/ath10k/core.c
  12175. +++ b/drivers/net/wireless/ath/ath10k/core.c
  12176. -@@ -1914,6 +1914,16 @@ int ath10k_core_register(struct ath10k *
  12177. +@@ -2107,6 +2107,16 @@ int ath10k_core_register(struct ath10k *
  12178. ar->chip_id = chip_id;
  12179. queue_work(ar->workqueue, &ar->register_work);
  12180. 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
  12181. index 281b447..a501b99 100644
  12182. --- a/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch
  12183. +++ b/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch
  12184. @@ -1,6 +1,6 @@
  12185. --- a/drivers/net/wireless/ath/ath10k/mac.c
  12186. +++ b/drivers/net/wireless/ath/ath10k/mac.c
  12187. -@@ -7141,6 +7141,21 @@ struct ath10k_vif *ath10k_get_arvif(stru
  12188. +@@ -7742,6 +7742,21 @@ struct ath10k_vif *ath10k_get_arvif(stru
  12189. return arvif_iter.arvif;
  12190. }
  12191. @@ -22,11 +22,11 @@
  12192. int ath10k_mac_register(struct ath10k *ar)
  12193. {
  12194. static const u32 cipher_suites[] = {
  12195. -@@ -7357,6 +7372,12 @@ int ath10k_mac_register(struct ath10k *a
  12196. +@@ -7975,6 +7990,12 @@ int ath10k_mac_register(struct ath10k *a
  12197. ar->hw->wiphy->cipher_suites = cipher_suites;
  12198. ar->hw->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
  12199. -+#if CPTCFG_MAC80211_LEDS
  12200. ++#ifdef CPTCFG_MAC80211_LEDS
  12201. + ieee80211_create_tpt_led_trigger(ar->hw,
  12202. + IEEE80211_TPT_LEDTRIG_FL_RADIO, ath10k_tpt_blink,
  12203. + ARRAY_SIZE(ath10k_tpt_blink));
  12204. diff --git a/package/kernel/mac80211/patches/936-ath10k_skip_otp_check.patch b/package/kernel/mac80211/patches/936-ath10k_skip_otp_check.patch
  12205. new file mode 100644
  12206. index 0000000..596ef98
  12207. --- /dev/null
  12208. +++ b/package/kernel/mac80211/patches/936-ath10k_skip_otp_check.patch
  12209. @@ -0,0 +1,51 @@
  12210. +--- a/drivers/net/wireless/ath/ath10k/core.c
  12211. ++++ b/drivers/net/wireless/ath/ath10k/core.c
  12212. +@@ -1243,9 +1243,6 @@ static int ath10k_core_fetch_firmware_fi
  12213. + {
  12214. + int ret;
  12215. +
  12216. +- /* calibration file is optional, don't check for any errors */
  12217. +- ath10k_fetch_cal_file(ar);
  12218. +-
  12219. + ar->fw_api = 5;
  12220. + ath10k_dbg(ar, ATH10K_DBG_BOOT, "trying fw api %d\n", ar->fw_api);
  12221. +
  12222. +@@ -1944,7 +1941,7 @@ EXPORT_SYMBOL(ath10k_core_stop);
  12223. + static int ath10k_core_probe_fw(struct ath10k *ar)
  12224. + {
  12225. + struct bmi_target_info target_info;
  12226. +- int ret = 0;
  12227. ++ int calret, ret = 0;
  12228. +
  12229. + ret = ath10k_hif_power_up(ar);
  12230. + if (ret) {
  12231. +@@ -1968,6 +1965,9 @@ static int ath10k_core_probe_fw(struct a
  12232. + goto err_power_down;
  12233. + }
  12234. +
  12235. ++ /* calibration file is optional, don't check for any errors */
  12236. ++ calret = ath10k_fetch_cal_file(ar);
  12237. ++
  12238. + ret = ath10k_core_fetch_firmware_files(ar);
  12239. + if (ret) {
  12240. + ath10k_err(ar, "could not fetch firmware files (%d)\n", ret);
  12241. +@@ -1990,11 +1990,14 @@ static int ath10k_core_probe_fw(struct a
  12242. + "could not load pre cal data: %d\n", ret);
  12243. + }
  12244. +
  12245. +- ret = ath10k_core_get_board_id_from_otp(ar);
  12246. +- if (ret && ret != -EOPNOTSUPP) {
  12247. +- ath10k_err(ar, "failed to get board id from otp: %d\n",
  12248. +- ret);
  12249. +- goto err_free_firmware_files;
  12250. ++ /* otp and board file not needed if calibration data is present */
  12251. ++ if (calret) {
  12252. ++ ret = ath10k_core_get_board_id_from_otp(ar);
  12253. ++ if (ret && ret != -EOPNOTSUPP) {
  12254. ++ ath10k_err(ar, "failed to get board id from otp: %d\n",
  12255. ++ ret);
  12256. ++ goto err_free_firmware_files;
  12257. ++ }
  12258. + }
  12259. +
  12260. + ret = ath10k_core_fetch_board_file(ar);
  12261. diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile
  12262. index e49dd48..90430b9 100644
  12263. --- a/package/kernel/mt76/Makefile
  12264. +++ b/package/kernel/mt76/Makefile
  12265. @@ -1,7 +1,7 @@
  12266. include $(TOPDIR)/rules.mk
  12267. PKG_NAME:=mt76
  12268. -PKG_VERSION:=2016-03-03
  12269. +PKG_VERSION:=2016-07-08
  12270. PKG_RELEASE=1
  12271. PKG_LICENSE:=GPLv2
  12272. @@ -10,23 +10,26 @@ PKG_LICENSE_FILES:=
  12273. PKG_SOURCE_URL:=https://github.com/openwrt/mt76
  12274. PKG_SOURCE_PROTO:=git
  12275. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  12276. -PKG_SOURCE_VERSION:=310d420178c86e253a172413da30ecf479b64251
  12277. +PKG_SOURCE_VERSION:=9226e96c40e9ae19996a262365ce764f7b0b9c4a
  12278. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
  12279. -PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  12280. +PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  12281. PKG_BUILD_PARALLEL:=1
  12282. +STAMP_CONFIGURED_DEPENDS := $(STAGING_DIR)/usr/include/mac80211-backport/backport/autoconf.h
  12283. +
  12284. include $(INCLUDE_DIR)/kernel.mk
  12285. include $(INCLUDE_DIR)/package.mk
  12286. define KernelPackage/mt76
  12287. SUBMENU:=Wireless Drivers
  12288. - TITLE:=MediaTek MT76x2 wireless driver
  12289. - DEPENDS:=+kmod-mac80211 +@DRIVER_11N_SUPPORT @PCI_SUPPORT
  12290. + TITLE:=MediaTek MT76x2/MT7603 wireless driver
  12291. + DEPENDS:=+kmod-mac80211 +@DRIVER_11N_SUPPORT @PCI_SUPPORT @!LINUX_3_18
  12292. FILES:=\
  12293. $(PKG_BUILD_DIR)/mt76.ko \
  12294. - $(PKG_BUILD_DIR)/mt76x2e.ko
  12295. - AUTOLOAD:=$(call AutoLoad,50,mac80211 mt76 mt76x2e)
  12296. + $(PKG_BUILD_DIR)/mt76x2e.ko \
  12297. + $(PKG_BUILD_DIR)/mt7603e.ko
  12298. + AUTOLOAD:=$(call AutoLoad,50,mac80211 mt76 mt76x2e mt7603e)
  12299. endef
  12300. NOSTDINC_FLAGS = \
  12301. @@ -54,6 +57,12 @@ endef
  12302. define KernelPackage/mt76/install
  12303. $(INSTALL_DIR) $(1)/lib/firmware
  12304. cp \
  12305. + $(if $(CONFIG_TARGET_ramips_mt7628) || $(CONFIG_TARGET_ramips_mt7688), \
  12306. + $(PKG_BUILD_DIR)/firmware/mt7628_e1.bin \
  12307. + $(PKG_BUILD_DIR)/firmware/mt7628_e2.bin \
  12308. + ) \
  12309. + $(PKG_BUILD_DIR)/firmware/mt7603_e1.bin \
  12310. + $(PKG_BUILD_DIR)/firmware/mt7603_e2.bin \
  12311. $(PKG_BUILD_DIR)/firmware/mt7662_rom_patch.bin \
  12312. $(PKG_BUILD_DIR)/firmware/mt7662.bin \
  12313. $(1)/lib/firmware
  12314. diff --git a/package/kernel/mwlwifi/Makefile b/package/kernel/mwlwifi/Makefile
  12315. index 091928d..880803e 100644
  12316. --- a/package/kernel/mwlwifi/Makefile
  12317. +++ b/package/kernel/mwlwifi/Makefile
  12318. @@ -8,7 +8,7 @@
  12319. include $(TOPDIR)/rules.mk
  12320. PKG_NAME:=mwlwifi
  12321. -PKG_VERSION:=10.3.0.16-20160105
  12322. +PKG_VERSION:=10.3.0.17-20160617
  12323. PKG_RELEASE=1
  12324. PKG_LICENSE:=ISC
  12325. @@ -17,7 +17,7 @@ PKG_LICENSE_FILES:=
  12326. PKG_SOURCE_URL:=https://github.com/kaloz/mwlwifi
  12327. PKG_SOURCE_PROTO:=git
  12328. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  12329. -PKG_SOURCE_VERSION:=99d3879cc72f2a25d44fb4bee96fd84eca028b04
  12330. +PKG_SOURCE_VERSION:=b7aff3c2839b048407d716d1cb9326122ee401f8
  12331. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
  12332. PKG_MAINTAINER:=Imre Kaloz <kaloz@openwrt.org>
  12333. diff --git a/package/kernel/mwlwifi/patches/100-drop_old_api.patch b/package/kernel/mwlwifi/patches/100-drop_old_api.patch
  12334. deleted file mode 100644
  12335. index d2e149e..0000000
  12336. --- a/package/kernel/mwlwifi/patches/100-drop_old_api.patch
  12337. +++ /dev/null
  12338. @@ -1,92 +0,0 @@
  12339. ---- a/main.c
  12340. -+++ b/main.c
  12341. -@@ -418,11 +418,7 @@ static void mwl_set_ht_caps(struct mwl_p
  12342. - band->ht_cap.cap |= IEEE80211_HT_CAP_SGI_20;
  12343. - band->ht_cap.cap |= IEEE80211_HT_CAP_SGI_40;
  12344. -
  12345. --#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
  12346. -- hw->flags |= IEEE80211_HW_AMPDU_AGGREGATION;
  12347. --#else
  12348. - ieee80211_hw_set(hw, AMPDU_AGGREGATION);
  12349. --#endif
  12350. - band->ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K;
  12351. - band->ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_4;
  12352. -
  12353. -@@ -524,29 +520,16 @@ static int mwl_wl_init(struct mwl_priv *
  12354. - hw->queues = SYSADPT_TX_WMM_QUEUES;
  12355. -
  12356. - /* Set rssi values to dBm */
  12357. --#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
  12358. -- hw->flags |= IEEE80211_HW_SIGNAL_DBM | IEEE80211_HW_HAS_RATE_CONTROL;
  12359. --#else
  12360. - ieee80211_hw_set(hw, SIGNAL_DBM);
  12361. - ieee80211_hw_set(hw, HAS_RATE_CONTROL);
  12362. --#endif
  12363. -
  12364. - /* Ask mac80211 not to trigger PS mode
  12365. - * based on PM bit of incoming frames.
  12366. - */
  12367. --#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
  12368. -- hw->flags |= IEEE80211_HW_AP_LINK_PS;
  12369. --#else
  12370. - ieee80211_hw_set(hw, AP_LINK_PS);
  12371. --#endif
  12372. -
  12373. --#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
  12374. -- hw->flags |= IEEE80211_HW_SUPPORTS_PER_STA_GTK |
  12375. -- IEEE80211_HW_MFP_CAPABLE;
  12376. --#else
  12377. - ieee80211_hw_set(hw, SUPPORTS_PER_STA_GTK);
  12378. - ieee80211_hw_set(hw, MFP_CAPABLE);
  12379. --#endif
  12380. -
  12381. - hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
  12382. -
  12383. ---- a/dev.h
  12384. -+++ b/dev.h
  12385. -@@ -484,10 +484,6 @@ static inline struct mwl_sta *mwl_dev_ge
  12386. - return (struct mwl_sta *)&sta->drv_priv;
  12387. - }
  12388. -
  12389. --#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)
  12390. --#define ether_addr_copy(dst, src) memcpy(dst, src, ETH_ALEN)
  12391. --#endif
  12392. --
  12393. - /* Defined in mac80211.c. */
  12394. - extern const struct ieee80211_ops mwl_mac80211_ops;
  12395. -
  12396. ---- a/mac80211.c
  12397. -+++ b/mac80211.c
  12398. -@@ -572,19 +572,11 @@ static int mwl_mac80211_get_survey(struc
  12399. - return 0;
  12400. - }
  12401. -
  12402. --#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0)
  12403. --static int mwl_mac80211_ampdu_action(struct ieee80211_hw *hw,
  12404. -- struct ieee80211_vif *vif,
  12405. -- enum ieee80211_ampdu_mlme_action action,
  12406. -- struct ieee80211_sta *sta,
  12407. -- u16 tid, u16 *ssn, u8 buf_size)
  12408. --#else
  12409. - static int mwl_mac80211_ampdu_action(struct ieee80211_hw *hw,
  12410. - struct ieee80211_vif *vif,
  12411. - enum ieee80211_ampdu_mlme_action action,
  12412. - struct ieee80211_sta *sta,
  12413. - u16 tid, u16 *ssn, u8 buf_size, bool amsdu)
  12414. --#endif
  12415. - {
  12416. - int rc = 0;
  12417. - struct mwl_priv *priv = hw->priv;
  12418. ---- a/rx.c
  12419. -+++ b/rx.c
  12420. -@@ -232,10 +232,8 @@ static inline void mwl_rx_prepare_status
  12421. - status->flag |= RX_FLAG_VHT;
  12422. - if (bw == RX_RATE_INFO_HT40)
  12423. - status->flag |= RX_FLAG_40MHZ;
  12424. --#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 18, 0)
  12425. - if (bw == RX_RATE_INFO_HT80)
  12426. - status->vht_flag |= RX_VHT_FLAG_80MHZ;
  12427. --#endif
  12428. - if (gi == RX_RATE_INFO_SHORT_INTERVAL)
  12429. - status->flag |= RX_FLAG_SHORT_GI;
  12430. - status->vht_nss = (nss + 1);
  12431. diff --git a/package/kernel/mwlwifi/patches/110-api_sync.patch b/package/kernel/mwlwifi/patches/110-api_sync.patch
  12432. deleted file mode 100644
  12433. index ed3e06a..0000000
  12434. --- a/package/kernel/mwlwifi/patches/110-api_sync.patch
  12435. +++ /dev/null
  12436. @@ -1,19 +0,0 @@
  12437. ---- a/mac80211.c
  12438. -+++ b/mac80211.c
  12439. -@@ -597,10 +597,13 @@ static int mwl_mac80211_get_survey(struc
  12440. -
  12441. - static int mwl_mac80211_ampdu_action(struct ieee80211_hw *hw,
  12442. - struct ieee80211_vif *vif,
  12443. -- enum ieee80211_ampdu_mlme_action action,
  12444. -- struct ieee80211_sta *sta,
  12445. -- u16 tid, u16 *ssn, u8 buf_size, bool amsdu)
  12446. -+ struct ieee80211_ampdu_params *params)
  12447. - {
  12448. -+ enum ieee80211_ampdu_mlme_action action = params->action;
  12449. -+ struct ieee80211_sta *sta = params->sta;
  12450. -+ u16 tid = params->tid;
  12451. -+ u16 *ssn = &params->ssn;
  12452. -+ u8 buf_size = params->buf_size;
  12453. - int rc = 0;
  12454. - struct mwl_priv *priv = hw->priv;
  12455. - struct mwl_ampdu_stream *stream;
  12456. diff --git a/package/network/services/hostapd/Config.in b/package/network/services/hostapd/Config.in
  12457. index aee2a15..645888e 100644
  12458. --- a/package/network/services/hostapd/Config.in
  12459. +++ b/package/network/services/hostapd/Config.in
  12460. @@ -10,11 +10,10 @@ config WPA_SUPPLICANT_NO_TIMESTAMP_CHECK
  12461. choice
  12462. prompt "Choose TLS provider"
  12463. default WPA_SUPPLICANT_INTERNAL
  12464. - depends on PACKAGE_wpa-supplicant || PACKAGE_wpa-supplicant-mesh || PACKAGE_wpad || PACKAGE_wpad-mesh
  12465. + depends on PACKAGE_wpa-supplicant || PACKAGE_wpad
  12466. config WPA_SUPPLICANT_INTERNAL
  12467. bool "internal"
  12468. - depends on PACKAGE_wpa-supplicant || PACKAGE_wpad
  12469. config WPA_SUPPLICANT_OPENSSL
  12470. bool "openssl"
  12471. diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile
  12472. index 8e706dc..5caf3e3 100644
  12473. --- a/package/network/services/hostapd/Makefile
  12474. +++ b/package/network/services/hostapd/Makefile
  12475. @@ -7,18 +7,18 @@
  12476. include $(TOPDIR)/rules.mk
  12477. PKG_NAME:=hostapd
  12478. -PKG_VERSION:=2015-03-25
  12479. +PKG_VERSION:=2016-06-15
  12480. PKG_RELEASE:=1
  12481. -PKG_REV:=8278138e679174b1ec8af7f169c2810a8888e202
  12482. +PKG_REV:=31d3692fe5d56c05753ed4a70c7943979e1d29e7
  12483. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
  12484. -PKG_SOURCE_URL:=git://w1.fi/srv/git/hostap.git
  12485. +PKG_SOURCE_URL:=http://w1.fi/hostap.git
  12486. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  12487. PKG_SOURCE_VERSION:=$(PKG_REV)
  12488. PKG_SOURCE_PROTO:=git
  12489. # PKG_MIRROR_MD5SUM:=4e7c1f97edd7514535056fce54ae053a
  12490. -PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  12491. +PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  12492. PKG_LICENSE:=BSD-3-Clause
  12493. PKG_BUILD_PARALLEL:=1
  12494. @@ -29,7 +29,6 @@ PKG_CONFIG_DEPENDS:= \
  12495. CONFIG_PACKAGE_kmod-cfg80211 \
  12496. CONFIG_PACKAGE_hostapd \
  12497. CONFIG_PACKAGE_hostapd-mini \
  12498. - CONFIG_PACKAGE_kmod-hostap \
  12499. CONFIG_WPA_RFKILL_SUPPORT \
  12500. CONFIG_DRIVER_WEXT_SUPPORT \
  12501. CONFIG_DRIVER_11N_SUPPORT
  12502. @@ -40,6 +39,10 @@ LOCAL_TYPE=$(strip \
  12503. hostapd \
  12504. )))
  12505. LOCAL_VARIANT=$(patsubst wpad-%,%,$(patsubst supplicant-%,%,$(BUILD_VARIANT)))
  12506. +CONFIG_VARIANT:=$(LOCAL_VARIANT)
  12507. +ifeq ($(LOCAL_VARIANT),mesh)
  12508. + CONFIG_VARIANT:=full
  12509. +endif
  12510. ifeq ($(LOCAL_TYPE),supplicant)
  12511. ifeq ($(LOCAL_VARIANT),full)
  12512. @@ -47,10 +50,6 @@ ifeq ($(LOCAL_TYPE),supplicant)
  12513. CONFIG_WPA_SUPPLICANT_INTERNAL \
  12514. CONFIG_WPA_SUPPLICANT_OPENSSL
  12515. endif
  12516. - ifeq ($(LOCAL_VARIANT),mesh)
  12517. - PKG_CONFIG_DEPENDS += \
  12518. - CONFIG_WPA_SUPPLICANT_OPENSSL
  12519. - endif
  12520. endif
  12521. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
  12522. @@ -66,7 +65,6 @@ endif
  12523. DRIVER_MAKEOPTS= \
  12524. CONFIG_ACS=$(CONFIG_PACKAGE_kmod-cfg80211) \
  12525. CONFIG_DRIVER_NL80211=$(CONFIG_PACKAGE_kmod-cfg80211) \
  12526. - CONFIG_DRIVER_HOSTAP=$(CONFIG_PACKAGE_kmod-hostap) \
  12527. CONFIG_IEEE80211N=$(HOSTAPD_IEEE80211N) \
  12528. CONFIG_DRIVER_WEXT=$(CONFIG_DRIVER_WEXT_SUPPORT) \
  12529. @@ -82,7 +80,7 @@ ifneq ($(LOCAL_TYPE),hostapd)
  12530. endif
  12531. endif
  12532. ifeq ($(LOCAL_VARIANT),mesh)
  12533. - DRIVER_MAKEOPTS += CONFIG_TLS=openssl
  12534. + DRIVER_MAKEOPTS += CONFIG_TLS=openssl CONFIG_AP=y CONFIG_SAE=y CONFIG_MESH=y
  12535. TARGET_LDFLAGS += -lcrypto -lssl
  12536. endif
  12537. ifdef CONFIG_WPA_SUPPLICANT_NO_TIMESTAMP_CHECK
  12538. @@ -177,8 +175,7 @@ endef
  12539. define Package/wpad-mesh
  12540. $(call Package/wpad/Default)
  12541. TITLE+= (with 802.11s mesh and SAE support)
  12542. - DEPENDS:=$(DRV_DEPENDS) +libubus +libopenssl +@CONFIG_WPA_SUPPLICANT_OPENSSL @(!TARGET_uml||BROKEN)
  12543. - CONFLICTS:=@WPA_SUPPLICANT_INTERNAL
  12544. + DEPENDS:=$(DRV_DEPENDS) +libubus +PACKAGE_wpad-mesh:libopenssl @(!TARGET_uml||BROKEN)
  12545. VARIANT:=wpad-mesh
  12546. endef
  12547. @@ -257,12 +254,6 @@ define Package/hostapd-common
  12548. CATEGORY:=Network
  12549. endef
  12550. -define Package/hostapd-common-old
  12551. - TITLE:=hostapd/wpa_supplicant common support files (legacy drivers)
  12552. - SECTION:=net
  12553. - CATEGORY:=Network
  12554. -endef
  12555. -
  12556. define Package/eapol-test
  12557. TITLE:=802.1x authentication test utility
  12558. SECTION:=net
  12559. @@ -284,10 +275,10 @@ endif
  12560. define Build/Configure
  12561. $(Build/Configure/rebuild)
  12562. - $(if $(wildcard ./files/hostapd-$(LOCAL_VARIANT).config), \
  12563. - $(CP) ./files/hostapd-$(LOCAL_VARIANT).config $(PKG_BUILD_DIR)/hostapd/.config \
  12564. + $(if $(wildcard ./files/hostapd-$(CONFIG_VARIANT).config), \
  12565. + $(CP) ./files/hostapd-$(CONFIG_VARIANT).config $(PKG_BUILD_DIR)/hostapd/.config \
  12566. )
  12567. - $(CP) ./files/wpa_supplicant-$(LOCAL_VARIANT).config $(PKG_BUILD_DIR)/wpa_supplicant/.config
  12568. + $(CP) ./files/wpa_supplicant-$(CONFIG_VARIANT).config $(PKG_BUILD_DIR)/wpa_supplicant/.config
  12569. endef
  12570. TARGET_CPPFLAGS := \
  12571. @@ -379,12 +370,6 @@ define Package/hostapd-common/install
  12572. $(INSTALL_DATA) ./files/netifd.sh $(1)/lib/netifd/hostapd.sh
  12573. endef
  12574. -define Package/hostapd-common-old/install
  12575. - $(INSTALL_DIR) $(1)/lib/wifi
  12576. - $(INSTALL_DATA) ./files/hostapd.sh $(1)/lib/wifi/hostapd.sh
  12577. - $(INSTALL_DATA) ./files/wpa_supplicant.sh $(1)/lib/wifi/wpa_supplicant.sh
  12578. -endef
  12579. -
  12580. define Package/hostapd/install
  12581. $(call Install/hostapd,$(1))
  12582. $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd $(1)/usr/sbin/
  12583. @@ -442,5 +427,4 @@ $(eval $(call BuildPackage,wpa-supplicant-p2p))
  12584. $(eval $(call BuildPackage,wpa-cli))
  12585. $(eval $(call BuildPackage,hostapd-utils))
  12586. $(eval $(call BuildPackage,hostapd-common))
  12587. -$(eval $(call BuildPackage,hostapd-common-old))
  12588. $(eval $(call BuildPackage,eapol-test))
  12589. diff --git a/package/network/services/hostapd/files/hostapd-full.config b/package/network/services/hostapd/files/hostapd-full.config
  12590. index f1b2655..e388109 100644
  12591. --- a/package/network/services/hostapd/files/hostapd-full.config
  12592. +++ b/package/network/services/hostapd/files/hostapd-full.config
  12593. @@ -10,7 +10,7 @@
  12594. # to override previous values of the variables.
  12595. # Driver interface for Host AP driver
  12596. -CONFIG_DRIVER_HOSTAP=y
  12597. +#CONFIG_DRIVER_HOSTAP=y
  12598. # Driver interface for wired authenticator
  12599. CONFIG_DRIVER_WIRED=y
  12600. @@ -53,6 +53,9 @@ CONFIG_PEERKEY=y
  12601. # Integrated EAP server
  12602. CONFIG_EAP=y
  12603. +# EAP-FAST for the integrated EAP server
  12604. +CONFIG_EAP_FAST=y
  12605. +
  12606. # EAP-MD5 for the integrated EAP server
  12607. CONFIG_EAP_MD5=y
  12608. diff --git a/package/network/services/hostapd/files/hostapd-mini.config b/package/network/services/hostapd/files/hostapd-mini.config
  12609. index 118d97c..8baff18 100644
  12610. --- a/package/network/services/hostapd/files/hostapd-mini.config
  12611. +++ b/package/network/services/hostapd/files/hostapd-mini.config
  12612. @@ -10,7 +10,7 @@
  12613. # to override previous values of the variables.
  12614. # Driver interface for Host AP driver
  12615. -CONFIG_DRIVER_HOSTAP=y
  12616. +#CONFIG_DRIVER_HOSTAP=y
  12617. # Driver interface for wired authenticator
  12618. CONFIG_DRIVER_WIRED=y
  12619. diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh
  12620. deleted file mode 100644
  12621. index 7aec7ad..0000000
  12622. --- a/package/network/services/hostapd/files/hostapd.sh
  12623. +++ /dev/null
  12624. @@ -1,394 +0,0 @@
  12625. -hostapd_set_bss_options() {
  12626. - local var="$1"
  12627. - local vif="$2"
  12628. - local enc wep_rekey wpa_group_rekey wpa_pair_rekey wpa_master_rekey wps_possible wpa_key_mgmt
  12629. -
  12630. - config_get enc "$vif" encryption "none"
  12631. - config_get wep_rekey "$vif" wep_rekey # 300
  12632. - config_get wpa_group_rekey "$vif" wpa_group_rekey # 300
  12633. - config_get wpa_pair_rekey "$vif" wpa_pair_rekey # 300
  12634. - config_get wpa_master_rekey "$vif" wpa_master_rekey # 640
  12635. - config_get_bool ap_isolate "$vif" isolate 0
  12636. - config_get_bool disassoc_low_ack "$vif" disassoc_low_ack 1
  12637. - config_get max_num_sta "$vif" max_num_sta 0
  12638. - config_get max_inactivity "$vif" max_inactivity 0
  12639. - config_get_bool preamble "$vif" short_preamble 1
  12640. -
  12641. - config_get device "$vif" device
  12642. - config_get hwmode "$device" hwmode
  12643. - config_get phy "$device" phy
  12644. -
  12645. - append "$var" "ctrl_interface=/var/run/hostapd-$phy" "$N"
  12646. -
  12647. - if [ "$ap_isolate" -gt 0 ]; then
  12648. - append "$var" "ap_isolate=$ap_isolate" "$N"
  12649. - fi
  12650. - if [ "$max_num_sta" -gt 0 ]; then
  12651. - append "$var" "max_num_sta=$max_num_sta" "$N"
  12652. - fi
  12653. - if [ "$max_inactivity" -gt 0 ]; then
  12654. - append "$var" "ap_max_inactivity=$max_inactivity" "$N"
  12655. - fi
  12656. - append "$var" "disassoc_low_ack=$disassoc_low_ack" "$N"
  12657. - if [ "$preamble" -gt 0 ]; then
  12658. - append "$var" "preamble=$preamble" "$N"
  12659. - fi
  12660. -
  12661. - # Examples:
  12662. - # psk-mixed/tkip => WPA1+2 PSK, TKIP
  12663. - # wpa-psk2/tkip+aes => WPA2 PSK, CCMP+TKIP
  12664. - # wpa2/tkip+aes => WPA2 RADIUS, CCMP+TKIP
  12665. - # ...
  12666. -
  12667. - # TODO: move this parsing function somewhere generic, so that
  12668. - # later it can be reused by drivers that don't use hostapd
  12669. -
  12670. - # crypto defaults: WPA2 vs WPA1
  12671. - case "$enc" in
  12672. - wpa2*|*psk2*)
  12673. - wpa=2
  12674. - crypto="CCMP"
  12675. - ;;
  12676. - *mixed*)
  12677. - wpa=3
  12678. - crypto="CCMP TKIP"
  12679. - ;;
  12680. - *)
  12681. - wpa=1
  12682. - crypto="TKIP"
  12683. - ;;
  12684. - esac
  12685. -
  12686. - # explicit override for crypto setting
  12687. - case "$enc" in
  12688. - *tkip+aes|*tkip+ccmp|*aes+tkip|*ccmp+tkip) crypto="CCMP TKIP";;
  12689. - *aes|*ccmp) crypto="CCMP";;
  12690. - *tkip) crypto="TKIP";;
  12691. - esac
  12692. -
  12693. - # enforce CCMP for 11ng and 11na
  12694. - case "$hwmode:$crypto" in
  12695. - *ng:TKIP|*na:TKIP) crypto="CCMP TKIP";;
  12696. - esac
  12697. -
  12698. - # use crypto/auth settings for building the hostapd config
  12699. - case "$enc" in
  12700. - none)
  12701. - wps_possible=1
  12702. - wpa=0
  12703. - crypto=
  12704. - # Here we make the assumption that if we're in open mode
  12705. - # with WPS enabled, we got to be in unconfigured state.
  12706. - wps_not_configured=1
  12707. - ;;
  12708. - *psk*)
  12709. - config_get psk "$vif" key
  12710. - if [ ${#psk} -eq 64 ]; then
  12711. - append "$var" "wpa_psk=$psk" "$N"
  12712. - else
  12713. - append "$var" "wpa_passphrase=$psk" "$N"
  12714. - fi
  12715. - wps_possible=1
  12716. - [ -n "$wpa_group_rekey" ] && append "$var" "wpa_group_rekey=$wpa_group_rekey" "$N"
  12717. - [ -n "$wpa_pair_rekey" ] && append "$var" "wpa_ptk_rekey=$wpa_pair_rekey" "$N"
  12718. - [ -n "$wpa_master_rekey" ] && append "$var" "wpa_gmk_rekey=$wpa_master_rekey" "$N"
  12719. - append wpa_key_mgmt "WPA-PSK"
  12720. - ;;
  12721. - *wpa*|*8021x*)
  12722. - # required fields? formats?
  12723. - # hostapd is particular, maybe a default configuration for failures
  12724. - config_get auth_server "$vif" auth_server
  12725. - [ -z "$auth_server" ] && config_get auth_server "$vif" server
  12726. - append "$var" "auth_server_addr=$auth_server" "$N"
  12727. - config_get auth_port "$vif" auth_port
  12728. - [ -z "$auth_port" ] && config_get auth_port "$vif" port
  12729. - auth_port=${auth_port:-1812}
  12730. - append "$var" "auth_server_port=$auth_port" "$N"
  12731. - config_get auth_secret "$vif" auth_secret
  12732. - [ -z "$auth_secret" ] && config_get auth_secret "$vif" key
  12733. - append "$var" "auth_server_shared_secret=$auth_secret" "$N"
  12734. - # You don't really want to enable this unless you are doing
  12735. - # some corner case testing or are using OpenWrt as a work around
  12736. - # for some systematic issues.
  12737. - config_get_bool auth_cache "$vif" auth_cache 0
  12738. - config_get rsn_preauth "$vif" rsn_preauth
  12739. - [ "$auth_cache" -gt 0 ] || [[ "$rsn_preauth" = 1 ]] || append "$var" "disable_pmksa_caching=1" "$N"
  12740. - [ "$auth_cache" -gt 0 ] || [[ "$rsn_preauth" = 1 ]] || append "$var" "okc=0" "$N"
  12741. - config_get acct_server "$vif" acct_server
  12742. - [ -n "$acct_server" ] && append "$var" "acct_server_addr=$acct_server" "$N"
  12743. - config_get acct_port "$vif" acct_port
  12744. - [ -n "$acct_port" ] && acct_port=${acct_port:-1813}
  12745. - [ -n "$acct_port" ] && append "$var" "acct_server_port=$acct_port" "$N"
  12746. - config_get acct_secret "$vif" acct_secret
  12747. - [ -n "$acct_secret" ] && append "$var" "acct_server_shared_secret=$acct_secret" "$N"
  12748. - config_get eap_reauth_period "$vif" eap_reauth_period
  12749. - [ -n "$eap_reauth_period" ] && append "$var" "eap_reauth_period=$eap_reauth_period" "$N"
  12750. - config_get dae_client "$vif" dae_client
  12751. - config_get dae_secret "$vif" dae_secret
  12752. - [ -n "$dae_client" -a -n "$dae_secret" ] && {
  12753. - config_get dae_port "$vif" dae_port
  12754. - append "$var" "radius_das_port=${dae_port:-3799}" "$N"
  12755. - append "$var" "radius_das_client=$dae_client $dae_secret" "$N"
  12756. - }
  12757. - config_get ownip "$vif" ownip
  12758. - append "$var" "own_ip_addr=$ownip" "$N"
  12759. - append "$var" "eapol_key_index_workaround=1" "$N"
  12760. - append "$var" "ieee8021x=1" "$N"
  12761. - append wpa_key_mgmt "WPA-EAP"
  12762. - [ -n "$wpa_group_rekey" ] && append "$var" "wpa_group_rekey=$wpa_group_rekey" "$N"
  12763. - [ -n "$wpa_pair_rekey" ] && append "$var" "wpa_ptk_rekey=$wpa_pair_rekey" "$N"
  12764. - [ -n "$wpa_master_rekey" ] && append "$var" "wpa_gmk_rekey=$wpa_master_rekey" "$N"
  12765. - ;;
  12766. - *wep*)
  12767. - config_get key "$vif" key
  12768. - key="${key:-1}"
  12769. - case "$key" in
  12770. - [1234])
  12771. - for idx in 1 2 3 4; do
  12772. - local zidx
  12773. - zidx=$(($idx - 1))
  12774. - config_get ckey "$vif" "key${idx}"
  12775. - [ -n "$ckey" ] && \
  12776. - append "$var" "wep_key${zidx}=$(prepare_key_wep "$ckey")" "$N"
  12777. - done
  12778. - append "$var" "wep_default_key=$((key - 1))" "$N"
  12779. - ;;
  12780. - *)
  12781. - append "$var" "wep_key0=$(prepare_key_wep "$key")" "$N"
  12782. - append "$var" "wep_default_key=0" "$N"
  12783. - [ -n "$wep_rekey" ] && append "$var" "wep_rekey_period=$wep_rekey" "$N"
  12784. - ;;
  12785. - esac
  12786. - case "$enc" in
  12787. - *shared*)
  12788. - auth_algs=2
  12789. - ;;
  12790. - *mixed*)
  12791. - auth_algs=3
  12792. - ;;
  12793. - esac
  12794. - wpa=0
  12795. - crypto=
  12796. - ;;
  12797. - *)
  12798. - wpa=0
  12799. - crypto=
  12800. - ;;
  12801. - esac
  12802. - append "$var" "auth_algs=${auth_algs:-1}" "$N"
  12803. - append "$var" "wpa=$wpa" "$N"
  12804. - [ -n "$crypto" ] && append "$var" "wpa_pairwise=$crypto" "$N"
  12805. - [ -n "$wpa_group_rekey" ] && append "$var" "wpa_group_rekey=$wpa_group_rekey" "$N"
  12806. -
  12807. - config_get ssid "$vif" ssid
  12808. - config_get bridge "$vif" bridge
  12809. - config_get ieee80211d "$vif" ieee80211d
  12810. - config_get iapp_interface "$vif" iapp_interface
  12811. -
  12812. - config_get_bool wps_pbc "$vif" wps_pushbutton 0
  12813. - config_get_bool wps_label "$vif" wps_label 0
  12814. -
  12815. - config_get config_methods "$vif" wps_config
  12816. - [ "$wps_pbc" -gt 0 ] && append config_methods push_button
  12817. -
  12818. - [ -n "$wps_possible" -a -n "$config_methods" ] && {
  12819. - config_get device_type "$vif" wps_device_type "6-0050F204-1"
  12820. - config_get device_name "$vif" wps_device_name "OpenWrt AP"
  12821. - config_get manufacturer "$vif" wps_manufacturer "openwrt.org"
  12822. - config_get wps_pin "$vif" wps_pin
  12823. -
  12824. - config_get_bool ext_registrar "$vif" ext_registrar 0
  12825. - [ "$ext_registrar" -gt 0 -a -n "$bridge" ] && append "$var" "upnp_iface=$bridge" "$N"
  12826. -
  12827. - append "$var" "eap_server=1" "$N"
  12828. - [ -n "$wps_pin" ] && append "$var" "ap_pin=$wps_pin" "$N"
  12829. - append "$var" "wps_state=${wps_not_configured:-2}" "$N"
  12830. - append "$var" "ap_setup_locked=0" "$N"
  12831. - append "$var" "device_type=$device_type" "$N"
  12832. - append "$var" "device_name=$device_name" "$N"
  12833. - append "$var" "manufacturer=$manufacturer" "$N"
  12834. - append "$var" "config_methods=$config_methods" "$N"
  12835. - }
  12836. -
  12837. - append "$var" "ssid=$ssid" "$N"
  12838. - [ -n "$bridge" ] && append "$var" "bridge=$bridge" "$N"
  12839. - [ -n "$ieee80211d" ] && append "$var" "ieee80211d=$ieee80211d" "$N"
  12840. - [ -n "$iapp_interface" ] && append "$var" iapp_interface=$(uci_get_state network "$iapp_interface" ifname "$iapp_interface") "$N"
  12841. -
  12842. - if [ "$wpa" -ge "1" ]
  12843. - then
  12844. - config_get nasid "$vif" nasid
  12845. - [ -n "$nasid" ] && append "$var" "nas_identifier=$nasid" "$N"
  12846. -
  12847. - config_get_bool ieee80211r "$vif" ieee80211r 0
  12848. - if [ "$ieee80211r" -gt 0 ]
  12849. - then
  12850. - config_get mobility_domain "$vif" mobility_domain "4f57"
  12851. - config_get r0_key_lifetime "$vif" r0_key_lifetime "10000"
  12852. - config_get r1_key_holder "$vif" r1_key_holder "00004f577274"
  12853. - config_get reassociation_deadline "$vif" reassociation_deadline "1000"
  12854. - config_get r0kh "$vif" r0kh
  12855. - config_get r1kh "$vif" r1kh
  12856. - config_get_bool pmk_r1_push "$vif" pmk_r1_push 0
  12857. -
  12858. - append "$var" "mobility_domain=$mobility_domain" "$N"
  12859. - append "$var" "r0_key_lifetime=$r0_key_lifetime" "$N"
  12860. - append "$var" "r1_key_holder=$r1_key_holder" "$N"
  12861. - append "$var" "reassociation_deadline=$reassociation_deadline" "$N"
  12862. - append "$var" "pmk_r1_push=$pmk_r1_push" "$N"
  12863. -
  12864. - for kh in $r0kh; do
  12865. - "$var" "r0kh=${kh//,/ }" "$N"
  12866. - done
  12867. - for kh in $r1kh; do
  12868. - "$var" "r1kh=${kh//,/ }" "$N"
  12869. - done
  12870. -
  12871. - [ "$wpa_key_mgmt" != "${wpa_key_mgmt/EAP/}" ] && append wpa_key_mgmt "FT-EAP"
  12872. - [ "$wpa_key_mgmt" != "${wpa_key_mgmt/PSK/}" ] && append wpa_key_mgmt "FT-PSK"
  12873. - fi
  12874. -
  12875. - [ -n "wpa_key_mgmt" ] && append "$var" "wpa_key_mgmt=$wpa_key_mgmt"
  12876. - fi
  12877. -
  12878. - if [ "$wpa" -ge "2" ]
  12879. - then
  12880. - # RSN -> allow preauthentication. You have two
  12881. - # options, rsn_preauth for production or rsn_preauth_testing
  12882. - # for validation / testing.
  12883. - if [ -n "$bridge" -a "$rsn_preauth" = 1 ]
  12884. - then
  12885. - append "$var" "rsn_preauth=1" "$N"
  12886. - append "$var" "rsn_preauth_interfaces=$bridge" "$N"
  12887. - append "$var" "okc=1" "$N"
  12888. - else
  12889. - # RSN preauthentication testings hould disable
  12890. - # Opportunistic Key Caching (okc) as otherwise the PMKSA
  12891. - # entry for a test could come from the Opportunistic Key Caching
  12892. - config_get rsn_preauth_testing "$vif" rsn_preauth_testing
  12893. - if [ -n "$bridge" -a "$rsn_preauth_testing" = 1 ]
  12894. - then
  12895. - append "$var" "rsn_preauth=1" "$N"
  12896. - append "$var" "rsn_preauth_interfaces=$bridge" "$N"
  12897. - append "$var" "okc=0" "$N"
  12898. - fi
  12899. - fi
  12900. -
  12901. - # RSN -> allow management frame protection
  12902. - config_get ieee80211w "$vif" ieee80211w
  12903. - case "$ieee80211w" in
  12904. - [012])
  12905. - append "$var" "ieee80211w=$ieee80211w" "$N"
  12906. - [ "$ieee80211w" -gt "0" ] && {
  12907. - config_get ieee80211w_max_timeout "$vif" ieee80211w_max_timeout
  12908. - config_get ieee80211w_retry_timeout "$vif" ieee80211w_retry_timeout
  12909. - [ -n "$ieee80211w_max_timeout" ] && \
  12910. - append "$var" "assoc_sa_query_max_timeout=$ieee80211w_max_timeout" "$N"
  12911. - [ -n "$ieee80211w_retry_timeout" ] && \
  12912. - append "$var" "assoc_sa_query_retry_timeout=$ieee80211w_retry_timeout" "$N"
  12913. - }
  12914. - ;;
  12915. - esac
  12916. - fi
  12917. -
  12918. - config_get macfile "$vif" macfile
  12919. - config_get maclist "$vif" maclist
  12920. - if [ -z "$macfile" ]
  12921. - then
  12922. - # if no macfile has been specified, fallback to the default name
  12923. - # and truncate file to avoid aggregating entries over time
  12924. - macfile="/var/run/hostapd-$ifname.maclist"
  12925. - echo "" > "$macfile"
  12926. - else
  12927. - if [ -n "$maclist" ]
  12928. - then
  12929. - # to avoid to overwrite the original file, make a copy
  12930. - # before appending the entries specified by the maclist
  12931. - # option
  12932. - cp $macfile $macfile.maclist
  12933. - macfile=$macfile.maclist
  12934. - fi
  12935. - fi
  12936. -
  12937. - if [ -n "$maclist" ]
  12938. - then
  12939. - for mac in $maclist; do
  12940. - echo "$mac" >> $macfile
  12941. - done
  12942. - fi
  12943. -
  12944. - config_get macfilter "$vif" macfilter
  12945. - case "$macfilter" in
  12946. - allow)
  12947. - append "$var" "macaddr_acl=1" "$N"
  12948. - append "$var" "accept_mac_file=$macfile" "$N"
  12949. - ;;
  12950. - deny)
  12951. - append "$var" "macaddr_acl=0" "$N"
  12952. - append "$var" "deny_mac_file=$macfile" "$N"
  12953. - ;;
  12954. - esac
  12955. -}
  12956. -
  12957. -hostapd_set_log_options() {
  12958. - local var="$1"
  12959. - local cfg="$2"
  12960. - local log_level log_80211 log_8021x log_radius log_wpa log_driver log_iapp log_mlme
  12961. -
  12962. - config_get log_level "$cfg" log_level 2
  12963. -
  12964. - config_get_bool log_80211 "$cfg" log_80211 1
  12965. - config_get_bool log_8021x "$cfg" log_8021x 1
  12966. - config_get_bool log_radius "$cfg" log_radius 1
  12967. - config_get_bool log_wpa "$cfg" log_wpa 1
  12968. - config_get_bool log_driver "$cfg" log_driver 1
  12969. - config_get_bool log_iapp "$cfg" log_iapp 1
  12970. - config_get_bool log_mlme "$cfg" log_mlme 1
  12971. -
  12972. - local log_mask=$(( \
  12973. - ($log_80211 << 0) | \
  12974. - ($log_8021x << 1) | \
  12975. - ($log_radius << 2) | \
  12976. - ($log_wpa << 3) | \
  12977. - ($log_driver << 4) | \
  12978. - ($log_iapp << 5) | \
  12979. - ($log_mlme << 6) \
  12980. - ))
  12981. -
  12982. - append "$var" "logger_syslog=$log_mask" "$N"
  12983. - append "$var" "logger_syslog_level=$log_level" "$N"
  12984. - append "$var" "logger_stdout=$log_mask" "$N"
  12985. - append "$var" "logger_stdout_level=$log_level" "$N"
  12986. -}
  12987. -
  12988. -hostapd_setup_vif() {
  12989. - local vif="$1"
  12990. - local driver="$2"
  12991. - local ifname device channel hwmode
  12992. -
  12993. - hostapd_cfg=
  12994. -
  12995. - config_get ifname "$vif" ifname
  12996. - config_get device "$vif" device
  12997. - config_get channel "$device" channel
  12998. - config_get hwmode "$device" hwmode
  12999. -
  13000. - hostapd_set_log_options hostapd_cfg "$device"
  13001. - hostapd_set_bss_options hostapd_cfg "$vif"
  13002. -
  13003. - case "$hwmode" in
  13004. - *bg|*gdt|*gst|*fh) hwmode=g;;
  13005. - *adt|*ast) hwmode=a;;
  13006. - esac
  13007. - [ "$channel" = auto ] && channel=
  13008. - [ -n "$channel" -a -z "$hwmode" ] && wifi_fixup_hwmode "$device"
  13009. - cat > /var/run/hostapd-$ifname.conf <<EOF
  13010. -driver=$driver
  13011. -interface=$ifname
  13012. -${hwmode:+hw_mode=${hwmode#11}}
  13013. -${channel:+channel=$channel}
  13014. -$hostapd_cfg
  13015. -EOF
  13016. - hostapd -P /var/run/wifi-$ifname.pid -B /var/run/hostapd-$ifname.conf
  13017. -}
  13018. -
  13019. diff --git a/package/network/services/hostapd/files/netifd.sh b/package/network/services/hostapd/files/netifd.sh
  13020. index 23d2e7e..af72e7a 100644
  13021. --- a/package/network/services/hostapd/files/netifd.sh
  13022. +++ b/package/network/services/hostapd/files/netifd.sh
  13023. @@ -1,3 +1,5 @@
  13024. +. /lib/functions/network.sh
  13025. +
  13026. wpa_supplicant_add_rate() {
  13027. local var="$1"
  13028. local val="$(($2 / 1000))"
  13029. @@ -120,6 +122,7 @@ hostapd_common_add_bss_config() {
  13030. config_add_boolean rsn_preauth auth_cache
  13031. config_add_int ieee80211w
  13032. + config_add_int eapol_version
  13033. config_add_string 'auth_server:host' 'server:host'
  13034. config_add_string auth_secret
  13035. @@ -136,10 +139,11 @@ hostapd_common_add_bss_config() {
  13036. config_add_string nasid
  13037. config_add_string ownip
  13038. config_add_string iapp_interface
  13039. - config_add_string eap_type ca_cert client_cert identity auth priv_key priv_key_pwd
  13040. + config_add_string eap_type ca_cert client_cert identity anonymous_identity auth priv_key priv_key_pwd
  13041. config_add_int dynamic_vlan vlan_naming
  13042. config_add_string vlan_tagged_interface vlan_bridge
  13043. + config_add_string vlan_file
  13044. config_add_string 'key1:wepkey' 'key2:wepkey' 'key3:wepkey' 'key4:wepkey' 'password:wpakey'
  13045. @@ -182,7 +186,7 @@ hostapd_set_bss_options() {
  13046. wps_pushbutton wps_label ext_registrar wps_pbc_in_m1 \
  13047. wps_device_type wps_device_name wps_manufacturer wps_pin \
  13048. macfilter ssid wmm uapsd hidden short_preamble rsn_preauth \
  13049. - iapp_interface
  13050. + iapp_interface eapol_version
  13051. set_default isolate 0
  13052. set_default maxassoc 0
  13053. @@ -192,6 +196,7 @@ hostapd_set_bss_options() {
  13054. set_default hidden 0
  13055. set_default wmm 1
  13056. set_default uapsd 1
  13057. + set_default eapol_version 0
  13058. append bss_conf "ctrl_interface=/var/run/hostapd"
  13059. if [ "$isolate" -gt 0 ]; then
  13060. @@ -237,6 +242,8 @@ hostapd_set_bss_options() {
  13061. [ -e "$wpa_psk_file" ] || touch "$wpa_psk_file"
  13062. append bss_conf "wpa_psk_file=$wpa_psk_file" "$N"
  13063. }
  13064. + [ "$eapol_version" -ge "1" -a "$eapol_version" -le "2" ] && append bss_conf "eapol_version=$eapol_version" "$N"
  13065. +
  13066. wps_possible=1
  13067. append wpa_key_mgmt "WPA-PSK"
  13068. ;;
  13069. @@ -248,7 +255,7 @@ hostapd_set_bss_options() {
  13070. ownip \
  13071. eap_reauth_period dynamic_vlan \
  13072. vlan_naming vlan_tagged_interface \
  13073. - vlan_bridge
  13074. + vlan_bridge vlan_file
  13075. # legacy compatibility
  13076. [ -n "$auth_server" ] || json_get_var auth_server server
  13077. @@ -291,7 +298,13 @@ hostapd_set_bss_options() {
  13078. append bss_conf "vlan_bridge=$vlan_bridge" "$N"
  13079. [ -n "$vlan_tagged_interface" ] && \
  13080. append bss_conf "vlan_tagged_interface=$vlan_tagged_interface" "$N"
  13081. + [ -n "$vlan_file" ] && {
  13082. + [ -e "$vlan_file" ] || touch "$vlan_file"
  13083. + append bss_conf "vlan_file=$vlan_file" "$N"
  13084. + }
  13085. }
  13086. +
  13087. + [ "$eapol_version" -ge "1" -a "$eapol_version" -le "2" ] && append bss_conf "eapol_version=$eapol_version" "$N"
  13088. ;;
  13089. wep)
  13090. local wep_keyidx=0
  13091. @@ -318,8 +331,8 @@ hostapd_set_bss_options() {
  13092. [ -n "$wps_possible" -a -n "$config_methods" ] && {
  13093. set_default ext_registrar 0
  13094. set_default wps_device_type "6-0050F204-1"
  13095. - set_default wps_device_name "OpenWrt AP"
  13096. - set_default wps_manufacturer "openwrt.org"
  13097. + set_default wps_device_name "Lede AP"
  13098. + set_default wps_manufacturer "www.lede-project.org"
  13099. wps_state=2
  13100. [ -n "$wps_configured" ] && wps_state=1
  13101. @@ -340,8 +353,9 @@ hostapd_set_bss_options() {
  13102. append bss_conf "ssid=$ssid" "$N"
  13103. [ -n "$network_bridge" ] && append bss_conf "bridge=$network_bridge" "$N"
  13104. [ -n "$iapp_interface" ] && {
  13105. - iapp_interface="$(uci_get_state network "$iapp_interface" ifname "$iapp_interface")"
  13106. - [ -n "$iapp_interface" ] && append bss_conf "iapp_interface=$iapp_interface" "$N"
  13107. + local ifname
  13108. + network_get_device ifname "$iapp_interface" || ifname = "$iapp_interface"
  13109. + append bss_conf "iapp_interface=$ifname" "$N"
  13110. }
  13111. if [ "$wpa" -ge "1" ]; then
  13112. @@ -522,9 +536,15 @@ wpa_supplicant_prepare_interface() {
  13113. _w_modestr="mode=1"
  13114. }
  13115. + local country_str=
  13116. + [ -n "$country" ] && {
  13117. + country_str="country=$country"
  13118. + }
  13119. +
  13120. wpa_supplicant_teardown_interface "$ifname"
  13121. cat > "$_config" <<EOF
  13122. $ap_scan
  13123. +$country_str
  13124. EOF
  13125. return 0
  13126. }
  13127. @@ -538,7 +558,9 @@ wpa_supplicant_add_network() {
  13128. json_get_vars \
  13129. ssid bssid key \
  13130. basic_rate mcast_rate \
  13131. - ieee80211w
  13132. + ieee80211w ieee80211r
  13133. +
  13134. + set_default ieee80211r 0
  13135. local key_mgmt='NONE'
  13136. local enc_str=
  13137. @@ -549,6 +571,8 @@ wpa_supplicant_add_network() {
  13138. local scan_ssid="scan_ssid=1"
  13139. local freq
  13140. + [ "$ieee80211r" -gt 0 ] && wpa_key_mgmt="FT-PSK $wpa_key_mgmt"
  13141. +
  13142. [[ "$_w_mode" = "adhoc" ]] && {
  13143. append network_data "mode=1" "$N$T"
  13144. [ -n "$channel" ] && {
  13145. @@ -563,6 +587,9 @@ wpa_supplicant_add_network() {
  13146. }
  13147. [[ "$_w_mode" = "mesh" ]] && {
  13148. + json_get_vars mesh_id
  13149. + ssid="${mesh_id}"
  13150. +
  13151. append network_data "mode=5" "$N$T"
  13152. [ -n "$channel" ] && {
  13153. freq="$(get_freq "$phy" "$channel")"
  13154. @@ -594,10 +621,12 @@ wpa_supplicant_add_network() {
  13155. ;;
  13156. eap)
  13157. key_mgmt='WPA-EAP'
  13158. + [ "$ieee80211r" -gt 0 ] && key_mgmt="FT-EAP $key_mgmt"
  13159. - json_get_vars eap_type identity ca_cert
  13160. + json_get_vars eap_type identity anonymous_identity ca_cert
  13161. [ -n "$ca_cert" ] && append network_data "ca_cert=\"$ca_cert\"" "$N$T"
  13162. [ -n "$identity" ] && append network_data "identity=\"$identity\"" "$N$T"
  13163. + [ -n "$anonymous_identity" ] && append network_data "anonymous_identity=\"$anonymous_identity\"" "$N$T"
  13164. case "$eap_type" in
  13165. tls)
  13166. json_get_vars client_cert priv_key priv_key_pwd
  13167. @@ -605,11 +634,32 @@ wpa_supplicant_add_network() {
  13168. append network_data "private_key=\"$priv_key\"" "$N$T"
  13169. append network_data "private_key_passwd=\"$priv_key_pwd\"" "$N$T"
  13170. ;;
  13171. - peap|ttls)
  13172. - json_get_vars auth password
  13173. + fast|peap|ttls)
  13174. + json_get_vars auth password ca_cert2 client_cert2 priv_key2 priv_key2_pwd
  13175. set_default auth MSCHAPV2
  13176. - append network_data "phase2=\"$auth\"" "$N$T"
  13177. - append network_data "password=\"$password\"" "$N$T"
  13178. +
  13179. + if [ "$auth" = "EAP-TLS" ]; then
  13180. + [ -n "$ca_cert2" ] &&
  13181. + append network_data "ca_cert2=\"$ca_cert2\"" "$N$T"
  13182. + append network_data "client_cert2=\"$client_cert2\"" "$N$T"
  13183. + append network_data "private_key2=\"$priv_key2\"" "$N$T"
  13184. + append network_data "private_key2_passwd=\"$priv_key2_pwd\"" "$N$T"
  13185. + else
  13186. + append network_data "password=\"$password\"" "$N$T"
  13187. + fi
  13188. +
  13189. + phase2proto="auth="
  13190. + case "$auth" in
  13191. + "auth"*)
  13192. + phase2proto=""
  13193. + ;;
  13194. + "EAP-"*)
  13195. + auth="$(echo $auth | cut -b 5- )"
  13196. + [ "$eap_type" = "ttls" ] &&
  13197. + phase2proto="autheap="
  13198. + ;;
  13199. + esac
  13200. + append network_data "phase2=\"$phase2proto$auth\"" "$N$T"
  13201. ;;
  13202. esac
  13203. append network_data "eap=$(echo $eap_type | tr 'a-z' 'A-Z')" "$N$T"
  13204. diff --git a/package/network/services/hostapd/files/wpa_supplicant-full.config b/package/network/services/hostapd/files/wpa_supplicant-full.config
  13205. index a9d04ab..18c3f9a 100644
  13206. --- a/package/network/services/hostapd/files/wpa_supplicant-full.config
  13207. +++ b/package/network/services/hostapd/files/wpa_supplicant-full.config
  13208. @@ -41,7 +41,7 @@
  13209. # Driver interface for Host AP driver
  13210. -CONFIG_DRIVER_HOSTAP=y
  13211. +#CONFIG_DRIVER_HOSTAP=y
  13212. # Driver interface for Agere driver
  13213. #CONFIG_DRIVER_HERMES=y
  13214. @@ -121,6 +121,9 @@ CONFIG_DRIVER_WIRED=y
  13215. # included)
  13216. CONFIG_IEEE8021X_EAPOL=y
  13217. +# EAP-FAST
  13218. +CONFIG_EAP_FAST=y
  13219. +
  13220. # EAP-MD5
  13221. CONFIG_EAP_MD5=y
  13222. @@ -367,7 +370,7 @@ CONFIG_INTERNAL_LIBTOMMATH_FAST=y
  13223. #CONFIG_DYNAMIC_EAP_METHODS=y
  13224. # IEEE Std 802.11r-2008 (Fast BSS Transition)
  13225. -#CONFIG_IEEE80211R=y
  13226. +CONFIG_IEEE80211R=y
  13227. # Add support for writing debug log to a file (/tmp/wpa_supplicant-log-#.txt)
  13228. #CONFIG_DEBUG_FILE=y
  13229. diff --git a/package/network/services/hostapd/files/wpa_supplicant-mesh.config b/package/network/services/hostapd/files/wpa_supplicant-mesh.config
  13230. deleted file mode 100644
  13231. index 36e2908..0000000
  13232. --- a/package/network/services/hostapd/files/wpa_supplicant-mesh.config
  13233. +++ /dev/null
  13234. @@ -1,407 +0,0 @@
  13235. -# Example wpa_supplicant build time configuration
  13236. -#
  13237. -# This file lists the configuration options that are used when building the
  13238. -# hostapd binary. All lines starting with # are ignored. Configuration option
  13239. -# lines must be commented out complete, if they are not to be included, i.e.,
  13240. -# just setting VARIABLE=n is not disabling that variable.
  13241. -#
  13242. -# This file is included in Makefile, so variables like CFLAGS and LIBS can also
  13243. -# be modified from here. In most cases, these lines should use += in order not
  13244. -# to override previous values of the variables.
  13245. -
  13246. -
  13247. -# Uncomment following two lines and fix the paths if you have installed OpenSSL
  13248. -# or GnuTLS in non-default location
  13249. -#CFLAGS += -I/usr/local/openssl/include
  13250. -#LIBS += -L/usr/local/openssl/lib
  13251. -
  13252. -# Some Red Hat versions seem to include kerberos header files from OpenSSL, but
  13253. -# the kerberos files are not in the default include path. Following line can be
  13254. -# used to fix build issues on such systems (krb5.h not found).
  13255. -#CFLAGS += -I/usr/include/kerberos
  13256. -
  13257. -# Example configuration for various cross-compilation platforms
  13258. -
  13259. -#### sveasoft (e.g., for Linksys WRT54G) ######################################
  13260. -#CC=mipsel-uclibc-gcc
  13261. -#CC=/opt/brcm/hndtools-mipsel-uclibc/bin/mipsel-uclibc-gcc
  13262. -#CFLAGS += -Os
  13263. -#CPPFLAGS += -I../src/include -I../../src/router/openssl/include
  13264. -#LIBS += -L/opt/brcm/hndtools-mipsel-uclibc-0.9.19/lib -lssl
  13265. -###############################################################################
  13266. -
  13267. -#### openwrt (e.g., for Linksys WRT54G) #######################################
  13268. -#CC=mipsel-uclibc-gcc
  13269. -#CC=/opt/brcm/hndtools-mipsel-uclibc/bin/mipsel-uclibc-gcc
  13270. -#CFLAGS += -Os
  13271. -#CPPFLAGS=-I../src/include -I../openssl-0.9.7d/include \
  13272. -# -I../WRT54GS/release/src/include
  13273. -#LIBS = -lssl
  13274. -###############################################################################
  13275. -
  13276. -
  13277. -# Driver interface for Host AP driver
  13278. -CONFIG_DRIVER_HOSTAP=y
  13279. -
  13280. -# Driver interface for Agere driver
  13281. -#CONFIG_DRIVER_HERMES=y
  13282. -# Change include directories to match with the local setup
  13283. -#CFLAGS += -I../../hcf -I../../include -I../../include/hcf
  13284. -#CFLAGS += -I../../include/wireless
  13285. -
  13286. -# Driver interface for ndiswrapper
  13287. -# Deprecated; use CONFIG_DRIVER_WEXT=y instead.
  13288. -#CONFIG_DRIVER_NDISWRAPPER=y
  13289. -
  13290. -# Driver interface for Atmel driver
  13291. -# CONFIG_DRIVER_ATMEL=y
  13292. -
  13293. -# Driver interface for old Broadcom driver
  13294. -# Please note that the newer Broadcom driver ("hybrid Linux driver") supports
  13295. -# Linux wireless extensions and does not need (or even work) with the old
  13296. -# driver wrapper. Use CONFIG_DRIVER_WEXT=y with that driver.
  13297. -#CONFIG_DRIVER_BROADCOM=y
  13298. -# Example path for wlioctl.h; change to match your configuration
  13299. -#CFLAGS += -I/opt/WRT54GS/release/src/include
  13300. -
  13301. -# Driver interface for Intel ipw2100/2200 driver
  13302. -# Deprecated; use CONFIG_DRIVER_WEXT=y instead.
  13303. -#CONFIG_DRIVER_IPW=y
  13304. -
  13305. -# Driver interface for Ralink driver
  13306. -#CONFIG_DRIVER_RALINK=y
  13307. -
  13308. -# Driver interface for generic Linux wireless extensions
  13309. -CONFIG_DRIVER_WEXT=y
  13310. -
  13311. -# Driver interface for Linux drivers using the nl80211 kernel interface
  13312. -CONFIG_DRIVER_NL80211=y
  13313. -
  13314. -# Driver interface for FreeBSD net80211 layer (e.g., Atheros driver)
  13315. -#CONFIG_DRIVER_BSD=y
  13316. -#CFLAGS += -I/usr/local/include
  13317. -#LIBS += -L/usr/local/lib
  13318. -#LIBS_p += -L/usr/local/lib
  13319. -#LIBS_c += -L/usr/local/lib
  13320. -
  13321. -# Driver interface for Windows NDIS
  13322. -#CONFIG_DRIVER_NDIS=y
  13323. -#CFLAGS += -I/usr/include/w32api/ddk
  13324. -#LIBS += -L/usr/local/lib
  13325. -# For native build using mingw
  13326. -#CONFIG_NATIVE_WINDOWS=y
  13327. -# Additional directories for cross-compilation on Linux host for mingw target
  13328. -#CFLAGS += -I/opt/mingw/mingw32/include/ddk
  13329. -#LIBS += -L/opt/mingw/mingw32/lib
  13330. -#CC=mingw32-gcc
  13331. -# By default, driver_ndis uses WinPcap for low-level operations. This can be
  13332. -# replaced with the following option which replaces WinPcap calls with NDISUIO.
  13333. -# However, this requires that WZC is disabled (net stop wzcsvc) before starting
  13334. -# wpa_supplicant.
  13335. -# CONFIG_USE_NDISUIO=y
  13336. -
  13337. -# Driver interface for development testing
  13338. -#CONFIG_DRIVER_TEST=y
  13339. -
  13340. -# Include client MLME (management frame processing) for test driver
  13341. -# This can be used to test MLME operations in hostapd with the test interface.
  13342. -# space.
  13343. -#CONFIG_CLIENT_MLME=y
  13344. -
  13345. -# Driver interface for wired Ethernet drivers
  13346. -CONFIG_DRIVER_WIRED=y
  13347. -
  13348. -# Driver interface for the Broadcom RoboSwitch family
  13349. -#CONFIG_DRIVER_ROBOSWITCH=y
  13350. -
  13351. -# Driver interface for no driver (e.g., WPS ER only)
  13352. -#CONFIG_DRIVER_NONE=y
  13353. -
  13354. -# Enable IEEE 802.1X Supplicant (automatically included if any EAP method is
  13355. -# included)
  13356. -CONFIG_IEEE8021X_EAPOL=y
  13357. -
  13358. -# EAP-MD5
  13359. -CONFIG_EAP_MD5=y
  13360. -
  13361. -# EAP-MSCHAPv2
  13362. -CONFIG_EAP_MSCHAPV2=y
  13363. -
  13364. -# EAP-TLS
  13365. -CONFIG_EAP_TLS=y
  13366. -
  13367. -# EAL-PEAP
  13368. -CONFIG_EAP_PEAP=y
  13369. -
  13370. -# EAP-TTLS
  13371. -CONFIG_EAP_TTLS=y
  13372. -
  13373. -# EAP-FAST
  13374. -# Note: Default OpenSSL package does not include support for all the
  13375. -# functionality needed for EAP-FAST. If EAP-FAST is enabled with OpenSSL,
  13376. -# the OpenSSL library must be patched (openssl-0.9.8d-tls-extensions.patch)
  13377. -# to add the needed functions.
  13378. -#CONFIG_EAP_FAST=y
  13379. -
  13380. -# EAP-GTC
  13381. -CONFIG_EAP_GTC=y
  13382. -
  13383. -# EAP-OTP
  13384. -CONFIG_EAP_OTP=y
  13385. -
  13386. -# EAP-SIM (enable CONFIG_PCSC, if EAP-SIM is used)
  13387. -#CONFIG_EAP_SIM=y
  13388. -
  13389. -# EAP-PSK (experimental; this is _not_ needed for WPA-PSK)
  13390. -#CONFIG_EAP_PSK=y
  13391. -
  13392. -# EAP-PAX
  13393. -#CONFIG_EAP_PAX=y
  13394. -
  13395. -# LEAP
  13396. -CONFIG_EAP_LEAP=y
  13397. -
  13398. -# EAP-AKA (enable CONFIG_PCSC, if EAP-AKA is used)
  13399. -#CONFIG_EAP_AKA=y
  13400. -
  13401. -# EAP-AKA' (enable CONFIG_PCSC, if EAP-AKA' is used).
  13402. -# This requires CONFIG_EAP_AKA to be enabled, too.
  13403. -#CONFIG_EAP_AKA_PRIME=y
  13404. -
  13405. -# Enable USIM simulator (Milenage) for EAP-AKA
  13406. -#CONFIG_USIM_SIMULATOR=y
  13407. -
  13408. -# EAP-SAKE
  13409. -#CONFIG_EAP_SAKE=y
  13410. -
  13411. -# EAP-GPSK
  13412. -#CONFIG_EAP_GPSK=y
  13413. -# Include support for optional SHA256 cipher suite in EAP-GPSK
  13414. -#CONFIG_EAP_GPSK_SHA256=y
  13415. -
  13416. -# EAP-TNC and related Trusted Network Connect support (experimental)
  13417. -#CONFIG_EAP_TNC=y
  13418. -
  13419. -# Wi-Fi Protected Setup (WPS)
  13420. -CONFIG_WPS=y
  13421. -
  13422. -# EAP-IKEv2
  13423. -#CONFIG_EAP_IKEV2=y
  13424. -
  13425. -# PKCS#12 (PFX) support (used to read private key and certificate file from
  13426. -# a file that usually has extension .p12 or .pfx)
  13427. -CONFIG_PKCS12=y
  13428. -
  13429. -# Smartcard support (i.e., private key on a smartcard), e.g., with openssl
  13430. -# engine.
  13431. -CONFIG_SMARTCARD=y
  13432. -
  13433. -# PC/SC interface for smartcards (USIM, GSM SIM)
  13434. -# Enable this if EAP-SIM or EAP-AKA is included
  13435. -#CONFIG_PCSC=y
  13436. -
  13437. -# Development testing
  13438. -#CONFIG_EAPOL_TEST=y
  13439. -
  13440. -# Select control interface backend for external programs, e.g, wpa_cli:
  13441. -# unix = UNIX domain sockets (default for Linux/*BSD)
  13442. -# udp = UDP sockets using localhost (127.0.0.1)
  13443. -# named_pipe = Windows Named Pipe (default for Windows)
  13444. -# y = use default (backwards compatibility)
  13445. -# If this option is commented out, control interface is not included in the
  13446. -# build.
  13447. -CONFIG_CTRL_IFACE=y
  13448. -
  13449. -# Include support for GNU Readline and History Libraries in wpa_cli.
  13450. -# When building a wpa_cli binary for distribution, please note that these
  13451. -# libraries are licensed under GPL and as such, BSD license may not apply for
  13452. -# the resulting binary.
  13453. -#CONFIG_READLINE=y
  13454. -
  13455. -# Remove debugging code that is printing out debug message to stdout.
  13456. -# This can be used to reduce the size of the wpa_supplicant considerably
  13457. -# if debugging code is not needed. The size reduction can be around 35%
  13458. -# (e.g., 90 kB).
  13459. -#CONFIG_NO_STDOUT_DEBUG=y
  13460. -
  13461. -# Remove WPA support, e.g., for wired-only IEEE 802.1X supplicant, to save
  13462. -# 35-50 kB in code size.
  13463. -#CONFIG_NO_WPA=y
  13464. -
  13465. -# Remove WPA2 support. This allows WPA to be used, but removes WPA2 code to
  13466. -# save about 1 kB in code size when building only WPA-Personal (no EAP support)
  13467. -# or 6 kB if building for WPA-Enterprise.
  13468. -#CONFIG_NO_WPA2=y
  13469. -
  13470. -# Remove IEEE 802.11i/WPA-Personal ASCII passphrase support
  13471. -# This option can be used to reduce code size by removing support for
  13472. -# converting ASCII passphrases into PSK. If this functionality is removed, the
  13473. -# PSK can only be configured as the 64-octet hexstring (e.g., from
  13474. -# wpa_passphrase). This saves about 0.5 kB in code size.
  13475. -#CONFIG_NO_WPA_PASSPHRASE=y
  13476. -
  13477. -# Disable scan result processing (ap_mode=1) to save code size by about 1 kB.
  13478. -# This can be used if ap_scan=1 mode is never enabled.
  13479. -#CONFIG_NO_SCAN_PROCESSING=y
  13480. -
  13481. -# Select configuration backend:
  13482. -# file = text file (e.g., wpa_supplicant.conf; note: the configuration file
  13483. -# path is given on command line, not here; this option is just used to
  13484. -# select the backend that allows configuration files to be used)
  13485. -# winreg = Windows registry (see win_example.reg for an example)
  13486. -CONFIG_BACKEND=file
  13487. -
  13488. -# Remove configuration write functionality (i.e., to allow the configuration
  13489. -# file to be updated based on runtime configuration changes). The runtime
  13490. -# configuration can still be changed, the changes are just not going to be
  13491. -# persistent over restarts. This option can be used to reduce code size by
  13492. -# about 3.5 kB.
  13493. -#CONFIG_NO_CONFIG_WRITE=y
  13494. -
  13495. -# Remove support for configuration blobs to reduce code size by about 1.5 kB.
  13496. -#CONFIG_NO_CONFIG_BLOBS=y
  13497. -
  13498. -# Select program entry point implementation:
  13499. -# main = UNIX/POSIX like main() function (default)
  13500. -# main_winsvc = Windows service (read parameters from registry)
  13501. -# main_none = Very basic example (development use only)
  13502. -#CONFIG_MAIN=main
  13503. -
  13504. -# Select wrapper for operatins system and C library specific functions
  13505. -# unix = UNIX/POSIX like systems (default)
  13506. -# win32 = Windows systems
  13507. -# none = Empty template
  13508. -#CONFIG_OS=unix
  13509. -
  13510. -# Select event loop implementation
  13511. -# eloop = select() loop (default)
  13512. -# eloop_win = Windows events and WaitForMultipleObject() loop
  13513. -# eloop_none = Empty template
  13514. -#CONFIG_ELOOP=eloop
  13515. -
  13516. -# Select layer 2 packet implementation
  13517. -# linux = Linux packet socket (default)
  13518. -# pcap = libpcap/libdnet/WinPcap
  13519. -# freebsd = FreeBSD libpcap
  13520. -# winpcap = WinPcap with receive thread
  13521. -# ndis = Windows NDISUIO (note: requires CONFIG_USE_NDISUIO=y)
  13522. -# none = Empty template
  13523. -#CONFIG_L2_PACKET=linux
  13524. -
  13525. -# PeerKey handshake for Station to Station Link (IEEE 802.11e DLS)
  13526. -CONFIG_PEERKEY=y
  13527. -
  13528. -# IEEE 802.11w (management frame protection)
  13529. -# This version is an experimental implementation based on IEEE 802.11w/D1.0
  13530. -# draft and is subject to change since the standard has not yet been finalized.
  13531. -# Driver support is also needed for IEEE 802.11w.
  13532. -CONFIG_IEEE80211W=y
  13533. -
  13534. -# Select TLS implementation
  13535. -# openssl = OpenSSL (default)
  13536. -# gnutls = GnuTLS (needed for TLS/IA, see also CONFIG_GNUTLS_EXTRA)
  13537. -# internal = Internal TLSv1 implementation (experimental)
  13538. -# none = Empty template
  13539. -CONFIG_TLS=internal
  13540. -
  13541. -# Whether to enable TLS/IA support, which is required for EAP-TTLSv1.
  13542. -# You need CONFIG_TLS=gnutls for this to have any effect. Please note that
  13543. -# even though the core GnuTLS library is released under LGPL, this extra
  13544. -# library uses GPL and as such, the terms of GPL apply to the combination
  13545. -# of wpa_supplicant and GnuTLS if this option is enabled. BSD license may not
  13546. -# apply for distribution of the resulting binary.
  13547. -#CONFIG_GNUTLS_EXTRA=y
  13548. -
  13549. -# If CONFIG_TLS=internal is used, additional library and include paths are
  13550. -# needed for LibTomMath. Alternatively, an integrated, minimal version of
  13551. -# LibTomMath can be used. See beginning of libtommath.c for details on benefits
  13552. -# and drawbacks of this option.
  13553. -CONFIG_INTERNAL_LIBTOMMATH=y
  13554. -#ifndef CONFIG_INTERNAL_LIBTOMMATH
  13555. -#LTM_PATH=/usr/src/libtommath-0.39
  13556. -#CFLAGS += -I$(LTM_PATH)
  13557. -#LIBS += -L$(LTM_PATH)
  13558. -#LIBS_p += -L$(LTM_PATH)
  13559. -#endif
  13560. -# At the cost of about 4 kB of additional binary size, the internal LibTomMath
  13561. -# can be configured to include faster routines for exptmod, sqr, and div to
  13562. -# speed up DH and RSA calculation considerably
  13563. -CONFIG_INTERNAL_LIBTOMMATH_FAST=y
  13564. -
  13565. -# Include NDIS event processing through WMI into wpa_supplicant/wpasvc.
  13566. -# This is only for Windows builds and requires WMI-related header files and
  13567. -# WbemUuid.Lib from Platform SDK even when building with MinGW.
  13568. -#CONFIG_NDIS_EVENTS_INTEGRATED=y
  13569. -#PLATFORMSDKLIB="/opt/Program Files/Microsoft Platform SDK/Lib"
  13570. -
  13571. -# Add support for old DBus control interface
  13572. -# (fi.epitest.hostap.WPASupplicant)
  13573. -#CONFIG_CTRL_IFACE_DBUS=y
  13574. -
  13575. -# Add support for new DBus control interface
  13576. -# (fi.w1.hostap.wpa_supplicant1)
  13577. -#CONFIG_CTRL_IFACE_DBUS_NEW=y
  13578. -
  13579. -# Add introspection support for new DBus control interface
  13580. -#CONFIG_CTRL_IFACE_DBUS_INTRO=y
  13581. -
  13582. -# Add support for loading EAP methods dynamically as shared libraries.
  13583. -# When this option is enabled, each EAP method can be either included
  13584. -# statically (CONFIG_EAP_<method>=y) or dynamically (CONFIG_EAP_<method>=dyn).
  13585. -# Dynamic EAP methods are build as shared objects (eap_*.so) and they need to
  13586. -# be loaded in the beginning of the wpa_supplicant configuration file
  13587. -# (see load_dynamic_eap parameter in the example file) before being used in
  13588. -# the network blocks.
  13589. -#
  13590. -# Note that some shared parts of EAP methods are included in the main program
  13591. -# and in order to be able to use dynamic EAP methods using these parts, the
  13592. -# main program must have been build with the EAP method enabled (=y or =dyn).
  13593. -# This means that EAP-TLS/PEAP/TTLS/FAST cannot be added as dynamic libraries
  13594. -# unless at least one of them was included in the main build to force inclusion
  13595. -# of the shared code. Similarly, at least one of EAP-SIM/AKA must be included
  13596. -# in the main build to be able to load these methods dynamically.
  13597. -#
  13598. -# Please also note that using dynamic libraries will increase the total binary
  13599. -# size. Thus, it may not be the best option for targets that have limited
  13600. -# amount of memory/flash.
  13601. -#CONFIG_DYNAMIC_EAP_METHODS=y
  13602. -
  13603. -# IEEE Std 802.11r-2008 (Fast BSS Transition)
  13604. -#CONFIG_IEEE80211R=y
  13605. -
  13606. -# Add support for writing debug log to a file (/tmp/wpa_supplicant-log-#.txt)
  13607. -#CONFIG_DEBUG_FILE=y
  13608. -
  13609. -# Enable privilege separation (see README 'Privilege separation' for details)
  13610. -#CONFIG_PRIVSEP=y
  13611. -
  13612. -# Enable mitigation against certain attacks against TKIP by delaying Michael
  13613. -# MIC error reports by a random amount of time between 0 and 60 seconds
  13614. -#CONFIG_DELAYED_MIC_ERROR_REPORT=y
  13615. -
  13616. -# Enable tracing code for developer debugging
  13617. -# This tracks use of memory allocations and other registrations and reports
  13618. -# incorrect use with a backtrace of call (or allocation) location.
  13619. -#CONFIG_WPA_TRACE=y
  13620. -# For BSD, comment out these.
  13621. -#LIBS += -lexecinfo
  13622. -#LIBS_p += -lexecinfo
  13623. -#LIBS_c += -lexecinfo
  13624. -
  13625. -# Use libbfd to get more details for developer debugging
  13626. -# This enables use of libbfd to get more detailed symbols for the backtraces
  13627. -# generated by CONFIG_WPA_TRACE=y.
  13628. -#CONFIG_WPA_TRACE_BFD=y
  13629. -# For BSD, comment out these.
  13630. -#LIBS += -lbfd -liberty -lz
  13631. -#LIBS_p += -lbfd -liberty -lz
  13632. -#LIBS_c += -lbfd -liberty -lz
  13633. -
  13634. -CONFIG_NO_RANDOM_POOL=y
  13635. -NEED_80211_COMMON=y
  13636. -
  13637. -CONFIG_IBSS_RSN=y
  13638. -
  13639. -CONFIG_MESH=y
  13640. -CONFIG_SAE=y
  13641. -CONFIG_AP=y
  13642. diff --git a/package/network/services/hostapd/files/wpa_supplicant-mini.config b/package/network/services/hostapd/files/wpa_supplicant-mini.config
  13643. index a8d334d..c272153 100644
  13644. --- a/package/network/services/hostapd/files/wpa_supplicant-mini.config
  13645. +++ b/package/network/services/hostapd/files/wpa_supplicant-mini.config
  13646. @@ -41,7 +41,7 @@
  13647. # Driver interface for Host AP driver
  13648. -CONFIG_DRIVER_HOSTAP=y
  13649. +#CONFIG_DRIVER_HOSTAP=y
  13650. # Driver interface for Agere driver
  13651. #CONFIG_DRIVER_HERMES=y
  13652. diff --git a/package/network/services/hostapd/files/wpa_supplicant-p2p.config b/package/network/services/hostapd/files/wpa_supplicant-p2p.config
  13653. index 1c307d0..563dace 100644
  13654. --- a/package/network/services/hostapd/files/wpa_supplicant-p2p.config
  13655. +++ b/package/network/services/hostapd/files/wpa_supplicant-p2p.config
  13656. @@ -41,7 +41,7 @@
  13657. # Driver interface for Host AP driver
  13658. -CONFIG_DRIVER_HOSTAP=y
  13659. +#CONFIG_DRIVER_HOSTAP=y
  13660. # Driver interface for Agere driver
  13661. #CONFIG_DRIVER_HERMES=y
  13662. diff --git a/package/network/services/hostapd/files/wpa_supplicant.sh b/package/network/services/hostapd/files/wpa_supplicant.sh
  13663. deleted file mode 100644
  13664. index b678484..0000000
  13665. --- a/package/network/services/hostapd/files/wpa_supplicant.sh
  13666. +++ /dev/null
  13667. @@ -1,194 +0,0 @@
  13668. -wpa_supplicant_setup_vif() {
  13669. - local vif="$1"
  13670. - local driver="$2"
  13671. - local key="$key"
  13672. - local options="$3"
  13673. - local freq=""
  13674. - local ht="$5"
  13675. - local ap_scan=""
  13676. - local scan_ssid="1"
  13677. - [ -n "$4" ] && freq="frequency=$4"
  13678. -
  13679. - config_get enc "$vif" encryption
  13680. - config_get key "$vif" key
  13681. -
  13682. - local net_cfg bridge
  13683. - config_get bridge "$vif" bridge
  13684. - [ -z "$bridge" ] && {
  13685. - net_cfg="$(find_net_config "$vif")"
  13686. - [ -z "$net_cfg" ] || bridge="$(bridge_interface "$net_cfg")"
  13687. - config_set "$vif" bridge "$bridge"
  13688. - }
  13689. -
  13690. - local mode ifname wds modestr=""
  13691. - config_get mode "$vif" mode
  13692. - config_get ifname "$vif" ifname
  13693. - config_get_bool wds "$vif" wds 0
  13694. - [ -z "$bridge" ] || [ "$mode" = ap ] || [ "$mode" = sta -a $wds -eq 1 ] || {
  13695. - echo "wpa_supplicant_setup_vif($ifname): Refusing to bridge $mode mode interface"
  13696. - return 1
  13697. - }
  13698. - [ "$mode" = "adhoc" ] && {
  13699. - modestr="mode=1"
  13700. - scan_ssid="0"
  13701. - ap_scan="ap_scan=2"
  13702. - }
  13703. -
  13704. - key_mgmt='NONE'
  13705. - case "$enc" in
  13706. - *none*) ;;
  13707. - *wep*)
  13708. - config_get key "$vif" key
  13709. - key="${key:-1}"
  13710. - case "$key" in
  13711. - [1234])
  13712. - for idx in 1 2 3 4; do
  13713. - local zidx
  13714. - zidx=$(($idx - 1))
  13715. - config_get ckey "$vif" "key${idx}"
  13716. - [ -n "$ckey" ] && \
  13717. - append "wep_key${zidx}" "wep_key${zidx}=$(prepare_key_wep "$ckey")"
  13718. - done
  13719. - wep_tx_keyidx="wep_tx_keyidx=$((key - 1))"
  13720. - ;;
  13721. - *)
  13722. - wep_key0="wep_key0=$(prepare_key_wep "$key")"
  13723. - wep_tx_keyidx="wep_tx_keyidx=0"
  13724. - ;;
  13725. - esac
  13726. - ;;
  13727. - *psk*)
  13728. - key_mgmt='WPA-PSK'
  13729. - # if you want to use PSK with a non-nl80211 driver you
  13730. - # have to use WPA-NONE and wext driver for wpa_s
  13731. - [ "$mode" = "adhoc" -a "$driver" != "nl80211" ] && {
  13732. - key_mgmt='WPA-NONE'
  13733. - driver='wext'
  13734. - }
  13735. - if [ ${#key} -eq 64 ]; then
  13736. - passphrase="psk=${key}"
  13737. - else
  13738. - passphrase="psk=\"${key}\""
  13739. - fi
  13740. - case "$enc" in
  13741. - *psk2*)
  13742. - proto='proto=RSN'
  13743. - config_get ieee80211w "$vif" ieee80211w
  13744. - ;;
  13745. - *psk*)
  13746. - proto='proto=WPA'
  13747. - ;;
  13748. - esac
  13749. - ;;
  13750. - *wpa*|*8021x*)
  13751. - proto='proto=WPA2'
  13752. - key_mgmt='WPA-EAP'
  13753. - config_get ieee80211w "$vif" ieee80211w
  13754. - config_get ca_cert "$vif" ca_cert
  13755. - config_get eap_type "$vif" eap_type
  13756. - ca_cert=${ca_cert:+"ca_cert=\"$ca_cert\""}
  13757. - case "$eap_type" in
  13758. - tls)
  13759. - pairwise='pairwise=CCMP'
  13760. - group='group=CCMP'
  13761. - config_get identity "$vif" identity
  13762. - config_get client_cert "$vif" client_cert
  13763. - config_get priv_key "$vif" priv_key
  13764. - config_get priv_key_pwd "$vif" priv_key_pwd
  13765. - identity="identity=\"$identity\""
  13766. - client_cert="client_cert=\"$client_cert\""
  13767. - priv_key="private_key=\"$priv_key\""
  13768. - priv_key_pwd="private_key_passwd=\"$priv_key_pwd\""
  13769. - ;;
  13770. - peap|ttls)
  13771. - config_get auth "$vif" auth
  13772. - config_get identity "$vif" identity
  13773. - config_get password "$vif" password
  13774. - phase2="phase2=\"auth=${auth:-MSCHAPV2}\""
  13775. - identity="identity=\"$identity\""
  13776. - password="${password:+password=\"$password\"}"
  13777. - ;;
  13778. - esac
  13779. - eap_type="eap=$(echo $eap_type | tr 'a-z' 'A-Z')"
  13780. - ;;
  13781. - esac
  13782. -
  13783. - case "$ieee80211w" in
  13784. - [012])
  13785. - ieee80211w="ieee80211w=$ieee80211w"
  13786. - ;;
  13787. - esac
  13788. -
  13789. - local fixed_freq bssid1 beacon_int brates mrate
  13790. - config_get ifname "$vif" ifname
  13791. - config_get bridge "$vif" bridge
  13792. - config_get ssid "$vif" ssid
  13793. - config_get bssid "$vif" bssid
  13794. - bssid1=${bssid:+"bssid=$bssid"}
  13795. - beacon_int=${beacon_int:+"beacon_int=$beacon_int"}
  13796. -
  13797. - local br brval brsub brstr
  13798. - [ -n "$basic_rate_list" ] && {
  13799. - for br in $basic_rate_list; do
  13800. - brval="$(($br / 1000))"
  13801. - brsub="$((($br / 100) % 10))"
  13802. - [ "$brsub" -gt 0 ] && brval="$brval.$brsub"
  13803. - [ -n "$brstr" ] && brstr="$brstr,"
  13804. - brstr="$brstr$brval"
  13805. - done
  13806. - brates=${basic_rate_list:+"rates=$brstr"}
  13807. - }
  13808. -
  13809. - local mcval=""
  13810. - [ -n "$mcast_rate" ] && {
  13811. - mcval="$(($mcast_rate / 1000))"
  13812. - mcsub="$(( ($mcast_rate / 100) % 10 ))"
  13813. - [ "$mcsub" -gt 0 ] && mcval="$mcval.$mcsub"
  13814. - mrate=${mcast_rate:+"mcast_rate=$mcval"}
  13815. - }
  13816. -
  13817. - local ht_str
  13818. - [ -n "$ht" ] && ht_str="htmode=$ht"
  13819. -
  13820. - rm -rf /var/run/wpa_supplicant-$ifname
  13821. - cat > /var/run/wpa_supplicant-$ifname.conf <<EOF
  13822. -ctrl_interface=/var/run/wpa_supplicant-$ifname
  13823. -$ap_scan
  13824. -network={
  13825. - $modestr
  13826. - scan_ssid=$scan_ssid
  13827. - ssid="$ssid"
  13828. - $bssid1
  13829. - key_mgmt=$key_mgmt
  13830. - $proto
  13831. - $freq
  13832. - ${fixed:+"fixed_freq=1"}
  13833. - $beacon_int
  13834. - $brates
  13835. - $mrate
  13836. - $ht_str
  13837. - $ieee80211w
  13838. - $passphrase
  13839. - $pairwise
  13840. - $group
  13841. - $eap_type
  13842. - $ca_cert
  13843. - $client_cert
  13844. - $priv_key
  13845. - $priv_key_pwd
  13846. - $phase2
  13847. - $identity
  13848. - $password
  13849. - $wep_key0
  13850. - $wep_key1
  13851. - $wep_key2
  13852. - $wep_key3
  13853. - $wep_tx_keyidx
  13854. -}
  13855. -EOF
  13856. - if [ -n "$proto" -o "$key_mgmt" = "NONE" ]; then
  13857. - 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
  13858. - else
  13859. - return 0
  13860. - fi
  13861. -}
  13862. 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
  13863. new file mode 100644
  13864. index 0000000..5c8b662
  13865. --- /dev/null
  13866. +++ b/package/network/services/hostapd/patches/001-4addr-fix-reconnecting-client-on-connection-lost.patch
  13867. @@ -0,0 +1,25 @@
  13868. +From: Matthias May <matthias.may@neratec.com>
  13869. +Date: Tue, 5 Jul 2016 15:00:43 +0200
  13870. +Subject: [PATCH] 4addr: fix reconnecting client on connection lost
  13871. +
  13872. +When a 4addr client suddenly looses its connection (no deauth/deassoc)
  13873. +the AP still thinks it is connected.
  13874. +If the client reconnects before the AP timeoutes the client, traffic
  13875. +cannot flow.
  13876. +
  13877. +Fix this by making sure the WLAN_STA_WDS flag is unset in the sta->flags
  13878. +when the client completes association.
  13879. +
  13880. +Signed-off-by: Matthias May <matthias.may@neratec.com>
  13881. +---
  13882. +
  13883. +--- a/src/ap/ieee802_11.c
  13884. ++++ b/src/ap/ieee802_11.c
  13885. +@@ -2826,6 +2826,7 @@ static void handle_assoc_cb(struct hosta
  13886. + new_assoc = 0;
  13887. + sta->flags |= WLAN_STA_ASSOC;
  13888. + sta->flags &= ~WLAN_STA_WNM_SLEEP_MODE;
  13889. ++ sta->flags &= ~WLAN_STA_WDS;
  13890. + if ((!hapd->conf->ieee802_1x && !hapd->conf->wpa && !hapd->conf->osen) ||
  13891. + sta->auth_alg == WLAN_AUTH_FT) {
  13892. + /*
  13893. 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
  13894. deleted file mode 100644
  13895. index e408fbe..0000000
  13896. --- a/package/network/services/hostapd/patches/001-P2P-Validate-SSID-element-length-before-copying-it-C.patch
  13897. +++ /dev/null
  13898. @@ -1,37 +0,0 @@
  13899. -From 9ed4eee345f85e3025c33c6e20aa25696e341ccd Mon Sep 17 00:00:00 2001
  13900. -From: Jouni Malinen <jouni@qca.qualcomm.com>
  13901. -Date: Tue, 7 Apr 2015 11:32:11 +0300
  13902. -Subject: [PATCH] P2P: Validate SSID element length before copying it
  13903. - (CVE-2015-1863)
  13904. -
  13905. -This fixes a possible memcpy overflow for P2P dev->oper_ssid in
  13906. -p2p_add_device(). The length provided by the peer device (0..255 bytes)
  13907. -was used without proper bounds checking and that could have resulted in
  13908. -arbitrary data of up to 223 bytes being written beyond the end of the
  13909. -dev->oper_ssid[] array (of which about 150 bytes would be beyond the
  13910. -heap allocation) when processing a corrupted management frame for P2P
  13911. -peer discovery purposes.
  13912. -
  13913. -This could result in corrupted state in heap, unexpected program
  13914. -behavior due to corrupted P2P peer device information, denial of service
  13915. -due to process crash, exposure of memory contents during GO Negotiation,
  13916. -and potentially arbitrary code execution.
  13917. -
  13918. -Thanks to Google security team for reporting this issue and smart
  13919. -hardware research group of Alibaba security team for discovering it.
  13920. -
  13921. -Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
  13922. ----
  13923. - src/p2p/p2p.c | 1 +
  13924. - 1 file changed, 1 insertion(+)
  13925. -
  13926. ---- a/src/p2p/p2p.c
  13927. -+++ b/src/p2p/p2p.c
  13928. -@@ -778,6 +778,7 @@ int p2p_add_device(struct p2p_data *p2p,
  13929. - if (os_memcmp(addr, p2p_dev_addr, ETH_ALEN) != 0)
  13930. - os_memcpy(dev->interface_addr, addr, ETH_ALEN);
  13931. - if (msg.ssid &&
  13932. -+ msg.ssid[1] <= sizeof(dev->oper_ssid) &&
  13933. - (msg.ssid[1] != P2P_WILDCARD_SSID_LEN ||
  13934. - os_memcmp(msg.ssid + 2, P2P_WILDCARD_SSID, P2P_WILDCARD_SSID_LEN)
  13935. - != 0)) {
  13936. 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
  13937. deleted file mode 100644
  13938. index bc4d60f..0000000
  13939. --- a/package/network/services/hostapd/patches/002-AP-WMM-Fix-integer-underflow-in-WMM-Action-frame-par.patch
  13940. +++ /dev/null
  13941. @@ -1,36 +0,0 @@
  13942. -From ef566a4d4f74022e1fdb0a2addfe81e6de9f4aae Mon Sep 17 00:00:00 2001
  13943. -From: Jouni Malinen <j@w1.fi>
  13944. -Date: Wed, 29 Apr 2015 02:21:53 +0300
  13945. -Subject: [PATCH] AP WMM: Fix integer underflow in WMM Action frame parser
  13946. -
  13947. -The length of the WMM Action frame was not properly validated and the
  13948. -length of the information elements (int left) could end up being
  13949. -negative. This would result in reading significantly past the stack
  13950. -buffer while parsing the IEs in ieee802_11_parse_elems() and while doing
  13951. -so, resulting in segmentation fault.
  13952. -
  13953. -This can result in an invalid frame being used for a denial of service
  13954. -attack (hostapd process killed) against an AP with a driver that uses
  13955. -hostapd for management frame processing (e.g., all mac80211-based
  13956. -drivers).
  13957. -
  13958. -Thanks to Kostya Kortchinsky of Google security team for discovering and
  13959. -reporting this issue.
  13960. -
  13961. -Signed-off-by: Jouni Malinen <j@w1.fi>
  13962. ----
  13963. - src/ap/wmm.c | 3 +++
  13964. - 1 file changed, 3 insertions(+)
  13965. -
  13966. ---- a/src/ap/wmm.c
  13967. -+++ b/src/ap/wmm.c
  13968. -@@ -274,6 +274,9 @@ void hostapd_wmm_action(struct hostapd_d
  13969. - return;
  13970. - }
  13971. -
  13972. -+ if (left < 0)
  13973. -+ return; /* not a valid WMM Action frame */
  13974. -+
  13975. - /* extract the tspec info element */
  13976. - if (ieee802_11_parse_elems(pos, left, &elems, 1) == ParseFailed) {
  13977. - hostapd_logger(hapd, mgmt->sa, HOSTAPD_MODULE_IEEE80211,
  13978. 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
  13979. new file mode 100644
  13980. index 0000000..2439220
  13981. --- /dev/null
  13982. +++ b/package/network/services/hostapd/patches/002-mesh-Set-correct-secondary-channel-offset-if-HT40-is.patch
  13983. @@ -0,0 +1,61 @@
  13984. +From: Masashi Honma <masashi.honma@gmail.com>
  13985. +Date: Tue, 26 Jul 2016 11:45:40 +0900
  13986. +Subject: [PATCH] mesh: Set correct secondary channel offset if HT40 is
  13987. + disabled
  13988. +
  13989. +Previously, secondary channel offset could be non zero even though
  13990. +disable_ht40=1. This patch fixes it.
  13991. +
  13992. +Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
  13993. +---
  13994. +
  13995. +--- a/wpa_supplicant/wpa_supplicant.c
  13996. ++++ b/wpa_supplicant/wpa_supplicant.c
  13997. +@@ -1901,20 +1901,27 @@ void ibss_mesh_setup_freq(struct wpa_sup
  13998. + break;
  13999. + }
  14000. + }
  14001. ++#ifdef CONFIG_HT_OVERRIDES
  14002. ++ if (ssid->disable_ht40)
  14003. ++ ht40 = 0;
  14004. ++#endif /* CONFIG_HT_OVERRIDES */
  14005. +
  14006. +- /* Find secondary channel */
  14007. +- for (i = 0; i < mode->num_channels; i++) {
  14008. +- sec_chan = &mode->channels[i];
  14009. +- if (sec_chan->chan == channel + ht40 * 4)
  14010. +- break;
  14011. +- sec_chan = NULL;
  14012. +- }
  14013. +- if (!sec_chan)
  14014. +- return;
  14015. ++ if (ht40) {
  14016. ++ /* Find secondary channel */
  14017. ++ for (i = 0; i < mode->num_channels; i++) {
  14018. ++ sec_chan = &mode->channels[i];
  14019. ++ if (sec_chan->chan == channel + ht40 * 4)
  14020. ++ break;
  14021. ++ sec_chan = NULL;
  14022. ++ }
  14023. ++ if (!sec_chan)
  14024. ++ return;
  14025. +
  14026. +- /* Check secondary channel flags */
  14027. +- if (sec_chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR))
  14028. +- return;
  14029. ++ /* Check secondary channel flags */
  14030. ++ if (sec_chan->flag &
  14031. ++ (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR))
  14032. ++ return;
  14033. ++ }
  14034. +
  14035. + freq->channel = pri_chan->chan;
  14036. +
  14037. +@@ -1930,6 +1937,7 @@ void ibss_mesh_setup_freq(struct wpa_sup
  14038. + freq->sec_channel_offset = 1;
  14039. + break;
  14040. + default:
  14041. ++ freq->sec_channel_offset = 0;
  14042. + break;
  14043. + }
  14044. +
  14045. 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
  14046. deleted file mode 100644
  14047. index 36b4ca2..0000000
  14048. --- a/package/network/services/hostapd/patches/003-WPS-Fix-HTTP-chunked-transfer-encoding-parser.patch
  14049. +++ /dev/null
  14050. @@ -1,49 +0,0 @@
  14051. -From 5acd23f4581da58683f3cf5e36cb71bbe4070bd7 Mon Sep 17 00:00:00 2001
  14052. -From: Jouni Malinen <j@w1.fi>
  14053. -Date: Tue, 28 Apr 2015 17:08:33 +0300
  14054. -Subject: [PATCH] WPS: Fix HTTP chunked transfer encoding parser
  14055. -
  14056. -strtoul() return value may end up overflowing the int h->chunk_size and
  14057. -resulting in a negative value to be stored as the chunk_size. This could
  14058. -result in the following memcpy operation using a very large length
  14059. -argument which would result in a buffer overflow and segmentation fault.
  14060. -
  14061. -This could have been used to cause a denial service by any device that
  14062. -has been authorized for network access (either wireless or wired). This
  14063. -would affect both the WPS UPnP functionality in a WPS AP (hostapd with
  14064. -upnp_iface parameter set in the configuration) and WPS ER
  14065. -(wpa_supplicant with WPS_ER_START control interface command used).
  14066. -
  14067. -Validate the parsed chunk length value to avoid this. In addition to
  14068. -rejecting negative values, we can also reject chunk size that would be
  14069. -larger than the maximum configured body length.
  14070. -
  14071. -Thanks to Kostya Kortchinsky of Google security team for discovering and
  14072. -reporting this issue.
  14073. -
  14074. -Signed-off-by: Jouni Malinen <j@w1.fi>
  14075. ----
  14076. - src/wps/httpread.c | 7 +++++++
  14077. - 1 file changed, 7 insertions(+)
  14078. -
  14079. -diff --git a/src/wps/httpread.c b/src/wps/httpread.c
  14080. -index 2f08f37..d2855e3 100644
  14081. ---- a/src/wps/httpread.c
  14082. -+++ b/src/wps/httpread.c
  14083. -@@ -533,6 +533,13 @@ static void httpread_read_handler(int sd, void *eloop_ctx, void *sock_ctx)
  14084. - if (!isxdigit(*cbp))
  14085. - goto bad;
  14086. - h->chunk_size = strtoul(cbp, NULL, 16);
  14087. -+ if (h->chunk_size < 0 ||
  14088. -+ h->chunk_size > h->max_bytes) {
  14089. -+ wpa_printf(MSG_DEBUG,
  14090. -+ "httpread: Invalid chunk size %d",
  14091. -+ h->chunk_size);
  14092. -+ goto bad;
  14093. -+ }
  14094. - /* throw away chunk header
  14095. - * so we have only real data
  14096. - */
  14097. ---
  14098. -1.9.1
  14099. -
  14100. 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
  14101. deleted file mode 100644
  14102. index 91627fb..0000000
  14103. --- a/package/network/services/hostapd/patches/004-EAP-pwd-peer-Fix-payload-length-validation-for-Commi.patch
  14104. +++ /dev/null
  14105. @@ -1,73 +0,0 @@
  14106. -From dd2f043c9c43d156494e33d7ce22db96e6ef42c7 Mon Sep 17 00:00:00 2001
  14107. -From: Jouni Malinen <j@w1.fi>
  14108. -Date: Fri, 1 May 2015 16:37:45 +0300
  14109. -Subject: [PATCH 1/5] EAP-pwd peer: Fix payload length validation for Commit
  14110. - and Confirm
  14111. -
  14112. -The length of the received Commit and Confirm message payloads was not
  14113. -checked before reading them. This could result in a buffer read
  14114. -overflow when processing an invalid message.
  14115. -
  14116. -Fix this by verifying that the payload is of expected length before
  14117. -processing it. In addition, enforce correct state transition sequence to
  14118. -make sure there is no unexpected behavior if receiving a Commit/Confirm
  14119. -message before the previous exchanges have been completed.
  14120. -
  14121. -Thanks to Kostya Kortchinsky of Google security team for discovering and
  14122. -reporting this issue.
  14123. -
  14124. -Signed-off-by: Jouni Malinen <j@w1.fi>
  14125. ----
  14126. - src/eap_peer/eap_pwd.c | 29 +++++++++++++++++++++++++++++
  14127. - 1 file changed, 29 insertions(+)
  14128. -
  14129. -diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c
  14130. -index f2b0926..a629437 100644
  14131. ---- a/src/eap_peer/eap_pwd.c
  14132. -+++ b/src/eap_peer/eap_pwd.c
  14133. -@@ -355,6 +355,23 @@ eap_pwd_perform_commit_exchange(struct eap_sm *sm, struct eap_pwd_data *data,
  14134. - BIGNUM *mask = NULL, *x = NULL, *y = NULL, *cofactor = NULL;
  14135. - u16 offset;
  14136. - u8 *ptr, *scalar = NULL, *element = NULL;
  14137. -+ size_t prime_len, order_len;
  14138. -+
  14139. -+ if (data->state != PWD_Commit_Req) {
  14140. -+ ret->ignore = TRUE;
  14141. -+ goto fin;
  14142. -+ }
  14143. -+
  14144. -+ prime_len = BN_num_bytes(data->grp->prime);
  14145. -+ order_len = BN_num_bytes(data->grp->order);
  14146. -+
  14147. -+ if (payload_len != 2 * prime_len + order_len) {
  14148. -+ wpa_printf(MSG_INFO,
  14149. -+ "EAP-pwd: Unexpected Commit payload length %u (expected %u)",
  14150. -+ (unsigned int) payload_len,
  14151. -+ (unsigned int) (2 * prime_len + order_len));
  14152. -+ goto fin;
  14153. -+ }
  14154. -
  14155. - if (((data->private_value = BN_new()) == NULL) ||
  14156. - ((data->my_element = EC_POINT_new(data->grp->group)) == NULL) ||
  14157. -@@ -554,6 +571,18 @@ eap_pwd_perform_confirm_exchange(struct eap_sm *sm, struct eap_pwd_data *data,
  14158. - u8 conf[SHA256_MAC_LEN], *cruft = NULL, *ptr;
  14159. - int offset;
  14160. -
  14161. -+ if (data->state != PWD_Confirm_Req) {
  14162. -+ ret->ignore = TRUE;
  14163. -+ goto fin;
  14164. -+ }
  14165. -+
  14166. -+ if (payload_len != SHA256_MAC_LEN) {
  14167. -+ wpa_printf(MSG_INFO,
  14168. -+ "EAP-pwd: Unexpected Confirm payload length %u (expected %u)",
  14169. -+ (unsigned int) payload_len, SHA256_MAC_LEN);
  14170. -+ goto fin;
  14171. -+ }
  14172. -+
  14173. - /*
  14174. - * first build up the ciphersuite which is group | random_function |
  14175. - * prf
  14176. ---
  14177. -1.9.1
  14178. -
  14179. 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
  14180. deleted file mode 100644
  14181. index 5dca20b..0000000
  14182. --- a/package/network/services/hostapd/patches/005-EAP-pwd-server-Fix-payload-length-validation-for-Com.patch
  14183. +++ /dev/null
  14184. @@ -1,66 +0,0 @@
  14185. -From e28a58be26184c2a23f80b410e0997ef1bd5d578 Mon Sep 17 00:00:00 2001
  14186. -From: Jouni Malinen <j@w1.fi>
  14187. -Date: Fri, 1 May 2015 16:40:44 +0300
  14188. -Subject: [PATCH 2/5] EAP-pwd server: Fix payload length validation for Commit
  14189. - and Confirm
  14190. -
  14191. -The length of the received Commit and Confirm message payloads was not
  14192. -checked before reading them. This could result in a buffer read
  14193. -overflow when processing an invalid message.
  14194. -
  14195. -Fix this by verifying that the payload is of expected length before
  14196. -processing it. In addition, enforce correct state transition sequence to
  14197. -make sure there is no unexpected behavior if receiving a Commit/Confirm
  14198. -message before the previous exchanges have been completed.
  14199. -
  14200. -Thanks to Kostya Kortchinsky of Google security team for discovering and
  14201. -reporting this issue.
  14202. -
  14203. -Signed-off-by: Jouni Malinen <j@w1.fi>
  14204. ----
  14205. - src/eap_server/eap_server_pwd.c | 19 +++++++++++++++++++
  14206. - 1 file changed, 19 insertions(+)
  14207. -
  14208. -diff --git a/src/eap_server/eap_server_pwd.c b/src/eap_server/eap_server_pwd.c
  14209. -index 66bd5d2..3189105 100644
  14210. ---- a/src/eap_server/eap_server_pwd.c
  14211. -+++ b/src/eap_server/eap_server_pwd.c
  14212. -@@ -656,9 +656,21 @@ eap_pwd_process_commit_resp(struct eap_sm *sm, struct eap_pwd_data *data,
  14213. - BIGNUM *x = NULL, *y = NULL, *cofactor = NULL;
  14214. - EC_POINT *K = NULL, *point = NULL;
  14215. - int res = 0;
  14216. -+ size_t prime_len, order_len;
  14217. -
  14218. - wpa_printf(MSG_DEBUG, "EAP-pwd: Received commit response");
  14219. -
  14220. -+ prime_len = BN_num_bytes(data->grp->prime);
  14221. -+ order_len = BN_num_bytes(data->grp->order);
  14222. -+
  14223. -+ if (payload_len != 2 * prime_len + order_len) {
  14224. -+ wpa_printf(MSG_INFO,
  14225. -+ "EAP-pwd: Unexpected Commit payload length %u (expected %u)",
  14226. -+ (unsigned int) payload_len,
  14227. -+ (unsigned int) (2 * prime_len + order_len));
  14228. -+ goto fin;
  14229. -+ }
  14230. -+
  14231. - if (((data->peer_scalar = BN_new()) == NULL) ||
  14232. - ((data->k = BN_new()) == NULL) ||
  14233. - ((cofactor = BN_new()) == NULL) ||
  14234. -@@ -774,6 +786,13 @@ eap_pwd_process_confirm_resp(struct eap_sm *sm, struct eap_pwd_data *data,
  14235. - u8 conf[SHA256_MAC_LEN], *cruft = NULL, *ptr;
  14236. - int offset;
  14237. -
  14238. -+ if (payload_len != SHA256_MAC_LEN) {
  14239. -+ wpa_printf(MSG_INFO,
  14240. -+ "EAP-pwd: Unexpected Confirm payload length %u (expected %u)",
  14241. -+ (unsigned int) payload_len, SHA256_MAC_LEN);
  14242. -+ goto fin;
  14243. -+ }
  14244. -+
  14245. - /* build up the ciphersuite: group | random_function | prf */
  14246. - grp = htons(data->group_num);
  14247. - ptr = (u8 *) &cs;
  14248. ---
  14249. -1.9.1
  14250. -
  14251. 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
  14252. deleted file mode 100644
  14253. index 4d2f9d8..0000000
  14254. --- a/package/network/services/hostapd/patches/006-EAP-pwd-peer-Fix-Total-Length-parsing-for-fragment-r.patch
  14255. +++ /dev/null
  14256. @@ -1,52 +0,0 @@
  14257. -From 477c74395acd0123340457ba6f15ab345d42016e Mon Sep 17 00:00:00 2001
  14258. -From: Jouni Malinen <j@w1.fi>
  14259. -Date: Sat, 2 May 2015 19:23:04 +0300
  14260. -Subject: [PATCH 3/5] EAP-pwd peer: Fix Total-Length parsing for fragment
  14261. - reassembly
  14262. -
  14263. -The remaining number of bytes in the message could be smaller than the
  14264. -Total-Length field size, so the length needs to be explicitly checked
  14265. -prior to reading the field and decrementing the len variable. This could
  14266. -have resulted in the remaining length becoming negative and interpreted
  14267. -as a huge positive integer.
  14268. -
  14269. -In addition, check that there is no already started fragment in progress
  14270. -before allocating a new buffer for reassembling fragments. This avoid a
  14271. -potential memory leak when processing invalid message.
  14272. -
  14273. -Signed-off-by: Jouni Malinen <j@w1.fi>
  14274. ----
  14275. - src/eap_peer/eap_pwd.c | 12 ++++++++++++
  14276. - 1 file changed, 12 insertions(+)
  14277. -
  14278. -diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c
  14279. -index a629437..1d2079b 100644
  14280. ---- a/src/eap_peer/eap_pwd.c
  14281. -+++ b/src/eap_peer/eap_pwd.c
  14282. -@@ -866,11 +866,23 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret,
  14283. - * if it's the first fragment there'll be a length field
  14284. - */
  14285. - if (EAP_PWD_GET_LENGTH_BIT(lm_exch)) {
  14286. -+ if (len < 2) {
  14287. -+ wpa_printf(MSG_DEBUG,
  14288. -+ "EAP-pwd: Frame too short to contain Total-Length field");
  14289. -+ ret->ignore = TRUE;
  14290. -+ return NULL;
  14291. -+ }
  14292. - tot_len = WPA_GET_BE16(pos);
  14293. - wpa_printf(MSG_DEBUG, "EAP-pwd: Incoming fragments whose "
  14294. - "total length = %d", tot_len);
  14295. - if (tot_len > 15000)
  14296. - return NULL;
  14297. -+ if (data->inbuf) {
  14298. -+ wpa_printf(MSG_DEBUG,
  14299. -+ "EAP-pwd: Unexpected new fragment start when previous fragment is still in use");
  14300. -+ ret->ignore = TRUE;
  14301. -+ return NULL;
  14302. -+ }
  14303. - data->inbuf = wpabuf_alloc(tot_len);
  14304. - if (data->inbuf == NULL) {
  14305. - wpa_printf(MSG_INFO, "Out of memory to buffer "
  14306. ---
  14307. -1.9.1
  14308. -
  14309. 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
  14310. deleted file mode 100644
  14311. index 7edef09..0000000
  14312. --- a/package/network/services/hostapd/patches/007-EAP-pwd-server-Fix-Total-Length-parsing-for-fragment.patch
  14313. +++ /dev/null
  14314. @@ -1,50 +0,0 @@
  14315. -From 3035cc2894e08319b905bd6561e8bddc8c2db9fa Mon Sep 17 00:00:00 2001
  14316. -From: Jouni Malinen <j@w1.fi>
  14317. -Date: Sat, 2 May 2015 19:26:06 +0300
  14318. -Subject: [PATCH 4/5] EAP-pwd server: Fix Total-Length parsing for fragment
  14319. - reassembly
  14320. -
  14321. -The remaining number of bytes in the message could be smaller than the
  14322. -Total-Length field size, so the length needs to be explicitly checked
  14323. -prior to reading the field and decrementing the len variable. This could
  14324. -have resulted in the remaining length becoming negative and interpreted
  14325. -as a huge positive integer.
  14326. -
  14327. -In addition, check that there is no already started fragment in progress
  14328. -before allocating a new buffer for reassembling fragments. This avoid a
  14329. -potential memory leak when processing invalid message.
  14330. -
  14331. -Signed-off-by: Jouni Malinen <j@w1.fi>
  14332. ----
  14333. - src/eap_server/eap_server_pwd.c | 10 ++++++++++
  14334. - 1 file changed, 10 insertions(+)
  14335. -
  14336. -diff --git a/src/eap_server/eap_server_pwd.c b/src/eap_server/eap_server_pwd.c
  14337. -index 3189105..2bfc3c2 100644
  14338. ---- a/src/eap_server/eap_server_pwd.c
  14339. -+++ b/src/eap_server/eap_server_pwd.c
  14340. -@@ -942,11 +942,21 @@ static void eap_pwd_process(struct eap_sm *sm, void *priv,
  14341. - * the first fragment has a total length
  14342. - */
  14343. - if (EAP_PWD_GET_LENGTH_BIT(lm_exch)) {
  14344. -+ if (len < 2) {
  14345. -+ wpa_printf(MSG_DEBUG,
  14346. -+ "EAP-pwd: Frame too short to contain Total-Length field");
  14347. -+ return;
  14348. -+ }
  14349. - tot_len = WPA_GET_BE16(pos);
  14350. - wpa_printf(MSG_DEBUG, "EAP-pwd: Incoming fragments, total "
  14351. - "length = %d", tot_len);
  14352. - if (tot_len > 15000)
  14353. - return;
  14354. -+ if (data->inbuf) {
  14355. -+ wpa_printf(MSG_DEBUG,
  14356. -+ "EAP-pwd: Unexpected new fragment start when previous fragment is still in use");
  14357. -+ return;
  14358. -+ }
  14359. - data->inbuf = wpabuf_alloc(tot_len);
  14360. - if (data->inbuf == NULL) {
  14361. - wpa_printf(MSG_INFO, "EAP-pwd: Out of memory to "
  14362. ---
  14363. -1.9.1
  14364. -
  14365. 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
  14366. deleted file mode 100644
  14367. index a601323..0000000
  14368. --- a/package/network/services/hostapd/patches/008-EAP-pwd-peer-Fix-asymmetric-fragmentation-behavior.patch
  14369. +++ /dev/null
  14370. @@ -1,32 +0,0 @@
  14371. -From 28a069a545b06b99eb55ad53f63f2c99e65a98f6 Mon Sep 17 00:00:00 2001
  14372. -From: Jouni Malinen <j@w1.fi>
  14373. -Date: Sat, 2 May 2015 19:26:28 +0300
  14374. -Subject: [PATCH 5/5] EAP-pwd peer: Fix asymmetric fragmentation behavior
  14375. -
  14376. -The L (Length) and M (More) flags needs to be cleared before deciding
  14377. -whether the locally generated response requires fragmentation. This
  14378. -fixes an issue where these flags from the server could have been invalid
  14379. -for the following message. In some cases, this could have resulted in
  14380. -triggering the wpabuf security check that would terminate the process
  14381. -due to invalid buffer allocation.
  14382. -
  14383. -Signed-off-by: Jouni Malinen <j@w1.fi>
  14384. ----
  14385. - src/eap_peer/eap_pwd.c | 1 +
  14386. - 1 file changed, 1 insertion(+)
  14387. -
  14388. -diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c
  14389. -index 1d2079b..e58b13a 100644
  14390. ---- a/src/eap_peer/eap_pwd.c
  14391. -+++ b/src/eap_peer/eap_pwd.c
  14392. -@@ -968,6 +968,7 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret,
  14393. - /*
  14394. - * we have output! Do we need to fragment it?
  14395. - */
  14396. -+ lm_exch = EAP_PWD_GET_EXCHANGE(lm_exch);
  14397. - len = wpabuf_len(data->outbuf);
  14398. - if ((len + EAP_PWD_HDR_SIZE) > data->mtu) {
  14399. - resp = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_PWD, data->mtu,
  14400. ---
  14401. -1.9.1
  14402. -
  14403. 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
  14404. deleted file mode 100644
  14405. index dd34624..0000000
  14406. --- a/package/network/services/hostapd/patches/009-NFC-Fix-payload-length-validation-in-NDEF-record-par.patch
  14407. +++ /dev/null
  14408. @@ -1,61 +0,0 @@
  14409. -From df9079e72760ceb7ebe7fb11538200c516bdd886 Mon Sep 17 00:00:00 2001
  14410. -From: Jouni Malinen <j@w1.fi>
  14411. -Date: Tue, 7 Jul 2015 21:57:28 +0300
  14412. -Subject: [PATCH] NFC: Fix payload length validation in NDEF record parser
  14413. -
  14414. -It was possible for the 32-bit record->total_length value to end up
  14415. -wrapping around due to integer overflow if the longer form of payload
  14416. -length field is used and record->payload_length gets a value close to
  14417. -2^32. This could result in ndef_parse_record() accepting a too large
  14418. -payload length value and the record type filter reading up to about 20
  14419. -bytes beyond the end of the buffer and potentially killing the process.
  14420. -This could also result in an attempt to allocate close to 2^32 bytes of
  14421. -heap memory and if that were to succeed, a buffer read overflow of the
  14422. -same length which would most likely result in the process termination.
  14423. -In case of record->total_length ending up getting the value 0, there
  14424. -would be no buffer read overflow, but record parsing would result in an
  14425. -infinite loop in ndef_parse_records().
  14426. -
  14427. -Any of these error cases could potentially be used for denial of service
  14428. -attacks over NFC by using a malformed NDEF record on an NFC Tag or
  14429. -sending them during NFC connection handover if the application providing
  14430. -the NDEF message to hostapd/wpa_supplicant did no validation of the
  14431. -received records. While such validation is likely done in the NFC stack
  14432. -that needs to parse the NFC messages before further processing,
  14433. -hostapd/wpa_supplicant better be prepared for any data being included
  14434. -here.
  14435. -
  14436. -Fix this by validating record->payload_length value in a way that
  14437. -detects integer overflow. (CID 122668)
  14438. -
  14439. -Signed-off-by: Jouni Malinen <j@w1.fi>
  14440. ----
  14441. - src/wps/ndef.c | 5 ++++-
  14442. - 1 file changed, 4 insertions(+), 1 deletion(-)
  14443. -
  14444. -diff --git a/src/wps/ndef.c b/src/wps/ndef.c
  14445. -index 5604b0a..50d018f 100644
  14446. ---- a/src/wps/ndef.c
  14447. -+++ b/src/wps/ndef.c
  14448. -@@ -48,6 +48,8 @@ static int ndef_parse_record(const u8 *data, u32 size,
  14449. - if (size < 6)
  14450. - return -1;
  14451. - record->payload_length = ntohl(*(u32 *)pos);
  14452. -+ if (record->payload_length > size - 6)
  14453. -+ return -1;
  14454. - pos += sizeof(u32);
  14455. - }
  14456. -
  14457. -@@ -68,7 +70,8 @@ static int ndef_parse_record(const u8 *data, u32 size,
  14458. - pos += record->payload_length;
  14459. -
  14460. - record->total_length = pos - data;
  14461. -- if (record->total_length > size)
  14462. -+ if (record->total_length > size ||
  14463. -+ record->total_length < record->payload_length)
  14464. - return -1;
  14465. - return 0;
  14466. - }
  14467. ---
  14468. -1.9.1
  14469. -
  14470. 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
  14471. deleted file mode 100644
  14472. index 00e5b7c..0000000
  14473. --- a/package/network/services/hostapd/patches/010-WNM-Ignore-Key-Data-in-WNM-Sleep-Mode-Response-frame.patch
  14474. +++ /dev/null
  14475. @@ -1,32 +0,0 @@
  14476. -From 6b12d93d2c7428a34bfd4b3813ba339ed57b698a Mon Sep 17 00:00:00 2001
  14477. -From: Jouni Malinen <j@w1.fi>
  14478. -Date: Sun, 25 Oct 2015 15:45:50 +0200
  14479. -Subject: [PATCH] WNM: Ignore Key Data in WNM Sleep Mode Response frame if no
  14480. - PMF in use
  14481. -
  14482. -WNM Sleep Mode Response frame is used to update GTK/IGTK only if PMF is
  14483. -enabled. Verify that PMF is in use before using this field on station
  14484. -side to avoid accepting unauthenticated key updates. (CVE-2015-5310)
  14485. -
  14486. -Signed-off-by: Jouni Malinen <j@w1.fi>
  14487. ----
  14488. - wpa_supplicant/wnm_sta.c | 6 ++++++
  14489. - 1 file changed, 6 insertions(+)
  14490. -
  14491. -diff --git a/wpa_supplicant/wnm_sta.c b/wpa_supplicant/wnm_sta.c
  14492. -index 954de67..7d79499 100644
  14493. ---- a/wpa_supplicant/wnm_sta.c
  14494. -+++ b/wpa_supplicant/wnm_sta.c
  14495. -@@ -187,6 +187,12 @@ static void wnm_sleep_mode_exit_success(struct wpa_supplicant *wpa_s,
  14496. - end = ptr + key_len_total;
  14497. - wpa_hexdump_key(MSG_DEBUG, "WNM: Key Data", ptr, key_len_total);
  14498. -
  14499. -+ if (key_len_total && !wpa_sm_pmf_enabled(wpa_s->wpa)) {
  14500. -+ wpa_msg(wpa_s, MSG_INFO,
  14501. -+ "WNM: Ignore Key Data in WNM-Sleep Mode Response - PMF not enabled");
  14502. -+ return;
  14503. -+ }
  14504. -+
  14505. - while (ptr + 1 < end) {
  14506. - if (ptr + 2 + ptr[1] > end) {
  14507. - wpa_printf(MSG_DEBUG, "WNM: Invalid Key Data element "
  14508. 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
  14509. deleted file mode 100644
  14510. index 82c2639..0000000
  14511. --- a/package/network/services/hostapd/patches/011-EAP-pwd-peer-Fix-last-fragment-length-validation.patch
  14512. +++ /dev/null
  14513. @@ -1,54 +0,0 @@
  14514. -From 8057821706784608b828e769ccefbced95591e50 Mon Sep 17 00:00:00 2001
  14515. -From: Jouni Malinen <j@w1.fi>
  14516. -Date: Sun, 1 Nov 2015 18:18:17 +0200
  14517. -Subject: [PATCH] EAP-pwd peer: Fix last fragment length validation
  14518. -
  14519. -All but the last fragment had their length checked against the remaining
  14520. -room in the reassembly buffer. This allowed a suitably constructed last
  14521. -fragment frame to try to add extra data that would go beyond the buffer.
  14522. -The length validation code in wpabuf_put_data() prevents an actual
  14523. -buffer write overflow from occurring, but this results in process
  14524. -termination. (CVE-2015-5315)
  14525. -
  14526. -Signed-off-by: Jouni Malinen <j@w1.fi>
  14527. ----
  14528. - src/eap_peer/eap_pwd.c | 7 +++----
  14529. - 1 file changed, 3 insertions(+), 4 deletions(-)
  14530. -
  14531. -diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c
  14532. -index 1f78544..75ceef1 100644
  14533. ---- a/src/eap_peer/eap_pwd.c
  14534. -+++ b/src/eap_peer/eap_pwd.c
  14535. -@@ -903,7 +903,7 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret,
  14536. - /*
  14537. - * buffer and ACK the fragment
  14538. - */
  14539. -- if (EAP_PWD_GET_MORE_BIT(lm_exch)) {
  14540. -+ if (EAP_PWD_GET_MORE_BIT(lm_exch) || data->in_frag_pos) {
  14541. - data->in_frag_pos += len;
  14542. - if (data->in_frag_pos > wpabuf_size(data->inbuf)) {
  14543. - wpa_printf(MSG_INFO, "EAP-pwd: Buffer overflow attack "
  14544. -@@ -916,7 +916,8 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret,
  14545. - return NULL;
  14546. - }
  14547. - wpabuf_put_data(data->inbuf, pos, len);
  14548. --
  14549. -+ }
  14550. -+ if (EAP_PWD_GET_MORE_BIT(lm_exch)) {
  14551. - resp = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_PWD,
  14552. - EAP_PWD_HDR_SIZE,
  14553. - EAP_CODE_RESPONSE, eap_get_id(reqData));
  14554. -@@ -930,10 +931,8 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret,
  14555. - * we're buffering and this is the last fragment
  14556. - */
  14557. - if (data->in_frag_pos) {
  14558. -- wpabuf_put_data(data->inbuf, pos, len);
  14559. - wpa_printf(MSG_DEBUG, "EAP-pwd: Last fragment, %d bytes",
  14560. - (int) len);
  14561. -- data->in_frag_pos += len;
  14562. - pos = wpabuf_head_u8(data->inbuf);
  14563. - len = data->in_frag_pos;
  14564. - }
  14565. ---
  14566. -1.9.1
  14567. -
  14568. 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
  14569. deleted file mode 100644
  14570. index bfc4c74..0000000
  14571. --- a/package/network/services/hostapd/patches/012-EAP-pwd-server-Fix-last-fragment-length-validation.patch
  14572. +++ /dev/null
  14573. @@ -1,51 +0,0 @@
  14574. -From bef802ece03f9ae9d52a21f0cf4f1bc2c5a1f8aa Mon Sep 17 00:00:00 2001
  14575. -From: Jouni Malinen <j@w1.fi>
  14576. -Date: Sun, 1 Nov 2015 18:24:16 +0200
  14577. -Subject: [PATCH] EAP-pwd server: Fix last fragment length validation
  14578. -
  14579. -All but the last fragment had their length checked against the remaining
  14580. -room in the reassembly buffer. This allowed a suitably constructed last
  14581. -fragment frame to try to add extra data that would go beyond the buffer.
  14582. -The length validation code in wpabuf_put_data() prevents an actual
  14583. -buffer write overflow from occurring, but this results in process
  14584. -termination. (CVE-2015-5314)
  14585. -
  14586. -Signed-off-by: Jouni Malinen <j@w1.fi>
  14587. ----
  14588. - src/eap_server/eap_server_pwd.c | 6 +++---
  14589. - 1 file changed, 3 insertions(+), 3 deletions(-)
  14590. -
  14591. -diff --git a/src/eap_server/eap_server_pwd.c b/src/eap_server/eap_server_pwd.c
  14592. -index cb83ff7..9f787ab 100644
  14593. ---- a/src/eap_server/eap_server_pwd.c
  14594. -+++ b/src/eap_server/eap_server_pwd.c
  14595. -@@ -970,7 +970,7 @@ static void eap_pwd_process(struct eap_sm *sm, void *priv,
  14596. - /*
  14597. - * the first and all intermediate fragments have the M bit set
  14598. - */
  14599. -- if (EAP_PWD_GET_MORE_BIT(lm_exch)) {
  14600. -+ if (EAP_PWD_GET_MORE_BIT(lm_exch) || data->in_frag_pos) {
  14601. - if ((data->in_frag_pos + len) > wpabuf_size(data->inbuf)) {
  14602. - wpa_printf(MSG_DEBUG, "EAP-pwd: Buffer overflow "
  14603. - "attack detected! (%d+%d > %d)",
  14604. -@@ -981,6 +981,8 @@ static void eap_pwd_process(struct eap_sm *sm, void *priv,
  14605. - }
  14606. - wpabuf_put_data(data->inbuf, pos, len);
  14607. - data->in_frag_pos += len;
  14608. -+ }
  14609. -+ if (EAP_PWD_GET_MORE_BIT(lm_exch)) {
  14610. - wpa_printf(MSG_DEBUG, "EAP-pwd: Got a %d byte fragment",
  14611. - (int) len);
  14612. - return;
  14613. -@@ -990,8 +992,6 @@ static void eap_pwd_process(struct eap_sm *sm, void *priv,
  14614. - * buffering fragments so that's how we know it's the last)
  14615. - */
  14616. - if (data->in_frag_pos) {
  14617. -- wpabuf_put_data(data->inbuf, pos, len);
  14618. -- data->in_frag_pos += len;
  14619. - pos = wpabuf_head_u8(data->inbuf);
  14620. - len = data->in_frag_pos;
  14621. - wpa_printf(MSG_DEBUG, "EAP-pwd: Last fragment, %d bytes",
  14622. ---
  14623. -1.9.1
  14624. -
  14625. 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
  14626. deleted file mode 100644
  14627. index 3088f6a..0000000
  14628. --- a/package/network/services/hostapd/patches/013-EAP-pwd-peer-Fix-error-path-for-unexpected-Confirm-m.patch
  14629. +++ /dev/null
  14630. @@ -1,34 +0,0 @@
  14631. -From 95577884ca4fa76be91344ff7a8d5d1e6dc3da61 Mon Sep 17 00:00:00 2001
  14632. -From: Jouni Malinen <j@w1.fi>
  14633. -Date: Sun, 1 Nov 2015 19:35:44 +0200
  14634. -Subject: [PATCH] EAP-pwd peer: Fix error path for unexpected Confirm message
  14635. -
  14636. -If the Confirm message is received from the server before the Identity
  14637. -exchange has been completed, the group has not yet been determined and
  14638. -data->grp is NULL. The error path in eap_pwd_perform_confirm_exchange()
  14639. -did not take this corner case into account and could end up
  14640. -dereferencing a NULL pointer and terminating the process if invalid
  14641. -message sequence is received. (CVE-2015-5316)
  14642. -
  14643. -Signed-off-by: Jouni Malinen <j@w1.fi>
  14644. ----
  14645. - src/eap_peer/eap_pwd.c | 3 ++-
  14646. - 1 file changed, 2 insertions(+), 1 deletion(-)
  14647. -
  14648. -diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c
  14649. -index 75ceef1..892b590 100644
  14650. ---- a/src/eap_peer/eap_pwd.c
  14651. -+++ b/src/eap_peer/eap_pwd.c
  14652. -@@ -774,7 +774,8 @@ eap_pwd_perform_confirm_exchange(struct eap_sm *sm, struct eap_pwd_data *data,
  14653. - wpabuf_put_data(data->outbuf, conf, SHA256_MAC_LEN);
  14654. -
  14655. - fin:
  14656. -- bin_clear_free(cruft, BN_num_bytes(data->grp->prime));
  14657. -+ if (data->grp)
  14658. -+ bin_clear_free(cruft, BN_num_bytes(data->grp->prime));
  14659. - BN_clear_free(x);
  14660. - BN_clear_free(y);
  14661. - if (data->outbuf == NULL) {
  14662. ---
  14663. -1.9.1
  14664. -
  14665. diff --git a/package/network/services/hostapd/patches/100-mesh_mode_fix.patch b/package/network/services/hostapd/patches/100-mesh_mode_fix.patch
  14666. new file mode 100644
  14667. index 0000000..ceb4c53
  14668. --- /dev/null
  14669. +++ b/package/network/services/hostapd/patches/100-mesh_mode_fix.patch
  14670. @@ -0,0 +1,12 @@
  14671. +--- a/src/drivers/driver_nl80211.c
  14672. ++++ b/src/drivers/driver_nl80211.c
  14673. +@@ -2332,7 +2332,8 @@ wpa_driver_nl80211_finish_drv_init(struc
  14674. +
  14675. + if (drv->hostapd || bss->static_ap)
  14676. + nlmode = NL80211_IFTYPE_AP;
  14677. +- else if (bss->if_dynamic)
  14678. ++ else if (bss->if_dynamic ||
  14679. ++ nl80211_get_ifmode(bss) == NL80211_IFTYPE_MESH_POINT)
  14680. + nlmode = nl80211_get_ifmode(bss);
  14681. + else
  14682. + nlmode = NL80211_IFTYPE_STATION;
  14683. diff --git a/package/network/services/hostapd/patches/110-bool_fix.patch b/package/network/services/hostapd/patches/110-bool_fix.patch
  14684. deleted file mode 100644
  14685. index 865c014..0000000
  14686. --- a/package/network/services/hostapd/patches/110-bool_fix.patch
  14687. +++ /dev/null
  14688. @@ -1,14 +0,0 @@
  14689. ---- a/src/ap/ieee802_1x.c
  14690. -+++ b/src/ap/ieee802_1x.c
  14691. -@@ -2332,9 +2332,9 @@ void ieee802_1x_notify_pre_auth(struct e
  14692. - }
  14693. -
  14694. -
  14695. --static const char * bool_txt(Boolean bool)
  14696. -+static const char * bool_txt(Boolean bool_val)
  14697. - {
  14698. -- return bool ? "TRUE" : "FALSE";
  14699. -+ return bool_val ? "TRUE" : "FALSE";
  14700. - }
  14701. -
  14702. -
  14703. 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
  14704. new file mode 100644
  14705. index 0000000..67fb899
  14706. --- /dev/null
  14707. +++ b/package/network/services/hostapd/patches/110-fix_parse_das_client.patch
  14708. @@ -0,0 +1,10 @@
  14709. +--- a/hostapd/config_file.c
  14710. ++++ b/hostapd/config_file.c
  14711. +@@ -645,6 +645,7 @@ static int hostapd_parse_das_client(stru
  14712. + if (secret == NULL)
  14713. + return -1;
  14714. +
  14715. ++ *secret = 0;
  14716. + secret++;
  14717. +
  14718. + if (hostapd_parse_ip_addr(val, &bss->radius_das_client_addr))
  14719. diff --git a/package/network/services/hostapd/patches/120-daemonize_fix.patch b/package/network/services/hostapd/patches/120-daemonize_fix.patch
  14720. index 032e207..0389406 100644
  14721. --- a/package/network/services/hostapd/patches/120-daemonize_fix.patch
  14722. +++ b/package/network/services/hostapd/patches/120-daemonize_fix.patch
  14723. @@ -8,7 +8,7 @@
  14724. #ifdef ANDROID
  14725. #include <sys/capability.h>
  14726. -@@ -155,59 +156,46 @@ int os_gmtime(os_time_t t, struct os_tm
  14727. +@@ -179,59 +180,46 @@ int os_gmtime(os_time_t t, struct os_tm
  14728. return 0;
  14729. }
  14730. @@ -60,13 +60,13 @@
  14731. + if (chdir("/") < 0)
  14732. return -1;
  14733. - }
  14734. --
  14735. +
  14736. - return 0;
  14737. -}
  14738. -#else /* __APPLE__ */
  14739. -#define os_daemon daemon
  14740. -#endif /* __APPLE__ */
  14741. -
  14742. +-
  14743. -
  14744. -int os_daemonize(const char *pid_file)
  14745. -{
  14746. diff --git a/package/network/services/hostapd/patches/130-no_eapol_fix.patch b/package/network/services/hostapd/patches/130-no_eapol_fix.patch
  14747. index d23b47b..5aee3d0 100644
  14748. --- a/package/network/services/hostapd/patches/130-no_eapol_fix.patch
  14749. +++ b/package/network/services/hostapd/patches/130-no_eapol_fix.patch
  14750. @@ -1,6 +1,6 @@
  14751. --- a/wpa_supplicant/wpa_supplicant.c
  14752. +++ b/wpa_supplicant/wpa_supplicant.c
  14753. -@@ -252,9 +252,10 @@ void wpa_supplicant_cancel_auth_timeout(
  14754. +@@ -257,9 +257,10 @@ void wpa_supplicant_cancel_auth_timeout(
  14755. */
  14756. void wpa_supplicant_initiate_eapol(struct wpa_supplicant *wpa_s)
  14757. {
  14758. 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
  14759. index 6337d8d..fdd5da9 100644
  14760. --- a/package/network/services/hostapd/patches/140-disable_bridge_packet_workaround.patch
  14761. +++ b/package/network/services/hostapd/patches/140-disable_bridge_packet_workaround.patch
  14762. @@ -1,6 +1,6 @@
  14763. --- a/src/l2_packet/l2_packet_linux.c
  14764. +++ b/src/l2_packet/l2_packet_linux.c
  14765. -@@ -307,8 +307,7 @@ struct l2_packet_data * l2_packet_init_b
  14766. +@@ -337,8 +337,7 @@ struct l2_packet_data * l2_packet_init_b
  14767. l2 = l2_packet_init(br_ifname, own_addr, protocol, rx_callback,
  14768. rx_callback_ctx, l2_hdr);
  14769. @@ -8,5 +8,5 @@
  14770. - return NULL;
  14771. + return l2;
  14772. + #ifndef CONFIG_NO_LINUX_PACKET_SOCKET_WAR
  14773. /*
  14774. - * The Linux packet socket behavior has changed over the years and there
  14775. 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
  14776. deleted file mode 100644
  14777. index 66c682f..0000000
  14778. --- a/package/network/services/hostapd/patches/150-nl80211-Report-disassociated-STA-lost-peer-for-the-c.patch
  14779. +++ /dev/null
  14780. @@ -1,67 +0,0 @@
  14781. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  14782. -Date: Mon, 11 Jan 2016 19:18:06 +0100
  14783. -Subject: [PATCH] nl80211: Report disassociated STA / lost peer for the correct
  14784. - BSS
  14785. -MIME-Version: 1.0
  14786. -Content-Type: text/plain; charset=UTF-8
  14787. -Content-Transfer-Encoding: 8bit
  14788. -
  14789. -We shouldn't use drv->ctx as it always points to the first BSS. When
  14790. -using FullMAC driver with multi-BSS support it resulted in incorrect
  14791. -treating nl80211 events. I noticed with with brcmfmac and BCM43602.
  14792. -
  14793. -Before my change I was getting "disassociated" on a wrong interface:
  14794. -wlan0-1: STA 78:d6:f0:00:11:22 IEEE 802.11: associated
  14795. -wlan0-1: STA 78:d6:f0:00:11:22 WPA: pairwise key handshake completed (RSN)
  14796. -wlan0: STA 78:d6:f0:00:11:22 IEEE 802.11: disassociated
  14797. -
  14798. -With this patch it works as expected:
  14799. -wlan0-1: STA 78:d6:f0:00:11:22 IEEE 802.11: associated
  14800. -wlan0-1: STA 78:d6:f0:00:11:22 WPA: pairwise key handshake completed (RSN)
  14801. -wlan0-1: STA 78:d6:f0:00:11:22 IEEE 802.11: disassociated
  14802. -
  14803. -This doesn't apply to hostapd dealing with SoftMAC drivers when handling
  14804. -AP SME & MLME is done it hostapd not the firmware.
  14805. -
  14806. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  14807. ----
  14808. - src/drivers/driver_nl80211_event.c | 7 ++++---
  14809. - 1 file changed, 4 insertions(+), 3 deletions(-)
  14810. -
  14811. ---- a/src/drivers/driver_nl80211_event.c
  14812. -+++ b/src/drivers/driver_nl80211_event.c
  14813. -@@ -1154,6 +1154,7 @@ static void nl80211_new_station_event(st
  14814. -
  14815. -
  14816. - static void nl80211_del_station_event(struct wpa_driver_nl80211_data *drv,
  14817. -+ struct i802_bss *bss,
  14818. - struct nlattr **tb)
  14819. - {
  14820. - u8 *addr;
  14821. -@@ -1166,7 +1167,7 @@ static void nl80211_del_station_event(st
  14822. - MAC2STR(addr));
  14823. -
  14824. - if (is_ap_interface(drv->nlmode) && drv->device_ap_sme) {
  14825. -- drv_event_disassoc(drv->ctx, addr);
  14826. -+ drv_event_disassoc(bss->ctx, addr);
  14827. - return;
  14828. - }
  14829. -
  14830. -@@ -1175,7 +1176,7 @@ static void nl80211_del_station_event(st
  14831. -
  14832. - os_memset(&data, 0, sizeof(data));
  14833. - os_memcpy(data.ibss_peer_lost.peer, addr, ETH_ALEN);
  14834. -- wpa_supplicant_event(drv->ctx, EVENT_IBSS_PEER_LOST, &data);
  14835. -+ wpa_supplicant_event(bss->ctx, EVENT_IBSS_PEER_LOST, &data);
  14836. - }
  14837. -
  14838. -
  14839. -@@ -1939,7 +1940,7 @@ static void do_process_drv_event(struct
  14840. - nl80211_new_station_event(drv, bss, tb);
  14841. - break;
  14842. - case NL80211_CMD_DEL_STATION:
  14843. -- nl80211_del_station_event(drv, tb);
  14844. -+ nl80211_del_station_event(drv, bss, tb);
  14845. - break;
  14846. - case NL80211_CMD_SET_REKEY_OFFLOAD:
  14847. - nl80211_rekey_offload_event(drv, tb);
  14848. diff --git a/package/network/services/hostapd/patches/200-multicall.patch b/package/network/services/hostapd/patches/200-multicall.patch
  14849. index de4a3a8..8b260c2 100644
  14850. --- a/package/network/services/hostapd/patches/200-multicall.patch
  14851. +++ b/package/network/services/hostapd/patches/200-multicall.patch
  14852. @@ -1,15 +1,25 @@
  14853. --- a/hostapd/Makefile
  14854. +++ b/hostapd/Makefile
  14855. -@@ -17,6 +17,7 @@ export BINDIR ?= /usr/local/bin/
  14856. - # CFLAGS += -DUSE_KERNEL_HEADERS -I/usr/src/linux/include
  14857. +@@ -28,6 +28,7 @@ CFLAGS += -I$(abspath ../src/utils)
  14858. + export BINDIR ?= /usr/local/bin/
  14859. -include .config
  14860. +-include $(if $(MULTICALL), ../wpa_supplicant/.config)
  14861. - ifdef CONFIG_TESTING_OPTIONS
  14862. - CFLAGS += -DCONFIG_TESTING_OPTIONS
  14863. -@@ -242,10 +243,14 @@ ifdef CONFIG_IEEE80211AC
  14864. - CFLAGS += -DCONFIG_IEEE80211AC
  14865. + ifndef CONFIG_NO_GITVER
  14866. + # Add VERSION_STR postfix for builds from a git repository
  14867. +@@ -190,7 +191,8 @@ endif
  14868. +
  14869. + ifdef CONFIG_NO_VLAN
  14870. + CFLAGS += -DCONFIG_NO_VLAN
  14871. +-else
  14872. ++endif
  14873. ++ifneq ($(findstring CONFIG_NO_VLAN,$(CFLAGS)), CONFIG_NO_VLAN)
  14874. + OBJS += ../src/ap/vlan_init.o
  14875. + OBJS += ../src/ap/vlan_ifconfig.o
  14876. + OBJS += ../src/ap/vlan.o
  14877. +@@ -315,10 +317,14 @@ CFLAGS += -DCONFIG_MBO
  14878. + OBJS += ../src/ap/mbo_ap.o
  14879. endif
  14880. +ifndef MULTICALL
  14881. @@ -26,7 +36,7 @@
  14882. LIBS += $(DRV_AP_LIBS)
  14883. ifdef CONFIG_L2_PACKET
  14884. -@@ -941,6 +946,12 @@ install: $(addprefix $(DESTDIR)$(BINDIR)
  14885. +@@ -1051,6 +1057,12 @@ install: $(addprefix $(DESTDIR)$(BINDIR)
  14886. BCHECK=../src/drivers/build.hostapd
  14887. @@ -39,7 +49,7 @@
  14888. hostapd: $(BCHECK) $(OBJS)
  14889. $(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS)
  14890. @$(E) " LD " $@
  14891. -@@ -980,6 +991,12 @@ HOBJS += ../src/crypto/aes-internal.o
  14892. +@@ -1092,6 +1104,12 @@ HOBJS += ../src/crypto/aes-internal.o
  14893. HOBJS += ../src/crypto/aes-internal-enc.o
  14894. endif
  14895. @@ -54,15 +64,25 @@
  14896. @$(E) " LD " $@
  14897. --- a/wpa_supplicant/Makefile
  14898. +++ b/wpa_supplicant/Makefile
  14899. -@@ -15,6 +15,7 @@ CFLAGS += -I$(abspath ../src)
  14900. +@@ -27,6 +27,7 @@ CFLAGS += -I$(abspath ../src)
  14901. CFLAGS += -I$(abspath ../src/utils)
  14902. -include .config
  14903. +-include $(if $(MULTICALL),../hostapd/.config)
  14904. - ifdef CONFIG_TESTING_OPTIONS
  14905. - CFLAGS += -DCONFIG_TESTING_OPTIONS
  14906. -@@ -773,6 +774,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS
  14907. + ifndef CONFIG_NO_GITVER
  14908. + # Add VERSION_STR postfix for builds from a git repository
  14909. +@@ -312,7 +313,9 @@ endif
  14910. + ifdef CONFIG_IBSS_RSN
  14911. + NEED_RSN_AUTHENTICATOR=y
  14912. + CFLAGS += -DCONFIG_IBSS_RSN
  14913. ++ifndef MULTICALL
  14914. + CFLAGS += -DCONFIG_NO_VLAN
  14915. ++endif
  14916. + OBJS += ibss_rsn.o
  14917. + endif
  14918. +
  14919. +@@ -803,6 +806,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS
  14920. CFLAGS += -DCONFIG_DYNAMIC_EAP_METHODS
  14921. LIBS += -ldl -rdynamic
  14922. endif
  14923. @@ -73,7 +93,7 @@
  14924. endif
  14925. ifdef CONFIG_MACSEC
  14926. -@@ -793,9 +798,11 @@ NEED_EAP_COMMON=y
  14927. +@@ -823,9 +830,11 @@ NEED_EAP_COMMON=y
  14928. NEED_RSN_AUTHENTICATOR=y
  14929. CFLAGS += -DCONFIG_AP
  14930. OBJS += ap.o
  14931. @@ -85,7 +105,7 @@
  14932. OBJS += ../src/ap/hostapd.o
  14933. OBJS += ../src/ap/wpa_auth_glue.o
  14934. OBJS += ../src/ap/utils.o
  14935. -@@ -858,10 +865,18 @@ endif
  14936. +@@ -898,10 +907,18 @@ endif
  14937. ifdef CONFIG_HS20
  14938. OBJS += ../src/ap/hs20.o
  14939. endif
  14940. @@ -104,7 +124,7 @@
  14941. NEED_AES_WRAP=y
  14942. OBJS += ../src/ap/wpa_auth.o
  14943. OBJS += ../src/ap/wpa_auth_ie.o
  14944. -@@ -1603,6 +1618,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv)
  14945. +@@ -1680,6 +1697,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv)
  14946. $(OBJS_c) $(OBJS_t) $(OBJS_t2) $(OBJS) $(BCHECK) $(EXTRA_progs): .config
  14947. @@ -117,8 +137,8 @@
  14948. wpa_supplicant: $(BCHECK) $(OBJS) $(EXTRA_progs)
  14949. $(Q)$(LDO) $(LDFLAGS) -o wpa_supplicant $(OBJS) $(LIBS) $(EXTRALIBS)
  14950. @$(E) " LD " $@
  14951. -@@ -1694,6 +1715,12 @@ endif
  14952. - $(Q)sed -e 's|\@BINDIR\@|$(BINDIR)|g' $< >$@
  14953. +@@ -1782,6 +1805,12 @@ endif
  14954. + -e 's|\@DBUS_INTERFACE\@|$(DBUS_INTERFACE)|g' $< >$@
  14955. @$(E) " sed" $<
  14956. +dump_cflags:
  14957. @@ -132,7 +152,7 @@
  14958. wpa_cli.exe: wpa_cli
  14959. --- a/src/drivers/driver.h
  14960. +++ b/src/drivers/driver.h
  14961. -@@ -4581,8 +4581,8 @@ union wpa_event_data {
  14962. +@@ -4794,8 +4794,8 @@ union wpa_event_data {
  14963. * Driver wrapper code should call this function whenever an event is received
  14964. * from the driver.
  14965. */
  14966. @@ -141,11 +161,20 @@
  14967. +extern void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event,
  14968. + union wpa_event_data *data);
  14969. + /**
  14970. + * wpa_supplicant_event_global - Report a driver event for wpa_supplicant
  14971. +@@ -4807,7 +4807,7 @@ void wpa_supplicant_event(void *ctx, enu
  14972. + * Same as wpa_supplicant_event(), but we search for the interface in
  14973. + * wpa_global.
  14974. + */
  14975. +-void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
  14976. ++extern void (*wpa_supplicant_event_global)(void *ctx, enum wpa_event_type event,
  14977. + union wpa_event_data *data);
  14978. /*
  14979. --- a/src/ap/drv_callbacks.c
  14980. +++ b/src/ap/drv_callbacks.c
  14981. -@@ -1075,8 +1075,8 @@ static void hostapd_event_dfs_cac_starte
  14982. +@@ -1157,8 +1157,8 @@ static void hostapd_event_dfs_cac_starte
  14983. #endif /* NEED_AP_MLME */
  14984. @@ -156,9 +185,18 @@
  14985. {
  14986. struct hostapd_data *hapd = ctx;
  14987. #ifndef CONFIG_NO_STDOUT_DEBUG
  14988. +@@ -1367,7 +1367,7 @@ void wpa_supplicant_event(void *ctx, enu
  14989. + }
  14990. +
  14991. +
  14992. +-void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
  14993. ++void hostapd_wpa_event_global(void *ctx, enum wpa_event_type event,
  14994. + union wpa_event_data *data)
  14995. + {
  14996. + struct hapd_interfaces *interfaces = ctx;
  14997. --- a/wpa_supplicant/wpa_priv.c
  14998. +++ b/wpa_supplicant/wpa_priv.c
  14999. -@@ -819,8 +819,8 @@ static void wpa_priv_send_ft_response(st
  15000. +@@ -940,8 +940,8 @@ static void wpa_priv_send_ft_response(st
  15001. }
  15002. @@ -169,17 +207,27 @@
  15003. {
  15004. struct wpa_priv_interface *iface = ctx;
  15005. -@@ -961,6 +961,7 @@ int main(int argc, char *argv[])
  15006. +@@ -1010,7 +1010,7 @@ void wpa_supplicant_event(void *ctx, enu
  15007. + }
  15008. +
  15009. +
  15010. +-void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
  15011. ++void supplicant_event_global(void *ctx, enum wpa_event_type event,
  15012. + union wpa_event_data *data)
  15013. + {
  15014. + struct wpa_priv_global *global = ctx;
  15015. +@@ -1122,6 +1122,8 @@ int main(int argc, char *argv[])
  15016. if (os_program_init())
  15017. return -1;
  15018. + wpa_supplicant_event = supplicant_event;
  15019. ++ wpa_supplicant_event_global = supplicant_event_global;
  15020. wpa_priv_fd_workaround();
  15021. - for (;;) {
  15022. + os_memset(&global, 0, sizeof(global));
  15023. --- a/wpa_supplicant/events.c
  15024. +++ b/wpa_supplicant/events.c
  15025. -@@ -3138,8 +3138,8 @@ static void wpa_supplicant_event_assoc_a
  15026. +@@ -3384,8 +3384,8 @@ static void wpa_supplicant_event_assoc_a
  15027. }
  15028. @@ -189,88 +237,125 @@
  15029. + union wpa_event_data *data)
  15030. {
  15031. struct wpa_supplicant *wpa_s = ctx;
  15032. + int resched;
  15033. +@@ -4051,7 +4051,7 @@ void wpa_supplicant_event(void *ctx, enu
  15034. + #endif /* CONFIG_AP */
  15035. + break;
  15036. + case EVENT_ACS_CHANNEL_SELECTED:
  15037. +-#ifdef CONFIG_ACS
  15038. ++#if defined(CONFIG_ACS) && defined(CONFIG_AP)
  15039. + if (!wpa_s->ap_iface)
  15040. + break;
  15041. + hostapd_acs_channel_selected(wpa_s->ap_iface->bss[0],
  15042. +@@ -4065,7 +4065,7 @@ void wpa_supplicant_event(void *ctx, enu
  15043. + }
  15044. +
  15045. +-void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
  15046. ++void supplicant_event_global(void *ctx, enum wpa_event_type event,
  15047. + union wpa_event_data *data)
  15048. + {
  15049. + struct wpa_supplicant *wpa_s;
  15050. --- a/wpa_supplicant/wpa_supplicant.c
  15051. +++ b/wpa_supplicant/wpa_supplicant.c
  15052. -@@ -4300,6 +4300,9 @@ static void wpa_supplicant_deinit_iface(
  15053. - os_free(wpa_s);
  15054. +@@ -4990,7 +4990,6 @@ struct wpa_interface * wpa_supplicant_ma
  15055. + return NULL;
  15056. }
  15057. +-
  15058. + /**
  15059. + * wpa_supplicant_match_existing - Match existing interfaces
  15060. + * @global: Pointer to global data from wpa_supplicant_init()
  15061. +@@ -5027,6 +5026,11 @@ static int wpa_supplicant_match_existing
  15062. +
  15063. + #endif /* CONFIG_MATCH_IFACE */
  15064. +
  15065. +extern void supplicant_event(void *ctx, enum wpa_event_type event,
  15066. + union wpa_event_data *data);
  15067. +
  15068. ++extern void supplicant_event_global(void *ctx, enum wpa_event_type event,
  15069. ++ union wpa_event_data *data);
  15070. /**
  15071. * wpa_supplicant_add_iface - Add a new network interface
  15072. -@@ -4526,6 +4529,7 @@ struct wpa_global * wpa_supplicant_init(
  15073. +@@ -5282,6 +5286,8 @@ struct wpa_global * wpa_supplicant_init(
  15074. #ifndef CONFIG_NO_WPA_MSG
  15075. wpa_msg_register_ifname_cb(wpa_supplicant_msg_ifname_cb);
  15076. #endif /* CONFIG_NO_WPA_MSG */
  15077. + wpa_supplicant_event = supplicant_event;
  15078. ++ wpa_supplicant_event_global = supplicant_event_global;
  15079. if (params->wpa_debug_file_path)
  15080. wpa_debug_open_file(params->wpa_debug_file_path);
  15081. --- a/hostapd/main.c
  15082. +++ b/hostapd/main.c
  15083. -@@ -511,6 +511,9 @@ static int hostapd_get_ctrl_iface_group(
  15084. - return 0;
  15085. +@@ -583,6 +583,11 @@ fail:
  15086. + return -1;
  15087. }
  15088. +void hostapd_wpa_event(void *ctx, enum wpa_event_type event,
  15089. + union wpa_event_data *data);
  15090. +
  15091. ++void hostapd_wpa_event_global(void *ctx, enum wpa_event_type event,
  15092. ++ union wpa_event_data *data);
  15093. #ifdef CONFIG_WPS
  15094. static int gen_uuid(const char *txt_addr)
  15095. -@@ -562,6 +565,7 @@ int main(int argc, char *argv[])
  15096. - interfaces.global_iface_name = NULL;
  15097. +@@ -660,6 +665,8 @@ int main(int argc, char *argv[])
  15098. interfaces.global_ctrl_sock = -1;
  15099. + dl_list_init(&interfaces.global_ctrl_dst);
  15100. + wpa_supplicant_event = hostapd_wpa_event;
  15101. ++ wpa_supplicant_event_global = hostapd_wpa_event_global;
  15102. for (;;) {
  15103. - c = getopt(argc, argv, "b:Bde:f:hKP:Ttu:vg:G:");
  15104. + c = getopt(argc, argv, "b:Bde:f:hi:KP:STtu:vg:G:");
  15105. if (c < 0)
  15106. --- a/src/drivers/drivers.c
  15107. +++ b/src/drivers/drivers.c
  15108. -@@ -10,6 +10,9 @@
  15109. +@@ -10,6 +10,11 @@
  15110. #include "utils/common.h"
  15111. #include "driver.h"
  15112. +void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event,
  15113. + union wpa_event_data *data);
  15114. ++void (*wpa_supplicant_event_global)(void *ctx, enum wpa_event_type event,
  15115. ++ union wpa_event_data *data);
  15116. +
  15117. #ifdef CONFIG_DRIVER_WEXT
  15118. extern struct wpa_driver_ops wpa_driver_wext_ops; /* driver_wext.c */
  15119. #endif /* CONFIG_DRIVER_WEXT */
  15120. --- a/wpa_supplicant/eapol_test.c
  15121. +++ b/wpa_supplicant/eapol_test.c
  15122. -@@ -28,8 +28,12 @@
  15123. +@@ -29,7 +29,12 @@
  15124. #include "ctrl_iface.h"
  15125. #include "pcsc_funcs.h"
  15126. #include "wpas_glue.h"
  15127. +#include "drivers/driver.h"
  15128. -
  15129. +void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event,
  15130. + union wpa_event_data *data);
  15131. -+
  15132. - struct wpa_driver_ops *wpa_drivers[] = { NULL };
  15133. ++void (*wpa_supplicant_event_global)(void *ctx, enum wpa_event_type event,
  15134. ++ union wpa_event_data *data);
  15135. + const struct wpa_driver_ops *const wpa_drivers[] = { NULL };
  15136. -@@ -1203,6 +1207,8 @@ static void usage(void)
  15137. +@@ -1295,6 +1300,10 @@ static void usage(void)
  15138. "option several times.\n");
  15139. }
  15140. +extern void supplicant_event(void *ctx, enum wpa_event_type event,
  15141. + union wpa_event_data *data);
  15142. ++extern void supplicant_event_global(void *ctx, enum wpa_event_type event,
  15143. ++ union wpa_event_data *data);
  15144. int main(int argc, char *argv[])
  15145. {
  15146. -@@ -1221,6 +1227,7 @@ int main(int argc, char *argv[])
  15147. +@@ -1315,6 +1324,8 @@ int main(int argc, char *argv[])
  15148. if (os_program_init())
  15149. return -1;
  15150. + wpa_supplicant_event = supplicant_event;
  15151. ++ wpa_supplicant_event_global = supplicant_event_global;
  15152. hostapd_logger_register_cb(hostapd_logger_cb);
  15153. os_memset(&eapol_test, 0, sizeof(eapol_test));
  15154. diff --git a/package/network/services/hostapd/patches/300-noscan.patch b/package/network/services/hostapd/patches/300-noscan.patch
  15155. index 57d8fe2..21d6316 100644
  15156. --- a/package/network/services/hostapd/patches/300-noscan.patch
  15157. +++ b/package/network/services/hostapd/patches/300-noscan.patch
  15158. @@ -1,6 +1,6 @@
  15159. --- a/hostapd/config_file.c
  15160. +++ b/hostapd/config_file.c
  15161. -@@ -2771,6 +2771,10 @@ static int hostapd_config_fill(struct ho
  15162. +@@ -2862,6 +2862,10 @@ static int hostapd_config_fill(struct ho
  15163. }
  15164. #endif /* CONFIG_IEEE80211W */
  15165. #ifdef CONFIG_IEEE80211N
  15166. @@ -13,7 +13,7 @@
  15167. } else if (os_strcmp(buf, "ht_capab") == 0) {
  15168. --- a/src/ap/ap_config.h
  15169. +++ b/src/ap/ap_config.h
  15170. -@@ -619,6 +619,8 @@ struct hostapd_config {
  15171. +@@ -655,6 +655,8 @@ struct hostapd_config {
  15172. int ht_op_mode_fixed;
  15173. u16 ht_capab;
  15174. @@ -21,21 +21,22 @@
  15175. + int no_ht_coex;
  15176. int ieee80211n;
  15177. int secondary_channel;
  15178. - int require_ht;
  15179. + int no_pri_sec_switch;
  15180. --- a/src/ap/hw_features.c
  15181. +++ b/src/ap/hw_features.c
  15182. -@@ -461,7 +461,7 @@ static int ieee80211n_check_40mhz(struct
  15183. - struct wpa_driver_scan_params params;
  15184. +@@ -474,7 +474,8 @@ static int ieee80211n_check_40mhz(struct
  15185. int ret;
  15186. -- if (!iface->conf->secondary_channel)
  15187. -+ if (!iface->conf->secondary_channel || iface->conf->noscan)
  15188. - return 0; /* HT40 not used */
  15189. + /* Check that HT40 is used and PRI / SEC switch is allowed */
  15190. +- if (!iface->conf->secondary_channel || iface->conf->no_pri_sec_switch)
  15191. ++ if (!iface->conf->secondary_channel || iface->conf->no_pri_sec_switch ||
  15192. ++ iface->conf->noscan)
  15193. + return 0;
  15194. hostapd_set_state(iface, HAPD_IFACE_HT_SCAN);
  15195. --- a/src/ap/ieee802_11_ht.c
  15196. +++ b/src/ap/ieee802_11_ht.c
  15197. -@@ -221,6 +221,9 @@ void hostapd_2040_coex_action(struct hos
  15198. +@@ -244,6 +244,9 @@ void hostapd_2040_coex_action(struct hos
  15199. if (!(iface->conf->ht_capab & HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET))
  15200. return;
  15201. @@ -45,7 +46,7 @@
  15202. if (len < IEEE80211_HDRLEN + 2 + sizeof(*bc_ie))
  15203. return;
  15204. -@@ -346,6 +349,9 @@ void ht40_intolerant_add(struct hostapd_
  15205. +@@ -368,6 +371,9 @@ void ht40_intolerant_add(struct hostapd_
  15206. if (iface->current_mode->mode != HOSTAPD_MODE_IEEE80211G)
  15207. return;
  15208. diff --git a/package/network/services/hostapd/patches/310-rescan_immediately.patch b/package/network/services/hostapd/patches/310-rescan_immediately.patch
  15209. index 7be8c32..3f46cc4 100644
  15210. --- a/package/network/services/hostapd/patches/310-rescan_immediately.patch
  15211. +++ b/package/network/services/hostapd/patches/310-rescan_immediately.patch
  15212. @@ -1,6 +1,6 @@
  15213. --- a/wpa_supplicant/wpa_supplicant.c
  15214. +++ b/wpa_supplicant/wpa_supplicant.c
  15215. -@@ -3249,7 +3249,7 @@ wpa_supplicant_alloc(struct wpa_supplica
  15216. +@@ -3556,7 +3556,7 @@ wpa_supplicant_alloc(struct wpa_supplica
  15217. if (wpa_s == NULL)
  15218. return NULL;
  15219. wpa_s->scan_req = INITIAL_SCAN_REQ;
  15220. @@ -8,4 +8,4 @@
  15221. + wpa_s->scan_interval = 1;
  15222. wpa_s->new_connection = 1;
  15223. wpa_s->parent = parent ? parent : wpa_s;
  15224. - wpa_s->sched_scanning = 0;
  15225. + wpa_s->p2pdev = wpa_s->parent;
  15226. diff --git a/package/network/services/hostapd/patches/320-optional_rfkill.patch b/package/network/services/hostapd/patches/320-optional_rfkill.patch
  15227. index 75b4b07..cf2a2c1 100644
  15228. --- a/package/network/services/hostapd/patches/320-optional_rfkill.patch
  15229. +++ b/package/network/services/hostapd/patches/320-optional_rfkill.patch
  15230. @@ -1,14 +1,14 @@
  15231. --- a/src/drivers/drivers.mak
  15232. +++ b/src/drivers/drivers.mak
  15233. -@@ -34,7 +34,6 @@ NEED_SME=y
  15234. +@@ -36,7 +36,6 @@ NEED_SME=y
  15235. NEED_AP_MLME=y
  15236. NEED_NETLINK=y
  15237. NEED_LINUX_IOCTL=y
  15238. -NEED_RFKILL=y
  15239. + NEED_RADIOTAP=y
  15240. ifdef CONFIG_LIBNL32
  15241. - DRV_LIBS += -lnl-3
  15242. -@@ -116,7 +115,6 @@ DRV_WPA_CFLAGS += -DCONFIG_DRIVER_WEXT
  15243. +@@ -123,7 +122,6 @@ DRV_WPA_CFLAGS += -DCONFIG_DRIVER_WEXT
  15244. CONFIG_WIRELESS_EXTENSION=y
  15245. NEED_NETLINK=y
  15246. NEED_LINUX_IOCTL=y
  15247. @@ -16,7 +16,7 @@
  15248. endif
  15249. ifdef CONFIG_DRIVER_NDIS
  15250. -@@ -142,7 +140,6 @@ endif
  15251. +@@ -149,7 +147,6 @@ endif
  15252. ifdef CONFIG_WIRELESS_EXTENSION
  15253. DRV_WPA_CFLAGS += -DCONFIG_WIRELESS_EXTENSION
  15254. DRV_WPA_OBJS += ../src/drivers/driver_wext.o
  15255. @@ -24,14 +24,14 @@
  15256. endif
  15257. ifdef NEED_NETLINK
  15258. -@@ -155,6 +152,7 @@ endif
  15259. +@@ -162,6 +159,7 @@ endif
  15260. ifdef NEED_RFKILL
  15261. DRV_OBJS += ../src/drivers/rfkill.o
  15262. +DRV_WPA_CFLAGS += -DCONFIG_RFKILL
  15263. endif
  15264. - ifdef CONFIG_VLAN_NETLINK
  15265. + ifdef NEED_RADIOTAP
  15266. --- a/src/drivers/rfkill.h
  15267. +++ b/src/drivers/rfkill.h
  15268. @@ -18,8 +18,24 @@ struct rfkill_config {
  15269. 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
  15270. index dd90877..ca46012 100644
  15271. --- a/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch
  15272. +++ b/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch
  15273. @@ -1,6 +1,6 @@
  15274. --- a/src/drivers/driver_nl80211.c
  15275. +++ b/src/drivers/driver_nl80211.c
  15276. -@@ -3616,7 +3616,7 @@ static int nl80211_set_channel(struct i8
  15277. +@@ -3795,7 +3795,7 @@ static int nl80211_set_channel(struct i8
  15278. freq->freq, freq->ht_enabled, freq->vht_enabled,
  15279. freq->bandwidth, freq->center_freq1, freq->center_freq2);
  15280. diff --git a/package/network/services/hostapd/patches/340-reload_freq_change.patch b/package/network/services/hostapd/patches/340-reload_freq_change.patch
  15281. index 91b6196..086ade9 100644
  15282. --- a/package/network/services/hostapd/patches/340-reload_freq_change.patch
  15283. +++ b/package/network/services/hostapd/patches/340-reload_freq_change.patch
  15284. @@ -1,6 +1,6 @@
  15285. --- a/src/ap/hostapd.c
  15286. +++ b/src/ap/hostapd.c
  15287. -@@ -76,6 +76,16 @@ static void hostapd_reload_bss(struct ho
  15288. +@@ -80,6 +80,16 @@ static void hostapd_reload_bss(struct ho
  15289. #endif /* CONFIG_NO_RADIUS */
  15290. ssid = &hapd->conf->ssid;
  15291. @@ -17,7 +17,7 @@
  15292. if (!ssid->wpa_psk_set && ssid->wpa_psk && !ssid->wpa_psk->next &&
  15293. ssid->wpa_passphrase_set && ssid->wpa_passphrase) {
  15294. /*
  15295. -@@ -175,21 +185,12 @@ int hostapd_reload_config(struct hostapd
  15296. +@@ -179,21 +189,12 @@ int hostapd_reload_config(struct hostapd
  15297. oldconf = hapd->iconf;
  15298. iface->conf = newconf;
  15299. 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
  15300. index a14fa03..247f154 100644
  15301. --- a/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch
  15302. +++ b/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch
  15303. @@ -1,6 +1,6 @@
  15304. --- a/src/drivers/driver_nl80211.c
  15305. +++ b/src/drivers/driver_nl80211.c
  15306. -@@ -2254,13 +2254,18 @@ wpa_driver_nl80211_finish_drv_init(struc
  15307. +@@ -2394,13 +2394,18 @@ wpa_driver_nl80211_finish_drv_init(struc
  15308. }
  15309. @@ -22,7 +22,7 @@
  15310. return send_and_recv_msgs(drv, msg, NULL, NULL);
  15311. }
  15312. -@@ -2311,7 +2316,7 @@ static void wpa_driver_nl80211_deinit(st
  15313. +@@ -2452,7 +2457,7 @@ static void wpa_driver_nl80211_deinit(st
  15314. nl80211_remove_monitor_interface(drv);
  15315. if (is_ap_interface(drv->nlmode))
  15316. @@ -31,7 +31,7 @@
  15317. if (drv->eapol_sock >= 0) {
  15318. eloop_unregister_read_sock(drv->eapol_sock);
  15319. -@@ -4140,8 +4145,7 @@ static void nl80211_teardown_ap(struct i
  15320. +@@ -4385,8 +4390,7 @@ static void nl80211_teardown_ap(struct i
  15321. nl80211_remove_monitor_interface(drv);
  15322. else
  15323. nl80211_mgmt_unsubscribe(bss, "AP teardown");
  15324. @@ -41,7 +41,7 @@
  15325. }
  15326. -@@ -6066,8 +6070,6 @@ static int wpa_driver_nl80211_if_remove(
  15327. +@@ -6387,8 +6391,6 @@ static int wpa_driver_nl80211_if_remove(
  15328. } else {
  15329. wpa_printf(MSG_DEBUG, "nl80211: First BSS - reassign context");
  15330. nl80211_teardown_ap(bss);
  15331. @@ -50,7 +50,7 @@
  15332. nl80211_destroy_bss(bss);
  15333. if (!bss->added_if)
  15334. i802_set_iface_flags(bss, 0);
  15335. -@@ -6389,8 +6391,7 @@ static int wpa_driver_nl80211_deinit_ap(
  15336. +@@ -6750,8 +6752,7 @@ static int wpa_driver_nl80211_deinit_ap(
  15337. struct wpa_driver_nl80211_data *drv = bss->drv;
  15338. if (!is_ap_interface(drv->nlmode))
  15339. return -1;
  15340. @@ -60,7 +60,7 @@
  15341. /*
  15342. * If the P2P GO interface was dynamically added, then it is
  15343. -@@ -6409,8 +6410,7 @@ static int wpa_driver_nl80211_stop_ap(vo
  15344. +@@ -6770,8 +6771,7 @@ static int wpa_driver_nl80211_stop_ap(vo
  15345. struct wpa_driver_nl80211_data *drv = bss->drv;
  15346. if (!is_ap_interface(drv->nlmode))
  15347. return -1;
  15348. diff --git a/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch b/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch
  15349. index 06b005e..1e405cb 100644
  15350. --- a/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch
  15351. +++ b/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch
  15352. @@ -1,22 +1,22 @@
  15353. --- a/hostapd/ctrl_iface.c
  15354. +++ b/hostapd/ctrl_iface.c
  15355. -@@ -45,6 +45,7 @@
  15356. - #include "wps/wps.h"
  15357. +@@ -54,6 +54,7 @@
  15358. + #include "fst/fst_ctrl_iface.h"
  15359. #include "config_file.h"
  15360. #include "ctrl_iface.h"
  15361. +#include "config_file.h"
  15362. - struct wpa_ctrl_dst {
  15363. -@@ -55,6 +56,7 @@ struct wpa_ctrl_dst {
  15364. - int errors;
  15365. - };
  15366. + #define HOSTAPD_CLI_DUP_VALUE_MAX_LEN 256
  15367. +@@ -72,6 +73,7 @@ static void hostapd_ctrl_iface_send(stru
  15368. + enum wpa_msg_type type,
  15369. + const char *buf, size_t len);
  15370. +static char *reload_opts = NULL;
  15371. - static void hostapd_ctrl_iface_send(struct hostapd_data *hapd, int level,
  15372. - const char *buf, size_t len);
  15373. -@@ -164,6 +166,61 @@ static int hostapd_ctrl_iface_new_sta(st
  15374. + static int hostapd_ctrl_iface_attach(struct hostapd_data *hapd,
  15375. + struct sockaddr_storage *from,
  15376. +@@ -123,6 +125,61 @@ static int hostapd_ctrl_iface_new_sta(st
  15377. return 0;
  15378. }
  15379. @@ -78,7 +78,7 @@
  15380. #ifdef CONFIG_IEEE80211W
  15381. #ifdef NEED_AP_MLME
  15382. -@@ -2086,6 +2143,8 @@ static void hostapd_ctrl_iface_receive(i
  15383. +@@ -2483,6 +2540,8 @@ static int hostapd_ctrl_iface_receive_pr
  15384. } else if (os_strncmp(buf, "VENDOR ", 7) == 0) {
  15385. reply_len = hostapd_ctrl_iface_vendor(hapd, buf + 7, reply,
  15386. reply_size);
  15387. @@ -89,7 +89,7 @@
  15388. #ifdef RADIUS_SERVER
  15389. --- a/src/ap/ctrl_iface_ap.c
  15390. +++ b/src/ap/ctrl_iface_ap.c
  15391. -@@ -541,5 +541,11 @@ int hostapd_parse_csa_settings(const cha
  15392. +@@ -593,7 +593,13 @@ int hostapd_parse_csa_settings(const cha
  15393. int hostapd_ctrl_iface_stop_ap(struct hostapd_data *hapd)
  15394. {
  15395. @@ -102,3 +102,5 @@
  15396. +
  15397. + return 0;
  15398. }
  15399. +
  15400. +
  15401. diff --git a/package/network/services/hostapd/patches/370-ap_sta_support.patch b/package/network/services/hostapd/patches/370-ap_sta_support.patch
  15402. index ea235e6..7a4ba0b 100644
  15403. --- a/package/network/services/hostapd/patches/370-ap_sta_support.patch
  15404. +++ b/package/network/services/hostapd/patches/370-ap_sta_support.patch
  15405. @@ -1,6 +1,6 @@
  15406. --- a/wpa_supplicant/wpa_supplicant_i.h
  15407. +++ b/wpa_supplicant/wpa_supplicant_i.h
  15408. -@@ -110,6 +110,11 @@ struct wpa_interface {
  15409. +@@ -100,6 +100,11 @@ struct wpa_interface {
  15410. const char *ifname;
  15411. /**
  15412. @@ -12,8 +12,8 @@
  15413. * bridge_ifname - Optional bridge interface name
  15414. *
  15415. * If the driver interface (ifname) is included in a Linux bridge
  15416. -@@ -442,6 +447,8 @@ struct wpa_supplicant {
  15417. - #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
  15418. +@@ -484,6 +489,8 @@ struct wpa_supplicant {
  15419. + #endif /* CONFIG_CTRL_IFACE_BINDER */
  15420. char bridge_ifname[16];
  15421. + struct wpa_ctrl *hostapd;
  15422. @@ -23,7 +23,7 @@
  15423. --- a/wpa_supplicant/Makefile
  15424. +++ b/wpa_supplicant/Makefile
  15425. -@@ -14,6 +14,10 @@ CFLAGS += $(EXTRA_CFLAGS)
  15426. +@@ -26,6 +26,10 @@ CFLAGS += $(EXTRA_CFLAGS)
  15427. CFLAGS += -I$(abspath ../src)
  15428. CFLAGS += -I$(abspath ../src/utils)
  15429. @@ -34,7 +34,7 @@
  15430. -include .config
  15431. -include $(if $(MULTICALL),../hostapd/.config)
  15432. -@@ -84,6 +88,8 @@ OBJS_c += ../src/utils/wpa_debug.o
  15433. +@@ -113,6 +117,8 @@ OBJS_c += ../src/utils/wpa_debug.o
  15434. OBJS_c += ../src/utils/common.o
  15435. OBJS += wmm_ac.o
  15436. @@ -45,7 +45,7 @@
  15437. CONFIG_OS=win32
  15438. --- a/wpa_supplicant/wpa_supplicant.c
  15439. +++ b/wpa_supplicant/wpa_supplicant.c
  15440. -@@ -107,6 +107,55 @@ const char *wpa_supplicant_full_license5
  15441. +@@ -112,6 +112,55 @@ const char *const wpa_supplicant_full_li
  15442. "\n";
  15443. #endif /* CONFIG_NO_STDOUT_DEBUG */
  15444. @@ -73,7 +73,7 @@
  15445. + int ret;
  15446. +
  15447. + if (!bss)
  15448. -+ return;
  15449. ++ return -1;
  15450. +
  15451. + if (bss->ht_param & HT_INFO_HT_PARAM_STA_CHNL_WIDTH) {
  15452. + int sec = bss->ht_param & HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK;
  15453. @@ -101,7 +101,7 @@
  15454. /* Configure default/group WEP keys for static WEP */
  15455. int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
  15456. {
  15457. -@@ -743,8 +792,12 @@ void wpa_supplicant_set_state(struct wpa
  15458. +@@ -812,8 +861,12 @@ void wpa_supplicant_set_state(struct wpa
  15459. wpas_p2p_completed(wpa_s);
  15460. sme_sched_obss_scan(wpa_s, 1);
  15461. @@ -114,7 +114,7 @@
  15462. wpa_s->new_connection = 1;
  15463. wpa_drv_set_operstate(wpa_s, 0);
  15464. #ifndef IEEE8021X_EAPOL
  15465. -@@ -4038,6 +4091,20 @@ static int wpa_supplicant_init_iface(str
  15466. +@@ -4646,6 +4699,20 @@ static int wpa_supplicant_init_iface(str
  15467. sizeof(wpa_s->bridge_ifname));
  15468. }
  15469. @@ -135,7 +135,7 @@
  15470. /* RSNA Supplicant Key Management - INITIALIZE */
  15471. eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE);
  15472. eapol_sm_notify_portValid(wpa_s->eapol, FALSE);
  15473. -@@ -4280,6 +4347,11 @@ static void wpa_supplicant_deinit_iface(
  15474. +@@ -4937,6 +5004,11 @@ static void wpa_supplicant_deinit_iface(
  15475. if (terminate)
  15476. wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_TERMINATING);
  15477. @@ -157,7 +157,7 @@
  15478. #include "drivers/driver.h"
  15479. #include "wpa_supplicant_i.h"
  15480. #include "config.h"
  15481. -@@ -277,6 +278,10 @@ static void calculate_update_time(const
  15482. +@@ -287,6 +288,10 @@ static void calculate_update_time(const
  15483. static void wpa_bss_copy_res(struct wpa_bss *dst, struct wpa_scan_res *src,
  15484. struct os_reltime *fetch_time)
  15485. {
  15486. @@ -168,7 +168,7 @@
  15487. dst->flags = src->flags;
  15488. os_memcpy(dst->bssid, src->bssid, ETH_ALEN);
  15489. dst->freq = src->freq;
  15490. -@@ -289,6 +294,15 @@ static void wpa_bss_copy_res(struct wpa_
  15491. +@@ -299,6 +304,15 @@ static void wpa_bss_copy_res(struct wpa_
  15492. dst->est_throughput = src->est_throughput;
  15493. dst->snr = src->snr;
  15494. @@ -186,7 +186,7 @@
  15495. --- a/wpa_supplicant/main.c
  15496. +++ b/wpa_supplicant/main.c
  15497. -@@ -33,7 +33,7 @@ static void usage(void)
  15498. +@@ -34,7 +34,7 @@ static void usage(void)
  15499. "vW] [-P<pid file>] "
  15500. "[-g<global ctrl>] \\\n"
  15501. " [-G<group>] \\\n"
  15502. @@ -195,24 +195,24 @@
  15503. "[-p<driver_param>] \\\n"
  15504. " [-b<br_ifname>] [-e<entropy file>]"
  15505. #ifdef CONFIG_DEBUG_FILE
  15506. -@@ -84,6 +84,7 @@ static void usage(void)
  15507. - #endif /* CONFIG_DEBUG_LINUX_TRACING */
  15508. - printf(" -t = include timestamp in debug messages\n"
  15509. +@@ -74,6 +74,7 @@ static void usage(void)
  15510. + " -g = global ctrl_interface\n"
  15511. + " -G = global ctrl_interface group\n"
  15512. " -h = show this help text\n"
  15513. + " -H = connect to a hostapd instance to manage state changes\n"
  15514. - " -L = show license (BSD)\n"
  15515. - " -o = override driver parameter for new interfaces\n"
  15516. - " -O = override ctrl_interface parameter for new interfaces\n"
  15517. -@@ -175,7 +176,7 @@ int main(int argc, char *argv[])
  15518. + " -i = interface name\n"
  15519. + " -I = additional configuration file\n"
  15520. + " -K = include keys (passwords, etc.) in debug output\n"
  15521. +@@ -201,7 +202,7 @@ int main(int argc, char *argv[])
  15522. for (;;) {
  15523. c = getopt(argc, argv,
  15524. -- "b:Bc:C:D:de:f:g:G:hi:I:KLm:No:O:p:P:qsTtuvW");
  15525. -+ "b:Bc:C:D:de:f:g:G:hH:i:I:KLm:No:O:p:P:qsTtuvW");
  15526. +- "b:Bc:C:D:de:f:g:G:hi:I:KLMm:No:O:p:P:qsTtuvW");
  15527. ++ "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuvW");
  15528. if (c < 0)
  15529. break;
  15530. switch (c) {
  15531. -@@ -222,6 +223,9 @@ int main(int argc, char *argv[])
  15532. +@@ -248,6 +249,9 @@ int main(int argc, char *argv[])
  15533. usage();
  15534. exitcode = 0;
  15535. goto out;
  15536. @@ -224,8 +224,8 @@
  15537. break;
  15538. --- a/wpa_supplicant/bss.h
  15539. +++ b/wpa_supplicant/bss.h
  15540. -@@ -72,6 +72,10 @@ struct wpa_bss {
  15541. - u8 ssid[32];
  15542. +@@ -79,6 +79,10 @@ struct wpa_bss {
  15543. + u8 ssid[SSID_MAX_LEN];
  15544. /** Length of SSID */
  15545. size_t ssid_len;
  15546. + /** HT caapbilities */
  15547. 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
  15548. index 3a41b82..9e815e9 100644
  15549. --- a/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch
  15550. +++ b/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch
  15551. @@ -1,18 +1,18 @@
  15552. --- a/hostapd/Makefile
  15553. +++ b/hostapd/Makefile
  15554. -@@ -168,6 +168,9 @@ endif
  15555. +@@ -212,6 +212,9 @@ endif
  15556. ifdef CONFIG_NO_CTRL_IFACE
  15557. CFLAGS += -DCONFIG_NO_CTRL_IFACE
  15558. else
  15559. +ifdef CONFIG_CTRL_IFACE_MIB
  15560. +CFLAGS += -DCONFIG_CTRL_IFACE_MIB
  15561. +endif
  15562. - OBJS += ctrl_iface.o
  15563. - OBJS += ../src/ap/ctrl_iface_ap.o
  15564. - endif
  15565. + ifeq ($(CONFIG_CTRL_IFACE), udp)
  15566. + CFLAGS += -DCONFIG_CTRL_IFACE_UDP
  15567. + else
  15568. --- a/hostapd/ctrl_iface.c
  15569. +++ b/hostapd/ctrl_iface.c
  15570. -@@ -1953,6 +1953,7 @@ static void hostapd_ctrl_iface_receive(i
  15571. +@@ -2342,6 +2342,7 @@ static int hostapd_ctrl_iface_receive_pr
  15572. reply_size);
  15573. } else if (os_strcmp(buf, "STATUS-DRIVER") == 0) {
  15574. reply_len = hostapd_drv_status(hapd, reply, reply_size);
  15575. @@ -20,18 +20,18 @@
  15576. } else if (os_strcmp(buf, "MIB") == 0) {
  15577. reply_len = ieee802_11_get_mib(hapd, reply, reply_size);
  15578. if (reply_len >= 0) {
  15579. -@@ -1994,6 +1995,7 @@ static void hostapd_ctrl_iface_receive(i
  15580. +@@ -2383,6 +2384,7 @@ static int hostapd_ctrl_iface_receive_pr
  15581. } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) {
  15582. reply_len = hostapd_ctrl_iface_sta_next(hapd, buf + 9, reply,
  15583. reply_size);
  15584. +#endif
  15585. } else if (os_strcmp(buf, "ATTACH") == 0) {
  15586. - if (hostapd_ctrl_iface_attach(hapd, &from, fromlen))
  15587. + if (hostapd_ctrl_iface_attach(hapd, from, fromlen))
  15588. reply_len = -1;
  15589. --- a/wpa_supplicant/Makefile
  15590. +++ b/wpa_supplicant/Makefile
  15591. -@@ -837,6 +837,9 @@ ifdef CONFIG_WNM
  15592. - OBJS += ../src/ap/wnm_ap.o
  15593. +@@ -874,6 +874,9 @@ ifdef CONFIG_MBO
  15594. + OBJS += ../src/ap/mbo_ap.o
  15595. endif
  15596. ifdef CONFIG_CTRL_IFACE
  15597. +ifdef CONFIG_CTRL_IFACE_MIB
  15598. @@ -42,7 +42,7 @@
  15599. --- a/wpa_supplicant/ctrl_iface.c
  15600. +++ b/wpa_supplicant/ctrl_iface.c
  15601. -@@ -1795,7 +1795,7 @@ static int wpa_supplicant_ctrl_iface_sta
  15602. +@@ -1895,7 +1895,7 @@ static int wpa_supplicant_ctrl_iface_sta
  15603. pos += ret;
  15604. }
  15605. @@ -51,7 +51,7 @@
  15606. if (wpa_s->ap_iface) {
  15607. pos += ap_ctrl_iface_wpa_get_status(wpa_s, pos,
  15608. end - pos,
  15609. -@@ -7896,6 +7896,7 @@ char * wpa_supplicant_ctrl_iface_process
  15610. +@@ -8687,6 +8687,7 @@ char * wpa_supplicant_ctrl_iface_process
  15611. reply_len = -1;
  15612. } else if (os_strncmp(buf, "NOTE ", 5) == 0) {
  15613. wpa_printf(MSG_INFO, "NOTE: %s", buf + 5);
  15614. @@ -59,7 +59,7 @@
  15615. } else if (os_strcmp(buf, "MIB") == 0) {
  15616. reply_len = wpa_sm_get_mib(wpa_s->wpa, reply, reply_size);
  15617. if (reply_len >= 0) {
  15618. -@@ -7903,6 +7904,7 @@ char * wpa_supplicant_ctrl_iface_process
  15619. +@@ -8694,6 +8695,7 @@ char * wpa_supplicant_ctrl_iface_process
  15620. reply + reply_len,
  15621. reply_size - reply_len);
  15622. }
  15623. @@ -67,7 +67,7 @@
  15624. } else if (os_strncmp(buf, "STATUS", 6) == 0) {
  15625. reply_len = wpa_supplicant_ctrl_iface_status(
  15626. wpa_s, buf + 6, reply, reply_size);
  15627. -@@ -8353,6 +8355,7 @@ char * wpa_supplicant_ctrl_iface_process
  15628. +@@ -9164,6 +9166,7 @@ char * wpa_supplicant_ctrl_iface_process
  15629. reply_len = wpa_supplicant_ctrl_iface_bss(
  15630. wpa_s, buf + 4, reply, reply_size);
  15631. #ifdef CONFIG_AP
  15632. @@ -75,7 +75,7 @@
  15633. } else if (os_strcmp(buf, "STA-FIRST") == 0) {
  15634. reply_len = ap_ctrl_iface_sta_first(wpa_s, reply, reply_size);
  15635. } else if (os_strncmp(buf, "STA ", 4) == 0) {
  15636. -@@ -8361,12 +8364,15 @@ char * wpa_supplicant_ctrl_iface_process
  15637. +@@ -9172,12 +9175,15 @@ char * wpa_supplicant_ctrl_iface_process
  15638. } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) {
  15639. reply_len = ap_ctrl_iface_sta_next(wpa_s, buf + 9, reply,
  15640. reply_size);
  15641. @@ -93,15 +93,15 @@
  15642. reply_len = -1;
  15643. --- a/src/ap/ctrl_iface_ap.c
  15644. +++ b/src/ap/ctrl_iface_ap.c
  15645. -@@ -22,6 +22,7 @@
  15646. - #include "ctrl_iface_ap.h"
  15647. +@@ -24,6 +24,7 @@
  15648. #include "ap_drv_ops.h"
  15649. + #include "mbo_ap.h"
  15650. +#ifdef CONFIG_CTRL_IFACE_MIB
  15651. static int hostapd_get_sta_tx_rx(struct hostapd_data *hapd,
  15652. struct sta_info *sta,
  15653. -@@ -224,6 +225,7 @@ int hostapd_ctrl_iface_sta_next(struct h
  15654. +@@ -249,6 +250,7 @@ int hostapd_ctrl_iface_sta_next(struct h
  15655. return hostapd_ctrl_iface_sta_mib(hapd, sta->next, buf, buflen);
  15656. }
  15657. @@ -111,33 +111,33 @@
  15658. static int p2p_manager_disconnect(struct hostapd_data *hapd, u16 stype,
  15659. --- a/src/ap/ieee802_1x.c
  15660. +++ b/src/ap/ieee802_1x.c
  15661. -@@ -2337,6 +2337,7 @@ static const char * bool_txt(Boolean boo
  15662. - return bool_val ? "TRUE" : "FALSE";
  15663. +@@ -2441,6 +2441,7 @@ static const char * bool_txt(Boolean val
  15664. + return val ? "TRUE" : "FALSE";
  15665. }
  15666. +#ifdef CONFIG_CTRL_IFACE_MIB
  15667. int ieee802_1x_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen)
  15668. {
  15669. -@@ -2512,6 +2513,7 @@ int ieee802_1x_get_mib_sta(struct hostap
  15670. +@@ -2616,6 +2617,7 @@ int ieee802_1x_get_mib_sta(struct hostap
  15671. return len;
  15672. }
  15673. +#endif
  15674. - static void ieee802_1x_finished(struct hostapd_data *hapd,
  15675. - struct sta_info *sta, int success,
  15676. + #ifdef CONFIG_HS20
  15677. + static void ieee802_1x_wnm_notif_send(void *eloop_ctx, void *timeout_ctx)
  15678. --- a/src/ap/wpa_auth.c
  15679. +++ b/src/ap/wpa_auth.c
  15680. -@@ -2999,6 +2999,7 @@ static const char * wpa_bool_txt(int boo
  15681. - return bool ? "TRUE" : "FALSE";
  15682. +@@ -3069,6 +3069,7 @@ static const char * wpa_bool_txt(int val
  15683. + return val ? "TRUE" : "FALSE";
  15684. }
  15685. +#ifdef CONFIG_CTRL_IFACE_MIB
  15686. #define RSN_SUITE "%02x-%02x-%02x-%d"
  15687. #define RSN_SUITE_ARG(s) \
  15688. -@@ -3143,7 +3144,7 @@ int wpa_get_mib_sta(struct wpa_state_mac
  15689. +@@ -3213,7 +3214,7 @@ int wpa_get_mib_sta(struct wpa_state_mac
  15690. return len;
  15691. }
  15692. @@ -148,7 +148,7 @@
  15693. {
  15694. --- a/src/rsn_supp/wpa.c
  15695. +++ b/src/rsn_supp/wpa.c
  15696. -@@ -2032,6 +2032,8 @@ static u32 wpa_key_mgmt_suite(struct wpa
  15697. +@@ -2108,6 +2108,8 @@ static u32 wpa_key_mgmt_suite(struct wpa
  15698. }
  15699. @@ -157,7 +157,7 @@
  15700. #define RSN_SUITE "%02x-%02x-%02x-%d"
  15701. #define RSN_SUITE_ARG(s) \
  15702. ((s) >> 24) & 0xff, ((s) >> 16) & 0xff, ((s) >> 8) & 0xff, (s) & 0xff
  15703. -@@ -2115,6 +2117,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch
  15704. +@@ -2191,6 +2193,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch
  15705. return (int) len;
  15706. }
  15707. @@ -167,7 +167,7 @@
  15708. --- a/wpa_supplicant/ap.c
  15709. +++ b/wpa_supplicant/ap.c
  15710. -@@ -1015,7 +1015,7 @@ int wpas_ap_wps_nfc_report_handover(stru
  15711. +@@ -1114,7 +1114,7 @@ int wpas_ap_wps_nfc_report_handover(stru
  15712. #endif /* CONFIG_WPS */
  15713. 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
  15714. index 1065a7f..c9e7bf4 100644
  15715. --- a/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch
  15716. +++ b/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch
  15717. @@ -1,6 +1,6 @@
  15718. --- a/src/common/wpa_common.c
  15719. +++ b/src/common/wpa_common.c
  15720. -@@ -1228,6 +1228,31 @@ u32 wpa_akm_to_suite(int akm)
  15721. +@@ -1244,6 +1244,31 @@ u32 wpa_akm_to_suite(int akm)
  15722. }
  15723. @@ -32,7 +32,7 @@
  15724. int wpa_compare_rsn_ie(int ft_initial_assoc,
  15725. const u8 *ie1, size_t ie1len,
  15726. const u8 *ie2, size_t ie2len)
  15727. -@@ -1235,8 +1260,19 @@ int wpa_compare_rsn_ie(int ft_initial_as
  15728. +@@ -1251,8 +1276,19 @@ int wpa_compare_rsn_ie(int ft_initial_as
  15729. if (ie1 == NULL || ie2 == NULL)
  15730. return -1;
  15731. 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
  15732. index 083af5b..f5872cd 100644
  15733. --- a/package/network/services/hostapd/patches/400-wps_single_auth_enc_type.patch
  15734. +++ b/package/network/services/hostapd/patches/400-wps_single_auth_enc_type.patch
  15735. @@ -1,25 +1,22 @@
  15736. --- a/src/ap/wps_hostapd.c
  15737. +++ b/src/ap/wps_hostapd.c
  15738. -@@ -1052,11 +1052,9 @@ int hostapd_init_wps(struct hostapd_data
  15739. -
  15740. - if (conf->rsn_pairwise & (WPA_CIPHER_CCMP | WPA_CIPHER_GCMP))
  15741. +@@ -352,8 +352,7 @@ static int hapd_wps_reconfig_in_memory(s
  15742. + bss->wpa_pairwise |= WPA_CIPHER_GCMP;
  15743. + else
  15744. + bss->wpa_pairwise |= WPA_CIPHER_CCMP;
  15745. +- }
  15746. +- if (cred->encr_type & WPS_ENCR_TKIP)
  15747. ++ } else if (cred->encr_type & WPS_ENCR_TKIP)
  15748. + bss->wpa_pairwise |= WPA_CIPHER_TKIP;
  15749. + bss->rsn_pairwise = bss->wpa_pairwise;
  15750. + bss->wpa_group = wpa_select_ap_group_cipher(bss->wpa,
  15751. +@@ -1073,8 +1072,7 @@ int hostapd_init_wps(struct hostapd_data
  15752. + if (conf->rsn_pairwise & (WPA_CIPHER_CCMP | WPA_CIPHER_GCMP)) {
  15753. wps->encr_types |= WPS_ENCR_AES;
  15754. -- if (conf->rsn_pairwise & WPA_CIPHER_TKIP)
  15755. -+ else if (conf->rsn_pairwise & WPA_CIPHER_TKIP)
  15756. + wps->encr_types_rsn |= WPS_ENCR_AES;
  15757. +- }
  15758. +- if (conf->rsn_pairwise & WPA_CIPHER_TKIP) {
  15759. ++ } else if (conf->rsn_pairwise & WPA_CIPHER_TKIP) {
  15760. wps->encr_types |= WPS_ENCR_TKIP;
  15761. -- }
  15762. --
  15763. -- if (conf->wpa & WPA_PROTO_WPA) {
  15764. -+ } else if (conf->wpa & WPA_PROTO_WPA) {
  15765. - if (conf->wpa_key_mgmt & WPA_KEY_MGMT_PSK)
  15766. - wps->auth_types |= WPS_AUTH_WPAPSK;
  15767. - if (conf->wpa_key_mgmt & WPA_KEY_MGMT_IEEE8021X)
  15768. -@@ -1064,7 +1062,7 @@ int hostapd_init_wps(struct hostapd_data
  15769. -
  15770. - if (conf->wpa_pairwise & WPA_CIPHER_CCMP)
  15771. - wps->encr_types |= WPS_ENCR_AES;
  15772. -- if (conf->wpa_pairwise & WPA_CIPHER_TKIP)
  15773. -+ else if (conf->wpa_pairwise & WPA_CIPHER_TKIP)
  15774. - wps->encr_types |= WPS_ENCR_TKIP;
  15775. - }
  15776. -
  15777. + wps->encr_types_rsn |= WPS_ENCR_TKIP;
  15778. + }
  15779. diff --git a/package/network/services/hostapd/patches/410-limit_debug_messages.patch b/package/network/services/hostapd/patches/410-limit_debug_messages.patch
  15780. index da88732..a48b696 100644
  15781. --- a/package/network/services/hostapd/patches/410-limit_debug_messages.patch
  15782. +++ b/package/network/services/hostapd/patches/410-limit_debug_messages.patch
  15783. @@ -64,7 +64,7 @@
  15784. #ifdef CONFIG_DEBUG_FILE
  15785. static char *last_path = NULL;
  15786. #endif /* CONFIG_DEBUG_FILE */
  15787. -@@ -602,7 +576,7 @@ void wpa_msg_register_ifname_cb(wpa_msg_
  15788. +@@ -604,7 +578,7 @@ void wpa_msg_register_ifname_cb(wpa_msg_
  15789. }
  15790. @@ -73,7 +73,7 @@
  15791. {
  15792. va_list ap;
  15793. char *buf;
  15794. -@@ -640,7 +614,7 @@ void wpa_msg(void *ctx, int level, const
  15795. +@@ -642,7 +616,7 @@ void wpa_msg(void *ctx, int level, const
  15796. }
  15797. @@ -183,7 +183,7 @@
  15798. /*
  15799. * wpa_dbg() behaves like wpa_msg(), but it can be removed from build to reduce
  15800. -@@ -181,7 +222,12 @@ void wpa_hexdump_ascii_key(int level, co
  15801. +@@ -182,7 +223,12 @@ void wpa_hexdump_ascii_key(int level, co
  15802. *
  15803. * Note: New line '\n' is added to the end of the text when printing to stdout.
  15804. */
  15805. @@ -197,7 +197,7 @@
  15806. /**
  15807. * wpa_msg_ctrl - Conditional printf for ctrl_iface monitors
  15808. -@@ -195,8 +241,13 @@ void wpa_msg(void *ctx, int level, const
  15809. +@@ -196,8 +242,13 @@ void wpa_msg(void *ctx, int level, const
  15810. * attached ctrl_iface monitors. In other words, it can be used for frequent
  15811. * events that do not need to be sent to syslog.
  15812. */
  15813. diff --git a/package/network/services/hostapd/patches/420-indicate-features.patch b/package/network/services/hostapd/patches/420-indicate-features.patch
  15814. index 64c92df..335e71e 100644
  15815. --- a/package/network/services/hostapd/patches/420-indicate-features.patch
  15816. +++ b/package/network/services/hostapd/patches/420-indicate-features.patch
  15817. @@ -8,16 +8,16 @@
  15818. #include "crypto/random.h"
  15819. #include "crypto/tls.h"
  15820. #include "common/version.h"
  15821. -@@ -567,7 +568,7 @@ int main(int argc, char *argv[])
  15822. -
  15823. +@@ -668,7 +669,7 @@ int main(int argc, char *argv[])
  15824. wpa_supplicant_event = hostapd_wpa_event;
  15825. + wpa_supplicant_event_global = hostapd_wpa_event_global;
  15826. for (;;) {
  15827. -- c = getopt(argc, argv, "b:Bde:f:hKP:Ttu:vg:G:");
  15828. -+ c = getopt(argc, argv, "b:Bde:f:hKP:Ttu:g:G:v::");
  15829. +- c = getopt(argc, argv, "b:Bde:f:hi:KP:STtu:vg:G:");
  15830. ++ c = getopt(argc, argv, "b:Bde:f:hi:KP:STtu:g:G:v::");
  15831. if (c < 0)
  15832. break;
  15833. switch (c) {
  15834. -@@ -604,6 +605,8 @@ int main(int argc, char *argv[])
  15835. +@@ -705,6 +706,8 @@ int main(int argc, char *argv[])
  15836. break;
  15837. #endif /* CONFIG_DEBUG_LINUX_TRACING */
  15838. case 'v':
  15839. @@ -33,19 +33,19 @@
  15840. #include "common.h"
  15841. +#include "build_features.h"
  15842. + #include "fst/fst.h"
  15843. #include "wpa_supplicant_i.h"
  15844. #include "driver_i.h"
  15845. - #include "p2p_supplicant.h"
  15846. -@@ -176,7 +177,7 @@ int main(int argc, char *argv[])
  15847. +@@ -202,7 +203,7 @@ int main(int argc, char *argv[])
  15848. for (;;) {
  15849. c = getopt(argc, argv,
  15850. -- "b:Bc:C:D:de:f:g:G:hH:i:I:KLm:No:O:p:P:qsTtuvW");
  15851. -+ "b:Bc:C:D:de:f:g:G:hH:i:I:KLm:No:O:p:P:qsTtuv::W");
  15852. +- "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuvW");
  15853. ++ "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuv::W");
  15854. if (c < 0)
  15855. break;
  15856. switch (c) {
  15857. -@@ -279,8 +280,12 @@ int main(int argc, char *argv[])
  15858. +@@ -305,8 +306,12 @@ int main(int argc, char *argv[])
  15859. break;
  15860. #endif /* CONFIG_DBUS */
  15861. case 'v':
  15862. diff --git a/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch b/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch
  15863. index 85d2e16..d07b747 100644
  15864. --- a/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch
  15865. +++ b/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch
  15866. @@ -1,6 +1,6 @@
  15867. --- a/hostapd/hostapd_cli.c
  15868. +++ b/hostapd/hostapd_cli.c
  15869. -@@ -67,7 +67,6 @@ static const char *commands_help =
  15870. +@@ -69,7 +69,6 @@ static const char *const commands_help =
  15871. #ifdef CONFIG_IEEE80211W
  15872. " sa_query <addr> send SA Query to a station\n"
  15873. #endif /* CONFIG_IEEE80211W */
  15874. @@ -8,7 +8,7 @@
  15875. " wps_pin <uuid> <pin> [timeout] [addr] add WPS Enrollee PIN\n"
  15876. " wps_check_pin <PIN> verify PIN checksum\n"
  15877. " wps_pbc indicate button pushed to initiate PBC\n"
  15878. -@@ -80,7 +79,6 @@ static const char *commands_help =
  15879. +@@ -82,7 +81,6 @@ static const char *const commands_help =
  15880. " wps_ap_pin <cmd> [params..] enable/disable AP PIN\n"
  15881. " wps_config <SSID> <auth> <encr> <key> configure AP\n"
  15882. " wps_get_status show current WPS status\n"
  15883. @@ -16,7 +16,7 @@
  15884. " get_config show current configuration\n"
  15885. " help show this usage help\n"
  15886. " interface [ifname] show interfaces/select interface\n"
  15887. -@@ -353,7 +351,6 @@ static int hostapd_cli_cmd_sa_query(stru
  15888. +@@ -418,7 +416,6 @@ static int hostapd_cli_cmd_sa_query(stru
  15889. #endif /* CONFIG_IEEE80211W */
  15890. @@ -24,7 +24,7 @@
  15891. static int hostapd_cli_cmd_wps_pin(struct wpa_ctrl *ctrl, int argc,
  15892. char *argv[])
  15893. {
  15894. -@@ -579,7 +576,6 @@ static int hostapd_cli_cmd_wps_config(st
  15895. +@@ -644,7 +641,6 @@ static int hostapd_cli_cmd_wps_config(st
  15896. ssid_hex, argv[1]);
  15897. return wpa_ctrl_command(ctrl, buf);
  15898. }
  15899. @@ -32,7 +32,7 @@
  15900. static int hostapd_cli_cmd_disassoc_imminent(struct wpa_ctrl *ctrl, int argc,
  15901. -@@ -1027,7 +1023,6 @@ static struct hostapd_cli_cmd hostapd_cl
  15902. +@@ -1236,7 +1232,6 @@ static const struct hostapd_cli_cmd host
  15903. #ifdef CONFIG_IEEE80211W
  15904. { "sa_query", hostapd_cli_cmd_sa_query },
  15905. #endif /* CONFIG_IEEE80211W */
  15906. @@ -40,7 +40,7 @@
  15907. { "wps_pin", hostapd_cli_cmd_wps_pin },
  15908. { "wps_check_pin", hostapd_cli_cmd_wps_check_pin },
  15909. { "wps_pbc", hostapd_cli_cmd_wps_pbc },
  15910. -@@ -1041,7 +1036,6 @@ static struct hostapd_cli_cmd hostapd_cl
  15911. +@@ -1250,7 +1245,6 @@ static const struct hostapd_cli_cmd host
  15912. { "wps_ap_pin", hostapd_cli_cmd_wps_ap_pin },
  15913. { "wps_config", hostapd_cli_cmd_wps_config },
  15914. { "wps_get_status", hostapd_cli_cmd_wps_get_status },
  15915. diff --git a/package/network/services/hostapd/patches/431-wpa_cli_ifdef.patch b/package/network/services/hostapd/patches/431-wpa_cli_ifdef.patch
  15916. index 874ff4b..256f6b5 100644
  15917. --- a/package/network/services/hostapd/patches/431-wpa_cli_ifdef.patch
  15918. +++ b/package/network/services/hostapd/patches/431-wpa_cli_ifdef.patch
  15919. @@ -1,13 +1,12 @@
  15920. --- a/wpa_supplicant/wpa_cli.c
  15921. +++ b/wpa_supplicant/wpa_cli.c
  15922. -@@ -26,6 +26,10 @@
  15923. +@@ -25,6 +25,9 @@
  15924. + #include <cutils/properties.h>
  15925. #endif /* ANDROID */
  15926. -
  15927. +#ifndef CONFIG_P2P
  15928. +#define CONFIG_P2P
  15929. +#endif
  15930. -+
  15931. - static const char *wpa_cli_version =
  15932. +
  15933. + static const char *const wpa_cli_version =
  15934. "wpa_cli v" VERSION_STR "\n"
  15935. - "Copyright (c) 2004-2015, Jouni Malinen <j@w1.fi> and contributors";
  15936. diff --git a/package/network/services/hostapd/patches/432-missing-typedef.patch b/package/network/services/hostapd/patches/432-missing-typedef.patch
  15937. new file mode 100644
  15938. index 0000000..7a100f1
  15939. --- /dev/null
  15940. +++ b/package/network/services/hostapd/patches/432-missing-typedef.patch
  15941. @@ -0,0 +1,10 @@
  15942. +--- a/src/drivers/linux_wext.h
  15943. ++++ b/src/drivers/linux_wext.h
  15944. +@@ -26,6 +26,7 @@ typedef int32_t __s32;
  15945. + typedef uint16_t __u16;
  15946. + typedef int16_t __s16;
  15947. + typedef uint8_t __u8;
  15948. ++typedef int8_t __s8;
  15949. + #ifndef __user
  15950. + #define __user
  15951. + #endif /* __user */
  15952. 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
  15953. deleted file mode 100644
  15954. index 74aef26..0000000
  15955. --- a/package/network/services/hostapd/patches/440-max_num_sta_probe.patch
  15956. +++ /dev/null
  15957. @@ -1,13 +0,0 @@
  15958. ---- a/src/ap/beacon.c
  15959. -+++ b/src/ap/beacon.c
  15960. -@@ -664,6 +664,10 @@ void handle_probe_req(struct hostapd_dat
  15961. - return;
  15962. - }
  15963. -
  15964. -+ if (!sta && hapd->num_sta >= hapd->conf->max_num_sta)
  15965. -+ wpa_printf(MSG_MSGDUMP, "Probe Request from " MACSTR " ignored,"
  15966. -+ " too many connected stations.", MAC2STR(mgmt->sa));
  15967. -+
  15968. - #ifdef CONFIG_INTERWORKING
  15969. - if (hapd->conf->interworking &&
  15970. - elems.interworking && elems.interworking_len >= 1) {
  15971. diff --git a/package/network/services/hostapd/patches/450-scan_wait.patch b/package/network/services/hostapd/patches/450-scan_wait.patch
  15972. index 87ebd45..78cf306 100644
  15973. --- a/package/network/services/hostapd/patches/450-scan_wait.patch
  15974. +++ b/package/network/services/hostapd/patches/450-scan_wait.patch
  15975. @@ -1,6 +1,6 @@
  15976. --- a/hostapd/main.c
  15977. +++ b/hostapd/main.c
  15978. -@@ -36,6 +36,8 @@ struct hapd_global {
  15979. +@@ -37,6 +37,8 @@ struct hapd_global {
  15980. };
  15981. static struct hapd_global global;
  15982. @@ -9,7 +9,7 @@
  15983. #ifndef CONFIG_NO_HOSTAPD_LOGGER
  15984. -@@ -142,6 +144,14 @@ static void hostapd_logger_cb(void *ctx,
  15985. +@@ -143,6 +145,14 @@ static void hostapd_logger_cb(void *ctx,
  15986. }
  15987. #endif /* CONFIG_NO_HOSTAPD_LOGGER */
  15988. @@ -24,7 +24,7 @@
  15989. /**
  15990. * hostapd_driver_init - Preparate driver interface
  15991. -@@ -160,6 +170,8 @@ static int hostapd_driver_init(struct ho
  15992. +@@ -161,6 +171,8 @@ static int hostapd_driver_init(struct ho
  15993. return -1;
  15994. }
  15995. @@ -33,7 +33,7 @@
  15996. /* Initialize the driver interface */
  15997. if (!(b[0] | b[1] | b[2] | b[3] | b[4] | b[5]))
  15998. b = NULL;
  15999. -@@ -381,8 +393,6 @@ static void hostapd_global_deinit(const
  16000. +@@ -401,8 +413,6 @@ static void hostapd_global_deinit(const
  16001. #endif /* CONFIG_NATIVE_WINDOWS */
  16002. eap_server_unregister_methods();
  16003. @@ -42,19 +42,26 @@
  16004. }
  16005. -@@ -408,11 +418,6 @@ static int hostapd_global_run(struct hap
  16006. +@@ -428,18 +438,6 @@ static int hostapd_global_run(struct hap
  16007. }
  16008. #endif /* EAP_SERVER_TNC */
  16009. -- if (daemonize && os_daemonize(pid_file)) {
  16010. -- wpa_printf(MSG_ERROR, "daemon: %s", strerror(errno));
  16011. -- return -1;
  16012. +- if (daemonize) {
  16013. +- if (os_daemonize(pid_file)) {
  16014. +- wpa_printf(MSG_ERROR, "daemon: %s", strerror(errno));
  16015. +- return -1;
  16016. +- }
  16017. +- if (eloop_sock_requeue()) {
  16018. +- wpa_printf(MSG_ERROR, "eloop_sock_requeue: %s",
  16019. +- strerror(errno));
  16020. +- return -1;
  16021. +- }
  16022. - }
  16023. -
  16024. eloop_run();
  16025. return 0;
  16026. -@@ -542,8 +547,7 @@ int main(int argc, char *argv[])
  16027. +@@ -638,8 +636,7 @@ int main(int argc, char *argv[])
  16028. struct hapd_interfaces interfaces;
  16029. int ret = 1;
  16030. size_t i, j;
  16031. 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
  16032. index 217e701..6a5866e 100644
  16033. --- a/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch
  16034. +++ b/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch
  16035. @@ -18,15 +18,15 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  16036. #define WPA_SUPPLICANT_DRIVER_VERSION 4
  16037. -+#include "drivers/nl80211_copy.h"
  16038. ++#include "ap/sta_info.h"
  16039. #include "common/defs.h"
  16040. + #include "common/ieee802_11_defs.h"
  16041. #include "utils/list.h"
  16042. -
  16043. -@@ -538,6 +539,9 @@ struct wpa_driver_associate_params {
  16044. +@@ -587,6 +588,9 @@ struct wpa_driver_associate_params {
  16045. * responsible for selecting with which BSS to associate. */
  16046. const u8 *bssid;
  16047. -+ unsigned char rates[NL80211_MAX_SUPP_RATES];
  16048. ++ unsigned char rates[WLAN_SUPP_RATES_MAX];
  16049. + int mcast_rate;
  16050. +
  16051. /**
  16052. @@ -34,15 +34,15 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  16053. *
  16054. --- a/wpa_supplicant/config.c
  16055. +++ b/wpa_supplicant/config.c
  16056. -@@ -15,6 +15,7 @@
  16057. - #include "rsn_supp/wpa.h"
  16058. +@@ -16,6 +16,7 @@
  16059. #include "eap_peer/eap.h"
  16060. #include "p2p/p2p.h"
  16061. -+#include "drivers/nl80211_copy.h"
  16062. + #include "fst/fst.h"
  16063. ++#include "ap/sta_info.h"
  16064. #include "config.h"
  16065. -@@ -1722,6 +1723,97 @@ static char * wpa_config_write_mesh_basi
  16066. +@@ -1816,6 +1817,97 @@ static char * wpa_config_write_mesh_basi
  16067. #endif /* CONFIG_MESH */
  16068. @@ -88,7 +88,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  16069. + pos = (char *)value;
  16070. + r = strtok_r(pos, ",", &sptr);
  16071. + i = 0;
  16072. -+ while (pos && i < NL80211_MAX_SUPP_RATES) {
  16073. ++ while (pos && i < WLAN_SUPP_RATES_MAX) {
  16074. + rate = 0.0;
  16075. + if (r)
  16076. + rate = strtod(r, &end);
  16077. @@ -113,11 +113,11 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  16078. + if (ssid->rates[0] <= 0)
  16079. + return NULL;
  16080. +
  16081. -+ value = os_malloc(6 * NL80211_MAX_SUPP_RATES + 1);
  16082. ++ value = os_malloc(6 * WLAN_SUPP_RATES_MAX + 1);
  16083. + if (value == NULL)
  16084. + return NULL;
  16085. + pos = value;
  16086. -+ for (i = 0; i < NL80211_MAX_SUPP_RATES - 1; i++) {
  16087. ++ for (i = 0; i < WLAN_SUPP_RATES_MAX - 1; i++) {
  16088. + res = os_snprintf(pos, 6, "%.1f,", (double)ssid->rates[i] / 2);
  16089. + if (res < 0) {
  16090. + os_free(value);
  16091. @@ -126,13 +126,13 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  16092. + pos += res;
  16093. + }
  16094. + res = os_snprintf(pos, 6, "%.1f",
  16095. -+ (double)ssid->rates[NL80211_MAX_SUPP_RATES - 1] / 2);
  16096. ++ (double)ssid->rates[WLAN_SUPP_RATES_MAX - 1] / 2);
  16097. + if (res < 0) {
  16098. + os_free(value);
  16099. + return NULL;
  16100. + }
  16101. +
  16102. -+ value[6 * NL80211_MAX_SUPP_RATES] = '\0';
  16103. ++ value[6 * WLAN_SUPP_RATES_MAX] = '\0';
  16104. + return value;
  16105. +}
  16106. +#endif /* NO_CONFIG_WRITE */
  16107. @@ -140,7 +140,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  16108. /* Helper macros for network block parser */
  16109. #ifdef OFFSET
  16110. -@@ -1947,6 +2039,9 @@ static const struct parse_data ssid_fiel
  16111. +@@ -2047,6 +2139,9 @@ static const struct parse_data ssid_fiel
  16112. { INT(ap_max_inactivity) },
  16113. { INT(dtim_period) },
  16114. { INT(beacon_int) },
  16115. @@ -152,19 +152,22 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  16116. #endif /* CONFIG_MACSEC */
  16117. --- a/wpa_supplicant/config_ssid.h
  16118. +++ b/wpa_supplicant/config_ssid.h
  16119. -@@ -12,6 +12,7 @@
  16120. +@@ -10,8 +10,10 @@
  16121. + #define CONFIG_SSID_H
  16122. +
  16123. #include "common/defs.h"
  16124. ++#include "ap/sta_info.h"
  16125. #include "utils/list.h"
  16126. #include "eap_peer/eap_config.h"
  16127. +#include "drivers/nl80211_copy.h"
  16128. - #define MAX_SSID_LEN 32
  16129. -@@ -675,6 +676,9 @@ struct wpa_ssid {
  16130. + #define DEFAULT_EAP_WORKAROUND ((unsigned int) -1)
  16131. +@@ -711,6 +713,9 @@ struct wpa_ssid {
  16132. */
  16133. void *parent_cred;
  16134. -+ unsigned char rates[NL80211_MAX_SUPP_RATES];
  16135. ++ unsigned char rates[WLAN_SUPP_RATES_MAX];
  16136. + double mcast_rate;
  16137. +
  16138. #ifdef CONFIG_MACSEC
  16139. @@ -172,13 +175,13 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  16140. * macsec_policy - Determines the policy for MACsec secure session
  16141. --- a/wpa_supplicant/wpa_supplicant.c
  16142. +++ b/wpa_supplicant/wpa_supplicant.c
  16143. -@@ -2266,6 +2266,13 @@ static void wpas_start_assoc_cb(struct w
  16144. +@@ -2518,6 +2518,13 @@ static void wpas_start_assoc_cb(struct w
  16145. params.beacon_int = ssid->beacon_int;
  16146. else
  16147. params.beacon_int = wpa_s->conf->beacon_int;
  16148. + params.fixed_freq = ssid->fixed_freq;
  16149. + i = 0;
  16150. -+ while (i < NL80211_MAX_SUPP_RATES) {
  16151. ++ while (i < WLAN_SUPP_RATES_MAX) {
  16152. + params.rates[i] = ssid->rates[i];
  16153. + i++;
  16154. + }
  16155. 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
  16156. index 730cc31..459bdb9 100644
  16157. --- a/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch
  16158. +++ b/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch
  16159. @@ -10,7 +10,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  16160. --- a/src/drivers/driver_nl80211.c
  16161. +++ b/src/drivers/driver_nl80211.c
  16162. -@@ -4398,7 +4398,7 @@ static int wpa_driver_nl80211_ibss(struc
  16163. +@@ -4644,7 +4644,7 @@ static int wpa_driver_nl80211_ibss(struc
  16164. struct wpa_driver_associate_params *params)
  16165. {
  16166. struct nl_msg *msg;
  16167. @@ -19,7 +19,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  16168. int count = 0;
  16169. wpa_printf(MSG_DEBUG, "nl80211: Join IBSS (ifindex=%d)", drv->ifindex);
  16170. -@@ -4425,6 +4425,37 @@ retry:
  16171. +@@ -4671,6 +4671,37 @@ retry:
  16172. nl80211_put_beacon_int(msg, params->beacon_int))
  16173. goto fail;
  16174. 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
  16175. index 30bb2dc..80fe49c 100644
  16176. --- a/package/network/services/hostapd/patches/462-wpa_s-support-htmode-param.patch
  16177. +++ b/package/network/services/hostapd/patches/462-wpa_s-support-htmode-param.patch
  16178. @@ -16,9 +16,9 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  16179. --- a/src/drivers/driver.h
  16180. +++ b/src/drivers/driver.h
  16181. -@@ -541,6 +541,8 @@ struct wpa_driver_associate_params {
  16182. +@@ -590,6 +590,8 @@ struct wpa_driver_associate_params {
  16183. - unsigned char rates[NL80211_MAX_SUPP_RATES];
  16184. + unsigned char rates[WLAN_SUPP_RATES_MAX];
  16185. int mcast_rate;
  16186. + int ht_set;
  16187. + unsigned int htmode;
  16188. @@ -27,7 +27,7 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  16189. * bssid_hint - BSSID of a proposed AP
  16190. --- a/src/drivers/driver_nl80211.c
  16191. +++ b/src/drivers/driver_nl80211.c
  16192. -@@ -4456,6 +4456,22 @@ retry:
  16193. +@@ -4702,6 +4702,22 @@ retry:
  16194. nla_put_u32(msg, NL80211_ATTR_MCAST_RATE, params->mcast_rate);
  16195. }
  16196. @@ -52,7 +52,7 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  16197. goto fail;
  16198. --- a/wpa_supplicant/config.c
  16199. +++ b/wpa_supplicant/config.c
  16200. -@@ -1754,6 +1754,71 @@ static char * wpa_config_write_mcast_rat
  16201. +@@ -1848,6 +1848,71 @@ static char * wpa_config_write_mcast_rat
  16202. }
  16203. #endif /* NO_CONFIG_WRITE */
  16204. @@ -124,7 +124,7 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  16205. static int wpa_config_parse_rates(const struct parse_data *data,
  16206. struct wpa_ssid *ssid, int line,
  16207. const char *value)
  16208. -@@ -2042,6 +2107,7 @@ static const struct parse_data ssid_fiel
  16209. +@@ -2142,6 +2207,7 @@ static const struct parse_data ssid_fiel
  16210. { INT_RANGE(fixed_freq, 0, 1) },
  16211. { FUNC(rates) },
  16212. { FUNC(mcast_rate) },
  16213. @@ -134,9 +134,9 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  16214. #endif /* CONFIG_MACSEC */
  16215. --- a/wpa_supplicant/config_ssid.h
  16216. +++ b/wpa_supplicant/config_ssid.h
  16217. -@@ -678,6 +678,8 @@ struct wpa_ssid {
  16218. +@@ -715,6 +715,8 @@ struct wpa_ssid {
  16219. - unsigned char rates[NL80211_MAX_SUPP_RATES];
  16220. + unsigned char rates[WLAN_SUPP_RATES_MAX];
  16221. double mcast_rate;
  16222. + int ht_set;
  16223. + unsigned int htmode;
  16224. @@ -145,7 +145,7 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  16225. /**
  16226. --- a/wpa_supplicant/wpa_supplicant.c
  16227. +++ b/wpa_supplicant/wpa_supplicant.c
  16228. -@@ -2273,6 +2273,8 @@ static void wpas_start_assoc_cb(struct w
  16229. +@@ -2525,6 +2525,8 @@ static void wpas_start_assoc_cb(struct w
  16230. i++;
  16231. }
  16232. params.mcast_rate = ssid->mcast_rate;
  16233. diff --git a/package/network/services/hostapd/patches/470-survey_data_fallback.patch b/package/network/services/hostapd/patches/470-survey_data_fallback.patch
  16234. new file mode 100644
  16235. index 0000000..4e40a87
  16236. --- /dev/null
  16237. +++ b/package/network/services/hostapd/patches/470-survey_data_fallback.patch
  16238. @@ -0,0 +1,45 @@
  16239. +--- a/src/ap/acs.c
  16240. ++++ b/src/ap/acs.c
  16241. +@@ -292,18 +292,12 @@ static void acs_fail(struct hostapd_ifac
  16242. + static long double
  16243. + acs_survey_interference_factor(struct freq_survey *survey, s8 min_nf)
  16244. + {
  16245. +- long double factor, busy, total;
  16246. ++ long double factor, busy = 0, total;
  16247. +
  16248. + if (survey->filled & SURVEY_HAS_CHAN_TIME_BUSY)
  16249. + busy = survey->channel_time_busy;
  16250. + else if (survey->filled & SURVEY_HAS_CHAN_TIME_RX)
  16251. + busy = survey->channel_time_rx;
  16252. +- else {
  16253. +- /* This shouldn't really happen as survey data is checked in
  16254. +- * acs_sanity_check() */
  16255. +- wpa_printf(MSG_ERROR, "ACS: Survey data missing");
  16256. +- return 0;
  16257. +- }
  16258. +
  16259. + total = survey->channel_time;
  16260. +
  16261. +@@ -395,20 +389,19 @@ static int acs_usable_vht80_chan(struct
  16262. + static int acs_survey_is_sufficient(struct freq_survey *survey)
  16263. + {
  16264. + if (!(survey->filled & SURVEY_HAS_NF)) {
  16265. ++ survey->nf = -95;
  16266. + wpa_printf(MSG_INFO, "ACS: Survey is missing noise floor");
  16267. +- return 0;
  16268. + }
  16269. +
  16270. + if (!(survey->filled & SURVEY_HAS_CHAN_TIME)) {
  16271. ++ survey->channel_time = 0;
  16272. + wpa_printf(MSG_INFO, "ACS: Survey is missing channel time");
  16273. +- return 0;
  16274. + }
  16275. +
  16276. + if (!(survey->filled & SURVEY_HAS_CHAN_TIME_BUSY) &&
  16277. + !(survey->filled & SURVEY_HAS_CHAN_TIME_RX)) {
  16278. + wpa_printf(MSG_INFO,
  16279. + "ACS: Survey is missing RX and busy time (at least one is required)");
  16280. +- return 0;
  16281. + }
  16282. +
  16283. + return 1;
  16284. 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
  16285. deleted file mode 100644
  16286. index e6bbddd..0000000
  16287. --- a/package/network/services/hostapd/patches/470-wait-for-nullfunc-longer.patch
  16288. +++ /dev/null
  16289. @@ -1,11 +0,0 @@
  16290. ---- a/src/ap/sta_info.h
  16291. -+++ b/src/ap/sta_info.h
  16292. -@@ -179,7 +179,7 @@ struct sta_info {
  16293. - * AP_DISASSOC_DELAY seconds. Similarly, the station will be deauthenticated
  16294. - * after AP_DEAUTH_DELAY seconds has passed after disassociation. */
  16295. - #define AP_MAX_INACTIVITY (5 * 60)
  16296. --#define AP_DISASSOC_DELAY (1)
  16297. -+#define AP_DISASSOC_DELAY (3)
  16298. - #define AP_DEAUTH_DELAY (1)
  16299. - /* Number of seconds to keep STA entry with Authenticated flag after it has
  16300. - * been disassociated. */
  16301. diff --git a/package/network/services/hostapd/patches/600-ubus_support.patch b/package/network/services/hostapd/patches/600-ubus_support.patch
  16302. index df2eac8..feacdf2 100644
  16303. --- a/package/network/services/hostapd/patches/600-ubus_support.patch
  16304. +++ b/package/network/services/hostapd/patches/600-ubus_support.patch
  16305. @@ -1,6 +1,6 @@
  16306. --- a/hostapd/Makefile
  16307. +++ b/hostapd/Makefile
  16308. -@@ -121,6 +121,11 @@ OBJS += ../src/common/hw_features_common
  16309. +@@ -157,6 +157,11 @@ OBJS += ../src/common/hw_features_common
  16310. OBJS += ../src/eapol_auth/eapol_auth_sm.o
  16311. @@ -22,7 +22,7 @@
  16312. struct wpa_ctrl_dst;
  16313. struct radius_server_data;
  16314. -@@ -103,6 +104,7 @@ struct hostapd_data {
  16315. +@@ -118,6 +119,7 @@ struct hostapd_data {
  16316. struct hostapd_iface *iface;
  16317. struct hostapd_config *iconf;
  16318. struct hostapd_bss_config *conf;
  16319. @@ -30,7 +30,7 @@
  16320. int interface_added; /* virtual interface added for this BSS */
  16321. unsigned int started:1;
  16322. unsigned int disabled:1;
  16323. -@@ -286,6 +288,8 @@ struct hostapd_iface {
  16324. +@@ -323,6 +325,8 @@ struct hostapd_iface {
  16325. struct hostapd_config *conf;
  16326. char phy[16]; /* Name of the PHY (radio) */
  16327. @@ -41,10 +41,10 @@
  16328. HAPD_IFACE_DISABLED,
  16329. --- /dev/null
  16330. +++ b/src/ap/ubus.c
  16331. -@@ -0,0 +1,511 @@
  16332. +@@ -0,0 +1,536 @@
  16333. +/*
  16334. + * hostapd / ubus support
  16335. -+ * Copyright (c) 2013, Felix Fietkau <nbd@openwrt.org>
  16336. ++ * Copyright (c) 2013, Felix Fietkau <nbd@nbd.name>
  16337. + *
  16338. + * This software may be distributed under the terms of the BSD license.
  16339. + * See README for more details.
  16340. @@ -58,6 +58,8 @@
  16341. +#include "wps_hostapd.h"
  16342. +#include "sta_info.h"
  16343. +#include "ubus.h"
  16344. ++#include "ap_drv_ops.h"
  16345. ++#include "beacon.h"
  16346. +
  16347. +static struct ubus_context *ctx;
  16348. +static struct blob_buf b;
  16349. @@ -417,6 +419,10 @@
  16350. +{
  16351. + struct blob_attr *tb[__VENDOR_ELEMENTS_MAX];
  16352. + struct hostapd_data *hapd = get_hapd_from_object(obj);
  16353. ++ struct hostapd_bss_config *bss = hapd->conf;
  16354. ++ struct wpabuf *elems;
  16355. ++ const char *pos;
  16356. ++ size_t len;
  16357. +
  16358. + blobmsg_parse(ve_policy, __VENDOR_ELEMENTS_MAX, tb,
  16359. + blob_data(msg), blob_len(msg));
  16360. @@ -424,10 +430,29 @@
  16361. + if (!tb[VENDOR_ELEMENTS])
  16362. + return UBUS_STATUS_INVALID_ARGUMENT;
  16363. +
  16364. -+ const char *vendor_elements = blobmsg_data(tb[VENDOR_ELEMENTS]);
  16365. -+ if (hostapd_set_iface(hapd->iconf, hapd->conf, "vendor_elements",
  16366. -+ vendor_elements) != 0)
  16367. -+ return UBUS_STATUS_NOT_SUPPORTED;
  16368. ++ pos = blobmsg_data(tb[VENDOR_ELEMENTS]);
  16369. ++ len = os_strlen(pos);
  16370. ++ if (len & 0x01)
  16371. ++ return UBUS_STATUS_INVALID_ARGUMENT;
  16372. ++
  16373. ++ len /= 2;
  16374. ++ if (len == 0) {
  16375. ++ wpabuf_free(bss->vendor_elements);
  16376. ++ bss->vendor_elements = NULL;
  16377. ++ return 0;
  16378. ++ }
  16379. ++
  16380. ++ elems = wpabuf_alloc(len);
  16381. ++ if (elems == NULL)
  16382. ++ return 1;
  16383. ++
  16384. ++ if (hexstr2bin(pos, wpabuf_put(elems, len), len)) {
  16385. ++ wpabuf_free(elems);
  16386. ++ return UBUS_STATUS_INVALID_ARGUMENT;
  16387. ++ }
  16388. ++
  16389. ++ wpabuf_free(bss->vendor_elements);
  16390. ++ bss->vendor_elements = elems;
  16391. +
  16392. + /* update beacons if vendor elements were set successfully */
  16393. + if (ieee802_11_update_beacons(hapd->iface) != 0)
  16394. @@ -558,7 +583,7 @@
  16395. @@ -0,0 +1,78 @@
  16396. +/*
  16397. + * hostapd / ubus support
  16398. -+ * Copyright (c) 2013, Felix Fietkau <nbd@openwrt.org>
  16399. ++ * Copyright (c) 2013, Felix Fietkau <nbd@nbd.name>
  16400. + *
  16401. + * This software may be distributed under the terms of the BSD license.
  16402. + * See README for more details.
  16403. @@ -636,7 +661,7 @@
  16404. +#endif
  16405. --- a/src/ap/hostapd.c
  16406. +++ b/src/ap/hostapd.c
  16407. -@@ -277,6 +277,7 @@ static void hostapd_free_hapd_data(struc
  16408. +@@ -284,6 +284,7 @@ static void hostapd_free_hapd_data(struc
  16409. hapd->started = 0;
  16410. wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface);
  16411. @@ -644,7 +669,7 @@
  16412. iapp_deinit(hapd->iapp);
  16413. hapd->iapp = NULL;
  16414. accounting_deinit(hapd);
  16415. -@@ -1098,6 +1099,8 @@ static int hostapd_setup_bss(struct host
  16416. +@@ -1139,6 +1140,8 @@ static int hostapd_setup_bss(struct host
  16417. if (hapd->driver && hapd->driver->set_operstate)
  16418. hapd->driver->set_operstate(hapd->drv_priv, 1);
  16419. @@ -653,7 +678,7 @@
  16420. return 0;
  16421. }
  16422. -@@ -1384,6 +1387,7 @@ int hostapd_setup_interface_complete(str
  16423. +@@ -1664,6 +1667,7 @@ static int hostapd_setup_interface_compl
  16424. if (err)
  16425. goto fail;
  16426. @@ -661,15 +686,15 @@
  16427. wpa_printf(MSG_DEBUG, "Completing interface initialization");
  16428. if (iface->conf->channel) {
  16429. #ifdef NEED_AP_MLME
  16430. -@@ -1544,6 +1548,7 @@ dfs_offload:
  16431. +@@ -1844,6 +1848,7 @@ dfs_offload:
  16432. fail:
  16433. wpa_printf(MSG_ERROR, "Interface initialization failed");
  16434. + hostapd_ubus_free_iface(iface);
  16435. hostapd_set_state(iface, HAPD_IFACE_DISABLED);
  16436. wpa_msg(hapd->msg_ctx, MSG_INFO, AP_EVENT_DISABLED);
  16437. - if (iface->interfaces && iface->interfaces->terminate_on_error)
  16438. -@@ -1873,6 +1878,7 @@ void hostapd_interface_deinit_free(struc
  16439. + #ifdef CONFIG_FST
  16440. +@@ -2277,6 +2282,7 @@ void hostapd_interface_deinit_free(struc
  16441. (unsigned int) iface->conf->num_bss);
  16442. driver = iface->bss[0]->driver;
  16443. drv_priv = iface->bss[0]->drv_priv;
  16444. @@ -679,7 +704,7 @@
  16445. __func__, driver, drv_priv);
  16446. --- a/src/ap/ieee802_11.c
  16447. +++ b/src/ap/ieee802_11.c
  16448. -@@ -881,7 +881,8 @@ int auth_sae_init_committed(struct hosta
  16449. +@@ -980,7 +980,8 @@ int auth_sae_init_committed(struct hosta
  16450. static void handle_auth(struct hostapd_data *hapd,
  16451. @@ -689,7 +714,7 @@
  16452. {
  16453. u16 auth_alg, auth_transaction, status_code;
  16454. u16 resp = WLAN_STATUS_SUCCESS;
  16455. -@@ -897,6 +898,11 @@ static void handle_auth(struct hostapd_d
  16456. +@@ -996,6 +997,11 @@ static void handle_auth(struct hostapd_d
  16457. char *identity = NULL;
  16458. char *radius_cui = NULL;
  16459. u16 seq_ctrl;
  16460. @@ -699,9 +724,9 @@
  16461. + .frame_info = fi,
  16462. + };
  16463. - if (len < IEEE80211_HDRLEN + sizeof(mgmt->u.auth)) {
  16464. - wpa_printf(MSG_INFO, "handle_auth - too short payload (len=%lu)",
  16465. -@@ -983,6 +989,14 @@ static void handle_auth(struct hostapd_d
  16466. + os_memset(&vlan_id, 0, sizeof(vlan_id));
  16467. +
  16468. +@@ -1149,6 +1155,14 @@ static void handle_auth(struct hostapd_d
  16469. resp = WLAN_STATUS_UNSPECIFIED_FAILURE;
  16470. goto fail;
  16471. }
  16472. @@ -716,7 +741,7 @@
  16473. if (res == HOSTAPD_ACL_PENDING) {
  16474. wpa_printf(MSG_DEBUG, "Authentication frame from " MACSTR
  16475. " waiting for an external authentication",
  16476. -@@ -1694,13 +1708,18 @@ static void send_assoc_resp(struct hosta
  16477. +@@ -2033,13 +2047,18 @@ static u16 send_assoc_resp(struct hostap
  16478. static void handle_assoc(struct hostapd_data *hapd,
  16479. const struct ieee80211_mgmt *mgmt, size_t len,
  16480. @@ -724,7 +749,7 @@
  16481. + int reassoc, struct hostapd_frame_info *fi)
  16482. {
  16483. u16 capab_info, listen_interval, seq_ctrl, fc;
  16484. - u16 resp = WLAN_STATUS_SUCCESS;
  16485. + u16 resp = WLAN_STATUS_SUCCESS, reply_res;
  16486. const u8 *pos;
  16487. int left, i;
  16488. struct sta_info *sta;
  16489. @@ -736,9 +761,9 @@
  16490. if (len < IEEE80211_HDRLEN + (reassoc ? sizeof(mgmt->u.reassoc_req) :
  16491. sizeof(mgmt->u.assoc_req))) {
  16492. -@@ -1820,6 +1839,13 @@ static void handle_assoc(struct hostapd_
  16493. - goto fail;
  16494. +@@ -2159,6 +2178,13 @@ static void handle_assoc(struct hostapd_
  16495. }
  16496. + #endif /* CONFIG_MBO */
  16497. + if (hostapd_ubus_handle_event(hapd, &req)) {
  16498. + wpa_printf(MSG_DEBUG, "Station " MACSTR " assoc rejected by ubus handler.\n",
  16499. @@ -747,10 +772,10 @@
  16500. + goto fail;
  16501. + }
  16502. +
  16503. - sta->capability = capab_info;
  16504. - sta->listen_interval = listen_interval;
  16505. -
  16506. -@@ -2236,7 +2262,7 @@ int ieee802_11_mgmt(struct hostapd_data
  16507. + /*
  16508. + * sta->capability is used in check_assoc_ies() for RRM enabled
  16509. + * capability element.
  16510. +@@ -2639,7 +2665,7 @@ int ieee802_11_mgmt(struct hostapd_data
  16511. if (stype == WLAN_FC_STYPE_PROBE_REQ) {
  16512. @@ -759,7 +784,7 @@
  16513. return 1;
  16514. }
  16515. -@@ -2251,17 +2277,17 @@ int ieee802_11_mgmt(struct hostapd_data
  16516. +@@ -2657,17 +2683,17 @@ int ieee802_11_mgmt(struct hostapd_data
  16517. switch (stype) {
  16518. case WLAN_FC_STYPE_AUTH:
  16519. wpa_printf(MSG_DEBUG, "mgmt::auth");
  16520. @@ -782,7 +807,7 @@
  16521. case WLAN_FC_STYPE_DISASSOC:
  16522. --- a/src/ap/beacon.c
  16523. +++ b/src/ap/beacon.c
  16524. -@@ -542,7 +542,7 @@ static enum ssid_match_result ssid_match
  16525. +@@ -675,7 +675,7 @@ sta_track_seen_on(struct hostapd_iface *
  16526. void handle_probe_req(struct hostapd_data *hapd,
  16527. const struct ieee80211_mgmt *mgmt, size_t len,
  16528. @@ -791,22 +816,23 @@
  16529. {
  16530. u8 *resp;
  16531. struct ieee802_11_elems elems;
  16532. -@@ -550,8 +550,14 @@ void handle_probe_req(struct hostapd_dat
  16533. - size_t ie_len;
  16534. - struct sta_info *sta = NULL;
  16535. +@@ -684,9 +684,15 @@ void handle_probe_req(struct hostapd_dat
  16536. size_t i, resp_len;
  16537. -+ int ssi_signal = fi->ssi_signal;
  16538. int noack;
  16539. enum ssid_match_result res;
  16540. ++ int ssi_signal = fi->ssi_signal;
  16541. + int ret;
  16542. + u16 csa_offs[2];
  16543. + size_t csa_offs_len;
  16544. + struct hostapd_ubus_request req = {
  16545. + .type = HOSTAPD_UBUS_PROBE_REQ,
  16546. + .mgmt_frame = mgmt,
  16547. + .frame_info = fi,
  16548. + };
  16549. - ie = mgmt->u.probe_req.variable;
  16550. - if (len < IEEE80211_HDRLEN + sizeof(mgmt->u.probe_req))
  16551. -@@ -710,6 +716,12 @@ void handle_probe_req(struct hostapd_dat
  16552. + if (len < IEEE80211_HDRLEN)
  16553. + return;
  16554. +@@ -838,6 +844,12 @@ void handle_probe_req(struct hostapd_dat
  16555. }
  16556. #endif /* CONFIG_P2P */
  16557. @@ -832,7 +858,7 @@
  16558. int ieee802_11_update_beacons(struct hostapd_iface *iface);
  16559. --- a/src/ap/drv_callbacks.c
  16560. +++ b/src/ap/drv_callbacks.c
  16561. -@@ -49,6 +49,10 @@ int hostapd_notif_assoc(struct hostapd_d
  16562. +@@ -52,6 +52,10 @@ int hostapd_notif_assoc(struct hostapd_d
  16563. u16 reason = WLAN_REASON_UNSPECIFIED;
  16564. u16 status = WLAN_STATUS_SUCCESS;
  16565. const u8 *p2p_dev_addr = NULL;
  16566. @@ -843,9 +869,9 @@
  16567. if (addr == NULL) {
  16568. /*
  16569. -@@ -113,6 +117,12 @@ int hostapd_notif_assoc(struct hostapd_d
  16570. +@@ -124,6 +128,12 @@ int hostapd_notif_assoc(struct hostapd_d
  16571. + goto fail;
  16572. }
  16573. - sta->flags &= ~(WLAN_STA_WPS | WLAN_STA_MAYBE_WPS | WLAN_STA_WPS2);
  16574. + if (hostapd_ubus_handle_event(hapd, &req)) {
  16575. + wpa_printf(MSG_DEBUG, "Station " MACSTR " assoc rejected by ubus handler.\n",
  16576. diff --git a/package/network/utils/iw/Makefile b/package/network/utils/iw/Makefile
  16577. index ad82081..d17cbca 100644
  16578. --- a/package/network/utils/iw/Makefile
  16579. +++ b/package/network/utils/iw/Makefile
  16580. @@ -12,10 +12,10 @@ PKG_VERSION:=4.3
  16581. PKG_RELEASE:=1
  16582. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  16583. -PKG_SOURCE_URL:=https://www.kernel.org/pub/software/network/iw
  16584. +PKG_SOURCE_URL:=@KERNEL/software/network/iw
  16585. PKG_MD5SUM:=7adec72e91ebdd9c55429fa34a23a6f5
  16586. -PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  16587. +PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  16588. PKG_LICENSE:=GPL-2.0
  16589. include $(INCLUDE_DIR)/package.mk
  16590. diff --git a/package/network/utils/iw/patches/001-nl80211_h_sync.patch b/package/network/utils/iw/patches/001-nl80211_h_sync.patch
  16591. index 7de2258..e5ea8f7 100644
  16592. --- a/package/network/utils/iw/patches/001-nl80211_h_sync.patch
  16593. +++ b/package/network/utils/iw/patches/001-nl80211_h_sync.patch
  16594. @@ -8,7 +8,17 @@
  16595. *
  16596. * Permission to use, copy, modify, and/or distribute this software for any
  16597. * purpose with or without fee is hereby granted, provided that the above
  16598. -@@ -328,7 +329,15 @@
  16599. +@@ -321,14 +322,24 @@
  16600. + * @NL80211_CMD_GET_SCAN: get scan results
  16601. + * @NL80211_CMD_TRIGGER_SCAN: trigger a new scan with the given parameters
  16602. + * %NL80211_ATTR_TX_NO_CCK_RATE is used to decide whether to send the
  16603. +- * probe requests at CCK rate or not.
  16604. ++ * probe requests at CCK rate or not. %NL80211_ATTR_MAC can be used to
  16605. ++ * specify a BSSID to scan for; if not included, the wildcard BSSID will
  16606. ++ * be used.
  16607. + * @NL80211_CMD_NEW_SCAN_RESULTS: scan notification (as a reply to
  16608. + * NL80211_CMD_GET_SCAN and on the "scan" multicast group)
  16609. + * @NL80211_CMD_SCAN_ABORTED: scan was aborted, for unspecified reasons,
  16610. * partial scan results may be available
  16611. *
  16612. * @NL80211_CMD_START_SCHED_SCAN: start a scheduled scan at certain
  16613. @@ -25,7 +35,82 @@
  16614. * Like with normal scans, if SSIDs (%NL80211_ATTR_SCAN_SSIDS)
  16615. * are passed, they are used in the probe requests. For
  16616. * broadcast, a broadcast SSID must be passed (ie. an empty
  16617. -@@ -1761,6 +1770,22 @@ enum nl80211_commands {
  16618. +@@ -418,7 +429,11 @@
  16619. + * @NL80211_CMD_ASSOCIATE: association request and notification; like
  16620. + * NL80211_CMD_AUTHENTICATE but for Association and Reassociation
  16621. + * (similar to MLME-ASSOCIATE.request, MLME-REASSOCIATE.request,
  16622. +- * MLME-ASSOCIATE.confirm or MLME-REASSOCIATE.confirm primitives).
  16623. ++ * MLME-ASSOCIATE.confirm or MLME-REASSOCIATE.confirm primitives). The
  16624. ++ * %NL80211_ATTR_PREV_BSSID attribute is used to specify whether the
  16625. ++ * request is for the initial association to an ESS (that attribute not
  16626. ++ * included) or for reassociation within the ESS (that attribute is
  16627. ++ * included).
  16628. + * @NL80211_CMD_DEAUTHENTICATE: deauthentication request and notification; like
  16629. + * NL80211_CMD_AUTHENTICATE but for Deauthentication frames (similar to
  16630. + * MLME-DEAUTHENTICATION.request and MLME-DEAUTHENTICATE.indication
  16631. +@@ -468,6 +483,9 @@
  16632. + * set of BSSID,frequency parameters is used (i.e., either the enforcing
  16633. + * %NL80211_ATTR_MAC,%NL80211_ATTR_WIPHY_FREQ or the less strict
  16634. + * %NL80211_ATTR_MAC_HINT and %NL80211_ATTR_WIPHY_FREQ_HINT).
  16635. ++ * %NL80211_ATTR_PREV_BSSID can be used to request a reassociation within
  16636. ++ * the ESS in case the device is already associated and an association with
  16637. ++ * a different BSS is desired.
  16638. + * Background scan period can optionally be
  16639. + * specified in %NL80211_ATTR_BG_SCAN_PERIOD,
  16640. + * if not specified default background scan configuration
  16641. +@@ -811,6 +829,10 @@
  16642. + * as an event to indicate changes for devices with wiphy-specific regdom
  16643. + * management.
  16644. + *
  16645. ++ * @NL80211_CMD_ABORT_SCAN: Stop an ongoing scan. Returns -ENOENT if a scan is
  16646. ++ * not running. The driver indicates the status of the scan through
  16647. ++ * cfg80211_scan_done().
  16648. ++ *
  16649. + * @NL80211_CMD_MAX: highest used command number
  16650. + * @__NL80211_CMD_AFTER_LAST: internal use
  16651. + */
  16652. +@@ -997,6 +1019,8 @@ enum nl80211_commands {
  16653. +
  16654. + NL80211_CMD_WIPHY_REG_CHANGE,
  16655. +
  16656. ++ NL80211_CMD_ABORT_SCAN,
  16657. ++
  16658. + /* add new commands above here */
  16659. +
  16660. + /* used to define NL80211_CMD_MAX below */
  16661. +@@ -1270,8 +1294,11 @@ enum nl80211_commands {
  16662. + * @NL80211_ATTR_RESP_IE: (Re)association response information elements as
  16663. + * sent by peer, for ROAM and successful CONNECT events.
  16664. + *
  16665. +- * @NL80211_ATTR_PREV_BSSID: previous BSSID, to be used by in ASSOCIATE
  16666. +- * commands to specify using a reassociate frame
  16667. ++ * @NL80211_ATTR_PREV_BSSID: previous BSSID, to be used in ASSOCIATE and CONNECT
  16668. ++ * commands to specify a request to reassociate within an ESS, i.e., to use
  16669. ++ * Reassociate Request frame (with the value of this attribute in the
  16670. ++ * Current AP address field) instead of Association Request frame which is
  16671. ++ * used for the initial association to an ESS.
  16672. + *
  16673. + * @NL80211_ATTR_KEY: key information in a nested attribute with
  16674. + * %NL80211_KEY_* sub-attributes
  16675. +@@ -1712,6 +1739,8 @@ enum nl80211_commands {
  16676. + * underlying device supports these minimal RRM features:
  16677. + * %NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES,
  16678. + * %NL80211_FEATURE_QUIET,
  16679. ++ * Or, if global RRM is supported, see:
  16680. ++ * %NL80211_EXT_FEATURE_RRM
  16681. + * If this flag is used, driver must add the Power Capabilities IE to the
  16682. + * association request. In addition, it must also set the RRM capability
  16683. + * flag in the association request's Capability Info field.
  16684. +@@ -1755,12 +1784,44 @@ enum nl80211_commands {
  16685. + * over all channels.
  16686. + *
  16687. + * @NL80211_ATTR_SCHED_SCAN_DELAY: delay before the first cycle of a
  16688. +- * scheduled scan (or a WoWLAN net-detect scan) is started, u32
  16689. +- * in seconds.
  16690. ++ * scheduled scan is started. Or the delay before a WoWLAN
  16691. ++ * net-detect scan is started, counting from the moment the
  16692. ++ * system is suspended. This value is a u32, in seconds.
  16693. +
  16694. * @NL80211_ATTR_REG_INDOOR: flag attribute, if set indicates that the device
  16695. * is operating in an indoor environment.
  16696. *
  16697. @@ -41,6 +126,21 @@
  16698. + * thus it must not specify the number of iterations, only the interval
  16699. + * between scans. The scan plans are executed sequentially.
  16700. + * Each scan plan is a nested attribute of &enum nl80211_sched_scan_plan.
  16701. ++ * @NL80211_ATTR_PBSS: flag attribute. If set it means operate
  16702. ++ * in a PBSS. Specified in %NL80211_CMD_CONNECT to request
  16703. ++ * connecting to a PCP, and in %NL80211_CMD_START_AP to start
  16704. ++ * a PCP instead of AP. Relevant for DMG networks only.
  16705. ++ * @NL80211_ATTR_BSS_SELECT: nested attribute for driver supporting the
  16706. ++ * BSS selection feature. When used with %NL80211_CMD_GET_WIPHY it contains
  16707. ++ * attributes according &enum nl80211_bss_select_attr to indicate what
  16708. ++ * BSS selection behaviours are supported. When used with %NL80211_CMD_CONNECT
  16709. ++ * it contains the behaviour-specific attribute containing the parameters for
  16710. ++ * BSS selection to be done by driver and/or firmware.
  16711. ++ *
  16712. ++ * @NL80211_ATTR_STA_SUPPORT_P2P_PS: whether P2P PS mechanism supported
  16713. ++ * or not. u8, one of the values of &enum nl80211_sta_p2p_ps_status
  16714. ++ *
  16715. ++ * @NL80211_ATTR_PAD: attribute used for padding for 64-bit alignment
  16716. + *
  16717. + * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce
  16718. + * transmit power to stay within regulatory limits. u32, dBi.
  16719. @@ -48,7 +148,7 @@
  16720. * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  16721. * @NL80211_ATTR_MAX: highest attribute number currently defined
  16722. * @__NL80211_ATTR_AFTER_LAST: internal use
  16723. -@@ -2130,6 +2155,13 @@ enum nl80211_attrs {
  16724. +@@ -2130,6 +2191,21 @@ enum nl80211_attrs {
  16725. NL80211_ATTR_REG_INDOOR,
  16726. @@ -57,30 +157,147 @@
  16727. + NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS,
  16728. + NL80211_ATTR_SCHED_SCAN_PLANS,
  16729. +
  16730. ++ NL80211_ATTR_PBSS,
  16731. ++
  16732. ++ NL80211_ATTR_BSS_SELECT,
  16733. ++
  16734. ++ NL80211_ATTR_STA_SUPPORT_P2P_PS,
  16735. ++
  16736. ++ NL80211_ATTR_PAD,
  16737. ++
  16738. + NL80211_ATTR_WIPHY_ANTENNA_GAIN,
  16739. +
  16740. /* add attributes here, update the policy in nl80211.c */
  16741. __NL80211_ATTR_AFTER_LAST,
  16742. -@@ -3364,6 +3396,9 @@ enum nl80211_bss_scan_width {
  16743. +@@ -2273,6 +2349,20 @@ enum nl80211_sta_flags {
  16744. + NL80211_STA_FLAG_MAX = __NL80211_STA_FLAG_AFTER_LAST - 1
  16745. + };
  16746. +
  16747. ++/**
  16748. ++ * enum nl80211_sta_p2p_ps_status - station support of P2P PS
  16749. ++ *
  16750. ++ * @NL80211_P2P_PS_UNSUPPORTED: station doesn't support P2P PS mechanism
  16751. ++ * @@NL80211_P2P_PS_SUPPORTED: station supports P2P PS mechanism
  16752. ++ * @NUM_NL80211_P2P_PS_STATUS: number of values
  16753. ++ */
  16754. ++enum nl80211_sta_p2p_ps_status {
  16755. ++ NL80211_P2P_PS_UNSUPPORTED = 0,
  16756. ++ NL80211_P2P_PS_SUPPORTED,
  16757. ++
  16758. ++ NUM_NL80211_P2P_PS_STATUS,
  16759. ++};
  16760. ++
  16761. + #define NL80211_STA_FLAG_MAX_OLD_API NL80211_STA_FLAG_TDLS_PEER
  16762. +
  16763. + /**
  16764. +@@ -2430,6 +2520,9 @@ enum nl80211_sta_bss_param {
  16765. + * TID+1 and the special TID 16 (i.e. value 17) is used for non-QoS frames;
  16766. + * each one of those is again nested with &enum nl80211_tid_stats
  16767. + * attributes carrying the actual values.
  16768. ++ * @NL80211_STA_INFO_RX_DURATION: aggregate PPDU duration for all frames
  16769. ++ * received from the station (u64, usec)
  16770. ++ * @NL80211_STA_INFO_PAD: attribute used for padding for 64-bit alignment
  16771. + * @__NL80211_STA_INFO_AFTER_LAST: internal
  16772. + * @NL80211_STA_INFO_MAX: highest possible station info attribute
  16773. + */
  16774. +@@ -2466,6 +2559,8 @@ enum nl80211_sta_info {
  16775. + NL80211_STA_INFO_BEACON_RX,
  16776. + NL80211_STA_INFO_BEACON_SIGNAL_AVG,
  16777. + NL80211_STA_INFO_TID_STATS,
  16778. ++ NL80211_STA_INFO_RX_DURATION,
  16779. ++ NL80211_STA_INFO_PAD,
  16780. +
  16781. + /* keep last */
  16782. + __NL80211_STA_INFO_AFTER_LAST,
  16783. +@@ -2482,6 +2577,7 @@ enum nl80211_sta_info {
  16784. + * transmitted MSDUs (not counting the first attempt; u64)
  16785. + * @NL80211_TID_STATS_TX_MSDU_FAILED: number of failed transmitted
  16786. + * MSDUs (u64)
  16787. ++ * @NL80211_TID_STATS_PAD: attribute used for padding for 64-bit alignment
  16788. + * @NUM_NL80211_TID_STATS: number of attributes here
  16789. + * @NL80211_TID_STATS_MAX: highest numbered attribute here
  16790. + */
  16791. +@@ -2491,6 +2587,7 @@ enum nl80211_tid_stats {
  16792. + NL80211_TID_STATS_TX_MSDU,
  16793. + NL80211_TID_STATS_TX_MSDU_RETRIES,
  16794. + NL80211_TID_STATS_TX_MSDU_FAILED,
  16795. ++ NL80211_TID_STATS_PAD,
  16796. +
  16797. + /* keep last */
  16798. + NUM_NL80211_TID_STATS,
  16799. +@@ -2927,6 +3024,7 @@ enum nl80211_user_reg_hint_type {
  16800. + * transmitting data (on channel or globally)
  16801. + * @NL80211_SURVEY_INFO_TIME_SCAN: time the radio spent for scan
  16802. + * (on this channel or globally)
  16803. ++ * @NL80211_SURVEY_INFO_PAD: attribute used for padding for 64-bit alignment
  16804. + * @NL80211_SURVEY_INFO_MAX: highest survey info attribute number
  16805. + * currently defined
  16806. + * @__NL80211_SURVEY_INFO_AFTER_LAST: internal use
  16807. +@@ -2942,6 +3040,7 @@ enum nl80211_survey_info {
  16808. + NL80211_SURVEY_INFO_TIME_RX,
  16809. + NL80211_SURVEY_INFO_TIME_TX,
  16810. + NL80211_SURVEY_INFO_TIME_SCAN,
  16811. ++ NL80211_SURVEY_INFO_PAD,
  16812. +
  16813. + /* keep last */
  16814. + __NL80211_SURVEY_INFO_AFTER_LAST,
  16815. +@@ -3364,6 +3463,10 @@ enum nl80211_bss_scan_width {
  16816. * (not present if no beacon frame has been received yet)
  16817. * @NL80211_BSS_PRESP_DATA: the data in @NL80211_BSS_INFORMATION_ELEMENTS and
  16818. * @NL80211_BSS_TSF is known to be from a probe response (flag attribute)
  16819. + * @NL80211_BSS_LAST_SEEN_BOOTTIME: CLOCK_BOOTTIME timestamp when this entry
  16820. + * was last updated by a received frame. The value is expected to be
  16821. + * accurate to about 10ms. (u64, nanoseconds)
  16822. ++ * @NL80211_BSS_PAD: attribute used for padding for 64-bit alignment
  16823. * @__NL80211_BSS_AFTER_LAST: internal
  16824. * @NL80211_BSS_MAX: highest BSS attribute
  16825. */
  16826. -@@ -3383,6 +3418,7 @@ enum nl80211_bss {
  16827. +@@ -3383,6 +3486,8 @@ enum nl80211_bss {
  16828. NL80211_BSS_CHAN_WIDTH,
  16829. NL80211_BSS_BEACON_TSF,
  16830. NL80211_BSS_PRESP_DATA,
  16831. + NL80211_BSS_LAST_SEEN_BOOTTIME,
  16832. ++ NL80211_BSS_PAD,
  16833. /* keep last */
  16834. __NL80211_BSS_AFTER_LAST,
  16835. -@@ -4589,4 +4625,28 @@ enum nl80211_tdls_peer_capability {
  16836. +@@ -3568,11 +3673,15 @@ enum nl80211_txrate_gi {
  16837. + * @NL80211_BAND_2GHZ: 2.4 GHz ISM band
  16838. + * @NL80211_BAND_5GHZ: around 5 GHz band (4.9 - 5.7 GHz)
  16839. + * @NL80211_BAND_60GHZ: around 60 GHz band (58.32 - 64.80 GHz)
  16840. ++ * @NUM_NL80211_BANDS: number of bands, avoid using this in userspace
  16841. ++ * since newer kernel versions may support more bands
  16842. + */
  16843. + enum nl80211_band {
  16844. + NL80211_BAND_2GHZ,
  16845. + NL80211_BAND_5GHZ,
  16846. + NL80211_BAND_60GHZ,
  16847. ++
  16848. ++ NUM_NL80211_BANDS,
  16849. + };
  16850. +
  16851. + /**
  16852. +@@ -4358,12 +4467,18 @@ enum nl80211_feature_flags {
  16853. + /**
  16854. + * enum nl80211_ext_feature_index - bit index of extended features.
  16855. + * @NL80211_EXT_FEATURE_VHT_IBSS: This driver supports IBSS with VHT datarates.
  16856. ++ * @NL80211_EXT_FEATURE_RRM: This driver supports RRM. When featured, user can
  16857. ++ * can request to use RRM (see %NL80211_ATTR_USE_RRM) with
  16858. ++ * %NL80211_CMD_ASSOCIATE and %NL80211_CMD_CONNECT requests, which will set
  16859. ++ * the ASSOC_REQ_USE_RRM flag in the association request even if
  16860. ++ * NL80211_FEATURE_QUIET is not advertized.
  16861. + *
  16862. + * @NUM_NL80211_EXT_FEATURES: number of extended features.
  16863. + * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
  16864. + */
  16865. + enum nl80211_ext_feature_index {
  16866. + NL80211_EXT_FEATURE_VHT_IBSS,
  16867. ++ NL80211_EXT_FEATURE_RRM,
  16868. +
  16869. + /* add new features before the definition below */
  16870. + NUM_NL80211_EXT_FEATURES,
  16871. +@@ -4589,4 +4704,72 @@ enum nl80211_tdls_peer_capability {
  16872. NL80211_TDLS_PEER_WMM = 1<<2,
  16873. };
  16874. @@ -108,4 +325,48 @@
  16875. + __NL80211_SCHED_SCAN_PLAN_AFTER_LAST - 1
  16876. +};
  16877. +
  16878. ++/**
  16879. ++ * struct nl80211_bss_select_rssi_adjust - RSSI adjustment parameters.
  16880. ++ *
  16881. ++ * @band: band of BSS that must match for RSSI value adjustment.
  16882. ++ * @delta: value used to adjust the RSSI value of matching BSS.
  16883. ++ */
  16884. ++struct nl80211_bss_select_rssi_adjust {
  16885. ++ __u8 band;
  16886. ++ __s8 delta;
  16887. ++} __attribute__((packed));
  16888. ++
  16889. ++/**
  16890. ++ * enum nl80211_bss_select_attr - attributes for bss selection.
  16891. ++ *
  16892. ++ * @__NL80211_BSS_SELECT_ATTR_INVALID: reserved.
  16893. ++ * @NL80211_BSS_SELECT_ATTR_RSSI: Flag indicating only RSSI-based BSS selection
  16894. ++ * is requested.
  16895. ++ * @NL80211_BSS_SELECT_ATTR_BAND_PREF: attribute indicating BSS
  16896. ++ * selection should be done such that the specified band is preferred.
  16897. ++ * When there are multiple BSS-es in the preferred band, the driver
  16898. ++ * shall use RSSI-based BSS selection as a second step. The value of
  16899. ++ * this attribute is according to &enum nl80211_band (u32).
  16900. ++ * @NL80211_BSS_SELECT_ATTR_RSSI_ADJUST: When present the RSSI level for
  16901. ++ * BSS-es in the specified band is to be adjusted before doing
  16902. ++ * RSSI-based BSS selection. The attribute value is a packed structure
  16903. ++ * value as specified by &struct nl80211_bss_select_rssi_adjust.
  16904. ++ * @NL80211_BSS_SELECT_ATTR_MAX: highest bss select attribute number.
  16905. ++ * @__NL80211_BSS_SELECT_ATTR_AFTER_LAST: internal use.
  16906. ++ *
  16907. ++ * One and only one of these attributes are found within %NL80211_ATTR_BSS_SELECT
  16908. ++ * for %NL80211_CMD_CONNECT. It specifies the required BSS selection behaviour
  16909. ++ * which the driver shall use.
  16910. ++ */
  16911. ++enum nl80211_bss_select_attr {
  16912. ++ __NL80211_BSS_SELECT_ATTR_INVALID,
  16913. ++ NL80211_BSS_SELECT_ATTR_RSSI,
  16914. ++ NL80211_BSS_SELECT_ATTR_BAND_PREF,
  16915. ++ NL80211_BSS_SELECT_ATTR_RSSI_ADJUST,
  16916. ++
  16917. ++ /* keep last */
  16918. ++ __NL80211_BSS_SELECT_ATTR_AFTER_LAST,
  16919. ++ NL80211_BSS_SELECT_ATTR_MAX = __NL80211_BSS_SELECT_ATTR_AFTER_LAST - 1
  16920. ++};
  16921. ++
  16922. #endif /* __LINUX_NL80211_H */
  16923. 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
  16924. index 574c490..2cdf360 100644
  16925. --- a/package/network/utils/iw/patches/300-display_interface_TX_power.patch
  16926. +++ b/package/network/utils/iw/patches/300-display_interface_TX_power.patch
  16927. @@ -12,11 +12,9 @@ Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  16928. interface.c | 7 +++++++
  16929. 1 file changed, 7 insertions(+)
  16930. -diff --git a/interface.c b/interface.c
  16931. -index 73ccecd..4f0821d 100644
  16932. --- a/interface.c
  16933. +++ b/interface.c
  16934. -@@ -368,6 +368,13 @@ static int print_iface_handler(struct nl_msg *msg, void *arg)
  16935. +@@ -368,6 +368,13 @@ static int print_iface_handler(struct nl
  16936. printf("\n");
  16937. }
  16938. diff --git a/package/network/utils/iw/patches/301-ibss_add_VHT80.patch b/package/network/utils/iw/patches/301-ibss_add_VHT80.patch
  16939. index 709fbb2..0627bcc 100644
  16940. --- a/package/network/utils/iw/patches/301-ibss_add_VHT80.patch
  16941. +++ b/package/network/utils/iw/patches/301-ibss_add_VHT80.patch
  16942. @@ -14,8 +14,6 @@ Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  16943. ibss.c | 49 +++++++++++++++++++++++++++++++++++++++++--------
  16944. 1 file changed, 41 insertions(+), 8 deletions(-)
  16945. -diff --git a/ibss.c b/ibss.c
  16946. -index 7a0b707..a99a262 100644
  16947. --- a/ibss.c
  16948. +++ b/ibss.c
  16949. @@ -16,6 +16,39 @@
  16950. @@ -58,7 +56,7 @@ index 7a0b707..a99a262 100644
  16951. static int join_ibss(struct nl80211_state *state,
  16952. struct nl_msg *msg,
  16953. int argc, char **argv,
  16954. -@@ -30,12 +63,8 @@ static int join_ibss(struct nl80211_state *state,
  16955. +@@ -30,12 +63,8 @@ static int join_ibss(struct nl80211_stat
  16956. int bintval;
  16957. int i;
  16958. unsigned long freq;
  16959. @@ -73,7 +71,7 @@ index 7a0b707..a99a262 100644
  16960. { .name = "HT20",
  16961. .width = NL80211_CHAN_WIDTH_20,
  16962. .freq1_diff = 0,
  16963. -@@ -60,6 +89,10 @@ static int join_ibss(struct nl80211_state *state,
  16964. +@@ -60,6 +89,10 @@ static int join_ibss(struct nl80211_stat
  16965. .width = NL80211_CHAN_WIDTH_10,
  16966. .freq1_diff = 0,
  16967. .chantype = -1 },
  16968. @@ -84,7 +82,7 @@ index 7a0b707..a99a262 100644
  16969. };
  16970. if (argc < 2)
  16971. -@@ -90,7 +123,7 @@ static int join_ibss(struct nl80211_state *state,
  16972. +@@ -90,7 +123,7 @@ static int join_ibss(struct nl80211_stat
  16973. NLA_PUT_U32(msg, NL80211_ATTR_CHANNEL_WIDTH,
  16974. chanmode_selected->width);
  16975. NLA_PUT_U32(msg, NL80211_ATTR_CENTER_FREQ1,
  16976. 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
  16977. index fc44427..f96d5ea 100644
  16978. --- a/package/network/utils/iw/patches/302-ibss_use_MHz_instead_MHZ.patch
  16979. +++ b/package/network/utils/iw/patches/302-ibss_use_MHz_instead_MHZ.patch
  16980. @@ -7,11 +7,9 @@ Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  16981. ibss.c | 8 ++++----
  16982. 1 file changed, 4 insertions(+), 4 deletions(-)
  16983. -diff --git a/ibss.c b/ibss.c
  16984. -index a99a262..23bda70 100644
  16985. --- a/ibss.c
  16986. +++ b/ibss.c
  16987. -@@ -81,15 +81,15 @@ static int join_ibss(struct nl80211_state *state,
  16988. +@@ -81,15 +81,15 @@ static int join_ibss(struct nl80211_stat
  16989. .width = NL80211_CHAN_WIDTH_20_NOHT,
  16990. .freq1_diff = 0,
  16991. .chantype = NL80211_CHAN_NO_HT },
  16992. diff --git a/package/network/utils/iw/patches/303-mesh_add_VHT80.patch b/package/network/utils/iw/patches/303-mesh_add_VHT80.patch
  16993. index fe8dc21..956b050 100644
  16994. --- a/package/network/utils/iw/patches/303-mesh_add_VHT80.patch
  16995. +++ b/package/network/utils/iw/patches/303-mesh_add_VHT80.patch
  16996. @@ -15,8 +15,6 @@ Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
  16997. util.c | 26 ++++++++++++++++++++++++++
  16998. 4 files changed, 43 insertions(+), 41 deletions(-)
  16999. -diff --git a/ibss.c b/ibss.c
  17000. -index 23bda70..ac06fc5 100644
  17001. --- a/ibss.c
  17002. +++ b/ibss.c
  17003. @@ -16,39 +16,6 @@
  17004. @@ -59,8 +57,6 @@ index 23bda70..ac06fc5 100644
  17005. static int join_ibss(struct nl80211_state *state,
  17006. struct nl_msg *msg,
  17007. int argc, char **argv,
  17008. -diff --git a/iw.h b/iw.h
  17009. -index cef9da8..8e1a37a 100644
  17010. --- a/iw.h
  17011. +++ b/iw.h
  17012. @@ -59,6 +59,13 @@ struct cmd {
  17013. @@ -77,7 +73,7 @@ index cef9da8..8e1a37a 100644
  17014. #define ARRAY_SIZE(ar) (sizeof(ar)/sizeof(ar[0]))
  17015. #define DIV_ROUND_UP(x, y) (((x) + (y - 1)) / (y))
  17016. -@@ -174,6 +181,8 @@ void print_ies(unsigned char *ie, int ielen, bool unknown,
  17017. +@@ -174,6 +181,8 @@ void print_ies(unsigned char *ie, int ie
  17018. void parse_bitrate(struct nlattr *bitrate_attr, char *buf, int buflen);
  17019. void iw_hexdump(const char *prefix, const __u8 *data, size_t len);
  17020. @@ -86,11 +82,9 @@ index cef9da8..8e1a37a 100644
  17021. #define SCHED_SCAN_OPTIONS "interval <in_msecs> [delay <in_secs>] " \
  17022. "[freqs <freq>+] [matches [ssid <ssid>]+]] [active [ssid <ssid>]+|passive] [randomise[=<addr>/<mask>]]"
  17023. int parse_sched_scan(struct nl_msg *msg, int *argc, char ***argv);
  17024. -diff --git a/mesh.c b/mesh.c
  17025. -index 0090530..930d58f 100644
  17026. --- a/mesh.c
  17027. +++ b/mesh.c
  17028. -@@ -439,12 +439,8 @@ static int join_mesh(struct nl80211_state *state,
  17029. +@@ -439,12 +439,8 @@ static int join_mesh(struct nl80211_stat
  17030. int bintval, dtim_period, i, n_rates = 0;
  17031. char *end, *value = NULL, *sptr = NULL;
  17032. unsigned long freq = 0;
  17033. @@ -105,7 +99,7 @@ index 0090530..930d58f 100644
  17034. { .name = "HT20",
  17035. .width = NL80211_CHAN_WIDTH_20,
  17036. .freq1_diff = 0,
  17037. -@@ -461,6 +457,10 @@ static int join_mesh(struct nl80211_state *state,
  17038. +@@ -461,6 +457,10 @@ static int join_mesh(struct nl80211_stat
  17039. .width = NL80211_CHAN_WIDTH_20_NOHT,
  17040. .freq1_diff = 0,
  17041. .chantype = NL80211_CHAN_NO_HT },
  17042. @@ -116,7 +110,7 @@ index 0090530..930d58f 100644
  17043. };
  17044. if (argc < 1)
  17045. -@@ -497,7 +497,7 @@ static int join_mesh(struct nl80211_state *state,
  17046. +@@ -497,7 +497,7 @@ static int join_mesh(struct nl80211_stat
  17047. NLA_PUT_U32(msg, NL80211_ATTR_CHANNEL_WIDTH,
  17048. chanmode_selected->width);
  17049. NLA_PUT_U32(msg, NL80211_ATTR_CENTER_FREQ1,
  17050. @@ -125,7 +119,7 @@ index 0090530..930d58f 100644
  17051. if (chanmode_selected->chantype != -1)
  17052. NLA_PUT_U32(msg,
  17053. NL80211_ATTR_WIPHY_CHANNEL_TYPE,
  17054. -@@ -599,7 +599,7 @@ static int join_mesh(struct nl80211_state *state,
  17055. +@@ -599,7 +599,7 @@ static int join_mesh(struct nl80211_stat
  17056. nla_put_failure:
  17057. return -ENOBUFS;
  17058. }
  17059. @@ -134,11 +128,9 @@ index 0090530..930d58f 100644
  17060. " [basic-rates <rate in Mbps,rate2,...>]], [mcast-rate <rate in Mbps>]"
  17061. " [beacon-interval <time in TUs>] [dtim-period <value>]"
  17062. " [vendor_sync on|off] [<param>=<value>]*",
  17063. -diff --git a/util.c b/util.c
  17064. -index 4efc4c8..d75ffe0 100644
  17065. --- a/util.c
  17066. +++ b/util.c
  17067. -@@ -728,3 +728,29 @@ void iw_hexdump(const char *prefix, const __u8 *buf, size_t size)
  17068. +@@ -728,3 +728,29 @@ void iw_hexdump(const char *prefix, cons
  17069. }
  17070. printf("\n\n");
  17071. }
  17072. 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
  17073. index d382453..20bb06e 100644
  17074. --- a/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.c
  17075. +++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.c
  17076. @@ -39,6 +39,18 @@ __init void ap9x_pci_setup_wmac_led_pin(unsigned wmac, int pin)
  17077. }
  17078. }
  17079. +__init void ap9x_pci_setup_wmac_led_name(unsigned wmac, const char *led_name)
  17080. +{
  17081. + switch (wmac) {
  17082. + case 0:
  17083. + ap9x_wmac0_data.led_name = led_name;
  17084. + break;
  17085. + case 1:
  17086. + ap9x_wmac1_data.led_name = led_name;
  17087. + break;
  17088. + }
  17089. +}
  17090. +
  17091. __init struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac)
  17092. {
  17093. switch (wmac) {
  17094. @@ -81,6 +93,20 @@ __init void ap9x_pci_setup_wmac_leds(unsigned wmac, struct gpio_led *leds,
  17095. }
  17096. }
  17097. +__init void ap9x_pci_setup_wmac_btns(unsigned wmac,
  17098. + struct gpio_keys_button *btns,
  17099. + unsigned num_btns, unsigned poll_interval)
  17100. +{
  17101. + struct ath9k_platform_data *ap9x_wmac_data;
  17102. +
  17103. + if (!(ap9x_wmac_data = ap9x_pci_get_wmac_data(wmac)))
  17104. + return;
  17105. +
  17106. + ap9x_wmac_data->btns = btns;
  17107. + ap9x_wmac_data->num_btns = num_btns;
  17108. + ap9x_wmac_data->btn_poll_interval = poll_interval;
  17109. +}
  17110. +
  17111. static int ap91_pci_plat_dev_init(struct pci_dev *dev)
  17112. {
  17113. switch (PCI_SLOT(dev->devfn)) {
  17114. 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
  17115. index ad288cb..d7c0185 100644
  17116. --- a/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.h
  17117. +++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.h
  17118. @@ -12,6 +12,7 @@
  17119. #define _ATH79_DEV_AP9X_PCI_H
  17120. struct gpio_led;
  17121. +struct gpio_keys_button;
  17122. struct ath9k_platform_data;
  17123. #if defined(CONFIG_ATH79_DEV_AP9X_PCI)
  17124. @@ -19,6 +20,9 @@ void ap9x_pci_setup_wmac_led_pin(unsigned wmac, int pin);
  17125. void ap9x_pci_setup_wmac_gpio(unsigned wmac, u32 mask, u32 val);
  17126. void ap9x_pci_setup_wmac_leds(unsigned wmac, struct gpio_led *leds,
  17127. int num_leds);
  17128. +void ap9x_pci_setup_wmac_led_name(unsigned wmac, const char *led_name);
  17129. +void ap9x_pci_setup_wmac_btns(unsigned wmac, struct gpio_keys_button *btns,
  17130. + unsigned num_btns, unsigned poll_interval);
  17131. struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac);
  17132. void ap91_pci_init(u8 *cal_data, u8 *mac_addr);
  17133. @@ -33,6 +37,12 @@ static inline void ap9x_pci_setup_wmac_gpio(unsigned wmac,
  17134. static inline void ap9x_pci_setup_wmac_leds(unsigned wmac,
  17135. struct gpio_led *leds,
  17136. int num_leds) {}
  17137. +static inline void ap9x_pci_setup_wmac_led_name(unsigned wmac,
  17138. + const char *led_name) {}
  17139. +static inline void ap9x_pci_setup_wmac_btns(unsigned wmac,
  17140. + struct gpio_keys_button *btns,
  17141. + unsigned num_btns,
  17142. + unsigned poll_interval) {}
  17143. static inline struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac)
  17144. {
  17145. return NULL;
  17146. diff --git a/target/linux/generic/files/include/linux/ath9k_platform.h b/target/linux/generic/files/include/linux/ath9k_platform.h
  17147. index 30ce216..2c19f3b 100644
  17148. --- a/target/linux/generic/files/include/linux/ath9k_platform.h
  17149. +++ b/target/linux/generic/files/include/linux/ath9k_platform.h
  17150. @@ -31,6 +31,10 @@ struct ath9k_platform_data {
  17151. u32 gpio_mask;
  17152. u32 gpio_val;
  17153. + u32 bt_active_pin;
  17154. + u32 bt_priority_pin;
  17155. + u32 wlan_active_pin;
  17156. +
  17157. bool endian_check;
  17158. bool is_clk_25mhz;
  17159. bool tx_gain_buffalo;
  17160. @@ -45,6 +49,11 @@ struct ath9k_platform_data {
  17161. int num_leds;
  17162. const struct gpio_led *leds;
  17163. + const char *led_name;
  17164. +
  17165. + unsigned num_btns;
  17166. + const struct gpio_keys_button *btns;
  17167. + unsigned btn_poll_interval;
  17168. };
  17169. #endif /* _LINUX_ATH9K_PLATFORM_H */