0007-mac80211-hostapd-iw-.-update-to-LEDE-b2ddfbc1c7b935cf931b4c336969b65947270ce9.patch 581 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303
  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 b2ddfbc1c7b935cf931b4c336969b65947270ce9
  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/patches/004-backports-add-skb_free_frag.patch b/package/kernel/mac80211/patches/004-backports-add-skb_free_frag.patch
  1043. deleted file mode 100644
  1044. index 9adfd8f..0000000
  1045. --- a/package/kernel/mac80211/patches/004-backports-add-skb_free_frag.patch
  1046. +++ /dev/null
  1047. @@ -1,21 +0,0 @@
  1048. -From: Felix Fietkau <nbd@openwrt.org>
  1049. -Date: Thu, 28 Jan 2016 15:16:35 +0100
  1050. -Subject: [PATCH] backports: add skb_free_frag()
  1051. -
  1052. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  1053. ----
  1054. -
  1055. ---- a/backport-include/linux/skbuff.h
  1056. -+++ b/backport-include/linux/skbuff.h
  1057. -@@ -300,4 +300,11 @@ int skb_ensure_writable(struct sk_buff *
  1058. -
  1059. - #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) */
  1060. -
  1061. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
  1062. -+static inline void skb_free_frag(void *data)
  1063. -+{
  1064. -+ put_page(virt_to_head_page(data));
  1065. -+}
  1066. -+#endif
  1067. -+
  1068. - #endif /* __BACKPORT_SKBUFF_H */
  1069. diff --git a/package/kernel/mac80211/patches/004-fix_duplicate_skcipher_backport.patch b/package/kernel/mac80211/patches/004-fix_duplicate_skcipher_backport.patch
  1070. new file mode 100644
  1071. index 0000000..38b3179
  1072. --- /dev/null
  1073. +++ b/package/kernel/mac80211/patches/004-fix_duplicate_skcipher_backport.patch
  1074. @@ -0,0 +1,11 @@
  1075. +--- a/compat/Makefile
  1076. ++++ b/compat/Makefile
  1077. +@@ -35,8 +35,6 @@ compat-$(CPTCFG_KERNEL_4_6) += backport-
  1078. +
  1079. + compat-$(CPTCFG_BPAUTO_BUILD_CRYPTO_CCM) += crypto-ccm.o
  1080. + compat-$(CPTCFG_BPAUTO_CRYPTO_SKCIPHER) += crypto-skcipher.o
  1081. +-skcipher-objs += crypto-skcipher.o
  1082. +-obj-$(CPTCFG_BPAUTO_CRYPTO_SKCIPHER) += skcipher.o
  1083. + compat-$(CPTCFG_BPAUTO_BUILD_WANT_DEV_COREDUMP) += drivers-base-devcoredump.o
  1084. + compat-$(CPTCFG_BPAUTO_RHASHTABLE) += lib-rhashtable.o
  1085. + cordic-objs += lib-cordic.o
  1086. 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
  1087. new file mode 100644
  1088. index 0000000..29bccc1
  1089. --- /dev/null
  1090. +++ b/package/kernel/mac80211/patches/005-backport_skb_get_hash_perturb.patch
  1091. @@ -0,0 +1,22 @@
  1092. +--- a/backport-include/linux/skbuff.h
  1093. ++++ b/backport-include/linux/skbuff.h
  1094. +@@ -305,6 +305,19 @@ static inline void skb_free_frag(void *d
  1095. + {
  1096. + put_page(virt_to_head_page(data));
  1097. + }
  1098. ++
  1099. ++#include <net/flow_keys.h>
  1100. ++#include <linux/jhash.h>
  1101. ++
  1102. ++static inline u32 skb_get_hash_perturb(struct sk_buff *skb, u32 key)
  1103. ++{
  1104. ++ struct flow_keys keys;
  1105. ++
  1106. ++ skb_flow_dissect(skb, &keys);
  1107. ++ return jhash_3words((__force u32)keys.dst,
  1108. ++ (__force u32)keys.src ^ keys.ip_proto,
  1109. ++ (__force u32)keys.ports, key);
  1110. ++}
  1111. + #endif
  1112. +
  1113. + #endif /* __BACKPORT_SKBUFF_H */
  1114. 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
  1115. deleted file mode 100644
  1116. index 9b672a8..0000000
  1117. --- a/package/kernel/mac80211/patches/005-backports-add-napi_alloc_frag.patch
  1118. +++ /dev/null
  1119. @@ -1,20 +0,0 @@
  1120. -From: Felix Fietkau <nbd@openwrt.org>
  1121. -Date: Thu, 28 Jan 2016 15:19:22 +0100
  1122. -Subject: [PATCH] backports: add napi_alloc_frag
  1123. -
  1124. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  1125. ----
  1126. -
  1127. ---- a/backport-include/linux/netdevice.h
  1128. -+++ b/backport-include/linux/netdevice.h
  1129. -@@ -232,6 +232,10 @@ static inline void backport_unregister_n
  1130. - #define unregister_netdevice_many LINUX_BACKPORT(unregister_netdevice_many)
  1131. - #endif
  1132. -
  1133. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
  1134. -+#define napi_alloc_frag netdev_alloc_frag
  1135. -+#endif
  1136. -+
  1137. - /*
  1138. - * Complicated way of saying: We only backport netdev_rss_key stuff on kernels
  1139. - * that either already have net_get_random_once() (>= 3.13) or where we've been
  1140. diff --git a/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch b/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
  1141. index fd1e1cf..8be5fa1 100644
  1142. --- a/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
  1143. +++ b/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
  1144. @@ -1,6 +1,6 @@
  1145. --- a/.local-symbols
  1146. +++ b/.local-symbols
  1147. -@@ -476,44 +476,6 @@ USB_IPHETH=
  1148. +@@ -481,45 +481,6 @@ USB_IPHETH=
  1149. USB_SIERRA_NET=
  1150. USB_VL600=
  1151. USB_NET_CH9200=
  1152. @@ -37,6 +37,7 @@
  1153. -BCMA_DRIVER_PCI=
  1154. -BCMA_DRIVER_PCI_HOSTMODE=
  1155. -BCMA_DRIVER_MIPS=
  1156. +-BCMA_PFLASH=
  1157. -BCMA_SFLASH=
  1158. -BCMA_NFLASH=
  1159. -BCMA_DRIVER_GMAC_CMN=
  1160. @@ -56,7 +57,7 @@
  1161. return (bus->chipco.dev ? bus->chipco.dev : bus->pcicore.dev);
  1162. #else
  1163. return bus->chipco.dev;
  1164. -@@ -4903,7 +4903,7 @@ static int b43_wireless_core_init(struct
  1165. +@@ -4883,7 +4883,7 @@ static int b43_wireless_core_init(struct
  1166. }
  1167. if (sprom->boardflags_lo & B43_BFL_XTAL_NOSLOW)
  1168. hf |= B43_HF_DSCRQ; /* Disable slowclock requests from ucode. */
  1169. diff --git a/package/kernel/mac80211/patches/080-disable_clk_backport.patch b/package/kernel/mac80211/patches/080-disable_clk_backport.patch
  1170. deleted file mode 100644
  1171. index 3765591..0000000
  1172. --- a/package/kernel/mac80211/patches/080-disable_clk_backport.patch
  1173. +++ /dev/null
  1174. @@ -1,20 +0,0 @@
  1175. ---- a/compat/compat-3.6.c
  1176. -+++ b/compat/compat-3.6.c
  1177. -@@ -147,17 +147,3 @@ int sg_alloc_table_from_pages(struct sg_
  1178. - return 0;
  1179. - }
  1180. - EXPORT_SYMBOL_GPL(sg_alloc_table_from_pages);
  1181. --
  1182. --/* whoopsie ! */
  1183. --#ifndef CONFIG_COMMON_CLK
  1184. --int clk_enable(struct clk *clk)
  1185. --{
  1186. -- return 0;
  1187. --}
  1188. --EXPORT_SYMBOL_GPL(clk_enable);
  1189. --
  1190. --void clk_disable(struct clk *clk)
  1191. --{
  1192. --}
  1193. --EXPORT_SYMBOL_GPL(clk_disable);
  1194. --#endif
  1195. diff --git a/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch b/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
  1196. index 02f46c7..fbe22e5 100644
  1197. --- a/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
  1198. +++ b/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
  1199. @@ -309,7 +309,7 @@
  1200. #endif /* AES_GMAC_H */
  1201. --- a/net/mac80211/key.h
  1202. +++ b/net/mac80211/key.h
  1203. -@@ -84,7 +84,7 @@ struct ieee80211_key {
  1204. +@@ -88,7 +88,7 @@ struct ieee80211_key {
  1205. * Management frames.
  1206. */
  1207. u8 rx_pn[IEEE80211_NUM_TIDS + 1][IEEE80211_CCMP_PN_LEN];
  1208. @@ -320,7 +320,7 @@
  1209. struct {
  1210. --- a/net/mac80211/wpa.c
  1211. +++ b/net/mac80211/wpa.c
  1212. -@@ -307,7 +307,8 @@ ieee80211_crypto_tkip_decrypt(struct iee
  1213. +@@ -304,7 +304,8 @@ ieee80211_crypto_tkip_decrypt(struct iee
  1214. }
  1215. @@ -330,7 +330,7 @@
  1216. {
  1217. __le16 mask_fc;
  1218. int a4_included, mgmt;
  1219. -@@ -337,14 +338,8 @@ static void ccmp_special_blocks(struct s
  1220. +@@ -334,14 +335,8 @@ static void ccmp_special_blocks(struct s
  1221. else
  1222. qos_tid = 0;
  1223. @@ -347,7 +347,7 @@
  1224. /* Nonce: Nonce Flags | A2 | PN
  1225. * Nonce Flags: Priority (b0..b3) | Management (b4) | Reserved (b5..b7)
  1226. -@@ -352,6 +347,8 @@ static void ccmp_special_blocks(struct s
  1227. +@@ -349,6 +344,8 @@ static void ccmp_special_blocks(struct s
  1228. b_0[1] = qos_tid | (mgmt << 4);
  1229. memcpy(&b_0[2], hdr->addr2, ETH_ALEN);
  1230. memcpy(&b_0[8], pn, IEEE80211_CCMP_PN_LEN);
  1231. @@ -356,7 +356,7 @@
  1232. /* AAD (extra authenticate-only data) / masked 802.11 header
  1233. * FC | A1 | A2 | A3 | SC | [A4] | [QC] */
  1234. -@@ -463,7 +460,7 @@ static int ccmp_encrypt_skb(struct ieee8
  1235. +@@ -460,7 +457,7 @@ static int ccmp_encrypt_skb(struct ieee8
  1236. return 0;
  1237. pos += IEEE80211_CCMP_HDR_LEN;
  1238. @@ -365,7 +365,7 @@
  1239. ieee80211_aes_ccm_encrypt(key->u.ccmp.tfm, b_0, aad, pos, len,
  1240. skb_put(skb, mic_len), mic_len);
  1241. -@@ -534,7 +531,7 @@ ieee80211_crypto_ccmp_decrypt(struct iee
  1242. +@@ -537,7 +534,7 @@ ieee80211_crypto_ccmp_decrypt(struct iee
  1243. u8 aad[2 * AES_BLOCK_SIZE];
  1244. u8 b_0[AES_BLOCK_SIZE];
  1245. /* hardware didn't decrypt/verify MIC */
  1246. 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
  1247. index d1d9fbd..3ca166f 100644
  1248. --- a/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch
  1249. +++ b/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch
  1250. @@ -2,7 +2,7 @@ Used for AP+STA support in OpenWrt - preserve AP mode keys across STA reconnects
  1251. --- a/net/mac80211/cfg.c
  1252. +++ b/net/mac80211/cfg.c
  1253. -@@ -846,7 +846,6 @@ static int ieee80211_stop_ap(struct wiph
  1254. +@@ -850,7 +850,6 @@ static int ieee80211_stop_ap(struct wiph
  1255. sdata->u.ap.driver_smps_mode = IEEE80211_SMPS_OFF;
  1256. __sta_info_flush(sdata, true);
  1257. diff --git a/package/kernel/mac80211/patches/150-disable_addr_notifier.patch b/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
  1258. index 2855a88..16fab84 100644
  1259. --- a/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
  1260. +++ b/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
  1261. @@ -18,9 +18,9 @@
  1262. static int ieee80211_ifa6_changed(struct notifier_block *nb,
  1263. unsigned long data, void *arg)
  1264. {
  1265. -@@ -1087,14 +1087,14 @@ int ieee80211_register_hw(struct ieee802
  1266. -
  1267. - rtnl_unlock();
  1268. +@@ -1090,14 +1090,14 @@ int ieee80211_register_hw(struct ieee802
  1269. + if (result)
  1270. + goto fail_flows;
  1271. -#ifdef CONFIG_INET
  1272. +#ifdef __disabled__CONFIG_INET
  1273. @@ -35,7 +35,7 @@
  1274. local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed;
  1275. result = register_inet6addr_notifier(&local->ifa6_notifier);
  1276. if (result)
  1277. -@@ -1103,13 +1103,13 @@ int ieee80211_register_hw(struct ieee802
  1278. +@@ -1106,13 +1106,13 @@ int ieee80211_register_hw(struct ieee802
  1279. return 0;
  1280. @@ -51,8 +51,8 @@
  1281. +#if defined(__disabled__CONFIG_INET) || defined(__disabled__CONFIG_IPV6)
  1282. fail_ifa:
  1283. #endif
  1284. - rtnl_lock();
  1285. -@@ -1137,10 +1137,10 @@ void ieee80211_unregister_hw(struct ieee
  1286. + ieee80211_txq_teardown_flows(local);
  1287. +@@ -1142,10 +1142,10 @@ void ieee80211_unregister_hw(struct ieee
  1288. tasklet_kill(&local->tx_pending_tasklet);
  1289. tasklet_kill(&local->tasklet);
  1290. diff --git a/package/kernel/mac80211/patches/210-ap_scan.patch b/package/kernel/mac80211/patches/210-ap_scan.patch
  1291. index a99cbd2..29f05c4 100644
  1292. --- a/package/kernel/mac80211/patches/210-ap_scan.patch
  1293. +++ b/package/kernel/mac80211/patches/210-ap_scan.patch
  1294. @@ -1,6 +1,6 @@
  1295. --- a/net/mac80211/cfg.c
  1296. +++ b/net/mac80211/cfg.c
  1297. -@@ -1999,7 +1999,7 @@ static int ieee80211_scan(struct wiphy *
  1298. +@@ -2008,7 +2008,7 @@ static int ieee80211_scan(struct wiphy *
  1299. * the frames sent while scanning on other channel will be
  1300. * lost)
  1301. */
  1302. diff --git a/package/kernel/mac80211/patches/220-fq_disable_hack.patch b/package/kernel/mac80211/patches/220-fq_disable_hack.patch
  1303. new file mode 100644
  1304. index 0000000..7f420be
  1305. --- /dev/null
  1306. +++ b/package/kernel/mac80211/patches/220-fq_disable_hack.patch
  1307. @@ -0,0 +1,15 @@
  1308. +mac80211 fq has been found to cause a regression in multi-stream TCP
  1309. +performance. Disable it until the cause has been found and fixed
  1310. +
  1311. +--- a/include/net/fq_impl.h
  1312. ++++ b/include/net/fq_impl.h
  1313. +@@ -104,6 +104,9 @@ static struct fq_flow *fq_flow_classify(
  1314. +
  1315. + lockdep_assert_held(&fq->lock);
  1316. +
  1317. ++ /* HACK: disable fq for now until TCP issues are fixed */
  1318. ++ return get_default_func(fq, tin, 0, skb);
  1319. ++
  1320. + hash = skb_get_hash_perturb(skb, fq->perturbation);
  1321. + idx = reciprocal_scale(hash, fq->flows_cnt);
  1322. + flow = &fq->flows[idx];
  1323. 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
  1324. index bddb15a..098bda7 100644
  1325. --- a/package/kernel/mac80211/patches/300-ath9k-force-rx_clear-when-disabling-rx.patch
  1326. +++ b/package/kernel/mac80211/patches/300-ath9k-force-rx_clear-when-disabling-rx.patch
  1327. @@ -3,15 +3,16 @@ Date: Sun, 7 Jun 2015 13:53:35 +0200
  1328. Subject: [PATCH] ath9k: force rx_clear when disabling rx
  1329. This makes stopping Rx more reliable and should reduce the frequency of
  1330. -Rx related DMA stop warnings
  1331. +Rx related DMA stop warnings. Don't use rx_clear in TX99 mode.
  1332. Cc: stable@vger.kernel.org
  1333. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  1334. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  1335. +Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
  1336. ---
  1337. --- a/drivers/net/wireless/ath/ath9k/mac.c
  1338. +++ b/drivers/net/wireless/ath/ath9k/mac.c
  1339. -@@ -677,13 +677,15 @@ void ath9k_hw_startpcureceive(struct ath
  1340. +@@ -677,13 +677,18 @@ void ath9k_hw_startpcureceive(struct ath
  1341. ath9k_ani_reset(ah, is_scanning);
  1342. @@ -24,8 +25,11 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  1343. void ath9k_hw_abortpcurecv(struct ath_hw *ah)
  1344. {
  1345. - REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_ABORT | AR_DIAG_RX_DIS);
  1346. -+ REG_SET_BIT(ah, AR_DIAG_SW,
  1347. -+ AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT | AR_DIAG_FORCE_RX_CLEAR);
  1348. ++ u32 reg = AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT;
  1349. ++
  1350. ++ if (!config_enabled(CPTCFG_ATH9K_TX99))
  1351. ++ reg |= AR_DIAG_FORCE_RX_CLEAR;
  1352. ++ REG_SET_BIT(ah, AR_DIAG_SW, reg);
  1353. ath9k_hw_disable_mib_counters(ah);
  1354. }
  1355. 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
  1356. new file mode 100644
  1357. index 0000000..7caa9be
  1358. --- /dev/null
  1359. +++ b/package/kernel/mac80211/patches/302-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch
  1360. @@ -0,0 +1,37 @@
  1361. +From: Felix Fietkau <nbd@nbd.name>
  1362. +Date: Sat, 14 May 2016 14:51:02 +0200
  1363. +Subject: [PATCH] Revert "ath9k: interpret requested txpower in EIRP
  1364. + domain"
  1365. +
  1366. +This reverts commit 71f5137bf010c6faffab50c0ec15374c59c4a411.
  1367. +---
  1368. +
  1369. +--- a/drivers/net/wireless/ath/ath9k/hw.c
  1370. ++++ b/drivers/net/wireless/ath/ath9k/hw.c
  1371. +@@ -2914,7 +2914,8 @@ void ath9k_hw_apply_txpower(struct ath_h
  1372. + {
  1373. + struct ath_regulatory *reg = ath9k_hw_regulatory(ah);
  1374. + struct ieee80211_channel *channel;
  1375. +- int chan_pwr, new_pwr;
  1376. ++ int chan_pwr, new_pwr, max_gain;
  1377. ++ int ant_gain, ant_reduction = 0;
  1378. +
  1379. + if (!chan)
  1380. + return;
  1381. +@@ -2922,10 +2923,15 @@ void ath9k_hw_apply_txpower(struct ath_h
  1382. + channel = chan->chan;
  1383. + chan_pwr = min_t(int, channel->max_power * 2, MAX_RATE_POWER);
  1384. + new_pwr = min_t(int, chan_pwr, reg->power_limit);
  1385. ++ max_gain = chan_pwr - new_pwr + channel->max_antenna_gain * 2;
  1386. ++
  1387. ++ ant_gain = get_antenna_gain(ah, chan);
  1388. ++ if (ant_gain > max_gain)
  1389. ++ ant_reduction = ant_gain - max_gain;
  1390. +
  1391. + ah->eep_ops->set_txpower(ah, chan,
  1392. + ath9k_regd_get_ctl(reg, chan),
  1393. +- get_antenna_gain(ah, chan), new_pwr, test);
  1394. ++ ant_reduction, new_pwr, test);
  1395. + }
  1396. +
  1397. + void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test)
  1398. 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
  1399. deleted file mode 100644
  1400. index 22b987a..0000000
  1401. --- a/package/kernel/mac80211/patches/302-ath9k_hw-add-low-power-tx-gain-table-for-AR953x.patch
  1402. +++ /dev/null
  1403. @@ -1,95 +0,0 @@
  1404. -From: Felix Fietkau <nbd@openwrt.org>
  1405. -Date: Thu, 14 Jan 2016 03:14:03 +0100
  1406. -Subject: [PATCH] ath9k_hw: add low power tx gain table for AR953x
  1407. -
  1408. -Used in some newer TP-Link AR9533 devices.
  1409. -
  1410. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  1411. ----
  1412. -
  1413. ---- a/drivers/net/wireless/ath/ath9k/ar9003_hw.c
  1414. -+++ b/drivers/net/wireless/ath/ath9k/ar9003_hw.c
  1415. -@@ -698,6 +698,9 @@ static void ar9003_tx_gain_table_mode2(s
  1416. - else if (AR_SREV_9340(ah))
  1417. - INIT_INI_ARRAY(&ah->iniModesTxGain,
  1418. - ar9340Modes_low_ob_db_tx_gain_table_1p0);
  1419. -+ else if (AR_SREV_9531_11(ah))
  1420. -+ INIT_INI_ARRAY(&ah->iniModesTxGain,
  1421. -+ qca953x_1p1_modes_no_xpa_low_power_tx_gain_table);
  1422. - else if (AR_SREV_9485_11_OR_LATER(ah))
  1423. - INIT_INI_ARRAY(&ah->iniModesTxGain,
  1424. - ar9485Modes_low_ob_db_tx_gain_1_1);
  1425. ---- a/drivers/net/wireless/ath/ath9k/ar953x_initvals.h
  1426. -+++ b/drivers/net/wireless/ath/ath9k/ar953x_initvals.h
  1427. -@@ -757,6 +757,71 @@ static const u32 qca953x_1p1_modes_xpa_t
  1428. - {0x00016448, 0x6c927a70},
  1429. - };
  1430. -
  1431. -+static const u32 qca953x_1p1_modes_no_xpa_low_power_tx_gain_table[][2] = {
  1432. -+ /* Addr allmodes */
  1433. -+ {0x0000a2dc, 0xfff55592},
  1434. -+ {0x0000a2e0, 0xfff99924},
  1435. -+ {0x0000a2e4, 0xfffe1e00},
  1436. -+ {0x0000a2e8, 0xffffe000},
  1437. -+ {0x0000a410, 0x000050d6},
  1438. -+ {0x0000a500, 0x00000069},
  1439. -+ {0x0000a504, 0x0400006b},
  1440. -+ {0x0000a508, 0x0800006d},
  1441. -+ {0x0000a50c, 0x0c000269},
  1442. -+ {0x0000a510, 0x1000026b},
  1443. -+ {0x0000a514, 0x1400026d},
  1444. -+ {0x0000a518, 0x18000669},
  1445. -+ {0x0000a51c, 0x1c00066b},
  1446. -+ {0x0000a520, 0x1d000a68},
  1447. -+ {0x0000a524, 0x21000a6a},
  1448. -+ {0x0000a528, 0x25000a6c},
  1449. -+ {0x0000a52c, 0x29000a6e},
  1450. -+ {0x0000a530, 0x2d0012a9},
  1451. -+ {0x0000a534, 0x310012ab},
  1452. -+ {0x0000a538, 0x350012ad},
  1453. -+ {0x0000a53c, 0x39001b0a},
  1454. -+ {0x0000a540, 0x3d001b0c},
  1455. -+ {0x0000a544, 0x41001b0e},
  1456. -+ {0x0000a548, 0x43001bae},
  1457. -+ {0x0000a54c, 0x45001914},
  1458. -+ {0x0000a550, 0x47001916},
  1459. -+ {0x0000a554, 0x49001b96},
  1460. -+ {0x0000a558, 0x49001b96},
  1461. -+ {0x0000a55c, 0x49001b96},
  1462. -+ {0x0000a560, 0x49001b96},
  1463. -+ {0x0000a564, 0x49001b96},
  1464. -+ {0x0000a568, 0x49001b96},
  1465. -+ {0x0000a56c, 0x49001b96},
  1466. -+ {0x0000a570, 0x49001b96},
  1467. -+ {0x0000a574, 0x49001b96},
  1468. -+ {0x0000a578, 0x49001b96},
  1469. -+ {0x0000a57c, 0x49001b96},
  1470. -+ {0x0000a600, 0x00000000},
  1471. -+ {0x0000a604, 0x00000000},
  1472. -+ {0x0000a608, 0x00000000},
  1473. -+ {0x0000a60c, 0x00000000},
  1474. -+ {0x0000a610, 0x00000000},
  1475. -+ {0x0000a614, 0x00000000},
  1476. -+ {0x0000a618, 0x00804201},
  1477. -+ {0x0000a61c, 0x01408201},
  1478. -+ {0x0000a620, 0x01408502},
  1479. -+ {0x0000a624, 0x01408502},
  1480. -+ {0x0000a628, 0x01408502},
  1481. -+ {0x0000a62c, 0x01408502},
  1482. -+ {0x0000a630, 0x01408502},
  1483. -+ {0x0000a634, 0x01408502},
  1484. -+ {0x0000a638, 0x01408502},
  1485. -+ {0x0000a63c, 0x01408502},
  1486. -+ {0x0000b2dc, 0xfff55592},
  1487. -+ {0x0000b2e0, 0xfff99924},
  1488. -+ {0x0000b2e4, 0xfffe1e00},
  1489. -+ {0x0000b2e8, 0xffffe000},
  1490. -+ {0x00016044, 0x044922db},
  1491. -+ {0x00016048, 0x6c927a70},
  1492. -+ {0x00016444, 0x044922db},
  1493. -+ {0x00016448, 0x6c927a70},
  1494. -+};
  1495. -+
  1496. - static const u32 qca953x_2p0_baseband_core[][2] = {
  1497. - /* Addr allmodes */
  1498. - {0x00009800, 0xafe68e30},
  1499. 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
  1500. new file mode 100644
  1501. index 0000000..73accd8
  1502. --- /dev/null
  1503. +++ b/package/kernel/mac80211/patches/303-ath10k-Ensure-txrx-compl-task-is-stopped-when-cleani.patch
  1504. @@ -0,0 +1,21 @@
  1505. +From: Ben Greear <greearb@candelatech.com>
  1506. +Date: Fri, 1 Apr 2016 14:12:08 -0700
  1507. +Subject: [PATCH] ath10k: Ensure txrx-compl-task is stopped when cleaning
  1508. + htt-tx.
  1509. +
  1510. +Otherwise, the txrx-compl-task may access some bad memory?
  1511. +
  1512. +Signed-off-by: Ben Greear <greearb@candelatech.com>
  1513. +---
  1514. +
  1515. +--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
  1516. ++++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
  1517. +@@ -388,6 +388,8 @@ void ath10k_htt_tx_free(struct ath10k_ht
  1518. + {
  1519. + int size;
  1520. +
  1521. ++ tasklet_kill(&htt->txrx_compl_task);
  1522. ++
  1523. + idr_for_each(&htt->pending_tx, ath10k_htt_tx_clean_up_pending, htt->ar);
  1524. + idr_destroy(&htt->pending_tx);
  1525. +
  1526. 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
  1527. deleted file mode 100644
  1528. index 7bb7435..0000000
  1529. --- a/package/kernel/mac80211/patches/303-rt2x00-fix-monitor-mode-regression.patch
  1530. +++ /dev/null
  1531. @@ -1,156 +0,0 @@
  1532. -From: Eli Cooper <elicooper@gmx.com>
  1533. -Date: Thu, 14 Jan 2016 00:07:12 +0800
  1534. -Subject: [PATCH] rt2x00: fix monitor mode regression
  1535. -
  1536. -Since commit df1404650ccbfeb76a84f301f22316be0d00a864 monitor mode for rt2x00
  1537. -has been made effectively useless because the hardware filter is configured to
  1538. -drop packets whose intended recipient is not the device, regardless of the
  1539. -presence of monitor mode interfaces.
  1540. -
  1541. -This patch fixes this regression by adding explicit monitor mode support, and
  1542. -configuring the hardware filter accordingly.
  1543. -
  1544. -Signed-off-by: Eli Cooper <elicooper@gmx.com>
  1545. ----
  1546. -
  1547. ---- a/drivers/net/wireless/ralink/rt2x00/rt2400pci.c
  1548. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2400pci.c
  1549. -@@ -273,8 +273,10 @@ static void rt2400pci_config_filter(stru
  1550. - !(filter_flags & FIF_PLCPFAIL));
  1551. - rt2x00_set_field32(&reg, RXCSR0_DROP_CONTROL,
  1552. - !(filter_flags & FIF_CONTROL));
  1553. -- rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME, 1);
  1554. -+ rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME,
  1555. -+ !rt2x00dev->is_monitoring);
  1556. - rt2x00_set_field32(&reg, RXCSR0_DROP_TODS,
  1557. -+ !rt2x00dev->is_monitoring &&
  1558. - !rt2x00dev->intf_ap_count);
  1559. - rt2x00_set_field32(&reg, RXCSR0_DROP_VERSION_ERROR, 1);
  1560. - rt2x00mmio_register_write(rt2x00dev, RXCSR0, reg);
  1561. ---- a/drivers/net/wireless/ralink/rt2x00/rt2500pci.c
  1562. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2500pci.c
  1563. -@@ -274,8 +274,10 @@ static void rt2500pci_config_filter(stru
  1564. - !(filter_flags & FIF_PLCPFAIL));
  1565. - rt2x00_set_field32(&reg, RXCSR0_DROP_CONTROL,
  1566. - !(filter_flags & FIF_CONTROL));
  1567. -- rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME, 1);
  1568. -+ rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME,
  1569. -+ !rt2x00dev->is_monitoring);
  1570. - rt2x00_set_field32(&reg, RXCSR0_DROP_TODS,
  1571. -+ !rt2x00dev->is_monitoring &&
  1572. - !rt2x00dev->intf_ap_count);
  1573. - rt2x00_set_field32(&reg, RXCSR0_DROP_VERSION_ERROR, 1);
  1574. - rt2x00_set_field32(&reg, RXCSR0_DROP_MCAST,
  1575. ---- a/drivers/net/wireless/ralink/rt2x00/rt2500usb.c
  1576. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2500usb.c
  1577. -@@ -437,8 +437,10 @@ static void rt2500usb_config_filter(stru
  1578. - !(filter_flags & FIF_PLCPFAIL));
  1579. - rt2x00_set_field16(&reg, TXRX_CSR2_DROP_CONTROL,
  1580. - !(filter_flags & FIF_CONTROL));
  1581. -- rt2x00_set_field16(&reg, TXRX_CSR2_DROP_NOT_TO_ME, 1);
  1582. -+ rt2x00_set_field16(&reg, TXRX_CSR2_DROP_NOT_TO_ME,
  1583. -+ !rt2x00dev->is_monitoring);
  1584. - rt2x00_set_field16(&reg, TXRX_CSR2_DROP_TODS,
  1585. -+ !rt2x00dev->is_monitoring &&
  1586. - !rt2x00dev->intf_ap_count);
  1587. - rt2x00_set_field16(&reg, TXRX_CSR2_DROP_VERSION_ERROR, 1);
  1588. - rt2x00_set_field16(&reg, TXRX_CSR2_DROP_MULTICAST,
  1589. ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  1590. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  1591. -@@ -1490,7 +1490,8 @@ void rt2800_config_filter(struct rt2x00_
  1592. - !(filter_flags & FIF_FCSFAIL));
  1593. - rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_PHY_ERROR,
  1594. - !(filter_flags & FIF_PLCPFAIL));
  1595. -- rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_TO_ME, 1);
  1596. -+ rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_TO_ME,
  1597. -+ !rt2x00dev->is_monitoring);
  1598. - rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_MY_BSSD, 0);
  1599. - rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_VER_ERROR, 1);
  1600. - rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_MULTICAST,
  1601. ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  1602. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  1603. -@@ -844,11 +844,13 @@ struct rt2x00_dev {
  1604. - * - Open sta interface count.
  1605. - * - Association count.
  1606. - * - Beaconing enabled count.
  1607. -+ * - Whether the device is monitoring.
  1608. - */
  1609. - unsigned int intf_ap_count;
  1610. - unsigned int intf_sta_count;
  1611. - unsigned int intf_associated;
  1612. - unsigned int intf_beaconing;
  1613. -+ bool is_monitoring;
  1614. -
  1615. - /*
  1616. - * Interface combinations
  1617. ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00config.c
  1618. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00config.c
  1619. -@@ -244,6 +244,16 @@ void rt2x00lib_config(struct rt2x00_dev
  1620. - (ieee80211_flags & IEEE80211_CONF_CHANGE_PS))
  1621. - cancel_delayed_work_sync(&rt2x00dev->autowakeup_work);
  1622. -
  1623. -+ if (ieee80211_flags & IEEE80211_CONF_CHANGE_MONITOR) {
  1624. -+ if (conf->flags & IEEE80211_CONF_MONITOR) {
  1625. -+ rt2x00_dbg(rt2x00dev, "Monitor mode is enabled\n");
  1626. -+ rt2x00dev->is_monitoring = true;
  1627. -+ } else {
  1628. -+ rt2x00_dbg(rt2x00dev, "Monitor mode is disabled\n");
  1629. -+ rt2x00dev->is_monitoring = false;
  1630. -+ }
  1631. -+ }
  1632. -+
  1633. - /*
  1634. - * Start configuration.
  1635. - */
  1636. ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  1637. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  1638. -@@ -1204,6 +1204,7 @@ int rt2x00lib_start(struct rt2x00_dev *r
  1639. - rt2x00dev->intf_ap_count = 0;
  1640. - rt2x00dev->intf_sta_count = 0;
  1641. - rt2x00dev->intf_associated = 0;
  1642. -+ rt2x00dev->is_monitoring = false;
  1643. -
  1644. - /* Enable the radio */
  1645. - retval = rt2x00lib_enable_radio(rt2x00dev);
  1646. ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
  1647. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
  1648. -@@ -385,11 +385,6 @@ void rt2x00mac_configure_filter(struct i
  1649. - *total_flags |= FIF_PSPOLL;
  1650. - }
  1651. -
  1652. -- /*
  1653. -- * Check if there is any work left for us.
  1654. -- */
  1655. -- if (rt2x00dev->packet_filter == *total_flags)
  1656. -- return;
  1657. - rt2x00dev->packet_filter = *total_flags;
  1658. -
  1659. - rt2x00dev->ops->lib->config_filter(rt2x00dev, *total_flags);
  1660. ---- a/drivers/net/wireless/ralink/rt2x00/rt61pci.c
  1661. -+++ b/drivers/net/wireless/ralink/rt2x00/rt61pci.c
  1662. -@@ -530,8 +530,10 @@ static void rt61pci_config_filter(struct
  1663. - !(filter_flags & FIF_PLCPFAIL));
  1664. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_CONTROL,
  1665. - !(filter_flags & (FIF_CONTROL | FIF_PSPOLL)));
  1666. -- rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME, 1);
  1667. -+ rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME,
  1668. -+ !rt2x00dev->is_monitoring);
  1669. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_TO_DS,
  1670. -+ !rt2x00dev->is_monitoring &&
  1671. - !rt2x00dev->intf_ap_count);
  1672. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_VERSION_ERROR, 1);
  1673. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_MULTICAST,
  1674. ---- a/drivers/net/wireless/ralink/rt2x00/rt73usb.c
  1675. -+++ b/drivers/net/wireless/ralink/rt2x00/rt73usb.c
  1676. -@@ -480,8 +480,10 @@ static void rt73usb_config_filter(struct
  1677. - !(filter_flags & FIF_PLCPFAIL));
  1678. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_CONTROL,
  1679. - !(filter_flags & (FIF_CONTROL | FIF_PSPOLL)));
  1680. -- rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME, 1);
  1681. -+ rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME,
  1682. -+ !rt2x00dev->is_monitoring);
  1683. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_TO_DS,
  1684. -+ !rt2x00dev->is_monitoring &&
  1685. - !rt2x00dev->intf_ap_count);
  1686. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_VERSION_ERROR, 1);
  1687. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_MULTICAST,
  1688. 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
  1689. new file mode 100644
  1690. index 0000000..7dec1fb
  1691. --- /dev/null
  1692. +++ b/package/kernel/mac80211/patches/304-ath10k-Ensure-peer_map-references-are-cleaned-up.patch
  1693. @@ -0,0 +1,60 @@
  1694. +From: Ben Greear <greearb@candelatech.com>
  1695. +Date: Fri, 1 Apr 2016 14:12:09 -0700
  1696. +Subject: [PATCH] ath10k: Ensure peer_map references are cleaned up.
  1697. +
  1698. +While debugging OS crashes due to firmware crashes, I enabled
  1699. +kasan, and it noticed that peer objects were being used-after-freed.
  1700. +
  1701. +Looks like there are two places we could be leaving stale references
  1702. +in the peer-map, so clean that up.
  1703. +
  1704. +Signed-off-by: Ben Greear <greearb@candelatech.com>
  1705. +---
  1706. +
  1707. +--- a/drivers/net/wireless/ath/ath10k/mac.c
  1708. ++++ b/drivers/net/wireless/ath/ath10k/mac.c
  1709. +@@ -802,6 +802,7 @@ static void ath10k_peer_cleanup(struct a
  1710. + {
  1711. + struct ath10k_peer *peer, *tmp;
  1712. + int peer_id;
  1713. ++ int i;
  1714. +
  1715. + lockdep_assert_held(&ar->conf_mutex);
  1716. +
  1717. +@@ -818,6 +819,17 @@ static void ath10k_peer_cleanup(struct a
  1718. + ar->peer_map[peer_id] = NULL;
  1719. + }
  1720. +
  1721. ++ /* Double check that peer is properly un-referenced from
  1722. ++ * the peer_map
  1723. ++ */
  1724. ++ for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) {
  1725. ++ if (ar->peer_map[i] == peer) {
  1726. ++ ath10k_warn(ar, "removing stale peer_map entry for %pM (ptr %p idx %d)\n",
  1727. ++ peer->addr, peer, i);
  1728. ++ ar->peer_map[i] = NULL;
  1729. ++ }
  1730. ++ }
  1731. ++
  1732. + list_del(&peer->list);
  1733. + kfree(peer);
  1734. + ar->num_peers--;
  1735. +@@ -828,6 +840,7 @@ static void ath10k_peer_cleanup(struct a
  1736. + static void ath10k_peer_cleanup_all(struct ath10k *ar)
  1737. + {
  1738. + struct ath10k_peer *peer, *tmp;
  1739. ++ int i;
  1740. +
  1741. + lockdep_assert_held(&ar->conf_mutex);
  1742. +
  1743. +@@ -836,6 +849,10 @@ static void ath10k_peer_cleanup_all(stru
  1744. + list_del(&peer->list);
  1745. + kfree(peer);
  1746. + }
  1747. ++
  1748. ++ for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++)
  1749. ++ ar->peer_map[i] = NULL;
  1750. ++
  1751. + spin_unlock_bh(&ar->data_lock);
  1752. +
  1753. + ar->num_peers = 0;
  1754. 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
  1755. deleted file mode 100644
  1756. index 049059a..0000000
  1757. --- a/package/kernel/mac80211/patches/304-ath9k-avoid-ANI-restart-if-no-trigger.patch
  1758. +++ /dev/null
  1759. @@ -1,32 +0,0 @@
  1760. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  1761. -Date: Fri, 15 Jan 2016 18:17:17 +0800
  1762. -Subject: [PATCH] ath9k: avoid ANI restart if no trigger
  1763. -
  1764. -Fixes commit 54da20d83f0e ("ath9k_hw: improve ANI processing and rx desensitizing parameters")
  1765. -
  1766. -Call ath9k_ani_restart() only when the phy error rate reach the
  1767. -ANI immunity threshold. Sync the logic with internal code base.
  1768. -
  1769. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  1770. ----
  1771. -
  1772. ---- a/drivers/net/wireless/ath/ath9k/ani.c
  1773. -+++ b/drivers/net/wireless/ath/ath9k/ani.c
  1774. -@@ -444,14 +444,16 @@ void ath9k_hw_ani_monitor(struct ath_hw
  1775. - ofdmPhyErrRate < ah->config.ofdm_trig_low) {
  1776. - ath9k_hw_ani_lower_immunity(ah);
  1777. - aniState->ofdmsTurn = !aniState->ofdmsTurn;
  1778. -+ ath9k_ani_restart(ah);
  1779. - } else if (ofdmPhyErrRate > ah->config.ofdm_trig_high) {
  1780. - ath9k_hw_ani_ofdm_err_trigger(ah);
  1781. - aniState->ofdmsTurn = false;
  1782. -+ ath9k_ani_restart(ah);
  1783. - } else if (cckPhyErrRate > ah->config.cck_trig_high) {
  1784. - ath9k_hw_ani_cck_err_trigger(ah);
  1785. - aniState->ofdmsTurn = true;
  1786. -+ ath9k_ani_restart(ah);
  1787. - }
  1788. -- ath9k_ani_restart(ah);
  1789. - }
  1790. - }
  1791. - EXPORT_SYMBOL(ath9k_hw_ani_monitor);
  1792. 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
  1793. new file mode 100644
  1794. index 0000000..7248a8c
  1795. --- /dev/null
  1796. +++ b/package/kernel/mac80211/patches/305-ath10k-Clean-up-peer-when-sta-goes-away.patch
  1797. @@ -0,0 +1,32 @@
  1798. +From: Ben Greear <greearb@candelatech.com>
  1799. +Date: Fri, 1 Apr 2016 14:12:11 -0700
  1800. +Subject: [PATCH] ath10k: Clean up peer when sta goes away.
  1801. +
  1802. +If WMI and/or firmware has issues removing the peer object,
  1803. +then we still need to clean up the peer object in the driver.
  1804. +
  1805. +Signed-off-by: Ben Greear <greearb@candelatech.com>
  1806. +---
  1807. +
  1808. +--- a/drivers/net/wireless/ath/ath10k/mac.c
  1809. ++++ b/drivers/net/wireless/ath/ath10k/mac.c
  1810. +@@ -5992,9 +5992,17 @@ static int ath10k_sta_state(struct ieee8
  1811. + continue;
  1812. +
  1813. + if (peer->sta == sta) {
  1814. +- ath10k_warn(ar, "found sta peer %pM entry on vdev %i after it was supposedly removed\n",
  1815. +- sta->addr, arvif->vdev_id);
  1816. ++ ath10k_warn(ar, "found sta peer %pM (ptr %p id %d) entry on vdev %i after it was supposedly removed\n",
  1817. ++ sta->addr, peer, i, arvif->vdev_id);
  1818. + peer->sta = NULL;
  1819. ++
  1820. ++ /* Clean up the peer object as well since we
  1821. ++ * must have failed to do this above.
  1822. ++ */
  1823. ++ list_del(&peer->list);
  1824. ++ ar->peer_map[i] = NULL;
  1825. ++ kfree(peer);
  1826. ++ ar->num_peers--;
  1827. + }
  1828. + }
  1829. + spin_unlock_bh(&ar->data_lock);
  1830. 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
  1831. deleted file mode 100644
  1832. index a1ac67c..0000000
  1833. --- a/package/kernel/mac80211/patches/305-ath9k-clean-up-ANI-per-channel-pointer-checking.patch
  1834. +++ /dev/null
  1835. @@ -1,91 +0,0 @@
  1836. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  1837. -Date: Fri, 15 Jan 2016 18:17:18 +0800
  1838. -Subject: [PATCH] ath9k: clean up ANI per-channel pointer checking
  1839. -
  1840. -commit c24bd3620c50 ("ath9k: Do not maintain ANI state per-channel")
  1841. -removed per-channel handling, the code to check 'curchan' also
  1842. -should be removed as never used.
  1843. -
  1844. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  1845. ----
  1846. -
  1847. ---- a/drivers/net/wireless/ath/ath9k/ani.c
  1848. -+++ b/drivers/net/wireless/ath/ath9k/ani.c
  1849. -@@ -126,12 +126,8 @@ static void ath9k_hw_update_mibstats(str
  1850. -
  1851. - static void ath9k_ani_restart(struct ath_hw *ah)
  1852. - {
  1853. -- struct ar5416AniState *aniState;
  1854. --
  1855. -- if (!ah->curchan)
  1856. -- return;
  1857. -+ struct ar5416AniState *aniState = &ah->ani;
  1858. -
  1859. -- aniState = &ah->ani;
  1860. - aniState->listenTime = 0;
  1861. -
  1862. - ENABLE_REGWRITE_BUFFER(ah);
  1863. -@@ -221,12 +217,7 @@ static void ath9k_hw_set_ofdm_nil(struct
  1864. -
  1865. - static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hw *ah)
  1866. - {
  1867. -- struct ar5416AniState *aniState;
  1868. --
  1869. -- if (!ah->curchan)
  1870. -- return;
  1871. --
  1872. -- aniState = &ah->ani;
  1873. -+ struct ar5416AniState *aniState = &ah->ani;
  1874. -
  1875. - if (aniState->ofdmNoiseImmunityLevel < ATH9K_ANI_OFDM_MAX_LEVEL)
  1876. - ath9k_hw_set_ofdm_nil(ah, aniState->ofdmNoiseImmunityLevel + 1, false);
  1877. -@@ -281,12 +272,7 @@ static void ath9k_hw_set_cck_nil(struct
  1878. -
  1879. - static void ath9k_hw_ani_cck_err_trigger(struct ath_hw *ah)
  1880. - {
  1881. -- struct ar5416AniState *aniState;
  1882. --
  1883. -- if (!ah->curchan)
  1884. -- return;
  1885. --
  1886. -- aniState = &ah->ani;
  1887. -+ struct ar5416AniState *aniState = &ah->ani;
  1888. -
  1889. - if (aniState->cckNoiseImmunityLevel < ATH9K_ANI_CCK_MAX_LEVEL)
  1890. - ath9k_hw_set_cck_nil(ah, aniState->cckNoiseImmunityLevel + 1,
  1891. -@@ -299,9 +285,7 @@ static void ath9k_hw_ani_cck_err_trigger
  1892. - */
  1893. - static void ath9k_hw_ani_lower_immunity(struct ath_hw *ah)
  1894. - {
  1895. -- struct ar5416AniState *aniState;
  1896. --
  1897. -- aniState = &ah->ani;
  1898. -+ struct ar5416AniState *aniState = &ah->ani;
  1899. -
  1900. - /* lower OFDM noise immunity */
  1901. - if (aniState->ofdmNoiseImmunityLevel > 0 &&
  1902. -@@ -329,7 +313,7 @@ void ath9k_ani_reset(struct ath_hw *ah,
  1903. - struct ath_common *common = ath9k_hw_common(ah);
  1904. - int ofdm_nil, cck_nil;
  1905. -
  1906. -- if (!ah->curchan)
  1907. -+ if (!chan)
  1908. - return;
  1909. -
  1910. - BUG_ON(aniState == NULL);
  1911. -@@ -416,14 +400,10 @@ static bool ath9k_hw_ani_read_counters(s
  1912. -
  1913. - void ath9k_hw_ani_monitor(struct ath_hw *ah, struct ath9k_channel *chan)
  1914. - {
  1915. -- struct ar5416AniState *aniState;
  1916. -+ struct ar5416AniState *aniState = &ah->ani;
  1917. - struct ath_common *common = ath9k_hw_common(ah);
  1918. - u32 ofdmPhyErrRate, cckPhyErrRate;
  1919. -
  1920. -- if (!ah->curchan)
  1921. -- return;
  1922. --
  1923. -- aniState = &ah->ani;
  1924. - if (!ath9k_hw_ani_read_counters(ah))
  1925. - return;
  1926. -
  1927. 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
  1928. deleted file mode 100644
  1929. index cf8194a..0000000
  1930. --- a/package/kernel/mac80211/patches/306-ath9k-do-not-reset-while-BB-panic-0x4000409-on-ar956.patch
  1931. +++ /dev/null
  1932. @@ -1,31 +0,0 @@
  1933. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  1934. -Date: Fri, 15 Jan 2016 18:17:19 +0800
  1935. -Subject: [PATCH] ath9k: do not reset while BB panic(0x4000409) on ar9561
  1936. -
  1937. -BB panic(0x4000409) observed while AP enabling/disabling
  1938. -bursting.
  1939. -
  1940. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  1941. ----
  1942. -
  1943. ---- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  1944. -+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  1945. -@@ -2071,7 +2071,8 @@ void ar9003_hw_attach_phy_ops(struct ath
  1946. - * to be disabled.
  1947. - *
  1948. - * 0x04000409: Packet stuck on receive.
  1949. -- * Full chip reset is required for all chips except AR9340.
  1950. -+ * Full chip reset is required for all chips except
  1951. -+ * AR9340, AR9531 and AR9561.
  1952. - */
  1953. -
  1954. - /*
  1955. -@@ -2100,7 +2101,7 @@ bool ar9003_hw_bb_watchdog_check(struct
  1956. - case 0x04000b09:
  1957. - return true;
  1958. - case 0x04000409:
  1959. -- if (AR_SREV_9340(ah) || AR_SREV_9531(ah))
  1960. -+ if (AR_SREV_9340(ah) || AR_SREV_9531(ah) || AR_SREV_9561(ah))
  1961. - return false;
  1962. - else
  1963. - return true;
  1964. 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
  1965. new file mode 100644
  1966. index 0000000..4a8f143
  1967. --- /dev/null
  1968. +++ b/package/kernel/mac80211/patches/306-mac80211-add-hdrlen-to-ieee80211_tx_data.patch
  1969. @@ -0,0 +1,203 @@
  1970. +From: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  1971. +Date: Fri, 19 Feb 2016 11:01:49 +0100
  1972. +Subject: [PATCH] mac80211: add hdrlen to ieee80211_tx_data
  1973. +
  1974. +Add hdrlen to ieee80211_tx_data and use this
  1975. +when wep/ccmd/tkip. This is preparation for
  1976. +aligned4 code.
  1977. +
  1978. +Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  1979. +---
  1980. +
  1981. +--- a/net/mac80211/ieee80211_i.h
  1982. ++++ b/net/mac80211/ieee80211_i.h
  1983. +@@ -173,6 +173,7 @@ struct ieee80211_tx_data {
  1984. + struct ieee80211_tx_rate rate;
  1985. +
  1986. + unsigned int flags;
  1987. ++ unsigned int hdrlen;
  1988. + };
  1989. +
  1990. +
  1991. +--- a/net/mac80211/tx.c
  1992. ++++ b/net/mac80211/tx.c
  1993. +@@ -922,7 +922,7 @@ ieee80211_tx_h_fragment(struct ieee80211
  1994. + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  1995. + struct ieee80211_hdr *hdr = (void *)skb->data;
  1996. + int frag_threshold = tx->local->hw.wiphy->frag_threshold;
  1997. +- int hdrlen;
  1998. ++ int hdrlen = tx->hdrlen;
  1999. + int fragnum;
  2000. +
  2001. + /* no matter what happens, tx->skb moves to tx->skbs */
  2002. +@@ -943,8 +943,6 @@ ieee80211_tx_h_fragment(struct ieee80211
  2003. + if (WARN_ON(info->flags & IEEE80211_TX_CTL_AMPDU))
  2004. + return TX_DROP;
  2005. +
  2006. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2007. +-
  2008. + /* internal error, why isn't DONTFRAG set? */
  2009. + if (WARN_ON(skb->len + FCS_LEN <= frag_threshold))
  2010. + return TX_DROP;
  2011. +@@ -1176,6 +1174,8 @@ ieee80211_tx_prepare(struct ieee80211_su
  2012. +
  2013. + hdr = (struct ieee80211_hdr *) skb->data;
  2014. +
  2015. ++ tx->hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2016. ++
  2017. + if (likely(sta)) {
  2018. + if (!IS_ERR(sta))
  2019. + tx->sta = sta;
  2020. +--- a/net/mac80211/util.c
  2021. ++++ b/net/mac80211/util.c
  2022. +@@ -1226,6 +1226,7 @@ void ieee80211_send_auth(struct ieee8021
  2023. + struct ieee80211_local *local = sdata->local;
  2024. + struct sk_buff *skb;
  2025. + struct ieee80211_mgmt *mgmt;
  2026. ++ unsigned int hdrlen;
  2027. + int err;
  2028. +
  2029. + /* 24 + 6 = header + auth_algo + auth_transaction + status_code */
  2030. +@@ -1250,8 +1251,10 @@ void ieee80211_send_auth(struct ieee8021
  2031. + memcpy(skb_put(skb, extra_len), extra, extra_len);
  2032. +
  2033. + if (auth_alg == WLAN_AUTH_SHARED_KEY && transaction == 3) {
  2034. ++ hdrlen = ieee80211_hdrlen(mgmt->frame_control);
  2035. + mgmt->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
  2036. +- err = ieee80211_wep_encrypt(local, skb, key, key_len, key_idx);
  2037. ++ err = ieee80211_wep_encrypt(local, skb, hdrlen, key,
  2038. ++ key_len, key_idx);
  2039. + WARN_ON(err);
  2040. + }
  2041. +
  2042. +--- a/net/mac80211/wep.c
  2043. ++++ b/net/mac80211/wep.c
  2044. +@@ -89,11 +89,11 @@ static void ieee80211_wep_get_iv(struct
  2045. +
  2046. + static u8 *ieee80211_wep_add_iv(struct ieee80211_local *local,
  2047. + struct sk_buff *skb,
  2048. ++ unsigned int hdrlen,
  2049. + int keylen, int keyidx)
  2050. + {
  2051. + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  2052. + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  2053. +- unsigned int hdrlen;
  2054. + u8 *newhdr;
  2055. +
  2056. + hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
  2057. +@@ -101,7 +101,6 @@ static u8 *ieee80211_wep_add_iv(struct i
  2058. + if (WARN_ON(skb_headroom(skb) < IEEE80211_WEP_IV_LEN))
  2059. + return NULL;
  2060. +
  2061. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2062. + newhdr = skb_push(skb, IEEE80211_WEP_IV_LEN);
  2063. + memmove(newhdr, newhdr + IEEE80211_WEP_IV_LEN, hdrlen);
  2064. +
  2065. +@@ -160,6 +159,7 @@ int ieee80211_wep_encrypt_data(struct cr
  2066. + */
  2067. + int ieee80211_wep_encrypt(struct ieee80211_local *local,
  2068. + struct sk_buff *skb,
  2069. ++ unsigned int hdrlen,
  2070. + const u8 *key, int keylen, int keyidx)
  2071. + {
  2072. + u8 *iv;
  2073. +@@ -169,7 +169,7 @@ int ieee80211_wep_encrypt(struct ieee802
  2074. + if (WARN_ON(skb_tailroom(skb) < IEEE80211_WEP_ICV_LEN))
  2075. + return -1;
  2076. +
  2077. +- iv = ieee80211_wep_add_iv(local, skb, keylen, keyidx);
  2078. ++ iv = ieee80211_wep_add_iv(local, skb, hdrlen, keylen, keyidx);
  2079. + if (!iv)
  2080. + return -1;
  2081. +
  2082. +@@ -306,13 +306,14 @@ static int wep_encrypt_skb(struct ieee80
  2083. + struct ieee80211_key_conf *hw_key = info->control.hw_key;
  2084. +
  2085. + if (!hw_key) {
  2086. +- if (ieee80211_wep_encrypt(tx->local, skb, tx->key->conf.key,
  2087. ++ if (ieee80211_wep_encrypt(tx->local, skb, tx->hdrlen,
  2088. ++ tx->key->conf.key,
  2089. + tx->key->conf.keylen,
  2090. + tx->key->conf.keyidx))
  2091. + return -1;
  2092. + } else if ((hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV) ||
  2093. + (hw_key->flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE)) {
  2094. +- if (!ieee80211_wep_add_iv(tx->local, skb,
  2095. ++ if (!ieee80211_wep_add_iv(tx->local, skb, tx->hdrlen,
  2096. + tx->key->conf.keylen,
  2097. + tx->key->conf.keyidx))
  2098. + return -1;
  2099. +--- a/net/mac80211/wep.h
  2100. ++++ b/net/mac80211/wep.h
  2101. +@@ -22,6 +22,7 @@ int ieee80211_wep_encrypt_data(struct cr
  2102. + size_t klen, u8 *data, size_t data_len);
  2103. + int ieee80211_wep_encrypt(struct ieee80211_local *local,
  2104. + struct sk_buff *skb,
  2105. ++ unsigned int hdrlen,
  2106. + const u8 *key, int keylen, int keyidx);
  2107. + int ieee80211_wep_decrypt_data(struct crypto_cipher *tfm, u8 *rc4key,
  2108. + size_t klen, u8 *data, size_t data_len);
  2109. +--- a/net/mac80211/wpa.c
  2110. ++++ b/net/mac80211/wpa.c
  2111. +@@ -43,7 +43,7 @@ ieee80211_tx_h_michael_mic_add(struct ie
  2112. + skb->len < 24 || !ieee80211_is_data_present(hdr->frame_control))
  2113. + return TX_CONTINUE;
  2114. +
  2115. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2116. ++ hdrlen = tx->hdrlen;
  2117. + if (skb->len < hdrlen)
  2118. + return TX_DROP;
  2119. +
  2120. +@@ -186,7 +186,6 @@ mic_fail_no_key:
  2121. +
  2122. + static int tkip_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
  2123. + {
  2124. +- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
  2125. + struct ieee80211_key *key = tx->key;
  2126. + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  2127. + unsigned int hdrlen;
  2128. +@@ -201,7 +200,7 @@ static int tkip_encrypt_skb(struct ieee8
  2129. + return 0;
  2130. + }
  2131. +
  2132. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2133. ++ hdrlen = tx->hdrlen;
  2134. + len = skb->len - hdrlen;
  2135. +
  2136. + if (info->control.hw_key)
  2137. +@@ -418,7 +417,7 @@ static int ccmp_encrypt_skb(struct ieee8
  2138. + return 0;
  2139. + }
  2140. +
  2141. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2142. ++ hdrlen = tx->hdrlen;
  2143. + len = skb->len - hdrlen;
  2144. +
  2145. + if (info->control.hw_key)
  2146. +@@ -651,7 +650,7 @@ static int gcmp_encrypt_skb(struct ieee8
  2147. + return 0;
  2148. + }
  2149. +
  2150. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2151. ++ hdrlen = tx->hdrlen;
  2152. + len = skb->len - hdrlen;
  2153. +
  2154. + if (info->control.hw_key)
  2155. +@@ -791,7 +790,6 @@ static ieee80211_tx_result
  2156. + ieee80211_crypto_cs_encrypt(struct ieee80211_tx_data *tx,
  2157. + struct sk_buff *skb)
  2158. + {
  2159. +- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  2160. + struct ieee80211_key *key = tx->key;
  2161. + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  2162. + int hdrlen;
  2163. +@@ -807,8 +805,7 @@ ieee80211_crypto_cs_encrypt(struct ieee8
  2164. + pskb_expand_head(skb, iv_len, 0, GFP_ATOMIC)))
  2165. + return TX_DROP;
  2166. +
  2167. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2168. +-
  2169. ++ hdrlen = tx->hdrlen;
  2170. + pos = skb_push(skb, iv_len);
  2171. + memmove(pos, pos + iv_len, hdrlen);
  2172. +
  2173. 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
  2174. deleted file mode 100644
  2175. index 80b781c..0000000
  2176. --- a/package/kernel/mac80211/patches/307-ath9k-fix-inconsistent-use-of-tab-and-space-in-inden.patch
  2177. +++ /dev/null
  2178. @@ -1,27 +0,0 @@
  2179. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  2180. -Date: Fri, 15 Jan 2016 18:17:20 +0800
  2181. -Subject: [PATCH] ath9k: fix inconsistent use of tab and space in
  2182. - indentation
  2183. -
  2184. -Minor changes for indenting.
  2185. -
  2186. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  2187. ----
  2188. -
  2189. ---- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
  2190. -+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
  2191. -@@ -5485,11 +5485,11 @@ unsigned int ar9003_get_paprd_scale_fact
  2192. - AR9300_PAPRD_SCALE_1);
  2193. - else {
  2194. - if (chan->channel >= 5700)
  2195. -- return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt20),
  2196. -- AR9300_PAPRD_SCALE_1);
  2197. -+ return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt20),
  2198. -+ AR9300_PAPRD_SCALE_1);
  2199. - else if (chan->channel >= 5400)
  2200. - return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt40),
  2201. -- AR9300_PAPRD_SCALE_2);
  2202. -+ AR9300_PAPRD_SCALE_2);
  2203. - else
  2204. - return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt40),
  2205. - AR9300_PAPRD_SCALE_1);
  2206. 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
  2207. new file mode 100644
  2208. index 0000000..eeb881e
  2209. --- /dev/null
  2210. +++ b/package/kernel/mac80211/patches/307-mac80211-add-NEED_ALIGNED4_SKBS-hw-flag.patch
  2211. @@ -0,0 +1,235 @@
  2212. +From: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  2213. +Date: Fri, 19 Feb 2016 11:01:50 +0100
  2214. +Subject: [PATCH] mac80211: add NEED_ALIGNED4_SKBS hw flag
  2215. +
  2216. +HW/driver should set NEED_ALIGNED4_SKBS flag in case
  2217. +require aligned skbs to four-byte boundaries.
  2218. +This affect only TX direction.
  2219. +
  2220. +Padding is added after ieee80211_hdr, before IV/LLC.
  2221. +
  2222. +Before we have to do memmove(hdrlen) twice in the
  2223. +dirver. Once before we pass this to HW and next
  2224. +in tx completion (to be sure monitor will report
  2225. +this tx frame correctly).
  2226. +
  2227. +With this patch we can skip this memmove() and save CPU.
  2228. +
  2229. +Currently this was tested with ath9k, both hw/sw crypt for
  2230. +wep/tkip/ccmp.
  2231. +
  2232. +Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  2233. +---
  2234. +
  2235. +--- a/include/net/mac80211.h
  2236. ++++ b/include/net/mac80211.h
  2237. +@@ -2014,6 +2014,9 @@ struct ieee80211_txq {
  2238. + * @IEEE80211_HW_TX_FRAG_LIST: Hardware (or driver) supports sending frag_list
  2239. + * skbs, needed for zero-copy software A-MSDU.
  2240. + *
  2241. ++ * @IEEE80211_HW_NEEDS_ALIGNED4_SKBS: Driver need aligned skbs to four-byte.
  2242. ++ * Padding will be added after ieee80211_hdr, before IV/LLC.
  2243. ++ *
  2244. + * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
  2245. + */
  2246. + enum ieee80211_hw_flags {
  2247. +@@ -2054,6 +2057,7 @@ enum ieee80211_hw_flags {
  2248. + IEEE80211_HW_USES_RSS,
  2249. + IEEE80211_HW_TX_AMSDU,
  2250. + IEEE80211_HW_TX_FRAG_LIST,
  2251. ++ IEEE80211_HW_NEEDS_ALIGNED4_SKBS,
  2252. +
  2253. + /* keep last, obviously */
  2254. + NUM_IEEE80211_HW_FLAGS
  2255. +--- a/net/mac80211/debugfs.c
  2256. ++++ b/net/mac80211/debugfs.c
  2257. +@@ -302,6 +302,7 @@ static const char *hw_flag_names[] = {
  2258. + FLAG(USES_RSS),
  2259. + FLAG(TX_AMSDU),
  2260. + FLAG(TX_FRAG_LIST),
  2261. ++ FLAG(NEEDS_ALIGNED4_SKBS),
  2262. + #undef FLAG
  2263. + };
  2264. +
  2265. +--- a/net/mac80211/ieee80211_i.h
  2266. ++++ b/net/mac80211/ieee80211_i.h
  2267. +@@ -1497,6 +1497,29 @@ ieee80211_have_rx_timestamp(struct ieee8
  2268. + return false;
  2269. + }
  2270. +
  2271. ++static inline unsigned int
  2272. ++ieee80211_hdr_padsize(struct ieee80211_hw *hw, unsigned int hdrlen)
  2273. ++{
  2274. ++ /*
  2275. ++ * While hdrlen is already aligned to two-byte boundaries,
  2276. ++ * simple check with & 2 will return correct padsize.
  2277. ++ */
  2278. ++ if (ieee80211_hw_check(hw, NEEDS_ALIGNED4_SKBS))
  2279. ++ return hdrlen & 2;
  2280. ++ return 0;
  2281. ++}
  2282. ++
  2283. ++static inline unsigned int
  2284. ++ieee80211_padded_hdrlen(struct ieee80211_hw *hw, __le16 fc)
  2285. ++{
  2286. ++ unsigned int hdrlen;
  2287. ++
  2288. ++ hdrlen = ieee80211_hdrlen(fc);
  2289. ++ hdrlen += ieee80211_hdr_padsize(hw, hdrlen);
  2290. ++
  2291. ++ return hdrlen;
  2292. ++}
  2293. ++
  2294. + u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local,
  2295. + struct ieee80211_rx_status *status,
  2296. + unsigned int mpdu_len,
  2297. +--- a/net/mac80211/sta_info.h
  2298. ++++ b/net/mac80211/sta_info.h
  2299. +@@ -279,7 +279,7 @@ struct ieee80211_fast_tx {
  2300. + u8 hdr_len;
  2301. + u8 sa_offs, da_offs, pn_offs;
  2302. + u8 band;
  2303. +- u8 hdr[30 + 2 + IEEE80211_FAST_XMIT_MAX_IV +
  2304. ++ u8 hdr[30 + 2 + 2 + IEEE80211_FAST_XMIT_MAX_IV +
  2305. + sizeof(rfc1042_header)] __aligned(2);
  2306. +
  2307. + struct rcu_head rcu_head;
  2308. +--- a/net/mac80211/status.c
  2309. ++++ b/net/mac80211/status.c
  2310. +@@ -683,9 +683,22 @@ void ieee80211_tx_monitor(struct ieee802
  2311. + struct sk_buff *skb2;
  2312. + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  2313. + struct ieee80211_sub_if_data *sdata;
  2314. ++ struct ieee80211_hdr *hdr = (void *)skb->data;
  2315. + struct net_device *prev_dev = NULL;
  2316. ++ unsigned int hdrlen, padsize;
  2317. + int rtap_len;
  2318. +
  2319. ++ /* Remove padding if was added */
  2320. ++ if (ieee80211_hw_check(&local->hw, NEEDS_ALIGNED4_SKBS)) {
  2321. ++ hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2322. ++ padsize = ieee80211_hdr_padsize(&local->hw, hdrlen);
  2323. ++
  2324. ++ if (padsize && skb->len > hdrlen + padsize) {
  2325. ++ memmove(skb->data + padsize, skb->data, hdrlen);
  2326. ++ skb_pull(skb, padsize);
  2327. ++ }
  2328. ++ }
  2329. ++
  2330. + /* send frame to monitor interfaces now */
  2331. + rtap_len = ieee80211_tx_radiotap_len(info);
  2332. + if (WARN_ON_ONCE(skb_headroom(skb) < rtap_len)) {
  2333. +--- a/net/mac80211/tkip.c
  2334. ++++ b/net/mac80211/tkip.c
  2335. +@@ -201,10 +201,12 @@ void ieee80211_get_tkip_p2k(struct ieee8
  2336. + {
  2337. + struct ieee80211_key *key = (struct ieee80211_key *)
  2338. + container_of(keyconf, struct ieee80211_key, conf);
  2339. ++ struct ieee80211_hw *hw = &key->local->hw;
  2340. + const u8 *tk = &key->conf.key[NL80211_TKIP_DATA_OFFSET_ENCR_KEY];
  2341. + struct tkip_ctx *ctx = &key->u.tkip.tx;
  2342. + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  2343. +- const u8 *data = (u8 *)hdr + ieee80211_hdrlen(hdr->frame_control);
  2344. ++ const u8 *data = (u8 *)hdr + ieee80211_padded_hdrlen(hw,
  2345. ++ hdr->frame_control);
  2346. + u32 iv32 = get_unaligned_le32(&data[4]);
  2347. + u16 iv16 = data[2] | (data[0] << 8);
  2348. +
  2349. +--- a/net/mac80211/tx.c
  2350. ++++ b/net/mac80211/tx.c
  2351. +@@ -1173,8 +1173,7 @@ ieee80211_tx_prepare(struct ieee80211_su
  2352. + info->flags &= ~IEEE80211_TX_INTFL_NEED_TXPROCESSING;
  2353. +
  2354. + hdr = (struct ieee80211_hdr *) skb->data;
  2355. +-
  2356. +- tx->hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2357. ++ tx->hdrlen = ieee80211_padded_hdrlen(&local->hw, hdr->frame_control);
  2358. +
  2359. + if (likely(sta)) {
  2360. + if (!IS_ERR(sta))
  2361. +@@ -2108,7 +2107,7 @@ netdev_tx_t ieee80211_monitor_start_xmit
  2362. + goto fail;
  2363. +
  2364. + hdr = (struct ieee80211_hdr *)(skb->data + len_rthdr);
  2365. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2366. ++ hdrlen = ieee80211_padded_hdrlen(&local->hw, hdr->frame_control);
  2367. +
  2368. + if (skb->len < len_rthdr + hdrlen)
  2369. + goto fail;
  2370. +@@ -2334,7 +2333,7 @@ static struct sk_buff *ieee80211_build_h
  2371. + struct ieee80211_chanctx_conf *chanctx_conf;
  2372. + struct ieee80211_sub_if_data *ap_sdata;
  2373. + enum nl80211_band band;
  2374. +- int ret;
  2375. ++ int padsize, ret;
  2376. +
  2377. + if (IS_ERR(sta))
  2378. + sta = NULL;
  2379. +@@ -2554,6 +2553,9 @@ static struct sk_buff *ieee80211_build_h
  2380. + hdrlen += 2;
  2381. + }
  2382. +
  2383. ++ /* Check aligned4 skb required */
  2384. ++ padsize = ieee80211_hdr_padsize(&sdata->local->hw, hdrlen);
  2385. ++
  2386. + /*
  2387. + * Drop unicast frames to unauthorised stations unless they are
  2388. + * EAPOL frames from the local station.
  2389. +@@ -2640,6 +2642,7 @@ static struct sk_buff *ieee80211_build_h
  2390. + h_pos -= skip_header_bytes;
  2391. +
  2392. + head_need = hdrlen + encaps_len + meshhdrlen - skb_headroom(skb);
  2393. ++ head_need += padsize;
  2394. +
  2395. + /*
  2396. + * So we need to modify the skb header and hence need a copy of
  2397. +@@ -2678,6 +2681,9 @@ static struct sk_buff *ieee80211_build_h
  2398. + }
  2399. + #endif
  2400. +
  2401. ++ if (padsize)
  2402. ++ memset(skb_push(skb, padsize), 0, padsize);
  2403. ++
  2404. + if (ieee80211_is_data_qos(fc)) {
  2405. + __le16 *qos_control;
  2406. +
  2407. +@@ -2691,8 +2697,8 @@ static struct sk_buff *ieee80211_build_h
  2408. + } else
  2409. + memcpy(skb_push(skb, hdrlen), &hdr, hdrlen);
  2410. +
  2411. +- nh_pos += hdrlen;
  2412. +- h_pos += hdrlen;
  2413. ++ nh_pos += hdrlen + padsize;
  2414. ++ h_pos += hdrlen + padsize;
  2415. +
  2416. + /* Update skb pointers to various headers since this modified frame
  2417. + * is going to go through Linux networking code that may potentially
  2418. +@@ -2861,6 +2867,9 @@ void ieee80211_check_fast_xmit(struct st
  2419. + fc |= cpu_to_le16(IEEE80211_STYPE_QOS_DATA);
  2420. + }
  2421. +
  2422. ++ /* Check aligned4 skb required */
  2423. ++ build.hdr_len += ieee80211_hdr_padsize(&local->hw, build.hdr_len);
  2424. ++
  2425. + /* We store the key here so there's no point in using rcu_dereference()
  2426. + * but that's fine because the code that changes the pointers will call
  2427. + * this function after doing so. For a single CPU that would be enough,
  2428. +--- a/net/mac80211/util.c
  2429. ++++ b/net/mac80211/util.c
  2430. +@@ -1224,6 +1224,7 @@ void ieee80211_send_auth(struct ieee8021
  2431. + u32 tx_flags)
  2432. + {
  2433. + struct ieee80211_local *local = sdata->local;
  2434. ++ struct ieee80211_hw *hw = &local->hw;
  2435. + struct sk_buff *skb;
  2436. + struct ieee80211_mgmt *mgmt;
  2437. + unsigned int hdrlen;
  2438. +@@ -1251,7 +1252,7 @@ void ieee80211_send_auth(struct ieee8021
  2439. + memcpy(skb_put(skb, extra_len), extra, extra_len);
  2440. +
  2441. + if (auth_alg == WLAN_AUTH_SHARED_KEY && transaction == 3) {
  2442. +- hdrlen = ieee80211_hdrlen(mgmt->frame_control);
  2443. ++ hdrlen = ieee80211_padded_hdrlen(hw, mgmt->frame_control);
  2444. + mgmt->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
  2445. + err = ieee80211_wep_encrypt(local, skb, hdrlen, key,
  2446. + key_len, key_idx);
  2447. 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
  2448. new file mode 100644
  2449. index 0000000..8590aad
  2450. --- /dev/null
  2451. +++ b/package/kernel/mac80211/patches/308-ath10k-Fix-sending-NULL-Qos-NULL-data-frames-for-QCA.patch
  2452. @@ -0,0 +1,72 @@
  2453. +From: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
  2454. +Date: Thu, 23 Jun 2016 22:10:01 +0530
  2455. +Subject: [PATCH] ath10k: Fix sending NULL/ Qos NULL data frames for
  2456. + QCA99X0 and later
  2457. +
  2458. +For chipsets like QCA99X0, IPQ4019 and later we are not getting proper
  2459. +NULL func status (always acked/successs !!) when hostapd does a
  2460. +PROBE_CLIENT via nullfunc frames when the station is powered off
  2461. +abruptly (inactive timer probes client via null func after the inactive
  2462. +time reaches beyond the threshold). Fix this by disabling the workaround
  2463. +(getting the ACK status of NULL func frames by sending via HTT mgmt-tx
  2464. + path) introduced by the change ("ath10k: fix beacon loss handling ")
  2465. +for QCA99X0 and later chipsets. The normal tx path provides the proper
  2466. +ACK status for NULL data frames. As of now disable this workaround for
  2467. +chipsets QCA99X0 and later, once the 10.1 firmware is obselete we can
  2468. +completely get rid of this workaround for all the chipsets
  2469. +
  2470. +Signed-off-by: Tamizh chelvam <c_traja@qti.qualcomm.com>
  2471. +Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
  2472. +---
  2473. +
  2474. +--- a/drivers/net/wireless/ath/ath10k/core.c
  2475. ++++ b/drivers/net/wireless/ath/ath10k/core.c
  2476. +@@ -181,6 +181,7 @@ static const struct ath10k_hw_params ath
  2477. + .board = QCA99X0_HW_2_0_BOARD_DATA_FILE,
  2478. + .board_size = QCA99X0_BOARD_DATA_SZ,
  2479. + .board_ext_size = QCA99X0_BOARD_EXT_DATA_SZ,
  2480. ++ .disable_null_func_workaround = true,
  2481. + },
  2482. + },
  2483. + {
  2484. +@@ -204,6 +205,7 @@ static const struct ath10k_hw_params ath
  2485. + .board = QCA9984_HW_1_0_BOARD_DATA_FILE,
  2486. + .board_size = QCA99X0_BOARD_DATA_SZ,
  2487. + .board_ext_size = QCA99X0_BOARD_EXT_DATA_SZ,
  2488. ++ .disable_null_func_workaround = true,
  2489. + },
  2490. + },
  2491. + {
  2492. +@@ -262,6 +264,7 @@ static const struct ath10k_hw_params ath
  2493. + .board = QCA4019_HW_1_0_BOARD_DATA_FILE,
  2494. + .board_size = QCA4019_BOARD_DATA_SZ,
  2495. + .board_ext_size = QCA4019_BOARD_EXT_DATA_SZ,
  2496. ++ .disable_null_func_workaround = true,
  2497. + },
  2498. + },
  2499. + };
  2500. +--- a/drivers/net/wireless/ath/ath10k/core.h
  2501. ++++ b/drivers/net/wireless/ath/ath10k/core.h
  2502. +@@ -750,6 +750,12 @@ struct ath10k {
  2503. + const char *board;
  2504. + size_t board_size;
  2505. + size_t board_ext_size;
  2506. ++ /* Workaround of sending NULL data frames via
  2507. ++ * HTT mgmt TX and getting the proper ACK status does
  2508. ++ * not works for chipsets QCA99X0 and later, while
  2509. ++ * Tx data path reports the ACK status properly.
  2510. ++ */
  2511. ++ bool disable_null_func_workaround;
  2512. + } fw;
  2513. + } hw_params;
  2514. +
  2515. +--- a/drivers/net/wireless/ath/ath10k/mac.c
  2516. ++++ b/drivers/net/wireless/ath/ath10k/mac.c
  2517. +@@ -3253,6 +3253,7 @@ ath10k_mac_tx_h_get_txmode(struct ath10k
  2518. + * mode though because AP don't sleep.
  2519. + */
  2520. + if (ar->htt.target_version_major < 3 &&
  2521. ++ !ar->hw_params.fw.disable_null_func_workaround &&
  2522. + (ieee80211_is_nullfunc(fc) || ieee80211_is_qos_nullfunc(fc)) &&
  2523. + !test_bit(ATH10K_FW_FEATURE_HAS_WMI_MGMT_TX,
  2524. + ar->running_fw->fw_file.fw_features))
  2525. 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
  2526. deleted file mode 100644
  2527. index d408866..0000000
  2528. --- a/package/kernel/mac80211/patches/308-ath9k-fix-data-bus-error-on-ar9300-and-ar9580.patch
  2529. +++ /dev/null
  2530. @@ -1,65 +0,0 @@
  2531. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  2532. -Date: Fri, 15 Jan 2016 18:17:21 +0800
  2533. -Subject: [PATCH] ath9k: fix data bus error on ar9300 and ar9580
  2534. -
  2535. -One crash issue be found on ar9300: RTC_RC reg read leads crash, leading
  2536. -the data bus error, due to RTC_RC reg write not happen properly.
  2537. -
  2538. -Warm Reset trigger in continuous beacon stuck for one of the customer for
  2539. -other chip, noticed the MAC was stuck in RTC reset. After analysis noticed
  2540. -DMA did not complete when RTC was put in reset.
  2541. -
  2542. -So, before resetting the MAC need to make sure there are no pending DMA
  2543. -transactions because this reset does not reset all parts of the chip.
  2544. -
  2545. -The 12th and 11th bit of MAC _DMA_CFG register used to do that.
  2546. - 12 cfg_halt_ack 0x0
  2547. - 0 DMA has not yet halted
  2548. - 1 DMA has halted
  2549. - 11 cfg_halt_req 0x0
  2550. - 0 DMA logic operates normally
  2551. - 1 Request DMA logic to stop so software can reset the MAC
  2552. -
  2553. -The Bit [12] of this register indicates when the halt has taken effect or
  2554. -not. the DMA halt IS NOT recoverable; once software sets bit [11] to
  2555. -request a DMA halt, software must wait for bit [12] to be set and reset
  2556. -the MAC.
  2557. -
  2558. -So, the same thing we implemented for ar9580 chip.
  2559. -
  2560. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  2561. ----
  2562. -
  2563. ---- a/drivers/net/wireless/ath/ath9k/hw.c
  2564. -+++ b/drivers/net/wireless/ath/ath9k/hw.c
  2565. -@@ -1368,6 +1368,16 @@ static bool ath9k_hw_set_reset(struct at
  2566. - if (ath9k_hw_mci_is_enabled(ah))
  2567. - ar9003_mci_check_gpm_offset(ah);
  2568. -
  2569. -+ /* DMA HALT added to resolve ar9300 and ar9580 bus error during
  2570. -+ * RTC_RC reg read
  2571. -+ */
  2572. -+ if (AR_SREV_9300(ah) || AR_SREV_9580(ah)) {
  2573. -+ REG_SET_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  2574. -+ ath9k_hw_wait(ah, AR_CFG, AR_CFG_HALT_ACK, AR_CFG_HALT_ACK,
  2575. -+ 20 * AH_WAIT_TIMEOUT);
  2576. -+ REG_CLR_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  2577. -+ }
  2578. -+
  2579. - REG_WRITE(ah, AR_RTC_RC, rst_flags);
  2580. -
  2581. - REGWRITE_BUFFER_FLUSH(ah);
  2582. ---- a/drivers/net/wireless/ath/ath9k/reg.h
  2583. -+++ b/drivers/net/wireless/ath/ath9k/reg.h
  2584. -@@ -34,8 +34,10 @@
  2585. - #define AR_CFG_SWRG 0x00000010
  2586. - #define AR_CFG_AP_ADHOC_INDICATION 0x00000020
  2587. - #define AR_CFG_PHOK 0x00000100
  2588. --#define AR_CFG_CLK_GATE_DIS 0x00000400
  2589. - #define AR_CFG_EEBS 0x00000200
  2590. -+#define AR_CFG_CLK_GATE_DIS 0x00000400
  2591. -+#define AR_CFG_HALT_REQ 0x00000800
  2592. -+#define AR_CFG_HALT_ACK 0x00001000
  2593. - #define AR_CFG_PCI_MASTER_REQ_Q_THRESH 0x00060000
  2594. - #define AR_CFG_PCI_MASTER_REQ_Q_THRESH_S 17
  2595. -
  2596. 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
  2597. deleted file mode 100644
  2598. index d9511c8..0000000
  2599. --- a/package/kernel/mac80211/patches/309-01-brcmfmac-add-missing-include.patch
  2600. +++ /dev/null
  2601. @@ -1,19 +0,0 @@
  2602. -From: Felix Fietkau <nbd@openwrt.org>
  2603. -Date: Fri, 15 Jan 2016 15:59:45 +0100
  2604. -Subject: [PATCH] brcmfmac: add missing include
  2605. -
  2606. -linux/module.h is required for defining module parameters
  2607. -
  2608. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  2609. ----
  2610. -
  2611. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  2612. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  2613. -@@ -17,6 +17,7 @@
  2614. - #include <linux/kernel.h>
  2615. - #include <linux/string.h>
  2616. - #include <linux/netdevice.h>
  2617. -+#include <linux/module.h>
  2618. - #include <brcmu_wifi.h>
  2619. - #include <brcmu_utils.h>
  2620. - #include "core.h"
  2621. 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
  2622. deleted file mode 100644
  2623. index 711e019..0000000
  2624. --- a/package/kernel/mac80211/patches/309-02-brcmfmac-fix-sdio-sg-table-alloc-crash.patch
  2625. +++ /dev/null
  2626. @@ -1,118 +0,0 @@
  2627. -From: Hante Meuleman <meuleman@broadcom.com>
  2628. -Date: Tue, 19 Jan 2016 12:39:24 +0100
  2629. -Subject: [PATCH] brcmfmac: fix sdio sg table alloc crash
  2630. -
  2631. -With commit 7d34b0560567 ("brcmfmac: Move all module parameters to
  2632. -one place") a bug was introduced causing a null pointer exception.
  2633. -This patch fixes the bug by initializing the sg table till after
  2634. -the settings have been initialized.
  2635. -
  2636. -Fixes: 7d34b0560567 ("brcmfmac: Move all module parameters to one place")
  2637. -Reported-by: Marc Zyngier <marc.zyngier@arm.com>
  2638. -Tested-by: Marc Zyngier <marc.zyngier@arm.com>
  2639. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  2640. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  2641. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  2642. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  2643. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  2644. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  2645. ----
  2646. -
  2647. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  2648. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  2649. -@@ -879,11 +879,24 @@ int brcmf_sdiod_abort(struct brcmf_sdio_
  2650. - return 0;
  2651. - }
  2652. -
  2653. --static void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev)
  2654. -+void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev)
  2655. - {
  2656. -+ struct sdio_func *func;
  2657. -+ struct mmc_host *host;
  2658. -+ uint max_blocks;
  2659. - uint nents;
  2660. - int err;
  2661. -
  2662. -+ func = sdiodev->func[2];
  2663. -+ host = func->card->host;
  2664. -+ sdiodev->sg_support = host->max_segs > 1;
  2665. -+ max_blocks = min_t(uint, host->max_blk_count, 511u);
  2666. -+ sdiodev->max_request_size = min_t(uint, host->max_req_size,
  2667. -+ max_blocks * func->cur_blksize);
  2668. -+ sdiodev->max_segment_count = min_t(uint, host->max_segs,
  2669. -+ SG_MAX_SINGLE_ALLOC);
  2670. -+ sdiodev->max_segment_size = host->max_seg_size;
  2671. -+
  2672. - if (!sdiodev->sg_support)
  2673. - return;
  2674. -
  2675. -@@ -1021,9 +1034,6 @@ static void brcmf_sdiod_host_fixup(struc
  2676. -
  2677. - static int brcmf_sdiod_probe(struct brcmf_sdio_dev *sdiodev)
  2678. - {
  2679. -- struct sdio_func *func;
  2680. -- struct mmc_host *host;
  2681. -- uint max_blocks;
  2682. - int ret = 0;
  2683. -
  2684. - sdiodev->num_funcs = 2;
  2685. -@@ -1054,26 +1064,6 @@ static int brcmf_sdiod_probe(struct brcm
  2686. - goto out;
  2687. - }
  2688. -
  2689. -- /*
  2690. -- * determine host related variables after brcmf_sdiod_probe()
  2691. -- * as func->cur_blksize is properly set and F2 init has been
  2692. -- * completed successfully.
  2693. -- */
  2694. -- func = sdiodev->func[2];
  2695. -- host = func->card->host;
  2696. -- sdiodev->sg_support = host->max_segs > 1;
  2697. -- max_blocks = min_t(uint, host->max_blk_count, 511u);
  2698. -- sdiodev->max_request_size = min_t(uint, host->max_req_size,
  2699. -- max_blocks * func->cur_blksize);
  2700. -- sdiodev->max_segment_count = min_t(uint, host->max_segs,
  2701. -- SG_MAX_SINGLE_ALLOC);
  2702. -- sdiodev->max_segment_size = host->max_seg_size;
  2703. --
  2704. -- /* allocate scatter-gather table. sg support
  2705. -- * will be disabled upon allocation failure.
  2706. -- */
  2707. -- brcmf_sdiod_sgtable_alloc(sdiodev);
  2708. --
  2709. - ret = brcmf_sdiod_freezer_attach(sdiodev);
  2710. - if (ret)
  2711. - goto out;
  2712. -@@ -1084,7 +1074,7 @@ static int brcmf_sdiod_probe(struct brcm
  2713. - ret = -ENODEV;
  2714. - goto out;
  2715. - }
  2716. -- brcmf_sdiod_host_fixup(host);
  2717. -+ brcmf_sdiod_host_fixup(sdiodev->func[2]->card->host);
  2718. - out:
  2719. - if (ret)
  2720. - brcmf_sdiod_remove(sdiodev);
  2721. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  2722. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  2723. -@@ -4114,6 +4114,11 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
  2724. - goto fail;
  2725. - }
  2726. -
  2727. -+ /* allocate scatter-gather table. sg support
  2728. -+ * will be disabled upon allocation failure.
  2729. -+ */
  2730. -+ brcmf_sdiod_sgtable_alloc(bus->sdiodev);
  2731. -+
  2732. - /* Query the F2 block size, set roundup accordingly */
  2733. - bus->blocksize = bus->sdiodev->func[2]->cur_blksize;
  2734. - bus->roundup = min(max_roundup, bus->blocksize);
  2735. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
  2736. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
  2737. -@@ -342,6 +342,7 @@ int brcmf_sdiod_ramrw(struct brcmf_sdio_
  2738. -
  2739. - /* Issue an abort to the specified function */
  2740. - int brcmf_sdiod_abort(struct brcmf_sdio_dev *sdiodev, uint fn);
  2741. -+void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev);
  2742. - void brcmf_sdiod_change_state(struct brcmf_sdio_dev *sdiodev,
  2743. - enum brcmf_sdiod_state state);
  2744. - #ifdef CONFIG_PM_SLEEP
  2745. 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
  2746. new file mode 100644
  2747. index 0000000..41c27ca
  2748. --- /dev/null
  2749. +++ b/package/kernel/mac80211/patches/309-cfg80211-fix-proto-in-ieee80211_data_to_8023-for-fra.patch
  2750. @@ -0,0 +1,37 @@
  2751. +From: Felix Fietkau <nbd@nbd.name>
  2752. +Date: Wed, 29 Jun 2016 10:02:32 +0200
  2753. +Subject: [PATCH] cfg80211: fix proto in ieee80211_data_to_8023 for frames
  2754. + without LLC header
  2755. +
  2756. +The PDU length of incoming LLC frames is set to the total skb payload size
  2757. +in __ieee80211_data_to_8023() of net/wireless/util.c which incorrectly
  2758. +includes the length of the IEEE 802.11 header.
  2759. +
  2760. +The resulting LLC frame header has a too large PDU length, causing the
  2761. +llc_fixup_skb() function of net/llc/llc_input.c to reject the incoming
  2762. +skb, effectively breaking STP.
  2763. +
  2764. +Solve the problem by properly substracting the IEEE 802.11 frame header size
  2765. +from the PDU length, allowing the LLC processor to pick up the incoming
  2766. +control messages.
  2767. +
  2768. +Special thanks to Gerry Rozema for tracking down the regression and proposing
  2769. +a suitable patch.
  2770. +
  2771. +Fixes: 2d1c304cb2d5 ("cfg80211: add function for 802.3 conversion with separate output buffer")
  2772. +Cc: stable@vger.kernel.org
  2773. +Reported-by: Gerry Rozema <gerryr@rozeware.com>
  2774. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  2775. +---
  2776. +
  2777. +--- a/net/wireless/util.c
  2778. ++++ b/net/wireless/util.c
  2779. +@@ -509,7 +509,7 @@ static int __ieee80211_data_to_8023(stru
  2780. + * replace EtherType */
  2781. + hdrlen += ETH_ALEN + 2;
  2782. + else
  2783. +- tmp.h_proto = htons(skb->len);
  2784. ++ tmp.h_proto = htons(skb->len - hdrlen);
  2785. +
  2786. + pskb_pull(skb, hdrlen);
  2787. +
  2788. 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
  2789. deleted file mode 100644
  2790. index 287d6e1..0000000
  2791. --- a/package/kernel/mac80211/patches/310-ath9k_hw-ignore-eeprom-magic-mismatch-on-flash-based.patch
  2792. +++ /dev/null
  2793. @@ -1,38 +0,0 @@
  2794. -From: Felix Fietkau <nbd@openwrt.org>
  2795. -Date: Thu, 21 Jan 2016 16:28:44 +0100
  2796. -Subject: [PATCH] ath9k_hw: ignore eeprom magic mismatch on flash based devices
  2797. -
  2798. -Many AR913x based devices (maybe others too) do not have a valid EEPROM
  2799. -magic in their calibration data partition.
  2800. -
  2801. -Fixes: 6fa658fd5ab2 ("ath9k: Simplify and fix eeprom endianness swapping")
  2802. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  2803. ----
  2804. -
  2805. ---- a/drivers/net/wireless/ath/ath9k/eeprom.c
  2806. -+++ b/drivers/net/wireless/ath/ath9k/eeprom.c
  2807. -@@ -150,18 +150,18 @@ int ath9k_hw_nvram_swap_data(struct ath_
  2808. - return -EIO;
  2809. - }
  2810. -
  2811. -- if (magic == AR5416_EEPROM_MAGIC) {
  2812. -- *swap_needed = false;
  2813. -- } else if (swab16(magic) == AR5416_EEPROM_MAGIC) {
  2814. -+ *swap_needed = false;
  2815. -+ if (swab16(magic) == AR5416_EEPROM_MAGIC) {
  2816. - if (ah->ah_flags & AH_NO_EEP_SWAP) {
  2817. - ath_info(common,
  2818. - "Ignoring endianness difference in EEPROM magic bytes.\n");
  2819. --
  2820. -- *swap_needed = false;
  2821. - } else {
  2822. - *swap_needed = true;
  2823. - }
  2824. -- } else {
  2825. -+ } else if (magic != AR5416_EEPROM_MAGIC) {
  2826. -+ if (ath9k_hw_use_flash(ah))
  2827. -+ return 0;
  2828. -+
  2829. - ath_err(common,
  2830. - "Invalid EEPROM Magic (0x%04x).\n", magic);
  2831. - return -EINVAL;
  2832. 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
  2833. new file mode 100644
  2834. index 0000000..25929c9
  2835. --- /dev/null
  2836. +++ b/package/kernel/mac80211/patches/310-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch
  2837. @@ -0,0 +1,81 @@
  2838. +From: Chaitanya T K <chaitanya.mgit@gmail.com>
  2839. +Date: Mon, 27 Jun 2016 15:23:26 +0530
  2840. +Subject: [PATCH] mac80211: minstrel: Enable STBC and LDPC for VHT Rates
  2841. +
  2842. +If peer support reception of STBC and LDPC, enable them for better
  2843. +performance.
  2844. +
  2845. +Signed-off-by: Chaitanya TK <chaitanya.mgit@gmail.com>
  2846. +---
  2847. +
  2848. +--- a/include/linux/ieee80211.h
  2849. ++++ b/include/linux/ieee80211.h
  2850. +@@ -1550,6 +1550,7 @@ struct ieee80211_vht_operation {
  2851. + #define IEEE80211_VHT_CAP_RXSTBC_3 0x00000300
  2852. + #define IEEE80211_VHT_CAP_RXSTBC_4 0x00000400
  2853. + #define IEEE80211_VHT_CAP_RXSTBC_MASK 0x00000700
  2854. ++#define IEEE80211_VHT_CAP_RXSTBC_SHIFT 8
  2855. + #define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800
  2856. + #define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000
  2857. + #define IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT 13
  2858. +--- a/net/mac80211/rc80211_minstrel_ht.c
  2859. ++++ b/net/mac80211/rc80211_minstrel_ht.c
  2860. +@@ -1166,13 +1166,14 @@ minstrel_ht_update_caps(void *priv, stru
  2861. + struct minstrel_ht_sta_priv *msp = priv_sta;
  2862. + struct minstrel_ht_sta *mi = &msp->ht;
  2863. + struct ieee80211_mcs_info *mcs = &sta->ht_cap.mcs;
  2864. +- u16 sta_cap = sta->ht_cap.cap;
  2865. ++ u16 ht_cap = sta->ht_cap.cap;
  2866. + struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap;
  2867. + int use_vht;
  2868. + int n_supported = 0;
  2869. + int ack_dur;
  2870. + int stbc;
  2871. + int i;
  2872. ++ bool ldpc = false;
  2873. +
  2874. + /* fall back to the old minstrel for legacy stations */
  2875. + if (!sta->ht_cap.ht_supported)
  2876. +@@ -1210,16 +1211,24 @@ minstrel_ht_update_caps(void *priv, stru
  2877. + }
  2878. + mi->sample_tries = 4;
  2879. +
  2880. +- /* TODO tx_flags for vht - ATM the RC API is not fine-grained enough */
  2881. + if (!use_vht) {
  2882. +- stbc = (sta_cap & IEEE80211_HT_CAP_RX_STBC) >>
  2883. ++ stbc = (ht_cap & IEEE80211_HT_CAP_RX_STBC) >>
  2884. + IEEE80211_HT_CAP_RX_STBC_SHIFT;
  2885. +- mi->tx_flags |= stbc << IEEE80211_TX_CTL_STBC_SHIFT;
  2886. +
  2887. +- if (sta_cap & IEEE80211_HT_CAP_LDPC_CODING)
  2888. +- mi->tx_flags |= IEEE80211_TX_CTL_LDPC;
  2889. ++ if (ht_cap & IEEE80211_HT_CAP_LDPC_CODING)
  2890. ++ ldpc = true;
  2891. ++ } else {
  2892. ++ stbc = (vht_cap->cap & IEEE80211_VHT_CAP_RXSTBC_MASK) >>
  2893. ++ IEEE80211_VHT_CAP_RXSTBC_SHIFT;
  2894. ++
  2895. ++ if (vht_cap->cap & IEEE80211_VHT_CAP_RXLDPC)
  2896. ++ ldpc = true;
  2897. + }
  2898. +
  2899. ++ mi->tx_flags |= stbc << IEEE80211_TX_CTL_STBC_SHIFT;
  2900. ++ if (ldpc)
  2901. ++ mi->tx_flags |= IEEE80211_TX_CTL_LDPC;
  2902. ++
  2903. + for (i = 0; i < ARRAY_SIZE(mi->groups); i++) {
  2904. + u32 gflags = minstrel_mcs_groups[i].flags;
  2905. + int bw, nss;
  2906. +@@ -1232,10 +1241,10 @@ minstrel_ht_update_caps(void *priv, stru
  2907. +
  2908. + if (gflags & IEEE80211_TX_RC_SHORT_GI) {
  2909. + if (gflags & IEEE80211_TX_RC_40_MHZ_WIDTH) {
  2910. +- if (!(sta_cap & IEEE80211_HT_CAP_SGI_40))
  2911. ++ if (!(ht_cap & IEEE80211_HT_CAP_SGI_40))
  2912. + continue;
  2913. + } else {
  2914. +- if (!(sta_cap & IEEE80211_HT_CAP_SGI_20))
  2915. ++ if (!(ht_cap & IEEE80211_HT_CAP_SGI_20))
  2916. + continue;
  2917. + }
  2918. + }
  2919. 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
  2920. new file mode 100644
  2921. index 0000000..4cf26a6
  2922. --- /dev/null
  2923. +++ b/package/kernel/mac80211/patches/311-ath10k-disable-wake_tx_queue-for-older-devices.patch
  2924. @@ -0,0 +1,73 @@
  2925. +From: Michal Kazior <michal.kazior@tieto.com>
  2926. +Date: Tue, 17 May 2016 14:47:01 +0200
  2927. +Subject: [PATCH] ath10k: disable wake_tx_queue for older devices
  2928. +
  2929. +Some setups suffer performance regressions with
  2930. +current wake_tx_queue implementation.
  2931. +
  2932. +Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
  2933. +---
  2934. +
  2935. +--- a/drivers/net/wireless/ath/ath10k/core.h
  2936. ++++ b/drivers/net/wireless/ath/ath10k/core.h
  2937. +@@ -667,6 +667,7 @@ struct ath10k_fw_components {
  2938. + struct ath10k {
  2939. + struct ath_common ath_common;
  2940. + struct ieee80211_hw *hw;
  2941. ++ struct ieee80211_ops *ops;
  2942. + struct device *dev;
  2943. + u8 mac_addr[ETH_ALEN];
  2944. +
  2945. +--- a/drivers/net/wireless/ath/ath10k/mac.c
  2946. ++++ b/drivers/net/wireless/ath/ath10k/mac.c
  2947. +@@ -7497,21 +7497,32 @@ static const struct ieee80211_channel at
  2948. + struct ath10k *ath10k_mac_create(size_t priv_size)
  2949. + {
  2950. + struct ieee80211_hw *hw;
  2951. ++ struct ieee80211_ops *ops;
  2952. + struct ath10k *ar;
  2953. +
  2954. +- hw = ieee80211_alloc_hw(sizeof(struct ath10k) + priv_size, &ath10k_ops);
  2955. +- if (!hw)
  2956. ++ ops = kmemdup(&ath10k_ops, sizeof(ath10k_ops), GFP_KERNEL);
  2957. ++ if (!ops)
  2958. ++ return NULL;
  2959. ++
  2960. ++ hw = ieee80211_alloc_hw(sizeof(struct ath10k) + priv_size, ops);
  2961. ++ if (!hw) {
  2962. ++ kfree(ops);
  2963. + return NULL;
  2964. ++ }
  2965. +
  2966. + ar = hw->priv;
  2967. + ar->hw = hw;
  2968. ++ ar->ops = ops;
  2969. +
  2970. + return ar;
  2971. + }
  2972. +
  2973. + void ath10k_mac_destroy(struct ath10k *ar)
  2974. + {
  2975. ++ struct ieee80211_ops *ops = ar->ops;
  2976. ++
  2977. + ieee80211_free_hw(ar->hw);
  2978. ++ kfree(ops);
  2979. + }
  2980. +
  2981. + static const struct ieee80211_iface_limit ath10k_if_limits[] = {
  2982. +@@ -7945,6 +7956,15 @@ int ath10k_mac_register(struct ath10k *a
  2983. + ath10k_warn(ar, "failed to initialise DFS pattern detector\n");
  2984. + }
  2985. +
  2986. ++ /* Current wake_tx_queue implementation imposes a significant
  2987. ++ * performance penalty in some setups. The tx scheduling code needs
  2988. ++ * more work anyway so disable the wake_tx_queue unless firmware
  2989. ++ * supports the pull-push mechanism.
  2990. ++ */
  2991. ++ if (!test_bit(ATH10K_FW_FEATURE_PEER_FLOW_CONTROL,
  2992. ++ ar->running_fw->fw_file.fw_features))
  2993. ++ ar->ops->wake_tx_queue = NULL;
  2994. ++
  2995. + ret = ath_regd_init(&ar->ath_common.regulatory, ar->hw->wiphy,
  2996. + ath10k_reg_notifier);
  2997. + if (ret) {
  2998. 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
  2999. deleted file mode 100644
  3000. index 070efa9..0000000
  3001. --- a/package/kernel/mac80211/patches/311-ath9k-do-not-limit-the-number-of-DFS-interfaces-to-1.patch
  3002. +++ /dev/null
  3003. @@ -1,55 +0,0 @@
  3004. -From: Felix Fietkau <nbd@openwrt.org>
  3005. -Date: Fri, 22 Jan 2016 01:05:56 +0100
  3006. -Subject: [PATCH] ath9k: do not limit the number of DFS interfaces to 1
  3007. -
  3008. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  3009. ----
  3010. -
  3011. ---- a/drivers/net/wireless/ath/ath9k/init.c
  3012. -+++ b/drivers/net/wireless/ath/ath9k/init.c
  3013. -@@ -751,14 +751,6 @@ static const struct ieee80211_iface_comb
  3014. -
  3015. - #endif /* CPTCFG_ATH9K_CHANNEL_CONTEXT */
  3016. -
  3017. --static const struct ieee80211_iface_limit if_dfs_limits[] = {
  3018. -- { .max = 1, .types = BIT(NL80211_IFTYPE_AP) |
  3019. --#ifdef CPTCFG_MAC80211_MESH
  3020. -- BIT(NL80211_IFTYPE_MESH_POINT) |
  3021. --#endif
  3022. -- BIT(NL80211_IFTYPE_ADHOC) },
  3023. --};
  3024. --
  3025. - static const struct ieee80211_iface_combination if_comb[] = {
  3026. - {
  3027. - .limits = if_limits,
  3028. -@@ -766,6 +758,11 @@ static const struct ieee80211_iface_comb
  3029. - .max_interfaces = 2048,
  3030. - .num_different_channels = 1,
  3031. - .beacon_int_infra_match = true,
  3032. -+#ifdef CPTCFG_ATH9K_DFS_CERTIFIED
  3033. -+ .radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) |
  3034. -+ BIT(NL80211_CHAN_WIDTH_20) |
  3035. -+ BIT(NL80211_CHAN_WIDTH_40),
  3036. -+#endif
  3037. - },
  3038. - {
  3039. - .limits = wds_limits,
  3040. -@@ -774,18 +771,6 @@ static const struct ieee80211_iface_comb
  3041. - .num_different_channels = 1,
  3042. - .beacon_int_infra_match = true,
  3043. - },
  3044. --#ifdef CPTCFG_ATH9K_DFS_CERTIFIED
  3045. -- {
  3046. -- .limits = if_dfs_limits,
  3047. -- .n_limits = ARRAY_SIZE(if_dfs_limits),
  3048. -- .max_interfaces = 1,
  3049. -- .num_different_channels = 1,
  3050. -- .beacon_int_infra_match = true,
  3051. -- .radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) |
  3052. -- BIT(NL80211_CHAN_WIDTH_20) |
  3053. -- BIT(NL80211_CHAN_WIDTH_40),
  3054. -- }
  3055. --#endif
  3056. - };
  3057. -
  3058. - #ifdef CPTCFG_ATH9K_CHANNEL_CONTEXT
  3059. 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
  3060. new file mode 100644
  3061. index 0000000..df43105
  3062. --- /dev/null
  3063. +++ b/package/kernel/mac80211/patches/312-ath9k-Correct-TSF-adjustment-to-align-the-beacon-tim.patch
  3064. @@ -0,0 +1,45 @@
  3065. +From: Benjamin Berg <benjamin.berg@open-mesh.com>
  3066. +Date: Mon, 4 Jul 2016 14:37:20 +0200
  3067. +Subject: [PATCH] ath9k: Correct TSF adjustment to align the beacon time
  3068. + correctly
  3069. +
  3070. +Beacons were not send out at (timestamp % beacon_time == 0) for interfaces
  3071. +other than the primary one. To send out beacons with the correct timestamp
  3072. +according to 10.1.3.2 of the 802.11 standard the tsf_adjustment has to be
  3073. +set to the negative time difference instead of positive. This way the
  3074. +later beacons get corrected to have a lower (and similar) timestamp with
  3075. +regard to the beacon from slot 0.
  3076. +
  3077. +I am not aware about any issues that have been caused by this.
  3078. +
  3079. +Signed-off-by: Benjamin Berg <benjamin.berg@open-mesh.com>
  3080. +---
  3081. +
  3082. +--- a/drivers/net/wireless/ath/ath9k/beacon.c
  3083. ++++ b/drivers/net/wireless/ath/ath9k/beacon.c
  3084. +@@ -279,17 +279,21 @@ static void ath9k_set_tsfadjust(struct a
  3085. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  3086. + struct ath_vif *avp = (void *)vif->drv_priv;
  3087. + struct ath_beacon_config *cur_conf = &avp->chanctx->beacon;
  3088. +- u32 tsfadjust;
  3089. ++ s64 tsfadjust;
  3090. +
  3091. + if (avp->av_bslot == 0)
  3092. + return;
  3093. +
  3094. ++ /* tsf_adjust is added to the TSF value. We send out the beacon late,
  3095. ++ * so need to adjust the TSF starting point to be later in time (i.e.
  3096. ++ * the theoretical first beacon has a TSF of 0 after correction).
  3097. ++ */
  3098. + tsfadjust = cur_conf->beacon_interval * avp->av_bslot;
  3099. +- tsfadjust = TU_TO_USEC(tsfadjust) / ATH_BCBUF;
  3100. ++ tsfadjust = -TU_TO_USEC(tsfadjust) / ATH_BCBUF;
  3101. + avp->tsf_adjust = cpu_to_le64(tsfadjust);
  3102. +
  3103. +- ath_dbg(common, CONFIG, "tsfadjust is: %llu for bslot: %d\n",
  3104. +- (unsigned long long)tsfadjust, avp->av_bslot);
  3105. ++ ath_dbg(common, CONFIG, "tsfadjust is: %lld for bslot: %d\n",
  3106. ++ (signed long long)tsfadjust, avp->av_bslot);
  3107. + }
  3108. +
  3109. + bool ath9k_csa_is_finished(struct ath_softc *sc, struct ieee80211_vif *vif)
  3110. 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
  3111. deleted file mode 100644
  3112. index 61cafc7..0000000
  3113. --- a/package/kernel/mac80211/patches/312-mac80211-fix-txq-queue-related-crashes.patch
  3114. +++ /dev/null
  3115. @@ -1,27 +0,0 @@
  3116. -From: Michal Kazior <michal.kazior@tieto.com>
  3117. -Date: Thu, 21 Jan 2016 14:23:07 +0100
  3118. -Subject: [PATCH] mac80211: fix txq queue related crashes
  3119. -
  3120. -The driver can access the queue simultanously
  3121. -while mac80211 tears down the interface. Without
  3122. -spinlock protection this could lead to corrupting
  3123. -sk_buff_head and subsequently to an invalid
  3124. -pointer dereference.
  3125. -
  3126. -Fixes: ba8c3d6f16a1 ("mac80211: add an intermediate software queue implementation")
  3127. -Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
  3128. ----
  3129. -
  3130. ---- a/net/mac80211/iface.c
  3131. -+++ b/net/mac80211/iface.c
  3132. -@@ -977,7 +977,10 @@ static void ieee80211_do_stop(struct iee
  3133. - if (sdata->vif.txq) {
  3134. - struct txq_info *txqi = to_txq_info(sdata->vif.txq);
  3135. -
  3136. -+ spin_lock_bh(&txqi->queue.lock);
  3137. - ieee80211_purge_tx_queue(&local->hw, &txqi->queue);
  3138. -+ spin_unlock_bh(&txqi->queue.lock);
  3139. -+
  3140. - atomic_set(&sdata->txqs_len[txqi->txq.ac], 0);
  3141. - }
  3142. -
  3143. 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
  3144. new file mode 100644
  3145. index 0000000..ef0afbe
  3146. --- /dev/null
  3147. +++ b/package/kernel/mac80211/patches/313-ath9k-Handle-channel-context-in-get_-set_-reset_tsf.patch
  3148. @@ -0,0 +1,70 @@
  3149. +From: Benjamin Berg <benjamin.berg@open-mesh.com>
  3150. +Date: Mon, 4 Jul 2016 14:37:21 +0200
  3151. +Subject: [PATCH] ath9k: Handle channel context in get_/set_/reset_tsf
  3152. +
  3153. +The ath9k TSF handling routines need to be aware of the channel context that
  3154. +is being modified. With this change the TSF related values that are stored
  3155. +in each channel context will be correctly tracked and the harware will only
  3156. +be updated if the modified context is currently the active one.
  3157. +
  3158. +Without this change the TSF modifications done using these routines would
  3159. +for example be lost during a hardware reset as done by ath_complete_reset.
  3160. +
  3161. +Signed-off-by: Benjamin Berg <benjamin.berg@open-mesh.com>
  3162. +---
  3163. +
  3164. +--- a/drivers/net/wireless/ath/ath9k/main.c
  3165. ++++ b/drivers/net/wireless/ath/ath9k/main.c
  3166. +@@ -1823,11 +1823,18 @@ static void ath9k_bss_info_changed(struc
  3167. + static u64 ath9k_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
  3168. + {
  3169. + struct ath_softc *sc = hw->priv;
  3170. ++ struct ath_vif *avp = (void *)vif->drv_priv;
  3171. + u64 tsf;
  3172. +
  3173. + mutex_lock(&sc->mutex);
  3174. + ath9k_ps_wakeup(sc);
  3175. +- tsf = ath9k_hw_gettsf64(sc->sc_ah);
  3176. ++ /* Get current TSF either from HW or kernel time. */
  3177. ++ if (sc->cur_chan == avp->chanctx) {
  3178. ++ tsf = ath9k_hw_gettsf64(sc->sc_ah);
  3179. ++ } else {
  3180. ++ tsf = sc->cur_chan->tsf_val +
  3181. ++ ath9k_hw_get_tsf_offset(&sc->cur_chan->tsf_ts, NULL);
  3182. ++ }
  3183. + ath9k_ps_restore(sc);
  3184. + mutex_unlock(&sc->mutex);
  3185. +
  3186. +@@ -1839,10 +1846,14 @@ static void ath9k_set_tsf(struct ieee802
  3187. + u64 tsf)
  3188. + {
  3189. + struct ath_softc *sc = hw->priv;
  3190. ++ struct ath_vif *avp = (void *)vif->drv_priv;
  3191. +
  3192. + mutex_lock(&sc->mutex);
  3193. + ath9k_ps_wakeup(sc);
  3194. +- ath9k_hw_settsf64(sc->sc_ah, tsf);
  3195. ++ getrawmonotonic(&avp->chanctx->tsf_ts);
  3196. ++ if (sc->cur_chan == avp->chanctx)
  3197. ++ ath9k_hw_settsf64(sc->sc_ah, tsf);
  3198. ++ avp->chanctx->tsf_val = tsf;
  3199. + ath9k_ps_restore(sc);
  3200. + mutex_unlock(&sc->mutex);
  3201. + }
  3202. +@@ -1850,11 +1861,15 @@ static void ath9k_set_tsf(struct ieee802
  3203. + static void ath9k_reset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
  3204. + {
  3205. + struct ath_softc *sc = hw->priv;
  3206. ++ struct ath_vif *avp = (void *)vif->drv_priv;
  3207. +
  3208. + mutex_lock(&sc->mutex);
  3209. +
  3210. + ath9k_ps_wakeup(sc);
  3211. +- ath9k_hw_reset_tsf(sc->sc_ah);
  3212. ++ getrawmonotonic(&avp->chanctx->tsf_ts);
  3213. ++ if (sc->cur_chan == avp->chanctx)
  3214. ++ ath9k_hw_reset_tsf(sc->sc_ah);
  3215. ++ avp->chanctx->tsf_val = 0;
  3216. + ath9k_ps_restore(sc);
  3217. +
  3218. + mutex_unlock(&sc->mutex);
  3219. 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
  3220. deleted file mode 100644
  3221. index 844d43b..0000000
  3222. --- a/package/kernel/mac80211/patches/313-mac80211-fix-unnecessary-frame-drops-in-mesh-fwding.patch
  3223. +++ /dev/null
  3224. @@ -1,57 +0,0 @@
  3225. -From: Michal Kazior <michal.kazior@tieto.com>
  3226. -Date: Mon, 25 Jan 2016 14:43:24 +0100
  3227. -Subject: [PATCH] mac80211: fix unnecessary frame drops in mesh fwding
  3228. -
  3229. -The ieee80211_queue_stopped() expects hw queue
  3230. -number but it was given raw WMM AC number instead.
  3231. -
  3232. -This could cause frame drops and problems with
  3233. -traffic in some cases - most notably if driver
  3234. -doesn't map AC numbers to queue numbers 1:1 and
  3235. -uses ieee80211_stop_queues() and
  3236. -ieee80211_wake_queue() only without ever calling
  3237. -ieee80211_wake_queues().
  3238. -
  3239. -On ath10k it was possible to hit this problem in
  3240. -the following case:
  3241. -
  3242. - 1. wlan0 uses queue 0
  3243. - (ath10k maps queues per vif)
  3244. - 2. offchannel uses queue 15
  3245. - 3. queues 1-14 are unused
  3246. - 4. ieee80211_stop_queues()
  3247. - 5. ieee80211_wake_queue(q=0)
  3248. - 6. ieee80211_wake_queue(q=15)
  3249. - (other queues are not woken up because both
  3250. - driver and mac80211 know other queues are
  3251. - unused)
  3252. - 7. ieee80211_rx_h_mesh_fwding()
  3253. - 8. ieee80211_select_queue_80211() returns 2
  3254. - 9. ieee80211_queue_stopped(q=2) returns true
  3255. - 10. frame is dropped (oops!)
  3256. -
  3257. -Fixes: d3c1597b8d1b ("mac80211: fix forwarded mesh frame queue mapping")
  3258. -Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
  3259. ----
  3260. -
  3261. ---- a/net/mac80211/rx.c
  3262. -+++ b/net/mac80211/rx.c
  3263. -@@ -2235,7 +2235,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
  3264. - struct ieee80211_local *local = rx->local;
  3265. - struct ieee80211_sub_if_data *sdata = rx->sdata;
  3266. - struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
  3267. -- u16 q, hdrlen;
  3268. -+ u16 ac, q, hdrlen;
  3269. -
  3270. - hdr = (struct ieee80211_hdr *) skb->data;
  3271. - hdrlen = ieee80211_hdrlen(hdr->frame_control);
  3272. -@@ -2304,7 +2304,8 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
  3273. - ether_addr_equal(sdata->vif.addr, hdr->addr3))
  3274. - return RX_CONTINUE;
  3275. -
  3276. -- q = ieee80211_select_queue_80211(sdata, skb, hdr);
  3277. -+ ac = ieee80211_select_queue_80211(sdata, skb, hdr);
  3278. -+ q = sdata->vif.hw_queue[ac];
  3279. - if (ieee80211_queue_stopped(&local->hw, q)) {
  3280. - IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_congestion);
  3281. - return RX_DROP_MONITOR;
  3282. 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
  3283. new file mode 100644
  3284. index 0000000..e725a8b
  3285. --- /dev/null
  3286. +++ b/package/kernel/mac80211/patches/314-ath9k-Use-tsf-offset-helper-in-ath9k_hw_reset.patch
  3287. @@ -0,0 +1,65 @@
  3288. +From: Benjamin Berg <benjamin.berg@open-mesh.com>
  3289. +Date: Mon, 4 Jul 2016 14:37:22 +0200
  3290. +Subject: [PATCH] ath9k: Use tsf offset helper in ath9k_hw_reset
  3291. +
  3292. +These changes make ath9k_hw_reset more consistent with other places that
  3293. +handle the TSF value by using the same helper routine.
  3294. +
  3295. +A slight improvement is to not assume that a fixed time of 1.5ms has
  3296. +passed for the initval writes when compared to the first write attempt.
  3297. +Instead the TSF value is re-calculated which will yield a higher accuracy
  3298. +of the restored TSF timer.
  3299. +
  3300. +Signed-off-by: Benjamin Berg <benjamin.berg@open-mesh.com>
  3301. +---
  3302. +
  3303. +--- a/drivers/net/wireless/ath/ath9k/hw.c
  3304. ++++ b/drivers/net/wireless/ath/ath9k/hw.c
  3305. +@@ -1832,8 +1832,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  3306. + u32 saveLedState;
  3307. + u32 saveDefAntenna;
  3308. + u32 macStaId1;
  3309. ++ struct timespec tsf_ts;
  3310. ++ u32 tsf_offset;
  3311. + u64 tsf = 0;
  3312. +- s64 usec = 0;
  3313. + int r;
  3314. + bool start_mci_reset = false;
  3315. + bool save_fullsleep = ah->chip_fullsleep;
  3316. +@@ -1877,8 +1878,8 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  3317. + macStaId1 = REG_READ(ah, AR_STA_ID1) & AR_STA_ID1_BASE_RATE_11B;
  3318. +
  3319. + /* Save TSF before chip reset, a cold reset clears it */
  3320. ++ getrawmonotonic(&tsf_ts);
  3321. + tsf = ath9k_hw_gettsf64(ah);
  3322. +- usec = ktime_to_us(ktime_get_raw());
  3323. +
  3324. + saveLedState = REG_READ(ah, AR_CFG_LED) &
  3325. + (AR_CFG_LED_ASSOC_CTL | AR_CFG_LED_MODE_SEL |
  3326. +@@ -1911,8 +1912,8 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  3327. + }
  3328. +
  3329. + /* Restore TSF */
  3330. +- usec = ktime_to_us(ktime_get_raw()) - usec;
  3331. +- ath9k_hw_settsf64(ah, tsf + usec);
  3332. ++ tsf_offset = ath9k_hw_get_tsf_offset(&tsf_ts, NULL);
  3333. ++ ath9k_hw_settsf64(ah, tsf + tsf_offset);
  3334. +
  3335. + if (AR_SREV_9280_20_OR_LATER(ah))
  3336. + REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL, AR_GPIO_JTAG_DISABLE);
  3337. +@@ -1932,12 +1933,11 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  3338. + /*
  3339. + * Some AR91xx SoC devices frequently fail to accept TSF writes
  3340. + * right after the chip reset. When that happens, write a new
  3341. +- * value after the initvals have been applied, with an offset
  3342. +- * based on measured time difference
  3343. ++ * value after the initvals have been applied.
  3344. + */
  3345. + if (AR_SREV_9100(ah) && (ath9k_hw_gettsf64(ah) < tsf)) {
  3346. +- tsf += 1500;
  3347. +- ath9k_hw_settsf64(ah, tsf);
  3348. ++ tsf_offset = ath9k_hw_get_tsf_offset(&tsf_ts, NULL);
  3349. ++ ath9k_hw_settsf64(ah, tsf + tsf_offset);
  3350. + }
  3351. +
  3352. + ath9k_hw_init_mfp(ah);
  3353. 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
  3354. deleted file mode 100644
  3355. index 5b3efbd..0000000
  3356. --- a/package/kernel/mac80211/patches/314-mac80211-Requeue-work-after-scan-complete-for-all-VI.patch
  3357. +++ /dev/null
  3358. @@ -1,103 +0,0 @@
  3359. -From: Sachin Kulkarni <Sachin.Kulkarni@imgtec.com>
  3360. -Date: Tue, 12 Jan 2016 14:30:19 +0530
  3361. -Subject: [PATCH] mac80211: Requeue work after scan complete for all VIF
  3362. - types.
  3363. -
  3364. -During a sw scan ieee80211_iface_work ignores work items for all vifs.
  3365. -However after the scan complete work is requeued only for STA, ADHOC
  3366. -and MESH iftypes.
  3367. -
  3368. -This occasionally results in event processing getting delayed/not
  3369. -processed for iftype AP when it coexists with a STA. This can result
  3370. -in data halt and eventually disconnection on the AP interface.
  3371. -
  3372. -Signed-off-by: Sachin Kulkarni <Sachin.Kulkarni@imgtec.com>
  3373. -Cc: linux-wireless@vger.kernel.org
  3374. -Cc: johannes@sipsolutions.net
  3375. ----
  3376. -
  3377. ---- a/net/mac80211/ibss.c
  3378. -+++ b/net/mac80211/ibss.c
  3379. -@@ -1731,7 +1731,6 @@ void ieee80211_ibss_notify_scan_complete
  3380. - if (sdata->vif.type != NL80211_IFTYPE_ADHOC)
  3381. - continue;
  3382. - sdata->u.ibss.last_scan_completed = jiffies;
  3383. -- ieee80211_queue_work(&local->hw, &sdata->work);
  3384. - }
  3385. - mutex_unlock(&local->iflist_mtx);
  3386. - }
  3387. ---- a/net/mac80211/mesh.c
  3388. -+++ b/net/mac80211/mesh.c
  3389. -@@ -1369,17 +1369,6 @@ out:
  3390. - sdata_unlock(sdata);
  3391. - }
  3392. -
  3393. --void ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local)
  3394. --{
  3395. -- struct ieee80211_sub_if_data *sdata;
  3396. --
  3397. -- rcu_read_lock();
  3398. -- list_for_each_entry_rcu(sdata, &local->interfaces, list)
  3399. -- if (ieee80211_vif_is_mesh(&sdata->vif) &&
  3400. -- ieee80211_sdata_running(sdata))
  3401. -- ieee80211_queue_work(&local->hw, &sdata->work);
  3402. -- rcu_read_unlock();
  3403. --}
  3404. -
  3405. - void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata)
  3406. - {
  3407. ---- a/net/mac80211/mesh.h
  3408. -+++ b/net/mac80211/mesh.h
  3409. -@@ -362,14 +362,10 @@ static inline bool mesh_path_sel_is_hwmp
  3410. - return sdata->u.mesh.mesh_pp_id == IEEE80211_PATH_PROTOCOL_HWMP;
  3411. - }
  3412. -
  3413. --void ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local);
  3414. --
  3415. - void mesh_path_flush_by_iface(struct ieee80211_sub_if_data *sdata);
  3416. - void mesh_sync_adjust_tbtt(struct ieee80211_sub_if_data *sdata);
  3417. - void ieee80211s_stop(void);
  3418. - #else
  3419. --static inline void
  3420. --ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local) {}
  3421. - static inline bool mesh_path_sel_is_hwmp(struct ieee80211_sub_if_data *sdata)
  3422. - { return false; }
  3423. - static inline void mesh_path_flush_by_iface(struct ieee80211_sub_if_data *sdata)
  3424. ---- a/net/mac80211/mlme.c
  3425. -+++ b/net/mac80211/mlme.c
  3426. -@@ -3978,8 +3978,6 @@ static void ieee80211_restart_sta_timer(
  3427. - if (!ieee80211_hw_check(&sdata->local->hw, CONNECTION_MONITOR))
  3428. - ieee80211_queue_work(&sdata->local->hw,
  3429. - &sdata->u.mgd.monitor_work);
  3430. -- /* and do all the other regular work too */
  3431. -- ieee80211_queue_work(&sdata->local->hw, &sdata->work);
  3432. - }
  3433. - }
  3434. -
  3435. ---- a/net/mac80211/scan.c
  3436. -+++ b/net/mac80211/scan.c
  3437. -@@ -314,6 +314,7 @@ static void __ieee80211_scan_completed(s
  3438. - bool was_scanning = local->scanning;
  3439. - struct cfg80211_scan_request *scan_req;
  3440. - struct ieee80211_sub_if_data *scan_sdata;
  3441. -+ struct ieee80211_sub_if_data *sdata;
  3442. -
  3443. - lockdep_assert_held(&local->mtx);
  3444. -
  3445. -@@ -373,7 +374,15 @@ static void __ieee80211_scan_completed(s
  3446. -
  3447. - ieee80211_mlme_notify_scan_completed(local);
  3448. - ieee80211_ibss_notify_scan_completed(local);
  3449. -- ieee80211_mesh_notify_scan_completed(local);
  3450. -+
  3451. -+ /* Requeue all the work that might have been ignored while
  3452. -+ * the scan was in progress
  3453. -+ */
  3454. -+ list_for_each_entry_rcu(sdata, &local->interfaces, list) {
  3455. -+ if (ieee80211_sdata_running(sdata))
  3456. -+ ieee80211_queue_work(&sdata->local->hw, &sdata->work);
  3457. -+ }
  3458. -+
  3459. - if (was_scanning)
  3460. - ieee80211_start_next_roc(local);
  3461. - }
  3462. 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
  3463. new file mode 100644
  3464. index 0000000..c95ab7e
  3465. --- /dev/null
  3466. +++ b/package/kernel/mac80211/patches/315-ath9k-Expose-tsf_adjustment-in-mac80211-tsf-getters-.patch
  3467. @@ -0,0 +1,32 @@
  3468. +From: Benjamin Berg <benjamin.berg@open-mesh.com>
  3469. +Date: Mon, 4 Jul 2016 14:37:23 +0200
  3470. +Subject: [PATCH] ath9k: Expose tsf_adjustment in mac80211 tsf getters and
  3471. + setters.
  3472. +
  3473. +The ath9k driver modifies the TSF for VIFs for the purpose of sending
  3474. +beacons in a staggered fashion. This patch exposes this VIF specific
  3475. +adjustment of the TSF value to mac80211. Without the change the TSF
  3476. +routines handle the hardware TSF value instead of the actual TSF value as
  3477. +seen on the air.
  3478. +
  3479. +Signed-off-by: Benjamin Berg <benjamin.berg@open-mesh.com>
  3480. +---
  3481. +
  3482. +--- a/drivers/net/wireless/ath/ath9k/main.c
  3483. ++++ b/drivers/net/wireless/ath/ath9k/main.c
  3484. +@@ -1835,6 +1835,7 @@ static u64 ath9k_get_tsf(struct ieee8021
  3485. + tsf = sc->cur_chan->tsf_val +
  3486. + ath9k_hw_get_tsf_offset(&sc->cur_chan->tsf_ts, NULL);
  3487. + }
  3488. ++ tsf += le64_to_cpu(avp->tsf_adjust);
  3489. + ath9k_ps_restore(sc);
  3490. + mutex_unlock(&sc->mutex);
  3491. +
  3492. +@@ -1850,6 +1851,7 @@ static void ath9k_set_tsf(struct ieee802
  3493. +
  3494. + mutex_lock(&sc->mutex);
  3495. + ath9k_ps_wakeup(sc);
  3496. ++ tsf -= le64_to_cpu(avp->tsf_adjust);
  3497. + getrawmonotonic(&avp->chanctx->tsf_ts);
  3498. + if (sc->cur_chan == avp->chanctx)
  3499. + ath9k_hw_settsf64(sc->sc_ah, tsf);
  3500. 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
  3501. deleted file mode 100644
  3502. index 52fecb9..0000000
  3503. --- a/package/kernel/mac80211/patches/315-mac80211-fix-ibss-scan-parameters.patch
  3504. +++ /dev/null
  3505. @@ -1,57 +0,0 @@
  3506. -From: Sara Sharon <sara.sharon@intel.com>
  3507. -Date: Mon, 25 Jan 2016 15:46:35 +0200
  3508. -Subject: [PATCH] mac80211: fix ibss scan parameters
  3509. -
  3510. -When joining IBSS a full scan should be initiated in order to search
  3511. -for existing cell, unless the fixed_channel parameter was set.
  3512. -A default channel to create the IBSS on if no cell was found is
  3513. -provided as well.
  3514. -However - a scan is initiated only on the default channel provided
  3515. -regardless of whether ifibss->fixed_channel is set or not, with the
  3516. -obvious result of the cell not joining existing IBSS cell that is
  3517. -on another channel.
  3518. -
  3519. -Fixes: 76bed0f43b27 ("mac80211: IBSS fix scan request")
  3520. -Signed-off-by: Sara Sharon <sara.sharon@intel.com>
  3521. -Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
  3522. ----
  3523. -
  3524. ---- a/net/mac80211/ibss.c
  3525. -+++ b/net/mac80211/ibss.c
  3526. -@@ -7,6 +7,7 @@
  3527. - * Copyright 2007, Michael Wu <flamingice@sourmilk.net>
  3528. - * Copyright 2009, Johannes Berg <johannes@sipsolutions.net>
  3529. - * Copyright 2013-2014 Intel Mobile Communications GmbH
  3530. -+ * Copyright(c) 2016 Intel Deutschland GmbH
  3531. - *
  3532. - * This program is free software; you can redistribute it and/or modify
  3533. - * it under the terms of the GNU General Public License version 2 as
  3534. -@@ -1483,14 +1484,21 @@ static void ieee80211_sta_find_ibss(stru
  3535. -
  3536. - sdata_info(sdata, "Trigger new scan to find an IBSS to join\n");
  3537. -
  3538. -- num = ieee80211_ibss_setup_scan_channels(local->hw.wiphy,
  3539. -- &ifibss->chandef,
  3540. -- channels,
  3541. -- ARRAY_SIZE(channels));
  3542. - scan_width = cfg80211_chandef_to_scan_width(&ifibss->chandef);
  3543. -- ieee80211_request_ibss_scan(sdata, ifibss->ssid,
  3544. -- ifibss->ssid_len, channels, num,
  3545. -- scan_width);
  3546. -+
  3547. -+ if (ifibss->fixed_channel) {
  3548. -+ num = ieee80211_ibss_setup_scan_channels(local->hw.wiphy,
  3549. -+ &ifibss->chandef,
  3550. -+ channels,
  3551. -+ ARRAY_SIZE(channels));
  3552. -+ ieee80211_request_ibss_scan(sdata, ifibss->ssid,
  3553. -+ ifibss->ssid_len, channels,
  3554. -+ num, scan_width);
  3555. -+ } else {
  3556. -+ ieee80211_request_ibss_scan(sdata, ifibss->ssid,
  3557. -+ ifibss->ssid_len, NULL,
  3558. -+ 0, scan_width);
  3559. -+ }
  3560. - } else {
  3561. - int interval = IEEE80211_SCAN_INTERVAL;
  3562. -
  3563. 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
  3564. new file mode 100644
  3565. index 0000000..36aaa10
  3566. --- /dev/null
  3567. +++ b/package/kernel/mac80211/patches/316-ath9k-Remove-some-defined-constants-to-decrease-verb.patch
  3568. @@ -0,0 +1,137 @@
  3569. +From: Benjamin Berg <benjamin.berg@open-mesh.com>
  3570. +Date: Mon, 4 Jul 2016 14:37:24 +0200
  3571. +Subject: [PATCH] ath9k: Remove some #defined constants to decrease
  3572. + verbosity
  3573. +
  3574. +The removed ATH9K_SLOT_TIME_X constants simply map the value in microseconds
  3575. +to the same integer. These constants were not used consistently, so fix the
  3576. +inconsistency issue by replacing all occurances with the integer equivalent.
  3577. +
  3578. +Signed-off-by: Benjamin Berg <benjamin.berg@open-mesh.com>
  3579. +---
  3580. +
  3581. +--- a/drivers/net/wireless/ath/ath9k/beacon.c
  3582. ++++ b/drivers/net/wireless/ath/ath9k/beacon.c
  3583. +@@ -50,7 +50,7 @@ static void ath9k_beaconq_config(struct
  3584. + txq = sc->tx.txq_map[IEEE80211_AC_BE];
  3585. + ath9k_hw_get_txq_props(ah, txq->axq_qnum, &qi_be);
  3586. + qi.tqi_aifs = qi_be.tqi_aifs;
  3587. +- if (ah->slottime == ATH9K_SLOT_TIME_20)
  3588. ++ if (ah->slottime == 20)
  3589. + qi.tqi_cwmin = 2*qi_be.tqi_cwmin;
  3590. + else
  3591. + qi.tqi_cwmin = 4*qi_be.tqi_cwmin;
  3592. +--- a/drivers/net/wireless/ath/ath9k/dynack.c
  3593. ++++ b/drivers/net/wireless/ath/ath9k/dynack.c
  3594. +@@ -280,7 +280,7 @@ EXPORT_SYMBOL(ath_dynack_sample_ack_ts);
  3595. + void ath_dynack_node_init(struct ath_hw *ah, struct ath_node *an)
  3596. + {
  3597. + /* ackto = slottime + sifs + air delay */
  3598. +- u32 ackto = ATH9K_SLOT_TIME_9 + 16 + 64;
  3599. ++ u32 ackto = 9 + 16 + 64;
  3600. + struct ath_dynack *da = &ah->dynack;
  3601. +
  3602. + an->ackto = ackto;
  3603. +@@ -315,7 +315,7 @@ EXPORT_SYMBOL(ath_dynack_node_deinit);
  3604. + void ath_dynack_reset(struct ath_hw *ah)
  3605. + {
  3606. + /* ackto = slottime + sifs + air delay */
  3607. +- u32 ackto = ATH9K_SLOT_TIME_9 + 16 + 64;
  3608. ++ u32 ackto = 9 + 16 + 64;
  3609. + struct ath_dynack *da = &ah->dynack;
  3610. +
  3611. + da->lto = jiffies;
  3612. +--- a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
  3613. ++++ b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
  3614. +@@ -45,7 +45,7 @@ void ath9k_htc_beaconq_config(struct ath
  3615. + * Long slot time : 2x cwmin
  3616. + * Short slot time : 4x cwmin
  3617. + */
  3618. +- if (ah->slottime == ATH9K_SLOT_TIME_20)
  3619. ++ if (ah->slottime == 20)
  3620. + qi.tqi_cwmin = 2*qi_be.tqi_cwmin;
  3621. + else
  3622. + qi.tqi_cwmin = 4*qi_be.tqi_cwmin;
  3623. +--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
  3624. ++++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
  3625. +@@ -678,7 +678,7 @@ static int ath9k_init_priv(struct ath9k_
  3626. +
  3627. + for (i = 0; i < ATH9K_HTC_MAX_BCN_VIF; i++)
  3628. + priv->beacon.bslot[i] = NULL;
  3629. +- priv->beacon.slottime = ATH9K_SLOT_TIME_9;
  3630. ++ priv->beacon.slottime = 9;
  3631. +
  3632. + ath9k_cmn_init_channels_rates(common);
  3633. + ath9k_cmn_init_crypto(ah);
  3634. +--- a/drivers/net/wireless/ath/ath9k/hw.c
  3635. ++++ b/drivers/net/wireless/ath/ath9k/hw.c
  3636. +@@ -454,7 +454,7 @@ static void ath9k_hw_init_defaults(struc
  3637. + if (AR_SREV_9100(ah))
  3638. + ah->sta_id1_defaults |= AR_STA_ID1_AR9100_BA_FIX;
  3639. +
  3640. +- ah->slottime = ATH9K_SLOT_TIME_9;
  3641. ++ ah->slottime = 9;
  3642. + ah->globaltxtimeout = (u32) -1;
  3643. + ah->power_mode = ATH9K_PM_UNDEFINED;
  3644. + ah->htc_reset_init = true;
  3645. +--- a/drivers/net/wireless/ath/ath9k/init.c
  3646. ++++ b/drivers/net/wireless/ath/ath9k/init.c
  3647. +@@ -372,7 +372,7 @@ static void ath9k_init_misc(struct ath_s
  3648. +
  3649. + common->last_rssi = ATH_RSSI_DUMMY_MARKER;
  3650. + memcpy(common->bssidmask, ath_bcast_mac, ETH_ALEN);
  3651. +- sc->beacon.slottime = ATH9K_SLOT_TIME_9;
  3652. ++ sc->beacon.slottime = 9;
  3653. +
  3654. + for (i = 0; i < ARRAY_SIZE(sc->beacon.bslot); i++)
  3655. + sc->beacon.bslot[i] = NULL;
  3656. +--- a/drivers/net/wireless/ath/ath9k/mac.h
  3657. ++++ b/drivers/net/wireless/ath/ath9k/mac.h
  3658. +@@ -65,10 +65,6 @@
  3659. + #define INIT_SSH_RETRY 32
  3660. + #define INIT_SLG_RETRY 32
  3661. +
  3662. +-#define ATH9K_SLOT_TIME_6 6
  3663. +-#define ATH9K_SLOT_TIME_9 9
  3664. +-#define ATH9K_SLOT_TIME_20 20
  3665. +-
  3666. + #define ATH9K_TXERR_XRETRY 0x01
  3667. + #define ATH9K_TXERR_FILT 0x02
  3668. + #define ATH9K_TXERR_FIFO 0x04
  3669. +--- a/drivers/net/wireless/ath/ath9k/main.c
  3670. ++++ b/drivers/net/wireless/ath/ath9k/main.c
  3671. +@@ -926,7 +926,7 @@ static void ath9k_vif_iter(struct ath9k_
  3672. + }
  3673. +
  3674. + if (!vif->bss_conf.use_short_slot)
  3675. +- iter_data->slottime = ATH9K_SLOT_TIME_20;
  3676. ++ iter_data->slottime = 20;
  3677. +
  3678. + switch (vif->type) {
  3679. + case NL80211_IFTYPE_AP:
  3680. +@@ -999,7 +999,7 @@ void ath9k_calculate_iter_data(struct at
  3681. + */
  3682. + memset(iter_data, 0, sizeof(*iter_data));
  3683. + eth_broadcast_addr(iter_data->mask);
  3684. +- iter_data->slottime = ATH9K_SLOT_TIME_9;
  3685. ++ iter_data->slottime = 9;
  3686. +
  3687. + list_for_each_entry(avp, &ctx->vifs, list)
  3688. + ath9k_vif_iter(iter_data, avp->vif->addr, avp->vif);
  3689. +@@ -1061,7 +1061,7 @@ static void ath9k_set_offchannel_state(s
  3690. + ah->opmode = vif->type;
  3691. + ah->imask &= ~ATH9K_INT_SWBA;
  3692. + ah->imask &= ~ATH9K_INT_TSFOOR;
  3693. +- ah->slottime = ATH9K_SLOT_TIME_9;
  3694. ++ ah->slottime = 9;
  3695. +
  3696. + ath_hw_setbssidmask(common);
  3697. + ath9k_hw_setopmode(ah);
  3698. +@@ -1788,6 +1788,7 @@ static void ath9k_bss_info_changed(struc
  3699. + slottime = 9;
  3700. + else
  3701. + slottime = 20;
  3702. ++
  3703. + if (vif->type == NL80211_IFTYPE_AP) {
  3704. + /*
  3705. + * Defer update, so that connected stations can adjust
  3706. 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
  3707. deleted file mode 100644
  3708. index e78df36..0000000
  3709. --- a/package/kernel/mac80211/patches/316-net-mac80211-agg-rx.c-fix-use-of-uninitialised-value.patch
  3710. +++ /dev/null
  3711. @@ -1,50 +0,0 @@
  3712. -From: Chris Bainbridge <chris.bainbridge@gmail.com>
  3713. -Date: Wed, 27 Jan 2016 15:46:18 +0000
  3714. -Subject: [PATCH] net/mac80211/agg-rx.c: fix use of uninitialised values
  3715. -
  3716. -Use kzalloc instead of kmalloc for struct tid_ampdu_rx. Fixes:
  3717. -
  3718. -[ 7.976605] UBSAN: Undefined behaviour in net/mac80211/rx.c:932:29
  3719. -[ 7.976608] load of value 2 is not a valid value for type '_Bool'
  3720. -[ 7.976611] CPU: 3 PID: 1134 Comm: kworker/u16:7 Not tainted 4.5.0-rc1+ #265
  3721. -[ 7.976613] Hardware name: Apple Inc. MacBookPro10,2/Mac-AFD8A9D944EA4843, BIOS MBP102.88Z.0106.B0A.1509130955 09/13/2015
  3722. -[ 7.976616] Workqueue: phy0 rt2x00usb_work_rxdone
  3723. -[ 7.976619] 0000000000000004 ffff880254a7ba50 ffffffff8181d866 0000000000000007
  3724. -[ 7.976622] ffff880254a7ba78 ffff880254a7ba68 ffffffff8188422d ffffffff8379b500
  3725. -[ 7.976626] ffff880254a7bab8 ffffffff81884747 0000000000000202 0000000348620032
  3726. -[ 7.976629] Call Trace:
  3727. -[ 7.976633] [<ffffffff8181d866>] dump_stack+0x45/0x5f
  3728. -[ 7.976637] [<ffffffff8188422d>] ubsan_epilogue+0xd/0x40
  3729. -[ 7.976642] [<ffffffff81884747>] __ubsan_handle_load_invalid_value+0x67/0x70
  3730. -[ 7.976646] [<ffffffff82227b4d>] ieee80211_sta_reorder_release.isra.16+0x5ed/0x730
  3731. -[ 7.976650] [<ffffffff8222ca14>] ieee80211_prepare_and_rx_handle+0xd04/0x1c00
  3732. -[ 7.976654] [<ffffffff81cb27ce>] ? usb_hcd_map_urb_for_dma+0x65e/0x960
  3733. -[ 7.976659] [<ffffffff8222db03>] __ieee80211_rx_handle_packet+0x1f3/0x750
  3734. -[ 7.976663] [<ffffffff8222e4a7>] ieee80211_rx_napi+0x447/0x990
  3735. -[ 7.976667] [<ffffffff81c5fb85>] rt2x00lib_rxdone+0x305/0xbd0
  3736. -[ 7.976670] [<ffffffff811ac23f>] ? dequeue_task_fair+0x64f/0x1de0
  3737. -[ 7.976674] [<ffffffff811a1516>] ? sched_clock_cpu+0xe6/0x150
  3738. -[ 7.976678] [<ffffffff81c6c45c>] rt2x00usb_work_rxdone+0x7c/0x140
  3739. -[ 7.976682] [<ffffffff8117aef6>] process_one_work+0x226/0x860
  3740. -[ 7.976686] [<ffffffff8117b58c>] worker_thread+0x5c/0x680
  3741. -[ 7.976690] [<ffffffff8117b530>] ? process_one_work+0x860/0x860
  3742. -[ 7.976693] [<ffffffff81184f86>] kthread+0xf6/0x150
  3743. -[ 7.976697] [<ffffffff81184e90>] ? kthread_worker_fn+0x310/0x310
  3744. -[ 7.976700] [<ffffffff822a94df>] ret_from_fork+0x3f/0x70
  3745. -[ 7.976703] [<ffffffff81184e90>] ? kthread_worker_fn+0x310/0x310
  3746. -
  3747. -Link: https://lkml.org/lkml/2016/1/26/230
  3748. -Signed-off-by: Chris Bainbridge <chris.bainbridge@gmail.com>
  3749. ----
  3750. -
  3751. ---- a/net/mac80211/agg-rx.c
  3752. -+++ b/net/mac80211/agg-rx.c
  3753. -@@ -327,7 +327,7 @@ void __ieee80211_start_rx_ba_session(str
  3754. - }
  3755. -
  3756. - /* prepare A-MPDU MLME for Rx aggregation */
  3757. -- tid_agg_rx = kmalloc(sizeof(struct tid_ampdu_rx), GFP_KERNEL);
  3758. -+ tid_agg_rx = kzalloc(sizeof(struct tid_ampdu_rx), GFP_KERNEL);
  3759. - if (!tid_agg_rx)
  3760. - goto end;
  3761. -
  3762. 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
  3763. new file mode 100644
  3764. index 0000000..360dfbf
  3765. --- /dev/null
  3766. +++ b/package/kernel/mac80211/patches/317-ath9k-Fix-beacon-configuration-for-addition-removal-.patch
  3767. @@ -0,0 +1,544 @@
  3768. +From: Benjamin Berg <benjamin.berg@open-mesh.com>
  3769. +Date: Mon, 4 Jul 2016 14:37:25 +0200
  3770. +Subject: [PATCH] ath9k: Fix beacon configuration for addition/removal of
  3771. + interfaces
  3772. +
  3773. +This patch fixes some issues with interface reconfiguration. It could
  3774. +for example happen that an AP interface in beacon slot 0 was removed
  3775. +leaving an IBSS station in one of the other slots. When this happens
  3776. +the driver never sends out the beacon as it only tries to send a beacon
  3777. +from slot 0.
  3778. +
  3779. +Appart from that the tracking of required changes to the beacon config is
  3780. +relatively complicated and prone to errors.
  3781. +
  3782. +The approach taken here is to solve reconfiguration issues is to
  3783. +reconfigure the beacons when any interface changes. This means that
  3784. +the complexity of deciding whether an interface change may modify the
  3785. +beacon configuration is gone. It also means that the beacon config will
  3786. +be reliably updated when an interface is removed.
  3787. +
  3788. +The issue that a single non-AP interface might not be in beacon
  3789. +slot 0 and wouldn't be send out is solved by moving it into the
  3790. +first slot. The TSF value in hardware is adjusted accordingly so
  3791. +that the timestamp of the beacons stay consistent.
  3792. +
  3793. +Signed-off-by: Benjamin Berg <benjamin.berg@open-mesh.com>
  3794. +---
  3795. +
  3796. +--- a/drivers/net/wireless/ath/ath9k/ath9k.h
  3797. ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  3798. +@@ -637,6 +637,8 @@ struct ath9k_vif_iter_data {
  3799. + int nwds; /* number of WDS vifs */
  3800. + int nadhocs; /* number of adhoc vifs */
  3801. + int nocbs; /* number of OCB vifs */
  3802. ++ int nbcnvifs; /* number of beaconing vifs */
  3803. ++ struct ieee80211_vif *primary_beacon_vif;
  3804. + struct ieee80211_vif *primary_sta;
  3805. + };
  3806. +
  3807. +@@ -685,10 +687,11 @@ struct ath_beacon {
  3808. + };
  3809. +
  3810. + void ath9k_beacon_tasklet(unsigned long data);
  3811. +-void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif,
  3812. +- u32 changed);
  3813. ++void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *main_vif,
  3814. ++ bool beacons);
  3815. + void ath9k_beacon_assign_slot(struct ath_softc *sc, struct ieee80211_vif *vif);
  3816. + void ath9k_beacon_remove_slot(struct ath_softc *sc, struct ieee80211_vif *vif);
  3817. ++void ath9k_beacon_ensure_primary_slot(struct ath_softc *sc);
  3818. + void ath9k_set_beacon(struct ath_softc *sc);
  3819. + bool ath9k_csa_is_finished(struct ath_softc *sc, struct ieee80211_vif *vif);
  3820. + void ath9k_csa_update(struct ath_softc *sc);
  3821. +--- a/drivers/net/wireless/ath/ath9k/beacon.c
  3822. ++++ b/drivers/net/wireless/ath/ath9k/beacon.c
  3823. +@@ -209,7 +209,6 @@ void ath9k_beacon_assign_slot(struct ath
  3824. + }
  3825. +
  3826. + sc->beacon.bslot[avp->av_bslot] = vif;
  3827. +- sc->nbcnvifs++;
  3828. +
  3829. + ath_dbg(common, CONFIG, "Added interface at beacon slot: %d\n",
  3830. + avp->av_bslot);
  3831. +@@ -220,15 +219,12 @@ void ath9k_beacon_remove_slot(struct ath
  3832. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  3833. + struct ath_vif *avp = (void *)vif->drv_priv;
  3834. + struct ath_buf *bf = avp->av_bcbuf;
  3835. +- struct ath_beacon_config *cur_conf = &sc->cur_chan->beacon;
  3836. +
  3837. + ath_dbg(common, CONFIG, "Removing interface at beacon slot: %d\n",
  3838. + avp->av_bslot);
  3839. +
  3840. + tasklet_disable(&sc->bcon_tasklet);
  3841. +
  3842. +- cur_conf->enable_beacon &= ~BIT(avp->av_bslot);
  3843. +-
  3844. + if (bf && bf->bf_mpdu) {
  3845. + struct sk_buff *skb = bf->bf_mpdu;
  3846. + dma_unmap_single(sc->dev, bf->bf_buf_addr,
  3847. +@@ -240,12 +236,73 @@ void ath9k_beacon_remove_slot(struct ath
  3848. +
  3849. + avp->av_bcbuf = NULL;
  3850. + sc->beacon.bslot[avp->av_bslot] = NULL;
  3851. +- sc->nbcnvifs--;
  3852. + list_add_tail(&bf->list, &sc->beacon.bbuf);
  3853. +
  3854. + tasklet_enable(&sc->bcon_tasklet);
  3855. + }
  3856. +
  3857. ++void ath9k_beacon_ensure_primary_slot(struct ath_softc *sc)
  3858. ++{
  3859. ++ struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  3860. ++ struct ieee80211_vif *vif;
  3861. ++ struct ath_vif *avp;
  3862. ++ s64 tsfadjust;
  3863. ++ u32 offset;
  3864. ++ int first_slot = ATH_BCBUF;
  3865. ++ int slot;
  3866. ++
  3867. ++ tasklet_disable(&sc->bcon_tasklet);
  3868. ++
  3869. ++ /* Find first taken slot. */
  3870. ++ for (slot = 0; slot < ATH_BCBUF; slot++) {
  3871. ++ if (sc->beacon.bslot[slot]) {
  3872. ++ first_slot = slot;
  3873. ++ break;
  3874. ++ }
  3875. ++ }
  3876. ++ if (first_slot == 0)
  3877. ++ goto out;
  3878. ++
  3879. ++ /* Re-enumarate all slots, moving them forward. */
  3880. ++ for (slot = 0; slot < ATH_BCBUF; slot++) {
  3881. ++ if (slot + first_slot < ATH_BCBUF) {
  3882. ++ vif = sc->beacon.bslot[slot + first_slot];
  3883. ++ sc->beacon.bslot[slot] = vif;
  3884. ++
  3885. ++ if (vif) {
  3886. ++ avp = (void *)vif->drv_priv;
  3887. ++ avp->av_bslot = slot;
  3888. ++ }
  3889. ++ } else {
  3890. ++ sc->beacon.bslot[slot] = NULL;
  3891. ++ }
  3892. ++ }
  3893. ++
  3894. ++ vif = sc->beacon.bslot[0];
  3895. ++ if (WARN_ON(!vif))
  3896. ++ goto out;
  3897. ++
  3898. ++ /* Get the tsf_adjust value for the new first slot. */
  3899. ++ avp = (void *)vif->drv_priv;
  3900. ++ tsfadjust = le64_to_cpu(avp->tsf_adjust);
  3901. ++
  3902. ++ ath_dbg(common, CONFIG,
  3903. ++ "Adjusting global TSF after beacon slot reassignment: %lld\n",
  3904. ++ (signed long long)tsfadjust);
  3905. ++
  3906. ++ /* Modify TSF as required and update the HW. */
  3907. ++ avp->chanctx->tsf_val += tsfadjust;
  3908. ++ if (sc->cur_chan == avp->chanctx) {
  3909. ++ offset = ath9k_hw_get_tsf_offset(&avp->chanctx->tsf_ts, NULL);
  3910. ++ ath9k_hw_settsf64(sc->sc_ah, avp->chanctx->tsf_val + offset);
  3911. ++ }
  3912. ++
  3913. ++ /* The slots tsf_adjust will be updated by ath9k_beacon_config later. */
  3914. ++
  3915. ++out:
  3916. ++ tasklet_enable(&sc->bcon_tasklet);
  3917. ++}
  3918. ++
  3919. + static int ath9k_beacon_choose_slot(struct ath_softc *sc)
  3920. + {
  3921. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  3922. +@@ -274,26 +331,33 @@ static int ath9k_beacon_choose_slot(stru
  3923. + return slot;
  3924. + }
  3925. +
  3926. +-static void ath9k_set_tsfadjust(struct ath_softc *sc, struct ieee80211_vif *vif)
  3927. ++static void ath9k_set_tsfadjust(struct ath_softc *sc,
  3928. ++ struct ath_beacon_config *cur_conf)
  3929. + {
  3930. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  3931. +- struct ath_vif *avp = (void *)vif->drv_priv;
  3932. +- struct ath_beacon_config *cur_conf = &avp->chanctx->beacon;
  3933. + s64 tsfadjust;
  3934. ++ int slot;
  3935. +
  3936. +- if (avp->av_bslot == 0)
  3937. +- return;
  3938. ++ for (slot = 0; slot < ATH_BCBUF; slot++) {
  3939. ++ struct ath_vif *avp;
  3940. +
  3941. +- /* tsf_adjust is added to the TSF value. We send out the beacon late,
  3942. +- * so need to adjust the TSF starting point to be later in time (i.e.
  3943. +- * the theoretical first beacon has a TSF of 0 after correction).
  3944. +- */
  3945. +- tsfadjust = cur_conf->beacon_interval * avp->av_bslot;
  3946. +- tsfadjust = -TU_TO_USEC(tsfadjust) / ATH_BCBUF;
  3947. +- avp->tsf_adjust = cpu_to_le64(tsfadjust);
  3948. ++ if (!sc->beacon.bslot[slot])
  3949. ++ continue;
  3950. +
  3951. +- ath_dbg(common, CONFIG, "tsfadjust is: %lld for bslot: %d\n",
  3952. +- (signed long long)tsfadjust, avp->av_bslot);
  3953. ++ avp = (void *)sc->beacon.bslot[slot]->drv_priv;
  3954. ++
  3955. ++ /* tsf_adjust is added to the TSF value. We send out the
  3956. ++ * beacon late, so need to adjust the TSF starting point to be
  3957. ++ * later in time (i.e. the theoretical first beacon has a TSF
  3958. ++ * of 0 after correction).
  3959. ++ */
  3960. ++ tsfadjust = cur_conf->beacon_interval * avp->av_bslot;
  3961. ++ tsfadjust = -TU_TO_USEC(tsfadjust) / ATH_BCBUF;
  3962. ++ avp->tsf_adjust = cpu_to_le64(tsfadjust);
  3963. ++
  3964. ++ ath_dbg(common, CONFIG, "tsfadjust is: %lld for bslot: %d\n",
  3965. ++ (signed long long)tsfadjust, avp->av_bslot);
  3966. ++ }
  3967. + }
  3968. +
  3969. + bool ath9k_csa_is_finished(struct ath_softc *sc, struct ieee80211_vif *vif)
  3970. +@@ -447,20 +511,28 @@ void ath9k_beacon_tasklet(unsigned long
  3971. + * Both nexttbtt and intval have to be in usecs.
  3972. + */
  3973. + static void ath9k_beacon_init(struct ath_softc *sc, u32 nexttbtt,
  3974. +- u32 intval, bool reset_tsf)
  3975. ++ u32 intval)
  3976. + {
  3977. + struct ath_hw *ah = sc->sc_ah;
  3978. +
  3979. + ath9k_hw_disable_interrupts(ah);
  3980. +- if (reset_tsf)
  3981. +- ath9k_hw_reset_tsf(ah);
  3982. + ath9k_beaconq_config(sc);
  3983. + ath9k_hw_beaconinit(ah, nexttbtt, intval);
  3984. ++ ah->imask |= ATH9K_INT_SWBA;
  3985. + sc->beacon.bmisscnt = 0;
  3986. + ath9k_hw_set_interrupts(ah);
  3987. + ath9k_hw_enable_interrupts(ah);
  3988. + }
  3989. +
  3990. ++static void ath9k_beacon_stop(struct ath_softc *sc)
  3991. ++{
  3992. ++ ath9k_hw_disable_interrupts(sc->sc_ah);
  3993. ++ sc->sc_ah->imask &= ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS);
  3994. ++ sc->beacon.bmisscnt = 0;
  3995. ++ ath9k_hw_set_interrupts(sc->sc_ah);
  3996. ++ ath9k_hw_enable_interrupts(sc->sc_ah);
  3997. ++}
  3998. ++
  3999. + /*
  4000. + * For multi-bss ap support beacons are either staggered evenly over N slots or
  4001. + * burst together. For the former arrange for the SWBA to be delivered for each
  4002. +@@ -472,7 +544,7 @@ static void ath9k_beacon_config_ap(struc
  4003. + struct ath_hw *ah = sc->sc_ah;
  4004. +
  4005. + ath9k_cmn_beacon_config_ap(ah, conf, ATH_BCBUF);
  4006. +- ath9k_beacon_init(sc, conf->nexttbtt, conf->intval, false);
  4007. ++ ath9k_beacon_init(sc, conf->nexttbtt, conf->intval);
  4008. + }
  4009. +
  4010. + static void ath9k_beacon_config_sta(struct ath_hw *ah,
  4011. +@@ -501,7 +573,7 @@ static void ath9k_beacon_config_adhoc(st
  4012. +
  4013. + ath9k_cmn_beacon_config_adhoc(ah, conf);
  4014. +
  4015. +- ath9k_beacon_init(sc, conf->nexttbtt, conf->intval, conf->ibss_creator);
  4016. ++ ath9k_beacon_init(sc, conf->nexttbtt, conf->intval);
  4017. +
  4018. + /*
  4019. + * Set the global 'beacon has been configured' flag for the
  4020. +@@ -511,44 +583,6 @@ static void ath9k_beacon_config_adhoc(st
  4021. + set_bit(ATH_OP_BEACONS, &common->op_flags);
  4022. + }
  4023. +
  4024. +-static bool ath9k_allow_beacon_config(struct ath_softc *sc,
  4025. +- struct ieee80211_vif *vif)
  4026. +-{
  4027. +- struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  4028. +- struct ath_vif *avp = (void *)vif->drv_priv;
  4029. +-
  4030. +- if (ath9k_is_chanctx_enabled()) {
  4031. +- /*
  4032. +- * If the VIF is not present in the current channel context,
  4033. +- * then we can't do the usual opmode checks. Allow the
  4034. +- * beacon config for the VIF to be updated in this case and
  4035. +- * return immediately.
  4036. +- */
  4037. +- if (sc->cur_chan != avp->chanctx)
  4038. +- return true;
  4039. +- }
  4040. +-
  4041. +- if (sc->sc_ah->opmode == NL80211_IFTYPE_AP) {
  4042. +- if (vif->type != NL80211_IFTYPE_AP) {
  4043. +- ath_dbg(common, CONFIG,
  4044. +- "An AP interface is already present !\n");
  4045. +- return false;
  4046. +- }
  4047. +- }
  4048. +-
  4049. +- if (sc->sc_ah->opmode == NL80211_IFTYPE_STATION) {
  4050. +- if ((vif->type == NL80211_IFTYPE_STATION) &&
  4051. +- test_bit(ATH_OP_BEACONS, &common->op_flags) &&
  4052. +- vif != sc->cur_chan->primary_sta) {
  4053. +- ath_dbg(common, CONFIG,
  4054. +- "Beacon already configured for a station interface\n");
  4055. +- return false;
  4056. +- }
  4057. +- }
  4058. +-
  4059. +- return true;
  4060. +-}
  4061. +-
  4062. + static void ath9k_cache_beacon_config(struct ath_softc *sc,
  4063. + struct ath_chanctx *ctx,
  4064. + struct ieee80211_bss_conf *bss_conf)
  4065. +@@ -584,87 +618,79 @@ static void ath9k_cache_beacon_config(st
  4066. + if (cur_conf->dtim_period == 0)
  4067. + cur_conf->dtim_period = 1;
  4068. +
  4069. ++ ath9k_set_tsfadjust(sc, cur_conf);
  4070. + }
  4071. +
  4072. +-void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif,
  4073. +- u32 changed)
  4074. ++void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *main_vif,
  4075. ++ bool beacons)
  4076. + {
  4077. +- struct ieee80211_bss_conf *bss_conf = &vif->bss_conf;
  4078. +- struct ath_hw *ah = sc->sc_ah;
  4079. +- struct ath_common *common = ath9k_hw_common(ah);
  4080. +- struct ath_vif *avp = (void *)vif->drv_priv;
  4081. +- struct ath_chanctx *ctx = avp->chanctx;
  4082. ++ struct ath_hw *ah = sc->sc_ah;
  4083. ++ struct ath_common *common = ath9k_hw_common(ah);
  4084. ++ struct ath_vif *avp;
  4085. ++ struct ath_chanctx *ctx;
  4086. + struct ath_beacon_config *cur_conf;
  4087. + unsigned long flags;
  4088. ++ bool enabled;
  4089. + bool skip_beacon = false;
  4090. +
  4091. +- if (!ctx)
  4092. ++ if (!beacons) {
  4093. ++ clear_bit(ATH_OP_BEACONS, &common->op_flags);
  4094. ++ ath9k_beacon_stop(sc);
  4095. + return;
  4096. ++ }
  4097. +
  4098. +- cur_conf = &avp->chanctx->beacon;
  4099. +- if (vif->type == NL80211_IFTYPE_AP)
  4100. +- ath9k_set_tsfadjust(sc, vif);
  4101. +-
  4102. +- if (!ath9k_allow_beacon_config(sc, vif))
  4103. ++ if (WARN_ON(!main_vif))
  4104. + return;
  4105. +
  4106. +- if (vif->type == NL80211_IFTYPE_STATION) {
  4107. +- ath9k_cache_beacon_config(sc, ctx, bss_conf);
  4108. +- if (ctx != sc->cur_chan)
  4109. +- return;
  4110. ++ avp = (void *)main_vif->drv_priv;
  4111. ++ ctx = avp->chanctx;
  4112. ++ cur_conf = &ctx->beacon;
  4113. ++ enabled = cur_conf->enable_beacon;
  4114. ++ cur_conf->enable_beacon = beacons;
  4115. ++
  4116. ++ if (sc->sc_ah->opmode == NL80211_IFTYPE_STATION) {
  4117. ++ ath9k_cache_beacon_config(sc, ctx, &main_vif->bss_conf);
  4118. +
  4119. + ath9k_set_beacon(sc);
  4120. + set_bit(ATH_OP_BEACONS, &common->op_flags);
  4121. + return;
  4122. + }
  4123. +
  4124. +- /*
  4125. +- * Take care of multiple interfaces when
  4126. +- * enabling/disabling SWBA.
  4127. +- */
  4128. +- if (changed & BSS_CHANGED_BEACON_ENABLED) {
  4129. +- bool enabled = cur_conf->enable_beacon;
  4130. +-
  4131. +- if (!bss_conf->enable_beacon) {
  4132. +- cur_conf->enable_beacon &= ~BIT(avp->av_bslot);
  4133. +- } else {
  4134. +- cur_conf->enable_beacon |= BIT(avp->av_bslot);
  4135. +- if (!enabled)
  4136. +- ath9k_cache_beacon_config(sc, ctx, bss_conf);
  4137. +- }
  4138. +- }
  4139. +-
  4140. +- if (ctx != sc->cur_chan)
  4141. +- return;
  4142. ++ /* Update the beacon configuration. */
  4143. ++ ath9k_cache_beacon_config(sc, ctx, &main_vif->bss_conf);
  4144. +
  4145. + /*
  4146. + * Configure the HW beacon registers only when we have a valid
  4147. + * beacon interval.
  4148. + */
  4149. + if (cur_conf->beacon_interval) {
  4150. +- /*
  4151. +- * If we are joining an existing IBSS network, start beaconing
  4152. +- * only after a TSF-sync has taken place. Ensure that this
  4153. +- * happens by setting the appropriate flags.
  4154. ++ /* Special case to sync the TSF when joining an existing IBSS.
  4155. ++ * This is only done if no AP interface is active.
  4156. ++ * Note that mac80211 always resets the TSF when creating a new
  4157. ++ * IBSS interface.
  4158. + */
  4159. +- if ((changed & BSS_CHANGED_IBSS) && !bss_conf->ibss_creator &&
  4160. +- bss_conf->enable_beacon) {
  4161. ++ if (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC &&
  4162. ++ !enabled && beacons && !main_vif->bss_conf.ibss_creator) {
  4163. + spin_lock_irqsave(&sc->sc_pm_lock, flags);
  4164. + sc->ps_flags |= PS_BEACON_SYNC | PS_WAIT_FOR_BEACON;
  4165. + spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
  4166. + skip_beacon = true;
  4167. +- } else {
  4168. +- ath9k_set_beacon(sc);
  4169. + }
  4170. +
  4171. + /*
  4172. + * Do not set the ATH_OP_BEACONS flag for IBSS joiner mode
  4173. + * here, it is done in ath9k_beacon_config_adhoc().
  4174. + */
  4175. +- if (cur_conf->enable_beacon && !skip_beacon)
  4176. ++ if (beacons && !skip_beacon) {
  4177. + set_bit(ATH_OP_BEACONS, &common->op_flags);
  4178. +- else
  4179. ++ ath9k_set_beacon(sc);
  4180. ++ } else {
  4181. + clear_bit(ATH_OP_BEACONS, &common->op_flags);
  4182. ++ ath9k_beacon_stop(sc);
  4183. ++ }
  4184. ++ } else {
  4185. ++ clear_bit(ATH_OP_BEACONS, &common->op_flags);
  4186. ++ ath9k_beacon_stop(sc);
  4187. + }
  4188. + }
  4189. +
  4190. +--- a/drivers/net/wireless/ath/ath9k/common.h
  4191. ++++ b/drivers/net/wireless/ath/ath9k/common.h
  4192. +@@ -50,6 +50,7 @@
  4193. + #define IEEE80211_MS_TO_TU(x) (((x) * 1000) / 1024)
  4194. +
  4195. + struct ath_beacon_config {
  4196. ++ struct ieee80211_vif *main_vif;
  4197. + int beacon_interval;
  4198. + u16 dtim_period;
  4199. + u16 bmiss_timeout;
  4200. +--- a/drivers/net/wireless/ath/ath9k/main.c
  4201. ++++ b/drivers/net/wireless/ath/ath9k/main.c
  4202. +@@ -910,6 +910,22 @@ static bool ath9k_uses_beacons(int type)
  4203. + }
  4204. + }
  4205. +
  4206. ++static void ath9k_vif_iter_set_beacon(struct ath9k_vif_iter_data *iter_data,
  4207. ++ struct ieee80211_vif *vif)
  4208. ++{
  4209. ++ /* Use the first (configured) interface, but prefering AP interfaces. */
  4210. ++ if (!iter_data->primary_beacon_vif) {
  4211. ++ iter_data->primary_beacon_vif = vif;
  4212. ++ } else {
  4213. ++ if (iter_data->primary_beacon_vif->type != NL80211_IFTYPE_AP &&
  4214. ++ vif->type == NL80211_IFTYPE_AP)
  4215. ++ iter_data->primary_beacon_vif = vif;
  4216. ++ }
  4217. ++
  4218. ++ iter_data->beacons = true;
  4219. ++ iter_data->nbcnvifs += 1;
  4220. ++}
  4221. ++
  4222. + static void ath9k_vif_iter(struct ath9k_vif_iter_data *iter_data,
  4223. + u8 *mac, struct ieee80211_vif *vif)
  4224. + {
  4225. +@@ -931,6 +947,8 @@ static void ath9k_vif_iter(struct ath9k_
  4226. + switch (vif->type) {
  4227. + case NL80211_IFTYPE_AP:
  4228. + iter_data->naps++;
  4229. ++ if (vif->bss_conf.enable_beacon)
  4230. ++ ath9k_vif_iter_set_beacon(iter_data, vif);
  4231. + break;
  4232. + case NL80211_IFTYPE_STATION:
  4233. + iter_data->nstations++;
  4234. +@@ -943,12 +961,12 @@ static void ath9k_vif_iter(struct ath9k_
  4235. + case NL80211_IFTYPE_ADHOC:
  4236. + iter_data->nadhocs++;
  4237. + if (vif->bss_conf.enable_beacon)
  4238. +- iter_data->beacons = true;
  4239. ++ ath9k_vif_iter_set_beacon(iter_data, vif);
  4240. + break;
  4241. + case NL80211_IFTYPE_MESH_POINT:
  4242. + iter_data->nmeshes++;
  4243. + if (vif->bss_conf.enable_beacon)
  4244. +- iter_data->beacons = true;
  4245. ++ ath9k_vif_iter_set_beacon(iter_data, vif);
  4246. + break;
  4247. + case NL80211_IFTYPE_WDS:
  4248. + iter_data->nwds++;
  4249. +@@ -1081,7 +1099,6 @@ void ath9k_calculate_summary_state(struc
  4250. + struct ath_hw *ah = sc->sc_ah;
  4251. + struct ath_common *common = ath9k_hw_common(ah);
  4252. + struct ath9k_vif_iter_data iter_data;
  4253. +- struct ath_beacon_config *cur_conf;
  4254. +
  4255. + ath_chanctx_check_active(sc, ctx);
  4256. +
  4257. +@@ -1103,13 +1120,12 @@ void ath9k_calculate_summary_state(struc
  4258. + ath_hw_setbssidmask(common);
  4259. +
  4260. + if (iter_data.naps > 0) {
  4261. +- cur_conf = &ctx->beacon;
  4262. + ath9k_hw_set_tsfadjust(ah, true);
  4263. + ah->opmode = NL80211_IFTYPE_AP;
  4264. +- if (cur_conf->enable_beacon)
  4265. +- iter_data.beacons = true;
  4266. + } else {
  4267. + ath9k_hw_set_tsfadjust(ah, false);
  4268. ++ if (iter_data.beacons)
  4269. ++ ath9k_beacon_ensure_primary_slot(sc);
  4270. +
  4271. + if (iter_data.nmeshes)
  4272. + ah->opmode = NL80211_IFTYPE_MESH_POINT;
  4273. +@@ -1134,7 +1150,6 @@ void ath9k_calculate_summary_state(struc
  4274. + ctx->switch_after_beacon = true;
  4275. + }
  4276. +
  4277. +- ah->imask &= ~ATH9K_INT_SWBA;
  4278. + if (ah->opmode == NL80211_IFTYPE_STATION) {
  4279. + bool changed = (iter_data.primary_sta != ctx->primary_sta);
  4280. +
  4281. +@@ -1151,16 +1166,12 @@ void ath9k_calculate_summary_state(struc
  4282. + if (ath9k_hw_mci_is_enabled(sc->sc_ah))
  4283. + ath9k_mci_update_wlan_channels(sc, true);
  4284. + }
  4285. +- } else if (iter_data.beacons) {
  4286. +- ah->imask |= ATH9K_INT_SWBA;
  4287. + }
  4288. ++ sc->nbcnvifs = iter_data.nbcnvifs;
  4289. ++ ath9k_beacon_config(sc, iter_data.primary_beacon_vif,
  4290. ++ iter_data.beacons);
  4291. + ath9k_hw_set_interrupts(ah);
  4292. +
  4293. +- if (iter_data.beacons)
  4294. +- set_bit(ATH_OP_BEACONS, &common->op_flags);
  4295. +- else
  4296. +- clear_bit(ATH_OP_BEACONS, &common->op_flags);
  4297. +-
  4298. + if (ah->slottime != iter_data.slottime) {
  4299. + ah->slottime = iter_data.slottime;
  4300. + ath9k_hw_init_global_settings(ah);
  4301. +@@ -1777,9 +1788,7 @@ static void ath9k_bss_info_changed(struc
  4302. + if ((changed & BSS_CHANGED_BEACON_ENABLED) ||
  4303. + (changed & BSS_CHANGED_BEACON_INT) ||
  4304. + (changed & BSS_CHANGED_BEACON_INFO)) {
  4305. +- ath9k_beacon_config(sc, vif, changed);
  4306. +- if (changed & BSS_CHANGED_BEACON_ENABLED)
  4307. +- ath9k_calculate_summary_state(sc, avp->chanctx);
  4308. ++ ath9k_calculate_summary_state(sc, avp->chanctx);
  4309. + }
  4310. +
  4311. + if ((avp->chanctx == sc->cur_chan) &&
  4312. 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
  4313. deleted file mode 100644
  4314. index 5bf53b9..0000000
  4315. --- a/package/kernel/mac80211/patches/317-mac80211-minstrel_ht-fix-out-of-bound-in-minstrel_ht.patch
  4316. +++ /dev/null
  4317. @@ -1,45 +0,0 @@
  4318. -From: Konstantin Khlebnikov <koct9i@gmail.com>
  4319. -Date: Fri, 29 Jan 2016 11:35:12 +0300
  4320. -Subject: [PATCH] mac80211: minstrel_ht: fix out-of-bound in
  4321. - minstrel_ht_set_best_prob_rate
  4322. -
  4323. -Patch fixes this splat
  4324. -
  4325. -BUG: KASAN: slab-out-of-bounds in minstrel_ht_update_stats.isra.7+0x6e1/0x9e0
  4326. -[mac80211] at addr ffff8800cee640f4 Read of size 4 by task swapper/3/0
  4327. -
  4328. -Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>
  4329. -Link: http://lkml.kernel.org/r/CALYGNiNyJhSaVnE35qS6UCGaSb2Dx1_i5HcRavuOX14oTz2P+w@mail.gmail.com
  4330. ----
  4331. -
  4332. ---- a/net/mac80211/rc80211_minstrel_ht.c
  4333. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  4334. -@@ -414,15 +414,16 @@ minstrel_ht_set_best_prob_rate(struct mi
  4335. - (max_tp_group != MINSTREL_CCK_GROUP))
  4336. - return;
  4337. -
  4338. -+ max_gpr_group = mg->max_group_prob_rate / MCS_GROUP_RATES;
  4339. -+ max_gpr_idx = mg->max_group_prob_rate % MCS_GROUP_RATES;
  4340. -+ max_gpr_prob = mi->groups[max_gpr_group].rates[max_gpr_idx].prob_ewma;
  4341. -+
  4342. - if (mrs->prob_ewma > MINSTREL_FRAC(75, 100)) {
  4343. - cur_tp_avg = minstrel_ht_get_tp_avg(mi, cur_group, cur_idx,
  4344. - mrs->prob_ewma);
  4345. - if (cur_tp_avg > tmp_tp_avg)
  4346. - mi->max_prob_rate = index;
  4347. -
  4348. -- max_gpr_group = mg->max_group_prob_rate / MCS_GROUP_RATES;
  4349. -- max_gpr_idx = mg->max_group_prob_rate % MCS_GROUP_RATES;
  4350. -- max_gpr_prob = mi->groups[max_gpr_group].rates[max_gpr_idx].prob_ewma;
  4351. - max_gpr_tp_avg = minstrel_ht_get_tp_avg(mi, max_gpr_group,
  4352. - max_gpr_idx,
  4353. - max_gpr_prob);
  4354. -@@ -431,7 +432,7 @@ minstrel_ht_set_best_prob_rate(struct mi
  4355. - } else {
  4356. - if (mrs->prob_ewma > tmp_prob)
  4357. - mi->max_prob_rate = index;
  4358. -- if (mrs->prob_ewma > mg->rates[mg->max_group_prob_rate].prob_ewma)
  4359. -+ if (mrs->prob_ewma > max_gpr_prob)
  4360. - mg->max_group_prob_rate = index;
  4361. - }
  4362. - }
  4363. 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
  4364. new file mode 100644
  4365. index 0000000..d946ecc
  4366. --- /dev/null
  4367. +++ b/package/kernel/mac80211/patches/318-brcmfmac-slightly-simplify-building-interface-combin.patch
  4368. @@ -0,0 +1,108 @@
  4369. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4370. +Date: Tue, 7 Jun 2016 21:10:18 +0200
  4371. +Subject: [PATCH] brcmfmac: slightly simplify building interface combinations
  4372. +MIME-Version: 1.0
  4373. +Content-Type: text/plain; charset=UTF-8
  4374. +Content-Transfer-Encoding: 8bit
  4375. +
  4376. +This change reorders some operations in brcmf_setup_ifmodes in hope to
  4377. +make it simpler:
  4378. +1) It allocates arrays right before filling them. This way it's easier
  4379. + to follow requested array length as it's immediately followed by
  4380. + code filling it. It's easier to check e.g. why we need 4 entries for
  4381. + P2P. Other than that it deduplicates some checks (e.g. for P2P).
  4382. +2) It reorders code to first prepare limits and then define a new combo.
  4383. + Previously this was mixed (e.g. we were setting num of channels
  4384. + before preparing limits).
  4385. +3) It modifies mbss code to use i variable just like other combos do.
  4386. +
  4387. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4388. +Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  4389. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4390. +---
  4391. +
  4392. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  4393. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  4394. +@@ -6284,29 +6284,15 @@ static int brcmf_setup_ifmodes(struct wi
  4395. + if (!combo)
  4396. + goto err;
  4397. +
  4398. +- c0_limits = kcalloc(p2p ? 3 : 2, sizeof(*c0_limits), GFP_KERNEL);
  4399. +- if (!c0_limits)
  4400. +- goto err;
  4401. +-
  4402. +- if (p2p) {
  4403. +- p2p_limits = kcalloc(4, sizeof(*p2p_limits), GFP_KERNEL);
  4404. +- if (!p2p_limits)
  4405. +- goto err;
  4406. +- }
  4407. +-
  4408. +- if (mbss) {
  4409. +- mbss_limits = kcalloc(1, sizeof(*mbss_limits), GFP_KERNEL);
  4410. +- if (!mbss_limits)
  4411. +- goto err;
  4412. +- }
  4413. +-
  4414. + wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
  4415. + BIT(NL80211_IFTYPE_ADHOC) |
  4416. + BIT(NL80211_IFTYPE_AP);
  4417. +
  4418. + c = 0;
  4419. + i = 0;
  4420. +- combo[c].num_different_channels = 1;
  4421. ++ c0_limits = kcalloc(p2p ? 3 : 2, sizeof(*c0_limits), GFP_KERNEL);
  4422. ++ if (!c0_limits)
  4423. ++ goto err;
  4424. + c0_limits[i].max = 1;
  4425. + c0_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  4426. + if (p2p) {
  4427. +@@ -6324,6 +6310,7 @@ static int brcmf_setup_ifmodes(struct wi
  4428. + c0_limits[i].max = 1;
  4429. + c0_limits[i++].types = BIT(NL80211_IFTYPE_AP);
  4430. + }
  4431. ++ combo[c].num_different_channels = 1;
  4432. + combo[c].max_interfaces = i;
  4433. + combo[c].n_limits = i;
  4434. + combo[c].limits = c0_limits;
  4435. +@@ -6331,7 +6318,9 @@ static int brcmf_setup_ifmodes(struct wi
  4436. + if (p2p) {
  4437. + c++;
  4438. + i = 0;
  4439. +- combo[c].num_different_channels = 1;
  4440. ++ p2p_limits = kcalloc(4, sizeof(*p2p_limits), GFP_KERNEL);
  4441. ++ if (!p2p_limits)
  4442. ++ goto err;
  4443. + p2p_limits[i].max = 1;
  4444. + p2p_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  4445. + p2p_limits[i].max = 1;
  4446. +@@ -6340,6 +6329,7 @@ static int brcmf_setup_ifmodes(struct wi
  4447. + p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT);
  4448. + p2p_limits[i].max = 1;
  4449. + p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  4450. ++ combo[c].num_different_channels = 1;
  4451. + combo[c].max_interfaces = i;
  4452. + combo[c].n_limits = i;
  4453. + combo[c].limits = p2p_limits;
  4454. +@@ -6347,14 +6337,19 @@ static int brcmf_setup_ifmodes(struct wi
  4455. +
  4456. + if (mbss) {
  4457. + c++;
  4458. ++ i = 0;
  4459. ++ mbss_limits = kcalloc(1, sizeof(*mbss_limits), GFP_KERNEL);
  4460. ++ if (!mbss_limits)
  4461. ++ goto err;
  4462. ++ mbss_limits[i].max = 4;
  4463. ++ mbss_limits[i++].types = BIT(NL80211_IFTYPE_AP);
  4464. + combo[c].beacon_int_infra_match = true;
  4465. + combo[c].num_different_channels = 1;
  4466. +- mbss_limits[0].max = 4;
  4467. +- mbss_limits[0].types = BIT(NL80211_IFTYPE_AP);
  4468. + combo[c].max_interfaces = 4;
  4469. +- combo[c].n_limits = 1;
  4470. ++ combo[c].n_limits = i;
  4471. + combo[c].limits = mbss_limits;
  4472. + }
  4473. ++
  4474. + wiphy->n_iface_combinations = n_combos;
  4475. + wiphy->iface_combinations = combo;
  4476. + return 0;
  4477. 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
  4478. deleted file mode 100644
  4479. index 655dc4b..0000000
  4480. --- a/package/kernel/mac80211/patches/318-mac80211-move-A-MSDU-skb_linearize-call-to-ieee80211.patch
  4481. +++ /dev/null
  4482. @@ -1,35 +0,0 @@
  4483. -From: Felix Fietkau <nbd@openwrt.org>
  4484. -Date: Tue, 2 Feb 2016 14:39:08 +0100
  4485. -Subject: [PATCH] mac80211: move A-MSDU skb_linearize call to
  4486. - ieee80211_amsdu_to_8023s
  4487. -
  4488. -Prepararation for zero-copy A-MSDU support with page fragment SKBs
  4489. -
  4490. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  4491. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  4492. ----
  4493. -
  4494. ---- a/net/mac80211/rx.c
  4495. -+++ b/net/mac80211/rx.c
  4496. -@@ -2203,9 +2203,6 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx
  4497. - skb->dev = dev;
  4498. - __skb_queue_head_init(&frame_list);
  4499. -
  4500. -- if (skb_linearize(skb))
  4501. -- return RX_DROP_UNUSABLE;
  4502. --
  4503. - ieee80211_amsdu_to_8023s(skb, &frame_list, dev->dev_addr,
  4504. - rx->sdata->vif.type,
  4505. - rx->local->hw.extra_tx_headroom, true);
  4506. ---- a/net/wireless/util.c
  4507. -+++ b/net/wireless/util.c
  4508. -@@ -657,6 +657,9 @@ void ieee80211_amsdu_to_8023s(struct sk_
  4509. - int remaining, err;
  4510. - u8 dst[ETH_ALEN], src[ETH_ALEN];
  4511. -
  4512. -+ if (skb_linearize(skb))
  4513. -+ goto out;
  4514. -+
  4515. - if (has_80211_header) {
  4516. - err = ieee80211_data_to_8023(skb, addr, iftype);
  4517. - if (err)
  4518. 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
  4519. new file mode 100644
  4520. index 0000000..073d012
  4521. --- /dev/null
  4522. +++ b/package/kernel/mac80211/patches/319-0001-brcmfmac-fix-lockup-when-removing-P2P-interface-afte.patch
  4523. @@ -0,0 +1,154 @@
  4524. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4525. +Date: Fri, 17 Jun 2016 12:29:21 +0200
  4526. +Subject: [PATCH] brcmfmac: fix lockup when removing P2P interface after
  4527. + event timeout
  4528. +MIME-Version: 1.0
  4529. +Content-Type: text/plain; charset=UTF-8
  4530. +Content-Transfer-Encoding: 8bit
  4531. +
  4532. +Removing P2P interface is handled by sending a proper request to the
  4533. +firmware. On success firmware triggers an event and driver's handler
  4534. +removes a matching interface.
  4535. +
  4536. +However on event timeout we remove interface directly from the cfg80211
  4537. +callback. Current code doesn't handle this case correctly as it always
  4538. +assumes rtnl to be unlocked.
  4539. +
  4540. +Fix it by adding an extra rtnl_locked parameter to functions and calling
  4541. +unregister_netdevice when needed.
  4542. +
  4543. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4544. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4545. +---
  4546. +
  4547. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  4548. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  4549. +@@ -548,12 +548,16 @@ fail:
  4550. + return -EBADE;
  4551. + }
  4552. +
  4553. +-static void brcmf_net_detach(struct net_device *ndev)
  4554. ++static void brcmf_net_detach(struct net_device *ndev, bool rtnl_locked)
  4555. + {
  4556. +- if (ndev->reg_state == NETREG_REGISTERED)
  4557. +- unregister_netdev(ndev);
  4558. +- else
  4559. ++ if (ndev->reg_state == NETREG_REGISTERED) {
  4560. ++ if (rtnl_locked)
  4561. ++ unregister_netdevice(ndev);
  4562. ++ else
  4563. ++ unregister_netdev(ndev);
  4564. ++ } else {
  4565. + brcmf_cfg80211_free_netdev(ndev);
  4566. ++ }
  4567. + }
  4568. +
  4569. + void brcmf_net_setcarrier(struct brcmf_if *ifp, bool on)
  4570. +@@ -651,7 +655,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  4571. + brcmf_err("ERROR: netdev:%s already exists\n",
  4572. + ifp->ndev->name);
  4573. + netif_stop_queue(ifp->ndev);
  4574. +- brcmf_net_detach(ifp->ndev);
  4575. ++ brcmf_net_detach(ifp->ndev, false);
  4576. + drvr->iflist[bsscfgidx] = NULL;
  4577. + } else {
  4578. + brcmf_dbg(INFO, "netdev:%s ignore IF event\n",
  4579. +@@ -699,7 +703,8 @@ struct brcmf_if *brcmf_add_if(struct brc
  4580. + return ifp;
  4581. + }
  4582. +
  4583. +-static void brcmf_del_if(struct brcmf_pub *drvr, s32 bsscfgidx)
  4584. ++static void brcmf_del_if(struct brcmf_pub *drvr, s32 bsscfgidx,
  4585. ++ bool rtnl_locked)
  4586. + {
  4587. + struct brcmf_if *ifp;
  4588. +
  4589. +@@ -729,7 +734,7 @@ static void brcmf_del_if(struct brcmf_pu
  4590. + cancel_work_sync(&ifp->multicast_work);
  4591. + cancel_work_sync(&ifp->ndoffload_work);
  4592. + }
  4593. +- brcmf_net_detach(ifp->ndev);
  4594. ++ brcmf_net_detach(ifp->ndev, rtnl_locked);
  4595. + } else {
  4596. + /* Only p2p device interfaces which get dynamically created
  4597. + * end up here. In this case the p2p module should be informed
  4598. +@@ -743,14 +748,14 @@ static void brcmf_del_if(struct brcmf_pu
  4599. + }
  4600. + }
  4601. +
  4602. +-void brcmf_remove_interface(struct brcmf_if *ifp)
  4603. ++void brcmf_remove_interface(struct brcmf_if *ifp, bool rtnl_locked)
  4604. + {
  4605. + if (!ifp || WARN_ON(ifp->drvr->iflist[ifp->bsscfgidx] != ifp))
  4606. + return;
  4607. + brcmf_dbg(TRACE, "Enter, bsscfgidx=%d, ifidx=%d\n", ifp->bsscfgidx,
  4608. + ifp->ifidx);
  4609. + brcmf_fws_del_interface(ifp);
  4610. +- brcmf_del_if(ifp->drvr, ifp->bsscfgidx);
  4611. ++ brcmf_del_if(ifp->drvr, ifp->bsscfgidx, rtnl_locked);
  4612. + }
  4613. +
  4614. + #ifdef CONFIG_INET
  4615. +@@ -1057,9 +1062,9 @@ fail:
  4616. + brcmf_fws_deinit(drvr);
  4617. + }
  4618. + if (ifp)
  4619. +- brcmf_net_detach(ifp->ndev);
  4620. ++ brcmf_net_detach(ifp->ndev, false);
  4621. + if (p2p_ifp)
  4622. +- brcmf_net_detach(p2p_ifp->ndev);
  4623. ++ brcmf_net_detach(p2p_ifp->ndev, false);
  4624. + drvr->iflist[0] = NULL;
  4625. + drvr->iflist[1] = NULL;
  4626. + if (drvr->settings->ignore_probe_fail)
  4627. +@@ -1128,7 +1133,7 @@ void brcmf_detach(struct device *dev)
  4628. +
  4629. + /* make sure primary interface removed last */
  4630. + for (i = BRCMF_MAX_IFS-1; i > -1; i--)
  4631. +- brcmf_remove_interface(drvr->iflist[i]);
  4632. ++ brcmf_remove_interface(drvr->iflist[i], false);
  4633. +
  4634. + brcmf_cfg80211_detach(drvr->config);
  4635. +
  4636. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  4637. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  4638. +@@ -216,7 +216,7 @@ struct brcmf_if *brcmf_get_ifp(struct br
  4639. + int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  4640. + struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
  4641. + bool is_p2pdev, char *name, u8 *mac_addr);
  4642. +-void brcmf_remove_interface(struct brcmf_if *ifp);
  4643. ++void brcmf_remove_interface(struct brcmf_if *ifp, bool rtnl_locked);
  4644. + void brcmf_txflowblock_if(struct brcmf_if *ifp,
  4645. + enum brcmf_netif_stop_reason reason, bool state);
  4646. + void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
  4647. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  4648. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  4649. +@@ -183,7 +183,7 @@ static void brcmf_fweh_handle_if_event(s
  4650. + err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data);
  4651. +
  4652. + if (ifp && ifevent->action == BRCMF_E_IF_DEL)
  4653. +- brcmf_remove_interface(ifp);
  4654. ++ brcmf_remove_interface(ifp, false);
  4655. + }
  4656. +
  4657. + /**
  4658. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  4659. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  4660. +@@ -2289,7 +2289,7 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  4661. + err = 0;
  4662. + }
  4663. + if (err)
  4664. +- brcmf_remove_interface(vif->ifp);
  4665. ++ brcmf_remove_interface(vif->ifp, true);
  4666. +
  4667. + brcmf_cfg80211_arm_vif_event(cfg, NULL);
  4668. + if (vif->wdev.iftype != NL80211_IFTYPE_P2P_DEVICE)
  4669. +@@ -2395,7 +2395,7 @@ void brcmf_p2p_detach(struct brcmf_p2p_i
  4670. + if (vif != NULL) {
  4671. + brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  4672. + brcmf_p2p_deinit_discovery(p2p);
  4673. +- brcmf_remove_interface(vif->ifp);
  4674. ++ brcmf_remove_interface(vif->ifp, false);
  4675. + }
  4676. + /* just set it all to zero */
  4677. + memset(p2p, 0, sizeof(*p2p));
  4678. 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
  4679. new file mode 100644
  4680. index 0000000..6d3f3c6
  4681. --- /dev/null
  4682. +++ b/package/kernel/mac80211/patches/319-0002-brcmfmac-use-const-char-for-interface-name-in-brcmf_.patch
  4683. @@ -0,0 +1,40 @@
  4684. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4685. +Date: Fri, 17 Jun 2016 12:48:44 +0200
  4686. +Subject: [PATCH] brcmfmac: use const char * for interface name in
  4687. + brcmf_add_if
  4688. +MIME-Version: 1.0
  4689. +Content-Type: text/plain; charset=UTF-8
  4690. +Content-Transfer-Encoding: 8bit
  4691. +
  4692. +This function can work just fine with const pointer, it only calls
  4693. +alloc_netdev which take const as well. Moreover it makes this function
  4694. +more flexible as some cfg80211 callback may provide const char * as
  4695. +well, e.g. add_virtual_intf. This will be needed for more advanced
  4696. +interface management.
  4697. +
  4698. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4699. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4700. +---
  4701. +
  4702. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  4703. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  4704. +@@ -638,7 +638,7 @@ fail:
  4705. + }
  4706. +
  4707. + struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
  4708. +- bool is_p2pdev, char *name, u8 *mac_addr)
  4709. ++ bool is_p2pdev, const char *name, u8 *mac_addr)
  4710. + {
  4711. + struct brcmf_if *ifp;
  4712. + struct net_device *ndev;
  4713. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  4714. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  4715. +@@ -215,7 +215,7 @@ char *brcmf_ifname(struct brcmf_if *ifp)
  4716. + struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx);
  4717. + int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  4718. + struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
  4719. +- bool is_p2pdev, char *name, u8 *mac_addr);
  4720. ++ bool is_p2pdev, const char *name, u8 *mac_addr);
  4721. + void brcmf_remove_interface(struct brcmf_if *ifp, bool rtnl_locked);
  4722. + void brcmf_txflowblock_if(struct brcmf_if *ifp,
  4723. + enum brcmf_netif_stop_reason reason, bool state);
  4724. 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
  4725. new file mode 100644
  4726. index 0000000..eeda766
  4727. --- /dev/null
  4728. +++ b/package/kernel/mac80211/patches/319-0003-brcmfmac-include-also-core.h-header-in-cfg80211.h.patch
  4729. @@ -0,0 +1,33 @@
  4730. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4731. +Date: Sat, 18 Jun 2016 18:49:38 +0200
  4732. +Subject: [PATCH] brcmfmac: include also core.h header in cfg80211.h
  4733. +MIME-Version: 1.0
  4734. +Content-Type: text/plain; charset=UTF-8
  4735. +Content-Transfer-Encoding: 8bit
  4736. +
  4737. +This header provides two inline functions using struct brcmf_if so we
  4738. +need core.h to avoid:
  4739. +
  4740. +drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h: In function ‘ndev_to_prof’:
  4741. +drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h:368:13: error: dereferencing pointer to incomplete type
  4742. + return &ifp->vif->profile;
  4743. + ^
  4744. +drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h: In function ‘ndev_to_vif’:
  4745. +drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h:374:12: error: dereferencing pointer to incomplete type
  4746. + return ifp->vif;
  4747. + ^
  4748. +
  4749. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4750. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4751. +---
  4752. +
  4753. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  4754. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  4755. +@@ -20,6 +20,7 @@
  4756. + /* for brcmu_d11inf */
  4757. + #include <brcmu_d11.h>
  4758. +
  4759. ++#include "core.h"
  4760. + #include "fwil_types.h"
  4761. + #include "p2p.h"
  4762. +
  4763. 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
  4764. new file mode 100644
  4765. index 0000000..3819248
  4766. --- /dev/null
  4767. +++ b/package/kernel/mac80211/patches/319-0004-brcmfmac-add-missing-break-when-deleting-P2P_DEVICE.patch
  4768. @@ -0,0 +1,27 @@
  4769. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4770. +Date: Sun, 19 Jun 2016 01:55:57 +0200
  4771. +Subject: [PATCH] brcmfmac: add missing break when deleting P2P_DEVICE
  4772. +MIME-Version: 1.0
  4773. +Content-Type: text/plain; charset=UTF-8
  4774. +Content-Transfer-Encoding: 8bit
  4775. +
  4776. +We obviously don't want to fall through in that switch. With this change
  4777. +1) We wait for event (triggered by p2p_disc) as expected
  4778. +2) We remove interface manually on timeout
  4779. +3) We return 0 on success instead of -ENOTSUPP
  4780. +
  4781. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4782. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4783. +---
  4784. +
  4785. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  4786. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  4787. +@@ -2263,6 +2263,8 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  4788. + return 0;
  4789. + brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  4790. + brcmf_p2p_deinit_discovery(p2p);
  4791. ++ break;
  4792. ++
  4793. + default:
  4794. + return -ENOTSUPP;
  4795. + }
  4796. 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
  4797. new file mode 100644
  4798. index 0000000..12d7eb4
  4799. --- /dev/null
  4800. +++ b/package/kernel/mac80211/patches/319-0005-brcmfmac-delete-interface-directly-in-code-that-sent.patch
  4801. @@ -0,0 +1,75 @@
  4802. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4803. +Date: Wed, 29 Jun 2016 21:54:26 +0200
  4804. +Subject: [PATCH] brcmfmac: delete interface directly in code that sent fw
  4805. + request
  4806. +MIME-Version: 1.0
  4807. +Content-Type: text/plain; charset=UTF-8
  4808. +Content-Transfer-Encoding: 8bit
  4809. +
  4810. +So far when receiving event about in-firmware-interface removal our
  4811. +event worker was notifying listener and afterwards it was removing Linux
  4812. +interface.
  4813. +
  4814. +First of all it was resulting in slightly unexpected order. The listener
  4815. +(del_virtual_intf callback) was (usually) returning with success before
  4816. +we even called unregister_netdev(ice).
  4817. +
  4818. +Please note this couldn't be simply fixed by changing order of calls in
  4819. +brcmf_fweh_handle_if_event as unregistering interface earlier could free
  4820. +struct brcmf_if.
  4821. +
  4822. +Another problem of current implementation are possible lockups. Focus on
  4823. +the time slot between calling event handler and removing Linux
  4824. +interface. During that time original caller may leave (unlocking rtnl
  4825. +semaphore) *and* another call to the same code may be done (locking it
  4826. +again). If that happens our event handler will stuck at removing Linux
  4827. +interface, it won't handle another event and will block process holding
  4828. +rtnl lock.
  4829. +
  4830. +This can be simply solved by unregistering interface in a proper
  4831. +callback, right after receiving confirmation event from firmware. This
  4832. +only required modifying worker to don't unregister on its own if there
  4833. +is someone waiting for the event.
  4834. +
  4835. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4836. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4837. +---
  4838. +
  4839. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  4840. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  4841. +@@ -18,6 +18,7 @@
  4842. + #include "brcmu_wifi.h"
  4843. + #include "brcmu_utils.h"
  4844. +
  4845. ++#include "cfg80211.h"
  4846. + #include "core.h"
  4847. + #include "debug.h"
  4848. + #include "tracepoint.h"
  4849. +@@ -182,8 +183,13 @@ static void brcmf_fweh_handle_if_event(s
  4850. +
  4851. + err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data);
  4852. +
  4853. +- if (ifp && ifevent->action == BRCMF_E_IF_DEL)
  4854. +- brcmf_remove_interface(ifp, false);
  4855. ++ if (ifp && ifevent->action == BRCMF_E_IF_DEL) {
  4856. ++ bool armed = brcmf_cfg80211_vif_event_armed(drvr->config);
  4857. ++
  4858. ++ /* Default handling in case no-one waits for this event */
  4859. ++ if (!armed)
  4860. ++ brcmf_remove_interface(ifp, false);
  4861. ++ }
  4862. + }
  4863. +
  4864. + /**
  4865. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  4866. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  4867. +@@ -2290,8 +2290,7 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  4868. + else
  4869. + err = 0;
  4870. + }
  4871. +- if (err)
  4872. +- brcmf_remove_interface(vif->ifp, true);
  4873. ++ brcmf_remove_interface(vif->ifp, true);
  4874. +
  4875. + brcmf_cfg80211_arm_vif_event(cfg, NULL);
  4876. + if (vif->wdev.iftype != NL80211_IFTYPE_P2P_DEVICE)
  4877. 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
  4878. new file mode 100644
  4879. index 0000000..2f7165e
  4880. --- /dev/null
  4881. +++ b/package/kernel/mac80211/patches/319-0006-brcmfmac-support-removing-AP-interfaces-with-interfa.patch
  4882. @@ -0,0 +1,84 @@
  4883. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4884. +Date: Wed, 29 Jun 2016 21:54:27 +0200
  4885. +Subject: [PATCH] brcmfmac: support removing AP interfaces with
  4886. + "interface_remove"
  4887. +MIME-Version: 1.0
  4888. +Content-Type: text/plain; charset=UTF-8
  4889. +Content-Transfer-Encoding: 8bit
  4890. +
  4891. +New firmwares (e.g. 10.10.69.36 for BCM4366) support "interface_remove"
  4892. +for removing interfaces. Try to use this method on cfg80211 request. In
  4893. +case of older firmwares (e.g. 7.35.177.56 for BCM43602 as I tested) this
  4894. +will just result in firmware rejecting command and this won't change any
  4895. +behavior.
  4896. +
  4897. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4898. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4899. +---
  4900. +
  4901. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  4902. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  4903. +@@ -785,12 +785,48 @@ s32 brcmf_notify_escan_complete(struct b
  4904. + return err;
  4905. + }
  4906. +
  4907. ++static int brcmf_cfg80211_del_ap_iface(struct wiphy *wiphy,
  4908. ++ struct wireless_dev *wdev)
  4909. ++{
  4910. ++ struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy);
  4911. ++ struct net_device *ndev = wdev->netdev;
  4912. ++ struct brcmf_if *ifp = netdev_priv(ndev);
  4913. ++ int ret;
  4914. ++ int err;
  4915. ++
  4916. ++ brcmf_cfg80211_arm_vif_event(cfg, ifp->vif);
  4917. ++
  4918. ++ err = brcmf_fil_bsscfg_data_set(ifp, "interface_remove", NULL, 0);
  4919. ++ if (err) {
  4920. ++ brcmf_err("interface_remove failed %d\n", err);
  4921. ++ goto err_unarm;
  4922. ++ }
  4923. ++
  4924. ++ /* wait for firmware event */
  4925. ++ ret = brcmf_cfg80211_wait_vif_event(cfg, BRCMF_E_IF_DEL,
  4926. ++ BRCMF_VIF_EVENT_TIMEOUT);
  4927. ++ if (!ret) {
  4928. ++ brcmf_err("timeout occurred\n");
  4929. ++ err = -EIO;
  4930. ++ goto err_unarm;
  4931. ++ }
  4932. ++
  4933. ++ brcmf_remove_interface(ifp, true);
  4934. ++
  4935. ++err_unarm:
  4936. ++ brcmf_cfg80211_arm_vif_event(cfg, NULL);
  4937. ++ return err;
  4938. ++}
  4939. ++
  4940. + static
  4941. + int brcmf_cfg80211_del_iface(struct wiphy *wiphy, struct wireless_dev *wdev)
  4942. + {
  4943. + struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy);
  4944. + struct net_device *ndev = wdev->netdev;
  4945. +
  4946. ++ if (ndev && ndev == cfg_to_ndev(cfg))
  4947. ++ return -ENOTSUPP;
  4948. ++
  4949. + /* vif event pending in firmware */
  4950. + if (brcmf_cfg80211_vif_event_armed(cfg))
  4951. + return -EBUSY;
  4952. +@@ -807,12 +843,13 @@ int brcmf_cfg80211_del_iface(struct wiph
  4953. + switch (wdev->iftype) {
  4954. + case NL80211_IFTYPE_ADHOC:
  4955. + case NL80211_IFTYPE_STATION:
  4956. +- case NL80211_IFTYPE_AP:
  4957. + case NL80211_IFTYPE_AP_VLAN:
  4958. + case NL80211_IFTYPE_WDS:
  4959. + case NL80211_IFTYPE_MONITOR:
  4960. + case NL80211_IFTYPE_MESH_POINT:
  4961. + return -EOPNOTSUPP;
  4962. ++ case NL80211_IFTYPE_AP:
  4963. ++ return brcmf_cfg80211_del_ap_iface(wiphy, wdev);
  4964. + case NL80211_IFTYPE_P2P_CLIENT:
  4965. + case NL80211_IFTYPE_P2P_GO:
  4966. + case NL80211_IFTYPE_P2P_DEVICE:
  4967. 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
  4968. deleted file mode 100644
  4969. index b646ab3..0000000
  4970. --- a/package/kernel/mac80211/patches/319-cfg80211-add-function-for-802.3-conversion-with-sepa.patch
  4971. +++ /dev/null
  4972. @@ -1,186 +0,0 @@
  4973. -From: Felix Fietkau <nbd@openwrt.org>
  4974. -Date: Tue, 2 Feb 2016 14:39:09 +0100
  4975. -Subject: [PATCH] cfg80211: add function for 802.3 conversion with separate
  4976. - output buffer
  4977. -
  4978. -Use skb_copy_bits in preparation for allowing fragmented skbs
  4979. -
  4980. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  4981. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  4982. ----
  4983. -
  4984. ---- a/net/wireless/util.c
  4985. -+++ b/net/wireless/util.c
  4986. -@@ -393,9 +393,9 @@ unsigned int ieee80211_get_hdrlen_from_s
  4987. - }
  4988. - EXPORT_SYMBOL(ieee80211_get_hdrlen_from_skb);
  4989. -
  4990. --unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr)
  4991. -+static unsigned int __ieee80211_get_mesh_hdrlen(u8 flags)
  4992. - {
  4993. -- int ae = meshhdr->flags & MESH_FLAGS_AE;
  4994. -+ int ae = flags & MESH_FLAGS_AE;
  4995. - /* 802.11-2012, 8.2.4.7.3 */
  4996. - switch (ae) {
  4997. - default:
  4998. -@@ -407,21 +407,31 @@ unsigned int ieee80211_get_mesh_hdrlen(s
  4999. - return 18;
  5000. - }
  5001. - }
  5002. -+
  5003. -+unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr)
  5004. -+{
  5005. -+ return __ieee80211_get_mesh_hdrlen(meshhdr->flags);
  5006. -+}
  5007. - EXPORT_SYMBOL(ieee80211_get_mesh_hdrlen);
  5008. -
  5009. --int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
  5010. -- enum nl80211_iftype iftype)
  5011. -+static int __ieee80211_data_to_8023(struct sk_buff *skb, struct ethhdr *ehdr,
  5012. -+ const u8 *addr, enum nl80211_iftype iftype)
  5013. - {
  5014. - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
  5015. -- u16 hdrlen, ethertype;
  5016. -- u8 *payload;
  5017. -- u8 dst[ETH_ALEN];
  5018. -- u8 src[ETH_ALEN] __aligned(2);
  5019. -+ struct {
  5020. -+ u8 hdr[ETH_ALEN] __aligned(2);
  5021. -+ __be16 proto;
  5022. -+ } payload;
  5023. -+ struct ethhdr tmp;
  5024. -+ u16 hdrlen;
  5025. -+ u8 mesh_flags = 0;
  5026. -
  5027. - if (unlikely(!ieee80211_is_data_present(hdr->frame_control)))
  5028. - return -1;
  5029. -
  5030. - hdrlen = ieee80211_hdrlen(hdr->frame_control);
  5031. -+ if (skb->len < hdrlen + 8)
  5032. -+ return -1;
  5033. -
  5034. - /* convert IEEE 802.11 header + possible LLC headers into Ethernet
  5035. - * header
  5036. -@@ -432,8 +442,11 @@ int ieee80211_data_to_8023(struct sk_buf
  5037. - * 1 0 BSSID SA DA n/a
  5038. - * 1 1 RA TA DA SA
  5039. - */
  5040. -- memcpy(dst, ieee80211_get_DA(hdr), ETH_ALEN);
  5041. -- memcpy(src, ieee80211_get_SA(hdr), ETH_ALEN);
  5042. -+ memcpy(tmp.h_dest, ieee80211_get_DA(hdr), ETH_ALEN);
  5043. -+ memcpy(tmp.h_source, ieee80211_get_SA(hdr), ETH_ALEN);
  5044. -+
  5045. -+ if (iftype == NL80211_IFTYPE_MESH_POINT)
  5046. -+ skb_copy_bits(skb, hdrlen, &mesh_flags, 1);
  5047. -
  5048. - switch (hdr->frame_control &
  5049. - cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) {
  5050. -@@ -450,44 +463,31 @@ int ieee80211_data_to_8023(struct sk_buf
  5051. - iftype != NL80211_IFTYPE_STATION))
  5052. - return -1;
  5053. - if (iftype == NL80211_IFTYPE_MESH_POINT) {
  5054. -- struct ieee80211s_hdr *meshdr =
  5055. -- (struct ieee80211s_hdr *) (skb->data + hdrlen);
  5056. -- /* make sure meshdr->flags is on the linear part */
  5057. -- if (!pskb_may_pull(skb, hdrlen + 1))
  5058. -- return -1;
  5059. -- if (meshdr->flags & MESH_FLAGS_AE_A4)
  5060. -+ if (mesh_flags & MESH_FLAGS_AE_A4)
  5061. - return -1;
  5062. -- if (meshdr->flags & MESH_FLAGS_AE_A5_A6) {
  5063. -+ if (mesh_flags & MESH_FLAGS_AE_A5_A6) {
  5064. - skb_copy_bits(skb, hdrlen +
  5065. - offsetof(struct ieee80211s_hdr, eaddr1),
  5066. -- dst, ETH_ALEN);
  5067. -- skb_copy_bits(skb, hdrlen +
  5068. -- offsetof(struct ieee80211s_hdr, eaddr2),
  5069. -- src, ETH_ALEN);
  5070. -+ tmp.h_dest, 2 * ETH_ALEN);
  5071. - }
  5072. -- hdrlen += ieee80211_get_mesh_hdrlen(meshdr);
  5073. -+ hdrlen += __ieee80211_get_mesh_hdrlen(mesh_flags);
  5074. - }
  5075. - break;
  5076. - case cpu_to_le16(IEEE80211_FCTL_FROMDS):
  5077. - if ((iftype != NL80211_IFTYPE_STATION &&
  5078. - iftype != NL80211_IFTYPE_P2P_CLIENT &&
  5079. - iftype != NL80211_IFTYPE_MESH_POINT) ||
  5080. -- (is_multicast_ether_addr(dst) &&
  5081. -- ether_addr_equal(src, addr)))
  5082. -+ (is_multicast_ether_addr(tmp.h_dest) &&
  5083. -+ ether_addr_equal(tmp.h_source, addr)))
  5084. - return -1;
  5085. - if (iftype == NL80211_IFTYPE_MESH_POINT) {
  5086. -- struct ieee80211s_hdr *meshdr =
  5087. -- (struct ieee80211s_hdr *) (skb->data + hdrlen);
  5088. -- /* make sure meshdr->flags is on the linear part */
  5089. -- if (!pskb_may_pull(skb, hdrlen + 1))
  5090. -- return -1;
  5091. -- if (meshdr->flags & MESH_FLAGS_AE_A5_A6)
  5092. -+ if (mesh_flags & MESH_FLAGS_AE_A5_A6)
  5093. - return -1;
  5094. -- if (meshdr->flags & MESH_FLAGS_AE_A4)
  5095. -+ if (mesh_flags & MESH_FLAGS_AE_A4)
  5096. - skb_copy_bits(skb, hdrlen +
  5097. - offsetof(struct ieee80211s_hdr, eaddr1),
  5098. -- src, ETH_ALEN);
  5099. -- hdrlen += ieee80211_get_mesh_hdrlen(meshdr);
  5100. -+ tmp.h_source, ETH_ALEN);
  5101. -+ hdrlen += __ieee80211_get_mesh_hdrlen(mesh_flags);
  5102. - }
  5103. - break;
  5104. - case cpu_to_le16(0):
  5105. -@@ -498,33 +498,33 @@ int ieee80211_data_to_8023(struct sk_buf
  5106. - break;
  5107. - }
  5108. -
  5109. -- if (!pskb_may_pull(skb, hdrlen + 8))
  5110. -- return -1;
  5111. --
  5112. -- payload = skb->data + hdrlen;
  5113. -- ethertype = (payload[6] << 8) | payload[7];
  5114. -+ skb_copy_bits(skb, hdrlen, &payload, sizeof(payload));
  5115. -+ tmp.h_proto = payload.proto;
  5116. -
  5117. -- if (likely((ether_addr_equal(payload, rfc1042_header) &&
  5118. -- ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) ||
  5119. -- ether_addr_equal(payload, bridge_tunnel_header))) {
  5120. -+ if (likely((ether_addr_equal(payload.hdr, rfc1042_header) &&
  5121. -+ tmp.h_proto != htons(ETH_P_AARP) &&
  5122. -+ tmp.h_proto != htons(ETH_P_IPX)) ||
  5123. -+ ether_addr_equal(payload.hdr, bridge_tunnel_header)))
  5124. - /* remove RFC1042 or Bridge-Tunnel encapsulation and
  5125. - * replace EtherType */
  5126. -- skb_pull(skb, hdrlen + 6);
  5127. -- memcpy(skb_push(skb, ETH_ALEN), src, ETH_ALEN);
  5128. -- memcpy(skb_push(skb, ETH_ALEN), dst, ETH_ALEN);
  5129. -- } else {
  5130. -- struct ethhdr *ehdr;
  5131. -- __be16 len;
  5132. -+ hdrlen += ETH_ALEN + 2;
  5133. -+ else
  5134. -+ tmp.h_proto = htons(skb->len);
  5135. -
  5136. -- skb_pull(skb, hdrlen);
  5137. -- len = htons(skb->len);
  5138. -+ pskb_pull(skb, hdrlen);
  5139. -+
  5140. -+ if (!ehdr)
  5141. - ehdr = (struct ethhdr *) skb_push(skb, sizeof(struct ethhdr));
  5142. -- memcpy(ehdr->h_dest, dst, ETH_ALEN);
  5143. -- memcpy(ehdr->h_source, src, ETH_ALEN);
  5144. -- ehdr->h_proto = len;
  5145. -- }
  5146. -+ memcpy(ehdr, &tmp, sizeof(tmp));
  5147. -+
  5148. - return 0;
  5149. - }
  5150. -+
  5151. -+int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
  5152. -+ enum nl80211_iftype iftype)
  5153. -+{
  5154. -+ return __ieee80211_data_to_8023(skb, NULL, addr, iftype);
  5155. -+}
  5156. - EXPORT_SYMBOL(ieee80211_data_to_8023);
  5157. -
  5158. - int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr,
  5159. 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
  5160. deleted file mode 100644
  5161. index 2eeed22..0000000
  5162. --- a/package/kernel/mac80211/patches/320-cfg80211-add-support-for-non-linear-skbs-in-ieee8021.patch
  5163. +++ /dev/null
  5164. @@ -1,159 +0,0 @@
  5165. -From: Felix Fietkau <nbd@openwrt.org>
  5166. -Date: Tue, 2 Feb 2016 14:39:10 +0100
  5167. -Subject: [PATCH] cfg80211: add support for non-linear skbs in
  5168. - ieee80211_amsdu_to_8023s
  5169. -
  5170. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  5171. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  5172. ----
  5173. -
  5174. ---- a/net/wireless/util.c
  5175. -+++ b/net/wireless/util.c
  5176. -@@ -644,73 +644,75 @@ int ieee80211_data_from_8023(struct sk_b
  5177. - }
  5178. - EXPORT_SYMBOL(ieee80211_data_from_8023);
  5179. -
  5180. -+static struct sk_buff *
  5181. -+__ieee80211_amsdu_copy(struct sk_buff *skb, unsigned int hlen,
  5182. -+ int offset, int len)
  5183. -+{
  5184. -+ struct sk_buff *frame;
  5185. -+
  5186. -+ if (skb->len - offset < len)
  5187. -+ return NULL;
  5188. -+
  5189. -+ /*
  5190. -+ * Allocate and reserve two bytes more for payload
  5191. -+ * alignment since sizeof(struct ethhdr) is 14.
  5192. -+ */
  5193. -+ frame = dev_alloc_skb(hlen + sizeof(struct ethhdr) + 2 + len);
  5194. -+
  5195. -+ skb_reserve(frame, hlen + sizeof(struct ethhdr) + 2);
  5196. -+ skb_copy_bits(skb, offset, skb_put(frame, len), len);
  5197. -+
  5198. -+ return frame;
  5199. -+}
  5200. -
  5201. - void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
  5202. - const u8 *addr, enum nl80211_iftype iftype,
  5203. - const unsigned int extra_headroom,
  5204. - bool has_80211_header)
  5205. - {
  5206. -+ unsigned int hlen = ALIGN(extra_headroom, 4);
  5207. - struct sk_buff *frame = NULL;
  5208. - u16 ethertype;
  5209. - u8 *payload;
  5210. -- const struct ethhdr *eth;
  5211. -- int remaining, err;
  5212. -- u8 dst[ETH_ALEN], src[ETH_ALEN];
  5213. --
  5214. -- if (skb_linearize(skb))
  5215. -- goto out;
  5216. -+ int offset = 0, remaining, err;
  5217. -+ struct ethhdr eth;
  5218. -+ bool reuse_skb = true;
  5219. -+ bool last = false;
  5220. -
  5221. - if (has_80211_header) {
  5222. -- err = ieee80211_data_to_8023(skb, addr, iftype);
  5223. -+ err = __ieee80211_data_to_8023(skb, &eth, addr, iftype);
  5224. - if (err)
  5225. - goto out;
  5226. --
  5227. -- /* skip the wrapping header */
  5228. -- eth = (struct ethhdr *) skb_pull(skb, sizeof(struct ethhdr));
  5229. -- if (!eth)
  5230. -- goto out;
  5231. -- } else {
  5232. -- eth = (struct ethhdr *) skb->data;
  5233. - }
  5234. -
  5235. -- while (skb != frame) {
  5236. -+ while (!last) {
  5237. -+ unsigned int subframe_len;
  5238. -+ int len;
  5239. - u8 padding;
  5240. -- __be16 len = eth->h_proto;
  5241. -- unsigned int subframe_len = sizeof(struct ethhdr) + ntohs(len);
  5242. --
  5243. -- remaining = skb->len;
  5244. -- memcpy(dst, eth->h_dest, ETH_ALEN);
  5245. -- memcpy(src, eth->h_source, ETH_ALEN);
  5246. -
  5247. -+ skb_copy_bits(skb, offset, &eth, sizeof(eth));
  5248. -+ len = ntohs(eth.h_proto);
  5249. -+ subframe_len = sizeof(struct ethhdr) + len;
  5250. - padding = (4 - subframe_len) & 0x3;
  5251. -+
  5252. - /* the last MSDU has no padding */
  5253. -+ remaining = skb->len - offset;
  5254. - if (subframe_len > remaining)
  5255. - goto purge;
  5256. -
  5257. -- skb_pull(skb, sizeof(struct ethhdr));
  5258. -+ offset += sizeof(struct ethhdr);
  5259. - /* reuse skb for the last subframe */
  5260. -- if (remaining <= subframe_len + padding)
  5261. -+ last = remaining <= subframe_len + padding;
  5262. -+ if (!skb_is_nonlinear(skb) && last) {
  5263. -+ skb_pull(skb, offset);
  5264. - frame = skb;
  5265. -- else {
  5266. -- unsigned int hlen = ALIGN(extra_headroom, 4);
  5267. -- /*
  5268. -- * Allocate and reserve two bytes more for payload
  5269. -- * alignment since sizeof(struct ethhdr) is 14.
  5270. -- */
  5271. -- frame = dev_alloc_skb(hlen + subframe_len + 2);
  5272. -+ reuse_skb = true;
  5273. -+ } else {
  5274. -+ frame = __ieee80211_amsdu_copy(skb, hlen, offset, len);
  5275. - if (!frame)
  5276. - goto purge;
  5277. -
  5278. -- skb_reserve(frame, hlen + sizeof(struct ethhdr) + 2);
  5279. -- memcpy(skb_put(frame, ntohs(len)), skb->data,
  5280. -- ntohs(len));
  5281. --
  5282. -- eth = (struct ethhdr *)skb_pull(skb, ntohs(len) +
  5283. -- padding);
  5284. -- if (!eth) {
  5285. -- dev_kfree_skb(frame);
  5286. -- goto purge;
  5287. -- }
  5288. -+ offset += len + padding;
  5289. - }
  5290. -
  5291. - skb_reset_network_header(frame);
  5292. -@@ -719,24 +721,20 @@ void ieee80211_amsdu_to_8023s(struct sk_
  5293. -
  5294. - payload = frame->data;
  5295. - ethertype = (payload[6] << 8) | payload[7];
  5296. --
  5297. - if (likely((ether_addr_equal(payload, rfc1042_header) &&
  5298. - ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) ||
  5299. - ether_addr_equal(payload, bridge_tunnel_header))) {
  5300. -- /* remove RFC1042 or Bridge-Tunnel
  5301. -- * encapsulation and replace EtherType */
  5302. -- skb_pull(frame, 6);
  5303. -- memcpy(skb_push(frame, ETH_ALEN), src, ETH_ALEN);
  5304. -- memcpy(skb_push(frame, ETH_ALEN), dst, ETH_ALEN);
  5305. -- } else {
  5306. -- memcpy(skb_push(frame, sizeof(__be16)), &len,
  5307. -- sizeof(__be16));
  5308. -- memcpy(skb_push(frame, ETH_ALEN), src, ETH_ALEN);
  5309. -- memcpy(skb_push(frame, ETH_ALEN), dst, ETH_ALEN);
  5310. -+ eth.h_proto = htons(ethertype);
  5311. -+ skb_pull(frame, ETH_ALEN + 2);
  5312. - }
  5313. -+
  5314. -+ memcpy(skb_push(frame, sizeof(eth)), &eth, sizeof(eth));
  5315. - __skb_queue_tail(list, frame);
  5316. - }
  5317. -
  5318. -+ if (!reuse_skb)
  5319. -+ dev_kfree_skb(skb);
  5320. -+
  5321. - return;
  5322. -
  5323. - purge:
  5324. 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
  5325. new file mode 100644
  5326. index 0000000..9caa76d
  5327. --- /dev/null
  5328. +++ b/package/kernel/mac80211/patches/321-ath9k_hw-reset-AHB-WMAC-interface-on-AR91xx.patch
  5329. @@ -0,0 +1,25 @@
  5330. +From: Felix Fietkau <nbd@nbd.name>
  5331. +Date: Sat, 9 Jul 2016 15:25:24 +0200
  5332. +Subject: [PATCH] ath9k_hw: reset AHB-WMAC interface on AR91xx
  5333. +
  5334. +Should fix a few stability issues
  5335. +
  5336. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  5337. +---
  5338. +
  5339. +--- a/drivers/net/wireless/ath/ath9k/hw.c
  5340. ++++ b/drivers/net/wireless/ath/ath9k/hw.c
  5341. +@@ -1398,8 +1398,12 @@ static bool ath9k_hw_set_reset(struct at
  5342. + if (!AR_SREV_9100(ah))
  5343. + REG_WRITE(ah, AR_RC, 0);
  5344. +
  5345. +- if (AR_SREV_9100(ah))
  5346. ++ if (AR_SREV_9100(ah)) {
  5347. ++ /* Reset the AHB-WMAC interface */
  5348. ++ if (ah->external_reset)
  5349. ++ ah->external_reset();
  5350. + udelay(50);
  5351. ++ }
  5352. +
  5353. + return true;
  5354. + }
  5355. 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
  5356. deleted file mode 100644
  5357. index c4155a1..0000000
  5358. --- a/package/kernel/mac80211/patches/321-mac80211-Parse-legacy-and-HT-rate-in-injected-frames.patch
  5359. +++ /dev/null
  5360. @@ -1,155 +0,0 @@
  5361. -From: Sven Eckelmann <sven@narfation.org>
  5362. -Date: Tue, 26 Jan 2016 17:11:13 +0100
  5363. -Subject: [PATCH] mac80211: Parse legacy and HT rate in injected frames
  5364. -
  5365. -Drivers/devices without their own rate control algorithm can get the
  5366. -information what rates they should use from either the radiotap header of
  5367. -injected frames or from the rate control algorithm. But the parsing of the
  5368. -legacy rate information from the radiotap header was removed in commit
  5369. -e6a9854b05c1 ("mac80211/drivers: rewrite the rate control API").
  5370. -
  5371. -The removal of this feature heavily reduced the usefulness of frame
  5372. -injection when wanting to simulate specific transmission behavior. Having
  5373. -rate parsing together with MCS rates and retry support allows a fine
  5374. -grained selection of the tx behavior of injected frames for these kind of
  5375. -tests.
  5376. -
  5377. -Signed-off-by: Sven Eckelmann <sven@narfation.org>
  5378. -Cc: Simon Wunderlich <sw@simonwunderlich.de>
  5379. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  5380. ----
  5381. -
  5382. ---- a/include/net/mac80211.h
  5383. -+++ b/include/net/mac80211.h
  5384. -@@ -708,12 +708,14 @@ enum mac80211_tx_info_flags {
  5385. - * protocol frame (e.g. EAP)
  5386. - * @IEEE80211_TX_CTRL_PS_RESPONSE: This frame is a response to a poll
  5387. - * frame (PS-Poll or uAPSD).
  5388. -+ * @IEEE80211_TX_CTRL_RATE_INJECT: This frame is injected with rate information
  5389. - *
  5390. - * These flags are used in tx_info->control.flags.
  5391. - */
  5392. - enum mac80211_tx_control_flags {
  5393. - IEEE80211_TX_CTRL_PORT_CTRL_PROTO = BIT(0),
  5394. - IEEE80211_TX_CTRL_PS_RESPONSE = BIT(1),
  5395. -+ IEEE80211_TX_CTRL_RATE_INJECT = BIT(2),
  5396. - };
  5397. -
  5398. - /*
  5399. ---- a/net/mac80211/tx.c
  5400. -+++ b/net/mac80211/tx.c
  5401. -@@ -710,6 +710,10 @@ ieee80211_tx_h_rate_ctrl(struct ieee8021
  5402. -
  5403. - info->control.short_preamble = txrc.short_preamble;
  5404. -
  5405. -+ /* don't ask rate control when rate already injected via radiotap */
  5406. -+ if (info->control.flags & IEEE80211_TX_CTRL_RATE_INJECT)
  5407. -+ return TX_CONTINUE;
  5408. -+
  5409. - if (tx->sta)
  5410. - assoc = test_sta_flag(tx->sta, WLAN_STA_ASSOC);
  5411. -
  5412. -@@ -1665,15 +1669,24 @@ void ieee80211_xmit(struct ieee80211_sub
  5413. - ieee80211_tx(sdata, sta, skb, false);
  5414. - }
  5415. -
  5416. --static bool ieee80211_parse_tx_radiotap(struct sk_buff *skb)
  5417. -+static bool ieee80211_parse_tx_radiotap(struct ieee80211_local *local,
  5418. -+ struct sk_buff *skb)
  5419. - {
  5420. - struct ieee80211_radiotap_iterator iterator;
  5421. - struct ieee80211_radiotap_header *rthdr =
  5422. - (struct ieee80211_radiotap_header *) skb->data;
  5423. - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  5424. -+ struct ieee80211_supported_band *sband =
  5425. -+ local->hw.wiphy->bands[info->band];
  5426. - int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len,
  5427. - NULL);
  5428. - u16 txflags;
  5429. -+ u16 rate = 0;
  5430. -+ bool rate_found = false;
  5431. -+ u8 rate_retries = 0;
  5432. -+ u16 rate_flags = 0;
  5433. -+ u8 mcs_known, mcs_flags;
  5434. -+ int i;
  5435. -
  5436. - info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT |
  5437. - IEEE80211_TX_CTL_DONTFRAG;
  5438. -@@ -1724,6 +1737,35 @@ static bool ieee80211_parse_tx_radiotap(
  5439. - info->flags |= IEEE80211_TX_CTL_NO_ACK;
  5440. - break;
  5441. -
  5442. -+ case IEEE80211_RADIOTAP_RATE:
  5443. -+ rate = *iterator.this_arg;
  5444. -+ rate_flags = 0;
  5445. -+ rate_found = true;
  5446. -+ break;
  5447. -+
  5448. -+ case IEEE80211_RADIOTAP_DATA_RETRIES:
  5449. -+ rate_retries = *iterator.this_arg;
  5450. -+ break;
  5451. -+
  5452. -+ case IEEE80211_RADIOTAP_MCS:
  5453. -+ mcs_known = iterator.this_arg[0];
  5454. -+ mcs_flags = iterator.this_arg[1];
  5455. -+ if (!(mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_MCS))
  5456. -+ break;
  5457. -+
  5458. -+ rate_found = true;
  5459. -+ rate = iterator.this_arg[2];
  5460. -+ rate_flags = IEEE80211_TX_RC_MCS;
  5461. -+
  5462. -+ if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_GI &&
  5463. -+ mcs_flags & IEEE80211_RADIOTAP_MCS_SGI)
  5464. -+ rate_flags |= IEEE80211_TX_RC_SHORT_GI;
  5465. -+
  5466. -+ if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_BW &&
  5467. -+ mcs_flags & IEEE80211_RADIOTAP_MCS_BW_40)
  5468. -+ rate_flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
  5469. -+ break;
  5470. -+
  5471. - /*
  5472. - * Please update the file
  5473. - * Documentation/networking/mac80211-injection.txt
  5474. -@@ -1738,6 +1780,32 @@ static bool ieee80211_parse_tx_radiotap(
  5475. - if (ret != -ENOENT) /* ie, if we didn't simply run out of fields */
  5476. - return false;
  5477. -
  5478. -+ if (rate_found) {
  5479. -+ info->control.flags |= IEEE80211_TX_CTRL_RATE_INJECT;
  5480. -+
  5481. -+ for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) {
  5482. -+ info->control.rates[i].idx = -1;
  5483. -+ info->control.rates[i].flags = 0;
  5484. -+ info->control.rates[i].count = 0;
  5485. -+ }
  5486. -+
  5487. -+ if (rate_flags & IEEE80211_TX_RC_MCS) {
  5488. -+ info->control.rates[0].idx = rate;
  5489. -+ } else {
  5490. -+ for (i = 0; i < sband->n_bitrates; i++) {
  5491. -+ if (rate * 5 != sband->bitrates[i].bitrate)
  5492. -+ continue;
  5493. -+
  5494. -+ info->control.rates[0].idx = i;
  5495. -+ break;
  5496. -+ }
  5497. -+ }
  5498. -+
  5499. -+ info->control.rates[0].flags = rate_flags;
  5500. -+ info->control.rates[0].count = min_t(u8, rate_retries + 1,
  5501. -+ local->hw.max_rate_tries);
  5502. -+ }
  5503. -+
  5504. - /*
  5505. - * remove the radiotap header
  5506. - * iterator->_max_length was sanity-checked against
  5507. -@@ -1819,7 +1887,7 @@ netdev_tx_t ieee80211_monitor_start_xmit
  5508. - IEEE80211_TX_CTL_INJECTED;
  5509. -
  5510. - /* process and remove the injection radiotap header */
  5511. -- if (!ieee80211_parse_tx_radiotap(skb))
  5512. -+ if (!ieee80211_parse_tx_radiotap(local, skb))
  5513. - goto fail;
  5514. -
  5515. - rcu_read_lock();
  5516. 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
  5517. new file mode 100644
  5518. index 0000000..5d4e849
  5519. --- /dev/null
  5520. +++ b/package/kernel/mac80211/patches/322-ath9k_hw-issue-external-reset-for-QCA9550.patch
  5521. @@ -0,0 +1,125 @@
  5522. +From: Felix Fietkau <nbd@nbd.name>
  5523. +Date: Sat, 9 Jul 2016 15:26:44 +0200
  5524. +Subject: [PATCH] ath9k_hw: issue external reset for QCA9550
  5525. +
  5526. +The RTC interface on the SoC needs to be reset along with the rest of
  5527. +the WMAC.
  5528. +
  5529. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  5530. +---
  5531. +
  5532. +--- a/drivers/net/wireless/ath/ath9k/hw.c
  5533. ++++ b/drivers/net/wireless/ath/ath9k/hw.c
  5534. +@@ -1275,39 +1275,56 @@ void ath9k_hw_get_delta_slope_vals(struc
  5535. + *coef_exponent = coef_exp - 16;
  5536. + }
  5537. +
  5538. +-/* AR9330 WAR:
  5539. +- * call external reset function to reset WMAC if:
  5540. +- * - doing a cold reset
  5541. +- * - we have pending frames in the TX queues.
  5542. +- */
  5543. +-static bool ath9k_hw_ar9330_reset_war(struct ath_hw *ah, int type)
  5544. ++static bool ath9k_hw_need_external_reset(struct ath_hw *ah, int type)
  5545. + {
  5546. +- int i, npend = 0;
  5547. ++ int i;
  5548. +
  5549. +- for (i = 0; i < AR_NUM_QCU; i++) {
  5550. +- npend = ath9k_hw_numtxpending(ah, i);
  5551. +- if (npend)
  5552. +- break;
  5553. ++ if (type == ATH9K_RESET_COLD)
  5554. ++ return true;
  5555. ++
  5556. ++ if (AR_SREV_9550(ah))
  5557. ++ return true;
  5558. ++
  5559. ++ /* AR9330 WAR:
  5560. ++ * call external reset function to reset WMAC if:
  5561. ++ * - doing a cold reset
  5562. ++ * - we have pending frames in the TX queues.
  5563. ++ */
  5564. ++ if (AR_SREV_9330(ah)) {
  5565. ++ for (i = 0; i < AR_NUM_QCU; i++) {
  5566. ++ if (ath9k_hw_numtxpending(ah, i))
  5567. ++ return true;
  5568. ++ }
  5569. + }
  5570. +
  5571. +- if (ah->external_reset &&
  5572. +- (npend || type == ATH9K_RESET_COLD)) {
  5573. +- int reset_err = 0;
  5574. ++ return false;
  5575. ++}
  5576. +
  5577. +- ath_dbg(ath9k_hw_common(ah), RESET,
  5578. +- "reset MAC via external reset\n");
  5579. ++static bool ath9k_hw_external_reset(struct ath_hw *ah, int type)
  5580. ++{
  5581. ++ int err;
  5582. +
  5583. +- reset_err = ah->external_reset();
  5584. +- if (reset_err) {
  5585. +- ath_err(ath9k_hw_common(ah),
  5586. +- "External reset failed, err=%d\n",
  5587. +- reset_err);
  5588. +- return false;
  5589. +- }
  5590. ++ if (!ah->external_reset || !ath9k_hw_need_external_reset(ah, type))
  5591. ++ return true;
  5592. +
  5593. +- REG_WRITE(ah, AR_RTC_RESET, 1);
  5594. ++ ath_dbg(ath9k_hw_common(ah), RESET,
  5595. ++ "reset MAC via external reset\n");
  5596. ++
  5597. ++ err = ah->external_reset();
  5598. ++ if (err) {
  5599. ++ ath_err(ath9k_hw_common(ah),
  5600. ++ "External reset failed, err=%d\n", err);
  5601. ++ return false;
  5602. ++ }
  5603. ++
  5604. ++ if (AR_SREV_9550(ah)) {
  5605. ++ REG_WRITE(ah, AR_RTC_RESET, 0);
  5606. ++ udelay(10);
  5607. + }
  5608. +
  5609. ++ REG_WRITE(ah, AR_RTC_RESET, 1);
  5610. ++ udelay(10);
  5611. ++
  5612. + return true;
  5613. + }
  5614. +
  5615. +@@ -1360,24 +1377,23 @@ static bool ath9k_hw_set_reset(struct at
  5616. + rst_flags |= AR_RTC_RC_MAC_COLD;
  5617. + }
  5618. +
  5619. +- if (AR_SREV_9330(ah)) {
  5620. +- if (!ath9k_hw_ar9330_reset_war(ah, type))
  5621. +- return false;
  5622. +- }
  5623. +-
  5624. + if (ath9k_hw_mci_is_enabled(ah))
  5625. + ar9003_mci_check_gpm_offset(ah);
  5626. +
  5627. + /* DMA HALT added to resolve ar9300 and ar9580 bus error during
  5628. +- * RTC_RC reg read
  5629. ++ * RTC_RC reg read. Also needed for AR9550 external reset
  5630. + */
  5631. +- if (AR_SREV_9300(ah) || AR_SREV_9580(ah)) {
  5632. ++ if (AR_SREV_9300(ah) || AR_SREV_9580(ah) || AR_SREV_9550(ah)) {
  5633. + REG_SET_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  5634. + ath9k_hw_wait(ah, AR_CFG, AR_CFG_HALT_ACK, AR_CFG_HALT_ACK,
  5635. + 20 * AH_WAIT_TIMEOUT);
  5636. +- REG_CLR_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  5637. + }
  5638. +
  5639. ++ ath9k_hw_external_reset(ah, type);
  5640. ++
  5641. ++ if (AR_SREV_9300(ah) || AR_SREV_9580(ah))
  5642. ++ REG_CLR_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  5643. ++
  5644. + REG_WRITE(ah, AR_RTC_RC, rst_flags);
  5645. +
  5646. + REGWRITE_BUFFER_FLUSH(ah);
  5647. 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
  5648. deleted file mode 100644
  5649. index e7bfb9c..0000000
  5650. --- a/package/kernel/mac80211/patches/322-mac80211-add-A-MSDU-tx-support.patch
  5651. +++ /dev/null
  5652. @@ -1,317 +0,0 @@
  5653. -From: Felix Fietkau <nbd@openwrt.org>
  5654. -Date: Fri, 5 Feb 2016 01:38:51 +0100
  5655. -Subject: [PATCH] mac80211: add A-MSDU tx support
  5656. -
  5657. -Requires software tx queueing support. frag_list support (for zero-copy)
  5658. -is optional.
  5659. -
  5660. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  5661. ----
  5662. -
  5663. ---- a/include/net/mac80211.h
  5664. -+++ b/include/net/mac80211.h
  5665. -@@ -709,6 +709,7 @@ enum mac80211_tx_info_flags {
  5666. - * @IEEE80211_TX_CTRL_PS_RESPONSE: This frame is a response to a poll
  5667. - * frame (PS-Poll or uAPSD).
  5668. - * @IEEE80211_TX_CTRL_RATE_INJECT: This frame is injected with rate information
  5669. -+ * @IEEE80211_TX_CTRL_AMSDU: This frame is an A-MSDU frame
  5670. - *
  5671. - * These flags are used in tx_info->control.flags.
  5672. - */
  5673. -@@ -716,6 +717,7 @@ enum mac80211_tx_control_flags {
  5674. - IEEE80211_TX_CTRL_PORT_CTRL_PROTO = BIT(0),
  5675. - IEEE80211_TX_CTRL_PS_RESPONSE = BIT(1),
  5676. - IEEE80211_TX_CTRL_RATE_INJECT = BIT(2),
  5677. -+ IEEE80211_TX_CTRL_AMSDU = BIT(3),
  5678. - };
  5679. -
  5680. - /*
  5681. -@@ -1728,6 +1730,7 @@ struct ieee80211_sta_rates {
  5682. - * size is min(max_amsdu_len, 7935) bytes.
  5683. - * Both additional HT limits must be enforced by the low level driver.
  5684. - * This is defined by the spec (IEEE 802.11-2012 section 8.3.2.2 NOTE 2).
  5685. -+ * @max_rc_amsdu_len: Maximum A-MSDU size in bytes recommended by rate control.
  5686. - * @txq: per-TID data TX queues (if driver uses the TXQ abstraction)
  5687. - */
  5688. - struct ieee80211_sta {
  5689. -@@ -1748,6 +1751,7 @@ struct ieee80211_sta {
  5690. - bool mfp;
  5691. - u8 max_amsdu_subframes;
  5692. - u16 max_amsdu_len;
  5693. -+ u16 max_rc_amsdu_len;
  5694. -
  5695. - struct ieee80211_txq *txq[IEEE80211_NUM_TIDS];
  5696. -
  5697. -@@ -1961,6 +1965,15 @@ struct ieee80211_txq {
  5698. - * order and does not need to manage its own reorder buffer or BA session
  5699. - * timeout.
  5700. - *
  5701. -+ * @IEEE80211_HW_TX_AMSDU: Hardware (or driver) supports software aggregated
  5702. -+ * A-MSDU frames. Requires software tx queueing and fast-xmit support.
  5703. -+ * When not using minstrel/minstrel_ht rate control, the driver should
  5704. -+ * limit the maximum A-MSDU size based on the current tx rate by setting
  5705. -+ * max_rc_amsdu_len in struct ieee80211_sta.
  5706. -+ *
  5707. -+ * @IEEE80211_HW_TX_FRAG_LIST: Hardware (or driver) supports sending frag_list
  5708. -+ * skbs, needed for zero-copy software A-MSDU.
  5709. -+ *
  5710. - * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
  5711. - */
  5712. - enum ieee80211_hw_flags {
  5713. -@@ -1998,6 +2011,8 @@ enum ieee80211_hw_flags {
  5714. - IEEE80211_HW_BEACON_TX_STATUS,
  5715. - IEEE80211_HW_NEEDS_UNIQUE_STA_ADDR,
  5716. - IEEE80211_HW_SUPPORTS_REORDERING_BUFFER,
  5717. -+ IEEE80211_HW_TX_AMSDU,
  5718. -+ IEEE80211_HW_TX_FRAG_LIST,
  5719. -
  5720. - /* keep last, obviously */
  5721. - NUM_IEEE80211_HW_FLAGS
  5722. -@@ -2070,6 +2085,9 @@ enum ieee80211_hw_flags {
  5723. - * size is smaller (an example is LinkSys WRT120N with FW v1.0.07
  5724. - * build 002 Jun 18 2012).
  5725. - *
  5726. -+ * @max_tx_fragments: maximum number of tx buffers per (A)-MSDU, sum
  5727. -+ * of 1 + skb_shinfo(skb)->nr_frags for each skb in the frag_list.
  5728. -+ *
  5729. - * @offchannel_tx_hw_queue: HW queue ID to use for offchannel TX
  5730. - * (if %IEEE80211_HW_QUEUE_CONTROL is set)
  5731. - *
  5732. -@@ -2124,6 +2142,7 @@ struct ieee80211_hw {
  5733. - u8 max_rate_tries;
  5734. - u8 max_rx_aggregation_subframes;
  5735. - u8 max_tx_aggregation_subframes;
  5736. -+ u8 max_tx_fragments;
  5737. - u8 offchannel_tx_hw_queue;
  5738. - u8 radiotap_mcs_details;
  5739. - u16 radiotap_vht_details;
  5740. ---- a/net/mac80211/agg-tx.c
  5741. -+++ b/net/mac80211/agg-tx.c
  5742. -@@ -935,6 +935,7 @@ void ieee80211_process_addba_resp(struct
  5743. - size_t len)
  5744. - {
  5745. - struct tid_ampdu_tx *tid_tx;
  5746. -+ struct ieee80211_txq *txq;
  5747. - u16 capab, tid;
  5748. - u8 buf_size;
  5749. - bool amsdu;
  5750. -@@ -945,6 +946,10 @@ void ieee80211_process_addba_resp(struct
  5751. - buf_size = (capab & IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK) >> 6;
  5752. - buf_size = min(buf_size, local->hw.max_tx_aggregation_subframes);
  5753. -
  5754. -+ txq = sta->sta.txq[tid];
  5755. -+ if (!amsdu && txq)
  5756. -+ set_bit(IEEE80211_TXQ_NO_AMSDU, &to_txq_info(txq)->flags);
  5757. -+
  5758. - mutex_lock(&sta->ampdu_mlme.mtx);
  5759. -
  5760. - tid_tx = rcu_dereference_protected_tid_tx(sta, tid);
  5761. ---- a/net/mac80211/debugfs.c
  5762. -+++ b/net/mac80211/debugfs.c
  5763. -@@ -127,6 +127,8 @@ static const char *hw_flag_names[NUM_IEE
  5764. - FLAG(BEACON_TX_STATUS),
  5765. - FLAG(NEEDS_UNIQUE_STA_ADDR),
  5766. - FLAG(SUPPORTS_REORDERING_BUFFER),
  5767. -+ FLAG(TX_AMSDU),
  5768. -+ FLAG(TX_FRAG_LIST),
  5769. -
  5770. - /* keep last for the build bug below */
  5771. - (void *)0x1
  5772. ---- a/net/mac80211/ieee80211_i.h
  5773. -+++ b/net/mac80211/ieee80211_i.h
  5774. -@@ -799,6 +799,7 @@ struct mac80211_qos_map {
  5775. - enum txq_info_flags {
  5776. - IEEE80211_TXQ_STOP,
  5777. - IEEE80211_TXQ_AMPDU,
  5778. -+ IEEE80211_TXQ_NO_AMSDU,
  5779. - };
  5780. -
  5781. - struct txq_info {
  5782. ---- a/net/mac80211/tx.c
  5783. -+++ b/net/mac80211/tx.c
  5784. -@@ -1318,6 +1318,10 @@ struct sk_buff *ieee80211_tx_dequeue(str
  5785. - out:
  5786. - spin_unlock_bh(&txqi->queue.lock);
  5787. -
  5788. -+ if (skb && skb_has_frag_list(skb) &&
  5789. -+ !ieee80211_hw_check(&local->hw, TX_FRAG_LIST))
  5790. -+ skb_linearize(skb);
  5791. -+
  5792. - return skb;
  5793. - }
  5794. - EXPORT_SYMBOL(ieee80211_tx_dequeue);
  5795. -@@ -2757,6 +2761,163 @@ void ieee80211_clear_fast_xmit(struct st
  5796. - kfree_rcu(fast_tx, rcu_head);
  5797. - }
  5798. -
  5799. -+static bool ieee80211_amsdu_realloc_pad(struct ieee80211_local *local,
  5800. -+ struct sk_buff *skb, int headroom,
  5801. -+ int *subframe_len)
  5802. -+{
  5803. -+ int amsdu_len = *subframe_len + sizeof(struct ethhdr);
  5804. -+ int padding = (4 - amsdu_len) & 3;
  5805. -+
  5806. -+ if (skb_headroom(skb) < headroom || skb_tailroom(skb) < padding) {
  5807. -+ I802_DEBUG_INC(local->tx_expand_skb_head);
  5808. -+
  5809. -+ if (pskb_expand_head(skb, headroom, padding, GFP_ATOMIC)) {
  5810. -+ wiphy_debug(local->hw.wiphy,
  5811. -+ "failed to reallocate TX buffer\n");
  5812. -+ return false;
  5813. -+ }
  5814. -+ }
  5815. -+
  5816. -+ if (padding) {
  5817. -+ *subframe_len += padding;
  5818. -+ memset(skb_put(skb, padding), 0, padding);
  5819. -+ }
  5820. -+
  5821. -+ return true;
  5822. -+}
  5823. -+
  5824. -+static bool ieee80211_amsdu_prepare_head(struct ieee80211_sub_if_data *sdata,
  5825. -+ struct ieee80211_fast_tx *fast_tx,
  5826. -+ struct sk_buff *skb)
  5827. -+{
  5828. -+ struct ieee80211_local *local = sdata->local;
  5829. -+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  5830. -+ struct ieee80211_hdr *hdr;
  5831. -+ struct ethhdr amsdu_hdr;
  5832. -+ int hdr_len = fast_tx->hdr_len - sizeof(rfc1042_header);
  5833. -+ int subframe_len = skb->len - hdr_len;
  5834. -+ void *data;
  5835. -+ u8 *qc;
  5836. -+
  5837. -+ if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE)
  5838. -+ return false;
  5839. -+
  5840. -+ if (info->control.flags & IEEE80211_TX_CTRL_AMSDU)
  5841. -+ return true;
  5842. -+
  5843. -+ if (!ieee80211_amsdu_realloc_pad(local, skb, sizeof(amsdu_hdr),
  5844. -+ &subframe_len))
  5845. -+ return false;
  5846. -+
  5847. -+ amsdu_hdr.h_proto = cpu_to_be16(subframe_len);
  5848. -+ memcpy(amsdu_hdr.h_source, skb->data + fast_tx->sa_offs, ETH_ALEN);
  5849. -+ memcpy(amsdu_hdr.h_dest, skb->data + fast_tx->da_offs, ETH_ALEN);
  5850. -+
  5851. -+ data = skb_push(skb, sizeof(amsdu_hdr));
  5852. -+ memmove(data, data + sizeof(amsdu_hdr), hdr_len);
  5853. -+ memcpy(data + hdr_len, &amsdu_hdr, sizeof(amsdu_hdr));
  5854. -+
  5855. -+ hdr = data;
  5856. -+ qc = ieee80211_get_qos_ctl(hdr);
  5857. -+ *qc |= IEEE80211_QOS_CTL_A_MSDU_PRESENT;
  5858. -+
  5859. -+ info->control.flags |= IEEE80211_TX_CTRL_AMSDU;
  5860. -+
  5861. -+ return true;
  5862. -+}
  5863. -+
  5864. -+static bool ieee80211_amsdu_aggregate(struct ieee80211_sub_if_data *sdata,
  5865. -+ struct sta_info *sta,
  5866. -+ struct ieee80211_fast_tx *fast_tx,
  5867. -+ struct sk_buff *skb)
  5868. -+{
  5869. -+ struct ieee80211_local *local = sdata->local;
  5870. -+ u8 tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK;
  5871. -+ struct ieee80211_txq *txq = sta->sta.txq[tid];
  5872. -+ struct txq_info *txqi;
  5873. -+ struct sk_buff **frag_tail, *head;
  5874. -+ int subframe_len = skb->len - ETH_ALEN;
  5875. -+ u8 max_subframes = sta->sta.max_amsdu_subframes;
  5876. -+ int max_frags = local->hw.max_tx_fragments;
  5877. -+ int max_amsdu_len = sta->sta.max_amsdu_len;
  5878. -+ __be16 len;
  5879. -+ void *data;
  5880. -+ bool ret = false;
  5881. -+ int n = 1, nfrags;
  5882. -+
  5883. -+ if (!ieee80211_hw_check(&local->hw, TX_AMSDU))
  5884. -+ return false;
  5885. -+
  5886. -+ if (!txq)
  5887. -+ return false;
  5888. -+
  5889. -+ txqi = to_txq_info(txq);
  5890. -+ if (test_bit(IEEE80211_TXQ_NO_AMSDU, &txqi->flags))
  5891. -+ return false;
  5892. -+
  5893. -+ if (sta->sta.max_rc_amsdu_len)
  5894. -+ max_amsdu_len = min_t(int, max_amsdu_len,
  5895. -+ sta->sta.max_rc_amsdu_len);
  5896. -+
  5897. -+ spin_lock_bh(&txqi->queue.lock);
  5898. -+
  5899. -+ head = skb_peek_tail(&txqi->queue);
  5900. -+ if (!head)
  5901. -+ goto out;
  5902. -+
  5903. -+ if (skb->len + head->len > max_amsdu_len)
  5904. -+ goto out;
  5905. -+
  5906. -+ /*
  5907. -+ * HT A-MPDU limits maximum MPDU size to 4095 bytes. Since aggregation
  5908. -+ * sessions are started/stopped without txq flush, use the limit here
  5909. -+ * to avoid having to de-aggregate later.
  5910. -+ */
  5911. -+ if (skb->len + head->len > 4095 &&
  5912. -+ !sta->sta.vht_cap.vht_supported)
  5913. -+ goto out;
  5914. -+
  5915. -+ if (!ieee80211_amsdu_prepare_head(sdata, fast_tx, head))
  5916. -+ goto out;
  5917. -+
  5918. -+ nfrags = 1 + skb_shinfo(skb)->nr_frags;
  5919. -+ nfrags += 1 + skb_shinfo(head)->nr_frags;
  5920. -+ frag_tail = &skb_shinfo(head)->frag_list;
  5921. -+ while (*frag_tail) {
  5922. -+ nfrags += 1 + skb_shinfo(*frag_tail)->nr_frags;
  5923. -+ frag_tail = &(*frag_tail)->next;
  5924. -+ n++;
  5925. -+ }
  5926. -+
  5927. -+ if (max_subframes && n > max_subframes)
  5928. -+ goto out;
  5929. -+
  5930. -+ if (max_frags && nfrags > max_frags)
  5931. -+ goto out;
  5932. -+
  5933. -+ if (!ieee80211_amsdu_realloc_pad(local, skb, sizeof(rfc1042_header) + 2,
  5934. -+ &subframe_len))
  5935. -+ return false;
  5936. -+
  5937. -+ ret = true;
  5938. -+ data = skb_push(skb, ETH_ALEN + 2);
  5939. -+ memmove(data, data + ETH_ALEN + 2, 2 * ETH_ALEN);
  5940. -+
  5941. -+ data += 2 * ETH_ALEN;
  5942. -+ len = cpu_to_be16(subframe_len);
  5943. -+ memcpy(data, &len, 2);
  5944. -+ memcpy(data + 2, rfc1042_header, sizeof(rfc1042_header));
  5945. -+
  5946. -+ head->len += skb->len;
  5947. -+ head->data_len += skb->len;
  5948. -+ *frag_tail = skb;
  5949. -+
  5950. -+out:
  5951. -+ spin_unlock_bh(&txqi->queue.lock);
  5952. -+
  5953. -+ return ret;
  5954. -+}
  5955. -+
  5956. - static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata,
  5957. - struct net_device *dev, struct sta_info *sta,
  5958. - struct ieee80211_fast_tx *fast_tx,
  5959. -@@ -2811,6 +2972,10 @@ static bool ieee80211_xmit_fast(struct i
  5960. -
  5961. - ieee80211_tx_stats(dev, skb->len + extra_head);
  5962. -
  5963. -+ if ((hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) &&
  5964. -+ ieee80211_amsdu_aggregate(sdata, sta, fast_tx, skb))
  5965. -+ return true;
  5966. -+
  5967. - /* will not be crypto-handled beyond what we do here, so use false
  5968. - * as the may-encrypt argument for the resize to not account for
  5969. - * more room than we already have in 'extra_head'
  5970. 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
  5971. deleted file mode 100644
  5972. index 9277b2c..0000000
  5973. --- a/package/kernel/mac80211/patches/323-0000-brcmfmac-fix-setting-primary-channel-for-80-MHz-widt.patch
  5974. +++ /dev/null
  5975. @@ -1,64 +0,0 @@
  5976. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  5977. -Date: Wed, 20 Jan 2016 16:46:04 +0100
  5978. -Subject: [PATCH] brcmfmac: fix setting primary channel for 80 MHz width
  5979. -MIME-Version: 1.0
  5980. -Content-Type: text/plain; charset=UTF-8
  5981. -Content-Transfer-Encoding: 8bit
  5982. -
  5983. -First of all it changes the way we calculate primary channel offset. If
  5984. -we use e.g. 80 MHz channel with primary frequency 5180 MHz (which means
  5985. -center frequency is 5210 MHz) it makes sense to calculate primary offset
  5986. -as -30 MHz.
  5987. -Then it fixes values we compare primary_offset with. We were comparing
  5988. -offset in MHz against -2 or 2 which was resulting in picking a wrong
  5989. -primary channel.
  5990. -
  5991. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  5992. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  5993. ----
  5994. -
  5995. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  5996. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  5997. -@@ -247,7 +247,7 @@ static u16 chandef_to_chanspec(struct br
  5998. - brcmf_dbg(TRACE, "chandef: control %d center %d width %d\n",
  5999. - ch->chan->center_freq, ch->center_freq1, ch->width);
  6000. - ch_inf.chnum = ieee80211_frequency_to_channel(ch->center_freq1);
  6001. -- primary_offset = ch->center_freq1 - ch->chan->center_freq;
  6002. -+ primary_offset = ch->chan->center_freq - ch->center_freq1;
  6003. - switch (ch->width) {
  6004. - case NL80211_CHAN_WIDTH_20:
  6005. - case NL80211_CHAN_WIDTH_20_NOHT:
  6006. -@@ -256,24 +256,21 @@ static u16 chandef_to_chanspec(struct br
  6007. - break;
  6008. - case NL80211_CHAN_WIDTH_40:
  6009. - ch_inf.bw = BRCMU_CHAN_BW_40;
  6010. -- if (primary_offset < 0)
  6011. -+ if (primary_offset > 0)
  6012. - ch_inf.sb = BRCMU_CHAN_SB_U;
  6013. - else
  6014. - ch_inf.sb = BRCMU_CHAN_SB_L;
  6015. - break;
  6016. - case NL80211_CHAN_WIDTH_80:
  6017. - ch_inf.bw = BRCMU_CHAN_BW_80;
  6018. -- if (primary_offset < 0) {
  6019. -- if (primary_offset < -CH_10MHZ_APART)
  6020. -- ch_inf.sb = BRCMU_CHAN_SB_UU;
  6021. -- else
  6022. -- ch_inf.sb = BRCMU_CHAN_SB_UL;
  6023. -- } else {
  6024. -- if (primary_offset > CH_10MHZ_APART)
  6025. -- ch_inf.sb = BRCMU_CHAN_SB_LL;
  6026. -- else
  6027. -- ch_inf.sb = BRCMU_CHAN_SB_LU;
  6028. -- }
  6029. -+ if (primary_offset == -30)
  6030. -+ ch_inf.sb = BRCMU_CHAN_SB_LL;
  6031. -+ else if (primary_offset == -10)
  6032. -+ ch_inf.sb = BRCMU_CHAN_SB_LU;
  6033. -+ else if (primary_offset == 10)
  6034. -+ ch_inf.sb = BRCMU_CHAN_SB_UL;
  6035. -+ else
  6036. -+ ch_inf.sb = BRCMU_CHAN_SB_UU;
  6037. - break;
  6038. - case NL80211_CHAN_WIDTH_80P80:
  6039. - case NL80211_CHAN_WIDTH_160:
  6040. 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
  6041. deleted file mode 100644
  6042. index d7018da..0000000
  6043. --- a/package/kernel/mac80211/patches/323-0001-brcmfmac-analyze-descriptors-of-current-component-on.patch
  6044. +++ /dev/null
  6045. @@ -1,51 +0,0 @@
  6046. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  6047. -Date: Tue, 26 Jan 2016 17:57:01 +0100
  6048. -Subject: [PATCH] brcmfmac: analyze descriptors of current component only
  6049. -MIME-Version: 1.0
  6050. -Content-Type: text/plain; charset=UTF-8
  6051. -Content-Transfer-Encoding: 8bit
  6052. -
  6053. -So far we were looking for address descriptors without a check for
  6054. -crossing current component border. In case of dealing with unsupported
  6055. -descriptor or descriptor missing at all the code would incorrectly get
  6056. -data from another component.
  6057. -
  6058. -Consider this binary-described component from BCM4366 EROM:
  6059. -4bf83b01 TAG==CI CID==0x83b
  6060. -20080201 TAG==CI PORTS==0+1 WRAPPERS==0+1
  6061. -18400035 TAG==ADDR SZ_SZD TYPE_SLAVE
  6062. -00050000
  6063. -18107085 TAG==ADDR SZ_4K TYPE_SWRAP
  6064. -
  6065. -Driver was assigning invalid base address to this core:
  6066. -brcmfmac: [6 ] core 0x83b:32 base 0x18109000 wrap 0x18107000
  6067. -which came from totally different component defined in EROM:
  6068. -43b36701 TAG==CI CID==0x367
  6069. -00000201 TAG==CI PORTS==0+1 WRAPPERS==0+0
  6070. -18109005 TAG==ADDR SZ_4K TYPE_SLAVE
  6071. -
  6072. -This change will also allow us to support components without wrapper
  6073. -address in the future.
  6074. -
  6075. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  6076. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6077. ----
  6078. -
  6079. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  6080. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  6081. -@@ -803,7 +803,14 @@ static int brcmf_chip_dmp_get_regaddr(st
  6082. - *eromaddr -= 4;
  6083. - return -EFAULT;
  6084. - }
  6085. -- } while (desc != DMP_DESC_ADDRESS);
  6086. -+ } while (desc != DMP_DESC_ADDRESS &&
  6087. -+ desc != DMP_DESC_COMPONENT);
  6088. -+
  6089. -+ /* stop if we crossed current component border */
  6090. -+ if (desc == DMP_DESC_COMPONENT) {
  6091. -+ *eromaddr -= 4;
  6092. -+ return 0;
  6093. -+ }
  6094. -
  6095. - /* skip upper 32-bit address descriptor */
  6096. - if (val & DMP_DESC_ADDRSIZE_GT32)
  6097. 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
  6098. deleted file mode 100644
  6099. index 045ab49..0000000
  6100. --- a/package/kernel/mac80211/patches/323-0002-brcmfmac-allow-storing-PMU-core-without-wrapper-addr.patch
  6101. +++ /dev/null
  6102. @@ -1,28 +0,0 @@
  6103. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  6104. -Date: Tue, 26 Jan 2016 17:57:02 +0100
  6105. -Subject: [PATCH] brcmfmac: allow storing PMU core without wrapper address
  6106. -MIME-Version: 1.0
  6107. -Content-Type: text/plain; charset=UTF-8
  6108. -Content-Transfer-Encoding: 8bit
  6109. -
  6110. -Separated PMU core can be found in new devices and should be used for
  6111. -accessing PMU registers (which were routed through ChipCommon so far).
  6112. -This core is one of exceptions that doesn't have or need wrapper address
  6113. -to be still safely accessible.
  6114. -
  6115. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  6116. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6117. ----
  6118. -
  6119. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  6120. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  6121. -@@ -883,7 +883,8 @@ int brcmf_chip_dmp_erom_scan(struct brcm
  6122. - rev = (val & DMP_COMP_REVISION) >> DMP_COMP_REVISION_S;
  6123. -
  6124. - /* need core with ports */
  6125. -- if (nmw + nsw == 0)
  6126. -+ if (nmw + nsw == 0 &&
  6127. -+ id != BCMA_CORE_PMU)
  6128. - continue;
  6129. -
  6130. - /* try to obtain register address info */
  6131. 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
  6132. deleted file mode 100644
  6133. index 7b7ba4f..0000000
  6134. --- a/package/kernel/mac80211/patches/323-0003-brcmfmac-read-extended-capabilities-of-ChipCommon-co.patch
  6135. +++ /dev/null
  6136. @@ -1,43 +0,0 @@
  6137. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  6138. -Date: Tue, 26 Jan 2016 17:57:03 +0100
  6139. -Subject: [PATCH] brcmfmac: read extended capabilities of ChipCommon core
  6140. -MIME-Version: 1.0
  6141. -Content-Type: text/plain; charset=UTF-8
  6142. -Content-Transfer-Encoding: 8bit
  6143. -
  6144. -This is an extra bitfield with info about some present hardware.
  6145. -
  6146. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  6147. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6148. ----
  6149. -
  6150. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  6151. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  6152. -@@ -1025,6 +1025,9 @@ static int brcmf_chip_setup(struct brcmf
  6153. - /* get chipcommon capabilites */
  6154. - pub->cc_caps = chip->ops->read32(chip->ctx,
  6155. - CORE_CC_REG(base, capabilities));
  6156. -+ pub->cc_caps_ext = chip->ops->read32(chip->ctx,
  6157. -+ CORE_CC_REG(base,
  6158. -+ capabilities_ext));
  6159. -
  6160. - /* get pmu caps & rev */
  6161. - if (pub->cc_caps & CC_CAP_PMU) {
  6162. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
  6163. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
  6164. -@@ -27,6 +27,7 @@
  6165. - * @chip: chip identifier.
  6166. - * @chiprev: chip revision.
  6167. - * @cc_caps: chipcommon core capabilities.
  6168. -+ * @cc_caps_ext: chipcommon core extended capabilities.
  6169. - * @pmucaps: PMU capabilities.
  6170. - * @pmurev: PMU revision.
  6171. - * @rambase: RAM base address (only applicable for ARM CR4 chips).
  6172. -@@ -38,6 +39,7 @@ struct brcmf_chip {
  6173. - u32 chip;
  6174. - u32 chiprev;
  6175. - u32 cc_caps;
  6176. -+ u32 cc_caps_ext;
  6177. - u32 pmucaps;
  6178. - u32 pmurev;
  6179. - u32 rambase;
  6180. 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
  6181. deleted file mode 100644
  6182. index 2af6fd9..0000000
  6183. --- a/package/kernel/mac80211/patches/323-0004-brcmfmac-access-PMU-registers-using-standalone-PMU-c.patch
  6184. +++ /dev/null
  6185. @@ -1,148 +0,0 @@
  6186. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  6187. -Date: Tue, 26 Jan 2016 17:57:04 +0100
  6188. -Subject: [PATCH] brcmfmac: access PMU registers using standalone PMU core if
  6189. - available
  6190. -MIME-Version: 1.0
  6191. -Content-Type: text/plain; charset=UTF-8
  6192. -Content-Transfer-Encoding: 8bit
  6193. -
  6194. -On recent Broadcom chipsets PMU is present as separated core and it
  6195. -can't be accessed using ChipCommon anymore as it fails with e.g.:
  6196. -[ 18.198412] Unhandled fault: imprecise external abort (0x1406) at 0xb6da200f
  6197. -
  6198. -Add a new helper function that will return a proper core that should be
  6199. -used for accessing PMU registers.
  6200. -
  6201. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  6202. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6203. ----
  6204. -
  6205. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  6206. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  6207. -@@ -1014,6 +1014,7 @@ static int brcmf_chip_setup(struct brcmf
  6208. - {
  6209. - struct brcmf_chip *pub;
  6210. - struct brcmf_core_priv *cc;
  6211. -+ struct brcmf_core *pmu;
  6212. - u32 base;
  6213. - u32 val;
  6214. - int ret = 0;
  6215. -@@ -1030,9 +1031,10 @@ static int brcmf_chip_setup(struct brcmf
  6216. - capabilities_ext));
  6217. -
  6218. - /* get pmu caps & rev */
  6219. -+ pmu = brcmf_chip_get_pmu(pub); /* after reading cc_caps_ext */
  6220. - if (pub->cc_caps & CC_CAP_PMU) {
  6221. - val = chip->ops->read32(chip->ctx,
  6222. -- CORE_CC_REG(base, pmucapabilities));
  6223. -+ CORE_CC_REG(pmu->base, pmucapabilities));
  6224. - pub->pmurev = val & PCAP_REV_MASK;
  6225. - pub->pmucaps = val;
  6226. - }
  6227. -@@ -1131,6 +1133,23 @@ struct brcmf_core *brcmf_chip_get_chipco
  6228. - return &cc->pub;
  6229. - }
  6230. -
  6231. -+struct brcmf_core *brcmf_chip_get_pmu(struct brcmf_chip *pub)
  6232. -+{
  6233. -+ struct brcmf_core *cc = brcmf_chip_get_chipcommon(pub);
  6234. -+ struct brcmf_core *pmu;
  6235. -+
  6236. -+ /* See if there is separated PMU core available */
  6237. -+ if (cc->rev >= 35 &&
  6238. -+ pub->cc_caps_ext & BCMA_CC_CAP_EXT_AOB_PRESENT) {
  6239. -+ pmu = brcmf_chip_get_core(pub, BCMA_CORE_PMU);
  6240. -+ if (pmu)
  6241. -+ return pmu;
  6242. -+ }
  6243. -+
  6244. -+ /* Fallback to ChipCommon core for older hardware */
  6245. -+ return cc;
  6246. -+}
  6247. -+
  6248. - bool brcmf_chip_iscoreup(struct brcmf_core *pub)
  6249. - {
  6250. - struct brcmf_core_priv *core;
  6251. -@@ -1301,6 +1320,7 @@ bool brcmf_chip_sr_capable(struct brcmf_
  6252. - {
  6253. - u32 base, addr, reg, pmu_cc3_mask = ~0;
  6254. - struct brcmf_chip_priv *chip;
  6255. -+ struct brcmf_core *pmu = brcmf_chip_get_pmu(pub);
  6256. -
  6257. - brcmf_dbg(TRACE, "Enter\n");
  6258. -
  6259. -@@ -1320,9 +1340,9 @@ bool brcmf_chip_sr_capable(struct brcmf_
  6260. - case BRCM_CC_4335_CHIP_ID:
  6261. - case BRCM_CC_4339_CHIP_ID:
  6262. - /* read PMU chipcontrol register 3 */
  6263. -- addr = CORE_CC_REG(base, chipcontrol_addr);
  6264. -+ addr = CORE_CC_REG(pmu->base, chipcontrol_addr);
  6265. - chip->ops->write32(chip->ctx, addr, 3);
  6266. -- addr = CORE_CC_REG(base, chipcontrol_data);
  6267. -+ addr = CORE_CC_REG(pmu->base, chipcontrol_data);
  6268. - reg = chip->ops->read32(chip->ctx, addr);
  6269. - return (reg & pmu_cc3_mask) != 0;
  6270. - case BRCM_CC_43430_CHIP_ID:
  6271. -@@ -1330,12 +1350,12 @@ bool brcmf_chip_sr_capable(struct brcmf_
  6272. - reg = chip->ops->read32(chip->ctx, addr);
  6273. - return reg != 0;
  6274. - default:
  6275. -- addr = CORE_CC_REG(base, pmucapabilities_ext);
  6276. -+ addr = CORE_CC_REG(pmu->base, pmucapabilities_ext);
  6277. - reg = chip->ops->read32(chip->ctx, addr);
  6278. - if ((reg & PCAPEXT_SR_SUPPORTED_MASK) == 0)
  6279. - return false;
  6280. -
  6281. -- addr = CORE_CC_REG(base, retention_ctl);
  6282. -+ addr = CORE_CC_REG(pmu->base, retention_ctl);
  6283. - reg = chip->ops->read32(chip->ctx, addr);
  6284. - return (reg & (PMU_RCTL_MACPHY_DISABLE_MASK |
  6285. - PMU_RCTL_LOGIC_DISABLE_MASK)) == 0;
  6286. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
  6287. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
  6288. -@@ -85,6 +85,7 @@ struct brcmf_chip *brcmf_chip_attach(voi
  6289. - void brcmf_chip_detach(struct brcmf_chip *chip);
  6290. - struct brcmf_core *brcmf_chip_get_core(struct brcmf_chip *chip, u16 coreid);
  6291. - struct brcmf_core *brcmf_chip_get_chipcommon(struct brcmf_chip *chip);
  6292. -+struct brcmf_core *brcmf_chip_get_pmu(struct brcmf_chip *pub);
  6293. - bool brcmf_chip_iscoreup(struct brcmf_core *core);
  6294. - void brcmf_chip_coredisable(struct brcmf_core *core, u32 prereset, u32 reset);
  6295. - void brcmf_chip_resetcore(struct brcmf_core *core, u32 prereset, u32 reset,
  6296. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  6297. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  6298. -@@ -3615,7 +3615,6 @@ brcmf_sdio_drivestrengthinit(struct brcm
  6299. - const struct sdiod_drive_str *str_tab = NULL;
  6300. - u32 str_mask;
  6301. - u32 str_shift;
  6302. -- u32 base;
  6303. - u32 i;
  6304. - u32 drivestrength_sel = 0;
  6305. - u32 cc_data_temp;
  6306. -@@ -3658,14 +3657,15 @@ brcmf_sdio_drivestrengthinit(struct brcm
  6307. - }
  6308. -
  6309. - if (str_tab != NULL) {
  6310. -+ struct brcmf_core *pmu = brcmf_chip_get_pmu(ci);
  6311. -+
  6312. - for (i = 0; str_tab[i].strength != 0; i++) {
  6313. - if (drivestrength >= str_tab[i].strength) {
  6314. - drivestrength_sel = str_tab[i].sel;
  6315. - break;
  6316. - }
  6317. - }
  6318. -- base = brcmf_chip_get_chipcommon(ci)->base;
  6319. -- addr = CORE_CC_REG(base, chipcontrol_addr);
  6320. -+ addr = CORE_CC_REG(pmu->base, chipcontrol_addr);
  6321. - brcmf_sdiod_regwl(sdiodev, addr, 1, NULL);
  6322. - cc_data_temp = brcmf_sdiod_regrl(sdiodev, addr, NULL);
  6323. - cc_data_temp &= ~str_mask;
  6324. -@@ -3835,8 +3835,7 @@ brcmf_sdio_probe_attach(struct brcmf_sdi
  6325. - goto fail;
  6326. -
  6327. - /* set PMUControl so a backplane reset does PMU state reload */
  6328. -- reg_addr = CORE_CC_REG(brcmf_chip_get_chipcommon(bus->ci)->base,
  6329. -- pmucontrol);
  6330. -+ reg_addr = CORE_CC_REG(brcmf_chip_get_pmu(bus->ci)->base, pmucontrol);
  6331. - reg_val = brcmf_sdiod_regrl(bus->sdiodev, reg_addr, &err);
  6332. - if (err)
  6333. - goto fail;
  6334. 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
  6335. deleted file mode 100644
  6336. index 35887fc..0000000
  6337. --- a/package/kernel/mac80211/patches/323-0005-brcmfmac-add-support-for-14e4-4365-PCI-ID-with-BCM43.patch
  6338. +++ /dev/null
  6339. @@ -1,38 +0,0 @@
  6340. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  6341. -Date: Tue, 26 Jan 2016 17:57:05 +0100
  6342. -Subject: [PATCH] brcmfmac: add support for 14e4:4365 PCI ID with BCM4366
  6343. - chipset
  6344. -MIME-Version: 1.0
  6345. -Content-Type: text/plain; charset=UTF-8
  6346. -Content-Transfer-Encoding: 8bit
  6347. -
  6348. -On Broadcom ARM routers BCM4366 cards are available with 14e4:4365 ID.
  6349. -Unfortunately this ID was already used by Broadcom for cards with
  6350. -BCM43142, a totally different chipset requiring SoftMAC driver. To avoid
  6351. -a conflict between brcmfmac and bcma use more specific ID entry with
  6352. -subvendor and subdevice specified.
  6353. -
  6354. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  6355. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6356. ----
  6357. -
  6358. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  6359. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  6360. -@@ -1951,6 +1951,9 @@ static const struct dev_pm_ops brcmf_pci
  6361. -
  6362. - #define BRCMF_PCIE_DEVICE(dev_id) { BRCM_PCIE_VENDOR_ID_BROADCOM, dev_id,\
  6363. - PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_NETWORK_OTHER << 8, 0xffff00, 0 }
  6364. -+#define BRCMF_PCIE_DEVICE_SUB(dev_id, subvend, subdev) { \
  6365. -+ BRCM_PCIE_VENDOR_ID_BROADCOM, dev_id,\
  6366. -+ subvend, subdev, PCI_CLASS_NETWORK_OTHER << 8, 0xffff00, 0 }
  6367. -
  6368. - static struct pci_device_id brcmf_pcie_devid_table[] = {
  6369. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4350_DEVICE_ID),
  6370. -@@ -1966,6 +1969,7 @@ static struct pci_device_id brcmf_pcie_d
  6371. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_DEVICE_ID),
  6372. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_2G_DEVICE_ID),
  6373. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_5G_DEVICE_ID),
  6374. -+ BRCMF_PCIE_DEVICE_SUB(0x4365, BRCM_PCIE_VENDOR_ID_BROADCOM, 0x4365),
  6375. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_DEVICE_ID),
  6376. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_2G_DEVICE_ID),
  6377. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_5G_DEVICE_ID),
  6378. 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
  6379. new file mode 100644
  6380. index 0000000..59ac29b
  6381. --- /dev/null
  6382. +++ b/package/kernel/mac80211/patches/323-ath9k-Fix-programming-of-minCCA-power-threshold.patch
  6383. @@ -0,0 +1,26 @@
  6384. +From: Sven Eckelmann <sven@narfation.org>
  6385. +Date: Fri, 17 Jun 2016 11:58:20 +0200
  6386. +Subject: [PATCH] ath9k: Fix programming of minCCA power threshold
  6387. +
  6388. +The function ar9003_hw_apply_minccapwr_thresh takes as second parameter not
  6389. +a pointer to the channel but a boolean value describing whether the channel
  6390. +is 2.4GHz or not. This broke (according to the origin commit) the ETSI
  6391. +regulatory compliance on 5GHz channels.
  6392. +
  6393. +Fixes: 3533bf6b15a0 ("ath9k: Fix regulatory compliance")
  6394. +Signed-off-by: Sven Eckelmann <sven@narfation.org>
  6395. +Cc: Simon Wunderlich <sw@simonwunderlich.de>
  6396. +Cc: Sujith Manoharan <c_manoha@qca.qualcomm.com>
  6397. +---
  6398. +
  6399. +--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
  6400. ++++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
  6401. +@@ -4175,7 +4175,7 @@ static void ath9k_hw_ar9300_set_board_va
  6402. + if (!AR_SREV_9330(ah) && !AR_SREV_9340(ah) && !AR_SREV_9531(ah))
  6403. + ar9003_hw_internal_regulator_apply(ah);
  6404. + ar9003_hw_apply_tuning_caps(ah);
  6405. +- ar9003_hw_apply_minccapwr_thresh(ah, chan);
  6406. ++ ar9003_hw_apply_minccapwr_thresh(ah, is2ghz);
  6407. + ar9003_hw_txend_to_xpa_off_apply(ah, is2ghz);
  6408. + ar9003_hw_thermometer_apply(ah);
  6409. + ar9003_hw_thermo_cal_apply(ah);
  6410. 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
  6411. new file mode 100644
  6412. index 0000000..b6f4868
  6413. --- /dev/null
  6414. +++ b/package/kernel/mac80211/patches/324-ath9k_hw-fix-spectral-scan-on-AR9285-and-newer.patch
  6415. @@ -0,0 +1,86 @@
  6416. +From: Felix Fietkau <nbd@nbd.name>
  6417. +Date: Mon, 11 Jul 2016 10:34:37 +0200
  6418. +Subject: [PATCH] ath9k_hw: fix spectral scan on AR9285 and newer
  6419. +
  6420. +The register layout of AR_PHY_SPECTRAL_SCAN has changed, only AR9280
  6421. +uses the old layout
  6422. +
  6423. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  6424. +---
  6425. +
  6426. +--- a/drivers/net/wireless/ath/ath9k/ar9002_phy.c
  6427. ++++ b/drivers/net/wireless/ath/ath9k/ar9002_phy.c
  6428. +@@ -476,6 +476,7 @@ static void ar9002_hw_set_bt_ant_diversi
  6429. + static void ar9002_hw_spectral_scan_config(struct ath_hw *ah,
  6430. + struct ath_spec_scan *param)
  6431. + {
  6432. ++ u32 repeat_bit;
  6433. + u8 count;
  6434. +
  6435. + if (!param->enabled) {
  6436. +@@ -486,12 +487,15 @@ static void ar9002_hw_spectral_scan_conf
  6437. + REG_SET_BIT(ah, AR_PHY_RADAR_0, AR_PHY_RADAR_0_FFT_ENA);
  6438. + REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN, AR_PHY_SPECTRAL_SCAN_ENABLE);
  6439. +
  6440. ++ if (AR_SREV_9280(ah))
  6441. ++ repeat_bit = AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT;
  6442. ++ else
  6443. ++ repeat_bit = AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_KIWI;
  6444. ++
  6445. + if (param->short_repeat)
  6446. +- REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN,
  6447. +- AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT);
  6448. ++ REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN, repeat_bit);
  6449. + else
  6450. +- REG_CLR_BIT(ah, AR_PHY_SPECTRAL_SCAN,
  6451. +- AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT);
  6452. ++ REG_CLR_BIT(ah, AR_PHY_SPECTRAL_SCAN, repeat_bit);
  6453. +
  6454. + /* on AR92xx, the highest bit of count will make the the chip send
  6455. + * spectral samples endlessly. Check if this really was intended,
  6456. +@@ -499,15 +503,25 @@ static void ar9002_hw_spectral_scan_conf
  6457. + */
  6458. + count = param->count;
  6459. + if (param->endless) {
  6460. +- if (AR_SREV_9271(ah))
  6461. +- count = 0;
  6462. +- else
  6463. ++ if (AR_SREV_9280(ah))
  6464. + count = 0x80;
  6465. ++ else
  6466. ++ count = 0;
  6467. + } else if (count & 0x80)
  6468. + count = 0x7f;
  6469. ++ else if (!count)
  6470. ++ count = 1;
  6471. ++
  6472. ++ if (AR_SREV_9280(ah)) {
  6473. ++ REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN,
  6474. ++ AR_PHY_SPECTRAL_SCAN_COUNT, count);
  6475. ++ } else {
  6476. ++ REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN,
  6477. ++ AR_PHY_SPECTRAL_SCAN_COUNT_KIWI, count);
  6478. ++ REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN,
  6479. ++ AR_PHY_SPECTRAL_SCAN_PHYERR_MASK_SELECT);
  6480. ++ }
  6481. +
  6482. +- REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN,
  6483. +- AR_PHY_SPECTRAL_SCAN_COUNT, count);
  6484. + REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN,
  6485. + AR_PHY_SPECTRAL_SCAN_PERIOD, param->period);
  6486. + REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN,
  6487. +--- a/drivers/net/wireless/ath/ath9k/ar9002_phy.h
  6488. ++++ b/drivers/net/wireless/ath/ath9k/ar9002_phy.h
  6489. +@@ -177,8 +177,11 @@
  6490. + #define AR_PHY_SPECTRAL_SCAN_PERIOD_S 8
  6491. + #define AR_PHY_SPECTRAL_SCAN_COUNT 0x00FF0000 /* Number of reports, reg 68, bits 16-23*/
  6492. + #define AR_PHY_SPECTRAL_SCAN_COUNT_S 16
  6493. ++#define AR_PHY_SPECTRAL_SCAN_COUNT_KIWI 0x0FFF0000 /* Number of reports, reg 68, bits 16-27*/
  6494. ++#define AR_PHY_SPECTRAL_SCAN_COUNT_KIWI_S 16
  6495. + #define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT 0x01000000 /* Short repeat, reg 68, bit 24*/
  6496. +-#define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_S 24 /* Short repeat, reg 68, bit 24*/
  6497. ++#define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_KIWI 0x10000000 /* Short repeat, reg 68, bit 28*/
  6498. ++#define AR_PHY_SPECTRAL_SCAN_PHYERR_MASK_SELECT 0x40000000
  6499. +
  6500. + #define AR_PHY_RX_DELAY 0x9914
  6501. + #define AR_PHY_SEARCH_START_DELAY 0x9918
  6502. 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
  6503. deleted file mode 100644
  6504. index 6ce60f1..0000000
  6505. --- a/package/kernel/mac80211/patches/324-brcmfmac-treat-NULL-character-in-NVRAM-as-separator.patch
  6506. +++ /dev/null
  6507. @@ -1,32 +0,0 @@
  6508. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  6509. -Date: Sun, 31 Jan 2016 12:14:34 +0100
  6510. -Subject: [PATCH] brcmfmac: treat NULL character in NVRAM as separator
  6511. -MIME-Version: 1.0
  6512. -Content-Type: text/plain; charset=UTF-8
  6513. -Content-Transfer-Encoding: 8bit
  6514. -
  6515. -Platform NVRAM (stored on a flash partition) has entries separated by a
  6516. -NULL (\0) char. Our parsing code switches from VALUE state to IDLE
  6517. -whenever it meets a NULL (\0). When that happens our IDLE handler should
  6518. -simply consume it and analyze whatever is placed ahead.
  6519. -
  6520. -This fixes harmless warnings spamming debugging output:
  6521. -[ 155.165624] brcmfmac: brcmf_nvram_handle_idle warning: ln=1:col=20: ignoring invalid character
  6522. -[ 155.180806] brcmfmac: brcmf_nvram_handle_idle warning: ln=1:col=44: ignoring invalid character
  6523. -[ 155.195971] brcmfmac: brcmf_nvram_handle_idle warning: ln=1:col=63: ignoring invalid character
  6524. -
  6525. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  6526. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6527. ----
  6528. -
  6529. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  6530. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  6531. -@@ -93,7 +93,7 @@ static enum nvram_parser_state brcmf_nvr
  6532. - c = nvp->data[nvp->pos];
  6533. - if (c == '\n')
  6534. - return COMMENT;
  6535. -- if (is_whitespace(c))
  6536. -+ if (is_whitespace(c) || c == '\0')
  6537. - goto proceed;
  6538. - if (c == '#')
  6539. - return COMMENT;
  6540. 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
  6541. new file mode 100644
  6542. index 0000000..6685f33
  6543. --- /dev/null
  6544. +++ b/package/kernel/mac80211/patches/325-ath9k_hw-fix-duplicate-and-partially-wrong-definitio.patch
  6545. @@ -0,0 +1,57 @@
  6546. +From: Felix Fietkau <nbd@nbd.name>
  6547. +Date: Mon, 11 Jul 2016 11:31:39 +0200
  6548. +Subject: [PATCH] ath9k_hw: fix duplicate (and partially wrong) definition
  6549. + of AR_CH0_THERM
  6550. +
  6551. +AR_PHY_65NM_CH0_THERM and AR_CH0_THERM were supposed to refer to the
  6552. +same register, however they had different SREV checks.
  6553. +
  6554. +Remove the duplicate and use the checks. Since there were other SREV
  6555. +checks present in the only place that uses this, this will probaby not
  6556. +affect runtime behavior.
  6557. +
  6558. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  6559. +---
  6560. +
  6561. +--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.h
  6562. ++++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.h
  6563. +@@ -689,13 +689,6 @@
  6564. + #define AR_CH0_TOP_XPABIASLVL (AR_SREV_9550(ah) ? 0x3c0 : 0x300)
  6565. + #define AR_CH0_TOP_XPABIASLVL_S (AR_SREV_9550(ah) ? 6 : 8)
  6566. +
  6567. +-#define AR_CH0_THERM (AR_SREV_9300(ah) ? 0x16290 : \
  6568. +- ((AR_SREV_9485(ah) ? 0x1628c : 0x16294)))
  6569. +-#define AR_CH0_THERM_XPABIASLVL_MSB 0x3
  6570. +-#define AR_CH0_THERM_XPABIASLVL_MSB_S 0
  6571. +-#define AR_CH0_THERM_XPASHORT2GND 0x4
  6572. +-#define AR_CH0_THERM_XPASHORT2GND_S 2
  6573. +-
  6574. + #define AR_SWITCH_TABLE_COM_ALL (0xffff)
  6575. + #define AR_SWITCH_TABLE_COM_ALL_S (0)
  6576. + #define AR_SWITCH_TABLE_COM_AR9462_ALL (0xffffff)
  6577. +@@ -712,15 +705,17 @@
  6578. + #define AR_SWITCH_TABLE_ALL (0xfff)
  6579. + #define AR_SWITCH_TABLE_ALL_S (0)
  6580. +
  6581. +-#define AR_PHY_65NM_CH0_THERM (AR_SREV_9300(ah) ? 0x16290 :\
  6582. +- ((AR_SREV_9462(ah) || AR_SREV_9565(ah)) ? 0x16294 : 0x1628c))
  6583. ++#define AR_CH0_THERM (AR_SREV_9300(ah) ? 0x16290 :\
  6584. ++ ((AR_SREV_9462(ah) || AR_SREV_9565(ah)) ? 0x16294 : 0x1628c))
  6585. ++#define AR_CH0_THERM_XPABIASLVL_MSB 0x3
  6586. ++#define AR_CH0_THERM_XPABIASLVL_MSB_S 0
  6587. ++#define AR_CH0_THERM_XPASHORT2GND 0x4
  6588. ++#define AR_CH0_THERM_XPASHORT2GND_S 2
  6589. +
  6590. +-#define AR_PHY_65NM_CH0_THERM_LOCAL 0x80000000
  6591. +-#define AR_PHY_65NM_CH0_THERM_LOCAL_S 31
  6592. +-#define AR_PHY_65NM_CH0_THERM_START 0x20000000
  6593. +-#define AR_PHY_65NM_CH0_THERM_START_S 29
  6594. +-#define AR_PHY_65NM_CH0_THERM_SAR_ADC_OUT 0x0000ff00
  6595. +-#define AR_PHY_65NM_CH0_THERM_SAR_ADC_OUT_S 8
  6596. ++#define AR_CH0_THERM_LOCAL 0x80000000
  6597. ++#define AR_CH0_THERM_START 0x20000000
  6598. ++#define AR_CH0_THERM_SAR_ADC_OUT 0x0000ff00
  6599. ++#define AR_CH0_THERM_SAR_ADC_OUT_S 8
  6600. +
  6601. + #define AR_CH0_TOP2 (AR_SREV_9300(ah) ? 0x1628c : \
  6602. + (AR_SREV_9462(ah) ? 0x16290 : 0x16284))
  6603. 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
  6604. deleted file mode 100644
  6605. index 012dea1..0000000
  6606. --- a/package/kernel/mac80211/patches/325-brcmfmac-sdio-Increase-the-default-timeouts-a-bit.patch
  6607. +++ /dev/null
  6608. @@ -1,41 +0,0 @@
  6609. -From: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
  6610. -Date: Mon, 25 Jan 2016 11:47:29 +0100
  6611. -Subject: [PATCH] brcmfmac: sdio: Increase the default timeouts a bit
  6612. -
  6613. -On a Radxa Rock2 board with a Ampak AP6335 (Broadcom 4339 core) it seems
  6614. -the card responds very quickly most of the time, unfortunately during
  6615. -initialisation it sometimes seems to take just a bit over 2 seconds to
  6616. -respond.
  6617. -
  6618. -This results intialization failing with message like:
  6619. - brcmf_c_preinit_dcmds: Retreiving cur_etheraddr failed, -52
  6620. - brcmf_bus_start: failed: -52
  6621. - brcmf_sdio_firmware_callback: dongle is not responding
  6622. -
  6623. -Increasing the timeout to allow for a bit more headroom allows the
  6624. -card to initialize reliably.
  6625. -
  6626. -A quick search online after diagnosing/fixing this showed that Google
  6627. -has a similar patch in their ChromeOS tree, so this doesn't seem
  6628. -specific to the board I'm using.
  6629. -
  6630. -Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
  6631. -Reviewed-by: Julian Calaby <julian.calaby@gmail.com>
  6632. -Acked-by: Arend van Spriel <arend@broadcom.com>
  6633. -Reviewed-by: Douglas Anderson <dianders@chromium.org>
  6634. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6635. ----
  6636. -
  6637. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  6638. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  6639. -@@ -45,8 +45,8 @@
  6640. - #include "chip.h"
  6641. - #include "firmware.h"
  6642. -
  6643. --#define DCMD_RESP_TIMEOUT msecs_to_jiffies(2000)
  6644. --#define CTL_DONE_TIMEOUT msecs_to_jiffies(2000)
  6645. -+#define DCMD_RESP_TIMEOUT msecs_to_jiffies(2500)
  6646. -+#define CTL_DONE_TIMEOUT msecs_to_jiffies(2500)
  6647. -
  6648. - #ifdef DEBUG
  6649. -
  6650. 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
  6651. deleted file mode 100644
  6652. index 71f7a40..0000000
  6653. --- a/package/kernel/mac80211/patches/326-ath9k-make-NF-load-complete-quickly-and-reliably.patch
  6654. +++ /dev/null
  6655. @@ -1,87 +0,0 @@
  6656. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  6657. -Date: Fri, 5 Feb 2016 09:45:50 +0800
  6658. -Subject: [PATCH] ath9k: make NF load complete quickly and reliably
  6659. -
  6660. -Make NF load complete quickly and reliably. NF load execution
  6661. -is delayed by HW to end of frame if frame Rx or Tx is ongoing.
  6662. -Increasing timeout to max frame duration. If NF cal is ongoing
  6663. -before NF load, stop it before load, and restart it afterwards.
  6664. -
  6665. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  6666. ----
  6667. -
  6668. ---- a/drivers/net/wireless/ath/ath9k/calib.c
  6669. -+++ b/drivers/net/wireless/ath/ath9k/calib.c
  6670. -@@ -241,6 +241,7 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  6671. - u8 chainmask = (ah->rxchainmask << 3) | ah->rxchainmask;
  6672. - struct ath_common *common = ath9k_hw_common(ah);
  6673. - s16 default_nf = ath9k_hw_get_default_nf(ah, chan);
  6674. -+ u32 bb_agc_ctl = REG_READ(ah, AR_PHY_AGC_CONTROL);
  6675. -
  6676. - if (ah->caldata)
  6677. - h = ah->caldata->nfCalHist;
  6678. -@@ -264,6 +265,16 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  6679. - }
  6680. -
  6681. - /*
  6682. -+ * stop NF cal if ongoing to ensure NF load completes immediately
  6683. -+ * (or after end rx/tx frame if ongoing)
  6684. -+ */
  6685. -+ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_NF) {
  6686. -+ REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF);
  6687. -+ REG_RMW_BUFFER_FLUSH(ah);
  6688. -+ ENABLE_REG_RMW_BUFFER(ah);
  6689. -+ }
  6690. -+
  6691. -+ /*
  6692. - * Load software filtered NF value into baseband internal minCCApwr
  6693. - * variable.
  6694. - */
  6695. -@@ -276,18 +287,33 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  6696. -
  6697. - /*
  6698. - * Wait for load to complete, should be fast, a few 10s of us.
  6699. -- * The max delay was changed from an original 250us to 10000us
  6700. -- * since 250us often results in NF load timeout and causes deaf
  6701. -- * condition during stress testing 12/12/2009
  6702. -+ * The max delay was changed from an original 250us to 22.2 msec.
  6703. -+ * This would increase timeout to the longest possible frame
  6704. -+ * (11n max length 22.1 msec)
  6705. - */
  6706. -- for (j = 0; j < 10000; j++) {
  6707. -+ for (j = 0; j < 22200; j++) {
  6708. - if ((REG_READ(ah, AR_PHY_AGC_CONTROL) &
  6709. -- AR_PHY_AGC_CONTROL_NF) == 0)
  6710. -+ AR_PHY_AGC_CONTROL_NF) == 0)
  6711. - break;
  6712. - udelay(10);
  6713. - }
  6714. -
  6715. - /*
  6716. -+ * Restart NF so it can continue.
  6717. -+ */
  6718. -+ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_NF) {
  6719. -+ ENABLE_REG_RMW_BUFFER(ah);
  6720. -+ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_ENABLE_NF)
  6721. -+ REG_SET_BIT(ah, AR_PHY_AGC_CONTROL,
  6722. -+ AR_PHY_AGC_CONTROL_ENABLE_NF);
  6723. -+ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_NO_UPDATE_NF)
  6724. -+ REG_SET_BIT(ah, AR_PHY_AGC_CONTROL,
  6725. -+ AR_PHY_AGC_CONTROL_NO_UPDATE_NF);
  6726. -+ REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF);
  6727. -+ REG_RMW_BUFFER_FLUSH(ah);
  6728. -+ }
  6729. -+
  6730. -+ /*
  6731. - * We timed out waiting for the noisefloor to load, probably due to an
  6732. - * in-progress rx. Simply return here and allow the load plenty of time
  6733. - * to complete before the next calibration interval. We need to avoid
  6734. -@@ -296,7 +322,7 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  6735. - * here, the baseband nf cal will just be capped by our present
  6736. - * noisefloor until the next calibration timer.
  6737. - */
  6738. -- if (j == 10000) {
  6739. -+ if (j == 22200) {
  6740. - ath_dbg(common, ANY,
  6741. - "Timeout while waiting for nf to load: AR_PHY_AGC_CONTROL=0x%x\n",
  6742. - REG_READ(ah, AR_PHY_AGC_CONTROL));
  6743. 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
  6744. new file mode 100644
  6745. index 0000000..999d993
  6746. --- /dev/null
  6747. +++ b/package/kernel/mac80211/patches/326-ath9k_hw-simplify-ar9003_hw_per_calibration.patch
  6748. @@ -0,0 +1,88 @@
  6749. +From: Felix Fietkau <nbd@nbd.name>
  6750. +Date: Mon, 11 Jul 2016 11:34:47 +0200
  6751. +Subject: [PATCH] ath9k_hw: simplify ar9003_hw_per_calibration
  6752. +
  6753. +Reduce indentation, use a variable to save a few pointer dereferences
  6754. +
  6755. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  6756. +---
  6757. +
  6758. +--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  6759. ++++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  6760. +@@ -75,50 +75,49 @@ static bool ar9003_hw_per_calibration(st
  6761. + struct ath9k_cal_list *currCal)
  6762. + {
  6763. + struct ath9k_hw_cal_data *caldata = ah->caldata;
  6764. +- /* Cal is assumed not done until explicitly set below */
  6765. +- bool iscaldone = false;
  6766. ++ const struct ath9k_percal_data *cur_caldata = currCal->calData;
  6767. +
  6768. + /* Calibration in progress. */
  6769. + if (currCal->calState == CAL_RUNNING) {
  6770. + /* Check to see if it has finished. */
  6771. +- if (!(REG_READ(ah, AR_PHY_TIMING4) & AR_PHY_TIMING4_DO_CAL)) {
  6772. +- /*
  6773. +- * Accumulate cal measures for active chains
  6774. +- */
  6775. +- currCal->calData->calCollect(ah);
  6776. +- ah->cal_samples++;
  6777. ++ if (REG_READ(ah, AR_PHY_TIMING4) & AR_PHY_TIMING4_DO_CAL)
  6778. ++ return false;
  6779. +
  6780. +- if (ah->cal_samples >=
  6781. +- currCal->calData->calNumSamples) {
  6782. +- unsigned int i, numChains = 0;
  6783. +- for (i = 0; i < AR9300_MAX_CHAINS; i++) {
  6784. +- if (rxchainmask & (1 << i))
  6785. +- numChains++;
  6786. +- }
  6787. ++ /*
  6788. ++ * Accumulate cal measures for active chains
  6789. ++ */
  6790. ++ cur_caldata->calCollect(ah);
  6791. ++ ah->cal_samples++;
  6792. +
  6793. +- /*
  6794. +- * Process accumulated data
  6795. +- */
  6796. +- currCal->calData->calPostProc(ah, numChains);
  6797. ++ if (ah->cal_samples >= cur_caldata->calNumSamples) {
  6798. ++ unsigned int i, numChains = 0;
  6799. ++ for (i = 0; i < AR9300_MAX_CHAINS; i++) {
  6800. ++ if (rxchainmask & (1 << i))
  6801. ++ numChains++;
  6802. ++ }
  6803. +
  6804. +- /* Calibration has finished. */
  6805. +- caldata->CalValid |= currCal->calData->calType;
  6806. +- currCal->calState = CAL_DONE;
  6807. +- iscaldone = true;
  6808. +- } else {
  6809. ++ /*
  6810. ++ * Process accumulated data
  6811. ++ */
  6812. ++ cur_caldata->calPostProc(ah, numChains);
  6813. ++
  6814. ++ /* Calibration has finished. */
  6815. ++ caldata->CalValid |= cur_caldata->calType;
  6816. ++ currCal->calState = CAL_DONE;
  6817. ++ return true;
  6818. ++ } else {
  6819. + /*
  6820. + * Set-up collection of another sub-sample until we
  6821. + * get desired number
  6822. + */
  6823. + ar9003_hw_setup_calibration(ah, currCal);
  6824. +- }
  6825. + }
  6826. +- } else if (!(caldata->CalValid & currCal->calData->calType)) {
  6827. ++ } else if (!(caldata->CalValid & cur_caldata->calType)) {
  6828. + /* If current cal is marked invalid in channel, kick it off */
  6829. + ath9k_hw_reset_calibration(ah, currCal);
  6830. + }
  6831. +
  6832. +- return iscaldone;
  6833. ++ return false;
  6834. + }
  6835. +
  6836. + static int ar9003_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan,
  6837. 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
  6838. new file mode 100644
  6839. index 0000000..b7f3823
  6840. --- /dev/null
  6841. +++ b/package/kernel/mac80211/patches/327-ath9k_hw-get-rid-of-some-duplicate-code-in-calibrati.patch
  6842. @@ -0,0 +1,94 @@
  6843. +From: Felix Fietkau <nbd@nbd.name>
  6844. +Date: Mon, 11 Jul 2016 11:35:20 +0200
  6845. +Subject: [PATCH] ath9k_hw: get rid of some duplicate code in calibration
  6846. + init
  6847. +
  6848. +Remove a misleading debug message as well
  6849. +
  6850. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  6851. +---
  6852. +
  6853. +--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  6854. ++++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  6855. +@@ -1373,6 +1373,26 @@ static void ar9003_hw_cl_cal_post_proc(s
  6856. + }
  6857. + }
  6858. +
  6859. ++static void ar9003_hw_init_cal_common(struct ath_hw *ah)
  6860. ++{
  6861. ++ struct ath9k_hw_cal_data *caldata = ah->caldata;
  6862. ++
  6863. ++ /* Initialize list pointers */
  6864. ++ ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL;
  6865. ++
  6866. ++ INIT_CAL(&ah->iq_caldata);
  6867. ++ INSERT_CAL(ah, &ah->iq_caldata);
  6868. ++
  6869. ++ /* Initialize current pointer to first element in list */
  6870. ++ ah->cal_list_curr = ah->cal_list;
  6871. ++
  6872. ++ if (ah->cal_list_curr)
  6873. ++ ath9k_hw_reset_calibration(ah, ah->cal_list_curr);
  6874. ++
  6875. ++ if (caldata)
  6876. ++ caldata->CalValid = 0;
  6877. ++}
  6878. ++
  6879. + static bool ar9003_hw_init_cal_pcoem(struct ath_hw *ah,
  6880. + struct ath9k_channel *chan)
  6881. + {
  6882. +@@ -1532,21 +1552,7 @@ skip_tx_iqcal:
  6883. + /* Revert chainmask to runtime parameters */
  6884. + ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask);
  6885. +
  6886. +- /* Initialize list pointers */
  6887. +- ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL;
  6888. +-
  6889. +- INIT_CAL(&ah->iq_caldata);
  6890. +- INSERT_CAL(ah, &ah->iq_caldata);
  6891. +- ath_dbg(common, CALIBRATE, "enabling IQ Calibration\n");
  6892. +-
  6893. +- /* Initialize current pointer to first element in list */
  6894. +- ah->cal_list_curr = ah->cal_list;
  6895. +-
  6896. +- if (ah->cal_list_curr)
  6897. +- ath9k_hw_reset_calibration(ah, ah->cal_list_curr);
  6898. +-
  6899. +- if (caldata)
  6900. +- caldata->CalValid = 0;
  6901. ++ ar9003_hw_init_cal_common(ah);
  6902. +
  6903. + return true;
  6904. + }
  6905. +@@ -1577,8 +1583,6 @@ static bool do_ar9003_agc_cal(struct ath
  6906. + static bool ar9003_hw_init_cal_soc(struct ath_hw *ah,
  6907. + struct ath9k_channel *chan)
  6908. + {
  6909. +- struct ath_common *common = ath9k_hw_common(ah);
  6910. +- struct ath9k_hw_cal_data *caldata = ah->caldata;
  6911. + bool txiqcal_done = false;
  6912. + bool status = true;
  6913. + bool run_agc_cal = false, sep_iq_cal = false;
  6914. +@@ -1676,21 +1680,7 @@ skip_tx_iqcal:
  6915. + /* Revert chainmask to runtime parameters */
  6916. + ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask);
  6917. +
  6918. +- /* Initialize list pointers */
  6919. +- ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL;
  6920. +-
  6921. +- INIT_CAL(&ah->iq_caldata);
  6922. +- INSERT_CAL(ah, &ah->iq_caldata);
  6923. +- ath_dbg(common, CALIBRATE, "enabling IQ Calibration\n");
  6924. +-
  6925. +- /* Initialize current pointer to first element in list */
  6926. +- ah->cal_list_curr = ah->cal_list;
  6927. +-
  6928. +- if (ah->cal_list_curr)
  6929. +- ath9k_hw_reset_calibration(ah, ah->cal_list_curr);
  6930. +-
  6931. +- if (caldata)
  6932. +- caldata->CalValid = 0;
  6933. ++ ar9003_hw_init_cal_common(ah);
  6934. +
  6935. + return true;
  6936. + }
  6937. 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
  6938. deleted file mode 100644
  6939. index f7f9df9..0000000
  6940. --- a/package/kernel/mac80211/patches/327-mac80211-Remove-MPP-table-entries-with-MPath.patch
  6941. +++ /dev/null
  6942. @@ -1,54 +0,0 @@
  6943. -From: Henning Rogge <hrogge@gmail.com>
  6944. -Date: Wed, 3 Feb 2016 13:58:36 +0100
  6945. -Subject: [PATCH] mac80211: Remove MPP table entries with MPath
  6946. -
  6947. -Make the mesh_path_del() function remove all mpp table entries
  6948. -that are proxied by the removed mesh path.
  6949. -
  6950. -Acked-by: Bob Copeland <me@bobcopeland.com>
  6951. -Signed-off-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
  6952. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  6953. ----
  6954. -
  6955. ---- a/net/mac80211/mesh_pathtbl.c
  6956. -+++ b/net/mac80211/mesh_pathtbl.c
  6957. -@@ -835,6 +835,29 @@ void mesh_path_flush_by_nexthop(struct s
  6958. - rcu_read_unlock();
  6959. - }
  6960. -
  6961. -+static void mpp_flush_by_proxy(struct ieee80211_sub_if_data *sdata,
  6962. -+ const u8 *proxy)
  6963. -+{
  6964. -+ struct mesh_table *tbl;
  6965. -+ struct mesh_path *mpp;
  6966. -+ struct mpath_node *node;
  6967. -+ int i;
  6968. -+
  6969. -+ rcu_read_lock();
  6970. -+ read_lock_bh(&pathtbl_resize_lock);
  6971. -+ tbl = resize_dereference_mpp_paths();
  6972. -+ for_each_mesh_entry(tbl, node, i) {
  6973. -+ mpp = node->mpath;
  6974. -+ if (ether_addr_equal(mpp->mpp, proxy)) {
  6975. -+ spin_lock(&tbl->hashwlock[i]);
  6976. -+ __mesh_path_del(tbl, node);
  6977. -+ spin_unlock(&tbl->hashwlock[i]);
  6978. -+ }
  6979. -+ }
  6980. -+ read_unlock_bh(&pathtbl_resize_lock);
  6981. -+ rcu_read_unlock();
  6982. -+}
  6983. -+
  6984. - static void table_flush_by_iface(struct mesh_table *tbl,
  6985. - struct ieee80211_sub_if_data *sdata)
  6986. - {
  6987. -@@ -892,6 +915,9 @@ int mesh_path_del(struct ieee80211_sub_i
  6988. - int hash_idx;
  6989. - int err = 0;
  6990. -
  6991. -+ /* flush relevant mpp entries first */
  6992. -+ mpp_flush_by_proxy(sdata, addr);
  6993. -+
  6994. - read_lock_bh(&pathtbl_resize_lock);
  6995. - tbl = resize_dereference_mesh_paths();
  6996. - hash_idx = mesh_table_hash(addr, sdata, tbl);
  6997. 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
  6998. new file mode 100644
  6999. index 0000000..cff32ad
  7000. --- /dev/null
  7001. +++ b/package/kernel/mac80211/patches/328-ath9k_hw-implement-temperature-compensation-support-.patch
  7002. @@ -0,0 +1,97 @@
  7003. +From: Felix Fietkau <nbd@nbd.name>
  7004. +Date: Mon, 11 Jul 2016 11:35:55 +0200
  7005. +Subject: [PATCH] ath9k_hw: implement temperature compensation support for
  7006. + AR9003+
  7007. +
  7008. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  7009. +---
  7010. +
  7011. +--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  7012. ++++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  7013. +@@ -33,6 +33,7 @@ struct coeff {
  7014. +
  7015. + enum ar9003_cal_types {
  7016. + IQ_MISMATCH_CAL = BIT(0),
  7017. ++ TEMP_COMP_CAL = BIT(1),
  7018. + };
  7019. +
  7020. + static void ar9003_hw_setup_calibration(struct ath_hw *ah,
  7021. +@@ -58,6 +59,12 @@ static void ar9003_hw_setup_calibration(
  7022. + /* Kick-off cal */
  7023. + REG_SET_BIT(ah, AR_PHY_TIMING4, AR_PHY_TIMING4_DO_CAL);
  7024. + break;
  7025. ++ case TEMP_COMP_CAL:
  7026. ++ ath_dbg(common, CALIBRATE,
  7027. ++ "starting Temperature Compensation Calibration\n");
  7028. ++ REG_SET_BIT(ah, AR_CH0_THERM, AR_CH0_THERM_LOCAL);
  7029. ++ REG_SET_BIT(ah, AR_CH0_THERM, AR_CH0_THERM_START);
  7030. ++ break;
  7031. + default:
  7032. + ath_err(common, "Invalid calibration type\n");
  7033. + break;
  7034. +@@ -86,7 +93,8 @@ static bool ar9003_hw_per_calibration(st
  7035. + /*
  7036. + * Accumulate cal measures for active chains
  7037. + */
  7038. +- cur_caldata->calCollect(ah);
  7039. ++ if (cur_caldata->calCollect)
  7040. ++ cur_caldata->calCollect(ah);
  7041. + ah->cal_samples++;
  7042. +
  7043. + if (ah->cal_samples >= cur_caldata->calNumSamples) {
  7044. +@@ -99,7 +107,8 @@ static bool ar9003_hw_per_calibration(st
  7045. + /*
  7046. + * Process accumulated data
  7047. + */
  7048. +- cur_caldata->calPostProc(ah, numChains);
  7049. ++ if (cur_caldata->calPostProc)
  7050. ++ cur_caldata->calPostProc(ah, numChains);
  7051. +
  7052. + /* Calibration has finished. */
  7053. + caldata->CalValid |= cur_caldata->calType;
  7054. +@@ -314,9 +323,16 @@ static const struct ath9k_percal_data iq
  7055. + ar9003_hw_iqcalibrate
  7056. + };
  7057. +
  7058. ++static const struct ath9k_percal_data temp_cal_single_sample = {
  7059. ++ TEMP_COMP_CAL,
  7060. ++ MIN_CAL_SAMPLES,
  7061. ++ PER_MAX_LOG_COUNT,
  7062. ++};
  7063. ++
  7064. + static void ar9003_hw_init_cal_settings(struct ath_hw *ah)
  7065. + {
  7066. + ah->iq_caldata.calData = &iq_cal_single_sample;
  7067. ++ ah->temp_caldata.calData = &temp_cal_single_sample;
  7068. +
  7069. + if (AR_SREV_9300_20_OR_LATER(ah)) {
  7070. + ah->enabled_cals |= TX_IQ_CAL;
  7071. +@@ -324,7 +340,7 @@ static void ar9003_hw_init_cal_settings(
  7072. + ah->enabled_cals |= TX_IQ_ON_AGC_CAL;
  7073. + }
  7074. +
  7075. +- ah->supp_cals = IQ_MISMATCH_CAL;
  7076. ++ ah->supp_cals = IQ_MISMATCH_CAL | TEMP_COMP_CAL;
  7077. + }
  7078. +
  7079. + #define OFF_UPPER_LT 24
  7080. +@@ -1383,6 +1399,9 @@ static void ar9003_hw_init_cal_common(st
  7081. + INIT_CAL(&ah->iq_caldata);
  7082. + INSERT_CAL(ah, &ah->iq_caldata);
  7083. +
  7084. ++ INIT_CAL(&ah->temp_caldata);
  7085. ++ INSERT_CAL(ah, &ah->temp_caldata);
  7086. ++
  7087. + /* Initialize current pointer to first element in list */
  7088. + ah->cal_list_curr = ah->cal_list;
  7089. +
  7090. +--- a/drivers/net/wireless/ath/ath9k/hw.h
  7091. ++++ b/drivers/net/wireless/ath/ath9k/hw.h
  7092. +@@ -830,6 +830,7 @@ struct ath_hw {
  7093. + /* Calibration */
  7094. + u32 supp_cals;
  7095. + struct ath9k_cal_list iq_caldata;
  7096. ++ struct ath9k_cal_list temp_caldata;
  7097. + struct ath9k_cal_list adcgain_caldata;
  7098. + struct ath9k_cal_list adcdc_caldata;
  7099. + struct ath9k_cal_list *cal_list;
  7100. 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
  7101. deleted file mode 100644
  7102. index 740993c..0000000
  7103. --- a/package/kernel/mac80211/patches/328-mac80211-let-unused-MPP-table-entries-timeout.patch
  7104. +++ /dev/null
  7105. @@ -1,104 +0,0 @@
  7106. -From: Henning Rogge <hrogge@gmail.com>
  7107. -Date: Wed, 3 Feb 2016 13:58:37 +0100
  7108. -Subject: [PATCH] mac80211: let unused MPP table entries timeout
  7109. -
  7110. -Remember the last time when a mpp table entry is used for
  7111. -rx or tx and remove them after MESH_PATH_EXPIRE time.
  7112. -
  7113. -Acked-by: Bob Copeland <me@bobcopeland.com>
  7114. -Signed-off-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
  7115. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  7116. ----
  7117. -
  7118. ---- a/net/mac80211/mesh_pathtbl.c
  7119. -+++ b/net/mac80211/mesh_pathtbl.c
  7120. -@@ -942,6 +942,46 @@ enddel:
  7121. - }
  7122. -
  7123. - /**
  7124. -+ * mpp_path_del - delete a mesh proxy path from the table
  7125. -+ *
  7126. -+ * @addr: addr address (ETH_ALEN length)
  7127. -+ * @sdata: local subif
  7128. -+ *
  7129. -+ * Returns: 0 if successful
  7130. -+ */
  7131. -+static int mpp_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr)
  7132. -+{
  7133. -+ struct mesh_table *tbl;
  7134. -+ struct mesh_path *mpath;
  7135. -+ struct mpath_node *node;
  7136. -+ struct hlist_head *bucket;
  7137. -+ int hash_idx;
  7138. -+ int err = 0;
  7139. -+
  7140. -+ read_lock_bh(&pathtbl_resize_lock);
  7141. -+ tbl = resize_dereference_mpp_paths();
  7142. -+ hash_idx = mesh_table_hash(addr, sdata, tbl);
  7143. -+ bucket = &tbl->hash_buckets[hash_idx];
  7144. -+
  7145. -+ spin_lock(&tbl->hashwlock[hash_idx]);
  7146. -+ hlist_for_each_entry(node, bucket, list) {
  7147. -+ mpath = node->mpath;
  7148. -+ if (mpath->sdata == sdata &&
  7149. -+ ether_addr_equal(addr, mpath->dst)) {
  7150. -+ __mesh_path_del(tbl, node);
  7151. -+ goto enddel;
  7152. -+ }
  7153. -+ }
  7154. -+
  7155. -+ err = -ENXIO;
  7156. -+enddel:
  7157. -+ mesh_paths_generation++;
  7158. -+ spin_unlock(&tbl->hashwlock[hash_idx]);
  7159. -+ read_unlock_bh(&pathtbl_resize_lock);
  7160. -+ return err;
  7161. -+}
  7162. -+
  7163. -+/**
  7164. - * mesh_path_tx_pending - sends pending frames in a mesh path queue
  7165. - *
  7166. - * @mpath: mesh path to activate
  7167. -@@ -1157,6 +1197,17 @@ void mesh_path_expire(struct ieee80211_s
  7168. - time_after(jiffies, mpath->exp_time + MESH_PATH_EXPIRE))
  7169. - mesh_path_del(mpath->sdata, mpath->dst);
  7170. - }
  7171. -+
  7172. -+ tbl = rcu_dereference(mpp_paths);
  7173. -+ for_each_mesh_entry(tbl, node, i) {
  7174. -+ if (node->mpath->sdata != sdata)
  7175. -+ continue;
  7176. -+ mpath = node->mpath;
  7177. -+ if ((!(mpath->flags & MESH_PATH_FIXED)) &&
  7178. -+ time_after(jiffies, mpath->exp_time + MESH_PATH_EXPIRE))
  7179. -+ mpp_path_del(mpath->sdata, mpath->dst);
  7180. -+ }
  7181. -+
  7182. - rcu_read_unlock();
  7183. - }
  7184. -
  7185. ---- a/net/mac80211/rx.c
  7186. -+++ b/net/mac80211/rx.c
  7187. -@@ -2291,6 +2291,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
  7188. - spin_lock_bh(&mppath->state_lock);
  7189. - if (!ether_addr_equal(mppath->mpp, mpp_addr))
  7190. - memcpy(mppath->mpp, mpp_addr, ETH_ALEN);
  7191. -+ mppath->exp_time = jiffies;
  7192. - spin_unlock_bh(&mppath->state_lock);
  7193. - }
  7194. - rcu_read_unlock();
  7195. ---- a/net/mac80211/tx.c
  7196. -+++ b/net/mac80211/tx.c
  7197. -@@ -2171,8 +2171,11 @@ static struct sk_buff *ieee80211_build_h
  7198. - mpp_lookup = true;
  7199. - }
  7200. -
  7201. -- if (mpp_lookup)
  7202. -+ if (mpp_lookup) {
  7203. - mppath = mpp_path_lookup(sdata, skb->data);
  7204. -+ if (mppath)
  7205. -+ mppath->exp_time = jiffies;
  7206. -+ }
  7207. -
  7208. - if (mppath && mpath)
  7209. - mesh_path_del(mpath->sdata, mpath->dst);
  7210. 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
  7211. deleted file mode 100644
  7212. index 0c36b1d..0000000
  7213. --- a/package/kernel/mac80211/patches/329-mac80211-Unify-mesh-and-mpp-path-removal-function.patch
  7214. +++ /dev/null
  7215. @@ -1,143 +0,0 @@
  7216. -From: Henning Rogge <hrogge@gmail.com>
  7217. -Date: Wed, 3 Feb 2016 13:58:38 +0100
  7218. -Subject: [PATCH] mac80211: Unify mesh and mpp path removal function
  7219. -
  7220. -mpp_path_del() and mesh_path_del() are mostly the same function.
  7221. -Move common code into a new static function.
  7222. -
  7223. -Acked-by: Bob Copeland <me@bobcopeland.com>
  7224. -Signed-off-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
  7225. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  7226. ----
  7227. -
  7228. ---- a/net/mac80211/mesh_pathtbl.c
  7229. -+++ b/net/mac80211/mesh_pathtbl.c
  7230. -@@ -55,16 +55,21 @@ int mpp_paths_generation;
  7231. - static DEFINE_RWLOCK(pathtbl_resize_lock);
  7232. -
  7233. -
  7234. -+static inline struct mesh_table *resize_dereference_paths(
  7235. -+ struct mesh_table __rcu *table)
  7236. -+{
  7237. -+ return rcu_dereference_protected(table,
  7238. -+ lockdep_is_held(&pathtbl_resize_lock));
  7239. -+}
  7240. -+
  7241. - static inline struct mesh_table *resize_dereference_mesh_paths(void)
  7242. - {
  7243. -- return rcu_dereference_protected(mesh_paths,
  7244. -- lockdep_is_held(&pathtbl_resize_lock));
  7245. -+ return resize_dereference_paths(mesh_paths);
  7246. - }
  7247. -
  7248. - static inline struct mesh_table *resize_dereference_mpp_paths(void)
  7249. - {
  7250. -- return rcu_dereference_protected(mpp_paths,
  7251. -- lockdep_is_held(&pathtbl_resize_lock));
  7252. -+ return resize_dereference_paths(mpp_paths);
  7253. - }
  7254. -
  7255. - /*
  7256. -@@ -899,14 +904,17 @@ void mesh_path_flush_by_iface(struct iee
  7257. - }
  7258. -
  7259. - /**
  7260. -- * mesh_path_del - delete a mesh path from the table
  7261. -+ * table_path_del - delete a path from the mesh or mpp table
  7262. - *
  7263. -- * @addr: dst address (ETH_ALEN length)
  7264. -+ * @tbl: mesh or mpp path table
  7265. - * @sdata: local subif
  7266. -+ * @addr: dst address (ETH_ALEN length)
  7267. - *
  7268. - * Returns: 0 if successful
  7269. - */
  7270. --int mesh_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr)
  7271. -+static int table_path_del(struct mesh_table __rcu *rcu_tbl,
  7272. -+ struct ieee80211_sub_if_data *sdata,
  7273. -+ const u8 *addr)
  7274. - {
  7275. - struct mesh_table *tbl;
  7276. - struct mesh_path *mpath;
  7277. -@@ -915,11 +923,7 @@ int mesh_path_del(struct ieee80211_sub_i
  7278. - int hash_idx;
  7279. - int err = 0;
  7280. -
  7281. -- /* flush relevant mpp entries first */
  7282. -- mpp_flush_by_proxy(sdata, addr);
  7283. --
  7284. -- read_lock_bh(&pathtbl_resize_lock);
  7285. -- tbl = resize_dereference_mesh_paths();
  7286. -+ tbl = resize_dereference_paths(rcu_tbl);
  7287. - hash_idx = mesh_table_hash(addr, sdata, tbl);
  7288. - bucket = &tbl->hash_buckets[hash_idx];
  7289. -
  7290. -@@ -935,9 +939,30 @@ int mesh_path_del(struct ieee80211_sub_i
  7291. -
  7292. - err = -ENXIO;
  7293. - enddel:
  7294. -- mesh_paths_generation++;
  7295. - spin_unlock(&tbl->hashwlock[hash_idx]);
  7296. -+ return err;
  7297. -+}
  7298. -+
  7299. -+/**
  7300. -+ * mesh_path_del - delete a mesh path from the table
  7301. -+ *
  7302. -+ * @addr: dst address (ETH_ALEN length)
  7303. -+ * @sdata: local subif
  7304. -+ *
  7305. -+ * Returns: 0 if successful
  7306. -+ */
  7307. -+int mesh_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr)
  7308. -+{
  7309. -+ int err = 0;
  7310. -+
  7311. -+ /* flush relevant mpp entries first */
  7312. -+ mpp_flush_by_proxy(sdata, addr);
  7313. -+
  7314. -+ read_lock_bh(&pathtbl_resize_lock);
  7315. -+ err = table_path_del(mesh_paths, sdata, addr);
  7316. -+ mesh_paths_generation++;
  7317. - read_unlock_bh(&pathtbl_resize_lock);
  7318. -+
  7319. - return err;
  7320. - }
  7321. -
  7322. -@@ -951,33 +976,13 @@ enddel:
  7323. - */
  7324. - static int mpp_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr)
  7325. - {
  7326. -- struct mesh_table *tbl;
  7327. -- struct mesh_path *mpath;
  7328. -- struct mpath_node *node;
  7329. -- struct hlist_head *bucket;
  7330. -- int hash_idx;
  7331. - int err = 0;
  7332. -
  7333. - read_lock_bh(&pathtbl_resize_lock);
  7334. -- tbl = resize_dereference_mpp_paths();
  7335. -- hash_idx = mesh_table_hash(addr, sdata, tbl);
  7336. -- bucket = &tbl->hash_buckets[hash_idx];
  7337. --
  7338. -- spin_lock(&tbl->hashwlock[hash_idx]);
  7339. -- hlist_for_each_entry(node, bucket, list) {
  7340. -- mpath = node->mpath;
  7341. -- if (mpath->sdata == sdata &&
  7342. -- ether_addr_equal(addr, mpath->dst)) {
  7343. -- __mesh_path_del(tbl, node);
  7344. -- goto enddel;
  7345. -- }
  7346. -- }
  7347. --
  7348. -- err = -ENXIO;
  7349. --enddel:
  7350. -- mesh_paths_generation++;
  7351. -- spin_unlock(&tbl->hashwlock[hash_idx]);
  7352. -+ err = table_path_del(mpp_paths, sdata, addr);
  7353. -+ mpp_paths_generation++;
  7354. - read_unlock_bh(&pathtbl_resize_lock);
  7355. -+
  7356. - return err;
  7357. - }
  7358. -
  7359. 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
  7360. new file mode 100644
  7361. index 0000000..38e541c
  7362. --- /dev/null
  7363. +++ b/package/kernel/mac80211/patches/329-mac80211-fix-check-for-buffered-powersave-frames-wit.patch
  7364. @@ -0,0 +1,21 @@
  7365. +From: Felix Fietkau <nbd@nbd.name>
  7366. +Date: Mon, 11 Jul 2016 15:07:06 +0200
  7367. +Subject: [PATCH] mac80211: fix check for buffered powersave frames with txq
  7368. +
  7369. +The logic was inverted here, set the bit if frames are pending.
  7370. +
  7371. +Fixes: ba8c3d6f16a1 ("mac80211: add an intermediate software queue implementation")
  7372. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  7373. +---
  7374. +
  7375. +--- a/net/mac80211/rx.c
  7376. ++++ b/net/mac80211/rx.c
  7377. +@@ -1268,7 +1268,7 @@ static void sta_ps_start(struct sta_info
  7378. + for (tid = 0; tid < ARRAY_SIZE(sta->sta.txq); tid++) {
  7379. + struct txq_info *txqi = to_txq_info(sta->sta.txq[tid]);
  7380. +
  7381. +- if (!txqi->tin.backlog_packets)
  7382. ++ if (txqi->tin.backlog_packets)
  7383. + set_bit(tid, &sta->txq_buffered_tids);
  7384. + else
  7385. + clear_bit(tid, &sta->txq_buffered_tids);
  7386. 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
  7387. new file mode 100644
  7388. index 0000000..a6031b9
  7389. --- /dev/null
  7390. +++ b/package/kernel/mac80211/patches/330-ath10k-fix-rx-status-reporting-for-A-MSDU-subframes.patch
  7391. @@ -0,0 +1,36 @@
  7392. +From: Felix Fietkau <nbd@nbd.name>
  7393. +Date: Sun, 17 Jul 2016 12:49:59 +0200
  7394. +Subject: [PATCH] ath10k: fix rx status reporting for A-MSDU subframes
  7395. +
  7396. +Patch by Nagarajan, Ashok Raj <arnagara@qti.qualcomm.com>
  7397. +
  7398. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  7399. +---
  7400. +
  7401. +--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
  7402. ++++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
  7403. +@@ -1525,7 +1525,7 @@ static void ath10k_htt_rx_h_filter(struc
  7404. + static int ath10k_htt_rx_handle_amsdu(struct ath10k_htt *htt)
  7405. + {
  7406. + struct ath10k *ar = htt->ar;
  7407. +- static struct ieee80211_rx_status rx_status;
  7408. ++ struct ieee80211_rx_status *rx_status = &htt->rx_status;
  7409. + struct sk_buff_head amsdu;
  7410. + int ret;
  7411. +
  7412. +@@ -1549,11 +1549,11 @@ static int ath10k_htt_rx_handle_amsdu(st
  7413. + return ret;
  7414. + }
  7415. +
  7416. +- ath10k_htt_rx_h_ppdu(ar, &amsdu, &rx_status, 0xffff);
  7417. ++ ath10k_htt_rx_h_ppdu(ar, &amsdu, rx_status, 0xffff);
  7418. + ath10k_htt_rx_h_unchain(ar, &amsdu, ret > 0);
  7419. +- ath10k_htt_rx_h_filter(ar, &amsdu, &rx_status);
  7420. +- ath10k_htt_rx_h_mpdu(ar, &amsdu, &rx_status);
  7421. +- ath10k_htt_rx_h_deliver(ar, &amsdu, &rx_status);
  7422. ++ ath10k_htt_rx_h_filter(ar, &amsdu, rx_status);
  7423. ++ ath10k_htt_rx_h_mpdu(ar, &amsdu, rx_status);
  7424. ++ ath10k_htt_rx_h_deliver(ar, &amsdu, rx_status);
  7425. +
  7426. + return 0;
  7427. + }
  7428. 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
  7429. deleted file mode 100644
  7430. index 4dc6d66..0000000
  7431. --- a/package/kernel/mac80211/patches/330-mac80211-minstrel-Change-expected-throughput-unit-ba.patch
  7432. +++ /dev/null
  7433. @@ -1,51 +0,0 @@
  7434. -From: Sven Eckelmann <sven.eckelmann@open-mesh.com>
  7435. -Date: Tue, 2 Feb 2016 08:12:26 +0100
  7436. -Subject: [PATCH] mac80211: minstrel: Change expected throughput unit back to
  7437. - Kbps
  7438. -
  7439. -The change from cur_tp to the function
  7440. -minstrel_get_tp_avg/minstrel_ht_get_tp_avg changed the unit used for the
  7441. -current throughput. For example in minstrel_ht the correct
  7442. -conversion between them would be:
  7443. -
  7444. - mrs->cur_tp / 10 == minstrel_ht_get_tp_avg(..).
  7445. -
  7446. -This factor 10 must also be included in the calculation of
  7447. -minstrel_get_expected_throughput and minstrel_ht_get_expected_throughput to
  7448. -return values with the unit [Kbps] instead of [10Kbps]. Otherwise routing
  7449. -algorithms like B.A.T.M.A.N. V will make incorrect decision based on these
  7450. -values. Its kernel based implementation expects expected_throughput always
  7451. -to have the unit [Kbps] and not sometimes [10Kbps] and sometimes [Kbps].
  7452. -
  7453. -The same requirement has iw or olsrdv2's nl80211 based statistics module
  7454. -which retrieve the same data via NL80211_STA_INFO_TX_BITRATE.
  7455. -
  7456. -Cc: stable@vger.kernel.org
  7457. -Fixes: 6a27b2c40b48 ("mac80211: restructure per-rate throughput calculation into function")
  7458. -Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
  7459. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  7460. ----
  7461. -
  7462. ---- a/net/mac80211/rc80211_minstrel.c
  7463. -+++ b/net/mac80211/rc80211_minstrel.c
  7464. -@@ -711,7 +711,7 @@ static u32 minstrel_get_expected_through
  7465. - * computing cur_tp
  7466. - */
  7467. - tmp_mrs = &mi->r[idx].stats;
  7468. -- tmp_cur_tp = minstrel_get_tp_avg(&mi->r[idx], tmp_mrs->prob_ewma);
  7469. -+ tmp_cur_tp = minstrel_get_tp_avg(&mi->r[idx], tmp_mrs->prob_ewma) * 10;
  7470. - tmp_cur_tp = tmp_cur_tp * 1200 * 8 / 1024;
  7471. -
  7472. - return tmp_cur_tp;
  7473. ---- a/net/mac80211/rc80211_minstrel_ht.c
  7474. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  7475. -@@ -1335,7 +1335,8 @@ static u32 minstrel_ht_get_expected_thro
  7476. - prob = mi->groups[i].rates[j].prob_ewma;
  7477. -
  7478. - /* convert tp_avg from pkt per second in kbps */
  7479. -- tp_avg = minstrel_ht_get_tp_avg(mi, i, j, prob) * AVG_PKT_SIZE * 8 / 1024;
  7480. -+ tp_avg = minstrel_ht_get_tp_avg(mi, i, j, prob) * 10;
  7481. -+ tp_avg = tp_avg * AVG_PKT_SIZE * 8 / 1024;
  7482. -
  7483. - return tp_avg;
  7484. - }
  7485. 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
  7486. deleted file mode 100644
  7487. index 1fd016f..0000000
  7488. --- a/package/kernel/mac80211/patches/331-brcmfmac-Increase-nr-of-supported-flowrings.patch
  7489. +++ /dev/null
  7490. @@ -1,307 +0,0 @@
  7491. -From: Hante Meuleman <meuleman@broadcom.com>
  7492. -Date: Sun, 7 Feb 2016 18:08:24 +0100
  7493. -Subject: [PATCH] brcmfmac: Increase nr of supported flowrings.
  7494. -MIME-Version: 1.0
  7495. -Content-Type: text/plain; charset=UTF-8
  7496. -Content-Transfer-Encoding: 8bit
  7497. -
  7498. -New generation devices have firmware which has more than 256 flowrings.
  7499. -E.g. following debugging message comes from 14e4:4365 BCM4366:
  7500. -[ 194.606245] brcmfmac: brcmf_pcie_init_ringbuffers Nr of flowrings is 264
  7501. -
  7502. -At various code places (related to flowrings) we were using u8 which
  7503. -could lead to storing wrong number or infinite loops when indexing with
  7504. -this type. This issue was quite easy to spot in brcmf_flowring_detach
  7505. -where it led to infinite loop e.g. on failed initialization.
  7506. -
  7507. -This patch switches code to proper types and increases the maximum
  7508. -number of supported flowrings to 512.
  7509. -
  7510. -Originally this change was sent in September 2015, but back it was
  7511. -causing a regression on BCM43602 resulting in:
  7512. -Unable to handle kernel NULL pointer dereference at virtual address ...
  7513. -
  7514. -The reason for this regression was missing update (s/u8/u16) of struct
  7515. -brcmf_flowring_ring. This problem was handled in 9f64df9 ("brcmfmac: Fix
  7516. -bug in flowring management."). Starting with that it's safe to apply
  7517. -this original patch as it doesn't cause a regression anymore.
  7518. -
  7519. -This patch fixes an infinite loop on BCM4366 which is supported since
  7520. -4.4 so it makes sense to apply it to stable 4.4+.
  7521. -
  7522. -Cc: <stable@vger.kernel.org> # 4.4+
  7523. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  7524. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  7525. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  7526. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  7527. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  7528. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  7529. ----
  7530. -
  7531. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c
  7532. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c
  7533. -@@ -32,7 +32,7 @@
  7534. - #define BRCMF_FLOWRING_LOW (BRCMF_FLOWRING_HIGH - 256)
  7535. - #define BRCMF_FLOWRING_INVALID_IFIDX 0xff
  7536. -
  7537. --#define BRCMF_FLOWRING_HASH_AP(da, fifo, ifidx) (da[5] + fifo + ifidx * 16)
  7538. -+#define BRCMF_FLOWRING_HASH_AP(da, fifo, ifidx) (da[5] * 2 + fifo + ifidx * 16)
  7539. - #define BRCMF_FLOWRING_HASH_STA(fifo, ifidx) (fifo + ifidx * 16)
  7540. -
  7541. - static const u8 brcmf_flowring_prio2fifo[] = {
  7542. -@@ -68,7 +68,7 @@ u32 brcmf_flowring_lookup(struct brcmf_f
  7543. - u8 prio, u8 ifidx)
  7544. - {
  7545. - struct brcmf_flowring_hash *hash;
  7546. -- u8 hash_idx;
  7547. -+ u16 hash_idx;
  7548. - u32 i;
  7549. - bool found;
  7550. - bool sta;
  7551. -@@ -88,6 +88,7 @@ u32 brcmf_flowring_lookup(struct brcmf_f
  7552. - }
  7553. - hash_idx = sta ? BRCMF_FLOWRING_HASH_STA(fifo, ifidx) :
  7554. - BRCMF_FLOWRING_HASH_AP(mac, fifo, ifidx);
  7555. -+ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1);
  7556. - found = false;
  7557. - hash = flow->hash;
  7558. - for (i = 0; i < BRCMF_FLOWRING_HASHSIZE; i++) {
  7559. -@@ -98,6 +99,7 @@ u32 brcmf_flowring_lookup(struct brcmf_f
  7560. - break;
  7561. - }
  7562. - hash_idx++;
  7563. -+ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1);
  7564. - }
  7565. - if (found)
  7566. - return hash[hash_idx].flowid;
  7567. -@@ -111,7 +113,7 @@ u32 brcmf_flowring_create(struct brcmf_f
  7568. - {
  7569. - struct brcmf_flowring_ring *ring;
  7570. - struct brcmf_flowring_hash *hash;
  7571. -- u8 hash_idx;
  7572. -+ u16 hash_idx;
  7573. - u32 i;
  7574. - bool found;
  7575. - u8 fifo;
  7576. -@@ -131,6 +133,7 @@ u32 brcmf_flowring_create(struct brcmf_f
  7577. - }
  7578. - hash_idx = sta ? BRCMF_FLOWRING_HASH_STA(fifo, ifidx) :
  7579. - BRCMF_FLOWRING_HASH_AP(mac, fifo, ifidx);
  7580. -+ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1);
  7581. - found = false;
  7582. - hash = flow->hash;
  7583. - for (i = 0; i < BRCMF_FLOWRING_HASHSIZE; i++) {
  7584. -@@ -140,6 +143,7 @@ u32 brcmf_flowring_create(struct brcmf_f
  7585. - break;
  7586. - }
  7587. - hash_idx++;
  7588. -+ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1);
  7589. - }
  7590. - if (found) {
  7591. - for (i = 0; i < flow->nrofrings; i++) {
  7592. -@@ -169,7 +173,7 @@ u32 brcmf_flowring_create(struct brcmf_f
  7593. - }
  7594. -
  7595. -
  7596. --u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u8 flowid)
  7597. -+u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u16 flowid)
  7598. - {
  7599. - struct brcmf_flowring_ring *ring;
  7600. -
  7601. -@@ -179,7 +183,7 @@ u8 brcmf_flowring_tid(struct brcmf_flowr
  7602. - }
  7603. -
  7604. -
  7605. --static void brcmf_flowring_block(struct brcmf_flowring *flow, u8 flowid,
  7606. -+static void brcmf_flowring_block(struct brcmf_flowring *flow, u16 flowid,
  7607. - bool blocked)
  7608. - {
  7609. - struct brcmf_flowring_ring *ring;
  7610. -@@ -228,10 +232,10 @@ static void brcmf_flowring_block(struct
  7611. - }
  7612. -
  7613. -
  7614. --void brcmf_flowring_delete(struct brcmf_flowring *flow, u8 flowid)
  7615. -+void brcmf_flowring_delete(struct brcmf_flowring *flow, u16 flowid)
  7616. - {
  7617. - struct brcmf_flowring_ring *ring;
  7618. -- u8 hash_idx;
  7619. -+ u16 hash_idx;
  7620. - struct sk_buff *skb;
  7621. -
  7622. - ring = flow->rings[flowid];
  7623. -@@ -253,7 +257,7 @@ void brcmf_flowring_delete(struct brcmf_
  7624. - }
  7625. -
  7626. -
  7627. --u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  7628. -+u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u16 flowid,
  7629. - struct sk_buff *skb)
  7630. - {
  7631. - struct brcmf_flowring_ring *ring;
  7632. -@@ -279,7 +283,7 @@ u32 brcmf_flowring_enqueue(struct brcmf_
  7633. - }
  7634. -
  7635. -
  7636. --struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u8 flowid)
  7637. -+struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u16 flowid)
  7638. - {
  7639. - struct brcmf_flowring_ring *ring;
  7640. - struct sk_buff *skb;
  7641. -@@ -300,7 +304,7 @@ struct sk_buff *brcmf_flowring_dequeue(s
  7642. - }
  7643. -
  7644. -
  7645. --void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u8 flowid,
  7646. -+void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u16 flowid,
  7647. - struct sk_buff *skb)
  7648. - {
  7649. - struct brcmf_flowring_ring *ring;
  7650. -@@ -311,7 +315,7 @@ void brcmf_flowring_reinsert(struct brcm
  7651. - }
  7652. -
  7653. -
  7654. --u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u8 flowid)
  7655. -+u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u16 flowid)
  7656. - {
  7657. - struct brcmf_flowring_ring *ring;
  7658. -
  7659. -@@ -326,7 +330,7 @@ u32 brcmf_flowring_qlen(struct brcmf_flo
  7660. - }
  7661. -
  7662. -
  7663. --void brcmf_flowring_open(struct brcmf_flowring *flow, u8 flowid)
  7664. -+void brcmf_flowring_open(struct brcmf_flowring *flow, u16 flowid)
  7665. - {
  7666. - struct brcmf_flowring_ring *ring;
  7667. -
  7668. -@@ -340,10 +344,10 @@ void brcmf_flowring_open(struct brcmf_fl
  7669. - }
  7670. -
  7671. -
  7672. --u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u8 flowid)
  7673. -+u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u16 flowid)
  7674. - {
  7675. - struct brcmf_flowring_ring *ring;
  7676. -- u8 hash_idx;
  7677. -+ u16 hash_idx;
  7678. -
  7679. - ring = flow->rings[flowid];
  7680. - hash_idx = ring->hash_id;
  7681. -@@ -384,7 +388,7 @@ void brcmf_flowring_detach(struct brcmf_
  7682. - struct brcmf_pub *drvr = bus_if->drvr;
  7683. - struct brcmf_flowring_tdls_entry *search;
  7684. - struct brcmf_flowring_tdls_entry *remove;
  7685. -- u8 flowid;
  7686. -+ u16 flowid;
  7687. -
  7688. - for (flowid = 0; flowid < flow->nrofrings; flowid++) {
  7689. - if (flow->rings[flowid])
  7690. -@@ -408,7 +412,7 @@ void brcmf_flowring_configure_addr_mode(
  7691. - struct brcmf_bus *bus_if = dev_get_drvdata(flow->dev);
  7692. - struct brcmf_pub *drvr = bus_if->drvr;
  7693. - u32 i;
  7694. -- u8 flowid;
  7695. -+ u16 flowid;
  7696. -
  7697. - if (flow->addr_mode[ifidx] != addr_mode) {
  7698. - for (i = 0; i < ARRAY_SIZE(flow->hash); i++) {
  7699. -@@ -434,7 +438,7 @@ void brcmf_flowring_delete_peer(struct b
  7700. - struct brcmf_flowring_tdls_entry *prev;
  7701. - struct brcmf_flowring_tdls_entry *search;
  7702. - u32 i;
  7703. -- u8 flowid;
  7704. -+ u16 flowid;
  7705. - bool sta;
  7706. -
  7707. - sta = (flow->addr_mode[ifidx] == ADDR_INDIRECT);
  7708. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.h
  7709. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.h
  7710. -@@ -16,7 +16,7 @@
  7711. - #define BRCMFMAC_FLOWRING_H
  7712. -
  7713. -
  7714. --#define BRCMF_FLOWRING_HASHSIZE 256
  7715. -+#define BRCMF_FLOWRING_HASHSIZE 512 /* has to be 2^x */
  7716. - #define BRCMF_FLOWRING_INVALID_ID 0xFFFFFFFF
  7717. -
  7718. -
  7719. -@@ -24,7 +24,7 @@ struct brcmf_flowring_hash {
  7720. - u8 mac[ETH_ALEN];
  7721. - u8 fifo;
  7722. - u8 ifidx;
  7723. -- u8 flowid;
  7724. -+ u16 flowid;
  7725. - };
  7726. -
  7727. - enum ring_status {
  7728. -@@ -61,16 +61,16 @@ u32 brcmf_flowring_lookup(struct brcmf_f
  7729. - u8 prio, u8 ifidx);
  7730. - u32 brcmf_flowring_create(struct brcmf_flowring *flow, u8 da[ETH_ALEN],
  7731. - u8 prio, u8 ifidx);
  7732. --void brcmf_flowring_delete(struct brcmf_flowring *flow, u8 flowid);
  7733. --void brcmf_flowring_open(struct brcmf_flowring *flow, u8 flowid);
  7734. --u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u8 flowid);
  7735. --u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  7736. -+void brcmf_flowring_delete(struct brcmf_flowring *flow, u16 flowid);
  7737. -+void brcmf_flowring_open(struct brcmf_flowring *flow, u16 flowid);
  7738. -+u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u16 flowid);
  7739. -+u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u16 flowid,
  7740. - struct sk_buff *skb);
  7741. --struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u8 flowid);
  7742. --void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u8 flowid,
  7743. -+struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u16 flowid);
  7744. -+void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u16 flowid,
  7745. - struct sk_buff *skb);
  7746. --u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u8 flowid);
  7747. --u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u8 flowid);
  7748. -+u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u16 flowid);
  7749. -+u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u16 flowid);
  7750. - struct brcmf_flowring *brcmf_flowring_attach(struct device *dev, u16 nrofrings);
  7751. - void brcmf_flowring_detach(struct brcmf_flowring *flow);
  7752. - void brcmf_flowring_configure_addr_mode(struct brcmf_flowring *flow, int ifidx,
  7753. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  7754. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  7755. -@@ -677,7 +677,7 @@ static u32 brcmf_msgbuf_flowring_create(
  7756. - }
  7757. -
  7758. -
  7759. --static void brcmf_msgbuf_txflow(struct brcmf_msgbuf *msgbuf, u8 flowid)
  7760. -+static void brcmf_msgbuf_txflow(struct brcmf_msgbuf *msgbuf, u16 flowid)
  7761. - {
  7762. - struct brcmf_flowring *flow = msgbuf->flow;
  7763. - struct brcmf_commonring *commonring;
  7764. -@@ -1310,7 +1310,7 @@ int brcmf_proto_msgbuf_rx_trigger(struct
  7765. - }
  7766. -
  7767. -
  7768. --void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u8 flowid)
  7769. -+void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u16 flowid)
  7770. - {
  7771. - struct brcmf_msgbuf *msgbuf = (struct brcmf_msgbuf *)drvr->proto->pd;
  7772. - struct msgbuf_tx_flowring_delete_req *delete;
  7773. -@@ -1415,6 +1415,13 @@ int brcmf_proto_msgbuf_attach(struct brc
  7774. - u32 count;
  7775. -
  7776. - if_msgbuf = drvr->bus_if->msgbuf;
  7777. -+
  7778. -+ if (if_msgbuf->nrof_flowrings >= BRCMF_FLOWRING_HASHSIZE) {
  7779. -+ brcmf_err("driver not configured for this many flowrings %d\n",
  7780. -+ if_msgbuf->nrof_flowrings);
  7781. -+ if_msgbuf->nrof_flowrings = BRCMF_FLOWRING_HASHSIZE - 1;
  7782. -+ }
  7783. -+
  7784. - msgbuf = kzalloc(sizeof(*msgbuf), GFP_KERNEL);
  7785. - if (!msgbuf)
  7786. - goto fail;
  7787. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.h
  7788. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.h
  7789. -@@ -33,7 +33,7 @@
  7790. -
  7791. -
  7792. - int brcmf_proto_msgbuf_rx_trigger(struct device *dev);
  7793. --void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u8 flowid);
  7794. -+void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u16 flowid);
  7795. - int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr);
  7796. - void brcmf_proto_msgbuf_detach(struct brcmf_pub *drvr);
  7797. - #else
  7798. 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
  7799. new file mode 100644
  7800. index 0000000..5d8a8fb
  7801. --- /dev/null
  7802. +++ b/package/kernel/mac80211/patches/331-mac80211-End-the-MPSP-even-if-EOSP-frame-was-not-rec.patch
  7803. @@ -0,0 +1,42 @@
  7804. +From: Masashi Honma <masashi.honma@gmail.com>
  7805. +Date: Wed, 13 Jul 2016 16:04:35 +0900
  7806. +Subject: [PATCH] mac80211: End the MPSP even if EOSP frame was not received
  7807. +
  7808. +The mesh STA sends QoS frame with EOSP (end of service period)
  7809. +subfiled=1 to end the MPSP(mesh peer service period). Previously, if
  7810. +the frame was not acked by peer, the mesh STA did not end the MPSP.
  7811. +This patch ends the MPSP even if the QoS frame was no acked.
  7812. +
  7813. +Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
  7814. +---
  7815. +
  7816. +--- a/net/mac80211/status.c
  7817. ++++ b/net/mac80211/status.c
  7818. +@@ -784,6 +784,13 @@ void ieee80211_tx_status(struct ieee8021
  7819. + clear_sta_flag(sta, WLAN_STA_SP);
  7820. +
  7821. + acked = !!(info->flags & IEEE80211_TX_STAT_ACK);
  7822. ++
  7823. ++ /* mesh Peer Service Period support */
  7824. ++ if (ieee80211_vif_is_mesh(&sta->sdata->vif) &&
  7825. ++ ieee80211_is_data_qos(fc))
  7826. ++ ieee80211_mpsp_trigger_process(
  7827. ++ ieee80211_get_qos_ctl(hdr), sta, true, acked);
  7828. ++
  7829. + if (!acked && test_sta_flag(sta, WLAN_STA_PS_STA)) {
  7830. + /*
  7831. + * The STA is in power save mode, so assume
  7832. +@@ -794,13 +801,6 @@ void ieee80211_tx_status(struct ieee8021
  7833. + return;
  7834. + }
  7835. +
  7836. +- /* mesh Peer Service Period support */
  7837. +- if (ieee80211_vif_is_mesh(&sta->sdata->vif) &&
  7838. +- ieee80211_is_data_qos(fc))
  7839. +- ieee80211_mpsp_trigger_process(
  7840. +- ieee80211_get_qos_ctl(hdr),
  7841. +- sta, true, acked);
  7842. +-
  7843. + if (ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL) &&
  7844. + (ieee80211_is_data(hdr->frame_control)) &&
  7845. + (rates_idx != -1))
  7846. diff --git a/package/kernel/mac80211/patches/332-ath10k-implement-NAPI-support.patch b/package/kernel/mac80211/patches/332-ath10k-implement-NAPI-support.patch
  7847. new file mode 100644
  7848. index 0000000..c6cc145
  7849. --- /dev/null
  7850. +++ b/package/kernel/mac80211/patches/332-ath10k-implement-NAPI-support.patch
  7851. @@ -0,0 +1,642 @@
  7852. +From: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
  7853. +Date: Thu, 21 Jul 2016 11:50:00 +0530
  7854. +Subject: [PATCH] ath10k: implement NAPI support
  7855. +
  7856. +Add NAPI support for rx and tx completion. NAPI poll is scheduled
  7857. +from interrupt handler. The design is as below
  7858. +
  7859. + - on interrupt
  7860. + - schedule napi and mask interrupts
  7861. + - on poll
  7862. + - process all pipes (no actual Tx/Rx)
  7863. + - process Rx within budget
  7864. + - if quota exceeds budget reschedule napi poll by returning budget
  7865. + - process Tx completions and update budget if necessary
  7866. + - process Tx fetch indications (pull-push)
  7867. + - push any other pending Tx (if possible)
  7868. + - before resched or napi completion replenish htt rx ring buffer
  7869. + - if work done < budget, complete napi poll and unmask interrupts
  7870. +
  7871. +This change also get rid of two tasklets (intr_tq and txrx_compl_task).
  7872. +
  7873. +Measured peak throughput with NAPI on IPQ4019 platform in controlled
  7874. +environment. No noticeable reduction in throughput is seen and also
  7875. +observed improvements in CPU usage. Approx. 15% CPU usage got reduced
  7876. +in UDP uplink case.
  7877. +
  7878. +DL: AP DUT Tx
  7879. +UL: AP DUT Rx
  7880. +
  7881. +IPQ4019 (avg. cpu usage %)
  7882. +========
  7883. + TOT +NAPI
  7884. + =========== =============
  7885. +TCP DL 644 Mbps (42%) 645 Mbps (36%)
  7886. +TCP UL 673 Mbps (30%) 675 Mbps (26%)
  7887. +UDP DL 682 Mbps (49%) 680 Mbps (49%)
  7888. +UDP UL 720 Mbps (28%) 717 Mbps (11%)
  7889. +
  7890. +Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
  7891. +---
  7892. +
  7893. +--- a/drivers/net/wireless/ath/ath10k/ahb.c
  7894. ++++ b/drivers/net/wireless/ath/ath10k/ahb.c
  7895. +@@ -462,13 +462,13 @@ static void ath10k_ahb_halt_chip(struct
  7896. + static irqreturn_t ath10k_ahb_interrupt_handler(int irq, void *arg)
  7897. + {
  7898. + struct ath10k *ar = arg;
  7899. +- struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
  7900. +
  7901. + if (!ath10k_pci_irq_pending(ar))
  7902. + return IRQ_NONE;
  7903. +
  7904. + ath10k_pci_disable_and_clear_legacy_irq(ar);
  7905. +- tasklet_schedule(&ar_pci->intr_tq);
  7906. ++ ath10k_pci_irq_msi_fw_mask(ar);
  7907. ++ napi_schedule(&ar->napi);
  7908. +
  7909. + return IRQ_HANDLED;
  7910. + }
  7911. +@@ -831,7 +831,7 @@ static int ath10k_ahb_probe(struct platf
  7912. + goto err_resource_deinit;
  7913. + }
  7914. +
  7915. +- ath10k_pci_init_irq_tasklets(ar);
  7916. ++ ath10k_pci_init_napi(ar);
  7917. +
  7918. + ret = ath10k_ahb_request_irq_legacy(ar);
  7919. + if (ret)
  7920. +--- a/drivers/net/wireless/ath/ath10k/core.c
  7921. ++++ b/drivers/net/wireless/ath/ath10k/core.c
  7922. +@@ -2226,6 +2226,8 @@ struct ath10k *ath10k_core_create(size_t
  7923. + INIT_WORK(&ar->register_work, ath10k_core_register_work);
  7924. + INIT_WORK(&ar->restart_work, ath10k_core_restart);
  7925. +
  7926. ++ init_dummy_netdev(&ar->napi_dev);
  7927. ++
  7928. + ret = ath10k_debug_create(ar);
  7929. + if (ret)
  7930. + goto err_free_aux_wq;
  7931. +--- a/drivers/net/wireless/ath/ath10k/core.h
  7932. ++++ b/drivers/net/wireless/ath/ath10k/core.h
  7933. +@@ -65,6 +65,10 @@
  7934. + #define ATH10K_KEEPALIVE_MAX_IDLE 3895
  7935. + #define ATH10K_KEEPALIVE_MAX_UNRESPONSIVE 3900
  7936. +
  7937. ++/* NAPI poll budget */
  7938. ++#define ATH10K_NAPI_BUDGET 64
  7939. ++#define ATH10K_NAPI_QUOTA_LIMIT 60
  7940. ++
  7941. + struct ath10k;
  7942. +
  7943. + enum ath10k_bus {
  7944. +@@ -933,6 +937,10 @@ struct ath10k {
  7945. + struct ath10k_thermal thermal;
  7946. + struct ath10k_wow wow;
  7947. +
  7948. ++ /* NAPI */
  7949. ++ struct net_device napi_dev;
  7950. ++ struct napi_struct napi;
  7951. ++
  7952. + /* must be last */
  7953. + u8 drv_priv[0] __aligned(sizeof(void *));
  7954. + };
  7955. +--- a/drivers/net/wireless/ath/ath10k/htt.h
  7956. ++++ b/drivers/net/wireless/ath/ath10k/htt.h
  7957. +@@ -1666,7 +1666,6 @@ struct ath10k_htt {
  7958. +
  7959. + /* This is used to group tx/rx completions separately and process them
  7960. + * in batches to reduce cache stalls */
  7961. +- struct tasklet_struct txrx_compl_task;
  7962. + struct sk_buff_head rx_compl_q;
  7963. + struct sk_buff_head rx_in_ord_compl_q;
  7964. + struct sk_buff_head tx_fetch_ind_q;
  7965. +@@ -1799,5 +1798,6 @@ int ath10k_htt_tx(struct ath10k_htt *htt
  7966. + struct sk_buff *msdu);
  7967. + void ath10k_htt_rx_pktlog_completion_handler(struct ath10k *ar,
  7968. + struct sk_buff *skb);
  7969. ++int ath10k_htt_txrx_compl_task(struct ath10k *ar, int budget);
  7970. +
  7971. + #endif
  7972. +--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
  7973. ++++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
  7974. +@@ -34,7 +34,6 @@
  7975. + #define HTT_RX_RING_REFILL_RESCHED_MS 5
  7976. +
  7977. + static int ath10k_htt_rx_get_csum_state(struct sk_buff *skb);
  7978. +-static void ath10k_htt_txrx_compl_task(unsigned long ptr);
  7979. +
  7980. + static struct sk_buff *
  7981. + ath10k_htt_rx_find_skb_paddr(struct ath10k *ar, u32 paddr)
  7982. +@@ -226,7 +225,6 @@ int ath10k_htt_rx_ring_refill(struct ath
  7983. + void ath10k_htt_rx_free(struct ath10k_htt *htt)
  7984. + {
  7985. + del_timer_sync(&htt->rx_ring.refill_retry_timer);
  7986. +- tasklet_kill(&htt->txrx_compl_task);
  7987. +
  7988. + skb_queue_purge(&htt->rx_compl_q);
  7989. + skb_queue_purge(&htt->rx_in_ord_compl_q);
  7990. +@@ -520,9 +518,6 @@ int ath10k_htt_rx_alloc(struct ath10k_ht
  7991. + skb_queue_head_init(&htt->tx_fetch_ind_q);
  7992. + atomic_set(&htt->num_mpdus_ready, 0);
  7993. +
  7994. +- tasklet_init(&htt->txrx_compl_task, ath10k_htt_txrx_compl_task,
  7995. +- (unsigned long)htt);
  7996. +-
  7997. + ath10k_dbg(ar, ATH10K_DBG_BOOT, "htt rx ring size %d fill_level %d\n",
  7998. + htt->rx_ring.size, htt->rx_ring.fill_level);
  7999. + return 0;
  8000. +@@ -958,7 +953,7 @@ static void ath10k_process_rx(struct ath
  8001. + trace_ath10k_rx_hdr(ar, skb->data, skb->len);
  8002. + trace_ath10k_rx_payload(ar, skb->data, skb->len);
  8003. +
  8004. +- ieee80211_rx(ar->hw, skb);
  8005. ++ ieee80211_rx_napi(ar->hw, NULL, skb, &ar->napi);
  8006. + }
  8007. +
  8008. + static int ath10k_htt_rx_nwifi_hdrlen(struct ath10k *ar,
  8009. +@@ -1527,7 +1522,7 @@ static int ath10k_htt_rx_handle_amsdu(st
  8010. + struct ath10k *ar = htt->ar;
  8011. + struct ieee80211_rx_status *rx_status = &htt->rx_status;
  8012. + struct sk_buff_head amsdu;
  8013. +- int ret;
  8014. ++ int ret, num_msdus;
  8015. +
  8016. + __skb_queue_head_init(&amsdu);
  8017. +
  8018. +@@ -1549,13 +1544,14 @@ static int ath10k_htt_rx_handle_amsdu(st
  8019. + return ret;
  8020. + }
  8021. +
  8022. ++ num_msdus = skb_queue_len(&amsdu);
  8023. + ath10k_htt_rx_h_ppdu(ar, &amsdu, rx_status, 0xffff);
  8024. + ath10k_htt_rx_h_unchain(ar, &amsdu, ret > 0);
  8025. + ath10k_htt_rx_h_filter(ar, &amsdu, rx_status);
  8026. + ath10k_htt_rx_h_mpdu(ar, &amsdu, rx_status);
  8027. + ath10k_htt_rx_h_deliver(ar, &amsdu, rx_status);
  8028. +
  8029. +- return 0;
  8030. ++ return num_msdus;
  8031. + }
  8032. +
  8033. + static void ath10k_htt_rx_proc_rx_ind(struct ath10k_htt *htt,
  8034. +@@ -1579,15 +1575,6 @@ static void ath10k_htt_rx_proc_rx_ind(st
  8035. + mpdu_count += mpdu_ranges[i].mpdu_count;
  8036. +
  8037. + atomic_add(mpdu_count, &htt->num_mpdus_ready);
  8038. +-
  8039. +- tasklet_schedule(&htt->txrx_compl_task);
  8040. +-}
  8041. +-
  8042. +-static void ath10k_htt_rx_frag_handler(struct ath10k_htt *htt)
  8043. +-{
  8044. +- atomic_inc(&htt->num_mpdus_ready);
  8045. +-
  8046. +- tasklet_schedule(&htt->txrx_compl_task);
  8047. + }
  8048. +
  8049. + static void ath10k_htt_rx_tx_compl_ind(struct ath10k *ar,
  8050. +@@ -1772,14 +1759,15 @@ static void ath10k_htt_rx_h_rx_offload_p
  8051. + RX_FLAG_MMIC_STRIPPED;
  8052. + }
  8053. +
  8054. +-static void ath10k_htt_rx_h_rx_offload(struct ath10k *ar,
  8055. +- struct sk_buff_head *list)
  8056. ++static int ath10k_htt_rx_h_rx_offload(struct ath10k *ar,
  8057. ++ struct sk_buff_head *list)
  8058. + {
  8059. + struct ath10k_htt *htt = &ar->htt;
  8060. + struct ieee80211_rx_status *status = &htt->rx_status;
  8061. + struct htt_rx_offload_msdu *rx;
  8062. + struct sk_buff *msdu;
  8063. + size_t offset;
  8064. ++ int num_msdu = 0;
  8065. +
  8066. + while ((msdu = __skb_dequeue(list))) {
  8067. + /* Offloaded frames don't have Rx descriptor. Instead they have
  8068. +@@ -1819,10 +1807,12 @@ static void ath10k_htt_rx_h_rx_offload(s
  8069. + ath10k_htt_rx_h_rx_offload_prot(status, msdu);
  8070. + ath10k_htt_rx_h_channel(ar, status, NULL, rx->vdev_id);
  8071. + ath10k_process_rx(ar, status, msdu);
  8072. ++ num_msdu++;
  8073. + }
  8074. ++ return num_msdu;
  8075. + }
  8076. +
  8077. +-static void ath10k_htt_rx_in_ord_ind(struct ath10k *ar, struct sk_buff *skb)
  8078. ++static int ath10k_htt_rx_in_ord_ind(struct ath10k *ar, struct sk_buff *skb)
  8079. + {
  8080. + struct ath10k_htt *htt = &ar->htt;
  8081. + struct htt_resp *resp = (void *)skb->data;
  8082. +@@ -1835,12 +1825,12 @@ static void ath10k_htt_rx_in_ord_ind(str
  8083. + u8 tid;
  8084. + bool offload;
  8085. + bool frag;
  8086. +- int ret;
  8087. ++ int ret, num_msdus = 0;
  8088. +
  8089. + lockdep_assert_held(&htt->rx_ring.lock);
  8090. +
  8091. + if (htt->rx_confused)
  8092. +- return;
  8093. ++ return -EIO;
  8094. +
  8095. + skb_pull(skb, sizeof(resp->hdr));
  8096. + skb_pull(skb, sizeof(resp->rx_in_ord_ind));
  8097. +@@ -1859,7 +1849,7 @@ static void ath10k_htt_rx_in_ord_ind(str
  8098. +
  8099. + if (skb->len < msdu_count * sizeof(*resp->rx_in_ord_ind.msdu_descs)) {
  8100. + ath10k_warn(ar, "dropping invalid in order rx indication\n");
  8101. +- return;
  8102. ++ return -EINVAL;
  8103. + }
  8104. +
  8105. + /* The event can deliver more than 1 A-MSDU. Each A-MSDU is later
  8106. +@@ -1870,14 +1860,14 @@ static void ath10k_htt_rx_in_ord_ind(str
  8107. + if (ret < 0) {
  8108. + ath10k_warn(ar, "failed to pop paddr list: %d\n", ret);
  8109. + htt->rx_confused = true;
  8110. +- return;
  8111. ++ return -EIO;
  8112. + }
  8113. +
  8114. + /* Offloaded frames are very different and need to be handled
  8115. + * separately.
  8116. + */
  8117. + if (offload)
  8118. +- ath10k_htt_rx_h_rx_offload(ar, &list);
  8119. ++ num_msdus = ath10k_htt_rx_h_rx_offload(ar, &list);
  8120. +
  8121. + while (!skb_queue_empty(&list)) {
  8122. + __skb_queue_head_init(&amsdu);
  8123. +@@ -1890,6 +1880,7 @@ static void ath10k_htt_rx_in_ord_ind(str
  8124. + * better to report something than nothing though. This
  8125. + * should still give an idea about rx rate to the user.
  8126. + */
  8127. ++ num_msdus += skb_queue_len(&amsdu);
  8128. + ath10k_htt_rx_h_ppdu(ar, &amsdu, status, vdev_id);
  8129. + ath10k_htt_rx_h_filter(ar, &amsdu, status);
  8130. + ath10k_htt_rx_h_mpdu(ar, &amsdu, status);
  8131. +@@ -1902,9 +1893,10 @@ static void ath10k_htt_rx_in_ord_ind(str
  8132. + ath10k_warn(ar, "failed to extract amsdu: %d\n", ret);
  8133. + htt->rx_confused = true;
  8134. + __skb_queue_purge(&list);
  8135. +- return;
  8136. ++ return -EIO;
  8137. + }
  8138. + }
  8139. ++ return num_msdus;
  8140. + }
  8141. +
  8142. + static void ath10k_htt_rx_tx_fetch_resp_id_confirm(struct ath10k *ar,
  8143. +@@ -2267,7 +2259,6 @@ bool ath10k_htt_t2h_msg_handler(struct a
  8144. + }
  8145. + case HTT_T2H_MSG_TYPE_TX_COMPL_IND:
  8146. + ath10k_htt_rx_tx_compl_ind(htt->ar, skb);
  8147. +- tasklet_schedule(&htt->txrx_compl_task);
  8148. + break;
  8149. + case HTT_T2H_MSG_TYPE_SEC_IND: {
  8150. + struct ath10k *ar = htt->ar;
  8151. +@@ -2284,7 +2275,7 @@ bool ath10k_htt_t2h_msg_handler(struct a
  8152. + case HTT_T2H_MSG_TYPE_RX_FRAG_IND: {
  8153. + ath10k_dbg_dump(ar, ATH10K_DBG_HTT_DUMP, NULL, "htt event: ",
  8154. + skb->data, skb->len);
  8155. +- ath10k_htt_rx_frag_handler(htt);
  8156. ++ atomic_inc(&htt->num_mpdus_ready);
  8157. + break;
  8158. + }
  8159. + case HTT_T2H_MSG_TYPE_TEST:
  8160. +@@ -2322,8 +2313,7 @@ bool ath10k_htt_t2h_msg_handler(struct a
  8161. + break;
  8162. + }
  8163. + case HTT_T2H_MSG_TYPE_RX_IN_ORD_PADDR_IND: {
  8164. +- skb_queue_tail(&htt->rx_in_ord_compl_q, skb);
  8165. +- tasklet_schedule(&htt->txrx_compl_task);
  8166. ++ __skb_queue_tail(&htt->rx_in_ord_compl_q, skb);
  8167. + return false;
  8168. + }
  8169. + case HTT_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND:
  8170. +@@ -2349,7 +2339,6 @@ bool ath10k_htt_t2h_msg_handler(struct a
  8171. + break;
  8172. + }
  8173. + skb_queue_tail(&htt->tx_fetch_ind_q, tx_fetch_ind);
  8174. +- tasklet_schedule(&htt->txrx_compl_task);
  8175. + break;
  8176. + }
  8177. + case HTT_T2H_MSG_TYPE_TX_FETCH_CONFIRM:
  8178. +@@ -2378,27 +2367,77 @@ void ath10k_htt_rx_pktlog_completion_han
  8179. + }
  8180. + EXPORT_SYMBOL(ath10k_htt_rx_pktlog_completion_handler);
  8181. +
  8182. +-static void ath10k_htt_txrx_compl_task(unsigned long ptr)
  8183. ++int ath10k_htt_txrx_compl_task(struct ath10k *ar, int budget)
  8184. + {
  8185. +- struct ath10k_htt *htt = (struct ath10k_htt *)ptr;
  8186. +- struct ath10k *ar = htt->ar;
  8187. ++ struct ath10k_htt *htt = &ar->htt;
  8188. + struct htt_tx_done tx_done = {};
  8189. +- struct sk_buff_head rx_ind_q;
  8190. + struct sk_buff_head tx_ind_q;
  8191. + struct sk_buff *skb;
  8192. + unsigned long flags;
  8193. +- int num_mpdus;
  8194. ++ int quota = 0, done, num_rx_msdus;
  8195. ++ bool resched_napi = false;
  8196. +
  8197. +- __skb_queue_head_init(&rx_ind_q);
  8198. + __skb_queue_head_init(&tx_ind_q);
  8199. +
  8200. +- spin_lock_irqsave(&htt->rx_in_ord_compl_q.lock, flags);
  8201. +- skb_queue_splice_init(&htt->rx_in_ord_compl_q, &rx_ind_q);
  8202. +- spin_unlock_irqrestore(&htt->rx_in_ord_compl_q.lock, flags);
  8203. ++ /* Since in-ord-ind can deliver more than 1 A-MSDU in single event,
  8204. ++ * process it first to utilize full available quota.
  8205. ++ */
  8206. ++ while (quota < budget) {
  8207. ++ if (skb_queue_empty(&htt->rx_in_ord_compl_q))
  8208. ++ break;
  8209. +
  8210. +- spin_lock_irqsave(&htt->tx_fetch_ind_q.lock, flags);
  8211. +- skb_queue_splice_init(&htt->tx_fetch_ind_q, &tx_ind_q);
  8212. +- spin_unlock_irqrestore(&htt->tx_fetch_ind_q.lock, flags);
  8213. ++ skb = __skb_dequeue(&htt->rx_in_ord_compl_q);
  8214. ++ if (!skb) {
  8215. ++ resched_napi = true;
  8216. ++ goto exit;
  8217. ++ }
  8218. ++
  8219. ++ spin_lock_bh(&htt->rx_ring.lock);
  8220. ++ num_rx_msdus = ath10k_htt_rx_in_ord_ind(ar, skb);
  8221. ++ spin_unlock_bh(&htt->rx_ring.lock);
  8222. ++ if (num_rx_msdus < 0) {
  8223. ++ resched_napi = true;
  8224. ++ goto exit;
  8225. ++ }
  8226. ++
  8227. ++ dev_kfree_skb_any(skb);
  8228. ++ if (num_rx_msdus > 0)
  8229. ++ quota += num_rx_msdus;
  8230. ++
  8231. ++ if ((quota > ATH10K_NAPI_QUOTA_LIMIT) &&
  8232. ++ !skb_queue_empty(&htt->rx_in_ord_compl_q)) {
  8233. ++ resched_napi = true;
  8234. ++ goto exit;
  8235. ++ }
  8236. ++ }
  8237. ++
  8238. ++ while (quota < budget) {
  8239. ++ /* no more data to receive */
  8240. ++ if (!atomic_read(&htt->num_mpdus_ready))
  8241. ++ break;
  8242. ++
  8243. ++ num_rx_msdus = ath10k_htt_rx_handle_amsdu(htt);
  8244. ++ if (num_rx_msdus < 0) {
  8245. ++ resched_napi = true;
  8246. ++ goto exit;
  8247. ++ }
  8248. ++
  8249. ++ quota += num_rx_msdus;
  8250. ++ atomic_dec(&htt->num_mpdus_ready);
  8251. ++ if ((quota > ATH10K_NAPI_QUOTA_LIMIT) &&
  8252. ++ atomic_read(&htt->num_mpdus_ready)) {
  8253. ++ resched_napi = true;
  8254. ++ goto exit;
  8255. ++ }
  8256. ++ }
  8257. ++
  8258. ++ /* From NAPI documentation:
  8259. ++ * The napi poll() function may also process TX completions, in which
  8260. ++ * case if it processes the entire TX ring then it should count that
  8261. ++ * work as the rest of the budget.
  8262. ++ */
  8263. ++ if ((quota < budget) && !kfifo_is_empty(&htt->txdone_fifo))
  8264. ++ quota = budget;
  8265. +
  8266. + /* kfifo_get: called only within txrx_tasklet so it's neatly serialized.
  8267. + * From kfifo_get() documentation:
  8268. +@@ -2408,27 +2447,22 @@ static void ath10k_htt_txrx_compl_task(u
  8269. + while (kfifo_get(&htt->txdone_fifo, &tx_done))
  8270. + ath10k_txrx_tx_unref(htt, &tx_done);
  8271. +
  8272. ++ spin_lock_irqsave(&htt->tx_fetch_ind_q.lock, flags);
  8273. ++ skb_queue_splice_init(&htt->tx_fetch_ind_q, &tx_ind_q);
  8274. ++ spin_unlock_irqrestore(&htt->tx_fetch_ind_q.lock, flags);
  8275. ++
  8276. + while ((skb = __skb_dequeue(&tx_ind_q))) {
  8277. + ath10k_htt_rx_tx_fetch_ind(ar, skb);
  8278. + dev_kfree_skb_any(skb);
  8279. + }
  8280. +
  8281. +- num_mpdus = atomic_read(&htt->num_mpdus_ready);
  8282. +-
  8283. +- while (num_mpdus) {
  8284. +- if (ath10k_htt_rx_handle_amsdu(htt))
  8285. +- break;
  8286. +-
  8287. +- num_mpdus--;
  8288. +- atomic_dec(&htt->num_mpdus_ready);
  8289. +- }
  8290. +-
  8291. +- while ((skb = __skb_dequeue(&rx_ind_q))) {
  8292. +- spin_lock_bh(&htt->rx_ring.lock);
  8293. +- ath10k_htt_rx_in_ord_ind(ar, skb);
  8294. +- spin_unlock_bh(&htt->rx_ring.lock);
  8295. +- dev_kfree_skb_any(skb);
  8296. +- }
  8297. +-
  8298. ++exit:
  8299. + ath10k_htt_rx_msdu_buff_replenish(htt);
  8300. ++ /* In case of rx failure or more data to read, report budget
  8301. ++ * to reschedule NAPI poll
  8302. ++ */
  8303. ++ done = resched_napi ? budget : quota;
  8304. ++
  8305. ++ return done;
  8306. + }
  8307. ++EXPORT_SYMBOL(ath10k_htt_txrx_compl_task);
  8308. +--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
  8309. ++++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
  8310. +@@ -388,8 +388,6 @@ void ath10k_htt_tx_free(struct ath10k_ht
  8311. + {
  8312. + int size;
  8313. +
  8314. +- tasklet_kill(&htt->txrx_compl_task);
  8315. +-
  8316. + idr_for_each(&htt->pending_tx, ath10k_htt_tx_clean_up_pending, htt->ar);
  8317. + idr_destroy(&htt->pending_tx);
  8318. +
  8319. +--- a/drivers/net/wireless/ath/ath10k/pci.c
  8320. ++++ b/drivers/net/wireless/ath/ath10k/pci.c
  8321. +@@ -1502,12 +1502,10 @@ void ath10k_pci_hif_send_complete_check(
  8322. + ath10k_ce_per_engine_service(ar, pipe);
  8323. + }
  8324. +
  8325. +-void ath10k_pci_kill_tasklet(struct ath10k *ar)
  8326. ++static void ath10k_pci_rx_retry_sync(struct ath10k *ar)
  8327. + {
  8328. + struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
  8329. +
  8330. +- tasklet_kill(&ar_pci->intr_tq);
  8331. +-
  8332. + del_timer_sync(&ar_pci->rx_post_retry);
  8333. + }
  8334. +
  8335. +@@ -1566,7 +1564,7 @@ void ath10k_pci_hif_get_default_pipe(str
  8336. + ul_pipe, dl_pipe);
  8337. + }
  8338. +
  8339. +-static void ath10k_pci_irq_msi_fw_mask(struct ath10k *ar)
  8340. ++void ath10k_pci_irq_msi_fw_mask(struct ath10k *ar)
  8341. + {
  8342. + u32 val;
  8343. +
  8344. +@@ -1747,7 +1745,7 @@ void ath10k_pci_ce_deinit(struct ath10k
  8345. +
  8346. + void ath10k_pci_flush(struct ath10k *ar)
  8347. + {
  8348. +- ath10k_pci_kill_tasklet(ar);
  8349. ++ ath10k_pci_rx_retry_sync(ar);
  8350. + ath10k_pci_buffer_cleanup(ar);
  8351. + }
  8352. +
  8353. +@@ -2754,35 +2752,53 @@ static irqreturn_t ath10k_pci_interrupt_
  8354. + return IRQ_NONE;
  8355. + }
  8356. +
  8357. +- if (ar_pci->oper_irq_mode == ATH10K_PCI_IRQ_LEGACY) {
  8358. +- if (!ath10k_pci_irq_pending(ar))
  8359. +- return IRQ_NONE;
  8360. +-
  8361. +- ath10k_pci_disable_and_clear_legacy_irq(ar);
  8362. +- }
  8363. ++ if ((ar_pci->oper_irq_mode == ATH10K_PCI_IRQ_LEGACY) &&
  8364. ++ !ath10k_pci_irq_pending(ar))
  8365. ++ return IRQ_NONE;
  8366. +
  8367. +- tasklet_schedule(&ar_pci->intr_tq);
  8368. ++ ath10k_pci_disable_and_clear_legacy_irq(ar);
  8369. ++ ath10k_pci_irq_msi_fw_mask(ar);
  8370. ++ napi_schedule(&ar->napi);
  8371. +
  8372. + return IRQ_HANDLED;
  8373. + }
  8374. +
  8375. +-static void ath10k_pci_tasklet(unsigned long data)
  8376. ++static int ath10k_pci_napi_poll(struct napi_struct *ctx, int budget)
  8377. + {
  8378. +- struct ath10k *ar = (struct ath10k *)data;
  8379. +- struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
  8380. ++ struct ath10k *ar = container_of(ctx, struct ath10k, napi);
  8381. ++ int done = 0;
  8382. +
  8383. + if (ath10k_pci_has_fw_crashed(ar)) {
  8384. +- ath10k_pci_irq_disable(ar);
  8385. + ath10k_pci_fw_crashed_clear(ar);
  8386. + ath10k_pci_fw_crashed_dump(ar);
  8387. +- return;
  8388. ++ napi_complete(ctx);
  8389. ++ return done;
  8390. + }
  8391. +
  8392. + ath10k_ce_per_engine_service_any(ar);
  8393. +
  8394. +- /* Re-enable legacy irq that was disabled in the irq handler */
  8395. +- if (ar_pci->oper_irq_mode == ATH10K_PCI_IRQ_LEGACY)
  8396. ++ done = ath10k_htt_txrx_compl_task(ar, budget);
  8397. ++
  8398. ++ if (done < budget) {
  8399. ++ napi_complete(ctx);
  8400. ++ /* In case of MSI, it is possible that interrupts are received
  8401. ++ * while NAPI poll is inprogress. So pending interrupts that are
  8402. ++ * received after processing all copy engine pipes by NAPI poll
  8403. ++ * will not be handled again. This is causing failure to
  8404. ++ * complete boot sequence in x86 platform. So before enabling
  8405. ++ * interrupts safer to check for pending interrupts for
  8406. ++ * immediate servicing.
  8407. ++ */
  8408. ++ if (CE_INTERRUPT_SUMMARY(ar)) {
  8409. ++ napi_reschedule(&ar->napi);
  8410. ++ goto out;
  8411. ++ }
  8412. + ath10k_pci_enable_legacy_irq(ar);
  8413. ++ ath10k_pci_irq_msi_fw_unmask(ar);
  8414. ++ }
  8415. ++
  8416. ++out:
  8417. ++ return done;
  8418. + }
  8419. +
  8420. + static int ath10k_pci_request_irq_msi(struct ath10k *ar)
  8421. +@@ -2840,11 +2856,11 @@ static void ath10k_pci_free_irq(struct a
  8422. + free_irq(ar_pci->pdev->irq, ar);
  8423. + }
  8424. +
  8425. +-void ath10k_pci_init_irq_tasklets(struct ath10k *ar)
  8426. ++void ath10k_pci_init_napi(struct ath10k *ar)
  8427. + {
  8428. +- struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
  8429. +-
  8430. +- tasklet_init(&ar_pci->intr_tq, ath10k_pci_tasklet, (unsigned long)ar);
  8431. ++ netif_napi_add(&ar->napi_dev, &ar->napi, ath10k_pci_napi_poll,
  8432. ++ ATH10K_NAPI_BUDGET);
  8433. ++ napi_enable(&ar->napi);
  8434. + }
  8435. +
  8436. + static int ath10k_pci_init_irq(struct ath10k *ar)
  8437. +@@ -2852,7 +2868,7 @@ static int ath10k_pci_init_irq(struct at
  8438. + struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
  8439. + int ret;
  8440. +
  8441. +- ath10k_pci_init_irq_tasklets(ar);
  8442. ++ ath10k_pci_init_napi(ar);
  8443. +
  8444. + if (ath10k_pci_irq_mode != ATH10K_PCI_IRQ_AUTO)
  8445. + ath10k_info(ar, "limiting irq mode to: %d\n",
  8446. +@@ -3113,7 +3129,8 @@ int ath10k_pci_setup_resource(struct ath
  8447. +
  8448. + void ath10k_pci_release_resource(struct ath10k *ar)
  8449. + {
  8450. +- ath10k_pci_kill_tasklet(ar);
  8451. ++ ath10k_pci_rx_retry_sync(ar);
  8452. ++ netif_napi_del(&ar->napi);
  8453. + ath10k_pci_ce_deinit(ar);
  8454. + ath10k_pci_free_pipes(ar);
  8455. + }
  8456. +@@ -3274,7 +3291,7 @@ static int ath10k_pci_probe(struct pci_d
  8457. +
  8458. + err_free_irq:
  8459. + ath10k_pci_free_irq(ar);
  8460. +- ath10k_pci_kill_tasklet(ar);
  8461. ++ ath10k_pci_rx_retry_sync(ar);
  8462. +
  8463. + err_deinit_irq:
  8464. + ath10k_pci_deinit_irq(ar);
  8465. +--- a/drivers/net/wireless/ath/ath10k/pci.h
  8466. ++++ b/drivers/net/wireless/ath/ath10k/pci.h
  8467. +@@ -177,8 +177,6 @@ struct ath10k_pci {
  8468. + /* Operating interrupt mode */
  8469. + enum ath10k_pci_irq_mode oper_irq_mode;
  8470. +
  8471. +- struct tasklet_struct intr_tq;
  8472. +-
  8473. + struct ath10k_pci_pipe pipe_info[CE_COUNT_MAX];
  8474. +
  8475. + /* Copy Engine used for Diagnostic Accesses */
  8476. +@@ -294,8 +292,7 @@ void ath10k_pci_free_pipes(struct ath10k
  8477. + void ath10k_pci_free_pipes(struct ath10k *ar);
  8478. + void ath10k_pci_rx_replenish_retry(unsigned long ptr);
  8479. + void ath10k_pci_ce_deinit(struct ath10k *ar);
  8480. +-void ath10k_pci_init_irq_tasklets(struct ath10k *ar);
  8481. +-void ath10k_pci_kill_tasklet(struct ath10k *ar);
  8482. ++void ath10k_pci_init_napi(struct ath10k *ar);
  8483. + int ath10k_pci_init_pipes(struct ath10k *ar);
  8484. + int ath10k_pci_init_config(struct ath10k *ar);
  8485. + void ath10k_pci_rx_post(struct ath10k *ar);
  8486. +@@ -303,6 +300,7 @@ void ath10k_pci_flush(struct ath10k *ar)
  8487. + void ath10k_pci_enable_legacy_irq(struct ath10k *ar);
  8488. + bool ath10k_pci_irq_pending(struct ath10k *ar);
  8489. + void ath10k_pci_disable_and_clear_legacy_irq(struct ath10k *ar);
  8490. ++void ath10k_pci_irq_msi_fw_mask(struct ath10k *ar);
  8491. + int ath10k_pci_wait_for_target_init(struct ath10k *ar);
  8492. + int ath10k_pci_setup_resource(struct ath10k *ar);
  8493. + void ath10k_pci_release_resource(struct ath10k *ar);
  8494. 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
  8495. deleted file mode 100644
  8496. index e414f23..0000000
  8497. --- a/package/kernel/mac80211/patches/332-cfg80211-fix-faulty-variable-initialization-in-ieee8.patch
  8498. +++ /dev/null
  8499. @@ -1,22 +0,0 @@
  8500. -From: Felix Fietkau <nbd@openwrt.org>
  8501. -Date: Mon, 8 Feb 2016 14:24:36 +0100
  8502. -Subject: [PATCH] cfg80211: fix faulty variable initialization in
  8503. - ieee80211_amsdu_to_8023s
  8504. -
  8505. -reuse_skb is set to true if the code decides to use the last segment.
  8506. -Fixes a memory leak
  8507. -
  8508. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  8509. ----
  8510. -
  8511. ---- a/net/wireless/util.c
  8512. -+++ b/net/wireless/util.c
  8513. -@@ -676,7 +676,7 @@ void ieee80211_amsdu_to_8023s(struct sk_
  8514. - u8 *payload;
  8515. - int offset = 0, remaining, err;
  8516. - struct ethhdr eth;
  8517. -- bool reuse_skb = true;
  8518. -+ bool reuse_skb = false;
  8519. - bool last = false;
  8520. -
  8521. - if (has_80211_header) {
  8522. 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
  8523. new file mode 100644
  8524. index 0000000..d008ceb
  8525. --- /dev/null
  8526. +++ b/package/kernel/mac80211/patches/333-ath9k-fix-client-mode-beacon-configuration.patch
  8527. @@ -0,0 +1,69 @@
  8528. +From: Felix Fietkau <nbd@nbd.name>
  8529. +Date: Tue, 26 Jul 2016 08:05:10 +0200
  8530. +Subject: [PATCH] ath9k: fix client mode beacon configuration
  8531. +
  8532. +For pure station mode, iter_data.primary_beacon_vif was used and passed
  8533. +to ath_beacon_config, but not set to the station vif.
  8534. +This was causing the following warning:
  8535. +
  8536. +[ 100.310919] ------------[ cut here ]------------
  8537. +[ 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]()
  8538. +[ 100.402028] CPU: 0 PID: 7 Comm: kworker/u2:1 Tainted: G W 4.4.15 #5
  8539. +[ 100.409676] Workqueue: phy0 ieee80211_ibss_leave [mac80211]
  8540. +[ 100.415351] Stack : 8736e98c 870b4b20 87a25b54 800a6800 8782a080 80400d63 8039b96c 00000007
  8541. +[ 100.415351] 803c5edc 87875914 80400000 800a47cc 87a25b54 800a6800 803a0fd8 80400000
  8542. +[ 100.415351] 00000003 87875914 80400000 80094ae0 87a25b54 8787594c 00000000 801ef308
  8543. +[ 100.415351] 803ffe70 801ef300 87193d58 87b3a400 87b3ad00 70687930 00000000 00000000
  8544. +[ 100.415351] 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  8545. +[ 100.415351] ...
  8546. +[ 100.451703] Call Trace:
  8547. +[ 100.454235] [<800a6800>] vprintk_default+0x24/0x30
  8548. +[ 100.459110] [<800a47cc>] printk+0x2c/0x38
  8549. +[ 100.463190] [<800a6800>] vprintk_default+0x24/0x30
  8550. +[ 100.468072] [<80094ae0>] print_worker_info+0x148/0x174
  8551. +[ 100.473378] [<801ef308>] serial8250_console_putchar+0x0/0x44
  8552. +[ 100.479122] [<801ef300>] wait_for_xmitr+0xc4/0xcc
  8553. +[ 100.484014] [<87193d58>] ieee80211_ibss_leave+0xb90/0x1900 [mac80211]
  8554. +[ 100.490590] [<80081604>] warn_slowpath_common+0xa0/0xd0
  8555. +[ 100.495922] [<801a359c>] dump_stack+0x14/0x28
  8556. +[ 100.500350] [<80071a00>] show_stack+0x50/0x84
  8557. +[ 100.504784] [<80081604>] warn_slowpath_common+0xa0/0xd0
  8558. +[ 100.510106] [<87024c60>] ath9k_calculate_summary_state+0x250/0x60c [ath9k]
  8559. +[ 100.517105] [<800816b8>] warn_slowpath_null+0x18/0x24
  8560. +[ 100.522256] [<87024c60>] ath9k_calculate_summary_state+0x250/0x60c [ath9k]
  8561. +[ 100.529273] [<87025418>] ath9k_set_txpower+0x148/0x498 [ath9k]
  8562. +[ 100.535302] [<871d2c64>] cleanup_module+0xa74/0xd4c [mac80211]
  8563. +[ 100.541237] [<801ef308>] serial8250_console_putchar+0x0/0x44
  8564. +[ 100.547042] [<800a5d18>] wake_up_klogd+0x54/0x68
  8565. +[ 100.551730] [<800a6650>] vprintk_emit+0x404/0x43c
  8566. +[ 100.556623] [<871b9db8>] ieee80211_sta_rx_notify+0x258/0x32c [mac80211]
  8567. +[ 100.563475] [<871ba6a4>] ieee80211_sta_rx_queued_mgmt+0x63c/0x734 [mac80211]
  8568. +[ 100.570693] [<871aa49c>] ieee80211_tx_prepare_skb+0x210/0x230 [mac80211]
  8569. +[ 100.577609] [<800af5d4>] mod_timer+0x15c/0x190
  8570. +[ 100.582220] [<871ba8b8>] ieee80211_sta_work+0xfc/0xe1c [mac80211]
  8571. +[ 100.588539] [<871940b4>] ieee80211_ibss_leave+0xeec/0x1900 [mac80211]
  8572. +[ 100.595122] [<8009ec84>] dequeue_task_fair+0x44/0x130
  8573. +[ 100.600281] [<80092a34>] process_one_work+0x1f8/0x334
  8574. +[ 100.605454] [<80093830>] worker_thread+0x2b4/0x408
  8575. +[ 100.610317] [<8009357c>] worker_thread+0x0/0x408
  8576. +[ 100.615019] [<8009357c>] worker_thread+0x0/0x408
  8577. +[ 100.619705] [<80097b68>] kthread+0xdc/0xe8
  8578. +[ 100.623886] [<80097a8c>] kthread+0x0/0xe8
  8579. +[ 100.627961] [<80060878>] ret_from_kernel_thread+0x14/0x1c
  8580. +[ 100.633448]
  8581. +[ 100.634956] ---[ end trace aafbe57e9ae6862f ]---
  8582. +
  8583. +Fixes: cfda2d8e2314 ("ath9k: Fix beacon configuration for addition/removal of interfaces")
  8584. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  8585. +---
  8586. +
  8587. +--- a/drivers/net/wireless/ath/ath9k/main.c
  8588. ++++ b/drivers/net/wireless/ath/ath9k/main.c
  8589. +@@ -1154,6 +1154,7 @@ void ath9k_calculate_summary_state(struc
  8590. + bool changed = (iter_data.primary_sta != ctx->primary_sta);
  8591. +
  8592. + if (iter_data.primary_sta) {
  8593. ++ iter_data.primary_beacon_vif = iter_data.primary_sta;
  8594. + iter_data.beacons = true;
  8595. + ath9k_set_assoc_state(sc, iter_data.primary_sta,
  8596. + changed);
  8597. 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
  8598. deleted file mode 100644
  8599. index 6e2d0cf..0000000
  8600. --- a/package/kernel/mac80211/patches/333-cfg80211-reuse-existing-page-fragments-in-A-MSDU-rx.patch
  8601. +++ /dev/null
  8602. @@ -1,132 +0,0 @@
  8603. -From: Felix Fietkau <nbd@openwrt.org>
  8604. -Date: Mon, 8 Feb 2016 14:33:19 +0100
  8605. -Subject: [PATCH] cfg80211: reuse existing page fragments in A-MSDU rx
  8606. -
  8607. -This massively reduces data copying and thus improves rx performance
  8608. -
  8609. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  8610. ----
  8611. -
  8612. ---- a/net/wireless/util.c
  8613. -+++ b/net/wireless/util.c
  8614. -@@ -644,23 +644,93 @@ int ieee80211_data_from_8023(struct sk_b
  8615. - }
  8616. - EXPORT_SYMBOL(ieee80211_data_from_8023);
  8617. -
  8618. -+static void
  8619. -+__frame_add_frag(struct sk_buff *skb, struct page *page,
  8620. -+ void *ptr, int len, int size)
  8621. -+{
  8622. -+ struct skb_shared_info *sh = skb_shinfo(skb);
  8623. -+ int page_offset;
  8624. -+
  8625. -+ atomic_inc(&page->_count);
  8626. -+ page_offset = ptr - page_address(page);
  8627. -+ skb_add_rx_frag(skb, sh->nr_frags, page, page_offset, len, size);
  8628. -+}
  8629. -+
  8630. -+static void
  8631. -+__ieee80211_amsdu_copy_frag(struct sk_buff *skb, struct sk_buff *frame,
  8632. -+ int offset, int len)
  8633. -+{
  8634. -+ struct skb_shared_info *sh = skb_shinfo(skb);
  8635. -+ const skb_frag_t *frag = &sh->frags[-1];
  8636. -+ struct page *frag_page;
  8637. -+ void *frag_ptr;
  8638. -+ int frag_len, frag_size;
  8639. -+ int head_size = skb->len - skb->data_len;
  8640. -+ int cur_len;
  8641. -+
  8642. -+ frag_page = virt_to_head_page(skb->head);
  8643. -+ frag_ptr = skb->data;
  8644. -+ frag_size = head_size;
  8645. -+
  8646. -+ while (offset >= frag_size) {
  8647. -+ offset -= frag_size;
  8648. -+ frag++;
  8649. -+ frag_page = skb_frag_page(frag);
  8650. -+ frag_ptr = skb_frag_address(frag);
  8651. -+ frag_size = skb_frag_size(frag);
  8652. -+ }
  8653. -+
  8654. -+ frag_ptr += offset;
  8655. -+ frag_len = frag_size - offset;
  8656. -+
  8657. -+ cur_len = min(len, frag_len);
  8658. -+
  8659. -+ __frame_add_frag(frame, frag_page, frag_ptr, cur_len, frag_size);
  8660. -+ len -= cur_len;
  8661. -+
  8662. -+ while (len > 0) {
  8663. -+ frag++;
  8664. -+ frag_len = skb_frag_size(frag);
  8665. -+ cur_len = min(len, frag_len);
  8666. -+ __frame_add_frag(frame, skb_frag_page(frag),
  8667. -+ skb_frag_address(frag), cur_len, frag_len);
  8668. -+ len -= cur_len;
  8669. -+ }
  8670. -+}
  8671. -+
  8672. - static struct sk_buff *
  8673. - __ieee80211_amsdu_copy(struct sk_buff *skb, unsigned int hlen,
  8674. -- int offset, int len)
  8675. -+ int offset, int len, bool reuse_frag)
  8676. - {
  8677. - struct sk_buff *frame;
  8678. -+ int cur_len = len;
  8679. -
  8680. - if (skb->len - offset < len)
  8681. - return NULL;
  8682. -
  8683. - /*
  8684. -+ * When reusing framents, copy some data to the head to simplify
  8685. -+ * ethernet header handling and speed up protocol header processing
  8686. -+ * in the stack later.
  8687. -+ */
  8688. -+ if (reuse_frag)
  8689. -+ cur_len = min_t(int, len, 32);
  8690. -+
  8691. -+ /*
  8692. - * Allocate and reserve two bytes more for payload
  8693. - * alignment since sizeof(struct ethhdr) is 14.
  8694. - */
  8695. -- frame = dev_alloc_skb(hlen + sizeof(struct ethhdr) + 2 + len);
  8696. -+ frame = dev_alloc_skb(hlen + sizeof(struct ethhdr) + 2 + cur_len);
  8697. -
  8698. - skb_reserve(frame, hlen + sizeof(struct ethhdr) + 2);
  8699. -- skb_copy_bits(skb, offset, skb_put(frame, len), len);
  8700. -+ skb_copy_bits(skb, offset, skb_put(frame, cur_len), cur_len);
  8701. -+
  8702. -+ len -= cur_len;
  8703. -+ if (!len)
  8704. -+ return frame;
  8705. -+
  8706. -+ offset += cur_len;
  8707. -+ __ieee80211_amsdu_copy_frag(skb, frame, offset, len);
  8708. -
  8709. - return frame;
  8710. - }
  8711. -@@ -676,6 +746,7 @@ void ieee80211_amsdu_to_8023s(struct sk_
  8712. - u8 *payload;
  8713. - int offset = 0, remaining, err;
  8714. - struct ethhdr eth;
  8715. -+ bool reuse_frag = skb->head_frag && !skb_has_frag_list(skb);
  8716. - bool reuse_skb = false;
  8717. - bool last = false;
  8718. -
  8719. -@@ -703,12 +774,13 @@ void ieee80211_amsdu_to_8023s(struct sk_
  8720. - offset += sizeof(struct ethhdr);
  8721. - /* reuse skb for the last subframe */
  8722. - last = remaining <= subframe_len + padding;
  8723. -- if (!skb_is_nonlinear(skb) && last) {
  8724. -+ if (!skb_is_nonlinear(skb) && !reuse_frag && last) {
  8725. - skb_pull(skb, offset);
  8726. - frame = skb;
  8727. - reuse_skb = true;
  8728. - } else {
  8729. -- frame = __ieee80211_amsdu_copy(skb, hlen, offset, len);
  8730. -+ frame = __ieee80211_amsdu_copy(skb, hlen, offset, len,
  8731. -+ reuse_frag);
  8732. - if (!frame)
  8733. - goto purge;
  8734. -
  8735. 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
  8736. deleted file mode 100644
  8737. index f8f4f09..0000000
  8738. --- a/package/kernel/mac80211/patches/334-mac80211-fix-wiphy-supported_band-access.patch
  8739. +++ /dev/null
  8740. @@ -1,36 +0,0 @@
  8741. -From: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  8742. -Date: Wed, 10 Feb 2016 16:08:17 +0100
  8743. -Subject: [PATCH] mac80211: fix wiphy supported_band access
  8744. -
  8745. -Fix wiphy supported_band access in tx radiotap parsing. In particular,
  8746. -info->band is always set to 0 (IEEE80211_BAND_2GHZ) since it has not
  8747. -assigned yet. This cause a kernel crash on 5GHz only devices.
  8748. -Move ieee80211_parse_tx_radiotap() after info->band assignment
  8749. -
  8750. -Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  8751. ----
  8752. -
  8753. ---- a/net/mac80211/tx.c
  8754. -+++ b/net/mac80211/tx.c
  8755. -@@ -1890,10 +1890,6 @@ netdev_tx_t ieee80211_monitor_start_xmit
  8756. - info->flags = IEEE80211_TX_CTL_REQ_TX_STATUS |
  8757. - IEEE80211_TX_CTL_INJECTED;
  8758. -
  8759. -- /* process and remove the injection radiotap header */
  8760. -- if (!ieee80211_parse_tx_radiotap(local, skb))
  8761. -- goto fail;
  8762. --
  8763. - rcu_read_lock();
  8764. -
  8765. - /*
  8766. -@@ -1955,6 +1951,10 @@ netdev_tx_t ieee80211_monitor_start_xmit
  8767. - goto fail_rcu;
  8768. -
  8769. - info->band = chandef->chan->band;
  8770. -+ /* process and remove the injection radiotap header */
  8771. -+ if (!ieee80211_parse_tx_radiotap(local, skb))
  8772. -+ goto fail_rcu;
  8773. -+
  8774. - ieee80211_xmit(sdata, NULL, skb);
  8775. - rcu_read_unlock();
  8776. -
  8777. 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
  8778. deleted file mode 100644
  8779. index acaacf7..0000000
  8780. --- a/package/kernel/mac80211/patches/335-mac80211-minstrel_ht-set-A-MSDU-tx-limits-based-on-s.patch
  8781. +++ /dev/null
  8782. @@ -1,61 +0,0 @@
  8783. -From: Felix Fietkau <nbd@openwrt.org>
  8784. -Date: Thu, 18 Feb 2016 19:30:05 +0100
  8785. -Subject: [PATCH] mac80211: minstrel_ht: set A-MSDU tx limits based on selected
  8786. - max_prob_rate
  8787. -
  8788. -Prevents excessive A-MSDU aggregation at low data rates or bad
  8789. -conditions.
  8790. -
  8791. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  8792. ----
  8793. -
  8794. ---- a/net/mac80211/rc80211_minstrel_ht.c
  8795. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  8796. -@@ -883,6 +883,39 @@ minstrel_ht_set_rate(struct minstrel_pri
  8797. - ratetbl->rate[offset].flags = flags;
  8798. - }
  8799. -
  8800. -+static int
  8801. -+minstrel_ht_get_max_amsdu_len(struct minstrel_ht_sta *mi)
  8802. -+{
  8803. -+ int group = mi->max_prob_rate / MCS_GROUP_RATES;
  8804. -+ const struct mcs_group *g = &minstrel_mcs_groups[group];
  8805. -+ int rate = mi->max_prob_rate % MCS_GROUP_RATES;
  8806. -+
  8807. -+ /* Disable A-MSDU if max_prob_rate is bad */
  8808. -+ if (mi->groups[group].rates[rate].prob_ewma < MINSTREL_FRAC(50, 100))
  8809. -+ return 1;
  8810. -+
  8811. -+ /* If the rate is slower than single-stream MCS1, make A-MSDU limit small */
  8812. -+ if (g->duration[rate] > MCS_DURATION(1, 0, 52))
  8813. -+ return 500;
  8814. -+
  8815. -+ /*
  8816. -+ * If the rate is slower than single-stream MCS4, limit A-MSDU to usual
  8817. -+ * data packet size
  8818. -+ */
  8819. -+ if (g->duration[rate] > MCS_DURATION(1, 0, 104))
  8820. -+ return 1500;
  8821. -+
  8822. -+ /*
  8823. -+ * If the rate is slower than single-stream MCS7, limit A-MSDU to twice
  8824. -+ * the usual data packet size
  8825. -+ */
  8826. -+ if (g->duration[rate] > MCS_DURATION(1, 0, 260))
  8827. -+ return 3000;
  8828. -+
  8829. -+ /* unlimited */
  8830. -+ return 0;
  8831. -+}
  8832. -+
  8833. - static void
  8834. - minstrel_ht_update_rates(struct minstrel_priv *mp, struct minstrel_ht_sta *mi)
  8835. - {
  8836. -@@ -907,6 +940,7 @@ minstrel_ht_update_rates(struct minstrel
  8837. - minstrel_ht_set_rate(mp, mi, rates, i++, mi->max_prob_rate);
  8838. - }
  8839. -
  8840. -+ mi->sta->max_rc_amsdu_len = minstrel_ht_get_max_amsdu_len(mi);
  8841. - rates->rate[i].idx = -1;
  8842. - rate_control_set_rates(mp->hw, mi->sta, rates);
  8843. - }
  8844. 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
  8845. deleted file mode 100644
  8846. index 32a2ad6..0000000
  8847. --- a/package/kernel/mac80211/patches/336-mac80211-minstrel_ht-set-default-tx-aggregation-time.patch
  8848. +++ /dev/null
  8849. @@ -1,31 +0,0 @@
  8850. -From: Felix Fietkau <nbd@openwrt.org>
  8851. -Date: Thu, 18 Feb 2016 19:45:33 +0100
  8852. -Subject: [PATCH] mac80211: minstrel_ht: set default tx aggregation timeout to
  8853. - 0
  8854. -
  8855. -The value 5000 was put here with the addition of the timeout field to
  8856. -ieee80211_start_tx_ba_session. It was originally added in mac80211 to
  8857. -save resources for drivers like iwlwifi, which only supports a limited
  8858. -number of concurrent aggregation sessions.
  8859. -
  8860. -Since iwlwifi does not use minstrel_ht and other drivers don't need
  8861. -this, 0 is a better default - especially since there have been
  8862. -recent reports of aggregation setup related issues reproduced with
  8863. -ath9k. This should improve stability without causing any adverse
  8864. -effects.
  8865. -
  8866. -Cc: stable@vger.kernel.org
  8867. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  8868. ----
  8869. -
  8870. ---- a/net/mac80211/rc80211_minstrel_ht.c
  8871. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  8872. -@@ -692,7 +692,7 @@ minstrel_aggr_check(struct ieee80211_sta
  8873. - if (likely(sta->ampdu_mlme.tid_tx[tid]))
  8874. - return;
  8875. -
  8876. -- ieee80211_start_tx_ba_session(pubsta, tid, 5000);
  8877. -+ ieee80211_start_tx_ba_session(pubsta, tid, 0);
  8878. - }
  8879. -
  8880. - static void
  8881. 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
  8882. deleted file mode 100644
  8883. index 229351b..0000000
  8884. --- a/package/kernel/mac80211/patches/337-mac80211-minstrel_ht-fix-a-logic-error-in-RTS-CTS-ha.patch
  8885. +++ /dev/null
  8886. @@ -1,26 +0,0 @@
  8887. -From: Felix Fietkau <nbd@openwrt.org>
  8888. -Date: Wed, 24 Feb 2016 12:03:13 +0100
  8889. -Subject: [PATCH] mac80211: minstrel_ht: fix a logic error in RTS/CTS handling
  8890. -MIME-Version: 1.0
  8891. -Content-Type: text/plain; charset=UTF-8
  8892. -Content-Transfer-Encoding: 8bit
  8893. -
  8894. -RTS/CTS needs to be enabled if the rate is a fallback rate *or* if it's
  8895. -a dual-stream rate and the sta is in dynamic SMPS mode.
  8896. -
  8897. -Fixes: a3ebb4e1b763 ("mac80211: minstrel_ht: handle peers in dynamic SMPS")
  8898. -Reported-by: Matías Richart <mrichart@fing.edu.uy>
  8899. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  8900. ----
  8901. -
  8902. ---- a/net/mac80211/rc80211_minstrel_ht.c
  8903. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  8904. -@@ -872,7 +872,7 @@ minstrel_ht_set_rate(struct minstrel_pri
  8905. - * - if station is in dynamic SMPS (and streams > 1)
  8906. - * - for fallback rates, to increase chances of getting through
  8907. - */
  8908. -- if (offset > 0 &&
  8909. -+ if (offset > 0 ||
  8910. - (mi->sta->smps_mode == IEEE80211_SMPS_DYNAMIC &&
  8911. - group->streams > 1)) {
  8912. - ratetbl->rate[offset].count = ratetbl->rate[offset].count_rts;
  8913. 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
  8914. deleted file mode 100644
  8915. index 56cd94a..0000000
  8916. --- a/package/kernel/mac80211/patches/338-mac80211-Fix-Public-Action-frame-RX-in-AP-mode.patch
  8917. +++ /dev/null
  8918. @@ -1,35 +0,0 @@
  8919. -From: Jouni Malinen <jouni@qca.qualcomm.com>
  8920. -Date: Tue, 1 Mar 2016 00:29:00 +0200
  8921. -Subject: [PATCH] mac80211: Fix Public Action frame RX in AP mode
  8922. -
  8923. -Public Action frames use special rules for how the BSSID field (Address
  8924. -3) is set. A wildcard BSSID is used in cases where the transmitter and
  8925. -recipient are not members of the same BSS. As such, we need to accept
  8926. -Public Action frames with wildcard BSSID.
  8927. -
  8928. -Commit db8e17324553 ("mac80211: ignore frames between TDLS peers when
  8929. -operating as AP") added a rule that drops Action frames to TDLS-peers
  8930. -based on an Action frame having different DA (Address 1) and BSSID
  8931. -(Address 3) values. This is not correct since it misses the possibility
  8932. -of BSSID being a wildcard BSSID in which case the Address 1 would not
  8933. -necessarily match.
  8934. -
  8935. -Fix this by allowing mac80211 to accept wildcard BSSID in an Action
  8936. -frame when in AP mode.
  8937. -
  8938. -Fixes: db8e17324553 ("mac80211: ignore frames between TDLS peers when operating as AP")
  8939. -Cc: stable@vger.kernel.org
  8940. -Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
  8941. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  8942. ----
  8943. -
  8944. ---- a/net/mac80211/rx.c
  8945. -+++ b/net/mac80211/rx.c
  8946. -@@ -3374,6 +3374,7 @@ static bool ieee80211_accept_frame(struc
  8947. - return false;
  8948. - /* ignore action frames to TDLS-peers */
  8949. - if (ieee80211_is_action(hdr->frame_control) &&
  8950. -+ !is_broadcast_ether_addr(bssid) &&
  8951. - !ether_addr_equal(bssid, hdr->addr1))
  8952. - return false;
  8953. - }
  8954. 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
  8955. deleted file mode 100644
  8956. index 15d6cd0..0000000
  8957. --- a/package/kernel/mac80211/patches/339-cfg80211-add-radiotap-VHT-info-to-rtap_namespace_siz.patch
  8958. +++ /dev/null
  8959. @@ -1,21 +0,0 @@
  8960. -From: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  8961. -Date: Fri, 19 Feb 2016 11:43:04 +0100
  8962. -Subject: [PATCH] cfg80211: add radiotap VHT info to rtap_namespace_sizes
  8963. -
  8964. -Add IEEE80211_RADIOTAP_VHT entry to rtap_namespace_sizes array in order to
  8965. -define alignment and size of VHT info in tx radiotap
  8966. -
  8967. -Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  8968. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  8969. ----
  8970. -
  8971. ---- a/net/wireless/radiotap.c
  8972. -+++ b/net/wireless/radiotap.c
  8973. -@@ -43,6 +43,7 @@ static const struct radiotap_align_size
  8974. - [IEEE80211_RADIOTAP_DATA_RETRIES] = { .align = 1, .size = 1, },
  8975. - [IEEE80211_RADIOTAP_MCS] = { .align = 1, .size = 3, },
  8976. - [IEEE80211_RADIOTAP_AMPDU_STATUS] = { .align = 4, .size = 8, },
  8977. -+ [IEEE80211_RADIOTAP_VHT] = { .align = 2, .size = 12, },
  8978. - /*
  8979. - * add more here as they are defined in radiotap.h
  8980. - */
  8981. 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
  8982. deleted file mode 100644
  8983. index de1b386..0000000
  8984. --- a/package/kernel/mac80211/patches/340-mac80211-fix-parsing-of-40Mhz-in-injected-radiotap-h.patch
  8985. +++ /dev/null
  8986. @@ -1,36 +0,0 @@
  8987. -From: Sven Eckelmann <sven@narfation.org>
  8988. -Date: Wed, 24 Feb 2016 16:25:49 +0100
  8989. -Subject: [PATCH] mac80211: fix parsing of 40Mhz in injected radiotap
  8990. - header
  8991. -
  8992. -The MCS bandwidth part of the radiotap header is 2 bits wide. The full 2
  8993. -bit have to compared against IEEE80211_RADIOTAP_MCS_BW_40 and not only if
  8994. -the first bit is set. Otherwise IEEE80211_RADIOTAP_MCS_BW_40 can be
  8995. -confused with IEEE80211_RADIOTAP_MCS_BW_20U.
  8996. -
  8997. -Fixes: 5ec3aed9ba4c ("mac80211: Parse legacy and HT rate in injected frames")
  8998. -Signed-off-by: Sven Eckelmann <sven@narfation.org>
  8999. ----
  9000. -
  9001. ---- a/net/mac80211/tx.c
  9002. -+++ b/net/mac80211/tx.c
  9003. -@@ -1689,7 +1689,7 @@ static bool ieee80211_parse_tx_radiotap(
  9004. - bool rate_found = false;
  9005. - u8 rate_retries = 0;
  9006. - u16 rate_flags = 0;
  9007. -- u8 mcs_known, mcs_flags;
  9008. -+ u8 mcs_known, mcs_flags, mcs_bw;
  9009. - int i;
  9010. -
  9011. - info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT |
  9012. -@@ -1765,8 +1765,9 @@ static bool ieee80211_parse_tx_radiotap(
  9013. - mcs_flags & IEEE80211_RADIOTAP_MCS_SGI)
  9014. - rate_flags |= IEEE80211_TX_RC_SHORT_GI;
  9015. -
  9016. -+ mcs_bw = mcs_flags & IEEE80211_RADIOTAP_MCS_BW_MASK;
  9017. - if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_BW &&
  9018. -- mcs_flags & IEEE80211_RADIOTAP_MCS_BW_40)
  9019. -+ mcs_bw == IEEE80211_RADIOTAP_MCS_BW_40)
  9020. - rate_flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
  9021. - break;
  9022. -
  9023. 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
  9024. deleted file mode 100644
  9025. index ac1f251..0000000
  9026. --- a/package/kernel/mac80211/patches/341-mac80211-parse-VHT-info-in-injected-frames.patch
  9027. +++ /dev/null
  9028. @@ -1,65 +0,0 @@
  9029. -From: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  9030. -Date: Tue, 23 Feb 2016 15:43:35 +0100
  9031. -Subject: [PATCH] mac80211: parse VHT info in injected frames
  9032. -
  9033. -Add VHT radiotap parsing support to ieee80211_parse_tx_radiotap().
  9034. -That capability has been tested using a d-link dir-860l rev b1 running
  9035. -OpenWrt trunk and mt76 driver
  9036. -
  9037. -Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  9038. ----
  9039. -
  9040. ---- a/net/mac80211/tx.c
  9041. -+++ b/net/mac80211/tx.c
  9042. -@@ -1690,6 +1690,8 @@ static bool ieee80211_parse_tx_radiotap(
  9043. - u8 rate_retries = 0;
  9044. - u16 rate_flags = 0;
  9045. - u8 mcs_known, mcs_flags, mcs_bw;
  9046. -+ u16 vht_known;
  9047. -+ u8 vht_mcs = 0, vht_nss = 0;
  9048. - int i;
  9049. -
  9050. - info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT |
  9051. -@@ -1771,6 +1773,32 @@ static bool ieee80211_parse_tx_radiotap(
  9052. - rate_flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
  9053. - break;
  9054. -
  9055. -+ case IEEE80211_RADIOTAP_VHT:
  9056. -+ vht_known = get_unaligned_le16(iterator.this_arg);
  9057. -+ rate_found = true;
  9058. -+
  9059. -+ rate_flags = IEEE80211_TX_RC_VHT_MCS;
  9060. -+ if ((vht_known & IEEE80211_RADIOTAP_VHT_KNOWN_GI) &&
  9061. -+ (iterator.this_arg[2] &
  9062. -+ IEEE80211_RADIOTAP_VHT_FLAG_SGI))
  9063. -+ rate_flags |= IEEE80211_TX_RC_SHORT_GI;
  9064. -+ if (vht_known &
  9065. -+ IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH) {
  9066. -+ if (iterator.this_arg[3] == 1)
  9067. -+ rate_flags |=
  9068. -+ IEEE80211_TX_RC_40_MHZ_WIDTH;
  9069. -+ else if (iterator.this_arg[3] == 4)
  9070. -+ rate_flags |=
  9071. -+ IEEE80211_TX_RC_80_MHZ_WIDTH;
  9072. -+ else if (iterator.this_arg[3] == 11)
  9073. -+ rate_flags |=
  9074. -+ IEEE80211_TX_RC_160_MHZ_WIDTH;
  9075. -+ }
  9076. -+
  9077. -+ vht_mcs = iterator.this_arg[4] >> 4;
  9078. -+ vht_nss = iterator.this_arg[4] & 0xF;
  9079. -+ break;
  9080. -+
  9081. - /*
  9082. - * Please update the file
  9083. - * Documentation/networking/mac80211-injection.txt
  9084. -@@ -1796,6 +1824,9 @@ static bool ieee80211_parse_tx_radiotap(
  9085. -
  9086. - if (rate_flags & IEEE80211_TX_RC_MCS) {
  9087. - info->control.rates[0].idx = rate;
  9088. -+ } else if (rate_flags & IEEE80211_TX_RC_VHT_MCS) {
  9089. -+ ieee80211_rate_set_vht(info->control.rates, vht_mcs,
  9090. -+ vht_nss);
  9091. - } else {
  9092. - for (i = 0; i < sband->n_bitrates; i++) {
  9093. - if (rate * 5 != sband->bitrates[i].bitrate)
  9094. 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
  9095. deleted file mode 100644
  9096. index d7452c2..0000000
  9097. --- a/package/kernel/mac80211/patches/342-mac80211-do-not-pass-injected-frames-without-a-valid.patch
  9098. +++ /dev/null
  9099. @@ -1,23 +0,0 @@
  9100. -From: Felix Fietkau <nbd@openwrt.org>
  9101. -Date: Wed, 2 Mar 2016 15:51:40 +0100
  9102. -Subject: [PATCH] mac80211: do not pass injected frames without a valid rate to
  9103. - the driver
  9104. -
  9105. -Fall back to rate control if the requested bitrate was not found.
  9106. -
  9107. -Fixes: dfdfc2beb0dd ("mac80211: Parse legacy and HT rate in injected frames")
  9108. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  9109. ----
  9110. -
  9111. ---- a/net/mac80211/tx.c
  9112. -+++ b/net/mac80211/tx.c
  9113. -@@ -1837,6 +1837,9 @@ static bool ieee80211_parse_tx_radiotap(
  9114. - }
  9115. - }
  9116. -
  9117. -+ if (info->control.rates[0].idx < 0)
  9118. -+ info->control.flags &= ~IEEE80211_TX_CTRL_RATE_INJECT;
  9119. -+
  9120. - info->control.rates[0].flags = rate_flags;
  9121. - info->control.rates[0].count = min_t(u8, rate_retries + 1,
  9122. - local->hw.max_rate_tries);
  9123. 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
  9124. deleted file mode 100644
  9125. index 55ff817..0000000
  9126. --- a/package/kernel/mac80211/patches/343-mac80211-minstrel_ht-improve-sample-rate-skip-logic.patch
  9127. +++ /dev/null
  9128. @@ -1,77 +0,0 @@
  9129. -From: Felix Fietkau <nbd@openwrt.org>
  9130. -Date: Thu, 3 Mar 2016 23:20:06 +0100
  9131. -Subject: [PATCH] mac80211: minstrel_ht: improve sample rate skip logic
  9132. -
  9133. -There were a few issues that were slowing down the process of finding
  9134. -the optimal rate, especially on devices with multi-rate retry
  9135. -limitations:
  9136. -
  9137. -When max_tp_rate[0] was slower than max_tp_rate[1], the code did not
  9138. -sample max_tp_rate[1], which would often allow it to switch places with
  9139. -max_tp_rate[0] (e.g. if only the first sampling attempts were bad, but the
  9140. -rate is otherwise good).
  9141. -
  9142. -Also, sample attempts of rates between max_tp_rate[0] and [1] were being
  9143. -ignored in this case, because the code only checked if the rate was
  9144. -slower than [1].
  9145. -
  9146. -Fix this by checking against the fastest / second fastest max_tp_rate
  9147. -instead of assuming a specific order between the two.
  9148. -
  9149. -In my tests this patch significantly reduces the time until minstrel_ht
  9150. -finds the optimal rate right after assoc
  9151. -
  9152. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  9153. ----
  9154. -
  9155. ---- a/net/mac80211/rc80211_minstrel_ht.c
  9156. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  9157. -@@ -958,6 +958,7 @@ minstrel_get_sample_rate(struct minstrel
  9158. - struct minstrel_rate_stats *mrs;
  9159. - struct minstrel_mcs_group_data *mg;
  9160. - unsigned int sample_dur, sample_group, cur_max_tp_streams;
  9161. -+ int tp_rate1, tp_rate2;
  9162. - int sample_idx = 0;
  9163. -
  9164. - if (mi->sample_wait > 0) {
  9165. -@@ -979,14 +980,22 @@ minstrel_get_sample_rate(struct minstrel
  9166. - mrs = &mg->rates[sample_idx];
  9167. - sample_idx += sample_group * MCS_GROUP_RATES;
  9168. -
  9169. -+ /* Set tp_rate1, tp_rate2 to the highest / second highest max_tp_rate */
  9170. -+ if (minstrel_get_duration(mi->max_tp_rate[0]) >
  9171. -+ minstrel_get_duration(mi->max_tp_rate[1])) {
  9172. -+ tp_rate1 = mi->max_tp_rate[1];
  9173. -+ tp_rate2 = mi->max_tp_rate[0];
  9174. -+ } else {
  9175. -+ tp_rate1 = mi->max_tp_rate[0];
  9176. -+ tp_rate2 = mi->max_tp_rate[1];
  9177. -+ }
  9178. -+
  9179. - /*
  9180. - * Sampling might add some overhead (RTS, no aggregation)
  9181. -- * to the frame. Hence, don't use sampling for the currently
  9182. -- * used rates.
  9183. -+ * to the frame. Hence, don't use sampling for the highest currently
  9184. -+ * used highest throughput or probability rate.
  9185. - */
  9186. -- if (sample_idx == mi->max_tp_rate[0] ||
  9187. -- sample_idx == mi->max_tp_rate[1] ||
  9188. -- sample_idx == mi->max_prob_rate)
  9189. -+ if (sample_idx == mi->max_tp_rate[0] || sample_idx == mi->max_prob_rate)
  9190. - return -1;
  9191. -
  9192. - /*
  9193. -@@ -1001,10 +1010,10 @@ minstrel_get_sample_rate(struct minstrel
  9194. - * if the link is working perfectly.
  9195. - */
  9196. -
  9197. -- cur_max_tp_streams = minstrel_mcs_groups[mi->max_tp_rate[0] /
  9198. -+ cur_max_tp_streams = minstrel_mcs_groups[tp_rate1 /
  9199. - MCS_GROUP_RATES].streams;
  9200. - sample_dur = minstrel_get_duration(sample_idx);
  9201. -- if (sample_dur >= minstrel_get_duration(mi->max_tp_rate[1]) &&
  9202. -+ if (sample_dur >= minstrel_get_duration(tp_rate2) &&
  9203. - (cur_max_tp_streams - 1 <
  9204. - minstrel_mcs_groups[sample_group].streams ||
  9205. - sample_dur >= minstrel_get_duration(mi->max_prob_rate))) {
  9206. 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
  9207. deleted file mode 100644
  9208. index 3de0f64..0000000
  9209. --- a/package/kernel/mac80211/patches/344-0008-brcmfmac-use-device-memsize-config-from-fw-if-define.patch
  9210. +++ /dev/null
  9211. @@ -1,73 +0,0 @@
  9212. -From: Hante Meuleman <meuleman@broadcom.com>
  9213. -Date: Wed, 17 Feb 2016 11:26:57 +0100
  9214. -Subject: [PATCH] brcmfmac: use device memsize config from fw if defined
  9215. -
  9216. -Newer type pcie devices have memory which get shared between fw and
  9217. -hw. The division of this memory is done firmware compile time. As a
  9218. -result the ramsize as used by driver needs to be adjusted for this.
  9219. -This is done by reading the memory size from the firmware.
  9220. -
  9221. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  9222. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  9223. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  9224. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  9225. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  9226. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9227. ----
  9228. -
  9229. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  9230. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  9231. -@@ -207,6 +207,10 @@ static struct brcmf_firmware_mapping brc
  9232. - #define BRCMF_PCIE_CFGREG_REG_BAR3_CONFIG 0x4F4
  9233. - #define BRCMF_PCIE_LINK_STATUS_CTRL_ASPM_ENAB 3
  9234. -
  9235. -+/* Magic number at a magic location to find RAM size */
  9236. -+#define BRCMF_RAMSIZE_MAGIC 0x534d4152 /* SMAR */
  9237. -+#define BRCMF_RAMSIZE_OFFSET 0x6c
  9238. -+
  9239. -
  9240. - struct brcmf_pcie_console {
  9241. - u32 base_addr;
  9242. -@@ -1412,6 +1416,28 @@ static const struct brcmf_bus_ops brcmf_
  9243. - };
  9244. -
  9245. -
  9246. -+static void
  9247. -+brcmf_pcie_adjust_ramsize(struct brcmf_pciedev_info *devinfo, u8 *data,
  9248. -+ u32 data_len)
  9249. -+{
  9250. -+ __le32 *field;
  9251. -+ u32 newsize;
  9252. -+
  9253. -+ if (data_len < BRCMF_RAMSIZE_OFFSET + 8)
  9254. -+ return;
  9255. -+
  9256. -+ field = (__le32 *)&data[BRCMF_RAMSIZE_OFFSET];
  9257. -+ if (le32_to_cpup(field) != BRCMF_RAMSIZE_MAGIC)
  9258. -+ return;
  9259. -+ field++;
  9260. -+ newsize = le32_to_cpup(field);
  9261. -+
  9262. -+ brcmf_dbg(PCIE, "Found ramsize info in FW, adjusting to 0x%x\n",
  9263. -+ newsize);
  9264. -+ devinfo->ci->ramsize = newsize;
  9265. -+}
  9266. -+
  9267. -+
  9268. - static int
  9269. - brcmf_pcie_init_share_ram_info(struct brcmf_pciedev_info *devinfo,
  9270. - u32 sharedram_addr)
  9271. -@@ -1694,6 +1720,13 @@ static void brcmf_pcie_setup(struct devi
  9272. -
  9273. - brcmf_pcie_attach(devinfo);
  9274. -
  9275. -+ /* Some of the firmwares have the size of the memory of the device
  9276. -+ * defined inside the firmware. This is because part of the memory in
  9277. -+ * the device is shared and the devision is determined by FW. Parse
  9278. -+ * the firmware and adjust the chip memory size now.
  9279. -+ */
  9280. -+ brcmf_pcie_adjust_ramsize(devinfo, (u8 *)fw->data, fw->size);
  9281. -+
  9282. - ret = brcmf_pcie_download_fw_nvram(devinfo, fw, nvram, nvram_len);
  9283. - if (ret)
  9284. - goto fail;
  9285. 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
  9286. deleted file mode 100644
  9287. index ca03ffe..0000000
  9288. --- a/package/kernel/mac80211/patches/344-0009-brcmfmac-use-bar1-window-size-as-provided-by-pci-sub.patch
  9289. +++ /dev/null
  9290. @@ -1,58 +0,0 @@
  9291. -From: Hante Meuleman <meuleman@broadcom.com>
  9292. -Date: Wed, 17 Feb 2016 11:26:58 +0100
  9293. -Subject: [PATCH] brcmfmac: use bar1 window size as provided by pci subsystem
  9294. -
  9295. -The PCIE bar1 window size is specified by chip. Currently the
  9296. -ioremap of bar1 was using a define which always matched the size
  9297. -of bar1, but newer chips can have a different bar1 sizes. With
  9298. -this patch the ioremap will be called with the by chip provided
  9299. -window size.
  9300. -
  9301. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  9302. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  9303. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  9304. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  9305. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  9306. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9307. ----
  9308. -
  9309. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  9310. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  9311. -@@ -72,7 +72,6 @@ static struct brcmf_firmware_mapping brc
  9312. -
  9313. - #define BRCMF_PCIE_FW_UP_TIMEOUT 2000 /* msec */
  9314. -
  9315. --#define BRCMF_PCIE_TCM_MAP_SIZE (4096 * 1024)
  9316. - #define BRCMF_PCIE_REG_MAP_SIZE (32 * 1024)
  9317. -
  9318. - /* backplane addres space accessed by BAR0 */
  9319. -@@ -252,7 +251,6 @@ struct brcmf_pciedev_info {
  9320. - char nvram_name[BRCMF_FW_NAME_LEN];
  9321. - void __iomem *regs;
  9322. - void __iomem *tcm;
  9323. -- u32 tcm_size;
  9324. - u32 ram_base;
  9325. - u32 ram_size;
  9326. - struct brcmf_chip *ci;
  9327. -@@ -1592,8 +1590,7 @@ static int brcmf_pcie_get_resource(struc
  9328. - }
  9329. -
  9330. - devinfo->regs = ioremap_nocache(bar0_addr, BRCMF_PCIE_REG_MAP_SIZE);
  9331. -- devinfo->tcm = ioremap_nocache(bar1_addr, BRCMF_PCIE_TCM_MAP_SIZE);
  9332. -- devinfo->tcm_size = BRCMF_PCIE_TCM_MAP_SIZE;
  9333. -+ devinfo->tcm = ioremap_nocache(bar1_addr, bar1_size);
  9334. -
  9335. - if (!devinfo->regs || !devinfo->tcm) {
  9336. - brcmf_err("ioremap() failed (%p,%p)\n", devinfo->regs,
  9337. -@@ -1602,8 +1599,9 @@ static int brcmf_pcie_get_resource(struc
  9338. - }
  9339. - brcmf_dbg(PCIE, "Phys addr : reg space = %p base addr %#016llx\n",
  9340. - devinfo->regs, (unsigned long long)bar0_addr);
  9341. -- brcmf_dbg(PCIE, "Phys addr : mem space = %p base addr %#016llx\n",
  9342. -- devinfo->tcm, (unsigned long long)bar1_addr);
  9343. -+ brcmf_dbg(PCIE, "Phys addr : mem space = %p base addr %#016llx size 0x%x\n",
  9344. -+ devinfo->tcm, (unsigned long long)bar1_addr,
  9345. -+ (unsigned int)bar1_size);
  9346. -
  9347. - return 0;
  9348. - }
  9349. 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
  9350. deleted file mode 100644
  9351. index e4a8f30..0000000
  9352. --- a/package/kernel/mac80211/patches/344-0010-brcmfmac-add-support-for-the-PCIE-4366c0-chip.patch
  9353. +++ /dev/null
  9354. @@ -1,34 +0,0 @@
  9355. -From: Hante Meuleman <meuleman@broadcom.com>
  9356. -Date: Wed, 17 Feb 2016 11:26:59 +0100
  9357. -Subject: [PATCH] brcmfmac: add support for the PCIE 4366c0 chip
  9358. -
  9359. -A newer version of the 4366 PCIE chip has been released. Add
  9360. -support for this version of the chip.
  9361. -
  9362. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  9363. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  9364. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  9365. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  9366. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9367. ----
  9368. -
  9369. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  9370. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  9371. -@@ -53,6 +53,7 @@ BRCMF_FW_NVRAM_DEF(4358, "brcmfmac4358-p
  9372. - BRCMF_FW_NVRAM_DEF(4359, "brcmfmac4359-pcie.bin", "brcmfmac4359-pcie.txt");
  9373. - BRCMF_FW_NVRAM_DEF(4365B, "brcmfmac4365b-pcie.bin", "brcmfmac4365b-pcie.txt");
  9374. - BRCMF_FW_NVRAM_DEF(4366B, "brcmfmac4366b-pcie.bin", "brcmfmac4366b-pcie.txt");
  9375. -+BRCMF_FW_NVRAM_DEF(4366C, "brcmfmac4366c-pcie.bin", "brcmfmac4366c-pcie.txt");
  9376. - BRCMF_FW_NVRAM_DEF(4371, "brcmfmac4371-pcie.bin", "brcmfmac4371-pcie.txt");
  9377. -
  9378. - static struct brcmf_firmware_mapping brcmf_pcie_fwnames[] = {
  9379. -@@ -66,7 +67,8 @@ static struct brcmf_firmware_mapping brc
  9380. - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4358_CHIP_ID, 0xFFFFFFFF, 4358),
  9381. - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4359_CHIP_ID, 0xFFFFFFFF, 4359),
  9382. - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4365_CHIP_ID, 0xFFFFFFFF, 4365B),
  9383. -- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4366_CHIP_ID, 0xFFFFFFFF, 4366B),
  9384. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4366_CHIP_ID, 0x0000000F, 4366B),
  9385. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4366_CHIP_ID, 0xFFFFFFF0, 4366C),
  9386. - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4371_CHIP_ID, 0xFFFFFFFF, 4371),
  9387. - };
  9388. -
  9389. 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
  9390. deleted file mode 100644
  9391. index c529ff2..0000000
  9392. --- a/package/kernel/mac80211/patches/344-0012-brcmfmac-increase-timeout-for-tx-eapol.patch
  9393. +++ /dev/null
  9394. @@ -1,30 +0,0 @@
  9395. -From: Hante Meuleman <meuleman@broadcom.com>
  9396. -Date: Wed, 17 Feb 2016 11:27:01 +0100
  9397. -Subject: [PATCH] brcmfmac: increase timeout for tx eapol
  9398. -
  9399. -When keys get set and updated this has to happen after eapol got
  9400. -transmitted (without key or old key) before the key can be updated.
  9401. -To make sure the order of sending eapol and configuring key is done
  9402. -correctly a timeout for tx of eapol is applied. This timeout is set
  9403. -to 50 msec, which is not always enough. Especially in AP mode and
  9404. -key updates the timeout may need to be much longer because client(s)
  9405. -can be in powersave. Increase the timeout from 50 to 950 msec.
  9406. -
  9407. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  9408. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  9409. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  9410. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  9411. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9412. ----
  9413. -
  9414. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  9415. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  9416. -@@ -40,7 +40,7 @@ MODULE_AUTHOR("Broadcom Corporation");
  9417. - MODULE_DESCRIPTION("Broadcom 802.11 wireless LAN fullmac driver.");
  9418. - MODULE_LICENSE("Dual BSD/GPL");
  9419. -
  9420. --#define MAX_WAIT_FOR_8021X_TX msecs_to_jiffies(50)
  9421. -+#define MAX_WAIT_FOR_8021X_TX msecs_to_jiffies(950)
  9422. -
  9423. - /* AMPDU rx reordering definitions */
  9424. - #define BRCMF_RXREORDER_FLOWID_OFFSET 0
  9425. 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
  9426. deleted file mode 100644
  9427. index f293401..0000000
  9428. --- a/package/kernel/mac80211/patches/345-brcmfmac-insert-default-boardrev-in-nvram-data-if-mi.patch
  9429. +++ /dev/null
  9430. @@ -1,114 +0,0 @@
  9431. -From: Hante Meuleman <hante.meuleman@broadcom.com>
  9432. -Date: Mon, 11 Apr 2016 11:35:23 +0200
  9433. -Subject: [PATCH] brcmfmac: insert default boardrev in nvram data if
  9434. - missing
  9435. -
  9436. -Some nvram files/stores come without the boardrev information,
  9437. -but firmware requires this to be set. When not found in nvram then
  9438. -add a default boardrev string to the nvram data.
  9439. -
  9440. -Reported-by: Rafal Milecki <zajec5@gmail.com>
  9441. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  9442. -Reviewed-by: Franky (Zhenhui) Lin <franky.lin@broadcom.com>
  9443. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  9444. -Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
  9445. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  9446. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9447. ----
  9448. -
  9449. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  9450. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  9451. -@@ -29,6 +29,7 @@
  9452. - #define BRCMF_FW_MAX_NVRAM_SIZE 64000
  9453. - #define BRCMF_FW_NVRAM_DEVPATH_LEN 19 /* devpath0=pcie/1/4/ */
  9454. - #define BRCMF_FW_NVRAM_PCIEDEV_LEN 10 /* pcie/1/4/ + \0 */
  9455. -+#define BRCMF_FW_DEFAULT_BOARDREV "boardrev=0xff"
  9456. -
  9457. - enum nvram_parser_state {
  9458. - IDLE,
  9459. -@@ -51,6 +52,7 @@ enum nvram_parser_state {
  9460. - * @entry: start position of key,value entry.
  9461. - * @multi_dev_v1: detect pcie multi device v1 (compressed).
  9462. - * @multi_dev_v2: detect pcie multi device v2.
  9463. -+ * @boardrev_found: nvram contains boardrev information.
  9464. - */
  9465. - struct nvram_parser {
  9466. - enum nvram_parser_state state;
  9467. -@@ -63,6 +65,7 @@ struct nvram_parser {
  9468. - u32 entry;
  9469. - bool multi_dev_v1;
  9470. - bool multi_dev_v2;
  9471. -+ bool boardrev_found;
  9472. - };
  9473. -
  9474. - /**
  9475. -@@ -125,6 +128,8 @@ static enum nvram_parser_state brcmf_nvr
  9476. - nvp->multi_dev_v1 = true;
  9477. - if (strncmp(&nvp->data[nvp->entry], "pcie/", 5) == 0)
  9478. - nvp->multi_dev_v2 = true;
  9479. -+ if (strncmp(&nvp->data[nvp->entry], "boardrev", 8) == 0)
  9480. -+ nvp->boardrev_found = true;
  9481. - } else if (!is_nvram_char(c) || c == ' ') {
  9482. - brcmf_dbg(INFO, "warning: ln=%d:col=%d: '=' expected, skip invalid key entry\n",
  9483. - nvp->line, nvp->column);
  9484. -@@ -284,6 +289,8 @@ static void brcmf_fw_strip_multi_v1(stru
  9485. - while (i < nvp->nvram_len) {
  9486. - if ((nvp->nvram[i] - '0' == id) && (nvp->nvram[i + 1] == ':')) {
  9487. - i += 2;
  9488. -+ if (strncmp(&nvp->nvram[i], "boardrev", 8) == 0)
  9489. -+ nvp->boardrev_found = true;
  9490. - while (nvp->nvram[i] != 0) {
  9491. - nvram[j] = nvp->nvram[i];
  9492. - i++;
  9493. -@@ -335,6 +342,8 @@ static void brcmf_fw_strip_multi_v2(stru
  9494. - while (i < nvp->nvram_len - len) {
  9495. - if (strncmp(&nvp->nvram[i], prefix, len) == 0) {
  9496. - i += len;
  9497. -+ if (strncmp(&nvp->nvram[i], "boardrev", 8) == 0)
  9498. -+ nvp->boardrev_found = true;
  9499. - while (nvp->nvram[i] != 0) {
  9500. - nvram[j] = nvp->nvram[i];
  9501. - i++;
  9502. -@@ -356,6 +365,18 @@ fail:
  9503. - nvp->nvram_len = 0;
  9504. - }
  9505. -
  9506. -+static void brcmf_fw_add_defaults(struct nvram_parser *nvp)
  9507. -+{
  9508. -+ if (nvp->boardrev_found)
  9509. -+ return;
  9510. -+
  9511. -+ memcpy(&nvp->nvram[nvp->nvram_len], &BRCMF_FW_DEFAULT_BOARDREV,
  9512. -+ strlen(BRCMF_FW_DEFAULT_BOARDREV));
  9513. -+ nvp->nvram_len += strlen(BRCMF_FW_DEFAULT_BOARDREV);
  9514. -+ nvp->nvram[nvp->nvram_len] = '\0';
  9515. -+ nvp->nvram_len++;
  9516. -+}
  9517. -+
  9518. - /* brcmf_nvram_strip :Takes a buffer of "<var>=<value>\n" lines read from a fil
  9519. - * and ending in a NUL. Removes carriage returns, empty lines, comment lines,
  9520. - * and converts newlines to NULs. Shortens buffer as needed and pads with NULs.
  9521. -@@ -377,16 +398,21 @@ static void *brcmf_fw_nvram_strip(const
  9522. - if (nvp.state == END)
  9523. - break;
  9524. - }
  9525. -- if (nvp.multi_dev_v1)
  9526. -+ if (nvp.multi_dev_v1) {
  9527. -+ nvp.boardrev_found = false;
  9528. - brcmf_fw_strip_multi_v1(&nvp, domain_nr, bus_nr);
  9529. -- else if (nvp.multi_dev_v2)
  9530. -+ } else if (nvp.multi_dev_v2) {
  9531. -+ nvp.boardrev_found = false;
  9532. - brcmf_fw_strip_multi_v2(&nvp, domain_nr, bus_nr);
  9533. -+ }
  9534. -
  9535. - if (nvp.nvram_len == 0) {
  9536. - kfree(nvp.nvram);
  9537. - return NULL;
  9538. - }
  9539. -
  9540. -+ brcmf_fw_add_defaults(&nvp);
  9541. -+
  9542. - pad = nvp.nvram_len;
  9543. - *new_length = roundup(nvp.nvram_len + 1, 4);
  9544. - while (pad != *new_length) {
  9545. diff --git a/package/kernel/mac80211/patches/402-ath_regd_optional.patch b/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  9546. index 7351353..4634283 100644
  9547. --- a/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  9548. +++ b/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  9549. @@ -8,7 +8,7 @@
  9550. + return;
  9551. +#endif
  9552. +
  9553. - for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
  9554. + for (band = 0; band < NUM_NL80211_BANDS; band++) {
  9555. if (!wiphy->bands[band])
  9556. continue;
  9557. @@ -374,6 +378,10 @@ ath_reg_apply_ir_flags(struct wiphy *wip
  9558. @@ -19,7 +19,7 @@
  9559. + return;
  9560. +#endif
  9561. +
  9562. - sband = wiphy->bands[IEEE80211_BAND_2GHZ];
  9563. + sband = wiphy->bands[NL80211_BAND_2GHZ];
  9564. if (!sband)
  9565. return;
  9566. @@ -402,6 +410,10 @@ static void ath_reg_apply_radar_flags(st
  9567. @@ -30,7 +30,7 @@
  9568. + return;
  9569. +#endif
  9570. +
  9571. - if (!wiphy->bands[IEEE80211_BAND_5GHZ])
  9572. + if (!wiphy->bands[NL80211_BAND_5GHZ])
  9573. return;
  9574. @@ -633,6 +645,11 @@ ath_regd_init_wiphy(struct ath_regulator
  9575. @@ -59,7 +59,7 @@
  9576. ---help---
  9577. --- a/.local-symbols
  9578. +++ b/.local-symbols
  9579. -@@ -125,6 +125,7 @@ ADM8211=
  9580. +@@ -127,6 +127,7 @@ ADM8211=
  9581. ATH_COMMON=
  9582. WLAN_VENDOR_ATH=
  9583. ATH_DEBUG=
  9584. 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
  9585. index 1a62484..f2f52f9 100644
  9586. --- a/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch
  9587. +++ b/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch
  9588. @@ -1,6 +1,6 @@
  9589. --- a/drivers/net/wireless/ath/ath9k/init.c
  9590. +++ b/drivers/net/wireless/ath/ath9k/init.c
  9591. -@@ -722,6 +722,7 @@ static const struct ieee80211_iface_limi
  9592. +@@ -727,6 +727,7 @@ static const struct ieee80211_iface_limi
  9593. BIT(NL80211_IFTYPE_AP) },
  9594. { .max = 1, .types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  9595. BIT(NL80211_IFTYPE_P2P_GO) },
  9596. diff --git a/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch b/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch
  9597. index a7f9d9f..f21eed1 100644
  9598. --- a/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch
  9599. +++ b/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch
  9600. @@ -1,6 +1,6 @@
  9601. --- a/drivers/net/wireless/ath/ath9k/debug.c
  9602. +++ b/drivers/net/wireless/ath/ath9k/debug.c
  9603. -@@ -1301,6 +1301,53 @@ void ath9k_deinit_debug(struct ath_softc
  9604. +@@ -1315,6 +1315,53 @@ void ath9k_deinit_debug(struct ath_softc
  9605. ath9k_cmn_spectral_deinit_debug(&sc->spec_priv);
  9606. }
  9607. @@ -54,7 +54,7 @@
  9608. int ath9k_init_debug(struct ath_hw *ah)
  9609. {
  9610. struct ath_common *common = ath9k_hw_common(ah);
  9611. -@@ -1320,6 +1367,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  9612. +@@ -1334,6 +1381,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  9613. ath9k_tx99_init_debug(sc);
  9614. ath9k_cmn_spectral_init_debug(&sc->spec_priv, sc->debug.debugfs_phy);
  9615. diff --git a/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch b/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch
  9616. index 5892c3e..1825d77 100644
  9617. --- a/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch
  9618. +++ b/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch
  9619. @@ -1,6 +1,6 @@
  9620. --- a/drivers/net/wireless/ath/ath9k/init.c
  9621. +++ b/drivers/net/wireless/ath/ath9k/init.c
  9622. -@@ -1024,23 +1024,23 @@ static int __init ath9k_init(void)
  9623. +@@ -1030,23 +1030,23 @@ static int __init ath9k_init(void)
  9624. {
  9625. int error;
  9626. diff --git a/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch b/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch
  9627. index 6766111..15b8d7b 100644
  9628. --- a/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch
  9629. +++ b/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch
  9630. @@ -8,4 +8,4 @@
  9631. +#define ATH_RXBUF 256
  9632. #define ATH_TXBUF 512
  9633. #define ATH_TXBUF_RESERVE 5
  9634. - #define ATH_MAX_QDEPTH (ATH_TXBUF / 4 - ATH_TXBUF_RESERVE)
  9635. + #define ATH_TXMAXTRY 13
  9636. diff --git a/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch b/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch
  9637. index 5ecf528..c98072b 100644
  9638. --- a/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch
  9639. +++ b/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch
  9640. @@ -1,6 +1,6 @@
  9641. --- a/drivers/net/wireless/ath/ath9k/debug.c
  9642. +++ b/drivers/net/wireless/ath/ath9k/debug.c
  9643. -@@ -1348,6 +1348,52 @@ static const struct file_operations fops
  9644. +@@ -1362,6 +1362,52 @@ static const struct file_operations fops
  9645. .owner = THIS_MODULE
  9646. };
  9647. @@ -53,7 +53,7 @@
  9648. int ath9k_init_debug(struct ath_hw *ah)
  9649. {
  9650. struct ath_common *common = ath9k_hw_common(ah);
  9651. -@@ -1369,6 +1415,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  9652. +@@ -1383,6 +1429,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  9653. debugfs_create_file("eeprom", S_IRUSR, sc->debug.debugfs_phy, sc,
  9654. &fops_eeprom);
  9655. @@ -90,7 +90,7 @@
  9656. ichan->channel = chan->center_freq;
  9657. ichan->chan = chan;
  9658. @@ -308,7 +310,19 @@ static void ath9k_cmn_update_ichannel(st
  9659. - if (chan->band == IEEE80211_BAND_5GHZ)
  9660. + if (chan->band == NL80211_BAND_5GHZ)
  9661. flags |= CHANNEL_5GHZ;
  9662. - switch (chandef->width) {
  9663. diff --git a/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch b/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
  9664. index c84d1bc..167eeff 100644
  9665. --- a/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
  9666. +++ b/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
  9667. @@ -20,7 +20,7 @@
  9668. #define AR9160_DEVID_PCI 0x0027
  9669. --- a/drivers/net/wireless/ath/ath9k/pci.c
  9670. +++ b/drivers/net/wireless/ath/ath9k/pci.c
  9671. -@@ -751,6 +751,7 @@ static const struct pci_device_id ath_pc
  9672. +@@ -761,6 +761,7 @@ static const struct pci_device_id ath_pc
  9673. .driver_data = ATH9K_PCI_BT_ANT_DIV },
  9674. #endif
  9675. diff --git a/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
  9676. index e151a12..c40598d 100644
  9677. --- a/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
  9678. +++ b/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
  9679. @@ -1,6 +1,6 @@
  9680. --- a/include/net/cfg80211.h
  9681. +++ b/include/net/cfg80211.h
  9682. -@@ -2363,6 +2363,7 @@ struct cfg80211_qos_map {
  9683. +@@ -2410,6 +2410,7 @@ struct cfg80211_qos_map {
  9684. * (as advertised by the nl80211 feature flag.)
  9685. * @get_tx_power: store the current TX power into the dbm variable;
  9686. * return 0 if successful
  9687. @@ -8,7 +8,7 @@
  9688. *
  9689. * @set_wds_peer: set the WDS peer for a WDS interface
  9690. *
  9691. -@@ -2624,6 +2625,7 @@ struct cfg80211_ops {
  9692. +@@ -2671,6 +2672,7 @@ struct cfg80211_ops {
  9693. enum nl80211_tx_power_setting type, int mbm);
  9694. int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
  9695. int *dbm);
  9696. @@ -18,7 +18,7 @@
  9697. const u8 *addr);
  9698. --- a/include/net/mac80211.h
  9699. +++ b/include/net/mac80211.h
  9700. -@@ -1286,6 +1286,7 @@ enum ieee80211_smps_mode {
  9701. +@@ -1317,6 +1317,7 @@ enum ieee80211_smps_mode {
  9702. *
  9703. * @power_level: requested transmit power (in dBm), backward compatibility
  9704. * value only that is set to the minimum of all interfaces
  9705. @@ -26,7 +26,7 @@
  9706. *
  9707. * @chandef: the channel definition to tune to
  9708. * @radar_enabled: whether radar detection is enabled
  9709. -@@ -1306,6 +1307,7 @@ enum ieee80211_smps_mode {
  9710. +@@ -1337,6 +1338,7 @@ enum ieee80211_smps_mode {
  9711. struct ieee80211_conf {
  9712. u32 flags;
  9713. int power_level, dynamic_ps_timeout;
  9714. @@ -36,9 +36,9 @@
  9715. u8 ps_dtim_period;
  9716. --- a/include/uapi/linux/nl80211.h
  9717. +++ b/include/uapi/linux/nl80211.h
  9718. -@@ -1790,6 +1790,9 @@ enum nl80211_commands {
  9719. - * between scans. The scan plans are executed sequentially.
  9720. - * Each scan plan is a nested attribute of &enum nl80211_sched_scan_plan.
  9721. +@@ -1829,6 +1829,9 @@ enum nl80211_commands {
  9722. + * %NL80211_ATTR_EXT_CAPA_MASK, to specify the extended capabilities per
  9723. + * interface type.
  9724. *
  9725. + * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce
  9726. + * transmit power to stay within regulatory limits. u32, dBi.
  9727. @@ -46,9 +46,9 @@
  9728. * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  9729. * @NL80211_ATTR_MAX: highest attribute number currently defined
  9730. * @__NL80211_ATTR_AFTER_LAST: internal use
  9731. -@@ -2164,6 +2167,8 @@ enum nl80211_attrs {
  9732. - NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS,
  9733. - NL80211_ATTR_SCHED_SCAN_PLANS,
  9734. +@@ -2213,6 +2216,8 @@ enum nl80211_attrs {
  9735. +
  9736. + NL80211_ATTR_IFTYPE_EXT_CAPA,
  9737. + NL80211_ATTR_WIPHY_ANTENNA_GAIN,
  9738. +
  9739. @@ -57,7 +57,7 @@
  9740. __NL80211_ATTR_AFTER_LAST,
  9741. --- a/net/mac80211/cfg.c
  9742. +++ b/net/mac80211/cfg.c
  9743. -@@ -2229,6 +2229,19 @@ static int ieee80211_get_tx_power(struct
  9744. +@@ -2238,6 +2238,19 @@ static int ieee80211_get_tx_power(struct
  9745. return 0;
  9746. }
  9747. @@ -77,7 +77,7 @@
  9748. static int ieee80211_set_wds_peer(struct wiphy *wiphy, struct net_device *dev,
  9749. const u8 *addr)
  9750. {
  9751. -@@ -3403,6 +3416,7 @@ const struct cfg80211_ops mac80211_confi
  9752. +@@ -3412,6 +3425,7 @@ const struct cfg80211_ops mac80211_confi
  9753. .set_wiphy_params = ieee80211_set_wiphy_params,
  9754. .set_tx_power = ieee80211_set_tx_power,
  9755. .get_tx_power = ieee80211_get_tx_power,
  9756. @@ -87,7 +87,7 @@
  9757. CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd)
  9758. --- a/net/mac80211/ieee80211_i.h
  9759. +++ b/net/mac80211/ieee80211_i.h
  9760. -@@ -1318,6 +1318,7 @@ struct ieee80211_local {
  9761. +@@ -1338,6 +1338,7 @@ struct ieee80211_local {
  9762. int dynamic_ps_forced_timeout;
  9763. int user_power_level; /* in dBm, for all interfaces */
  9764. @@ -119,7 +119,7 @@
  9765. if (local->hw.conf.power_level != power) {
  9766. changed |= IEEE80211_CONF_CHANGE_POWER;
  9767. local->hw.conf.power_level = power;
  9768. -@@ -586,6 +592,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
  9769. +@@ -588,6 +594,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
  9770. IEEE80211_RADIOTAP_MCS_HAVE_BW;
  9771. local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI |
  9772. IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH;
  9773. @@ -129,15 +129,15 @@
  9774. local->user_power_level = IEEE80211_UNSET_POWER_LEVEL;
  9775. --- a/net/wireless/nl80211.c
  9776. +++ b/net/wireless/nl80211.c
  9777. -@@ -403,6 +403,7 @@ static const struct nla_policy nl80211_p
  9778. - [NL80211_ATTR_NETNS_FD] = { .type = NLA_U32 },
  9779. - [NL80211_ATTR_SCHED_SCAN_DELAY] = { .type = NLA_U32 },
  9780. - [NL80211_ATTR_REG_INDOOR] = { .type = NLA_FLAG },
  9781. +@@ -407,6 +407,7 @@ static const struct nla_policy nl80211_p
  9782. + [NL80211_ATTR_PBSS] = { .type = NLA_FLAG },
  9783. + [NL80211_ATTR_BSS_SELECT] = { .type = NLA_NESTED },
  9784. + [NL80211_ATTR_STA_SUPPORT_P2P_PS] = { .type = NLA_U8 },
  9785. + [NL80211_ATTR_WIPHY_ANTENNA_GAIN] = { .type = NLA_U32 },
  9786. };
  9787. /* policy for the key attributes */
  9788. -@@ -2220,6 +2221,20 @@ static int nl80211_set_wiphy(struct sk_b
  9789. +@@ -2294,6 +2295,20 @@ static int nl80211_set_wiphy(struct sk_b
  9790. if (result)
  9791. return result;
  9792. }
  9793. diff --git a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  9794. index 5a5e464..0b25749 100644
  9795. --- a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  9796. +++ b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  9797. @@ -1,16 +1,16 @@
  9798. --- a/drivers/net/wireless/ath/ath9k/ath9k.h
  9799. +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  9800. @@ -814,6 +814,9 @@ static inline int ath9k_dump_btcoex(stru
  9801. + #ifdef CPTCFG_MAC80211_LEDS
  9802. void ath_init_leds(struct ath_softc *sc);
  9803. void ath_deinit_leds(struct ath_softc *sc);
  9804. - void ath_fill_led_pin(struct ath_softc *sc);
  9805. +int ath_create_gpio_led(struct ath_softc *sc, int gpio, const char *name,
  9806. -+ const char *trigger, bool active_low);
  9807. ++ const char *trigger, bool active_low);
  9808. +
  9809. #else
  9810. static inline void ath_init_leds(struct ath_softc *sc)
  9811. {
  9812. -@@ -953,6 +956,13 @@ void ath_ant_comb_scan(struct ath_softc
  9813. +@@ -950,6 +953,13 @@ void ath_ant_comb_scan(struct ath_softc
  9814. #define ATH9K_NUM_CHANCTX 2 /* supports 2 operating channels */
  9815. @@ -24,7 +24,7 @@
  9816. struct ath_softc {
  9817. struct ieee80211_hw *hw;
  9818. struct device *dev;
  9819. -@@ -1005,9 +1015,8 @@ struct ath_softc {
  9820. +@@ -1002,9 +1012,8 @@ struct ath_softc {
  9821. spinlock_t chan_lock;
  9822. #ifdef CPTCFG_MAC80211_LEDS
  9823. @@ -38,24 +38,33 @@
  9824. #ifdef CPTCFG_ATH9K_DEBUGFS
  9825. --- a/drivers/net/wireless/ath/ath9k/gpio.c
  9826. +++ b/drivers/net/wireless/ath/ath9k/gpio.c
  9827. -@@ -24,45 +24,102 @@
  9828. - static void ath_led_brightness(struct led_classdev *led_cdev,
  9829. - enum led_brightness brightness)
  9830. +@@ -22,7 +22,7 @@
  9831. +
  9832. + #ifdef CPTCFG_MAC80211_LEDS
  9833. +
  9834. +-void ath_fill_led_pin(struct ath_softc *sc)
  9835. ++static void ath_fill_led_pin(struct ath_softc *sc)
  9836. {
  9837. -- struct ath_softc *sc = container_of(led_cdev, struct ath_softc, led_cdev);
  9838. -- u32 val = (brightness == LED_OFF);
  9839. + struct ath_hw *ah = sc->sc_ah;
  9840. +
  9841. +@@ -39,61 +39,111 @@ void ath_fill_led_pin(struct ath_softc *
  9842. + else
  9843. + ah->led_pin = ATH_LED_PIN_DEF;
  9844. + }
  9845. ++}
  9846. ++
  9847. ++static void ath_led_brightness(struct led_classdev *led_cdev,
  9848. ++ enum led_brightness brightness)
  9849. ++{
  9850. + struct ath_led *led = container_of(led_cdev, struct ath_led, cdev);
  9851. + struct ath_softc *sc = led->sc;
  9852. -
  9853. -- if (sc->sc_ah->config.led_active_high)
  9854. -- val = !val;
  9855. ++
  9856. + ath9k_ps_wakeup(sc);
  9857. + ath9k_hw_set_gpio(sc->sc_ah, led->gpio->gpio,
  9858. + (brightness != LED_OFF) ^ led->gpio->active_low);
  9859. + ath9k_ps_restore(sc);
  9860. +}
  9861. -
  9862. -- ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, val);
  9863. ++
  9864. +static int ath_add_led(struct ath_softc *sc, struct ath_led *led)
  9865. +{
  9866. + const struct gpio_led *gpio = led->gpio;
  9867. @@ -71,30 +80,40 @@
  9868. +
  9869. + led->sc = sc;
  9870. + list_add(&led->list, &sc->leds);
  9871. -+
  9872. -+ /* Configure gpio for output */
  9873. -+ ath9k_hw_cfg_output(sc->sc_ah, gpio->gpio,
  9874. -+ AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
  9875. -+
  9876. +
  9877. + /* Configure gpio for output */
  9878. +- ath9k_hw_gpio_request_out(ah, ah->led_pin, "ath9k-led",
  9879. ++ ath9k_hw_gpio_request_out(sc->sc_ah, gpio->gpio, gpio->name,
  9880. + AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
  9881. +
  9882. +- /* LED off, active low */
  9883. +- ath9k_hw_set_gpio(ah, ah->led_pin, ah->config.led_active_high ? 0 : 1);
  9884. + /* LED off */
  9885. + ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low);
  9886. +
  9887. + return 0;
  9888. -+}
  9889. -+
  9890. + }
  9891. +
  9892. +-static void ath_led_brightness(struct led_classdev *led_cdev,
  9893. +- enum led_brightness brightness)
  9894. +int ath_create_gpio_led(struct ath_softc *sc, int gpio_num, const char *name,
  9895. + const char *trigger, bool active_low)
  9896. -+{
  9897. + {
  9898. +- struct ath_softc *sc = container_of(led_cdev, struct ath_softc, led_cdev);
  9899. +- u32 val = (brightness == LED_OFF);
  9900. + struct ath_led *led;
  9901. + struct gpio_led *gpio;
  9902. + char *_name;
  9903. + int ret;
  9904. -+
  9905. +
  9906. +- if (sc->sc_ah->config.led_active_high)
  9907. +- val = !val;
  9908. + led = kzalloc(sizeof(*led) + sizeof(*gpio) + strlen(name) + 1,
  9909. + GFP_KERNEL);
  9910. + if (!led)
  9911. + return -ENOMEM;
  9912. -+
  9913. +
  9914. +- ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, val);
  9915. + led->gpio = gpio = (struct gpio_led *) (led + 1);
  9916. + _name = (char *) (led->gpio + 1);
  9917. +
  9918. @@ -115,15 +134,18 @@
  9919. {
  9920. - if (!sc->led_registered)
  9921. - return;
  9922. -+ struct ath_led *led;
  9923. -
  9924. +-
  9925. - ath_led_brightness(&sc->led_cdev, LED_OFF);
  9926. - led_classdev_unregister(&sc->led_cdev);
  9927. ++ struct ath_led *led;
  9928. +
  9929. +- ath9k_hw_gpio_free(sc->sc_ah, sc->sc_ah->led_pin);
  9930. + while (!list_empty(&sc->leds)) {
  9931. + led = list_first_entry(&sc->leds, struct ath_led, list);
  9932. + list_del(&led->list);
  9933. + ath_led_brightness(&led->cdev, LED_OFF);
  9934. + led_classdev_unregister(&led->cdev);
  9935. ++ ath9k_hw_gpio_free(sc->sc_ah, led->gpio->gpio);
  9936. + kfree(led);
  9937. + }
  9938. }
  9939. @@ -139,6 +161,8 @@
  9940. if (AR_SREV_9100(sc->sc_ah))
  9941. return;
  9942. + ath_fill_led_pin(sc);
  9943. +
  9944. - if (!ath9k_led_blink)
  9945. - sc->led_cdev.default_trigger =
  9946. - ieee80211_get_radio_led_name(sc->hw);
  9947. @@ -159,13 +183,14 @@
  9948. + trigger = ieee80211_get_radio_led_name(sc->hw);
  9949. - sc->led_registered = true;
  9950. -+ ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, !sc->sc_ah->config.led_active_high);
  9951. ++ ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger,
  9952. ++ !sc->sc_ah->config.led_active_high);
  9953. }
  9954. + #endif
  9955. - void ath_fill_led_pin(struct ath_softc *sc)
  9956. --- a/drivers/net/wireless/ath/ath9k/init.c
  9957. +++ b/drivers/net/wireless/ath/ath9k/init.c
  9958. -@@ -936,7 +936,7 @@ int ath9k_init_device(u16 devid, struct
  9959. +@@ -942,7 +942,7 @@ int ath9k_init_device(u16 devid, struct
  9960. #ifdef CPTCFG_MAC80211_LEDS
  9961. /* must be initialized before ieee80211_register_hw */
  9962. @@ -176,7 +201,7 @@
  9963. #endif
  9964. --- a/drivers/net/wireless/ath/ath9k/debug.c
  9965. +++ b/drivers/net/wireless/ath/ath9k/debug.c
  9966. -@@ -1393,6 +1393,61 @@ static const struct file_operations fops
  9967. +@@ -1407,6 +1407,61 @@ static const struct file_operations fops
  9968. .llseek = default_llseek,
  9969. };
  9970. @@ -238,7 +263,7 @@
  9971. int ath9k_init_debug(struct ath_hw *ah)
  9972. {
  9973. -@@ -1417,6 +1472,10 @@ int ath9k_init_debug(struct ath_hw *ah)
  9974. +@@ -1431,6 +1486,10 @@ int ath9k_init_debug(struct ath_hw *ah)
  9975. &fops_eeprom);
  9976. debugfs_create_file("chanbw", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
  9977. sc, &fops_chanbw);
  9978. diff --git a/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch b/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch
  9979. index 7c10ea6..f656697 100644
  9980. --- a/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch
  9981. +++ b/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch
  9982. @@ -1,6 +1,6 @@
  9983. --- a/include/linux/ath9k_platform.h
  9984. +++ b/include/linux/ath9k_platform.h
  9985. -@@ -41,6 +41,9 @@ struct ath9k_platform_data {
  9986. +@@ -45,6 +45,9 @@ struct ath9k_platform_data {
  9987. int (*external_reset)(void);
  9988. bool use_eeprom;
  9989. @@ -20,7 +20,7 @@
  9990. /********************************/
  9991. /* LED functions */
  9992. -@@ -88,6 +89,24 @@ int ath_create_gpio_led(struct ath_softc
  9993. +@@ -108,6 +109,24 @@ int ath_create_gpio_led(struct ath_softc
  9994. return ret;
  9995. }
  9996. @@ -45,7 +45,7 @@
  9997. void ath_deinit_leds(struct ath_softc *sc)
  9998. {
  9999. struct ath_led *led;
  10000. -@@ -103,8 +122,10 @@ void ath_deinit_leds(struct ath_softc *s
  10001. +@@ -124,8 +143,10 @@ void ath_deinit_leds(struct ath_softc *s
  10002. void ath_init_leds(struct ath_softc *sc)
  10003. {
  10004. @@ -56,10 +56,10 @@
  10005. INIT_LIST_HEAD(&sc->leds);
  10006. -@@ -120,6 +141,12 @@ void ath_init_leds(struct ath_softc *sc)
  10007. - trigger = ieee80211_get_radio_led_name(sc->hw);
  10008. +@@ -144,6 +165,12 @@ void ath_init_leds(struct ath_softc *sc)
  10009. - ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, !sc->sc_ah->config.led_active_high);
  10010. + ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger,
  10011. + !sc->sc_ah->config.led_active_high);
  10012. +
  10013. + if (!pdata)
  10014. + return;
  10015. @@ -67,5 +67,5 @@
  10016. + for (i = 0; i < pdata->num_leds; i++)
  10017. + ath_create_platform_led(sc, &pdata->leds[i]);
  10018. }
  10019. + #endif
  10020. - void ath_fill_led_pin(struct ath_softc *sc)
  10021. 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
  10022. index 6d62a2b..50d8a7a 100644
  10023. --- a/package/kernel/mac80211/patches/532-ath9k_get_led_polarity_from_platform_data.patch
  10024. +++ b/package/kernel/mac80211/patches/532-ath9k_get_led_polarity_from_platform_data.patch
  10025. @@ -1,6 +1,6 @@
  10026. --- a/include/linux/ath9k_platform.h
  10027. +++ b/include/linux/ath9k_platform.h
  10028. -@@ -36,6 +36,7 @@ struct ath9k_platform_data {
  10029. +@@ -40,6 +40,7 @@ struct ath9k_platform_data {
  10030. bool tx_gain_buffalo;
  10031. bool disable_2ghz;
  10032. bool disable_5ghz;
  10033. @@ -10,7 +10,7 @@
  10034. int (*external_reset)(void);
  10035. --- a/drivers/net/wireless/ath/ath9k/init.c
  10036. +++ b/drivers/net/wireless/ath/ath9k/init.c
  10037. -@@ -577,6 +577,7 @@ static int ath9k_init_softc(u16 devid, s
  10038. +@@ -580,6 +580,7 @@ static int ath9k_init_softc(u16 devid, s
  10039. ah->external_reset = pdata->external_reset;
  10040. ah->disable_2ghz = pdata->disable_2ghz;
  10041. ah->disable_5ghz = pdata->disable_5ghz;
  10042. 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
  10043. index 3c5e9f5..c2d2781 100644
  10044. --- a/package/kernel/mac80211/patches/541-ath9k_rx_dma_stop_check.patch
  10045. +++ b/package/kernel/mac80211/patches/541-ath9k_rx_dma_stop_check.patch
  10046. @@ -1,6 +1,6 @@
  10047. --- a/drivers/net/wireless/ath/ath9k/mac.c
  10048. +++ b/drivers/net/wireless/ath/ath9k/mac.c
  10049. -@@ -695,7 +695,7 @@ bool ath9k_hw_stopdmarecv(struct ath_hw
  10050. +@@ -698,7 +698,7 @@ bool ath9k_hw_stopdmarecv(struct ath_hw
  10051. {
  10052. #define AH_RX_STOP_DMA_TIMEOUT 10000 /* usec */
  10053. struct ath_common *common = ath9k_hw_common(ah);
  10054. @@ -9,7 +9,7 @@
  10055. int i;
  10056. /* Enable access to the DMA observation bus */
  10057. -@@ -725,6 +725,16 @@ bool ath9k_hw_stopdmarecv(struct ath_hw
  10058. +@@ -728,6 +728,16 @@ bool ath9k_hw_stopdmarecv(struct ath_hw
  10059. }
  10060. if (i == 0) {
  10061. diff --git a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  10062. index e83c6bf..4615643 100644
  10063. --- a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  10064. +++ b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  10065. @@ -1,6 +1,6 @@
  10066. --- a/drivers/net/wireless/ath/ath9k/debug.c
  10067. +++ b/drivers/net/wireless/ath/ath9k/debug.c
  10068. -@@ -1449,6 +1449,50 @@ static const struct file_operations fops
  10069. +@@ -1463,6 +1463,50 @@ static const struct file_operations fops
  10070. #endif
  10071. @@ -51,7 +51,7 @@
  10072. int ath9k_init_debug(struct ath_hw *ah)
  10073. {
  10074. struct ath_common *common = ath9k_hw_common(ah);
  10075. -@@ -1476,6 +1520,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  10076. +@@ -1490,6 +1534,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  10077. debugfs_create_file("gpio_led", S_IWUSR,
  10078. sc->debug.debugfs_phy, sc, &fops_gpio_led);
  10079. #endif
  10080. @@ -62,7 +62,7 @@
  10081. debugfs_create_devm_seqfile(sc->dev, "interrupt", sc->debug.debugfs_phy,
  10082. --- a/drivers/net/wireless/ath/ath9k/hw.h
  10083. +++ b/drivers/net/wireless/ath/ath9k/hw.h
  10084. -@@ -519,6 +519,12 @@ enum {
  10085. +@@ -520,6 +520,12 @@ enum {
  10086. ATH9K_RESET_COLD,
  10087. };
  10088. @@ -75,7 +75,7 @@
  10089. struct ath9k_hw_version {
  10090. u32 magic;
  10091. u16 devid;
  10092. -@@ -804,6 +810,8 @@ struct ath_hw {
  10093. +@@ -805,6 +811,8 @@ struct ath_hw {
  10094. u32 rfkill_polarity;
  10095. u32 ah_flags;
  10096. @@ -84,7 +84,7 @@
  10097. bool reset_power_on;
  10098. bool htc_reset_init;
  10099. -@@ -1066,6 +1074,7 @@ void ath9k_hw_check_nav(struct ath_hw *a
  10100. +@@ -1068,6 +1076,7 @@ void ath9k_hw_check_nav(struct ath_hw *a
  10101. bool ath9k_hw_check_alive(struct ath_hw *ah);
  10102. bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode);
  10103. @@ -94,7 +94,7 @@
  10104. struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah,
  10105. --- a/drivers/net/wireless/ath/ath9k/hw.c
  10106. +++ b/drivers/net/wireless/ath/ath9k/hw.c
  10107. -@@ -1819,6 +1819,20 @@ u32 ath9k_hw_get_tsf_offset(struct times
  10108. +@@ -1841,6 +1841,20 @@ u32 ath9k_hw_get_tsf_offset(struct times
  10109. }
  10110. EXPORT_SYMBOL(ath9k_hw_get_tsf_offset);
  10111. @@ -115,7 +115,7 @@
  10112. int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
  10113. struct ath9k_hw_cal_data *caldata, bool fastcc)
  10114. {
  10115. -@@ -2027,6 +2041,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  10116. +@@ -2049,6 +2063,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  10117. ar9003_hw_disable_phy_restart(ah);
  10118. ath9k_hw_apply_gpio_override(ah);
  10119. diff --git a/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch b/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  10120. index d7bb5a1..656ed43 100644
  10121. --- a/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  10122. +++ b/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  10123. @@ -1,6 +1,6 @@
  10124. --- a/drivers/net/wireless/ath/ath9k/hw.h
  10125. +++ b/drivers/net/wireless/ath/ath9k/hw.h
  10126. -@@ -720,6 +720,7 @@ struct ath_spec_scan {
  10127. +@@ -721,6 +721,7 @@ struct ath_spec_scan {
  10128. * @config_pci_powersave:
  10129. * @calibrate: periodic calibration for NF, ANI, IQ, ADC gain, ADC-DC
  10130. *
  10131. @@ -8,7 +8,7 @@
  10132. * @spectral_scan_config: set parameters for spectral scan and enable/disable it
  10133. * @spectral_scan_trigger: trigger a spectral scan run
  10134. * @spectral_scan_wait: wait for a spectral scan run to finish
  10135. -@@ -742,6 +743,7 @@ struct ath_hw_ops {
  10136. +@@ -743,6 +744,7 @@ struct ath_hw_ops {
  10137. struct ath_hw_antcomb_conf *antconf);
  10138. void (*antdiv_comb_conf_set)(struct ath_hw *ah,
  10139. struct ath_hw_antcomb_conf *antconf);
  10140. @@ -18,7 +18,7 @@
  10141. void (*spectral_scan_trigger)(struct ath_hw *ah);
  10142. --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  10143. +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  10144. -@@ -1998,6 +1998,26 @@ void ar9003_hw_init_rate_txpower(struct
  10145. +@@ -1945,6 +1945,26 @@ void ar9003_hw_init_rate_txpower(struct
  10146. }
  10147. }
  10148. @@ -45,7 +45,7 @@
  10149. void ar9003_hw_attach_phy_ops(struct ath_hw *ah)
  10150. {
  10151. struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah);
  10152. -@@ -2034,6 +2054,7 @@ void ar9003_hw_attach_phy_ops(struct ath
  10153. +@@ -1981,6 +2001,7 @@ void ar9003_hw_attach_phy_ops(struct ath
  10154. priv_ops->set_radar_params = ar9003_hw_set_radar_params;
  10155. priv_ops->fast_chan_change = ar9003_hw_fast_chan_change;
  10156. @@ -55,9 +55,9 @@
  10157. ops->spectral_scan_config = ar9003_hw_spectral_scan_config;
  10158. --- a/drivers/net/wireless/ath/ath9k/init.c
  10159. +++ b/drivers/net/wireless/ath/ath9k/init.c
  10160. -@@ -711,7 +711,8 @@ static void ath9k_init_txpower_limits(st
  10161. +@@ -716,7 +716,8 @@ static void ath9k_init_txpower_limits(st
  10162. if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)
  10163. - ath9k_init_band_txpower(sc, IEEE80211_BAND_5GHZ);
  10164. + ath9k_init_band_txpower(sc, NL80211_BAND_5GHZ);
  10165. - ah->curchan = curchan;
  10166. + if (curchan)
  10167. @@ -65,7 +65,7 @@
  10168. }
  10169. static const struct ieee80211_iface_limit if_limits[] = {
  10170. -@@ -897,6 +898,18 @@ static void ath9k_set_hw_capab(struct at
  10171. +@@ -903,6 +904,18 @@ static void ath9k_set_hw_capab(struct at
  10172. SET_IEEE80211_PERM_ADDR(hw, common->macaddr);
  10173. }
  10174. @@ -84,7 +84,7 @@
  10175. int ath9k_init_device(u16 devid, struct ath_softc *sc,
  10176. const struct ath_bus_ops *bus_ops)
  10177. {
  10178. -@@ -942,6 +955,8 @@ int ath9k_init_device(u16 devid, struct
  10179. +@@ -948,6 +961,8 @@ int ath9k_init_device(u16 devid, struct
  10180. ARRAY_SIZE(ath9k_tpt_blink));
  10181. #endif
  10182. @@ -110,7 +110,7 @@
  10183. static inline void ath9k_hw_set_bt_ant_diversity(struct ath_hw *ah, bool enable)
  10184. --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  10185. +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  10186. -@@ -1327,9 +1327,30 @@ void ar5008_hw_init_rate_txpower(struct
  10187. +@@ -1325,9 +1325,30 @@ void ar5008_hw_init_rate_txpower(struct
  10188. }
  10189. }
  10190. @@ -141,7 +141,7 @@
  10191. static const u32 ar5416_cca_regs[6] = {
  10192. AR_PHY_CCA,
  10193. AR_PHY_CH1_CCA,
  10194. -@@ -1344,6 +1365,8 @@ int ar5008_hw_attach_phy_ops(struct ath_
  10195. +@@ -1342,6 +1363,8 @@ int ar5008_hw_attach_phy_ops(struct ath_
  10196. if (ret)
  10197. return ret;
  10198. @@ -175,7 +175,7 @@
  10199. #define AR_PHY_TIMING2 0x9810
  10200. #define AR_PHY_TIMING3 0x9814
  10201. #define AR_PHY_TIMING3_DSC_MAN 0xFFFE0000
  10202. -@@ -390,6 +399,8 @@
  10203. +@@ -393,6 +402,8 @@
  10204. #define AR_PHY_RFBUS_GRANT 0x9C20
  10205. #define AR_PHY_RFBUS_GRANT_EN 0x00000001
  10206. 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
  10207. index 8768c5d..b9c962e 100644
  10208. --- a/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch
  10209. +++ b/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch
  10210. @@ -20,9 +20,9 @@
  10211. /******************/
  10212. /* Chip Revisions */
  10213. /******************/
  10214. -@@ -1397,6 +1410,9 @@ static bool ath9k_hw_set_reset(struct at
  10215. - if (AR_SREV_9100(ah))
  10216. +@@ -1417,6 +1430,9 @@ static bool ath9k_hw_set_reset(struct at
  10217. udelay(50);
  10218. + }
  10219. + if (AR_SREV_9330(ah) || AR_SREV_9340(ah))
  10220. + ath9k_hw_disable_pll_lock_detect(ah);
  10221. @@ -30,7 +30,7 @@
  10222. return true;
  10223. }
  10224. -@@ -1496,6 +1512,9 @@ static bool ath9k_hw_chip_reset(struct a
  10225. +@@ -1516,6 +1532,9 @@ static bool ath9k_hw_chip_reset(struct a
  10226. ar9003_hw_internal_regulator_apply(ah);
  10227. ath9k_hw_init_pll(ah, chan);
  10228. @@ -40,7 +40,7 @@
  10229. return true;
  10230. }
  10231. -@@ -1797,8 +1816,14 @@ static int ath9k_hw_do_fastcc(struct ath
  10232. +@@ -1819,8 +1838,14 @@ static int ath9k_hw_do_fastcc(struct ath
  10233. if (AR_SREV_9271(ah))
  10234. ar9002_hw_load_ani_reg(ah, chan);
  10235. @@ -55,7 +55,7 @@
  10236. return -EINVAL;
  10237. }
  10238. -@@ -2052,6 +2077,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  10239. +@@ -2074,6 +2099,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  10240. ath9k_hw_set_radar_params(ah);
  10241. }
  10242. diff --git a/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch b/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
  10243. index 3d24ccd..b639f97 100644
  10244. --- a/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
  10245. +++ b/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
  10246. @@ -1,6 +1,6 @@
  10247. --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  10248. +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  10249. -@@ -956,55 +956,6 @@ static bool ar5008_hw_ani_control_new(st
  10250. +@@ -954,55 +954,6 @@ static bool ar5008_hw_ani_control_new(st
  10251. * on == 0 means more noise imm
  10252. */
  10253. u32 on = param ? 1 : 0;
  10254. @@ -58,7 +58,7 @@
  10255. REG_SET_BIT(ah, AR_PHY_SFCORR_LOW,
  10256. --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  10257. +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  10258. -@@ -41,20 +41,6 @@ static const int cycpwrThr1_table[] =
  10259. +@@ -42,20 +42,6 @@ static const int cycpwrThr1_table[] =
  10260. /* level: 0 1 2 3 4 5 6 7 8 */
  10261. { -6, -4, -2, 0, 2, 4, 6, 8 }; /* lvl 0-7, default 3 */
  10262. @@ -79,7 +79,7 @@
  10263. static const u8 ofdm2pwr[] = {
  10264. ALL_TARGET_LEGACY_6_24,
  10265. ALL_TARGET_LEGACY_6_24,
  10266. -@@ -1089,11 +1075,6 @@ static bool ar9003_hw_ani_control(struct
  10267. +@@ -1095,11 +1081,6 @@ static bool ar9003_hw_ani_control(struct
  10268. struct ath_common *common = ath9k_hw_common(ah);
  10269. struct ath9k_channel *chan = ah->curchan;
  10270. struct ar5416AniState *aniState = &ah->ani;
  10271. @@ -91,7 +91,7 @@
  10272. s32 value, value2;
  10273. switch (cmd & ah->ani_function) {
  10274. -@@ -1107,61 +1088,6 @@ static bool ar9003_hw_ani_control(struct
  10275. +@@ -1113,61 +1094,6 @@ static bool ar9003_hw_ani_control(struct
  10276. */
  10277. u32 on = param ? 1 : 0;
  10278. diff --git a/package/kernel/mac80211/patches/546-ath9k_platform_led_name.patch b/package/kernel/mac80211/patches/546-ath9k_platform_led_name.patch
  10279. new file mode 100644
  10280. index 0000000..ced72c6
  10281. --- /dev/null
  10282. +++ b/package/kernel/mac80211/patches/546-ath9k_platform_led_name.patch
  10283. @@ -0,0 +1,39 @@
  10284. +From: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  10285. +Date: Sun, 31 Jan 2016 20:45:57 +0100
  10286. +Subject: [PATCH v4 1/8] mac80211: ath9k: enable platform WLAN LED name
  10287. +
  10288. +Enable platform-supplied WLAN LED name for ath9k device. It replaces generic
  10289. +'ath9k-phy*' label with string set during platform initialization.
  10290. +
  10291. +Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  10292. +---
  10293. + drivers/net/wireless/ath/ath9k/gpio.c | 10 +++++++---
  10294. + include/linux/ath9k_platform.h | 1 +
  10295. + 2 files changed, 8 insertions(+), 3 deletions(-)
  10296. +
  10297. +--- a/drivers/net/wireless/ath/ath9k/gpio.c
  10298. ++++ b/drivers/net/wireless/ath/ath9k/gpio.c
  10299. +@@ -155,8 +155,11 @@ void ath_init_leds(struct ath_softc *sc)
  10300. +
  10301. + ath_fill_led_pin(sc);
  10302. +
  10303. +- snprintf(led_name, sizeof(led_name), "ath9k-%s",
  10304. +- wiphy_name(sc->hw->wiphy));
  10305. ++ if (pdata && pdata->led_name)
  10306. ++ strncpy(led_name, pdata->led_name, sizeof(led_name));
  10307. ++ else
  10308. ++ snprintf(led_name, sizeof(led_name), "ath9k-%s",
  10309. ++ wiphy_name(sc->hw->wiphy));
  10310. +
  10311. + if (ath9k_led_blink)
  10312. + trigger = sc->led_default_trigger;
  10313. +--- a/include/linux/ath9k_platform.h
  10314. ++++ b/include/linux/ath9k_platform.h
  10315. +@@ -49,6 +49,7 @@ struct ath9k_platform_data {
  10316. +
  10317. + int num_leds;
  10318. + const struct gpio_led *leds;
  10319. ++ const char *led_name;
  10320. + };
  10321. +
  10322. + #endif /* _LINUX_ATH9K_PLATFORM_H */
  10323. diff --git a/package/kernel/mac80211/patches/547-ath9k_led_defstate_fix.patch b/package/kernel/mac80211/patches/547-ath9k_led_defstate_fix.patch
  10324. new file mode 100644
  10325. index 0000000..5d84cf0
  10326. --- /dev/null
  10327. +++ b/package/kernel/mac80211/patches/547-ath9k_led_defstate_fix.patch
  10328. @@ -0,0 +1,29 @@
  10329. +From: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  10330. +Date: Sun, 31 Jan 2016 20:48:49 +0100
  10331. +Subject: [PATCH v4 2/8] mac80211: ath9k: set default state for platform LEDs
  10332. +
  10333. +Support default state for platform LEDs connected to ath9k device.
  10334. +Now LEDs are correctly set on or off at ath9k module initialization.
  10335. +Very useful if power LED is connected to wireless chip.
  10336. +
  10337. +Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  10338. +---
  10339. + gpio.c | 7 +++++--
  10340. + 1 file changed, 5 insertions(+), 2 deletions(-)
  10341. +
  10342. +--- a/drivers/net/wireless/ath/ath9k/gpio.c
  10343. ++++ b/drivers/net/wireless/ath/ath9k/gpio.c
  10344. +@@ -74,8 +74,11 @@ static int ath_add_led(struct ath_softc
  10345. + ath9k_hw_gpio_request_out(sc->sc_ah, gpio->gpio, gpio->name,
  10346. + AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
  10347. +
  10348. +- /* LED off */
  10349. +- ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low);
  10350. ++ /* Set default LED state */
  10351. ++ if (gpio->default_state == LEDS_GPIO_DEFSTATE_ON)
  10352. ++ ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, !gpio->active_low);
  10353. ++ else
  10354. ++ ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low);
  10355. +
  10356. + return 0;
  10357. + }
  10358. diff --git a/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch b/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch
  10359. new file mode 100644
  10360. index 0000000..de7c0ac
  10361. --- /dev/null
  10362. +++ b/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch
  10363. @@ -0,0 +1,234 @@
  10364. +From: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  10365. +Date: Sun, 31 Jan 2016 21:01:31 +0100
  10366. +Subject: [PATCH v4 4/8] mac80211: ath9k: enable access to GPIO
  10367. +
  10368. +Enable access to GPIO chip and its pins for Atheros AR92xx
  10369. +wireless devices. For now AR9285 and AR9287 are supported.
  10370. +
  10371. +Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  10372. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  10373. +---
  10374. +--- a/drivers/net/wireless/ath/ath9k/ath9k.h
  10375. ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  10376. +@@ -24,6 +24,7 @@
  10377. + #include <linux/completion.h>
  10378. + #include <linux/time.h>
  10379. + #include <linux/hw_random.h>
  10380. ++#include <linux/gpio/driver.h>
  10381. +
  10382. + #include "common.h"
  10383. + #include "debug.h"
  10384. +@@ -960,6 +961,14 @@ struct ath_led {
  10385. + struct led_classdev cdev;
  10386. + };
  10387. +
  10388. ++#ifdef CONFIG_GPIOLIB
  10389. ++struct ath9k_gpio_chip {
  10390. ++ struct ath_softc *sc;
  10391. ++ char label[32];
  10392. ++ struct gpio_chip gchip;
  10393. ++};
  10394. ++#endif
  10395. ++
  10396. + struct ath_softc {
  10397. + struct ieee80211_hw *hw;
  10398. + struct device *dev;
  10399. +@@ -1014,6 +1023,9 @@ struct ath_softc {
  10400. + #ifdef CPTCFG_MAC80211_LEDS
  10401. + const char *led_default_trigger;
  10402. + struct list_head leds;
  10403. ++#ifdef CONFIG_GPIOLIB
  10404. ++ struct ath9k_gpio_chip *gpiochip;
  10405. ++#endif
  10406. + #endif
  10407. +
  10408. + #ifdef CPTCFG_ATH9K_DEBUGFS
  10409. +--- a/drivers/net/wireless/ath/ath9k/gpio.c
  10410. ++++ b/drivers/net/wireless/ath/ath9k/gpio.c
  10411. +@@ -16,13 +16,135 @@
  10412. +
  10413. + #include "ath9k.h"
  10414. + #include <linux/ath9k_platform.h>
  10415. ++#include <linux/gpio.h>
  10416. ++
  10417. ++#ifdef CPTCFG_MAC80211_LEDS
  10418. ++
  10419. ++#ifdef CONFIG_GPIOLIB
  10420. ++
  10421. ++/***************/
  10422. ++/* GPIO Chip */
  10423. ++/***************/
  10424. ++
  10425. ++/* gpio_chip handler : set GPIO to input */
  10426. ++static int ath9k_gpio_pin_cfg_input(struct gpio_chip *chip, unsigned offset)
  10427. ++{
  10428. ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip,
  10429. ++ gchip);
  10430. ++
  10431. ++ ath9k_hw_gpio_request_in(gc->sc->sc_ah, offset, "ath9k-gpio");
  10432. ++
  10433. ++ return 0;
  10434. ++}
  10435. ++
  10436. ++/* gpio_chip handler : set GPIO to output */
  10437. ++static int ath9k_gpio_pin_cfg_output(struct gpio_chip *chip, unsigned offset,
  10438. ++ int value)
  10439. ++{
  10440. ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip,
  10441. ++ gchip);
  10442. ++
  10443. ++ ath9k_hw_gpio_request_out(gc->sc->sc_ah, offset, "ath9k-gpio",
  10444. ++ AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
  10445. ++ ath9k_hw_set_gpio(gc->sc->sc_ah, offset, value);
  10446. ++
  10447. ++ return 0;
  10448. ++}
  10449. ++
  10450. ++/* gpio_chip handler : query GPIO direction (0=out, 1=in) */
  10451. ++static int ath9k_gpio_pin_get_dir(struct gpio_chip *chip, unsigned offset)
  10452. ++{
  10453. ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip,
  10454. ++ gchip);
  10455. ++ struct ath_hw *ah = gc->sc->sc_ah;
  10456. ++
  10457. ++ return !((REG_READ(ah, AR_GPIO_OE_OUT) >> (offset * 2)) & 3);
  10458. ++}
  10459. ++
  10460. ++/* gpio_chip handler : get GPIO pin value */
  10461. ++static int ath9k_gpio_pin_get(struct gpio_chip *chip, unsigned offset)
  10462. ++{
  10463. ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip,
  10464. ++ gchip);
  10465. ++
  10466. ++ return ath9k_hw_gpio_get(gc->sc->sc_ah, offset);
  10467. ++}
  10468. ++
  10469. ++/* gpio_chip handler : set GPIO pin to value */
  10470. ++static void ath9k_gpio_pin_set(struct gpio_chip *chip, unsigned offset,
  10471. ++ int value)
  10472. ++{
  10473. ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip,
  10474. ++ gchip);
  10475. ++
  10476. ++ ath9k_hw_set_gpio(gc->sc->sc_ah, offset, value);
  10477. ++}
  10478. ++
  10479. ++/* register GPIO chip */
  10480. ++static void ath9k_register_gpio_chip(struct ath_softc *sc)
  10481. ++{
  10482. ++ struct ath9k_gpio_chip *gc;
  10483. ++ struct ath_hw *ah = sc->sc_ah;
  10484. ++
  10485. ++ gc = kzalloc(sizeof(struct ath9k_gpio_chip), GFP_KERNEL);
  10486. ++ if (!gc)
  10487. ++ return;
  10488. ++
  10489. ++ snprintf(gc->label, sizeof(gc->label), "ath9k-%s",
  10490. ++ wiphy_name(sc->hw->wiphy));
  10491. ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0)
  10492. ++ gc->gchip.parent = sc->dev;
  10493. ++#else
  10494. ++ gc->gchip.dev = sc->dev;
  10495. ++#endif
  10496. ++ gc->gchip.label = gc->label;
  10497. ++ gc->gchip.base = -1; /* determine base automatically */
  10498. ++ gc->gchip.ngpio = ah->caps.num_gpio_pins;
  10499. ++ gc->gchip.direction_input = ath9k_gpio_pin_cfg_input;
  10500. ++ gc->gchip.direction_output = ath9k_gpio_pin_cfg_output;
  10501. ++ gc->gchip.get_direction = ath9k_gpio_pin_get_dir;
  10502. ++ gc->gchip.get = ath9k_gpio_pin_get;
  10503. ++ gc->gchip.set = ath9k_gpio_pin_set;
  10504. ++
  10505. ++ if (gpiochip_add(&gc->gchip)) {
  10506. ++ kfree(gc);
  10507. ++ return;
  10508. ++ }
  10509. ++
  10510. ++ gc->gchip.owner = NULL;
  10511. ++ sc->gpiochip = gc;
  10512. ++ gc->sc = sc;
  10513. ++}
  10514. ++
  10515. ++/* remove GPIO chip */
  10516. ++static void ath9k_unregister_gpio_chip(struct ath_softc *sc)
  10517. ++{
  10518. ++ struct ath9k_gpio_chip *gc = sc->gpiochip;
  10519. ++
  10520. ++ if (!gc)
  10521. ++ return;
  10522. ++
  10523. ++ gpiochip_remove(&gc->gchip);
  10524. ++ kfree(gc);
  10525. ++ sc->gpiochip = NULL;
  10526. ++}
  10527. ++
  10528. ++#else /* CONFIG_GPIOLIB */
  10529. ++
  10530. ++static inline void ath9k_register_gpio_chip(struct ath_softc *sc)
  10531. ++{
  10532. ++}
  10533. ++
  10534. ++static inline void ath9k_unregister_gpio_chip(struct ath_softc *sc)
  10535. ++{
  10536. ++}
  10537. ++
  10538. ++#endif /* CONFIG_GPIOLIB */
  10539. +
  10540. + /********************************/
  10541. + /* LED functions */
  10542. + /********************************/
  10543. +
  10544. +-#ifdef CPTCFG_MAC80211_LEDS
  10545. +-
  10546. + static void ath_fill_led_pin(struct ath_softc *sc)
  10547. + {
  10548. + struct ath_hw *ah = sc->sc_ah;
  10549. +@@ -80,6 +202,12 @@ static int ath_add_led(struct ath_softc
  10550. + else
  10551. + ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low);
  10552. +
  10553. ++#ifdef CONFIG_GPIOLIB
  10554. ++ /* If there is GPIO chip configured, reserve LED pin */
  10555. ++ if (sc->gpiochip)
  10556. ++ gpio_request(sc->gpiochip->gchip.base + gpio->gpio, gpio->name);
  10557. ++#endif
  10558. ++
  10559. + return 0;
  10560. + }
  10561. +
  10562. +@@ -136,12 +264,18 @@ void ath_deinit_leds(struct ath_softc *s
  10563. +
  10564. + while (!list_empty(&sc->leds)) {
  10565. + led = list_first_entry(&sc->leds, struct ath_led, list);
  10566. ++#ifdef CONFIG_GPIOLIB
  10567. ++ /* If there is GPIO chip configured, free LED pin */
  10568. ++ if (sc->gpiochip)
  10569. ++ gpio_free(sc->gpiochip->gchip.base + led->gpio->gpio);
  10570. ++#endif
  10571. + list_del(&led->list);
  10572. + ath_led_brightness(&led->cdev, LED_OFF);
  10573. + led_classdev_unregister(&led->cdev);
  10574. + ath9k_hw_gpio_free(sc->sc_ah, led->gpio->gpio);
  10575. + kfree(led);
  10576. + }
  10577. ++ ath9k_unregister_gpio_chip(sc);
  10578. + }
  10579. +
  10580. + void ath_init_leds(struct ath_softc *sc)
  10581. +@@ -158,6 +292,8 @@ void ath_init_leds(struct ath_softc *sc)
  10582. +
  10583. + ath_fill_led_pin(sc);
  10584. +
  10585. ++ ath9k_register_gpio_chip(sc);
  10586. ++
  10587. + if (pdata && pdata->led_name)
  10588. + strncpy(led_name, pdata->led_name, sizeof(led_name));
  10589. + else
  10590. +@@ -178,6 +314,7 @@ void ath_init_leds(struct ath_softc *sc)
  10591. + for (i = 0; i < pdata->num_leds; i++)
  10592. + ath_create_platform_led(sc, &pdata->leds[i]);
  10593. + }
  10594. ++
  10595. + #endif
  10596. +
  10597. + /*******************/
  10598. diff --git a/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch b/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch
  10599. new file mode 100644
  10600. index 0000000..b9d1883
  10601. --- /dev/null
  10602. +++ b/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch
  10603. @@ -0,0 +1,149 @@
  10604. +From: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  10605. +Subject: [PATCH v5 5/8] mac80211: ath9k: enable GPIO buttons
  10606. +
  10607. +Enable platform-defined GPIO button support for ath9k device.
  10608. +Key poller is activated for attached platform buttons.
  10609. +Requires ath9k GPIO chip access.
  10610. +
  10611. +Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  10612. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  10613. +---
  10614. +--- a/drivers/net/wireless/ath/ath9k/ath9k.h
  10615. ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  10616. +@@ -1025,6 +1025,7 @@ struct ath_softc {
  10617. + struct list_head leds;
  10618. + #ifdef CONFIG_GPIOLIB
  10619. + struct ath9k_gpio_chip *gpiochip;
  10620. ++ struct platform_device *btnpdev; /* gpio-keys-polled */
  10621. + #endif
  10622. + #endif
  10623. +
  10624. +--- a/drivers/net/wireless/ath/ath9k/gpio.c
  10625. ++++ b/drivers/net/wireless/ath/ath9k/gpio.c
  10626. +@@ -17,6 +17,8 @@
  10627. + #include "ath9k.h"
  10628. + #include <linux/ath9k_platform.h>
  10629. + #include <linux/gpio.h>
  10630. ++#include <linux/platform_device.h>
  10631. ++#include <linux/gpio_keys.h>
  10632. +
  10633. + #ifdef CPTCFG_MAC80211_LEDS
  10634. +
  10635. +@@ -129,6 +131,64 @@ static void ath9k_unregister_gpio_chip(s
  10636. + sc->gpiochip = NULL;
  10637. + }
  10638. +
  10639. ++/******************/
  10640. ++/* GPIO Buttons */
  10641. ++/******************/
  10642. ++
  10643. ++/* add GPIO buttons */
  10644. ++static void ath9k_init_buttons(struct ath_softc *sc)
  10645. ++{
  10646. ++ struct ath9k_platform_data *pdata = sc->dev->platform_data;
  10647. ++ struct platform_device *pdev;
  10648. ++ struct gpio_keys_platform_data gkpdata;
  10649. ++ struct gpio_keys_button *bt;
  10650. ++ int i;
  10651. ++
  10652. ++ if (!sc->gpiochip)
  10653. ++ return;
  10654. ++
  10655. ++ if (!pdata || !pdata->btns || !pdata->num_btns)
  10656. ++ return;
  10657. ++
  10658. ++ bt = devm_kmemdup(sc->dev, pdata->btns,
  10659. ++ pdata->num_btns * sizeof(struct gpio_keys_button),
  10660. ++ GFP_KERNEL);
  10661. ++ if (!bt)
  10662. ++ return;
  10663. ++
  10664. ++ for (i = 0; i < pdata->num_btns; i++) {
  10665. ++ ath9k_hw_gpio_request_in(sc->sc_ah, pdata->btns[i].gpio,
  10666. ++ "ath9k-gpio");
  10667. ++ bt[i].gpio = sc->gpiochip->gchip.base + pdata->btns[i].gpio;
  10668. ++ }
  10669. ++
  10670. ++ memset(&gkpdata, 0, sizeof(struct gpio_keys_platform_data));
  10671. ++ gkpdata.buttons = bt;
  10672. ++ gkpdata.nbuttons = pdata->num_btns;
  10673. ++ gkpdata.poll_interval = pdata->btn_poll_interval;
  10674. ++
  10675. ++ pdev = platform_device_register_data(sc->dev, "gpio-keys-polled",
  10676. ++ PLATFORM_DEVID_AUTO, &gkpdata,
  10677. ++ sizeof(gkpdata));
  10678. ++ if (!IS_ERR_OR_NULL(pdev))
  10679. ++ sc->btnpdev = pdev;
  10680. ++ else {
  10681. ++ sc->btnpdev = NULL;
  10682. ++ devm_kfree(sc->dev, bt);
  10683. ++ }
  10684. ++}
  10685. ++
  10686. ++/* remove GPIO buttons */
  10687. ++static void ath9k_deinit_buttons(struct ath_softc *sc)
  10688. ++{
  10689. ++ if (!sc->gpiochip || !sc->btnpdev)
  10690. ++ return;
  10691. ++
  10692. ++ platform_device_unregister(sc->btnpdev);
  10693. ++
  10694. ++ sc->btnpdev = NULL;
  10695. ++}
  10696. ++
  10697. + #else /* CONFIG_GPIOLIB */
  10698. +
  10699. + static inline void ath9k_register_gpio_chip(struct ath_softc *sc)
  10700. +@@ -139,6 +199,14 @@ static inline void ath9k_unregister_gpio
  10701. + {
  10702. + }
  10703. +
  10704. ++static inline void ath9k_init_buttons(struct ath_softc *sc)
  10705. ++{
  10706. ++}
  10707. ++
  10708. ++static inline void ath9k_deinit_buttons(struct ath_softc *sc)
  10709. ++{
  10710. ++}
  10711. ++
  10712. + #endif /* CONFIG_GPIOLIB */
  10713. +
  10714. + /********************************/
  10715. +@@ -262,6 +330,7 @@ void ath_deinit_leds(struct ath_softc *s
  10716. + {
  10717. + struct ath_led *led;
  10718. +
  10719. ++ ath9k_deinit_buttons(sc);
  10720. + while (!list_empty(&sc->leds)) {
  10721. + led = list_first_entry(&sc->leds, struct ath_led, list);
  10722. + #ifdef CONFIG_GPIOLIB
  10723. +@@ -293,6 +362,7 @@ void ath_init_leds(struct ath_softc *sc)
  10724. + ath_fill_led_pin(sc);
  10725. +
  10726. + ath9k_register_gpio_chip(sc);
  10727. ++ ath9k_init_buttons(sc);
  10728. +
  10729. + if (pdata && pdata->led_name)
  10730. + strncpy(led_name, pdata->led_name, sizeof(led_name));
  10731. +@@ -308,7 +378,7 @@ void ath_init_leds(struct ath_softc *sc)
  10732. + ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger,
  10733. + !sc->sc_ah->config.led_active_high);
  10734. +
  10735. +- if (!pdata)
  10736. ++ if (!pdata || !pdata->leds || !pdata->num_leds)
  10737. + return;
  10738. +
  10739. + for (i = 0; i < pdata->num_leds; i++)
  10740. +--- a/include/linux/ath9k_platform.h
  10741. ++++ b/include/linux/ath9k_platform.h
  10742. +@@ -50,6 +50,10 @@ struct ath9k_platform_data {
  10743. + int num_leds;
  10744. + const struct gpio_led *leds;
  10745. + const char *led_name;
  10746. ++
  10747. ++ unsigned num_btns;
  10748. ++ const struct gpio_keys_button *btns;
  10749. ++ unsigned btn_poll_interval;
  10750. + };
  10751. +
  10752. + #endif /* _LINUX_ATH9K_PLATFORM_H */
  10753. 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
  10754. index 8245909..db70a33 100644
  10755. --- a/package/kernel/mac80211/patches/600-0002-rt2x00-rt2800lib-introduce-RT2800_HAS_HIGH_SHARED_ME.patch
  10756. +++ b/package/kernel/mac80211/patches/600-0002-rt2x00-rt2800lib-introduce-RT2800_HAS_HIGH_SHARED_ME.patch
  10757. @@ -24,7 +24,7 @@ Changes since v1:
  10758. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  10759. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  10760. -@@ -7722,6 +7722,7 @@ static int rt2800_probe_rt(struct rt2x00
  10761. +@@ -7726,6 +7726,7 @@ static int rt2800_probe_rt(struct rt2x00
  10762. int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev)
  10763. {
  10764. @@ -32,7 +32,7 @@ Changes since v1:
  10765. int retval;
  10766. u32 reg;
  10767. -@@ -7729,6 +7730,9 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  10768. +@@ -7733,6 +7734,9 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  10769. if (retval)
  10770. return retval;
  10771. 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
  10772. index 7abfcd1..a3b62bc 100644
  10773. --- a/package/kernel/mac80211/patches/600-0003-rt2x00-rt2800-serialize-shared-memory-access.patch
  10774. +++ b/package/kernel/mac80211/patches/600-0003-rt2x00-rt2800-serialize-shared-memory-access.patch
  10775. @@ -239,7 +239,7 @@ Changes since v1: ---
  10776. msleep(1);
  10777. /*
  10778. -@@ -7726,6 +7774,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  10779. +@@ -7730,6 +7778,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  10780. int retval;
  10781. u32 reg;
  10782. @@ -248,7 +248,7 @@ Changes since v1: ---
  10783. retval = rt2800_probe_rt(rt2x00dev);
  10784. if (retval)
  10785. return retval;
  10786. -@@ -7809,8 +7859,11 @@ void rt2800_get_key_seq(struct ieee80211
  10787. +@@ -7813,8 +7863,11 @@ void rt2800_get_key_seq(struct ieee80211
  10788. return;
  10789. offset = MAC_IVEIV_ENTRY(key->hw_key_idx);
  10790. 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
  10791. index 02b2acf..f41a160 100644
  10792. --- a/package/kernel/mac80211/patches/600-0005-rt2x00-rt2800lib-add-hw_beacon_count-field-to-struct.patch
  10793. +++ b/package/kernel/mac80211/patches/600-0005-rt2x00-rt2800lib-add-hw_beacon_count-field-to-struct.patch
  10794. @@ -41,7 +41,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  10795. rt2800_clear_beacon_register(rt2x00dev, i);
  10796. if (rt2x00_is_usb(rt2x00dev)) {
  10797. -@@ -7827,6 +7828,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  10798. +@@ -7831,6 +7832,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  10799. if (rt2x00_rt(rt2x00dev, RT3593))
  10800. __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  10801. 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
  10802. index e909272..5099c64 100644
  10803. --- a/package/kernel/mac80211/patches/600-0007-rt2x00-rt2800lib-fix-max-supported-beacon-count-for-.patch
  10804. +++ b/package/kernel/mac80211/patches/600-0007-rt2x00-rt2800lib-fix-max-supported-beacon-count-for-.patch
  10805. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  10806. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  10807. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  10808. -@@ -7852,7 +7852,10 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  10809. +@@ -7856,7 +7856,10 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  10810. if (rt2x00_rt(rt2x00dev, RT3593))
  10811. __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  10812. 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
  10813. index 7fe38e0..a2e7015 100644
  10814. --- a/package/kernel/mac80211/patches/600-0009-rt2x00-rt2800lib-enable-support-for-RT3883.patch
  10815. +++ b/package/kernel/mac80211/patches/600-0009-rt2x00-rt2800lib-enable-support-for-RT3883.patch
  10816. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  10817. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  10818. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  10819. -@@ -7822,6 +7822,7 @@ static int rt2800_probe_rt(struct rt2x00
  10820. +@@ -7826,6 +7826,7 @@ static int rt2800_probe_rt(struct rt2x00
  10821. case RT3390:
  10822. case RT3572:
  10823. case RT3593:
  10824. 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
  10825. index 253a0c0..89bd0ac 100644
  10826. --- a/package/kernel/mac80211/patches/600-0010-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch
  10827. +++ b/package/kernel/mac80211/patches/600-0010-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch
  10828. @@ -98,7 +98,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  10829. static const struct rf_channel rf_vals_5592_xtal20[] = {
  10830. /* Channel, N, K, mod, R */
  10831. {1, 482, 4, 10, 3},
  10832. -@@ -7669,6 +7729,11 @@ static int rt2800_probe_hw_mode(struct r
  10833. +@@ -7673,6 +7733,11 @@ static int rt2800_probe_hw_mode(struct r
  10834. spec->channels = rf_vals_3x;
  10835. break;
  10836. 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
  10837. index f15c22b..b7efc9f 100644
  10838. --- a/package/kernel/mac80211/patches/600-0011-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch
  10839. +++ b/package/kernel/mac80211/patches/600-0011-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch
  10840. @@ -18,7 +18,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  10841. case RF5360:
  10842. case RF5362:
  10843. case RF5370:
  10844. -@@ -7848,6 +7849,7 @@ static int rt2800_probe_hw_mode(struct r
  10845. +@@ -7852,6 +7853,7 @@ static int rt2800_probe_hw_mode(struct r
  10846. case RF3053:
  10847. case RF3070:
  10848. case RF3290:
  10849. 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
  10850. index 6ce224a..220e35f 100644
  10851. --- a/package/kernel/mac80211/patches/600-0026-rt2x00-rt2800lib-use-correct-beacon-count-for-RT3883.patch
  10852. +++ b/package/kernel/mac80211/patches/600-0026-rt2x00-rt2800lib-use-correct-beacon-count-for-RT3883.patch
  10853. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  10854. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  10855. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  10856. -@@ -8403,7 +8403,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  10857. +@@ -8407,7 +8407,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  10858. if (rt2x00_rt(rt2x00dev, RT3593))
  10859. __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  10860. 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
  10861. index 25753af..2ffa5a4 100644
  10862. --- a/package/kernel/mac80211/patches/600-0032-rt2x00-rt2800lib-enable-RT2800_HAS_HIGH_SHARED_MEM-f.patch
  10863. +++ b/package/kernel/mac80211/patches/600-0032-rt2x00-rt2800lib-enable-RT2800_HAS_HIGH_SHARED_MEM-f.patch
  10864. @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  10865. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  10866. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  10867. -@@ -8416,7 +8416,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  10868. +@@ -8420,7 +8420,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  10869. if (retval)
  10870. return retval;
  10871. 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
  10872. index 7a183a4..daa5dc6 100644
  10873. --- a/package/kernel/mac80211/patches/602-rt2x00-introduce-rt2x00_platform_h.patch
  10874. +++ b/package/kernel/mac80211/patches/602-rt2x00-introduce-rt2x00_platform_h.patch
  10875. @@ -22,10 +22,10 @@
  10876. +#endif /* _RT2X00_PLATFORM_H */
  10877. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  10878. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  10879. -@@ -38,6 +38,7 @@
  10880. - #include <linux/kfifo.h>
  10881. +@@ -39,6 +39,7 @@
  10882. #include <linux/hrtimer.h>
  10883. #include <linux/average.h>
  10884. + #include <linux/usb.h>
  10885. +#include <linux/rt2x00_platform.h>
  10886. #include <net/mac80211.h>
  10887. diff --git a/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch b/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
  10888. index bc056cd..8ae5da3 100644
  10889. --- a/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
  10890. +++ b/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
  10891. @@ -1,6 +1,6 @@
  10892. --- a/.local-symbols
  10893. +++ b/.local-symbols
  10894. -@@ -329,6 +329,7 @@ RT2X00_LIB_FIRMWARE=
  10895. +@@ -331,6 +331,7 @@ RT2X00_LIB_FIRMWARE=
  10896. RT2X00_LIB_CRYPTO=
  10897. RT2X00_LIB_LEDS=
  10898. RT2X00_LIB_DEBUGFS=
  10899. @@ -105,7 +105,7 @@
  10900. .drv_init_registers = rt2800mmio_init_registers,
  10901. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  10902. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  10903. -@@ -697,6 +697,7 @@ enum rt2x00_capability_flags {
  10904. +@@ -699,6 +699,7 @@ enum rt2x00_capability_flags {
  10905. REQUIRE_HT_TX_DESC,
  10906. REQUIRE_PS_AUTOWAKE,
  10907. REQUIRE_DELAYED_RFKILL,
  10908. @@ -127,7 +127,7 @@
  10909. DECLARE_KFIFO_PTR(txstatus_fifo, u32);
  10910. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  10911. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  10912. -@@ -1335,6 +1335,10 @@ int rt2x00lib_probe_dev(struct rt2x00_de
  10913. +@@ -1334,6 +1334,10 @@ int rt2x00lib_probe_dev(struct rt2x00_de
  10914. INIT_DELAYED_WORK(&rt2x00dev->autowakeup_work, rt2x00lib_autowakeup);
  10915. INIT_WORK(&rt2x00dev->sleep_work, rt2x00lib_sleep);
  10916. @@ -138,7 +138,7 @@
  10917. /*
  10918. * Let the driver probe the device to detect the capabilities.
  10919. */
  10920. -@@ -1475,6 +1479,11 @@ void rt2x00lib_remove_dev(struct rt2x00_
  10921. +@@ -1477,6 +1481,11 @@ void rt2x00lib_remove_dev(struct rt2x00_
  10922. * Free the driver data.
  10923. */
  10924. kfree(rt2x00dev->drv_data);
  10925. 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
  10926. index d923e05..a2e1faf 100644
  10927. --- a/package/kernel/mac80211/patches/607-rt2x00-allow_disabling_bands_through_platform_data.patch
  10928. +++ b/package/kernel/mac80211/patches/607-rt2x00-allow_disabling_bands_through_platform_data.patch
  10929. @@ -37,7 +37,7 @@
  10930. num_rates += 4;
  10931. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  10932. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  10933. -@@ -405,6 +405,7 @@ struct hw_mode_spec {
  10934. +@@ -406,6 +406,7 @@ struct hw_mode_spec {
  10935. unsigned int supported_bands;
  10936. #define SUPPORT_BAND_2GHZ 0x00000001
  10937. #define SUPPORT_BAND_5GHZ 0x00000002
  10938. 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
  10939. index a645ba1..6704ff8 100644
  10940. --- a/package/kernel/mac80211/patches/608-add_platform_data_mac_addr.patch
  10941. +++ b/package/kernel/mac80211/patches/608-add_platform_data_mac_addr.patch
  10942. @@ -31,7 +31,7 @@
  10943. {
  10944. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  10945. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  10946. -@@ -1414,6 +1414,7 @@ static inline void rt2x00debug_dump_fram
  10947. +@@ -1416,6 +1416,7 @@ static inline void rt2x00debug_dump_fram
  10948. */
  10949. u32 rt2x00lib_get_bssidx(struct rt2x00_dev *rt2x00dev,
  10950. struct ieee80211_vif *vif);
  10951. 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
  10952. index c69d330..9f10fe3 100644
  10953. --- a/package/kernel/mac80211/patches/610-rt2x00-fix-rt3352-ext-pa.patch
  10954. +++ b/package/kernel/mac80211/patches/610-rt2x00-fix-rt3352-ext-pa.patch
  10955. @@ -200,7 +200,7 @@
  10956. * EEPROM frequency
  10957. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  10958. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  10959. -@@ -717,6 +717,8 @@ enum rt2x00_capability_flags {
  10960. +@@ -719,6 +719,8 @@ enum rt2x00_capability_flags {
  10961. CAPABILITY_DOUBLE_ANTENNA,
  10962. CAPABILITY_BT_COEXIST,
  10963. CAPABILITY_VCO_RECALIBRATION,
  10964. 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
  10965. index b44fe90..860fdc0 100644
  10966. --- a/package/kernel/mac80211/patches/611-rt2x00-rf_vals-rt3352-xtal20.patch
  10967. +++ b/package/kernel/mac80211/patches/611-rt2x00-rf_vals-rt3352-xtal20.patch
  10968. @@ -28,7 +28,7 @@
  10969. static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
  10970. {
  10971. struct hw_mode_spec *spec = &rt2x00dev->spec;
  10972. -@@ -8272,7 +8293,10 @@ static int rt2800_probe_hw_mode(struct r
  10973. +@@ -8276,7 +8297,10 @@ static int rt2800_probe_hw_mode(struct r
  10974. case RF5390:
  10975. case RF5392:
  10976. spec->num_channels = 14;
  10977. @@ -40,7 +40,7 @@
  10978. break;
  10979. case RF3052:
  10980. -@@ -8456,6 +8480,19 @@ static int rt2800_probe_rt(struct rt2x00
  10981. +@@ -8460,6 +8484,19 @@ static int rt2800_probe_rt(struct rt2x00
  10982. return 0;
  10983. }
  10984. @@ -60,7 +60,7 @@
  10985. int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev)
  10986. {
  10987. struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
  10988. -@@ -8498,6 +8535,15 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  10989. +@@ -8502,6 +8539,15 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  10990. rt2800_register_write(rt2x00dev, GPIO_CTRL, reg);
  10991. /*
  10992. @@ -78,7 +78,7 @@
  10993. retval = rt2800_probe_hw_mode(rt2x00dev);
  10994. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  10995. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  10996. -@@ -400,6 +400,7 @@ static inline struct rt2x00_intf* vif_to
  10997. +@@ -401,6 +401,7 @@ static inline struct rt2x00_intf* vif_to
  10998. * @channels: Device/chipset specific channel values (See &struct rf_channel).
  10999. * @channels_info: Additional information for channels (See &struct channel_info).
  11000. * @ht: Driver HT Capabilities (See &ieee80211_sta_ht_cap).
  11001. @@ -86,7 +86,7 @@
  11002. */
  11003. struct hw_mode_spec {
  11004. unsigned int supported_bands;
  11005. -@@ -416,6 +417,7 @@ struct hw_mode_spec {
  11006. +@@ -417,6 +418,7 @@ struct hw_mode_spec {
  11007. const struct channel_info *channels_info;
  11008. struct ieee80211_sta_ht_cap ht;
  11009. diff --git a/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch b/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
  11010. index 8e3bd2a..e7b2a8c 100644
  11011. --- a/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
  11012. +++ b/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
  11013. @@ -8,7 +8,7 @@
  11014. #include "rt2x00.h"
  11015. #include "rt2800lib.h"
  11016. -@@ -8482,13 +8483,14 @@ static int rt2800_probe_rt(struct rt2x00
  11017. +@@ -8486,13 +8487,14 @@ static int rt2800_probe_rt(struct rt2x00
  11018. int rt2800_probe_clk(struct rt2x00_dev *rt2x00dev)
  11019. {
  11020. diff --git a/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch b/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch
  11021. index faa5879..44bd8a1 100644
  11022. --- a/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch
  11023. +++ b/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch
  11024. @@ -240,7 +240,7 @@
  11025. case RF5360:
  11026. case RF5362:
  11027. case RF5370:
  11028. -@@ -8287,6 +8398,7 @@ static int rt2800_probe_hw_mode(struct r
  11029. +@@ -8291,6 +8402,7 @@ static int rt2800_probe_hw_mode(struct r
  11030. case RF3290:
  11031. case RF3320:
  11032. case RF3322:
  11033. @@ -248,7 +248,7 @@
  11034. case RF5360:
  11035. case RF5362:
  11036. case RF5370:
  11037. -@@ -8426,6 +8538,7 @@ static int rt2800_probe_hw_mode(struct r
  11038. +@@ -8430,6 +8542,7 @@ static int rt2800_probe_hw_mode(struct r
  11039. case RF3070:
  11040. case RF3290:
  11041. case RF3853:
  11042. @@ -256,7 +256,7 @@
  11043. case RF5360:
  11044. case RF5362:
  11045. case RF5370:
  11046. -@@ -8466,6 +8579,7 @@ static int rt2800_probe_rt(struct rt2x00
  11047. +@@ -8470,6 +8583,7 @@ static int rt2800_probe_rt(struct rt2x00
  11048. case RT3572:
  11049. case RT3593:
  11050. case RT3883:
  11051. @@ -266,7 +266,7 @@
  11052. case RT5592:
  11053. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  11054. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  11055. -@@ -169,6 +169,7 @@ struct rt2x00_chip {
  11056. +@@ -170,6 +170,7 @@ struct rt2x00_chip {
  11057. #define RT3572 0x3572
  11058. #define RT3593 0x3593
  11059. #define RT3883 0x3883 /* WSOC */
  11060. 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
  11061. index 55452b9..dba6033 100644
  11062. --- a/package/kernel/mac80211/patches/620-rt2x00-add-AP+STA-support.patch
  11063. +++ b/package/kernel/mac80211/patches/620-rt2x00-add-AP+STA-support.patch
  11064. @@ -1,6 +1,6 @@
  11065. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  11066. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  11067. -@@ -1284,7 +1284,7 @@ static inline void rt2x00lib_set_if_comb
  11068. +@@ -1283,7 +1283,7 @@ static inline void rt2x00lib_set_if_comb
  11069. */
  11070. if_limit = &rt2x00dev->if_limits_ap;
  11071. if_limit->max = rt2x00dev->ops->max_ap_intf;
  11072. diff --git a/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch b/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
  11073. index fd885cc..02f3053 100644
  11074. --- a/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
  11075. +++ b/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
  11076. @@ -1,6 +1,6 @@
  11077. --- a/drivers/net/wireless/marvell/libertas/cfg.c
  11078. +++ b/drivers/net/wireless/marvell/libertas/cfg.c
  11079. -@@ -2084,6 +2084,8 @@ struct wireless_dev *lbs_cfg_alloc(struc
  11080. +@@ -2122,6 +2122,8 @@ struct wireless_dev *lbs_cfg_alloc(struc
  11081. goto err_wiphy_new;
  11082. }
  11083. diff --git a/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch b/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
  11084. index b67a95f..ad30608 100644
  11085. --- a/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
  11086. +++ b/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
  11087. @@ -1,6 +1,6 @@
  11088. --- a/drivers/net/wireless/marvell/libertas/cfg.c
  11089. +++ b/drivers/net/wireless/marvell/libertas/cfg.c
  11090. -@@ -2174,6 +2174,8 @@ int lbs_cfg_register(struct lbs_private
  11091. +@@ -2212,6 +2212,8 @@ int lbs_cfg_register(struct lbs_private
  11092. wdev->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
  11093. wdev->wiphy->reg_notifier = lbs_reg_notifier;
  11094. diff --git a/package/kernel/mac80211/patches/804-b43-sync-with-bcma.patch b/package/kernel/mac80211/patches/804-b43-sync-with-bcma.patch
  11095. deleted file mode 100644
  11096. index 74cd448..0000000
  11097. --- a/package/kernel/mac80211/patches/804-b43-sync-with-bcma.patch
  11098. +++ /dev/null
  11099. @@ -1,17 +0,0 @@
  11100. ---- a/drivers/net/wireless/broadcom/b43/main.c
  11101. -+++ b/drivers/net/wireless/broadcom/b43/main.c
  11102. -@@ -1215,10 +1215,10 @@ void b43_wireless_core_phy_pll_reset(str
  11103. - case B43_BUS_BCMA:
  11104. - bcma_cc = &dev->dev->bdev->bus->drv_cc;
  11105. -
  11106. -- bcma_cc_write32(bcma_cc, BCMA_CC_CHIPCTL_ADDR, 0);
  11107. -- bcma_cc_mask32(bcma_cc, BCMA_CC_CHIPCTL_DATA, ~0x4);
  11108. -- bcma_cc_set32(bcma_cc, BCMA_CC_CHIPCTL_DATA, 0x4);
  11109. -- bcma_cc_mask32(bcma_cc, BCMA_CC_CHIPCTL_DATA, ~0x4);
  11110. -+ bcma_cc_write32(bcma_cc, BCMA_CC_PMU_CHIPCTL_ADDR, 0);
  11111. -+ bcma_cc_mask32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, ~0x4);
  11112. -+ bcma_cc_set32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, 0x4);
  11113. -+ bcma_cc_mask32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, ~0x4);
  11114. - break;
  11115. - #endif
  11116. - #ifdef CPTCFG_B43_SSB
  11117. diff --git a/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch b/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch
  11118. index 06c731f..f8f555f 100644
  11119. --- a/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch
  11120. +++ b/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch
  11121. @@ -9,7 +9,7 @@
  11122. antenna = b43_antenna_to_phyctl(antenna);
  11123. ctl = b43_shm_read16(dev, B43_SHM_SHARED, B43_SHM_SH_BEACPHYCTL);
  11124. /* We can't send beacons with short preamble. Would get PHY errors. */
  11125. -@@ -3300,8 +3300,8 @@ static int b43_chip_init(struct b43_wlde
  11126. +@@ -3297,8 +3297,8 @@ static int b43_chip_init(struct b43_wlde
  11127. /* Select the antennae */
  11128. if (phy->ops->set_rx_antenna)
  11129. @@ -20,7 +20,7 @@
  11130. if (phy->type == B43_PHYTYPE_B) {
  11131. value16 = b43_read16(dev, 0x005E);
  11132. -@@ -4001,7 +4001,6 @@ static int b43_op_config(struct ieee8021
  11133. +@@ -3998,7 +3998,6 @@ static int b43_op_config(struct ieee8021
  11134. struct b43_wldev *dev = wl->current_dev;
  11135. struct b43_phy *phy = &dev->phy;
  11136. struct ieee80211_conf *conf = &hw->conf;
  11137. @@ -28,7 +28,7 @@
  11138. int err = 0;
  11139. mutex_lock(&wl->mutex);
  11140. -@@ -4044,11 +4043,9 @@ static int b43_op_config(struct ieee8021
  11141. +@@ -4041,11 +4040,9 @@ static int b43_op_config(struct ieee8021
  11142. }
  11143. /* Antennas for RX and management frame TX. */
  11144. @@ -42,7 +42,7 @@
  11145. if (wl->radio_enabled != phy->radio_on) {
  11146. if (wl->radio_enabled) {
  11147. -@@ -5209,6 +5206,47 @@ static int b43_op_get_survey(struct ieee
  11148. +@@ -5189,6 +5186,47 @@ static int b43_op_get_survey(struct ieee
  11149. return 0;
  11150. }
  11151. @@ -90,7 +90,7 @@
  11152. static const struct ieee80211_ops b43_hw_ops = {
  11153. .tx = b43_op_tx,
  11154. .conf_tx = b43_op_conf_tx,
  11155. -@@ -5230,6 +5268,8 @@ static const struct ieee80211_ops b43_hw
  11156. +@@ -5210,6 +5248,8 @@ static const struct ieee80211_ops b43_hw
  11157. .sw_scan_complete = b43_op_sw_scan_complete_notifier,
  11158. .get_survey = b43_op_get_survey,
  11159. .rfkill_poll = b43_rfkill_poll,
  11160. @@ -99,7 +99,7 @@
  11161. };
  11162. /* Hard-reset the chip. Do not call this directly.
  11163. -@@ -5538,6 +5578,8 @@ static int b43_one_core_attach(struct b4
  11164. +@@ -5513,6 +5553,8 @@ static int b43_one_core_attach(struct b4
  11165. if (!wldev)
  11166. goto out;
  11167. @@ -108,7 +108,7 @@
  11168. wldev->use_pio = b43_modparam_pio;
  11169. wldev->dev = dev;
  11170. wldev->wl = wl;
  11171. -@@ -5628,6 +5670,9 @@ static struct b43_wl *b43_wireless_init(
  11172. +@@ -5603,6 +5645,9 @@ static struct b43_wl *b43_wireless_init(
  11173. hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
  11174. 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
  11175. new file mode 100644
  11176. index 0000000..ae571c9
  11177. --- /dev/null
  11178. +++ b/package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch
  11179. @@ -0,0 +1,97 @@
  11180. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  11181. +Date: Mon, 8 Jun 2015 16:11:40 +0200
  11182. +Subject: [PATCH] brcmfmac: register wiphy(s) during module_init
  11183. +MIME-Version: 1.0
  11184. +Content-Type: text/plain; charset=UTF-8
  11185. +Content-Transfer-Encoding: 8bit
  11186. +
  11187. +This is needed by OpenWrt which expects all PHYs to be created after
  11188. +module loads successfully.
  11189. +
  11190. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  11191. +---
  11192. +
  11193. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  11194. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  11195. +@@ -1213,6 +1213,7 @@ int __init brcmf_core_init(void)
  11196. + {
  11197. + if (!schedule_work(&brcmf_driver_work))
  11198. + return -EBUSY;
  11199. ++ flush_work(&brcmf_driver_work);
  11200. +
  11201. + return 0;
  11202. + }
  11203. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  11204. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  11205. +@@ -444,6 +444,7 @@ struct brcmf_fw {
  11206. + u16 bus_nr;
  11207. + void (*done)(struct device *dev, const struct firmware *fw,
  11208. + void *nvram_image, u32 nvram_len);
  11209. ++ struct completion *completion;
  11210. + };
  11211. +
  11212. + static void brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx)
  11213. +@@ -478,6 +479,8 @@ static void brcmf_fw_request_nvram_done(
  11214. + goto fail;
  11215. +
  11216. + fwctx->done(fwctx->dev, fwctx->code, nvram, nvram_length);
  11217. ++ if (fwctx->completion)
  11218. ++ complete(fwctx->completion);
  11219. + kfree(fwctx);
  11220. + return;
  11221. +
  11222. +@@ -485,6 +488,8 @@ fail:
  11223. + brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev));
  11224. + release_firmware(fwctx->code);
  11225. + device_release_driver(fwctx->dev);
  11226. ++ if (fwctx->completion)
  11227. ++ complete(fwctx->completion);
  11228. + kfree(fwctx);
  11229. + }
  11230. +
  11231. +@@ -500,6 +505,8 @@ static void brcmf_fw_request_code_done(c
  11232. + /* only requested code so done here */
  11233. + if (!(fwctx->flags & BRCMF_FW_REQUEST_NVRAM)) {
  11234. + fwctx->done(fwctx->dev, fw, NULL, 0);
  11235. ++ if (fwctx->completion)
  11236. ++ complete(fwctx->completion);
  11237. + kfree(fwctx);
  11238. + return;
  11239. + }
  11240. +@@ -517,6 +524,8 @@ static void brcmf_fw_request_code_done(c
  11241. + fail:
  11242. + brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev));
  11243. + device_release_driver(fwctx->dev);
  11244. ++ if (fwctx->completion)
  11245. ++ complete(fwctx->completion);
  11246. + kfree(fwctx);
  11247. + }
  11248. +
  11249. +@@ -528,6 +537,8 @@ int brcmf_fw_get_firmwares_pcie(struct d
  11250. + u16 domain_nr, u16 bus_nr)
  11251. + {
  11252. + struct brcmf_fw *fwctx;
  11253. ++ struct completion completion;
  11254. ++ int err;
  11255. +
  11256. + brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(dev));
  11257. + if (!fw_cb || !code)
  11258. +@@ -548,9 +559,17 @@ int brcmf_fw_get_firmwares_pcie(struct d
  11259. + fwctx->domain_nr = domain_nr;
  11260. + fwctx->bus_nr = bus_nr;
  11261. +
  11262. +- return request_firmware_nowait(THIS_MODULE, true, code, dev,
  11263. ++ init_completion(&completion);
  11264. ++ fwctx->completion = &completion;
  11265. ++
  11266. ++ err = request_firmware_nowait(THIS_MODULE, true, code, dev,
  11267. + GFP_KERNEL, fwctx,
  11268. + brcmf_fw_request_code_done);
  11269. ++ if (!err)
  11270. ++ wait_for_completion_timeout(fwctx->completion,
  11271. ++ msecs_to_jiffies(5000));
  11272. ++ fwctx->completion = NULL;
  11273. ++ return err;
  11274. + }
  11275. +
  11276. + int brcmf_fw_get_firmwares(struct device *dev, u16 flags,
  11277. 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
  11278. deleted file mode 100644
  11279. index 00181f6..0000000
  11280. --- a/package/kernel/mac80211/patches/861-brcmfmac-register-wiphy-s-during-module_init.patch
  11281. +++ /dev/null
  11282. @@ -1,97 +0,0 @@
  11283. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  11284. -Date: Mon, 8 Jun 2015 16:11:40 +0200
  11285. -Subject: [PATCH] brcmfmac: register wiphy(s) during module_init
  11286. -MIME-Version: 1.0
  11287. -Content-Type: text/plain; charset=UTF-8
  11288. -Content-Transfer-Encoding: 8bit
  11289. -
  11290. -This is needed by OpenWrt which expects all PHYs to be created after
  11291. -module loads successfully.
  11292. -
  11293. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  11294. ----
  11295. -
  11296. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  11297. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  11298. -@@ -1332,6 +1332,7 @@ static int __init brcmfmac_module_init(v
  11299. - #endif
  11300. - if (!schedule_work(&brcmf_driver_work))
  11301. - return -EBUSY;
  11302. -+ flush_work(&brcmf_driver_work);
  11303. -
  11304. - return 0;
  11305. - }
  11306. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  11307. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  11308. -@@ -444,6 +444,7 @@ struct brcmf_fw {
  11309. - u16 bus_nr;
  11310. - void (*done)(struct device *dev, const struct firmware *fw,
  11311. - void *nvram_image, u32 nvram_len);
  11312. -+ struct completion *completion;
  11313. - };
  11314. -
  11315. - static void brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx)
  11316. -@@ -478,6 +479,8 @@ static void brcmf_fw_request_nvram_done(
  11317. - goto fail;
  11318. -
  11319. - fwctx->done(fwctx->dev, fwctx->code, nvram, nvram_length);
  11320. -+ if (fwctx->completion)
  11321. -+ complete(fwctx->completion);
  11322. - kfree(fwctx);
  11323. - return;
  11324. -
  11325. -@@ -485,6 +488,8 @@ fail:
  11326. - brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev));
  11327. - release_firmware(fwctx->code);
  11328. - device_release_driver(fwctx->dev);
  11329. -+ if (fwctx->completion)
  11330. -+ complete(fwctx->completion);
  11331. - kfree(fwctx);
  11332. - }
  11333. -
  11334. -@@ -500,6 +505,8 @@ static void brcmf_fw_request_code_done(c
  11335. - /* only requested code so done here */
  11336. - if (!(fwctx->flags & BRCMF_FW_REQUEST_NVRAM)) {
  11337. - fwctx->done(fwctx->dev, fw, NULL, 0);
  11338. -+ if (fwctx->completion)
  11339. -+ complete(fwctx->completion);
  11340. - kfree(fwctx);
  11341. - return;
  11342. - }
  11343. -@@ -517,6 +524,8 @@ static void brcmf_fw_request_code_done(c
  11344. - fail:
  11345. - brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev));
  11346. - device_release_driver(fwctx->dev);
  11347. -+ if (fwctx->completion)
  11348. -+ complete(fwctx->completion);
  11349. - kfree(fwctx);
  11350. - }
  11351. -
  11352. -@@ -528,6 +537,8 @@ int brcmf_fw_get_firmwares_pcie(struct d
  11353. - u16 domain_nr, u16 bus_nr)
  11354. - {
  11355. - struct brcmf_fw *fwctx;
  11356. -+ struct completion completion;
  11357. -+ int err;
  11358. -
  11359. - brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(dev));
  11360. - if (!fw_cb || !code)
  11361. -@@ -548,9 +559,17 @@ int brcmf_fw_get_firmwares_pcie(struct d
  11362. - fwctx->domain_nr = domain_nr;
  11363. - fwctx->bus_nr = bus_nr;
  11364. -
  11365. -- return request_firmware_nowait(THIS_MODULE, true, code, dev,
  11366. -+ init_completion(&completion);
  11367. -+ fwctx->completion = &completion;
  11368. -+
  11369. -+ err = request_firmware_nowait(THIS_MODULE, true, code, dev,
  11370. - GFP_KERNEL, fwctx,
  11371. - brcmf_fw_request_code_done);
  11372. -+ if (!err)
  11373. -+ wait_for_completion_timeout(fwctx->completion,
  11374. -+ msecs_to_jiffies(5000));
  11375. -+ fwctx->completion = NULL;
  11376. -+ return err;
  11377. - }
  11378. -
  11379. - int brcmf_fw_get_firmwares(struct device *dev, u16 flags,
  11380. 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
  11381. new file mode 100644
  11382. index 0000000..8721155
  11383. --- /dev/null
  11384. +++ b/package/kernel/mac80211/patches/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch
  11385. @@ -0,0 +1,50 @@
  11386. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  11387. +Date: Thu, 9 Jul 2015 00:07:59 +0200
  11388. +Subject: [PATCH] brcmfmac: workaround bug with some inconsistent BSSes state
  11389. +MIME-Version: 1.0
  11390. +Content-Type: text/plain; charset=UTF-8
  11391. +Content-Transfer-Encoding: 8bit
  11392. +
  11393. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  11394. +---
  11395. +
  11396. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  11397. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  11398. +@@ -665,9 +665,37 @@ static struct wireless_dev *brcmf_cfg802
  11399. + u32 *flags,
  11400. + struct vif_params *params)
  11401. + {
  11402. ++ struct net_device *dev;
  11403. + struct wireless_dev *wdev;
  11404. + int err;
  11405. +
  11406. ++ /*
  11407. ++ * There is a bug with in-firmware BSS management. When adding virtual
  11408. ++ * interface brcmfmac first tells firmware to create new BSS and then
  11409. ++ * it creates new struct net_device.
  11410. ++ *
  11411. ++ * If creating/registering netdev(ice) fails, BSS remains in some bugged
  11412. ++ * state. It conflicts with existing BSSes by overtaking their auth
  11413. ++ * requests.
  11414. ++ *
  11415. ++ * It results in one BSS (addresss X) sending beacons and another BSS
  11416. ++ * (address Y) replying to authentication requests. This makes interface
  11417. ++ * unusable as AP.
  11418. ++ *
  11419. ++ * To workaround this bug we may try to guess if register_netdev(ice)
  11420. ++ * will fail. The most obvious case is using interface name that already
  11421. ++ * exists. This is actually quite likely with brcmfmac & some user space
  11422. ++ * scripts as brcmfmac doesn't allow deleting virtual interfaces.
  11423. ++ * So this bug can be triggered even by something trivial like:
  11424. ++ * iw dev wlan0 delete
  11425. ++ * iw phy phy0 interface add wlan0 type __ap
  11426. ++ */
  11427. ++ dev = dev_get_by_name(&init_net, name);
  11428. ++ if (dev) {
  11429. ++ dev_put(dev);
  11430. ++ return ERR_PTR(-ENFILE);
  11431. ++ }
  11432. ++
  11433. + brcmf_dbg(TRACE, "enter: %s type %d\n", name, type);
  11434. + err = brcmf_vif_add_validate(wiphy_to_cfg(wiphy), type);
  11435. + if (err) {
  11436. diff --git a/package/kernel/mac80211/patches/862-brcmfmac-Disable-power-management.patch b/package/kernel/mac80211/patches/862-brcmfmac-Disable-power-management.patch
  11437. new file mode 100644
  11438. index 0000000..f301fe1
  11439. --- /dev/null
  11440. +++ b/package/kernel/mac80211/patches/862-brcmfmac-Disable-power-management.patch
  11441. @@ -0,0 +1,27 @@
  11442. +From 66ae1b1750720a33e29792a177b1e696f4f005fb Mon Sep 17 00:00:00 2001
  11443. +From: Phil Elwell <phil@raspberrypi.org>
  11444. +Date: Wed, 9 Mar 2016 17:25:59 +0000
  11445. +Subject: [PATCH] brcmfmac: Disable power management
  11446. +
  11447. +Disable wireless power saving in the brcmfmac WLAN driver. This is a
  11448. +temporary measure until the connectivity loss resulting from power
  11449. +saving is resolved.
  11450. +
  11451. +Signed-off-by: Phil Elwell <phil@raspberrypi.org>
  11452. +---
  11453. + drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c | 2 ++
  11454. + 1 file changed, 2 insertions(+)
  11455. +
  11456. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  11457. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  11458. +@@ -2783,6 +2783,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip
  11459. + * preference in cfg struct to apply this to
  11460. + * FW later while initializing the dongle
  11461. + */
  11462. ++#if defined(CONFIG_BCM2708) || defined(CONFIG_BCM2709)
  11463. ++ pr_info("power management disabled\n");
  11464. ++ enabled = false;
  11465. ++#endif
  11466. + cfg->pwr_save = enabled;
  11467. + if (!check_vif_up(ifp->vif)) {
  11468. +
  11469. 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
  11470. deleted file mode 100644
  11471. index 4295b4b..0000000
  11472. --- a/package/kernel/mac80211/patches/862-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch
  11473. +++ /dev/null
  11474. @@ -1,50 +0,0 @@
  11475. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  11476. -Date: Thu, 9 Jul 2015 00:07:59 +0200
  11477. -Subject: [PATCH] brcmfmac: workaround bug with some inconsistent BSSes state
  11478. -MIME-Version: 1.0
  11479. -Content-Type: text/plain; charset=UTF-8
  11480. -Content-Transfer-Encoding: 8bit
  11481. -
  11482. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  11483. ----
  11484. -
  11485. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  11486. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  11487. -@@ -615,9 +615,37 @@ static struct wireless_dev *brcmf_cfg802
  11488. - u32 *flags,
  11489. - struct vif_params *params)
  11490. - {
  11491. -+ struct net_device *dev;
  11492. - struct wireless_dev *wdev;
  11493. - int err;
  11494. -
  11495. -+ /*
  11496. -+ * There is a bug with in-firmware BSS management. When adding virtual
  11497. -+ * interface brcmfmac first tells firmware to create new BSS and then
  11498. -+ * it creates new struct net_device.
  11499. -+ *
  11500. -+ * If creating/registering netdev(ice) fails, BSS remains in some bugged
  11501. -+ * state. It conflicts with existing BSSes by overtaking their auth
  11502. -+ * requests.
  11503. -+ *
  11504. -+ * It results in one BSS (addresss X) sending beacons and another BSS
  11505. -+ * (address Y) replying to authentication requests. This makes interface
  11506. -+ * unusable as AP.
  11507. -+ *
  11508. -+ * To workaround this bug we may try to guess if register_netdev(ice)
  11509. -+ * will fail. The most obvious case is using interface name that already
  11510. -+ * exists. This is actually quite likely with brcmfmac & some user space
  11511. -+ * scripts as brcmfmac doesn't allow deleting virtual interfaces.
  11512. -+ * So this bug can be triggered even by something trivial like:
  11513. -+ * iw dev wlan0 delete
  11514. -+ * iw phy phy0 interface add wlan0 type __ap
  11515. -+ */
  11516. -+ dev = dev_get_by_name(&init_net, name);
  11517. -+ if (dev) {
  11518. -+ dev_put(dev);
  11519. -+ return ERR_PTR(-EEXIST);
  11520. -+ }
  11521. -+
  11522. - brcmf_dbg(TRACE, "enter: %s type %d\n", name, type);
  11523. - err = brcmf_vif_add_validate(wiphy_to_cfg(wiphy), type);
  11524. - if (err) {
  11525. 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
  11526. index f2e21ea..be210f2 100644
  11527. --- a/package/kernel/mac80211/patches/910-01-add-support-for-mt7620.patch
  11528. +++ b/package/kernel/mac80211/patches/910-01-add-support-for-mt7620.patch
  11529. @@ -1184,7 +1184,7 @@
  11530. break;
  11531. default:
  11532. rt2x00_err(rt2x00dev, "Invalid RF chipset 0x%04x detected\n",
  11533. -@@ -8423,6 +9363,7 @@ static int rt2800_probe_hw_mode(struct r
  11534. +@@ -8427,6 +9367,7 @@ static int rt2800_probe_hw_mode(struct r
  11535. case RF5372:
  11536. case RF5390:
  11537. case RF5392:
  11538. @@ -1192,7 +1192,7 @@
  11539. spec->num_channels = 14;
  11540. if (spec->clk_is_20mhz)
  11541. spec->channels = rf_vals_xtal20mhz_3x;
  11542. -@@ -8563,6 +9504,7 @@ static int rt2800_probe_hw_mode(struct r
  11543. +@@ -8567,6 +9508,7 @@ static int rt2800_probe_hw_mode(struct r
  11544. case RF5372:
  11545. case RF5390:
  11546. case RF5392:
  11547. diff --git a/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch b/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
  11548. index 8c6d720..e842d61 100644
  11549. --- a/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
  11550. +++ b/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
  11551. @@ -14,7 +14,7 @@ Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
  11552. --- a/drivers/net/wireless/ath/ath10k/core.c
  11553. +++ b/drivers/net/wireless/ath/ath10k/core.c
  11554. -@@ -1914,6 +1914,16 @@ int ath10k_core_register(struct ath10k *
  11555. +@@ -2107,6 +2107,16 @@ int ath10k_core_register(struct ath10k *
  11556. ar->chip_id = chip_id;
  11557. queue_work(ar->workqueue, &ar->register_work);
  11558. 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
  11559. index 281b447..a501b99 100644
  11560. --- a/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch
  11561. +++ b/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch
  11562. @@ -1,6 +1,6 @@
  11563. --- a/drivers/net/wireless/ath/ath10k/mac.c
  11564. +++ b/drivers/net/wireless/ath/ath10k/mac.c
  11565. -@@ -7141,6 +7141,21 @@ struct ath10k_vif *ath10k_get_arvif(stru
  11566. +@@ -7742,6 +7742,21 @@ struct ath10k_vif *ath10k_get_arvif(stru
  11567. return arvif_iter.arvif;
  11568. }
  11569. @@ -22,11 +22,11 @@
  11570. int ath10k_mac_register(struct ath10k *ar)
  11571. {
  11572. static const u32 cipher_suites[] = {
  11573. -@@ -7357,6 +7372,12 @@ int ath10k_mac_register(struct ath10k *a
  11574. +@@ -7975,6 +7990,12 @@ int ath10k_mac_register(struct ath10k *a
  11575. ar->hw->wiphy->cipher_suites = cipher_suites;
  11576. ar->hw->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
  11577. -+#if CPTCFG_MAC80211_LEDS
  11578. ++#ifdef CPTCFG_MAC80211_LEDS
  11579. + ieee80211_create_tpt_led_trigger(ar->hw,
  11580. + IEEE80211_TPT_LEDTRIG_FL_RADIO, ath10k_tpt_blink,
  11581. + ARRAY_SIZE(ath10k_tpt_blink));
  11582. diff --git a/package/kernel/mac80211/patches/936-ath10k_skip_otp_check.patch b/package/kernel/mac80211/patches/936-ath10k_skip_otp_check.patch
  11583. new file mode 100644
  11584. index 0000000..596ef98
  11585. --- /dev/null
  11586. +++ b/package/kernel/mac80211/patches/936-ath10k_skip_otp_check.patch
  11587. @@ -0,0 +1,51 @@
  11588. +--- a/drivers/net/wireless/ath/ath10k/core.c
  11589. ++++ b/drivers/net/wireless/ath/ath10k/core.c
  11590. +@@ -1243,9 +1243,6 @@ static int ath10k_core_fetch_firmware_fi
  11591. + {
  11592. + int ret;
  11593. +
  11594. +- /* calibration file is optional, don't check for any errors */
  11595. +- ath10k_fetch_cal_file(ar);
  11596. +-
  11597. + ar->fw_api = 5;
  11598. + ath10k_dbg(ar, ATH10K_DBG_BOOT, "trying fw api %d\n", ar->fw_api);
  11599. +
  11600. +@@ -1944,7 +1941,7 @@ EXPORT_SYMBOL(ath10k_core_stop);
  11601. + static int ath10k_core_probe_fw(struct ath10k *ar)
  11602. + {
  11603. + struct bmi_target_info target_info;
  11604. +- int ret = 0;
  11605. ++ int calret, ret = 0;
  11606. +
  11607. + ret = ath10k_hif_power_up(ar);
  11608. + if (ret) {
  11609. +@@ -1968,6 +1965,9 @@ static int ath10k_core_probe_fw(struct a
  11610. + goto err_power_down;
  11611. + }
  11612. +
  11613. ++ /* calibration file is optional, don't check for any errors */
  11614. ++ calret = ath10k_fetch_cal_file(ar);
  11615. ++
  11616. + ret = ath10k_core_fetch_firmware_files(ar);
  11617. + if (ret) {
  11618. + ath10k_err(ar, "could not fetch firmware files (%d)\n", ret);
  11619. +@@ -1990,11 +1990,14 @@ static int ath10k_core_probe_fw(struct a
  11620. + "could not load pre cal data: %d\n", ret);
  11621. + }
  11622. +
  11623. +- ret = ath10k_core_get_board_id_from_otp(ar);
  11624. +- if (ret && ret != -EOPNOTSUPP) {
  11625. +- ath10k_err(ar, "failed to get board id from otp: %d\n",
  11626. +- ret);
  11627. +- goto err_free_firmware_files;
  11628. ++ /* otp and board file not needed if calibration data is present */
  11629. ++ if (calret) {
  11630. ++ ret = ath10k_core_get_board_id_from_otp(ar);
  11631. ++ if (ret && ret != -EOPNOTSUPP) {
  11632. ++ ath10k_err(ar, "failed to get board id from otp: %d\n",
  11633. ++ ret);
  11634. ++ goto err_free_firmware_files;
  11635. ++ }
  11636. + }
  11637. +
  11638. + ret = ath10k_core_fetch_board_file(ar);
  11639. diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile
  11640. index e49dd48..90430b9 100644
  11641. --- a/package/kernel/mt76/Makefile
  11642. +++ b/package/kernel/mt76/Makefile
  11643. @@ -1,7 +1,7 @@
  11644. include $(TOPDIR)/rules.mk
  11645. PKG_NAME:=mt76
  11646. -PKG_VERSION:=2016-03-03
  11647. +PKG_VERSION:=2016-07-08
  11648. PKG_RELEASE=1
  11649. PKG_LICENSE:=GPLv2
  11650. @@ -10,23 +10,26 @@ PKG_LICENSE_FILES:=
  11651. PKG_SOURCE_URL:=https://github.com/openwrt/mt76
  11652. PKG_SOURCE_PROTO:=git
  11653. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  11654. -PKG_SOURCE_VERSION:=310d420178c86e253a172413da30ecf479b64251
  11655. +PKG_SOURCE_VERSION:=9226e96c40e9ae19996a262365ce764f7b0b9c4a
  11656. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
  11657. -PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  11658. +PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  11659. PKG_BUILD_PARALLEL:=1
  11660. +STAMP_CONFIGURED_DEPENDS := $(STAGING_DIR)/usr/include/mac80211-backport/backport/autoconf.h
  11661. +
  11662. include $(INCLUDE_DIR)/kernel.mk
  11663. include $(INCLUDE_DIR)/package.mk
  11664. define KernelPackage/mt76
  11665. SUBMENU:=Wireless Drivers
  11666. - TITLE:=MediaTek MT76x2 wireless driver
  11667. - DEPENDS:=+kmod-mac80211 +@DRIVER_11N_SUPPORT @PCI_SUPPORT
  11668. + TITLE:=MediaTek MT76x2/MT7603 wireless driver
  11669. + DEPENDS:=+kmod-mac80211 +@DRIVER_11N_SUPPORT @PCI_SUPPORT @!LINUX_3_18
  11670. FILES:=\
  11671. $(PKG_BUILD_DIR)/mt76.ko \
  11672. - $(PKG_BUILD_DIR)/mt76x2e.ko
  11673. - AUTOLOAD:=$(call AutoLoad,50,mac80211 mt76 mt76x2e)
  11674. + $(PKG_BUILD_DIR)/mt76x2e.ko \
  11675. + $(PKG_BUILD_DIR)/mt7603e.ko
  11676. + AUTOLOAD:=$(call AutoLoad,50,mac80211 mt76 mt76x2e mt7603e)
  11677. endef
  11678. NOSTDINC_FLAGS = \
  11679. @@ -54,6 +57,12 @@ endef
  11680. define KernelPackage/mt76/install
  11681. $(INSTALL_DIR) $(1)/lib/firmware
  11682. cp \
  11683. + $(if $(CONFIG_TARGET_ramips_mt7628) || $(CONFIG_TARGET_ramips_mt7688), \
  11684. + $(PKG_BUILD_DIR)/firmware/mt7628_e1.bin \
  11685. + $(PKG_BUILD_DIR)/firmware/mt7628_e2.bin \
  11686. + ) \
  11687. + $(PKG_BUILD_DIR)/firmware/mt7603_e1.bin \
  11688. + $(PKG_BUILD_DIR)/firmware/mt7603_e2.bin \
  11689. $(PKG_BUILD_DIR)/firmware/mt7662_rom_patch.bin \
  11690. $(PKG_BUILD_DIR)/firmware/mt7662.bin \
  11691. $(1)/lib/firmware
  11692. diff --git a/package/kernel/mwlwifi/Makefile b/package/kernel/mwlwifi/Makefile
  11693. index 091928d..880803e 100644
  11694. --- a/package/kernel/mwlwifi/Makefile
  11695. +++ b/package/kernel/mwlwifi/Makefile
  11696. @@ -8,7 +8,7 @@
  11697. include $(TOPDIR)/rules.mk
  11698. PKG_NAME:=mwlwifi
  11699. -PKG_VERSION:=10.3.0.16-20160105
  11700. +PKG_VERSION:=10.3.0.17-20160617
  11701. PKG_RELEASE=1
  11702. PKG_LICENSE:=ISC
  11703. @@ -17,7 +17,7 @@ PKG_LICENSE_FILES:=
  11704. PKG_SOURCE_URL:=https://github.com/kaloz/mwlwifi
  11705. PKG_SOURCE_PROTO:=git
  11706. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  11707. -PKG_SOURCE_VERSION:=99d3879cc72f2a25d44fb4bee96fd84eca028b04
  11708. +PKG_SOURCE_VERSION:=b7aff3c2839b048407d716d1cb9326122ee401f8
  11709. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
  11710. PKG_MAINTAINER:=Imre Kaloz <kaloz@openwrt.org>
  11711. diff --git a/package/kernel/mwlwifi/patches/100-drop_old_api.patch b/package/kernel/mwlwifi/patches/100-drop_old_api.patch
  11712. deleted file mode 100644
  11713. index d2e149e..0000000
  11714. --- a/package/kernel/mwlwifi/patches/100-drop_old_api.patch
  11715. +++ /dev/null
  11716. @@ -1,92 +0,0 @@
  11717. ---- a/main.c
  11718. -+++ b/main.c
  11719. -@@ -418,11 +418,7 @@ static void mwl_set_ht_caps(struct mwl_p
  11720. - band->ht_cap.cap |= IEEE80211_HT_CAP_SGI_20;
  11721. - band->ht_cap.cap |= IEEE80211_HT_CAP_SGI_40;
  11722. -
  11723. --#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
  11724. -- hw->flags |= IEEE80211_HW_AMPDU_AGGREGATION;
  11725. --#else
  11726. - ieee80211_hw_set(hw, AMPDU_AGGREGATION);
  11727. --#endif
  11728. - band->ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K;
  11729. - band->ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_4;
  11730. -
  11731. -@@ -524,29 +520,16 @@ static int mwl_wl_init(struct mwl_priv *
  11732. - hw->queues = SYSADPT_TX_WMM_QUEUES;
  11733. -
  11734. - /* Set rssi values to dBm */
  11735. --#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
  11736. -- hw->flags |= IEEE80211_HW_SIGNAL_DBM | IEEE80211_HW_HAS_RATE_CONTROL;
  11737. --#else
  11738. - ieee80211_hw_set(hw, SIGNAL_DBM);
  11739. - ieee80211_hw_set(hw, HAS_RATE_CONTROL);
  11740. --#endif
  11741. -
  11742. - /* Ask mac80211 not to trigger PS mode
  11743. - * based on PM bit of incoming frames.
  11744. - */
  11745. --#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
  11746. -- hw->flags |= IEEE80211_HW_AP_LINK_PS;
  11747. --#else
  11748. - ieee80211_hw_set(hw, AP_LINK_PS);
  11749. --#endif
  11750. -
  11751. --#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
  11752. -- hw->flags |= IEEE80211_HW_SUPPORTS_PER_STA_GTK |
  11753. -- IEEE80211_HW_MFP_CAPABLE;
  11754. --#else
  11755. - ieee80211_hw_set(hw, SUPPORTS_PER_STA_GTK);
  11756. - ieee80211_hw_set(hw, MFP_CAPABLE);
  11757. --#endif
  11758. -
  11759. - hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
  11760. -
  11761. ---- a/dev.h
  11762. -+++ b/dev.h
  11763. -@@ -484,10 +484,6 @@ static inline struct mwl_sta *mwl_dev_ge
  11764. - return (struct mwl_sta *)&sta->drv_priv;
  11765. - }
  11766. -
  11767. --#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)
  11768. --#define ether_addr_copy(dst, src) memcpy(dst, src, ETH_ALEN)
  11769. --#endif
  11770. --
  11771. - /* Defined in mac80211.c. */
  11772. - extern const struct ieee80211_ops mwl_mac80211_ops;
  11773. -
  11774. ---- a/mac80211.c
  11775. -+++ b/mac80211.c
  11776. -@@ -572,19 +572,11 @@ static int mwl_mac80211_get_survey(struc
  11777. - return 0;
  11778. - }
  11779. -
  11780. --#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0)
  11781. --static int mwl_mac80211_ampdu_action(struct ieee80211_hw *hw,
  11782. -- struct ieee80211_vif *vif,
  11783. -- enum ieee80211_ampdu_mlme_action action,
  11784. -- struct ieee80211_sta *sta,
  11785. -- u16 tid, u16 *ssn, u8 buf_size)
  11786. --#else
  11787. - static int mwl_mac80211_ampdu_action(struct ieee80211_hw *hw,
  11788. - struct ieee80211_vif *vif,
  11789. - enum ieee80211_ampdu_mlme_action action,
  11790. - struct ieee80211_sta *sta,
  11791. - u16 tid, u16 *ssn, u8 buf_size, bool amsdu)
  11792. --#endif
  11793. - {
  11794. - int rc = 0;
  11795. - struct mwl_priv *priv = hw->priv;
  11796. ---- a/rx.c
  11797. -+++ b/rx.c
  11798. -@@ -232,10 +232,8 @@ static inline void mwl_rx_prepare_status
  11799. - status->flag |= RX_FLAG_VHT;
  11800. - if (bw == RX_RATE_INFO_HT40)
  11801. - status->flag |= RX_FLAG_40MHZ;
  11802. --#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 18, 0)
  11803. - if (bw == RX_RATE_INFO_HT80)
  11804. - status->vht_flag |= RX_VHT_FLAG_80MHZ;
  11805. --#endif
  11806. - if (gi == RX_RATE_INFO_SHORT_INTERVAL)
  11807. - status->flag |= RX_FLAG_SHORT_GI;
  11808. - status->vht_nss = (nss + 1);
  11809. diff --git a/package/kernel/mwlwifi/patches/110-api_sync.patch b/package/kernel/mwlwifi/patches/110-api_sync.patch
  11810. deleted file mode 100644
  11811. index ed3e06a..0000000
  11812. --- a/package/kernel/mwlwifi/patches/110-api_sync.patch
  11813. +++ /dev/null
  11814. @@ -1,19 +0,0 @@
  11815. ---- a/mac80211.c
  11816. -+++ b/mac80211.c
  11817. -@@ -597,10 +597,13 @@ static int mwl_mac80211_get_survey(struc
  11818. -
  11819. - static int mwl_mac80211_ampdu_action(struct ieee80211_hw *hw,
  11820. - struct ieee80211_vif *vif,
  11821. -- enum ieee80211_ampdu_mlme_action action,
  11822. -- struct ieee80211_sta *sta,
  11823. -- u16 tid, u16 *ssn, u8 buf_size, bool amsdu)
  11824. -+ struct ieee80211_ampdu_params *params)
  11825. - {
  11826. -+ enum ieee80211_ampdu_mlme_action action = params->action;
  11827. -+ struct ieee80211_sta *sta = params->sta;
  11828. -+ u16 tid = params->tid;
  11829. -+ u16 *ssn = &params->ssn;
  11830. -+ u8 buf_size = params->buf_size;
  11831. - int rc = 0;
  11832. - struct mwl_priv *priv = hw->priv;
  11833. - struct mwl_ampdu_stream *stream;
  11834. diff --git a/package/network/services/hostapd/Config.in b/package/network/services/hostapd/Config.in
  11835. index aee2a15..645888e 100644
  11836. --- a/package/network/services/hostapd/Config.in
  11837. +++ b/package/network/services/hostapd/Config.in
  11838. @@ -10,11 +10,10 @@ config WPA_SUPPLICANT_NO_TIMESTAMP_CHECK
  11839. choice
  11840. prompt "Choose TLS provider"
  11841. default WPA_SUPPLICANT_INTERNAL
  11842. - depends on PACKAGE_wpa-supplicant || PACKAGE_wpa-supplicant-mesh || PACKAGE_wpad || PACKAGE_wpad-mesh
  11843. + depends on PACKAGE_wpa-supplicant || PACKAGE_wpad
  11844. config WPA_SUPPLICANT_INTERNAL
  11845. bool "internal"
  11846. - depends on PACKAGE_wpa-supplicant || PACKAGE_wpad
  11847. config WPA_SUPPLICANT_OPENSSL
  11848. bool "openssl"
  11849. diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile
  11850. index 8e706dc..88f7627 100644
  11851. --- a/package/network/services/hostapd/Makefile
  11852. +++ b/package/network/services/hostapd/Makefile
  11853. @@ -7,18 +7,18 @@
  11854. include $(TOPDIR)/rules.mk
  11855. PKG_NAME:=hostapd
  11856. -PKG_VERSION:=2015-03-25
  11857. +PKG_VERSION:=2016-06-15
  11858. PKG_RELEASE:=1
  11859. -PKG_REV:=8278138e679174b1ec8af7f169c2810a8888e202
  11860. +PKG_REV:=31d3692fe5d56c05753ed4a70c7943979e1d29e7
  11861. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
  11862. -PKG_SOURCE_URL:=git://w1.fi/srv/git/hostap.git
  11863. +PKG_SOURCE_URL:=http://w1.fi/hostap.git
  11864. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  11865. PKG_SOURCE_VERSION:=$(PKG_REV)
  11866. PKG_SOURCE_PROTO:=git
  11867. # PKG_MIRROR_MD5SUM:=4e7c1f97edd7514535056fce54ae053a
  11868. -PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  11869. +PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  11870. PKG_LICENSE:=BSD-3-Clause
  11871. PKG_BUILD_PARALLEL:=1
  11872. @@ -40,6 +40,10 @@ LOCAL_TYPE=$(strip \
  11873. hostapd \
  11874. )))
  11875. LOCAL_VARIANT=$(patsubst wpad-%,%,$(patsubst supplicant-%,%,$(BUILD_VARIANT)))
  11876. +CONFIG_VARIANT:=$(LOCAL_VARIANT)
  11877. +ifeq ($(LOCAL_VARIANT),mesh)
  11878. + CONFIG_VARIANT:=full
  11879. +endif
  11880. ifeq ($(LOCAL_TYPE),supplicant)
  11881. ifeq ($(LOCAL_VARIANT),full)
  11882. @@ -47,10 +51,6 @@ ifeq ($(LOCAL_TYPE),supplicant)
  11883. CONFIG_WPA_SUPPLICANT_INTERNAL \
  11884. CONFIG_WPA_SUPPLICANT_OPENSSL
  11885. endif
  11886. - ifeq ($(LOCAL_VARIANT),mesh)
  11887. - PKG_CONFIG_DEPENDS += \
  11888. - CONFIG_WPA_SUPPLICANT_OPENSSL
  11889. - endif
  11890. endif
  11891. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
  11892. @@ -82,7 +82,7 @@ ifneq ($(LOCAL_TYPE),hostapd)
  11893. endif
  11894. endif
  11895. ifeq ($(LOCAL_VARIANT),mesh)
  11896. - DRIVER_MAKEOPTS += CONFIG_TLS=openssl
  11897. + DRIVER_MAKEOPTS += CONFIG_TLS=openssl CONFIG_AP=y CONFIG_SAE=y CONFIG_MESH=y
  11898. TARGET_LDFLAGS += -lcrypto -lssl
  11899. endif
  11900. ifdef CONFIG_WPA_SUPPLICANT_NO_TIMESTAMP_CHECK
  11901. @@ -177,8 +177,7 @@ endef
  11902. define Package/wpad-mesh
  11903. $(call Package/wpad/Default)
  11904. TITLE+= (with 802.11s mesh and SAE support)
  11905. - DEPENDS:=$(DRV_DEPENDS) +libubus +libopenssl +@CONFIG_WPA_SUPPLICANT_OPENSSL @(!TARGET_uml||BROKEN)
  11906. - CONFLICTS:=@WPA_SUPPLICANT_INTERNAL
  11907. + DEPENDS:=$(DRV_DEPENDS) +libubus +PACKAGE_wpad-mesh:libopenssl @(!TARGET_uml||BROKEN)
  11908. VARIANT:=wpad-mesh
  11909. endef
  11910. @@ -284,10 +283,10 @@ endif
  11911. define Build/Configure
  11912. $(Build/Configure/rebuild)
  11913. - $(if $(wildcard ./files/hostapd-$(LOCAL_VARIANT).config), \
  11914. - $(CP) ./files/hostapd-$(LOCAL_VARIANT).config $(PKG_BUILD_DIR)/hostapd/.config \
  11915. + $(if $(wildcard ./files/hostapd-$(CONFIG_VARIANT).config), \
  11916. + $(CP) ./files/hostapd-$(CONFIG_VARIANT).config $(PKG_BUILD_DIR)/hostapd/.config \
  11917. )
  11918. - $(CP) ./files/wpa_supplicant-$(LOCAL_VARIANT).config $(PKG_BUILD_DIR)/wpa_supplicant/.config
  11919. + $(CP) ./files/wpa_supplicant-$(CONFIG_VARIANT).config $(PKG_BUILD_DIR)/wpa_supplicant/.config
  11920. endef
  11921. TARGET_CPPFLAGS := \
  11922. diff --git a/package/network/services/hostapd/files/hostapd-full.config b/package/network/services/hostapd/files/hostapd-full.config
  11923. index f1b2655..681e9df 100644
  11924. --- a/package/network/services/hostapd/files/hostapd-full.config
  11925. +++ b/package/network/services/hostapd/files/hostapd-full.config
  11926. @@ -53,6 +53,9 @@ CONFIG_PEERKEY=y
  11927. # Integrated EAP server
  11928. CONFIG_EAP=y
  11929. +# EAP-FAST for the integrated EAP server
  11930. +CONFIG_EAP_FAST=y
  11931. +
  11932. # EAP-MD5 for the integrated EAP server
  11933. CONFIG_EAP_MD5=y
  11934. diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh
  11935. index 7aec7ad..9c1ba0f 100644
  11936. --- a/package/network/services/hostapd/files/hostapd.sh
  11937. +++ b/package/network/services/hostapd/files/hostapd.sh
  11938. @@ -1,3 +1,5 @@
  11939. +. /lib/functions/network.sh
  11940. +
  11941. hostapd_set_bss_options() {
  11942. local var="$1"
  11943. local vif="$2"
  11944. @@ -193,8 +195,8 @@ hostapd_set_bss_options() {
  11945. [ -n "$wps_possible" -a -n "$config_methods" ] && {
  11946. config_get device_type "$vif" wps_device_type "6-0050F204-1"
  11947. - config_get device_name "$vif" wps_device_name "OpenWrt AP"
  11948. - config_get manufacturer "$vif" wps_manufacturer "openwrt.org"
  11949. + config_get device_name "$vif" wps_device_name "Lede AP"
  11950. + config_get manufacturer "$vif" wps_manufacturer "www.lede-project.org"
  11951. config_get wps_pin "$vif" wps_pin
  11952. config_get_bool ext_registrar "$vif" ext_registrar 0
  11953. @@ -213,7 +215,11 @@ hostapd_set_bss_options() {
  11954. append "$var" "ssid=$ssid" "$N"
  11955. [ -n "$bridge" ] && append "$var" "bridge=$bridge" "$N"
  11956. [ -n "$ieee80211d" ] && append "$var" "ieee80211d=$ieee80211d" "$N"
  11957. - [ -n "$iapp_interface" ] && append "$var" iapp_interface=$(uci_get_state network "$iapp_interface" ifname "$iapp_interface") "$N"
  11958. + [ -n "$iapp_interface" ] && {
  11959. + local ifname
  11960. + network_get_device ifname "$iapp_interface" || ifname = "$iapp_interface"
  11961. + append bss_conf "iapp_interface=$ifname" "$N"
  11962. + }
  11963. if [ "$wpa" -ge "1" ]
  11964. then
  11965. @@ -391,4 +397,3 @@ $hostapd_cfg
  11966. EOF
  11967. hostapd -P /var/run/wifi-$ifname.pid -B /var/run/hostapd-$ifname.conf
  11968. }
  11969. -
  11970. diff --git a/package/network/services/hostapd/files/netifd.sh b/package/network/services/hostapd/files/netifd.sh
  11971. index 23d2e7e..af72e7a 100644
  11972. --- a/package/network/services/hostapd/files/netifd.sh
  11973. +++ b/package/network/services/hostapd/files/netifd.sh
  11974. @@ -1,3 +1,5 @@
  11975. +. /lib/functions/network.sh
  11976. +
  11977. wpa_supplicant_add_rate() {
  11978. local var="$1"
  11979. local val="$(($2 / 1000))"
  11980. @@ -120,6 +122,7 @@ hostapd_common_add_bss_config() {
  11981. config_add_boolean rsn_preauth auth_cache
  11982. config_add_int ieee80211w
  11983. + config_add_int eapol_version
  11984. config_add_string 'auth_server:host' 'server:host'
  11985. config_add_string auth_secret
  11986. @@ -136,10 +139,11 @@ hostapd_common_add_bss_config() {
  11987. config_add_string nasid
  11988. config_add_string ownip
  11989. config_add_string iapp_interface
  11990. - config_add_string eap_type ca_cert client_cert identity auth priv_key priv_key_pwd
  11991. + config_add_string eap_type ca_cert client_cert identity anonymous_identity auth priv_key priv_key_pwd
  11992. config_add_int dynamic_vlan vlan_naming
  11993. config_add_string vlan_tagged_interface vlan_bridge
  11994. + config_add_string vlan_file
  11995. config_add_string 'key1:wepkey' 'key2:wepkey' 'key3:wepkey' 'key4:wepkey' 'password:wpakey'
  11996. @@ -182,7 +186,7 @@ hostapd_set_bss_options() {
  11997. wps_pushbutton wps_label ext_registrar wps_pbc_in_m1 \
  11998. wps_device_type wps_device_name wps_manufacturer wps_pin \
  11999. macfilter ssid wmm uapsd hidden short_preamble rsn_preauth \
  12000. - iapp_interface
  12001. + iapp_interface eapol_version
  12002. set_default isolate 0
  12003. set_default maxassoc 0
  12004. @@ -192,6 +196,7 @@ hostapd_set_bss_options() {
  12005. set_default hidden 0
  12006. set_default wmm 1
  12007. set_default uapsd 1
  12008. + set_default eapol_version 0
  12009. append bss_conf "ctrl_interface=/var/run/hostapd"
  12010. if [ "$isolate" -gt 0 ]; then
  12011. @@ -237,6 +242,8 @@ hostapd_set_bss_options() {
  12012. [ -e "$wpa_psk_file" ] || touch "$wpa_psk_file"
  12013. append bss_conf "wpa_psk_file=$wpa_psk_file" "$N"
  12014. }
  12015. + [ "$eapol_version" -ge "1" -a "$eapol_version" -le "2" ] && append bss_conf "eapol_version=$eapol_version" "$N"
  12016. +
  12017. wps_possible=1
  12018. append wpa_key_mgmt "WPA-PSK"
  12019. ;;
  12020. @@ -248,7 +255,7 @@ hostapd_set_bss_options() {
  12021. ownip \
  12022. eap_reauth_period dynamic_vlan \
  12023. vlan_naming vlan_tagged_interface \
  12024. - vlan_bridge
  12025. + vlan_bridge vlan_file
  12026. # legacy compatibility
  12027. [ -n "$auth_server" ] || json_get_var auth_server server
  12028. @@ -291,7 +298,13 @@ hostapd_set_bss_options() {
  12029. append bss_conf "vlan_bridge=$vlan_bridge" "$N"
  12030. [ -n "$vlan_tagged_interface" ] && \
  12031. append bss_conf "vlan_tagged_interface=$vlan_tagged_interface" "$N"
  12032. + [ -n "$vlan_file" ] && {
  12033. + [ -e "$vlan_file" ] || touch "$vlan_file"
  12034. + append bss_conf "vlan_file=$vlan_file" "$N"
  12035. + }
  12036. }
  12037. +
  12038. + [ "$eapol_version" -ge "1" -a "$eapol_version" -le "2" ] && append bss_conf "eapol_version=$eapol_version" "$N"
  12039. ;;
  12040. wep)
  12041. local wep_keyidx=0
  12042. @@ -318,8 +331,8 @@ hostapd_set_bss_options() {
  12043. [ -n "$wps_possible" -a -n "$config_methods" ] && {
  12044. set_default ext_registrar 0
  12045. set_default wps_device_type "6-0050F204-1"
  12046. - set_default wps_device_name "OpenWrt AP"
  12047. - set_default wps_manufacturer "openwrt.org"
  12048. + set_default wps_device_name "Lede AP"
  12049. + set_default wps_manufacturer "www.lede-project.org"
  12050. wps_state=2
  12051. [ -n "$wps_configured" ] && wps_state=1
  12052. @@ -340,8 +353,9 @@ hostapd_set_bss_options() {
  12053. append bss_conf "ssid=$ssid" "$N"
  12054. [ -n "$network_bridge" ] && append bss_conf "bridge=$network_bridge" "$N"
  12055. [ -n "$iapp_interface" ] && {
  12056. - iapp_interface="$(uci_get_state network "$iapp_interface" ifname "$iapp_interface")"
  12057. - [ -n "$iapp_interface" ] && append bss_conf "iapp_interface=$iapp_interface" "$N"
  12058. + local ifname
  12059. + network_get_device ifname "$iapp_interface" || ifname = "$iapp_interface"
  12060. + append bss_conf "iapp_interface=$ifname" "$N"
  12061. }
  12062. if [ "$wpa" -ge "1" ]; then
  12063. @@ -522,9 +536,15 @@ wpa_supplicant_prepare_interface() {
  12064. _w_modestr="mode=1"
  12065. }
  12066. + local country_str=
  12067. + [ -n "$country" ] && {
  12068. + country_str="country=$country"
  12069. + }
  12070. +
  12071. wpa_supplicant_teardown_interface "$ifname"
  12072. cat > "$_config" <<EOF
  12073. $ap_scan
  12074. +$country_str
  12075. EOF
  12076. return 0
  12077. }
  12078. @@ -538,7 +558,9 @@ wpa_supplicant_add_network() {
  12079. json_get_vars \
  12080. ssid bssid key \
  12081. basic_rate mcast_rate \
  12082. - ieee80211w
  12083. + ieee80211w ieee80211r
  12084. +
  12085. + set_default ieee80211r 0
  12086. local key_mgmt='NONE'
  12087. local enc_str=
  12088. @@ -549,6 +571,8 @@ wpa_supplicant_add_network() {
  12089. local scan_ssid="scan_ssid=1"
  12090. local freq
  12091. + [ "$ieee80211r" -gt 0 ] && wpa_key_mgmt="FT-PSK $wpa_key_mgmt"
  12092. +
  12093. [[ "$_w_mode" = "adhoc" ]] && {
  12094. append network_data "mode=1" "$N$T"
  12095. [ -n "$channel" ] && {
  12096. @@ -563,6 +587,9 @@ wpa_supplicant_add_network() {
  12097. }
  12098. [[ "$_w_mode" = "mesh" ]] && {
  12099. + json_get_vars mesh_id
  12100. + ssid="${mesh_id}"
  12101. +
  12102. append network_data "mode=5" "$N$T"
  12103. [ -n "$channel" ] && {
  12104. freq="$(get_freq "$phy" "$channel")"
  12105. @@ -594,10 +621,12 @@ wpa_supplicant_add_network() {
  12106. ;;
  12107. eap)
  12108. key_mgmt='WPA-EAP'
  12109. + [ "$ieee80211r" -gt 0 ] && key_mgmt="FT-EAP $key_mgmt"
  12110. - json_get_vars eap_type identity ca_cert
  12111. + json_get_vars eap_type identity anonymous_identity ca_cert
  12112. [ -n "$ca_cert" ] && append network_data "ca_cert=\"$ca_cert\"" "$N$T"
  12113. [ -n "$identity" ] && append network_data "identity=\"$identity\"" "$N$T"
  12114. + [ -n "$anonymous_identity" ] && append network_data "anonymous_identity=\"$anonymous_identity\"" "$N$T"
  12115. case "$eap_type" in
  12116. tls)
  12117. json_get_vars client_cert priv_key priv_key_pwd
  12118. @@ -605,11 +634,32 @@ wpa_supplicant_add_network() {
  12119. append network_data "private_key=\"$priv_key\"" "$N$T"
  12120. append network_data "private_key_passwd=\"$priv_key_pwd\"" "$N$T"
  12121. ;;
  12122. - peap|ttls)
  12123. - json_get_vars auth password
  12124. + fast|peap|ttls)
  12125. + json_get_vars auth password ca_cert2 client_cert2 priv_key2 priv_key2_pwd
  12126. set_default auth MSCHAPV2
  12127. - append network_data "phase2=\"$auth\"" "$N$T"
  12128. - append network_data "password=\"$password\"" "$N$T"
  12129. +
  12130. + if [ "$auth" = "EAP-TLS" ]; then
  12131. + [ -n "$ca_cert2" ] &&
  12132. + append network_data "ca_cert2=\"$ca_cert2\"" "$N$T"
  12133. + append network_data "client_cert2=\"$client_cert2\"" "$N$T"
  12134. + append network_data "private_key2=\"$priv_key2\"" "$N$T"
  12135. + append network_data "private_key2_passwd=\"$priv_key2_pwd\"" "$N$T"
  12136. + else
  12137. + append network_data "password=\"$password\"" "$N$T"
  12138. + fi
  12139. +
  12140. + phase2proto="auth="
  12141. + case "$auth" in
  12142. + "auth"*)
  12143. + phase2proto=""
  12144. + ;;
  12145. + "EAP-"*)
  12146. + auth="$(echo $auth | cut -b 5- )"
  12147. + [ "$eap_type" = "ttls" ] &&
  12148. + phase2proto="autheap="
  12149. + ;;
  12150. + esac
  12151. + append network_data "phase2=\"$phase2proto$auth\"" "$N$T"
  12152. ;;
  12153. esac
  12154. append network_data "eap=$(echo $eap_type | tr 'a-z' 'A-Z')" "$N$T"
  12155. diff --git a/package/network/services/hostapd/files/wpa_supplicant-full.config b/package/network/services/hostapd/files/wpa_supplicant-full.config
  12156. index a9d04ab..53c0762 100644
  12157. --- a/package/network/services/hostapd/files/wpa_supplicant-full.config
  12158. +++ b/package/network/services/hostapd/files/wpa_supplicant-full.config
  12159. @@ -121,6 +121,9 @@ CONFIG_DRIVER_WIRED=y
  12160. # included)
  12161. CONFIG_IEEE8021X_EAPOL=y
  12162. +# EAP-FAST
  12163. +CONFIG_EAP_FAST=y
  12164. +
  12165. # EAP-MD5
  12166. CONFIG_EAP_MD5=y
  12167. @@ -367,7 +370,7 @@ CONFIG_INTERNAL_LIBTOMMATH_FAST=y
  12168. #CONFIG_DYNAMIC_EAP_METHODS=y
  12169. # IEEE Std 802.11r-2008 (Fast BSS Transition)
  12170. -#CONFIG_IEEE80211R=y
  12171. +CONFIG_IEEE80211R=y
  12172. # Add support for writing debug log to a file (/tmp/wpa_supplicant-log-#.txt)
  12173. #CONFIG_DEBUG_FILE=y
  12174. diff --git a/package/network/services/hostapd/files/wpa_supplicant-mesh.config b/package/network/services/hostapd/files/wpa_supplicant-mesh.config
  12175. deleted file mode 100644
  12176. index 36e2908..0000000
  12177. --- a/package/network/services/hostapd/files/wpa_supplicant-mesh.config
  12178. +++ /dev/null
  12179. @@ -1,407 +0,0 @@
  12180. -# Example wpa_supplicant build time configuration
  12181. -#
  12182. -# This file lists the configuration options that are used when building the
  12183. -# hostapd binary. All lines starting with # are ignored. Configuration option
  12184. -# lines must be commented out complete, if they are not to be included, i.e.,
  12185. -# just setting VARIABLE=n is not disabling that variable.
  12186. -#
  12187. -# This file is included in Makefile, so variables like CFLAGS and LIBS can also
  12188. -# be modified from here. In most cases, these lines should use += in order not
  12189. -# to override previous values of the variables.
  12190. -
  12191. -
  12192. -# Uncomment following two lines and fix the paths if you have installed OpenSSL
  12193. -# or GnuTLS in non-default location
  12194. -#CFLAGS += -I/usr/local/openssl/include
  12195. -#LIBS += -L/usr/local/openssl/lib
  12196. -
  12197. -# Some Red Hat versions seem to include kerberos header files from OpenSSL, but
  12198. -# the kerberos files are not in the default include path. Following line can be
  12199. -# used to fix build issues on such systems (krb5.h not found).
  12200. -#CFLAGS += -I/usr/include/kerberos
  12201. -
  12202. -# Example configuration for various cross-compilation platforms
  12203. -
  12204. -#### sveasoft (e.g., for Linksys WRT54G) ######################################
  12205. -#CC=mipsel-uclibc-gcc
  12206. -#CC=/opt/brcm/hndtools-mipsel-uclibc/bin/mipsel-uclibc-gcc
  12207. -#CFLAGS += -Os
  12208. -#CPPFLAGS += -I../src/include -I../../src/router/openssl/include
  12209. -#LIBS += -L/opt/brcm/hndtools-mipsel-uclibc-0.9.19/lib -lssl
  12210. -###############################################################################
  12211. -
  12212. -#### openwrt (e.g., for Linksys WRT54G) #######################################
  12213. -#CC=mipsel-uclibc-gcc
  12214. -#CC=/opt/brcm/hndtools-mipsel-uclibc/bin/mipsel-uclibc-gcc
  12215. -#CFLAGS += -Os
  12216. -#CPPFLAGS=-I../src/include -I../openssl-0.9.7d/include \
  12217. -# -I../WRT54GS/release/src/include
  12218. -#LIBS = -lssl
  12219. -###############################################################################
  12220. -
  12221. -
  12222. -# Driver interface for Host AP driver
  12223. -CONFIG_DRIVER_HOSTAP=y
  12224. -
  12225. -# Driver interface for Agere driver
  12226. -#CONFIG_DRIVER_HERMES=y
  12227. -# Change include directories to match with the local setup
  12228. -#CFLAGS += -I../../hcf -I../../include -I../../include/hcf
  12229. -#CFLAGS += -I../../include/wireless
  12230. -
  12231. -# Driver interface for ndiswrapper
  12232. -# Deprecated; use CONFIG_DRIVER_WEXT=y instead.
  12233. -#CONFIG_DRIVER_NDISWRAPPER=y
  12234. -
  12235. -# Driver interface for Atmel driver
  12236. -# CONFIG_DRIVER_ATMEL=y
  12237. -
  12238. -# Driver interface for old Broadcom driver
  12239. -# Please note that the newer Broadcom driver ("hybrid Linux driver") supports
  12240. -# Linux wireless extensions and does not need (or even work) with the old
  12241. -# driver wrapper. Use CONFIG_DRIVER_WEXT=y with that driver.
  12242. -#CONFIG_DRIVER_BROADCOM=y
  12243. -# Example path for wlioctl.h; change to match your configuration
  12244. -#CFLAGS += -I/opt/WRT54GS/release/src/include
  12245. -
  12246. -# Driver interface for Intel ipw2100/2200 driver
  12247. -# Deprecated; use CONFIG_DRIVER_WEXT=y instead.
  12248. -#CONFIG_DRIVER_IPW=y
  12249. -
  12250. -# Driver interface for Ralink driver
  12251. -#CONFIG_DRIVER_RALINK=y
  12252. -
  12253. -# Driver interface for generic Linux wireless extensions
  12254. -CONFIG_DRIVER_WEXT=y
  12255. -
  12256. -# Driver interface for Linux drivers using the nl80211 kernel interface
  12257. -CONFIG_DRIVER_NL80211=y
  12258. -
  12259. -# Driver interface for FreeBSD net80211 layer (e.g., Atheros driver)
  12260. -#CONFIG_DRIVER_BSD=y
  12261. -#CFLAGS += -I/usr/local/include
  12262. -#LIBS += -L/usr/local/lib
  12263. -#LIBS_p += -L/usr/local/lib
  12264. -#LIBS_c += -L/usr/local/lib
  12265. -
  12266. -# Driver interface for Windows NDIS
  12267. -#CONFIG_DRIVER_NDIS=y
  12268. -#CFLAGS += -I/usr/include/w32api/ddk
  12269. -#LIBS += -L/usr/local/lib
  12270. -# For native build using mingw
  12271. -#CONFIG_NATIVE_WINDOWS=y
  12272. -# Additional directories for cross-compilation on Linux host for mingw target
  12273. -#CFLAGS += -I/opt/mingw/mingw32/include/ddk
  12274. -#LIBS += -L/opt/mingw/mingw32/lib
  12275. -#CC=mingw32-gcc
  12276. -# By default, driver_ndis uses WinPcap for low-level operations. This can be
  12277. -# replaced with the following option which replaces WinPcap calls with NDISUIO.
  12278. -# However, this requires that WZC is disabled (net stop wzcsvc) before starting
  12279. -# wpa_supplicant.
  12280. -# CONFIG_USE_NDISUIO=y
  12281. -
  12282. -# Driver interface for development testing
  12283. -#CONFIG_DRIVER_TEST=y
  12284. -
  12285. -# Include client MLME (management frame processing) for test driver
  12286. -# This can be used to test MLME operations in hostapd with the test interface.
  12287. -# space.
  12288. -#CONFIG_CLIENT_MLME=y
  12289. -
  12290. -# Driver interface for wired Ethernet drivers
  12291. -CONFIG_DRIVER_WIRED=y
  12292. -
  12293. -# Driver interface for the Broadcom RoboSwitch family
  12294. -#CONFIG_DRIVER_ROBOSWITCH=y
  12295. -
  12296. -# Driver interface for no driver (e.g., WPS ER only)
  12297. -#CONFIG_DRIVER_NONE=y
  12298. -
  12299. -# Enable IEEE 802.1X Supplicant (automatically included if any EAP method is
  12300. -# included)
  12301. -CONFIG_IEEE8021X_EAPOL=y
  12302. -
  12303. -# EAP-MD5
  12304. -CONFIG_EAP_MD5=y
  12305. -
  12306. -# EAP-MSCHAPv2
  12307. -CONFIG_EAP_MSCHAPV2=y
  12308. -
  12309. -# EAP-TLS
  12310. -CONFIG_EAP_TLS=y
  12311. -
  12312. -# EAL-PEAP
  12313. -CONFIG_EAP_PEAP=y
  12314. -
  12315. -# EAP-TTLS
  12316. -CONFIG_EAP_TTLS=y
  12317. -
  12318. -# EAP-FAST
  12319. -# Note: Default OpenSSL package does not include support for all the
  12320. -# functionality needed for EAP-FAST. If EAP-FAST is enabled with OpenSSL,
  12321. -# the OpenSSL library must be patched (openssl-0.9.8d-tls-extensions.patch)
  12322. -# to add the needed functions.
  12323. -#CONFIG_EAP_FAST=y
  12324. -
  12325. -# EAP-GTC
  12326. -CONFIG_EAP_GTC=y
  12327. -
  12328. -# EAP-OTP
  12329. -CONFIG_EAP_OTP=y
  12330. -
  12331. -# EAP-SIM (enable CONFIG_PCSC, if EAP-SIM is used)
  12332. -#CONFIG_EAP_SIM=y
  12333. -
  12334. -# EAP-PSK (experimental; this is _not_ needed for WPA-PSK)
  12335. -#CONFIG_EAP_PSK=y
  12336. -
  12337. -# EAP-PAX
  12338. -#CONFIG_EAP_PAX=y
  12339. -
  12340. -# LEAP
  12341. -CONFIG_EAP_LEAP=y
  12342. -
  12343. -# EAP-AKA (enable CONFIG_PCSC, if EAP-AKA is used)
  12344. -#CONFIG_EAP_AKA=y
  12345. -
  12346. -# EAP-AKA' (enable CONFIG_PCSC, if EAP-AKA' is used).
  12347. -# This requires CONFIG_EAP_AKA to be enabled, too.
  12348. -#CONFIG_EAP_AKA_PRIME=y
  12349. -
  12350. -# Enable USIM simulator (Milenage) for EAP-AKA
  12351. -#CONFIG_USIM_SIMULATOR=y
  12352. -
  12353. -# EAP-SAKE
  12354. -#CONFIG_EAP_SAKE=y
  12355. -
  12356. -# EAP-GPSK
  12357. -#CONFIG_EAP_GPSK=y
  12358. -# Include support for optional SHA256 cipher suite in EAP-GPSK
  12359. -#CONFIG_EAP_GPSK_SHA256=y
  12360. -
  12361. -# EAP-TNC and related Trusted Network Connect support (experimental)
  12362. -#CONFIG_EAP_TNC=y
  12363. -
  12364. -# Wi-Fi Protected Setup (WPS)
  12365. -CONFIG_WPS=y
  12366. -
  12367. -# EAP-IKEv2
  12368. -#CONFIG_EAP_IKEV2=y
  12369. -
  12370. -# PKCS#12 (PFX) support (used to read private key and certificate file from
  12371. -# a file that usually has extension .p12 or .pfx)
  12372. -CONFIG_PKCS12=y
  12373. -
  12374. -# Smartcard support (i.e., private key on a smartcard), e.g., with openssl
  12375. -# engine.
  12376. -CONFIG_SMARTCARD=y
  12377. -
  12378. -# PC/SC interface for smartcards (USIM, GSM SIM)
  12379. -# Enable this if EAP-SIM or EAP-AKA is included
  12380. -#CONFIG_PCSC=y
  12381. -
  12382. -# Development testing
  12383. -#CONFIG_EAPOL_TEST=y
  12384. -
  12385. -# Select control interface backend for external programs, e.g, wpa_cli:
  12386. -# unix = UNIX domain sockets (default for Linux/*BSD)
  12387. -# udp = UDP sockets using localhost (127.0.0.1)
  12388. -# named_pipe = Windows Named Pipe (default for Windows)
  12389. -# y = use default (backwards compatibility)
  12390. -# If this option is commented out, control interface is not included in the
  12391. -# build.
  12392. -CONFIG_CTRL_IFACE=y
  12393. -
  12394. -# Include support for GNU Readline and History Libraries in wpa_cli.
  12395. -# When building a wpa_cli binary for distribution, please note that these
  12396. -# libraries are licensed under GPL and as such, BSD license may not apply for
  12397. -# the resulting binary.
  12398. -#CONFIG_READLINE=y
  12399. -
  12400. -# Remove debugging code that is printing out debug message to stdout.
  12401. -# This can be used to reduce the size of the wpa_supplicant considerably
  12402. -# if debugging code is not needed. The size reduction can be around 35%
  12403. -# (e.g., 90 kB).
  12404. -#CONFIG_NO_STDOUT_DEBUG=y
  12405. -
  12406. -# Remove WPA support, e.g., for wired-only IEEE 802.1X supplicant, to save
  12407. -# 35-50 kB in code size.
  12408. -#CONFIG_NO_WPA=y
  12409. -
  12410. -# Remove WPA2 support. This allows WPA to be used, but removes WPA2 code to
  12411. -# save about 1 kB in code size when building only WPA-Personal (no EAP support)
  12412. -# or 6 kB if building for WPA-Enterprise.
  12413. -#CONFIG_NO_WPA2=y
  12414. -
  12415. -# Remove IEEE 802.11i/WPA-Personal ASCII passphrase support
  12416. -# This option can be used to reduce code size by removing support for
  12417. -# converting ASCII passphrases into PSK. If this functionality is removed, the
  12418. -# PSK can only be configured as the 64-octet hexstring (e.g., from
  12419. -# wpa_passphrase). This saves about 0.5 kB in code size.
  12420. -#CONFIG_NO_WPA_PASSPHRASE=y
  12421. -
  12422. -# Disable scan result processing (ap_mode=1) to save code size by about 1 kB.
  12423. -# This can be used if ap_scan=1 mode is never enabled.
  12424. -#CONFIG_NO_SCAN_PROCESSING=y
  12425. -
  12426. -# Select configuration backend:
  12427. -# file = text file (e.g., wpa_supplicant.conf; note: the configuration file
  12428. -# path is given on command line, not here; this option is just used to
  12429. -# select the backend that allows configuration files to be used)
  12430. -# winreg = Windows registry (see win_example.reg for an example)
  12431. -CONFIG_BACKEND=file
  12432. -
  12433. -# Remove configuration write functionality (i.e., to allow the configuration
  12434. -# file to be updated based on runtime configuration changes). The runtime
  12435. -# configuration can still be changed, the changes are just not going to be
  12436. -# persistent over restarts. This option can be used to reduce code size by
  12437. -# about 3.5 kB.
  12438. -#CONFIG_NO_CONFIG_WRITE=y
  12439. -
  12440. -# Remove support for configuration blobs to reduce code size by about 1.5 kB.
  12441. -#CONFIG_NO_CONFIG_BLOBS=y
  12442. -
  12443. -# Select program entry point implementation:
  12444. -# main = UNIX/POSIX like main() function (default)
  12445. -# main_winsvc = Windows service (read parameters from registry)
  12446. -# main_none = Very basic example (development use only)
  12447. -#CONFIG_MAIN=main
  12448. -
  12449. -# Select wrapper for operatins system and C library specific functions
  12450. -# unix = UNIX/POSIX like systems (default)
  12451. -# win32 = Windows systems
  12452. -# none = Empty template
  12453. -#CONFIG_OS=unix
  12454. -
  12455. -# Select event loop implementation
  12456. -# eloop = select() loop (default)
  12457. -# eloop_win = Windows events and WaitForMultipleObject() loop
  12458. -# eloop_none = Empty template
  12459. -#CONFIG_ELOOP=eloop
  12460. -
  12461. -# Select layer 2 packet implementation
  12462. -# linux = Linux packet socket (default)
  12463. -# pcap = libpcap/libdnet/WinPcap
  12464. -# freebsd = FreeBSD libpcap
  12465. -# winpcap = WinPcap with receive thread
  12466. -# ndis = Windows NDISUIO (note: requires CONFIG_USE_NDISUIO=y)
  12467. -# none = Empty template
  12468. -#CONFIG_L2_PACKET=linux
  12469. -
  12470. -# PeerKey handshake for Station to Station Link (IEEE 802.11e DLS)
  12471. -CONFIG_PEERKEY=y
  12472. -
  12473. -# IEEE 802.11w (management frame protection)
  12474. -# This version is an experimental implementation based on IEEE 802.11w/D1.0
  12475. -# draft and is subject to change since the standard has not yet been finalized.
  12476. -# Driver support is also needed for IEEE 802.11w.
  12477. -CONFIG_IEEE80211W=y
  12478. -
  12479. -# Select TLS implementation
  12480. -# openssl = OpenSSL (default)
  12481. -# gnutls = GnuTLS (needed for TLS/IA, see also CONFIG_GNUTLS_EXTRA)
  12482. -# internal = Internal TLSv1 implementation (experimental)
  12483. -# none = Empty template
  12484. -CONFIG_TLS=internal
  12485. -
  12486. -# Whether to enable TLS/IA support, which is required for EAP-TTLSv1.
  12487. -# You need CONFIG_TLS=gnutls for this to have any effect. Please note that
  12488. -# even though the core GnuTLS library is released under LGPL, this extra
  12489. -# library uses GPL and as such, the terms of GPL apply to the combination
  12490. -# of wpa_supplicant and GnuTLS if this option is enabled. BSD license may not
  12491. -# apply for distribution of the resulting binary.
  12492. -#CONFIG_GNUTLS_EXTRA=y
  12493. -
  12494. -# If CONFIG_TLS=internal is used, additional library and include paths are
  12495. -# needed for LibTomMath. Alternatively, an integrated, minimal version of
  12496. -# LibTomMath can be used. See beginning of libtommath.c for details on benefits
  12497. -# and drawbacks of this option.
  12498. -CONFIG_INTERNAL_LIBTOMMATH=y
  12499. -#ifndef CONFIG_INTERNAL_LIBTOMMATH
  12500. -#LTM_PATH=/usr/src/libtommath-0.39
  12501. -#CFLAGS += -I$(LTM_PATH)
  12502. -#LIBS += -L$(LTM_PATH)
  12503. -#LIBS_p += -L$(LTM_PATH)
  12504. -#endif
  12505. -# At the cost of about 4 kB of additional binary size, the internal LibTomMath
  12506. -# can be configured to include faster routines for exptmod, sqr, and div to
  12507. -# speed up DH and RSA calculation considerably
  12508. -CONFIG_INTERNAL_LIBTOMMATH_FAST=y
  12509. -
  12510. -# Include NDIS event processing through WMI into wpa_supplicant/wpasvc.
  12511. -# This is only for Windows builds and requires WMI-related header files and
  12512. -# WbemUuid.Lib from Platform SDK even when building with MinGW.
  12513. -#CONFIG_NDIS_EVENTS_INTEGRATED=y
  12514. -#PLATFORMSDKLIB="/opt/Program Files/Microsoft Platform SDK/Lib"
  12515. -
  12516. -# Add support for old DBus control interface
  12517. -# (fi.epitest.hostap.WPASupplicant)
  12518. -#CONFIG_CTRL_IFACE_DBUS=y
  12519. -
  12520. -# Add support for new DBus control interface
  12521. -# (fi.w1.hostap.wpa_supplicant1)
  12522. -#CONFIG_CTRL_IFACE_DBUS_NEW=y
  12523. -
  12524. -# Add introspection support for new DBus control interface
  12525. -#CONFIG_CTRL_IFACE_DBUS_INTRO=y
  12526. -
  12527. -# Add support for loading EAP methods dynamically as shared libraries.
  12528. -# When this option is enabled, each EAP method can be either included
  12529. -# statically (CONFIG_EAP_<method>=y) or dynamically (CONFIG_EAP_<method>=dyn).
  12530. -# Dynamic EAP methods are build as shared objects (eap_*.so) and they need to
  12531. -# be loaded in the beginning of the wpa_supplicant configuration file
  12532. -# (see load_dynamic_eap parameter in the example file) before being used in
  12533. -# the network blocks.
  12534. -#
  12535. -# Note that some shared parts of EAP methods are included in the main program
  12536. -# and in order to be able to use dynamic EAP methods using these parts, the
  12537. -# main program must have been build with the EAP method enabled (=y or =dyn).
  12538. -# This means that EAP-TLS/PEAP/TTLS/FAST cannot be added as dynamic libraries
  12539. -# unless at least one of them was included in the main build to force inclusion
  12540. -# of the shared code. Similarly, at least one of EAP-SIM/AKA must be included
  12541. -# in the main build to be able to load these methods dynamically.
  12542. -#
  12543. -# Please also note that using dynamic libraries will increase the total binary
  12544. -# size. Thus, it may not be the best option for targets that have limited
  12545. -# amount of memory/flash.
  12546. -#CONFIG_DYNAMIC_EAP_METHODS=y
  12547. -
  12548. -# IEEE Std 802.11r-2008 (Fast BSS Transition)
  12549. -#CONFIG_IEEE80211R=y
  12550. -
  12551. -# Add support for writing debug log to a file (/tmp/wpa_supplicant-log-#.txt)
  12552. -#CONFIG_DEBUG_FILE=y
  12553. -
  12554. -# Enable privilege separation (see README 'Privilege separation' for details)
  12555. -#CONFIG_PRIVSEP=y
  12556. -
  12557. -# Enable mitigation against certain attacks against TKIP by delaying Michael
  12558. -# MIC error reports by a random amount of time between 0 and 60 seconds
  12559. -#CONFIG_DELAYED_MIC_ERROR_REPORT=y
  12560. -
  12561. -# Enable tracing code for developer debugging
  12562. -# This tracks use of memory allocations and other registrations and reports
  12563. -# incorrect use with a backtrace of call (or allocation) location.
  12564. -#CONFIG_WPA_TRACE=y
  12565. -# For BSD, comment out these.
  12566. -#LIBS += -lexecinfo
  12567. -#LIBS_p += -lexecinfo
  12568. -#LIBS_c += -lexecinfo
  12569. -
  12570. -# Use libbfd to get more details for developer debugging
  12571. -# This enables use of libbfd to get more detailed symbols for the backtraces
  12572. -# generated by CONFIG_WPA_TRACE=y.
  12573. -#CONFIG_WPA_TRACE_BFD=y
  12574. -# For BSD, comment out these.
  12575. -#LIBS += -lbfd -liberty -lz
  12576. -#LIBS_p += -lbfd -liberty -lz
  12577. -#LIBS_c += -lbfd -liberty -lz
  12578. -
  12579. -CONFIG_NO_RANDOM_POOL=y
  12580. -NEED_80211_COMMON=y
  12581. -
  12582. -CONFIG_IBSS_RSN=y
  12583. -
  12584. -CONFIG_MESH=y
  12585. -CONFIG_SAE=y
  12586. -CONFIG_AP=y
  12587. 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
  12588. new file mode 100644
  12589. index 0000000..5c8b662
  12590. --- /dev/null
  12591. +++ b/package/network/services/hostapd/patches/001-4addr-fix-reconnecting-client-on-connection-lost.patch
  12592. @@ -0,0 +1,25 @@
  12593. +From: Matthias May <matthias.may@neratec.com>
  12594. +Date: Tue, 5 Jul 2016 15:00:43 +0200
  12595. +Subject: [PATCH] 4addr: fix reconnecting client on connection lost
  12596. +
  12597. +When a 4addr client suddenly looses its connection (no deauth/deassoc)
  12598. +the AP still thinks it is connected.
  12599. +If the client reconnects before the AP timeoutes the client, traffic
  12600. +cannot flow.
  12601. +
  12602. +Fix this by making sure the WLAN_STA_WDS flag is unset in the sta->flags
  12603. +when the client completes association.
  12604. +
  12605. +Signed-off-by: Matthias May <matthias.may@neratec.com>
  12606. +---
  12607. +
  12608. +--- a/src/ap/ieee802_11.c
  12609. ++++ b/src/ap/ieee802_11.c
  12610. +@@ -2826,6 +2826,7 @@ static void handle_assoc_cb(struct hosta
  12611. + new_assoc = 0;
  12612. + sta->flags |= WLAN_STA_ASSOC;
  12613. + sta->flags &= ~WLAN_STA_WNM_SLEEP_MODE;
  12614. ++ sta->flags &= ~WLAN_STA_WDS;
  12615. + if ((!hapd->conf->ieee802_1x && !hapd->conf->wpa && !hapd->conf->osen) ||
  12616. + sta->auth_alg == WLAN_AUTH_FT) {
  12617. + /*
  12618. 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
  12619. deleted file mode 100644
  12620. index e408fbe..0000000
  12621. --- a/package/network/services/hostapd/patches/001-P2P-Validate-SSID-element-length-before-copying-it-C.patch
  12622. +++ /dev/null
  12623. @@ -1,37 +0,0 @@
  12624. -From 9ed4eee345f85e3025c33c6e20aa25696e341ccd Mon Sep 17 00:00:00 2001
  12625. -From: Jouni Malinen <jouni@qca.qualcomm.com>
  12626. -Date: Tue, 7 Apr 2015 11:32:11 +0300
  12627. -Subject: [PATCH] P2P: Validate SSID element length before copying it
  12628. - (CVE-2015-1863)
  12629. -
  12630. -This fixes a possible memcpy overflow for P2P dev->oper_ssid in
  12631. -p2p_add_device(). The length provided by the peer device (0..255 bytes)
  12632. -was used without proper bounds checking and that could have resulted in
  12633. -arbitrary data of up to 223 bytes being written beyond the end of the
  12634. -dev->oper_ssid[] array (of which about 150 bytes would be beyond the
  12635. -heap allocation) when processing a corrupted management frame for P2P
  12636. -peer discovery purposes.
  12637. -
  12638. -This could result in corrupted state in heap, unexpected program
  12639. -behavior due to corrupted P2P peer device information, denial of service
  12640. -due to process crash, exposure of memory contents during GO Negotiation,
  12641. -and potentially arbitrary code execution.
  12642. -
  12643. -Thanks to Google security team for reporting this issue and smart
  12644. -hardware research group of Alibaba security team for discovering it.
  12645. -
  12646. -Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
  12647. ----
  12648. - src/p2p/p2p.c | 1 +
  12649. - 1 file changed, 1 insertion(+)
  12650. -
  12651. ---- a/src/p2p/p2p.c
  12652. -+++ b/src/p2p/p2p.c
  12653. -@@ -778,6 +778,7 @@ int p2p_add_device(struct p2p_data *p2p,
  12654. - if (os_memcmp(addr, p2p_dev_addr, ETH_ALEN) != 0)
  12655. - os_memcpy(dev->interface_addr, addr, ETH_ALEN);
  12656. - if (msg.ssid &&
  12657. -+ msg.ssid[1] <= sizeof(dev->oper_ssid) &&
  12658. - (msg.ssid[1] != P2P_WILDCARD_SSID_LEN ||
  12659. - os_memcmp(msg.ssid + 2, P2P_WILDCARD_SSID, P2P_WILDCARD_SSID_LEN)
  12660. - != 0)) {
  12661. 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
  12662. deleted file mode 100644
  12663. index bc4d60f..0000000
  12664. --- a/package/network/services/hostapd/patches/002-AP-WMM-Fix-integer-underflow-in-WMM-Action-frame-par.patch
  12665. +++ /dev/null
  12666. @@ -1,36 +0,0 @@
  12667. -From ef566a4d4f74022e1fdb0a2addfe81e6de9f4aae Mon Sep 17 00:00:00 2001
  12668. -From: Jouni Malinen <j@w1.fi>
  12669. -Date: Wed, 29 Apr 2015 02:21:53 +0300
  12670. -Subject: [PATCH] AP WMM: Fix integer underflow in WMM Action frame parser
  12671. -
  12672. -The length of the WMM Action frame was not properly validated and the
  12673. -length of the information elements (int left) could end up being
  12674. -negative. This would result in reading significantly past the stack
  12675. -buffer while parsing the IEs in ieee802_11_parse_elems() and while doing
  12676. -so, resulting in segmentation fault.
  12677. -
  12678. -This can result in an invalid frame being used for a denial of service
  12679. -attack (hostapd process killed) against an AP with a driver that uses
  12680. -hostapd for management frame processing (e.g., all mac80211-based
  12681. -drivers).
  12682. -
  12683. -Thanks to Kostya Kortchinsky of Google security team for discovering and
  12684. -reporting this issue.
  12685. -
  12686. -Signed-off-by: Jouni Malinen <j@w1.fi>
  12687. ----
  12688. - src/ap/wmm.c | 3 +++
  12689. - 1 file changed, 3 insertions(+)
  12690. -
  12691. ---- a/src/ap/wmm.c
  12692. -+++ b/src/ap/wmm.c
  12693. -@@ -274,6 +274,9 @@ void hostapd_wmm_action(struct hostapd_d
  12694. - return;
  12695. - }
  12696. -
  12697. -+ if (left < 0)
  12698. -+ return; /* not a valid WMM Action frame */
  12699. -+
  12700. - /* extract the tspec info element */
  12701. - if (ieee802_11_parse_elems(pos, left, &elems, 1) == ParseFailed) {
  12702. - hostapd_logger(hapd, mgmt->sa, HOSTAPD_MODULE_IEEE80211,
  12703. 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
  12704. new file mode 100644
  12705. index 0000000..2439220
  12706. --- /dev/null
  12707. +++ b/package/network/services/hostapd/patches/002-mesh-Set-correct-secondary-channel-offset-if-HT40-is.patch
  12708. @@ -0,0 +1,61 @@
  12709. +From: Masashi Honma <masashi.honma@gmail.com>
  12710. +Date: Tue, 26 Jul 2016 11:45:40 +0900
  12711. +Subject: [PATCH] mesh: Set correct secondary channel offset if HT40 is
  12712. + disabled
  12713. +
  12714. +Previously, secondary channel offset could be non zero even though
  12715. +disable_ht40=1. This patch fixes it.
  12716. +
  12717. +Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
  12718. +---
  12719. +
  12720. +--- a/wpa_supplicant/wpa_supplicant.c
  12721. ++++ b/wpa_supplicant/wpa_supplicant.c
  12722. +@@ -1901,20 +1901,27 @@ void ibss_mesh_setup_freq(struct wpa_sup
  12723. + break;
  12724. + }
  12725. + }
  12726. ++#ifdef CONFIG_HT_OVERRIDES
  12727. ++ if (ssid->disable_ht40)
  12728. ++ ht40 = 0;
  12729. ++#endif /* CONFIG_HT_OVERRIDES */
  12730. +
  12731. +- /* Find secondary channel */
  12732. +- for (i = 0; i < mode->num_channels; i++) {
  12733. +- sec_chan = &mode->channels[i];
  12734. +- if (sec_chan->chan == channel + ht40 * 4)
  12735. +- break;
  12736. +- sec_chan = NULL;
  12737. +- }
  12738. +- if (!sec_chan)
  12739. +- return;
  12740. ++ if (ht40) {
  12741. ++ /* Find secondary channel */
  12742. ++ for (i = 0; i < mode->num_channels; i++) {
  12743. ++ sec_chan = &mode->channels[i];
  12744. ++ if (sec_chan->chan == channel + ht40 * 4)
  12745. ++ break;
  12746. ++ sec_chan = NULL;
  12747. ++ }
  12748. ++ if (!sec_chan)
  12749. ++ return;
  12750. +
  12751. +- /* Check secondary channel flags */
  12752. +- if (sec_chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR))
  12753. +- return;
  12754. ++ /* Check secondary channel flags */
  12755. ++ if (sec_chan->flag &
  12756. ++ (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR))
  12757. ++ return;
  12758. ++ }
  12759. +
  12760. + freq->channel = pri_chan->chan;
  12761. +
  12762. +@@ -1930,6 +1937,7 @@ void ibss_mesh_setup_freq(struct wpa_sup
  12763. + freq->sec_channel_offset = 1;
  12764. + break;
  12765. + default:
  12766. ++ freq->sec_channel_offset = 0;
  12767. + break;
  12768. + }
  12769. +
  12770. 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
  12771. deleted file mode 100644
  12772. index 36b4ca2..0000000
  12773. --- a/package/network/services/hostapd/patches/003-WPS-Fix-HTTP-chunked-transfer-encoding-parser.patch
  12774. +++ /dev/null
  12775. @@ -1,49 +0,0 @@
  12776. -From 5acd23f4581da58683f3cf5e36cb71bbe4070bd7 Mon Sep 17 00:00:00 2001
  12777. -From: Jouni Malinen <j@w1.fi>
  12778. -Date: Tue, 28 Apr 2015 17:08:33 +0300
  12779. -Subject: [PATCH] WPS: Fix HTTP chunked transfer encoding parser
  12780. -
  12781. -strtoul() return value may end up overflowing the int h->chunk_size and
  12782. -resulting in a negative value to be stored as the chunk_size. This could
  12783. -result in the following memcpy operation using a very large length
  12784. -argument which would result in a buffer overflow and segmentation fault.
  12785. -
  12786. -This could have been used to cause a denial service by any device that
  12787. -has been authorized for network access (either wireless or wired). This
  12788. -would affect both the WPS UPnP functionality in a WPS AP (hostapd with
  12789. -upnp_iface parameter set in the configuration) and WPS ER
  12790. -(wpa_supplicant with WPS_ER_START control interface command used).
  12791. -
  12792. -Validate the parsed chunk length value to avoid this. In addition to
  12793. -rejecting negative values, we can also reject chunk size that would be
  12794. -larger than the maximum configured body length.
  12795. -
  12796. -Thanks to Kostya Kortchinsky of Google security team for discovering and
  12797. -reporting this issue.
  12798. -
  12799. -Signed-off-by: Jouni Malinen <j@w1.fi>
  12800. ----
  12801. - src/wps/httpread.c | 7 +++++++
  12802. - 1 file changed, 7 insertions(+)
  12803. -
  12804. -diff --git a/src/wps/httpread.c b/src/wps/httpread.c
  12805. -index 2f08f37..d2855e3 100644
  12806. ---- a/src/wps/httpread.c
  12807. -+++ b/src/wps/httpread.c
  12808. -@@ -533,6 +533,13 @@ static void httpread_read_handler(int sd, void *eloop_ctx, void *sock_ctx)
  12809. - if (!isxdigit(*cbp))
  12810. - goto bad;
  12811. - h->chunk_size = strtoul(cbp, NULL, 16);
  12812. -+ if (h->chunk_size < 0 ||
  12813. -+ h->chunk_size > h->max_bytes) {
  12814. -+ wpa_printf(MSG_DEBUG,
  12815. -+ "httpread: Invalid chunk size %d",
  12816. -+ h->chunk_size);
  12817. -+ goto bad;
  12818. -+ }
  12819. - /* throw away chunk header
  12820. - * so we have only real data
  12821. - */
  12822. ---
  12823. -1.9.1
  12824. -
  12825. 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
  12826. deleted file mode 100644
  12827. index 91627fb..0000000
  12828. --- a/package/network/services/hostapd/patches/004-EAP-pwd-peer-Fix-payload-length-validation-for-Commi.patch
  12829. +++ /dev/null
  12830. @@ -1,73 +0,0 @@
  12831. -From dd2f043c9c43d156494e33d7ce22db96e6ef42c7 Mon Sep 17 00:00:00 2001
  12832. -From: Jouni Malinen <j@w1.fi>
  12833. -Date: Fri, 1 May 2015 16:37:45 +0300
  12834. -Subject: [PATCH 1/5] EAP-pwd peer: Fix payload length validation for Commit
  12835. - and Confirm
  12836. -
  12837. -The length of the received Commit and Confirm message payloads was not
  12838. -checked before reading them. This could result in a buffer read
  12839. -overflow when processing an invalid message.
  12840. -
  12841. -Fix this by verifying that the payload is of expected length before
  12842. -processing it. In addition, enforce correct state transition sequence to
  12843. -make sure there is no unexpected behavior if receiving a Commit/Confirm
  12844. -message before the previous exchanges have been completed.
  12845. -
  12846. -Thanks to Kostya Kortchinsky of Google security team for discovering and
  12847. -reporting this issue.
  12848. -
  12849. -Signed-off-by: Jouni Malinen <j@w1.fi>
  12850. ----
  12851. - src/eap_peer/eap_pwd.c | 29 +++++++++++++++++++++++++++++
  12852. - 1 file changed, 29 insertions(+)
  12853. -
  12854. -diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c
  12855. -index f2b0926..a629437 100644
  12856. ---- a/src/eap_peer/eap_pwd.c
  12857. -+++ b/src/eap_peer/eap_pwd.c
  12858. -@@ -355,6 +355,23 @@ eap_pwd_perform_commit_exchange(struct eap_sm *sm, struct eap_pwd_data *data,
  12859. - BIGNUM *mask = NULL, *x = NULL, *y = NULL, *cofactor = NULL;
  12860. - u16 offset;
  12861. - u8 *ptr, *scalar = NULL, *element = NULL;
  12862. -+ size_t prime_len, order_len;
  12863. -+
  12864. -+ if (data->state != PWD_Commit_Req) {
  12865. -+ ret->ignore = TRUE;
  12866. -+ goto fin;
  12867. -+ }
  12868. -+
  12869. -+ prime_len = BN_num_bytes(data->grp->prime);
  12870. -+ order_len = BN_num_bytes(data->grp->order);
  12871. -+
  12872. -+ if (payload_len != 2 * prime_len + order_len) {
  12873. -+ wpa_printf(MSG_INFO,
  12874. -+ "EAP-pwd: Unexpected Commit payload length %u (expected %u)",
  12875. -+ (unsigned int) payload_len,
  12876. -+ (unsigned int) (2 * prime_len + order_len));
  12877. -+ goto fin;
  12878. -+ }
  12879. -
  12880. - if (((data->private_value = BN_new()) == NULL) ||
  12881. - ((data->my_element = EC_POINT_new(data->grp->group)) == NULL) ||
  12882. -@@ -554,6 +571,18 @@ eap_pwd_perform_confirm_exchange(struct eap_sm *sm, struct eap_pwd_data *data,
  12883. - u8 conf[SHA256_MAC_LEN], *cruft = NULL, *ptr;
  12884. - int offset;
  12885. -
  12886. -+ if (data->state != PWD_Confirm_Req) {
  12887. -+ ret->ignore = TRUE;
  12888. -+ goto fin;
  12889. -+ }
  12890. -+
  12891. -+ if (payload_len != SHA256_MAC_LEN) {
  12892. -+ wpa_printf(MSG_INFO,
  12893. -+ "EAP-pwd: Unexpected Confirm payload length %u (expected %u)",
  12894. -+ (unsigned int) payload_len, SHA256_MAC_LEN);
  12895. -+ goto fin;
  12896. -+ }
  12897. -+
  12898. - /*
  12899. - * first build up the ciphersuite which is group | random_function |
  12900. - * prf
  12901. ---
  12902. -1.9.1
  12903. -
  12904. 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
  12905. deleted file mode 100644
  12906. index 5dca20b..0000000
  12907. --- a/package/network/services/hostapd/patches/005-EAP-pwd-server-Fix-payload-length-validation-for-Com.patch
  12908. +++ /dev/null
  12909. @@ -1,66 +0,0 @@
  12910. -From e28a58be26184c2a23f80b410e0997ef1bd5d578 Mon Sep 17 00:00:00 2001
  12911. -From: Jouni Malinen <j@w1.fi>
  12912. -Date: Fri, 1 May 2015 16:40:44 +0300
  12913. -Subject: [PATCH 2/5] EAP-pwd server: Fix payload length validation for Commit
  12914. - and Confirm
  12915. -
  12916. -The length of the received Commit and Confirm message payloads was not
  12917. -checked before reading them. This could result in a buffer read
  12918. -overflow when processing an invalid message.
  12919. -
  12920. -Fix this by verifying that the payload is of expected length before
  12921. -processing it. In addition, enforce correct state transition sequence to
  12922. -make sure there is no unexpected behavior if receiving a Commit/Confirm
  12923. -message before the previous exchanges have been completed.
  12924. -
  12925. -Thanks to Kostya Kortchinsky of Google security team for discovering and
  12926. -reporting this issue.
  12927. -
  12928. -Signed-off-by: Jouni Malinen <j@w1.fi>
  12929. ----
  12930. - src/eap_server/eap_server_pwd.c | 19 +++++++++++++++++++
  12931. - 1 file changed, 19 insertions(+)
  12932. -
  12933. -diff --git a/src/eap_server/eap_server_pwd.c b/src/eap_server/eap_server_pwd.c
  12934. -index 66bd5d2..3189105 100644
  12935. ---- a/src/eap_server/eap_server_pwd.c
  12936. -+++ b/src/eap_server/eap_server_pwd.c
  12937. -@@ -656,9 +656,21 @@ eap_pwd_process_commit_resp(struct eap_sm *sm, struct eap_pwd_data *data,
  12938. - BIGNUM *x = NULL, *y = NULL, *cofactor = NULL;
  12939. - EC_POINT *K = NULL, *point = NULL;
  12940. - int res = 0;
  12941. -+ size_t prime_len, order_len;
  12942. -
  12943. - wpa_printf(MSG_DEBUG, "EAP-pwd: Received commit response");
  12944. -
  12945. -+ prime_len = BN_num_bytes(data->grp->prime);
  12946. -+ order_len = BN_num_bytes(data->grp->order);
  12947. -+
  12948. -+ if (payload_len != 2 * prime_len + order_len) {
  12949. -+ wpa_printf(MSG_INFO,
  12950. -+ "EAP-pwd: Unexpected Commit payload length %u (expected %u)",
  12951. -+ (unsigned int) payload_len,
  12952. -+ (unsigned int) (2 * prime_len + order_len));
  12953. -+ goto fin;
  12954. -+ }
  12955. -+
  12956. - if (((data->peer_scalar = BN_new()) == NULL) ||
  12957. - ((data->k = BN_new()) == NULL) ||
  12958. - ((cofactor = BN_new()) == NULL) ||
  12959. -@@ -774,6 +786,13 @@ eap_pwd_process_confirm_resp(struct eap_sm *sm, struct eap_pwd_data *data,
  12960. - u8 conf[SHA256_MAC_LEN], *cruft = NULL, *ptr;
  12961. - int offset;
  12962. -
  12963. -+ if (payload_len != SHA256_MAC_LEN) {
  12964. -+ wpa_printf(MSG_INFO,
  12965. -+ "EAP-pwd: Unexpected Confirm payload length %u (expected %u)",
  12966. -+ (unsigned int) payload_len, SHA256_MAC_LEN);
  12967. -+ goto fin;
  12968. -+ }
  12969. -+
  12970. - /* build up the ciphersuite: group | random_function | prf */
  12971. - grp = htons(data->group_num);
  12972. - ptr = (u8 *) &cs;
  12973. ---
  12974. -1.9.1
  12975. -
  12976. 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
  12977. deleted file mode 100644
  12978. index 4d2f9d8..0000000
  12979. --- a/package/network/services/hostapd/patches/006-EAP-pwd-peer-Fix-Total-Length-parsing-for-fragment-r.patch
  12980. +++ /dev/null
  12981. @@ -1,52 +0,0 @@
  12982. -From 477c74395acd0123340457ba6f15ab345d42016e Mon Sep 17 00:00:00 2001
  12983. -From: Jouni Malinen <j@w1.fi>
  12984. -Date: Sat, 2 May 2015 19:23:04 +0300
  12985. -Subject: [PATCH 3/5] EAP-pwd peer: Fix Total-Length parsing for fragment
  12986. - reassembly
  12987. -
  12988. -The remaining number of bytes in the message could be smaller than the
  12989. -Total-Length field size, so the length needs to be explicitly checked
  12990. -prior to reading the field and decrementing the len variable. This could
  12991. -have resulted in the remaining length becoming negative and interpreted
  12992. -as a huge positive integer.
  12993. -
  12994. -In addition, check that there is no already started fragment in progress
  12995. -before allocating a new buffer for reassembling fragments. This avoid a
  12996. -potential memory leak when processing invalid message.
  12997. -
  12998. -Signed-off-by: Jouni Malinen <j@w1.fi>
  12999. ----
  13000. - src/eap_peer/eap_pwd.c | 12 ++++++++++++
  13001. - 1 file changed, 12 insertions(+)
  13002. -
  13003. -diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c
  13004. -index a629437..1d2079b 100644
  13005. ---- a/src/eap_peer/eap_pwd.c
  13006. -+++ b/src/eap_peer/eap_pwd.c
  13007. -@@ -866,11 +866,23 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret,
  13008. - * if it's the first fragment there'll be a length field
  13009. - */
  13010. - if (EAP_PWD_GET_LENGTH_BIT(lm_exch)) {
  13011. -+ if (len < 2) {
  13012. -+ wpa_printf(MSG_DEBUG,
  13013. -+ "EAP-pwd: Frame too short to contain Total-Length field");
  13014. -+ ret->ignore = TRUE;
  13015. -+ return NULL;
  13016. -+ }
  13017. - tot_len = WPA_GET_BE16(pos);
  13018. - wpa_printf(MSG_DEBUG, "EAP-pwd: Incoming fragments whose "
  13019. - "total length = %d", tot_len);
  13020. - if (tot_len > 15000)
  13021. - return NULL;
  13022. -+ if (data->inbuf) {
  13023. -+ wpa_printf(MSG_DEBUG,
  13024. -+ "EAP-pwd: Unexpected new fragment start when previous fragment is still in use");
  13025. -+ ret->ignore = TRUE;
  13026. -+ return NULL;
  13027. -+ }
  13028. - data->inbuf = wpabuf_alloc(tot_len);
  13029. - if (data->inbuf == NULL) {
  13030. - wpa_printf(MSG_INFO, "Out of memory to buffer "
  13031. ---
  13032. -1.9.1
  13033. -
  13034. 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
  13035. deleted file mode 100644
  13036. index 7edef09..0000000
  13037. --- a/package/network/services/hostapd/patches/007-EAP-pwd-server-Fix-Total-Length-parsing-for-fragment.patch
  13038. +++ /dev/null
  13039. @@ -1,50 +0,0 @@
  13040. -From 3035cc2894e08319b905bd6561e8bddc8c2db9fa Mon Sep 17 00:00:00 2001
  13041. -From: Jouni Malinen <j@w1.fi>
  13042. -Date: Sat, 2 May 2015 19:26:06 +0300
  13043. -Subject: [PATCH 4/5] EAP-pwd server: Fix Total-Length parsing for fragment
  13044. - reassembly
  13045. -
  13046. -The remaining number of bytes in the message could be smaller than the
  13047. -Total-Length field size, so the length needs to be explicitly checked
  13048. -prior to reading the field and decrementing the len variable. This could
  13049. -have resulted in the remaining length becoming negative and interpreted
  13050. -as a huge positive integer.
  13051. -
  13052. -In addition, check that there is no already started fragment in progress
  13053. -before allocating a new buffer for reassembling fragments. This avoid a
  13054. -potential memory leak when processing invalid message.
  13055. -
  13056. -Signed-off-by: Jouni Malinen <j@w1.fi>
  13057. ----
  13058. - src/eap_server/eap_server_pwd.c | 10 ++++++++++
  13059. - 1 file changed, 10 insertions(+)
  13060. -
  13061. -diff --git a/src/eap_server/eap_server_pwd.c b/src/eap_server/eap_server_pwd.c
  13062. -index 3189105..2bfc3c2 100644
  13063. ---- a/src/eap_server/eap_server_pwd.c
  13064. -+++ b/src/eap_server/eap_server_pwd.c
  13065. -@@ -942,11 +942,21 @@ static void eap_pwd_process(struct eap_sm *sm, void *priv,
  13066. - * the first fragment has a total length
  13067. - */
  13068. - if (EAP_PWD_GET_LENGTH_BIT(lm_exch)) {
  13069. -+ if (len < 2) {
  13070. -+ wpa_printf(MSG_DEBUG,
  13071. -+ "EAP-pwd: Frame too short to contain Total-Length field");
  13072. -+ return;
  13073. -+ }
  13074. - tot_len = WPA_GET_BE16(pos);
  13075. - wpa_printf(MSG_DEBUG, "EAP-pwd: Incoming fragments, total "
  13076. - "length = %d", tot_len);
  13077. - if (tot_len > 15000)
  13078. - return;
  13079. -+ if (data->inbuf) {
  13080. -+ wpa_printf(MSG_DEBUG,
  13081. -+ "EAP-pwd: Unexpected new fragment start when previous fragment is still in use");
  13082. -+ return;
  13083. -+ }
  13084. - data->inbuf = wpabuf_alloc(tot_len);
  13085. - if (data->inbuf == NULL) {
  13086. - wpa_printf(MSG_INFO, "EAP-pwd: Out of memory to "
  13087. ---
  13088. -1.9.1
  13089. -
  13090. 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
  13091. deleted file mode 100644
  13092. index a601323..0000000
  13093. --- a/package/network/services/hostapd/patches/008-EAP-pwd-peer-Fix-asymmetric-fragmentation-behavior.patch
  13094. +++ /dev/null
  13095. @@ -1,32 +0,0 @@
  13096. -From 28a069a545b06b99eb55ad53f63f2c99e65a98f6 Mon Sep 17 00:00:00 2001
  13097. -From: Jouni Malinen <j@w1.fi>
  13098. -Date: Sat, 2 May 2015 19:26:28 +0300
  13099. -Subject: [PATCH 5/5] EAP-pwd peer: Fix asymmetric fragmentation behavior
  13100. -
  13101. -The L (Length) and M (More) flags needs to be cleared before deciding
  13102. -whether the locally generated response requires fragmentation. This
  13103. -fixes an issue where these flags from the server could have been invalid
  13104. -for the following message. In some cases, this could have resulted in
  13105. -triggering the wpabuf security check that would terminate the process
  13106. -due to invalid buffer allocation.
  13107. -
  13108. -Signed-off-by: Jouni Malinen <j@w1.fi>
  13109. ----
  13110. - src/eap_peer/eap_pwd.c | 1 +
  13111. - 1 file changed, 1 insertion(+)
  13112. -
  13113. -diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c
  13114. -index 1d2079b..e58b13a 100644
  13115. ---- a/src/eap_peer/eap_pwd.c
  13116. -+++ b/src/eap_peer/eap_pwd.c
  13117. -@@ -968,6 +968,7 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret,
  13118. - /*
  13119. - * we have output! Do we need to fragment it?
  13120. - */
  13121. -+ lm_exch = EAP_PWD_GET_EXCHANGE(lm_exch);
  13122. - len = wpabuf_len(data->outbuf);
  13123. - if ((len + EAP_PWD_HDR_SIZE) > data->mtu) {
  13124. - resp = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_PWD, data->mtu,
  13125. ---
  13126. -1.9.1
  13127. -
  13128. 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
  13129. deleted file mode 100644
  13130. index dd34624..0000000
  13131. --- a/package/network/services/hostapd/patches/009-NFC-Fix-payload-length-validation-in-NDEF-record-par.patch
  13132. +++ /dev/null
  13133. @@ -1,61 +0,0 @@
  13134. -From df9079e72760ceb7ebe7fb11538200c516bdd886 Mon Sep 17 00:00:00 2001
  13135. -From: Jouni Malinen <j@w1.fi>
  13136. -Date: Tue, 7 Jul 2015 21:57:28 +0300
  13137. -Subject: [PATCH] NFC: Fix payload length validation in NDEF record parser
  13138. -
  13139. -It was possible for the 32-bit record->total_length value to end up
  13140. -wrapping around due to integer overflow if the longer form of payload
  13141. -length field is used and record->payload_length gets a value close to
  13142. -2^32. This could result in ndef_parse_record() accepting a too large
  13143. -payload length value and the record type filter reading up to about 20
  13144. -bytes beyond the end of the buffer and potentially killing the process.
  13145. -This could also result in an attempt to allocate close to 2^32 bytes of
  13146. -heap memory and if that were to succeed, a buffer read overflow of the
  13147. -same length which would most likely result in the process termination.
  13148. -In case of record->total_length ending up getting the value 0, there
  13149. -would be no buffer read overflow, but record parsing would result in an
  13150. -infinite loop in ndef_parse_records().
  13151. -
  13152. -Any of these error cases could potentially be used for denial of service
  13153. -attacks over NFC by using a malformed NDEF record on an NFC Tag or
  13154. -sending them during NFC connection handover if the application providing
  13155. -the NDEF message to hostapd/wpa_supplicant did no validation of the
  13156. -received records. While such validation is likely done in the NFC stack
  13157. -that needs to parse the NFC messages before further processing,
  13158. -hostapd/wpa_supplicant better be prepared for any data being included
  13159. -here.
  13160. -
  13161. -Fix this by validating record->payload_length value in a way that
  13162. -detects integer overflow. (CID 122668)
  13163. -
  13164. -Signed-off-by: Jouni Malinen <j@w1.fi>
  13165. ----
  13166. - src/wps/ndef.c | 5 ++++-
  13167. - 1 file changed, 4 insertions(+), 1 deletion(-)
  13168. -
  13169. -diff --git a/src/wps/ndef.c b/src/wps/ndef.c
  13170. -index 5604b0a..50d018f 100644
  13171. ---- a/src/wps/ndef.c
  13172. -+++ b/src/wps/ndef.c
  13173. -@@ -48,6 +48,8 @@ static int ndef_parse_record(const u8 *data, u32 size,
  13174. - if (size < 6)
  13175. - return -1;
  13176. - record->payload_length = ntohl(*(u32 *)pos);
  13177. -+ if (record->payload_length > size - 6)
  13178. -+ return -1;
  13179. - pos += sizeof(u32);
  13180. - }
  13181. -
  13182. -@@ -68,7 +70,8 @@ static int ndef_parse_record(const u8 *data, u32 size,
  13183. - pos += record->payload_length;
  13184. -
  13185. - record->total_length = pos - data;
  13186. -- if (record->total_length > size)
  13187. -+ if (record->total_length > size ||
  13188. -+ record->total_length < record->payload_length)
  13189. - return -1;
  13190. - return 0;
  13191. - }
  13192. ---
  13193. -1.9.1
  13194. -
  13195. 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
  13196. deleted file mode 100644
  13197. index 00e5b7c..0000000
  13198. --- a/package/network/services/hostapd/patches/010-WNM-Ignore-Key-Data-in-WNM-Sleep-Mode-Response-frame.patch
  13199. +++ /dev/null
  13200. @@ -1,32 +0,0 @@
  13201. -From 6b12d93d2c7428a34bfd4b3813ba339ed57b698a Mon Sep 17 00:00:00 2001
  13202. -From: Jouni Malinen <j@w1.fi>
  13203. -Date: Sun, 25 Oct 2015 15:45:50 +0200
  13204. -Subject: [PATCH] WNM: Ignore Key Data in WNM Sleep Mode Response frame if no
  13205. - PMF in use
  13206. -
  13207. -WNM Sleep Mode Response frame is used to update GTK/IGTK only if PMF is
  13208. -enabled. Verify that PMF is in use before using this field on station
  13209. -side to avoid accepting unauthenticated key updates. (CVE-2015-5310)
  13210. -
  13211. -Signed-off-by: Jouni Malinen <j@w1.fi>
  13212. ----
  13213. - wpa_supplicant/wnm_sta.c | 6 ++++++
  13214. - 1 file changed, 6 insertions(+)
  13215. -
  13216. -diff --git a/wpa_supplicant/wnm_sta.c b/wpa_supplicant/wnm_sta.c
  13217. -index 954de67..7d79499 100644
  13218. ---- a/wpa_supplicant/wnm_sta.c
  13219. -+++ b/wpa_supplicant/wnm_sta.c
  13220. -@@ -187,6 +187,12 @@ static void wnm_sleep_mode_exit_success(struct wpa_supplicant *wpa_s,
  13221. - end = ptr + key_len_total;
  13222. - wpa_hexdump_key(MSG_DEBUG, "WNM: Key Data", ptr, key_len_total);
  13223. -
  13224. -+ if (key_len_total && !wpa_sm_pmf_enabled(wpa_s->wpa)) {
  13225. -+ wpa_msg(wpa_s, MSG_INFO,
  13226. -+ "WNM: Ignore Key Data in WNM-Sleep Mode Response - PMF not enabled");
  13227. -+ return;
  13228. -+ }
  13229. -+
  13230. - while (ptr + 1 < end) {
  13231. - if (ptr + 2 + ptr[1] > end) {
  13232. - wpa_printf(MSG_DEBUG, "WNM: Invalid Key Data element "
  13233. 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
  13234. deleted file mode 100644
  13235. index 82c2639..0000000
  13236. --- a/package/network/services/hostapd/patches/011-EAP-pwd-peer-Fix-last-fragment-length-validation.patch
  13237. +++ /dev/null
  13238. @@ -1,54 +0,0 @@
  13239. -From 8057821706784608b828e769ccefbced95591e50 Mon Sep 17 00:00:00 2001
  13240. -From: Jouni Malinen <j@w1.fi>
  13241. -Date: Sun, 1 Nov 2015 18:18:17 +0200
  13242. -Subject: [PATCH] EAP-pwd peer: Fix last fragment length validation
  13243. -
  13244. -All but the last fragment had their length checked against the remaining
  13245. -room in the reassembly buffer. This allowed a suitably constructed last
  13246. -fragment frame to try to add extra data that would go beyond the buffer.
  13247. -The length validation code in wpabuf_put_data() prevents an actual
  13248. -buffer write overflow from occurring, but this results in process
  13249. -termination. (CVE-2015-5315)
  13250. -
  13251. -Signed-off-by: Jouni Malinen <j@w1.fi>
  13252. ----
  13253. - src/eap_peer/eap_pwd.c | 7 +++----
  13254. - 1 file changed, 3 insertions(+), 4 deletions(-)
  13255. -
  13256. -diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c
  13257. -index 1f78544..75ceef1 100644
  13258. ---- a/src/eap_peer/eap_pwd.c
  13259. -+++ b/src/eap_peer/eap_pwd.c
  13260. -@@ -903,7 +903,7 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret,
  13261. - /*
  13262. - * buffer and ACK the fragment
  13263. - */
  13264. -- if (EAP_PWD_GET_MORE_BIT(lm_exch)) {
  13265. -+ if (EAP_PWD_GET_MORE_BIT(lm_exch) || data->in_frag_pos) {
  13266. - data->in_frag_pos += len;
  13267. - if (data->in_frag_pos > wpabuf_size(data->inbuf)) {
  13268. - wpa_printf(MSG_INFO, "EAP-pwd: Buffer overflow attack "
  13269. -@@ -916,7 +916,8 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret,
  13270. - return NULL;
  13271. - }
  13272. - wpabuf_put_data(data->inbuf, pos, len);
  13273. --
  13274. -+ }
  13275. -+ if (EAP_PWD_GET_MORE_BIT(lm_exch)) {
  13276. - resp = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_PWD,
  13277. - EAP_PWD_HDR_SIZE,
  13278. - EAP_CODE_RESPONSE, eap_get_id(reqData));
  13279. -@@ -930,10 +931,8 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret,
  13280. - * we're buffering and this is the last fragment
  13281. - */
  13282. - if (data->in_frag_pos) {
  13283. -- wpabuf_put_data(data->inbuf, pos, len);
  13284. - wpa_printf(MSG_DEBUG, "EAP-pwd: Last fragment, %d bytes",
  13285. - (int) len);
  13286. -- data->in_frag_pos += len;
  13287. - pos = wpabuf_head_u8(data->inbuf);
  13288. - len = data->in_frag_pos;
  13289. - }
  13290. ---
  13291. -1.9.1
  13292. -
  13293. 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
  13294. deleted file mode 100644
  13295. index bfc4c74..0000000
  13296. --- a/package/network/services/hostapd/patches/012-EAP-pwd-server-Fix-last-fragment-length-validation.patch
  13297. +++ /dev/null
  13298. @@ -1,51 +0,0 @@
  13299. -From bef802ece03f9ae9d52a21f0cf4f1bc2c5a1f8aa Mon Sep 17 00:00:00 2001
  13300. -From: Jouni Malinen <j@w1.fi>
  13301. -Date: Sun, 1 Nov 2015 18:24:16 +0200
  13302. -Subject: [PATCH] EAP-pwd server: Fix last fragment length validation
  13303. -
  13304. -All but the last fragment had their length checked against the remaining
  13305. -room in the reassembly buffer. This allowed a suitably constructed last
  13306. -fragment frame to try to add extra data that would go beyond the buffer.
  13307. -The length validation code in wpabuf_put_data() prevents an actual
  13308. -buffer write overflow from occurring, but this results in process
  13309. -termination. (CVE-2015-5314)
  13310. -
  13311. -Signed-off-by: Jouni Malinen <j@w1.fi>
  13312. ----
  13313. - src/eap_server/eap_server_pwd.c | 6 +++---
  13314. - 1 file changed, 3 insertions(+), 3 deletions(-)
  13315. -
  13316. -diff --git a/src/eap_server/eap_server_pwd.c b/src/eap_server/eap_server_pwd.c
  13317. -index cb83ff7..9f787ab 100644
  13318. ---- a/src/eap_server/eap_server_pwd.c
  13319. -+++ b/src/eap_server/eap_server_pwd.c
  13320. -@@ -970,7 +970,7 @@ static void eap_pwd_process(struct eap_sm *sm, void *priv,
  13321. - /*
  13322. - * the first and all intermediate fragments have the M bit set
  13323. - */
  13324. -- if (EAP_PWD_GET_MORE_BIT(lm_exch)) {
  13325. -+ if (EAP_PWD_GET_MORE_BIT(lm_exch) || data->in_frag_pos) {
  13326. - if ((data->in_frag_pos + len) > wpabuf_size(data->inbuf)) {
  13327. - wpa_printf(MSG_DEBUG, "EAP-pwd: Buffer overflow "
  13328. - "attack detected! (%d+%d > %d)",
  13329. -@@ -981,6 +981,8 @@ static void eap_pwd_process(struct eap_sm *sm, void *priv,
  13330. - }
  13331. - wpabuf_put_data(data->inbuf, pos, len);
  13332. - data->in_frag_pos += len;
  13333. -+ }
  13334. -+ if (EAP_PWD_GET_MORE_BIT(lm_exch)) {
  13335. - wpa_printf(MSG_DEBUG, "EAP-pwd: Got a %d byte fragment",
  13336. - (int) len);
  13337. - return;
  13338. -@@ -990,8 +992,6 @@ static void eap_pwd_process(struct eap_sm *sm, void *priv,
  13339. - * buffering fragments so that's how we know it's the last)
  13340. - */
  13341. - if (data->in_frag_pos) {
  13342. -- wpabuf_put_data(data->inbuf, pos, len);
  13343. -- data->in_frag_pos += len;
  13344. - pos = wpabuf_head_u8(data->inbuf);
  13345. - len = data->in_frag_pos;
  13346. - wpa_printf(MSG_DEBUG, "EAP-pwd: Last fragment, %d bytes",
  13347. ---
  13348. -1.9.1
  13349. -
  13350. 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
  13351. deleted file mode 100644
  13352. index 3088f6a..0000000
  13353. --- a/package/network/services/hostapd/patches/013-EAP-pwd-peer-Fix-error-path-for-unexpected-Confirm-m.patch
  13354. +++ /dev/null
  13355. @@ -1,34 +0,0 @@
  13356. -From 95577884ca4fa76be91344ff7a8d5d1e6dc3da61 Mon Sep 17 00:00:00 2001
  13357. -From: Jouni Malinen <j@w1.fi>
  13358. -Date: Sun, 1 Nov 2015 19:35:44 +0200
  13359. -Subject: [PATCH] EAP-pwd peer: Fix error path for unexpected Confirm message
  13360. -
  13361. -If the Confirm message is received from the server before the Identity
  13362. -exchange has been completed, the group has not yet been determined and
  13363. -data->grp is NULL. The error path in eap_pwd_perform_confirm_exchange()
  13364. -did not take this corner case into account and could end up
  13365. -dereferencing a NULL pointer and terminating the process if invalid
  13366. -message sequence is received. (CVE-2015-5316)
  13367. -
  13368. -Signed-off-by: Jouni Malinen <j@w1.fi>
  13369. ----
  13370. - src/eap_peer/eap_pwd.c | 3 ++-
  13371. - 1 file changed, 2 insertions(+), 1 deletion(-)
  13372. -
  13373. -diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c
  13374. -index 75ceef1..892b590 100644
  13375. ---- a/src/eap_peer/eap_pwd.c
  13376. -+++ b/src/eap_peer/eap_pwd.c
  13377. -@@ -774,7 +774,8 @@ eap_pwd_perform_confirm_exchange(struct eap_sm *sm, struct eap_pwd_data *data,
  13378. - wpabuf_put_data(data->outbuf, conf, SHA256_MAC_LEN);
  13379. -
  13380. - fin:
  13381. -- bin_clear_free(cruft, BN_num_bytes(data->grp->prime));
  13382. -+ if (data->grp)
  13383. -+ bin_clear_free(cruft, BN_num_bytes(data->grp->prime));
  13384. - BN_clear_free(x);
  13385. - BN_clear_free(y);
  13386. - if (data->outbuf == NULL) {
  13387. ---
  13388. -1.9.1
  13389. -
  13390. diff --git a/package/network/services/hostapd/patches/100-mesh_mode_fix.patch b/package/network/services/hostapd/patches/100-mesh_mode_fix.patch
  13391. new file mode 100644
  13392. index 0000000..ceb4c53
  13393. --- /dev/null
  13394. +++ b/package/network/services/hostapd/patches/100-mesh_mode_fix.patch
  13395. @@ -0,0 +1,12 @@
  13396. +--- a/src/drivers/driver_nl80211.c
  13397. ++++ b/src/drivers/driver_nl80211.c
  13398. +@@ -2332,7 +2332,8 @@ wpa_driver_nl80211_finish_drv_init(struc
  13399. +
  13400. + if (drv->hostapd || bss->static_ap)
  13401. + nlmode = NL80211_IFTYPE_AP;
  13402. +- else if (bss->if_dynamic)
  13403. ++ else if (bss->if_dynamic ||
  13404. ++ nl80211_get_ifmode(bss) == NL80211_IFTYPE_MESH_POINT)
  13405. + nlmode = nl80211_get_ifmode(bss);
  13406. + else
  13407. + nlmode = NL80211_IFTYPE_STATION;
  13408. diff --git a/package/network/services/hostapd/patches/110-bool_fix.patch b/package/network/services/hostapd/patches/110-bool_fix.patch
  13409. deleted file mode 100644
  13410. index 865c014..0000000
  13411. --- a/package/network/services/hostapd/patches/110-bool_fix.patch
  13412. +++ /dev/null
  13413. @@ -1,14 +0,0 @@
  13414. ---- a/src/ap/ieee802_1x.c
  13415. -+++ b/src/ap/ieee802_1x.c
  13416. -@@ -2332,9 +2332,9 @@ void ieee802_1x_notify_pre_auth(struct e
  13417. - }
  13418. -
  13419. -
  13420. --static const char * bool_txt(Boolean bool)
  13421. -+static const char * bool_txt(Boolean bool_val)
  13422. - {
  13423. -- return bool ? "TRUE" : "FALSE";
  13424. -+ return bool_val ? "TRUE" : "FALSE";
  13425. - }
  13426. -
  13427. -
  13428. 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
  13429. new file mode 100644
  13430. index 0000000..67fb899
  13431. --- /dev/null
  13432. +++ b/package/network/services/hostapd/patches/110-fix_parse_das_client.patch
  13433. @@ -0,0 +1,10 @@
  13434. +--- a/hostapd/config_file.c
  13435. ++++ b/hostapd/config_file.c
  13436. +@@ -645,6 +645,7 @@ static int hostapd_parse_das_client(stru
  13437. + if (secret == NULL)
  13438. + return -1;
  13439. +
  13440. ++ *secret = 0;
  13441. + secret++;
  13442. +
  13443. + if (hostapd_parse_ip_addr(val, &bss->radius_das_client_addr))
  13444. diff --git a/package/network/services/hostapd/patches/120-daemonize_fix.patch b/package/network/services/hostapd/patches/120-daemonize_fix.patch
  13445. index 032e207..0389406 100644
  13446. --- a/package/network/services/hostapd/patches/120-daemonize_fix.patch
  13447. +++ b/package/network/services/hostapd/patches/120-daemonize_fix.patch
  13448. @@ -8,7 +8,7 @@
  13449. #ifdef ANDROID
  13450. #include <sys/capability.h>
  13451. -@@ -155,59 +156,46 @@ int os_gmtime(os_time_t t, struct os_tm
  13452. +@@ -179,59 +180,46 @@ int os_gmtime(os_time_t t, struct os_tm
  13453. return 0;
  13454. }
  13455. @@ -60,13 +60,13 @@
  13456. + if (chdir("/") < 0)
  13457. return -1;
  13458. - }
  13459. --
  13460. +
  13461. - return 0;
  13462. -}
  13463. -#else /* __APPLE__ */
  13464. -#define os_daemon daemon
  13465. -#endif /* __APPLE__ */
  13466. -
  13467. +-
  13468. -
  13469. -int os_daemonize(const char *pid_file)
  13470. -{
  13471. diff --git a/package/network/services/hostapd/patches/130-no_eapol_fix.patch b/package/network/services/hostapd/patches/130-no_eapol_fix.patch
  13472. index d23b47b..5aee3d0 100644
  13473. --- a/package/network/services/hostapd/patches/130-no_eapol_fix.patch
  13474. +++ b/package/network/services/hostapd/patches/130-no_eapol_fix.patch
  13475. @@ -1,6 +1,6 @@
  13476. --- a/wpa_supplicant/wpa_supplicant.c
  13477. +++ b/wpa_supplicant/wpa_supplicant.c
  13478. -@@ -252,9 +252,10 @@ void wpa_supplicant_cancel_auth_timeout(
  13479. +@@ -257,9 +257,10 @@ void wpa_supplicant_cancel_auth_timeout(
  13480. */
  13481. void wpa_supplicant_initiate_eapol(struct wpa_supplicant *wpa_s)
  13482. {
  13483. 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
  13484. index 6337d8d..fdd5da9 100644
  13485. --- a/package/network/services/hostapd/patches/140-disable_bridge_packet_workaround.patch
  13486. +++ b/package/network/services/hostapd/patches/140-disable_bridge_packet_workaround.patch
  13487. @@ -1,6 +1,6 @@
  13488. --- a/src/l2_packet/l2_packet_linux.c
  13489. +++ b/src/l2_packet/l2_packet_linux.c
  13490. -@@ -307,8 +307,7 @@ struct l2_packet_data * l2_packet_init_b
  13491. +@@ -337,8 +337,7 @@ struct l2_packet_data * l2_packet_init_b
  13492. l2 = l2_packet_init(br_ifname, own_addr, protocol, rx_callback,
  13493. rx_callback_ctx, l2_hdr);
  13494. @@ -8,5 +8,5 @@
  13495. - return NULL;
  13496. + return l2;
  13497. + #ifndef CONFIG_NO_LINUX_PACKET_SOCKET_WAR
  13498. /*
  13499. - * The Linux packet socket behavior has changed over the years and there
  13500. 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
  13501. deleted file mode 100644
  13502. index 66c682f..0000000
  13503. --- a/package/network/services/hostapd/patches/150-nl80211-Report-disassociated-STA-lost-peer-for-the-c.patch
  13504. +++ /dev/null
  13505. @@ -1,67 +0,0 @@
  13506. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  13507. -Date: Mon, 11 Jan 2016 19:18:06 +0100
  13508. -Subject: [PATCH] nl80211: Report disassociated STA / lost peer for the correct
  13509. - BSS
  13510. -MIME-Version: 1.0
  13511. -Content-Type: text/plain; charset=UTF-8
  13512. -Content-Transfer-Encoding: 8bit
  13513. -
  13514. -We shouldn't use drv->ctx as it always points to the first BSS. When
  13515. -using FullMAC driver with multi-BSS support it resulted in incorrect
  13516. -treating nl80211 events. I noticed with with brcmfmac and BCM43602.
  13517. -
  13518. -Before my change I was getting "disassociated" on a wrong interface:
  13519. -wlan0-1: STA 78:d6:f0:00:11:22 IEEE 802.11: associated
  13520. -wlan0-1: STA 78:d6:f0:00:11:22 WPA: pairwise key handshake completed (RSN)
  13521. -wlan0: STA 78:d6:f0:00:11:22 IEEE 802.11: disassociated
  13522. -
  13523. -With this patch it works as expected:
  13524. -wlan0-1: STA 78:d6:f0:00:11:22 IEEE 802.11: associated
  13525. -wlan0-1: STA 78:d6:f0:00:11:22 WPA: pairwise key handshake completed (RSN)
  13526. -wlan0-1: STA 78:d6:f0:00:11:22 IEEE 802.11: disassociated
  13527. -
  13528. -This doesn't apply to hostapd dealing with SoftMAC drivers when handling
  13529. -AP SME & MLME is done it hostapd not the firmware.
  13530. -
  13531. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  13532. ----
  13533. - src/drivers/driver_nl80211_event.c | 7 ++++---
  13534. - 1 file changed, 4 insertions(+), 3 deletions(-)
  13535. -
  13536. ---- a/src/drivers/driver_nl80211_event.c
  13537. -+++ b/src/drivers/driver_nl80211_event.c
  13538. -@@ -1154,6 +1154,7 @@ static void nl80211_new_station_event(st
  13539. -
  13540. -
  13541. - static void nl80211_del_station_event(struct wpa_driver_nl80211_data *drv,
  13542. -+ struct i802_bss *bss,
  13543. - struct nlattr **tb)
  13544. - {
  13545. - u8 *addr;
  13546. -@@ -1166,7 +1167,7 @@ static void nl80211_del_station_event(st
  13547. - MAC2STR(addr));
  13548. -
  13549. - if (is_ap_interface(drv->nlmode) && drv->device_ap_sme) {
  13550. -- drv_event_disassoc(drv->ctx, addr);
  13551. -+ drv_event_disassoc(bss->ctx, addr);
  13552. - return;
  13553. - }
  13554. -
  13555. -@@ -1175,7 +1176,7 @@ static void nl80211_del_station_event(st
  13556. -
  13557. - os_memset(&data, 0, sizeof(data));
  13558. - os_memcpy(data.ibss_peer_lost.peer, addr, ETH_ALEN);
  13559. -- wpa_supplicant_event(drv->ctx, EVENT_IBSS_PEER_LOST, &data);
  13560. -+ wpa_supplicant_event(bss->ctx, EVENT_IBSS_PEER_LOST, &data);
  13561. - }
  13562. -
  13563. -
  13564. -@@ -1939,7 +1940,7 @@ static void do_process_drv_event(struct
  13565. - nl80211_new_station_event(drv, bss, tb);
  13566. - break;
  13567. - case NL80211_CMD_DEL_STATION:
  13568. -- nl80211_del_station_event(drv, tb);
  13569. -+ nl80211_del_station_event(drv, bss, tb);
  13570. - break;
  13571. - case NL80211_CMD_SET_REKEY_OFFLOAD:
  13572. - nl80211_rekey_offload_event(drv, tb);
  13573. diff --git a/package/network/services/hostapd/patches/200-multicall.patch b/package/network/services/hostapd/patches/200-multicall.patch
  13574. index de4a3a8..8b260c2 100644
  13575. --- a/package/network/services/hostapd/patches/200-multicall.patch
  13576. +++ b/package/network/services/hostapd/patches/200-multicall.patch
  13577. @@ -1,15 +1,25 @@
  13578. --- a/hostapd/Makefile
  13579. +++ b/hostapd/Makefile
  13580. -@@ -17,6 +17,7 @@ export BINDIR ?= /usr/local/bin/
  13581. - # CFLAGS += -DUSE_KERNEL_HEADERS -I/usr/src/linux/include
  13582. +@@ -28,6 +28,7 @@ CFLAGS += -I$(abspath ../src/utils)
  13583. + export BINDIR ?= /usr/local/bin/
  13584. -include .config
  13585. +-include $(if $(MULTICALL), ../wpa_supplicant/.config)
  13586. - ifdef CONFIG_TESTING_OPTIONS
  13587. - CFLAGS += -DCONFIG_TESTING_OPTIONS
  13588. -@@ -242,10 +243,14 @@ ifdef CONFIG_IEEE80211AC
  13589. - CFLAGS += -DCONFIG_IEEE80211AC
  13590. + ifndef CONFIG_NO_GITVER
  13591. + # Add VERSION_STR postfix for builds from a git repository
  13592. +@@ -190,7 +191,8 @@ endif
  13593. +
  13594. + ifdef CONFIG_NO_VLAN
  13595. + CFLAGS += -DCONFIG_NO_VLAN
  13596. +-else
  13597. ++endif
  13598. ++ifneq ($(findstring CONFIG_NO_VLAN,$(CFLAGS)), CONFIG_NO_VLAN)
  13599. + OBJS += ../src/ap/vlan_init.o
  13600. + OBJS += ../src/ap/vlan_ifconfig.o
  13601. + OBJS += ../src/ap/vlan.o
  13602. +@@ -315,10 +317,14 @@ CFLAGS += -DCONFIG_MBO
  13603. + OBJS += ../src/ap/mbo_ap.o
  13604. endif
  13605. +ifndef MULTICALL
  13606. @@ -26,7 +36,7 @@
  13607. LIBS += $(DRV_AP_LIBS)
  13608. ifdef CONFIG_L2_PACKET
  13609. -@@ -941,6 +946,12 @@ install: $(addprefix $(DESTDIR)$(BINDIR)
  13610. +@@ -1051,6 +1057,12 @@ install: $(addprefix $(DESTDIR)$(BINDIR)
  13611. BCHECK=../src/drivers/build.hostapd
  13612. @@ -39,7 +49,7 @@
  13613. hostapd: $(BCHECK) $(OBJS)
  13614. $(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS)
  13615. @$(E) " LD " $@
  13616. -@@ -980,6 +991,12 @@ HOBJS += ../src/crypto/aes-internal.o
  13617. +@@ -1092,6 +1104,12 @@ HOBJS += ../src/crypto/aes-internal.o
  13618. HOBJS += ../src/crypto/aes-internal-enc.o
  13619. endif
  13620. @@ -54,15 +64,25 @@
  13621. @$(E) " LD " $@
  13622. --- a/wpa_supplicant/Makefile
  13623. +++ b/wpa_supplicant/Makefile
  13624. -@@ -15,6 +15,7 @@ CFLAGS += -I$(abspath ../src)
  13625. +@@ -27,6 +27,7 @@ CFLAGS += -I$(abspath ../src)
  13626. CFLAGS += -I$(abspath ../src/utils)
  13627. -include .config
  13628. +-include $(if $(MULTICALL),../hostapd/.config)
  13629. - ifdef CONFIG_TESTING_OPTIONS
  13630. - CFLAGS += -DCONFIG_TESTING_OPTIONS
  13631. -@@ -773,6 +774,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS
  13632. + ifndef CONFIG_NO_GITVER
  13633. + # Add VERSION_STR postfix for builds from a git repository
  13634. +@@ -312,7 +313,9 @@ endif
  13635. + ifdef CONFIG_IBSS_RSN
  13636. + NEED_RSN_AUTHENTICATOR=y
  13637. + CFLAGS += -DCONFIG_IBSS_RSN
  13638. ++ifndef MULTICALL
  13639. + CFLAGS += -DCONFIG_NO_VLAN
  13640. ++endif
  13641. + OBJS += ibss_rsn.o
  13642. + endif
  13643. +
  13644. +@@ -803,6 +806,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS
  13645. CFLAGS += -DCONFIG_DYNAMIC_EAP_METHODS
  13646. LIBS += -ldl -rdynamic
  13647. endif
  13648. @@ -73,7 +93,7 @@
  13649. endif
  13650. ifdef CONFIG_MACSEC
  13651. -@@ -793,9 +798,11 @@ NEED_EAP_COMMON=y
  13652. +@@ -823,9 +830,11 @@ NEED_EAP_COMMON=y
  13653. NEED_RSN_AUTHENTICATOR=y
  13654. CFLAGS += -DCONFIG_AP
  13655. OBJS += ap.o
  13656. @@ -85,7 +105,7 @@
  13657. OBJS += ../src/ap/hostapd.o
  13658. OBJS += ../src/ap/wpa_auth_glue.o
  13659. OBJS += ../src/ap/utils.o
  13660. -@@ -858,10 +865,18 @@ endif
  13661. +@@ -898,10 +907,18 @@ endif
  13662. ifdef CONFIG_HS20
  13663. OBJS += ../src/ap/hs20.o
  13664. endif
  13665. @@ -104,7 +124,7 @@
  13666. NEED_AES_WRAP=y
  13667. OBJS += ../src/ap/wpa_auth.o
  13668. OBJS += ../src/ap/wpa_auth_ie.o
  13669. -@@ -1603,6 +1618,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv)
  13670. +@@ -1680,6 +1697,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv)
  13671. $(OBJS_c) $(OBJS_t) $(OBJS_t2) $(OBJS) $(BCHECK) $(EXTRA_progs): .config
  13672. @@ -117,8 +137,8 @@
  13673. wpa_supplicant: $(BCHECK) $(OBJS) $(EXTRA_progs)
  13674. $(Q)$(LDO) $(LDFLAGS) -o wpa_supplicant $(OBJS) $(LIBS) $(EXTRALIBS)
  13675. @$(E) " LD " $@
  13676. -@@ -1694,6 +1715,12 @@ endif
  13677. - $(Q)sed -e 's|\@BINDIR\@|$(BINDIR)|g' $< >$@
  13678. +@@ -1782,6 +1805,12 @@ endif
  13679. + -e 's|\@DBUS_INTERFACE\@|$(DBUS_INTERFACE)|g' $< >$@
  13680. @$(E) " sed" $<
  13681. +dump_cflags:
  13682. @@ -132,7 +152,7 @@
  13683. wpa_cli.exe: wpa_cli
  13684. --- a/src/drivers/driver.h
  13685. +++ b/src/drivers/driver.h
  13686. -@@ -4581,8 +4581,8 @@ union wpa_event_data {
  13687. +@@ -4794,8 +4794,8 @@ union wpa_event_data {
  13688. * Driver wrapper code should call this function whenever an event is received
  13689. * from the driver.
  13690. */
  13691. @@ -141,11 +161,20 @@
  13692. +extern void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event,
  13693. + union wpa_event_data *data);
  13694. + /**
  13695. + * wpa_supplicant_event_global - Report a driver event for wpa_supplicant
  13696. +@@ -4807,7 +4807,7 @@ void wpa_supplicant_event(void *ctx, enu
  13697. + * Same as wpa_supplicant_event(), but we search for the interface in
  13698. + * wpa_global.
  13699. + */
  13700. +-void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
  13701. ++extern void (*wpa_supplicant_event_global)(void *ctx, enum wpa_event_type event,
  13702. + union wpa_event_data *data);
  13703. /*
  13704. --- a/src/ap/drv_callbacks.c
  13705. +++ b/src/ap/drv_callbacks.c
  13706. -@@ -1075,8 +1075,8 @@ static void hostapd_event_dfs_cac_starte
  13707. +@@ -1157,8 +1157,8 @@ static void hostapd_event_dfs_cac_starte
  13708. #endif /* NEED_AP_MLME */
  13709. @@ -156,9 +185,18 @@
  13710. {
  13711. struct hostapd_data *hapd = ctx;
  13712. #ifndef CONFIG_NO_STDOUT_DEBUG
  13713. +@@ -1367,7 +1367,7 @@ void wpa_supplicant_event(void *ctx, enu
  13714. + }
  13715. +
  13716. +
  13717. +-void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
  13718. ++void hostapd_wpa_event_global(void *ctx, enum wpa_event_type event,
  13719. + union wpa_event_data *data)
  13720. + {
  13721. + struct hapd_interfaces *interfaces = ctx;
  13722. --- a/wpa_supplicant/wpa_priv.c
  13723. +++ b/wpa_supplicant/wpa_priv.c
  13724. -@@ -819,8 +819,8 @@ static void wpa_priv_send_ft_response(st
  13725. +@@ -940,8 +940,8 @@ static void wpa_priv_send_ft_response(st
  13726. }
  13727. @@ -169,17 +207,27 @@
  13728. {
  13729. struct wpa_priv_interface *iface = ctx;
  13730. -@@ -961,6 +961,7 @@ int main(int argc, char *argv[])
  13731. +@@ -1010,7 +1010,7 @@ void wpa_supplicant_event(void *ctx, enu
  13732. + }
  13733. +
  13734. +
  13735. +-void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
  13736. ++void supplicant_event_global(void *ctx, enum wpa_event_type event,
  13737. + union wpa_event_data *data)
  13738. + {
  13739. + struct wpa_priv_global *global = ctx;
  13740. +@@ -1122,6 +1122,8 @@ int main(int argc, char *argv[])
  13741. if (os_program_init())
  13742. return -1;
  13743. + wpa_supplicant_event = supplicant_event;
  13744. ++ wpa_supplicant_event_global = supplicant_event_global;
  13745. wpa_priv_fd_workaround();
  13746. - for (;;) {
  13747. + os_memset(&global, 0, sizeof(global));
  13748. --- a/wpa_supplicant/events.c
  13749. +++ b/wpa_supplicant/events.c
  13750. -@@ -3138,8 +3138,8 @@ static void wpa_supplicant_event_assoc_a
  13751. +@@ -3384,8 +3384,8 @@ static void wpa_supplicant_event_assoc_a
  13752. }
  13753. @@ -189,88 +237,125 @@
  13754. + union wpa_event_data *data)
  13755. {
  13756. struct wpa_supplicant *wpa_s = ctx;
  13757. + int resched;
  13758. +@@ -4051,7 +4051,7 @@ void wpa_supplicant_event(void *ctx, enu
  13759. + #endif /* CONFIG_AP */
  13760. + break;
  13761. + case EVENT_ACS_CHANNEL_SELECTED:
  13762. +-#ifdef CONFIG_ACS
  13763. ++#if defined(CONFIG_ACS) && defined(CONFIG_AP)
  13764. + if (!wpa_s->ap_iface)
  13765. + break;
  13766. + hostapd_acs_channel_selected(wpa_s->ap_iface->bss[0],
  13767. +@@ -4065,7 +4065,7 @@ void wpa_supplicant_event(void *ctx, enu
  13768. + }
  13769. +
  13770. +-void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
  13771. ++void supplicant_event_global(void *ctx, enum wpa_event_type event,
  13772. + union wpa_event_data *data)
  13773. + {
  13774. + struct wpa_supplicant *wpa_s;
  13775. --- a/wpa_supplicant/wpa_supplicant.c
  13776. +++ b/wpa_supplicant/wpa_supplicant.c
  13777. -@@ -4300,6 +4300,9 @@ static void wpa_supplicant_deinit_iface(
  13778. - os_free(wpa_s);
  13779. +@@ -4990,7 +4990,6 @@ struct wpa_interface * wpa_supplicant_ma
  13780. + return NULL;
  13781. }
  13782. +-
  13783. + /**
  13784. + * wpa_supplicant_match_existing - Match existing interfaces
  13785. + * @global: Pointer to global data from wpa_supplicant_init()
  13786. +@@ -5027,6 +5026,11 @@ static int wpa_supplicant_match_existing
  13787. +
  13788. + #endif /* CONFIG_MATCH_IFACE */
  13789. +
  13790. +extern void supplicant_event(void *ctx, enum wpa_event_type event,
  13791. + union wpa_event_data *data);
  13792. +
  13793. ++extern void supplicant_event_global(void *ctx, enum wpa_event_type event,
  13794. ++ union wpa_event_data *data);
  13795. /**
  13796. * wpa_supplicant_add_iface - Add a new network interface
  13797. -@@ -4526,6 +4529,7 @@ struct wpa_global * wpa_supplicant_init(
  13798. +@@ -5282,6 +5286,8 @@ struct wpa_global * wpa_supplicant_init(
  13799. #ifndef CONFIG_NO_WPA_MSG
  13800. wpa_msg_register_ifname_cb(wpa_supplicant_msg_ifname_cb);
  13801. #endif /* CONFIG_NO_WPA_MSG */
  13802. + wpa_supplicant_event = supplicant_event;
  13803. ++ wpa_supplicant_event_global = supplicant_event_global;
  13804. if (params->wpa_debug_file_path)
  13805. wpa_debug_open_file(params->wpa_debug_file_path);
  13806. --- a/hostapd/main.c
  13807. +++ b/hostapd/main.c
  13808. -@@ -511,6 +511,9 @@ static int hostapd_get_ctrl_iface_group(
  13809. - return 0;
  13810. +@@ -583,6 +583,11 @@ fail:
  13811. + return -1;
  13812. }
  13813. +void hostapd_wpa_event(void *ctx, enum wpa_event_type event,
  13814. + union wpa_event_data *data);
  13815. +
  13816. ++void hostapd_wpa_event_global(void *ctx, enum wpa_event_type event,
  13817. ++ union wpa_event_data *data);
  13818. #ifdef CONFIG_WPS
  13819. static int gen_uuid(const char *txt_addr)
  13820. -@@ -562,6 +565,7 @@ int main(int argc, char *argv[])
  13821. - interfaces.global_iface_name = NULL;
  13822. +@@ -660,6 +665,8 @@ int main(int argc, char *argv[])
  13823. interfaces.global_ctrl_sock = -1;
  13824. + dl_list_init(&interfaces.global_ctrl_dst);
  13825. + wpa_supplicant_event = hostapd_wpa_event;
  13826. ++ wpa_supplicant_event_global = hostapd_wpa_event_global;
  13827. for (;;) {
  13828. - c = getopt(argc, argv, "b:Bde:f:hKP:Ttu:vg:G:");
  13829. + c = getopt(argc, argv, "b:Bde:f:hi:KP:STtu:vg:G:");
  13830. if (c < 0)
  13831. --- a/src/drivers/drivers.c
  13832. +++ b/src/drivers/drivers.c
  13833. -@@ -10,6 +10,9 @@
  13834. +@@ -10,6 +10,11 @@
  13835. #include "utils/common.h"
  13836. #include "driver.h"
  13837. +void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event,
  13838. + union wpa_event_data *data);
  13839. ++void (*wpa_supplicant_event_global)(void *ctx, enum wpa_event_type event,
  13840. ++ union wpa_event_data *data);
  13841. +
  13842. #ifdef CONFIG_DRIVER_WEXT
  13843. extern struct wpa_driver_ops wpa_driver_wext_ops; /* driver_wext.c */
  13844. #endif /* CONFIG_DRIVER_WEXT */
  13845. --- a/wpa_supplicant/eapol_test.c
  13846. +++ b/wpa_supplicant/eapol_test.c
  13847. -@@ -28,8 +28,12 @@
  13848. +@@ -29,7 +29,12 @@
  13849. #include "ctrl_iface.h"
  13850. #include "pcsc_funcs.h"
  13851. #include "wpas_glue.h"
  13852. +#include "drivers/driver.h"
  13853. -
  13854. +void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event,
  13855. + union wpa_event_data *data);
  13856. -+
  13857. - struct wpa_driver_ops *wpa_drivers[] = { NULL };
  13858. ++void (*wpa_supplicant_event_global)(void *ctx, enum wpa_event_type event,
  13859. ++ union wpa_event_data *data);
  13860. + const struct wpa_driver_ops *const wpa_drivers[] = { NULL };
  13861. -@@ -1203,6 +1207,8 @@ static void usage(void)
  13862. +@@ -1295,6 +1300,10 @@ static void usage(void)
  13863. "option several times.\n");
  13864. }
  13865. +extern void supplicant_event(void *ctx, enum wpa_event_type event,
  13866. + union wpa_event_data *data);
  13867. ++extern void supplicant_event_global(void *ctx, enum wpa_event_type event,
  13868. ++ union wpa_event_data *data);
  13869. int main(int argc, char *argv[])
  13870. {
  13871. -@@ -1221,6 +1227,7 @@ int main(int argc, char *argv[])
  13872. +@@ -1315,6 +1324,8 @@ int main(int argc, char *argv[])
  13873. if (os_program_init())
  13874. return -1;
  13875. + wpa_supplicant_event = supplicant_event;
  13876. ++ wpa_supplicant_event_global = supplicant_event_global;
  13877. hostapd_logger_register_cb(hostapd_logger_cb);
  13878. os_memset(&eapol_test, 0, sizeof(eapol_test));
  13879. diff --git a/package/network/services/hostapd/patches/300-noscan.patch b/package/network/services/hostapd/patches/300-noscan.patch
  13880. index 57d8fe2..21d6316 100644
  13881. --- a/package/network/services/hostapd/patches/300-noscan.patch
  13882. +++ b/package/network/services/hostapd/patches/300-noscan.patch
  13883. @@ -1,6 +1,6 @@
  13884. --- a/hostapd/config_file.c
  13885. +++ b/hostapd/config_file.c
  13886. -@@ -2771,6 +2771,10 @@ static int hostapd_config_fill(struct ho
  13887. +@@ -2862,6 +2862,10 @@ static int hostapd_config_fill(struct ho
  13888. }
  13889. #endif /* CONFIG_IEEE80211W */
  13890. #ifdef CONFIG_IEEE80211N
  13891. @@ -13,7 +13,7 @@
  13892. } else if (os_strcmp(buf, "ht_capab") == 0) {
  13893. --- a/src/ap/ap_config.h
  13894. +++ b/src/ap/ap_config.h
  13895. -@@ -619,6 +619,8 @@ struct hostapd_config {
  13896. +@@ -655,6 +655,8 @@ struct hostapd_config {
  13897. int ht_op_mode_fixed;
  13898. u16 ht_capab;
  13899. @@ -21,21 +21,22 @@
  13900. + int no_ht_coex;
  13901. int ieee80211n;
  13902. int secondary_channel;
  13903. - int require_ht;
  13904. + int no_pri_sec_switch;
  13905. --- a/src/ap/hw_features.c
  13906. +++ b/src/ap/hw_features.c
  13907. -@@ -461,7 +461,7 @@ static int ieee80211n_check_40mhz(struct
  13908. - struct wpa_driver_scan_params params;
  13909. +@@ -474,7 +474,8 @@ static int ieee80211n_check_40mhz(struct
  13910. int ret;
  13911. -- if (!iface->conf->secondary_channel)
  13912. -+ if (!iface->conf->secondary_channel || iface->conf->noscan)
  13913. - return 0; /* HT40 not used */
  13914. + /* Check that HT40 is used and PRI / SEC switch is allowed */
  13915. +- if (!iface->conf->secondary_channel || iface->conf->no_pri_sec_switch)
  13916. ++ if (!iface->conf->secondary_channel || iface->conf->no_pri_sec_switch ||
  13917. ++ iface->conf->noscan)
  13918. + return 0;
  13919. hostapd_set_state(iface, HAPD_IFACE_HT_SCAN);
  13920. --- a/src/ap/ieee802_11_ht.c
  13921. +++ b/src/ap/ieee802_11_ht.c
  13922. -@@ -221,6 +221,9 @@ void hostapd_2040_coex_action(struct hos
  13923. +@@ -244,6 +244,9 @@ void hostapd_2040_coex_action(struct hos
  13924. if (!(iface->conf->ht_capab & HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET))
  13925. return;
  13926. @@ -45,7 +46,7 @@
  13927. if (len < IEEE80211_HDRLEN + 2 + sizeof(*bc_ie))
  13928. return;
  13929. -@@ -346,6 +349,9 @@ void ht40_intolerant_add(struct hostapd_
  13930. +@@ -368,6 +371,9 @@ void ht40_intolerant_add(struct hostapd_
  13931. if (iface->current_mode->mode != HOSTAPD_MODE_IEEE80211G)
  13932. return;
  13933. diff --git a/package/network/services/hostapd/patches/310-rescan_immediately.patch b/package/network/services/hostapd/patches/310-rescan_immediately.patch
  13934. index 7be8c32..3f46cc4 100644
  13935. --- a/package/network/services/hostapd/patches/310-rescan_immediately.patch
  13936. +++ b/package/network/services/hostapd/patches/310-rescan_immediately.patch
  13937. @@ -1,6 +1,6 @@
  13938. --- a/wpa_supplicant/wpa_supplicant.c
  13939. +++ b/wpa_supplicant/wpa_supplicant.c
  13940. -@@ -3249,7 +3249,7 @@ wpa_supplicant_alloc(struct wpa_supplica
  13941. +@@ -3556,7 +3556,7 @@ wpa_supplicant_alloc(struct wpa_supplica
  13942. if (wpa_s == NULL)
  13943. return NULL;
  13944. wpa_s->scan_req = INITIAL_SCAN_REQ;
  13945. @@ -8,4 +8,4 @@
  13946. + wpa_s->scan_interval = 1;
  13947. wpa_s->new_connection = 1;
  13948. wpa_s->parent = parent ? parent : wpa_s;
  13949. - wpa_s->sched_scanning = 0;
  13950. + wpa_s->p2pdev = wpa_s->parent;
  13951. diff --git a/package/network/services/hostapd/patches/320-optional_rfkill.patch b/package/network/services/hostapd/patches/320-optional_rfkill.patch
  13952. index 75b4b07..cf2a2c1 100644
  13953. --- a/package/network/services/hostapd/patches/320-optional_rfkill.patch
  13954. +++ b/package/network/services/hostapd/patches/320-optional_rfkill.patch
  13955. @@ -1,14 +1,14 @@
  13956. --- a/src/drivers/drivers.mak
  13957. +++ b/src/drivers/drivers.mak
  13958. -@@ -34,7 +34,6 @@ NEED_SME=y
  13959. +@@ -36,7 +36,6 @@ NEED_SME=y
  13960. NEED_AP_MLME=y
  13961. NEED_NETLINK=y
  13962. NEED_LINUX_IOCTL=y
  13963. -NEED_RFKILL=y
  13964. + NEED_RADIOTAP=y
  13965. ifdef CONFIG_LIBNL32
  13966. - DRV_LIBS += -lnl-3
  13967. -@@ -116,7 +115,6 @@ DRV_WPA_CFLAGS += -DCONFIG_DRIVER_WEXT
  13968. +@@ -123,7 +122,6 @@ DRV_WPA_CFLAGS += -DCONFIG_DRIVER_WEXT
  13969. CONFIG_WIRELESS_EXTENSION=y
  13970. NEED_NETLINK=y
  13971. NEED_LINUX_IOCTL=y
  13972. @@ -16,7 +16,7 @@
  13973. endif
  13974. ifdef CONFIG_DRIVER_NDIS
  13975. -@@ -142,7 +140,6 @@ endif
  13976. +@@ -149,7 +147,6 @@ endif
  13977. ifdef CONFIG_WIRELESS_EXTENSION
  13978. DRV_WPA_CFLAGS += -DCONFIG_WIRELESS_EXTENSION
  13979. DRV_WPA_OBJS += ../src/drivers/driver_wext.o
  13980. @@ -24,14 +24,14 @@
  13981. endif
  13982. ifdef NEED_NETLINK
  13983. -@@ -155,6 +152,7 @@ endif
  13984. +@@ -162,6 +159,7 @@ endif
  13985. ifdef NEED_RFKILL
  13986. DRV_OBJS += ../src/drivers/rfkill.o
  13987. +DRV_WPA_CFLAGS += -DCONFIG_RFKILL
  13988. endif
  13989. - ifdef CONFIG_VLAN_NETLINK
  13990. + ifdef NEED_RADIOTAP
  13991. --- a/src/drivers/rfkill.h
  13992. +++ b/src/drivers/rfkill.h
  13993. @@ -18,8 +18,24 @@ struct rfkill_config {
  13994. 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
  13995. index dd90877..ca46012 100644
  13996. --- a/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch
  13997. +++ b/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch
  13998. @@ -1,6 +1,6 @@
  13999. --- a/src/drivers/driver_nl80211.c
  14000. +++ b/src/drivers/driver_nl80211.c
  14001. -@@ -3616,7 +3616,7 @@ static int nl80211_set_channel(struct i8
  14002. +@@ -3795,7 +3795,7 @@ static int nl80211_set_channel(struct i8
  14003. freq->freq, freq->ht_enabled, freq->vht_enabled,
  14004. freq->bandwidth, freq->center_freq1, freq->center_freq2);
  14005. diff --git a/package/network/services/hostapd/patches/340-reload_freq_change.patch b/package/network/services/hostapd/patches/340-reload_freq_change.patch
  14006. index 91b6196..086ade9 100644
  14007. --- a/package/network/services/hostapd/patches/340-reload_freq_change.patch
  14008. +++ b/package/network/services/hostapd/patches/340-reload_freq_change.patch
  14009. @@ -1,6 +1,6 @@
  14010. --- a/src/ap/hostapd.c
  14011. +++ b/src/ap/hostapd.c
  14012. -@@ -76,6 +76,16 @@ static void hostapd_reload_bss(struct ho
  14013. +@@ -80,6 +80,16 @@ static void hostapd_reload_bss(struct ho
  14014. #endif /* CONFIG_NO_RADIUS */
  14015. ssid = &hapd->conf->ssid;
  14016. @@ -17,7 +17,7 @@
  14017. if (!ssid->wpa_psk_set && ssid->wpa_psk && !ssid->wpa_psk->next &&
  14018. ssid->wpa_passphrase_set && ssid->wpa_passphrase) {
  14019. /*
  14020. -@@ -175,21 +185,12 @@ int hostapd_reload_config(struct hostapd
  14021. +@@ -179,21 +189,12 @@ int hostapd_reload_config(struct hostapd
  14022. oldconf = hapd->iconf;
  14023. iface->conf = newconf;
  14024. 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
  14025. index a14fa03..247f154 100644
  14026. --- a/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch
  14027. +++ b/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch
  14028. @@ -1,6 +1,6 @@
  14029. --- a/src/drivers/driver_nl80211.c
  14030. +++ b/src/drivers/driver_nl80211.c
  14031. -@@ -2254,13 +2254,18 @@ wpa_driver_nl80211_finish_drv_init(struc
  14032. +@@ -2394,13 +2394,18 @@ wpa_driver_nl80211_finish_drv_init(struc
  14033. }
  14034. @@ -22,7 +22,7 @@
  14035. return send_and_recv_msgs(drv, msg, NULL, NULL);
  14036. }
  14037. -@@ -2311,7 +2316,7 @@ static void wpa_driver_nl80211_deinit(st
  14038. +@@ -2452,7 +2457,7 @@ static void wpa_driver_nl80211_deinit(st
  14039. nl80211_remove_monitor_interface(drv);
  14040. if (is_ap_interface(drv->nlmode))
  14041. @@ -31,7 +31,7 @@
  14042. if (drv->eapol_sock >= 0) {
  14043. eloop_unregister_read_sock(drv->eapol_sock);
  14044. -@@ -4140,8 +4145,7 @@ static void nl80211_teardown_ap(struct i
  14045. +@@ -4385,8 +4390,7 @@ static void nl80211_teardown_ap(struct i
  14046. nl80211_remove_monitor_interface(drv);
  14047. else
  14048. nl80211_mgmt_unsubscribe(bss, "AP teardown");
  14049. @@ -41,7 +41,7 @@
  14050. }
  14051. -@@ -6066,8 +6070,6 @@ static int wpa_driver_nl80211_if_remove(
  14052. +@@ -6387,8 +6391,6 @@ static int wpa_driver_nl80211_if_remove(
  14053. } else {
  14054. wpa_printf(MSG_DEBUG, "nl80211: First BSS - reassign context");
  14055. nl80211_teardown_ap(bss);
  14056. @@ -50,7 +50,7 @@
  14057. nl80211_destroy_bss(bss);
  14058. if (!bss->added_if)
  14059. i802_set_iface_flags(bss, 0);
  14060. -@@ -6389,8 +6391,7 @@ static int wpa_driver_nl80211_deinit_ap(
  14061. +@@ -6750,8 +6752,7 @@ static int wpa_driver_nl80211_deinit_ap(
  14062. struct wpa_driver_nl80211_data *drv = bss->drv;
  14063. if (!is_ap_interface(drv->nlmode))
  14064. return -1;
  14065. @@ -60,7 +60,7 @@
  14066. /*
  14067. * If the P2P GO interface was dynamically added, then it is
  14068. -@@ -6409,8 +6410,7 @@ static int wpa_driver_nl80211_stop_ap(vo
  14069. +@@ -6770,8 +6771,7 @@ static int wpa_driver_nl80211_stop_ap(vo
  14070. struct wpa_driver_nl80211_data *drv = bss->drv;
  14071. if (!is_ap_interface(drv->nlmode))
  14072. return -1;
  14073. diff --git a/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch b/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch
  14074. index 06b005e..1e405cb 100644
  14075. --- a/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch
  14076. +++ b/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch
  14077. @@ -1,22 +1,22 @@
  14078. --- a/hostapd/ctrl_iface.c
  14079. +++ b/hostapd/ctrl_iface.c
  14080. -@@ -45,6 +45,7 @@
  14081. - #include "wps/wps.h"
  14082. +@@ -54,6 +54,7 @@
  14083. + #include "fst/fst_ctrl_iface.h"
  14084. #include "config_file.h"
  14085. #include "ctrl_iface.h"
  14086. +#include "config_file.h"
  14087. - struct wpa_ctrl_dst {
  14088. -@@ -55,6 +56,7 @@ struct wpa_ctrl_dst {
  14089. - int errors;
  14090. - };
  14091. + #define HOSTAPD_CLI_DUP_VALUE_MAX_LEN 256
  14092. +@@ -72,6 +73,7 @@ static void hostapd_ctrl_iface_send(stru
  14093. + enum wpa_msg_type type,
  14094. + const char *buf, size_t len);
  14095. +static char *reload_opts = NULL;
  14096. - static void hostapd_ctrl_iface_send(struct hostapd_data *hapd, int level,
  14097. - const char *buf, size_t len);
  14098. -@@ -164,6 +166,61 @@ static int hostapd_ctrl_iface_new_sta(st
  14099. + static int hostapd_ctrl_iface_attach(struct hostapd_data *hapd,
  14100. + struct sockaddr_storage *from,
  14101. +@@ -123,6 +125,61 @@ static int hostapd_ctrl_iface_new_sta(st
  14102. return 0;
  14103. }
  14104. @@ -78,7 +78,7 @@
  14105. #ifdef CONFIG_IEEE80211W
  14106. #ifdef NEED_AP_MLME
  14107. -@@ -2086,6 +2143,8 @@ static void hostapd_ctrl_iface_receive(i
  14108. +@@ -2483,6 +2540,8 @@ static int hostapd_ctrl_iface_receive_pr
  14109. } else if (os_strncmp(buf, "VENDOR ", 7) == 0) {
  14110. reply_len = hostapd_ctrl_iface_vendor(hapd, buf + 7, reply,
  14111. reply_size);
  14112. @@ -89,7 +89,7 @@
  14113. #ifdef RADIUS_SERVER
  14114. --- a/src/ap/ctrl_iface_ap.c
  14115. +++ b/src/ap/ctrl_iface_ap.c
  14116. -@@ -541,5 +541,11 @@ int hostapd_parse_csa_settings(const cha
  14117. +@@ -593,7 +593,13 @@ int hostapd_parse_csa_settings(const cha
  14118. int hostapd_ctrl_iface_stop_ap(struct hostapd_data *hapd)
  14119. {
  14120. @@ -102,3 +102,5 @@
  14121. +
  14122. + return 0;
  14123. }
  14124. +
  14125. +
  14126. diff --git a/package/network/services/hostapd/patches/370-ap_sta_support.patch b/package/network/services/hostapd/patches/370-ap_sta_support.patch
  14127. index ea235e6..7a4ba0b 100644
  14128. --- a/package/network/services/hostapd/patches/370-ap_sta_support.patch
  14129. +++ b/package/network/services/hostapd/patches/370-ap_sta_support.patch
  14130. @@ -1,6 +1,6 @@
  14131. --- a/wpa_supplicant/wpa_supplicant_i.h
  14132. +++ b/wpa_supplicant/wpa_supplicant_i.h
  14133. -@@ -110,6 +110,11 @@ struct wpa_interface {
  14134. +@@ -100,6 +100,11 @@ struct wpa_interface {
  14135. const char *ifname;
  14136. /**
  14137. @@ -12,8 +12,8 @@
  14138. * bridge_ifname - Optional bridge interface name
  14139. *
  14140. * If the driver interface (ifname) is included in a Linux bridge
  14141. -@@ -442,6 +447,8 @@ struct wpa_supplicant {
  14142. - #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
  14143. +@@ -484,6 +489,8 @@ struct wpa_supplicant {
  14144. + #endif /* CONFIG_CTRL_IFACE_BINDER */
  14145. char bridge_ifname[16];
  14146. + struct wpa_ctrl *hostapd;
  14147. @@ -23,7 +23,7 @@
  14148. --- a/wpa_supplicant/Makefile
  14149. +++ b/wpa_supplicant/Makefile
  14150. -@@ -14,6 +14,10 @@ CFLAGS += $(EXTRA_CFLAGS)
  14151. +@@ -26,6 +26,10 @@ CFLAGS += $(EXTRA_CFLAGS)
  14152. CFLAGS += -I$(abspath ../src)
  14153. CFLAGS += -I$(abspath ../src/utils)
  14154. @@ -34,7 +34,7 @@
  14155. -include .config
  14156. -include $(if $(MULTICALL),../hostapd/.config)
  14157. -@@ -84,6 +88,8 @@ OBJS_c += ../src/utils/wpa_debug.o
  14158. +@@ -113,6 +117,8 @@ OBJS_c += ../src/utils/wpa_debug.o
  14159. OBJS_c += ../src/utils/common.o
  14160. OBJS += wmm_ac.o
  14161. @@ -45,7 +45,7 @@
  14162. CONFIG_OS=win32
  14163. --- a/wpa_supplicant/wpa_supplicant.c
  14164. +++ b/wpa_supplicant/wpa_supplicant.c
  14165. -@@ -107,6 +107,55 @@ const char *wpa_supplicant_full_license5
  14166. +@@ -112,6 +112,55 @@ const char *const wpa_supplicant_full_li
  14167. "\n";
  14168. #endif /* CONFIG_NO_STDOUT_DEBUG */
  14169. @@ -73,7 +73,7 @@
  14170. + int ret;
  14171. +
  14172. + if (!bss)
  14173. -+ return;
  14174. ++ return -1;
  14175. +
  14176. + if (bss->ht_param & HT_INFO_HT_PARAM_STA_CHNL_WIDTH) {
  14177. + int sec = bss->ht_param & HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK;
  14178. @@ -101,7 +101,7 @@
  14179. /* Configure default/group WEP keys for static WEP */
  14180. int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
  14181. {
  14182. -@@ -743,8 +792,12 @@ void wpa_supplicant_set_state(struct wpa
  14183. +@@ -812,8 +861,12 @@ void wpa_supplicant_set_state(struct wpa
  14184. wpas_p2p_completed(wpa_s);
  14185. sme_sched_obss_scan(wpa_s, 1);
  14186. @@ -114,7 +114,7 @@
  14187. wpa_s->new_connection = 1;
  14188. wpa_drv_set_operstate(wpa_s, 0);
  14189. #ifndef IEEE8021X_EAPOL
  14190. -@@ -4038,6 +4091,20 @@ static int wpa_supplicant_init_iface(str
  14191. +@@ -4646,6 +4699,20 @@ static int wpa_supplicant_init_iface(str
  14192. sizeof(wpa_s->bridge_ifname));
  14193. }
  14194. @@ -135,7 +135,7 @@
  14195. /* RSNA Supplicant Key Management - INITIALIZE */
  14196. eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE);
  14197. eapol_sm_notify_portValid(wpa_s->eapol, FALSE);
  14198. -@@ -4280,6 +4347,11 @@ static void wpa_supplicant_deinit_iface(
  14199. +@@ -4937,6 +5004,11 @@ static void wpa_supplicant_deinit_iface(
  14200. if (terminate)
  14201. wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_TERMINATING);
  14202. @@ -157,7 +157,7 @@
  14203. #include "drivers/driver.h"
  14204. #include "wpa_supplicant_i.h"
  14205. #include "config.h"
  14206. -@@ -277,6 +278,10 @@ static void calculate_update_time(const
  14207. +@@ -287,6 +288,10 @@ static void calculate_update_time(const
  14208. static void wpa_bss_copy_res(struct wpa_bss *dst, struct wpa_scan_res *src,
  14209. struct os_reltime *fetch_time)
  14210. {
  14211. @@ -168,7 +168,7 @@
  14212. dst->flags = src->flags;
  14213. os_memcpy(dst->bssid, src->bssid, ETH_ALEN);
  14214. dst->freq = src->freq;
  14215. -@@ -289,6 +294,15 @@ static void wpa_bss_copy_res(struct wpa_
  14216. +@@ -299,6 +304,15 @@ static void wpa_bss_copy_res(struct wpa_
  14217. dst->est_throughput = src->est_throughput;
  14218. dst->snr = src->snr;
  14219. @@ -186,7 +186,7 @@
  14220. --- a/wpa_supplicant/main.c
  14221. +++ b/wpa_supplicant/main.c
  14222. -@@ -33,7 +33,7 @@ static void usage(void)
  14223. +@@ -34,7 +34,7 @@ static void usage(void)
  14224. "vW] [-P<pid file>] "
  14225. "[-g<global ctrl>] \\\n"
  14226. " [-G<group>] \\\n"
  14227. @@ -195,24 +195,24 @@
  14228. "[-p<driver_param>] \\\n"
  14229. " [-b<br_ifname>] [-e<entropy file>]"
  14230. #ifdef CONFIG_DEBUG_FILE
  14231. -@@ -84,6 +84,7 @@ static void usage(void)
  14232. - #endif /* CONFIG_DEBUG_LINUX_TRACING */
  14233. - printf(" -t = include timestamp in debug messages\n"
  14234. +@@ -74,6 +74,7 @@ static void usage(void)
  14235. + " -g = global ctrl_interface\n"
  14236. + " -G = global ctrl_interface group\n"
  14237. " -h = show this help text\n"
  14238. + " -H = connect to a hostapd instance to manage state changes\n"
  14239. - " -L = show license (BSD)\n"
  14240. - " -o = override driver parameter for new interfaces\n"
  14241. - " -O = override ctrl_interface parameter for new interfaces\n"
  14242. -@@ -175,7 +176,7 @@ int main(int argc, char *argv[])
  14243. + " -i = interface name\n"
  14244. + " -I = additional configuration file\n"
  14245. + " -K = include keys (passwords, etc.) in debug output\n"
  14246. +@@ -201,7 +202,7 @@ int main(int argc, char *argv[])
  14247. for (;;) {
  14248. c = getopt(argc, argv,
  14249. -- "b:Bc:C:D:de:f:g:G:hi:I:KLm:No:O:p:P:qsTtuvW");
  14250. -+ "b:Bc:C:D:de:f:g:G:hH:i:I:KLm:No:O:p:P:qsTtuvW");
  14251. +- "b:Bc:C:D:de:f:g:G:hi:I:KLMm:No:O:p:P:qsTtuvW");
  14252. ++ "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuvW");
  14253. if (c < 0)
  14254. break;
  14255. switch (c) {
  14256. -@@ -222,6 +223,9 @@ int main(int argc, char *argv[])
  14257. +@@ -248,6 +249,9 @@ int main(int argc, char *argv[])
  14258. usage();
  14259. exitcode = 0;
  14260. goto out;
  14261. @@ -224,8 +224,8 @@
  14262. break;
  14263. --- a/wpa_supplicant/bss.h
  14264. +++ b/wpa_supplicant/bss.h
  14265. -@@ -72,6 +72,10 @@ struct wpa_bss {
  14266. - u8 ssid[32];
  14267. +@@ -79,6 +79,10 @@ struct wpa_bss {
  14268. + u8 ssid[SSID_MAX_LEN];
  14269. /** Length of SSID */
  14270. size_t ssid_len;
  14271. + /** HT caapbilities */
  14272. 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
  14273. index 3a41b82..9e815e9 100644
  14274. --- a/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch
  14275. +++ b/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch
  14276. @@ -1,18 +1,18 @@
  14277. --- a/hostapd/Makefile
  14278. +++ b/hostapd/Makefile
  14279. -@@ -168,6 +168,9 @@ endif
  14280. +@@ -212,6 +212,9 @@ endif
  14281. ifdef CONFIG_NO_CTRL_IFACE
  14282. CFLAGS += -DCONFIG_NO_CTRL_IFACE
  14283. else
  14284. +ifdef CONFIG_CTRL_IFACE_MIB
  14285. +CFLAGS += -DCONFIG_CTRL_IFACE_MIB
  14286. +endif
  14287. - OBJS += ctrl_iface.o
  14288. - OBJS += ../src/ap/ctrl_iface_ap.o
  14289. - endif
  14290. + ifeq ($(CONFIG_CTRL_IFACE), udp)
  14291. + CFLAGS += -DCONFIG_CTRL_IFACE_UDP
  14292. + else
  14293. --- a/hostapd/ctrl_iface.c
  14294. +++ b/hostapd/ctrl_iface.c
  14295. -@@ -1953,6 +1953,7 @@ static void hostapd_ctrl_iface_receive(i
  14296. +@@ -2342,6 +2342,7 @@ static int hostapd_ctrl_iface_receive_pr
  14297. reply_size);
  14298. } else if (os_strcmp(buf, "STATUS-DRIVER") == 0) {
  14299. reply_len = hostapd_drv_status(hapd, reply, reply_size);
  14300. @@ -20,18 +20,18 @@
  14301. } else if (os_strcmp(buf, "MIB") == 0) {
  14302. reply_len = ieee802_11_get_mib(hapd, reply, reply_size);
  14303. if (reply_len >= 0) {
  14304. -@@ -1994,6 +1995,7 @@ static void hostapd_ctrl_iface_receive(i
  14305. +@@ -2383,6 +2384,7 @@ static int hostapd_ctrl_iface_receive_pr
  14306. } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) {
  14307. reply_len = hostapd_ctrl_iface_sta_next(hapd, buf + 9, reply,
  14308. reply_size);
  14309. +#endif
  14310. } else if (os_strcmp(buf, "ATTACH") == 0) {
  14311. - if (hostapd_ctrl_iface_attach(hapd, &from, fromlen))
  14312. + if (hostapd_ctrl_iface_attach(hapd, from, fromlen))
  14313. reply_len = -1;
  14314. --- a/wpa_supplicant/Makefile
  14315. +++ b/wpa_supplicant/Makefile
  14316. -@@ -837,6 +837,9 @@ ifdef CONFIG_WNM
  14317. - OBJS += ../src/ap/wnm_ap.o
  14318. +@@ -874,6 +874,9 @@ ifdef CONFIG_MBO
  14319. + OBJS += ../src/ap/mbo_ap.o
  14320. endif
  14321. ifdef CONFIG_CTRL_IFACE
  14322. +ifdef CONFIG_CTRL_IFACE_MIB
  14323. @@ -42,7 +42,7 @@
  14324. --- a/wpa_supplicant/ctrl_iface.c
  14325. +++ b/wpa_supplicant/ctrl_iface.c
  14326. -@@ -1795,7 +1795,7 @@ static int wpa_supplicant_ctrl_iface_sta
  14327. +@@ -1895,7 +1895,7 @@ static int wpa_supplicant_ctrl_iface_sta
  14328. pos += ret;
  14329. }
  14330. @@ -51,7 +51,7 @@
  14331. if (wpa_s->ap_iface) {
  14332. pos += ap_ctrl_iface_wpa_get_status(wpa_s, pos,
  14333. end - pos,
  14334. -@@ -7896,6 +7896,7 @@ char * wpa_supplicant_ctrl_iface_process
  14335. +@@ -8687,6 +8687,7 @@ char * wpa_supplicant_ctrl_iface_process
  14336. reply_len = -1;
  14337. } else if (os_strncmp(buf, "NOTE ", 5) == 0) {
  14338. wpa_printf(MSG_INFO, "NOTE: %s", buf + 5);
  14339. @@ -59,7 +59,7 @@
  14340. } else if (os_strcmp(buf, "MIB") == 0) {
  14341. reply_len = wpa_sm_get_mib(wpa_s->wpa, reply, reply_size);
  14342. if (reply_len >= 0) {
  14343. -@@ -7903,6 +7904,7 @@ char * wpa_supplicant_ctrl_iface_process
  14344. +@@ -8694,6 +8695,7 @@ char * wpa_supplicant_ctrl_iface_process
  14345. reply + reply_len,
  14346. reply_size - reply_len);
  14347. }
  14348. @@ -67,7 +67,7 @@
  14349. } else if (os_strncmp(buf, "STATUS", 6) == 0) {
  14350. reply_len = wpa_supplicant_ctrl_iface_status(
  14351. wpa_s, buf + 6, reply, reply_size);
  14352. -@@ -8353,6 +8355,7 @@ char * wpa_supplicant_ctrl_iface_process
  14353. +@@ -9164,6 +9166,7 @@ char * wpa_supplicant_ctrl_iface_process
  14354. reply_len = wpa_supplicant_ctrl_iface_bss(
  14355. wpa_s, buf + 4, reply, reply_size);
  14356. #ifdef CONFIG_AP
  14357. @@ -75,7 +75,7 @@
  14358. } else if (os_strcmp(buf, "STA-FIRST") == 0) {
  14359. reply_len = ap_ctrl_iface_sta_first(wpa_s, reply, reply_size);
  14360. } else if (os_strncmp(buf, "STA ", 4) == 0) {
  14361. -@@ -8361,12 +8364,15 @@ char * wpa_supplicant_ctrl_iface_process
  14362. +@@ -9172,12 +9175,15 @@ char * wpa_supplicant_ctrl_iface_process
  14363. } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) {
  14364. reply_len = ap_ctrl_iface_sta_next(wpa_s, buf + 9, reply,
  14365. reply_size);
  14366. @@ -93,15 +93,15 @@
  14367. reply_len = -1;
  14368. --- a/src/ap/ctrl_iface_ap.c
  14369. +++ b/src/ap/ctrl_iface_ap.c
  14370. -@@ -22,6 +22,7 @@
  14371. - #include "ctrl_iface_ap.h"
  14372. +@@ -24,6 +24,7 @@
  14373. #include "ap_drv_ops.h"
  14374. + #include "mbo_ap.h"
  14375. +#ifdef CONFIG_CTRL_IFACE_MIB
  14376. static int hostapd_get_sta_tx_rx(struct hostapd_data *hapd,
  14377. struct sta_info *sta,
  14378. -@@ -224,6 +225,7 @@ int hostapd_ctrl_iface_sta_next(struct h
  14379. +@@ -249,6 +250,7 @@ int hostapd_ctrl_iface_sta_next(struct h
  14380. return hostapd_ctrl_iface_sta_mib(hapd, sta->next, buf, buflen);
  14381. }
  14382. @@ -111,33 +111,33 @@
  14383. static int p2p_manager_disconnect(struct hostapd_data *hapd, u16 stype,
  14384. --- a/src/ap/ieee802_1x.c
  14385. +++ b/src/ap/ieee802_1x.c
  14386. -@@ -2337,6 +2337,7 @@ static const char * bool_txt(Boolean boo
  14387. - return bool_val ? "TRUE" : "FALSE";
  14388. +@@ -2441,6 +2441,7 @@ static const char * bool_txt(Boolean val
  14389. + return val ? "TRUE" : "FALSE";
  14390. }
  14391. +#ifdef CONFIG_CTRL_IFACE_MIB
  14392. int ieee802_1x_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen)
  14393. {
  14394. -@@ -2512,6 +2513,7 @@ int ieee802_1x_get_mib_sta(struct hostap
  14395. +@@ -2616,6 +2617,7 @@ int ieee802_1x_get_mib_sta(struct hostap
  14396. return len;
  14397. }
  14398. +#endif
  14399. - static void ieee802_1x_finished(struct hostapd_data *hapd,
  14400. - struct sta_info *sta, int success,
  14401. + #ifdef CONFIG_HS20
  14402. + static void ieee802_1x_wnm_notif_send(void *eloop_ctx, void *timeout_ctx)
  14403. --- a/src/ap/wpa_auth.c
  14404. +++ b/src/ap/wpa_auth.c
  14405. -@@ -2999,6 +2999,7 @@ static const char * wpa_bool_txt(int boo
  14406. - return bool ? "TRUE" : "FALSE";
  14407. +@@ -3069,6 +3069,7 @@ static const char * wpa_bool_txt(int val
  14408. + return val ? "TRUE" : "FALSE";
  14409. }
  14410. +#ifdef CONFIG_CTRL_IFACE_MIB
  14411. #define RSN_SUITE "%02x-%02x-%02x-%d"
  14412. #define RSN_SUITE_ARG(s) \
  14413. -@@ -3143,7 +3144,7 @@ int wpa_get_mib_sta(struct wpa_state_mac
  14414. +@@ -3213,7 +3214,7 @@ int wpa_get_mib_sta(struct wpa_state_mac
  14415. return len;
  14416. }
  14417. @@ -148,7 +148,7 @@
  14418. {
  14419. --- a/src/rsn_supp/wpa.c
  14420. +++ b/src/rsn_supp/wpa.c
  14421. -@@ -2032,6 +2032,8 @@ static u32 wpa_key_mgmt_suite(struct wpa
  14422. +@@ -2108,6 +2108,8 @@ static u32 wpa_key_mgmt_suite(struct wpa
  14423. }
  14424. @@ -157,7 +157,7 @@
  14425. #define RSN_SUITE "%02x-%02x-%02x-%d"
  14426. #define RSN_SUITE_ARG(s) \
  14427. ((s) >> 24) & 0xff, ((s) >> 16) & 0xff, ((s) >> 8) & 0xff, (s) & 0xff
  14428. -@@ -2115,6 +2117,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch
  14429. +@@ -2191,6 +2193,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch
  14430. return (int) len;
  14431. }
  14432. @@ -167,7 +167,7 @@
  14433. --- a/wpa_supplicant/ap.c
  14434. +++ b/wpa_supplicant/ap.c
  14435. -@@ -1015,7 +1015,7 @@ int wpas_ap_wps_nfc_report_handover(stru
  14436. +@@ -1114,7 +1114,7 @@ int wpas_ap_wps_nfc_report_handover(stru
  14437. #endif /* CONFIG_WPS */
  14438. 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
  14439. index 1065a7f..c9e7bf4 100644
  14440. --- a/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch
  14441. +++ b/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch
  14442. @@ -1,6 +1,6 @@
  14443. --- a/src/common/wpa_common.c
  14444. +++ b/src/common/wpa_common.c
  14445. -@@ -1228,6 +1228,31 @@ u32 wpa_akm_to_suite(int akm)
  14446. +@@ -1244,6 +1244,31 @@ u32 wpa_akm_to_suite(int akm)
  14447. }
  14448. @@ -32,7 +32,7 @@
  14449. int wpa_compare_rsn_ie(int ft_initial_assoc,
  14450. const u8 *ie1, size_t ie1len,
  14451. const u8 *ie2, size_t ie2len)
  14452. -@@ -1235,8 +1260,19 @@ int wpa_compare_rsn_ie(int ft_initial_as
  14453. +@@ -1251,8 +1276,19 @@ int wpa_compare_rsn_ie(int ft_initial_as
  14454. if (ie1 == NULL || ie2 == NULL)
  14455. return -1;
  14456. 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
  14457. index 083af5b..f5872cd 100644
  14458. --- a/package/network/services/hostapd/patches/400-wps_single_auth_enc_type.patch
  14459. +++ b/package/network/services/hostapd/patches/400-wps_single_auth_enc_type.patch
  14460. @@ -1,25 +1,22 @@
  14461. --- a/src/ap/wps_hostapd.c
  14462. +++ b/src/ap/wps_hostapd.c
  14463. -@@ -1052,11 +1052,9 @@ int hostapd_init_wps(struct hostapd_data
  14464. -
  14465. - if (conf->rsn_pairwise & (WPA_CIPHER_CCMP | WPA_CIPHER_GCMP))
  14466. +@@ -352,8 +352,7 @@ static int hapd_wps_reconfig_in_memory(s
  14467. + bss->wpa_pairwise |= WPA_CIPHER_GCMP;
  14468. + else
  14469. + bss->wpa_pairwise |= WPA_CIPHER_CCMP;
  14470. +- }
  14471. +- if (cred->encr_type & WPS_ENCR_TKIP)
  14472. ++ } else if (cred->encr_type & WPS_ENCR_TKIP)
  14473. + bss->wpa_pairwise |= WPA_CIPHER_TKIP;
  14474. + bss->rsn_pairwise = bss->wpa_pairwise;
  14475. + bss->wpa_group = wpa_select_ap_group_cipher(bss->wpa,
  14476. +@@ -1073,8 +1072,7 @@ int hostapd_init_wps(struct hostapd_data
  14477. + if (conf->rsn_pairwise & (WPA_CIPHER_CCMP | WPA_CIPHER_GCMP)) {
  14478. wps->encr_types |= WPS_ENCR_AES;
  14479. -- if (conf->rsn_pairwise & WPA_CIPHER_TKIP)
  14480. -+ else if (conf->rsn_pairwise & WPA_CIPHER_TKIP)
  14481. + wps->encr_types_rsn |= WPS_ENCR_AES;
  14482. +- }
  14483. +- if (conf->rsn_pairwise & WPA_CIPHER_TKIP) {
  14484. ++ } else if (conf->rsn_pairwise & WPA_CIPHER_TKIP) {
  14485. wps->encr_types |= WPS_ENCR_TKIP;
  14486. -- }
  14487. --
  14488. -- if (conf->wpa & WPA_PROTO_WPA) {
  14489. -+ } else if (conf->wpa & WPA_PROTO_WPA) {
  14490. - if (conf->wpa_key_mgmt & WPA_KEY_MGMT_PSK)
  14491. - wps->auth_types |= WPS_AUTH_WPAPSK;
  14492. - if (conf->wpa_key_mgmt & WPA_KEY_MGMT_IEEE8021X)
  14493. -@@ -1064,7 +1062,7 @@ int hostapd_init_wps(struct hostapd_data
  14494. -
  14495. - if (conf->wpa_pairwise & WPA_CIPHER_CCMP)
  14496. - wps->encr_types |= WPS_ENCR_AES;
  14497. -- if (conf->wpa_pairwise & WPA_CIPHER_TKIP)
  14498. -+ else if (conf->wpa_pairwise & WPA_CIPHER_TKIP)
  14499. - wps->encr_types |= WPS_ENCR_TKIP;
  14500. - }
  14501. -
  14502. + wps->encr_types_rsn |= WPS_ENCR_TKIP;
  14503. + }
  14504. diff --git a/package/network/services/hostapd/patches/410-limit_debug_messages.patch b/package/network/services/hostapd/patches/410-limit_debug_messages.patch
  14505. index da88732..a48b696 100644
  14506. --- a/package/network/services/hostapd/patches/410-limit_debug_messages.patch
  14507. +++ b/package/network/services/hostapd/patches/410-limit_debug_messages.patch
  14508. @@ -64,7 +64,7 @@
  14509. #ifdef CONFIG_DEBUG_FILE
  14510. static char *last_path = NULL;
  14511. #endif /* CONFIG_DEBUG_FILE */
  14512. -@@ -602,7 +576,7 @@ void wpa_msg_register_ifname_cb(wpa_msg_
  14513. +@@ -604,7 +578,7 @@ void wpa_msg_register_ifname_cb(wpa_msg_
  14514. }
  14515. @@ -73,7 +73,7 @@
  14516. {
  14517. va_list ap;
  14518. char *buf;
  14519. -@@ -640,7 +614,7 @@ void wpa_msg(void *ctx, int level, const
  14520. +@@ -642,7 +616,7 @@ void wpa_msg(void *ctx, int level, const
  14521. }
  14522. @@ -183,7 +183,7 @@
  14523. /*
  14524. * wpa_dbg() behaves like wpa_msg(), but it can be removed from build to reduce
  14525. -@@ -181,7 +222,12 @@ void wpa_hexdump_ascii_key(int level, co
  14526. +@@ -182,7 +223,12 @@ void wpa_hexdump_ascii_key(int level, co
  14527. *
  14528. * Note: New line '\n' is added to the end of the text when printing to stdout.
  14529. */
  14530. @@ -197,7 +197,7 @@
  14531. /**
  14532. * wpa_msg_ctrl - Conditional printf for ctrl_iface monitors
  14533. -@@ -195,8 +241,13 @@ void wpa_msg(void *ctx, int level, const
  14534. +@@ -196,8 +242,13 @@ void wpa_msg(void *ctx, int level, const
  14535. * attached ctrl_iface monitors. In other words, it can be used for frequent
  14536. * events that do not need to be sent to syslog.
  14537. */
  14538. diff --git a/package/network/services/hostapd/patches/420-indicate-features.patch b/package/network/services/hostapd/patches/420-indicate-features.patch
  14539. index 64c92df..335e71e 100644
  14540. --- a/package/network/services/hostapd/patches/420-indicate-features.patch
  14541. +++ b/package/network/services/hostapd/patches/420-indicate-features.patch
  14542. @@ -8,16 +8,16 @@
  14543. #include "crypto/random.h"
  14544. #include "crypto/tls.h"
  14545. #include "common/version.h"
  14546. -@@ -567,7 +568,7 @@ int main(int argc, char *argv[])
  14547. -
  14548. +@@ -668,7 +669,7 @@ int main(int argc, char *argv[])
  14549. wpa_supplicant_event = hostapd_wpa_event;
  14550. + wpa_supplicant_event_global = hostapd_wpa_event_global;
  14551. for (;;) {
  14552. -- c = getopt(argc, argv, "b:Bde:f:hKP:Ttu:vg:G:");
  14553. -+ c = getopt(argc, argv, "b:Bde:f:hKP:Ttu:g:G:v::");
  14554. +- c = getopt(argc, argv, "b:Bde:f:hi:KP:STtu:vg:G:");
  14555. ++ c = getopt(argc, argv, "b:Bde:f:hi:KP:STtu:g:G:v::");
  14556. if (c < 0)
  14557. break;
  14558. switch (c) {
  14559. -@@ -604,6 +605,8 @@ int main(int argc, char *argv[])
  14560. +@@ -705,6 +706,8 @@ int main(int argc, char *argv[])
  14561. break;
  14562. #endif /* CONFIG_DEBUG_LINUX_TRACING */
  14563. case 'v':
  14564. @@ -33,19 +33,19 @@
  14565. #include "common.h"
  14566. +#include "build_features.h"
  14567. + #include "fst/fst.h"
  14568. #include "wpa_supplicant_i.h"
  14569. #include "driver_i.h"
  14570. - #include "p2p_supplicant.h"
  14571. -@@ -176,7 +177,7 @@ int main(int argc, char *argv[])
  14572. +@@ -202,7 +203,7 @@ int main(int argc, char *argv[])
  14573. for (;;) {
  14574. c = getopt(argc, argv,
  14575. -- "b:Bc:C:D:de:f:g:G:hH:i:I:KLm:No:O:p:P:qsTtuvW");
  14576. -+ "b:Bc:C:D:de:f:g:G:hH:i:I:KLm:No:O:p:P:qsTtuv::W");
  14577. +- "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuvW");
  14578. ++ "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuv::W");
  14579. if (c < 0)
  14580. break;
  14581. switch (c) {
  14582. -@@ -279,8 +280,12 @@ int main(int argc, char *argv[])
  14583. +@@ -305,8 +306,12 @@ int main(int argc, char *argv[])
  14584. break;
  14585. #endif /* CONFIG_DBUS */
  14586. case 'v':
  14587. diff --git a/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch b/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch
  14588. index 85d2e16..d07b747 100644
  14589. --- a/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch
  14590. +++ b/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch
  14591. @@ -1,6 +1,6 @@
  14592. --- a/hostapd/hostapd_cli.c
  14593. +++ b/hostapd/hostapd_cli.c
  14594. -@@ -67,7 +67,6 @@ static const char *commands_help =
  14595. +@@ -69,7 +69,6 @@ static const char *const commands_help =
  14596. #ifdef CONFIG_IEEE80211W
  14597. " sa_query <addr> send SA Query to a station\n"
  14598. #endif /* CONFIG_IEEE80211W */
  14599. @@ -8,7 +8,7 @@
  14600. " wps_pin <uuid> <pin> [timeout] [addr] add WPS Enrollee PIN\n"
  14601. " wps_check_pin <PIN> verify PIN checksum\n"
  14602. " wps_pbc indicate button pushed to initiate PBC\n"
  14603. -@@ -80,7 +79,6 @@ static const char *commands_help =
  14604. +@@ -82,7 +81,6 @@ static const char *const commands_help =
  14605. " wps_ap_pin <cmd> [params..] enable/disable AP PIN\n"
  14606. " wps_config <SSID> <auth> <encr> <key> configure AP\n"
  14607. " wps_get_status show current WPS status\n"
  14608. @@ -16,7 +16,7 @@
  14609. " get_config show current configuration\n"
  14610. " help show this usage help\n"
  14611. " interface [ifname] show interfaces/select interface\n"
  14612. -@@ -353,7 +351,6 @@ static int hostapd_cli_cmd_sa_query(stru
  14613. +@@ -418,7 +416,6 @@ static int hostapd_cli_cmd_sa_query(stru
  14614. #endif /* CONFIG_IEEE80211W */
  14615. @@ -24,7 +24,7 @@
  14616. static int hostapd_cli_cmd_wps_pin(struct wpa_ctrl *ctrl, int argc,
  14617. char *argv[])
  14618. {
  14619. -@@ -579,7 +576,6 @@ static int hostapd_cli_cmd_wps_config(st
  14620. +@@ -644,7 +641,6 @@ static int hostapd_cli_cmd_wps_config(st
  14621. ssid_hex, argv[1]);
  14622. return wpa_ctrl_command(ctrl, buf);
  14623. }
  14624. @@ -32,7 +32,7 @@
  14625. static int hostapd_cli_cmd_disassoc_imminent(struct wpa_ctrl *ctrl, int argc,
  14626. -@@ -1027,7 +1023,6 @@ static struct hostapd_cli_cmd hostapd_cl
  14627. +@@ -1236,7 +1232,6 @@ static const struct hostapd_cli_cmd host
  14628. #ifdef CONFIG_IEEE80211W
  14629. { "sa_query", hostapd_cli_cmd_sa_query },
  14630. #endif /* CONFIG_IEEE80211W */
  14631. @@ -40,7 +40,7 @@
  14632. { "wps_pin", hostapd_cli_cmd_wps_pin },
  14633. { "wps_check_pin", hostapd_cli_cmd_wps_check_pin },
  14634. { "wps_pbc", hostapd_cli_cmd_wps_pbc },
  14635. -@@ -1041,7 +1036,6 @@ static struct hostapd_cli_cmd hostapd_cl
  14636. +@@ -1250,7 +1245,6 @@ static const struct hostapd_cli_cmd host
  14637. { "wps_ap_pin", hostapd_cli_cmd_wps_ap_pin },
  14638. { "wps_config", hostapd_cli_cmd_wps_config },
  14639. { "wps_get_status", hostapd_cli_cmd_wps_get_status },
  14640. diff --git a/package/network/services/hostapd/patches/431-wpa_cli_ifdef.patch b/package/network/services/hostapd/patches/431-wpa_cli_ifdef.patch
  14641. index 874ff4b..256f6b5 100644
  14642. --- a/package/network/services/hostapd/patches/431-wpa_cli_ifdef.patch
  14643. +++ b/package/network/services/hostapd/patches/431-wpa_cli_ifdef.patch
  14644. @@ -1,13 +1,12 @@
  14645. --- a/wpa_supplicant/wpa_cli.c
  14646. +++ b/wpa_supplicant/wpa_cli.c
  14647. -@@ -26,6 +26,10 @@
  14648. +@@ -25,6 +25,9 @@
  14649. + #include <cutils/properties.h>
  14650. #endif /* ANDROID */
  14651. -
  14652. +#ifndef CONFIG_P2P
  14653. +#define CONFIG_P2P
  14654. +#endif
  14655. -+
  14656. - static const char *wpa_cli_version =
  14657. +
  14658. + static const char *const wpa_cli_version =
  14659. "wpa_cli v" VERSION_STR "\n"
  14660. - "Copyright (c) 2004-2015, Jouni Malinen <j@w1.fi> and contributors";
  14661. diff --git a/package/network/services/hostapd/patches/432-missing-typedef.patch b/package/network/services/hostapd/patches/432-missing-typedef.patch
  14662. new file mode 100644
  14663. index 0000000..7a100f1
  14664. --- /dev/null
  14665. +++ b/package/network/services/hostapd/patches/432-missing-typedef.patch
  14666. @@ -0,0 +1,10 @@
  14667. +--- a/src/drivers/linux_wext.h
  14668. ++++ b/src/drivers/linux_wext.h
  14669. +@@ -26,6 +26,7 @@ typedef int32_t __s32;
  14670. + typedef uint16_t __u16;
  14671. + typedef int16_t __s16;
  14672. + typedef uint8_t __u8;
  14673. ++typedef int8_t __s8;
  14674. + #ifndef __user
  14675. + #define __user
  14676. + #endif /* __user */
  14677. 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
  14678. deleted file mode 100644
  14679. index 74aef26..0000000
  14680. --- a/package/network/services/hostapd/patches/440-max_num_sta_probe.patch
  14681. +++ /dev/null
  14682. @@ -1,13 +0,0 @@
  14683. ---- a/src/ap/beacon.c
  14684. -+++ b/src/ap/beacon.c
  14685. -@@ -664,6 +664,10 @@ void handle_probe_req(struct hostapd_dat
  14686. - return;
  14687. - }
  14688. -
  14689. -+ if (!sta && hapd->num_sta >= hapd->conf->max_num_sta)
  14690. -+ wpa_printf(MSG_MSGDUMP, "Probe Request from " MACSTR " ignored,"
  14691. -+ " too many connected stations.", MAC2STR(mgmt->sa));
  14692. -+
  14693. - #ifdef CONFIG_INTERWORKING
  14694. - if (hapd->conf->interworking &&
  14695. - elems.interworking && elems.interworking_len >= 1) {
  14696. diff --git a/package/network/services/hostapd/patches/450-scan_wait.patch b/package/network/services/hostapd/patches/450-scan_wait.patch
  14697. index 87ebd45..78cf306 100644
  14698. --- a/package/network/services/hostapd/patches/450-scan_wait.patch
  14699. +++ b/package/network/services/hostapd/patches/450-scan_wait.patch
  14700. @@ -1,6 +1,6 @@
  14701. --- a/hostapd/main.c
  14702. +++ b/hostapd/main.c
  14703. -@@ -36,6 +36,8 @@ struct hapd_global {
  14704. +@@ -37,6 +37,8 @@ struct hapd_global {
  14705. };
  14706. static struct hapd_global global;
  14707. @@ -9,7 +9,7 @@
  14708. #ifndef CONFIG_NO_HOSTAPD_LOGGER
  14709. -@@ -142,6 +144,14 @@ static void hostapd_logger_cb(void *ctx,
  14710. +@@ -143,6 +145,14 @@ static void hostapd_logger_cb(void *ctx,
  14711. }
  14712. #endif /* CONFIG_NO_HOSTAPD_LOGGER */
  14713. @@ -24,7 +24,7 @@
  14714. /**
  14715. * hostapd_driver_init - Preparate driver interface
  14716. -@@ -160,6 +170,8 @@ static int hostapd_driver_init(struct ho
  14717. +@@ -161,6 +171,8 @@ static int hostapd_driver_init(struct ho
  14718. return -1;
  14719. }
  14720. @@ -33,7 +33,7 @@
  14721. /* Initialize the driver interface */
  14722. if (!(b[0] | b[1] | b[2] | b[3] | b[4] | b[5]))
  14723. b = NULL;
  14724. -@@ -381,8 +393,6 @@ static void hostapd_global_deinit(const
  14725. +@@ -401,8 +413,6 @@ static void hostapd_global_deinit(const
  14726. #endif /* CONFIG_NATIVE_WINDOWS */
  14727. eap_server_unregister_methods();
  14728. @@ -42,19 +42,26 @@
  14729. }
  14730. -@@ -408,11 +418,6 @@ static int hostapd_global_run(struct hap
  14731. +@@ -428,18 +438,6 @@ static int hostapd_global_run(struct hap
  14732. }
  14733. #endif /* EAP_SERVER_TNC */
  14734. -- if (daemonize && os_daemonize(pid_file)) {
  14735. -- wpa_printf(MSG_ERROR, "daemon: %s", strerror(errno));
  14736. -- return -1;
  14737. +- if (daemonize) {
  14738. +- if (os_daemonize(pid_file)) {
  14739. +- wpa_printf(MSG_ERROR, "daemon: %s", strerror(errno));
  14740. +- return -1;
  14741. +- }
  14742. +- if (eloop_sock_requeue()) {
  14743. +- wpa_printf(MSG_ERROR, "eloop_sock_requeue: %s",
  14744. +- strerror(errno));
  14745. +- return -1;
  14746. +- }
  14747. - }
  14748. -
  14749. eloop_run();
  14750. return 0;
  14751. -@@ -542,8 +547,7 @@ int main(int argc, char *argv[])
  14752. +@@ -638,8 +636,7 @@ int main(int argc, char *argv[])
  14753. struct hapd_interfaces interfaces;
  14754. int ret = 1;
  14755. size_t i, j;
  14756. 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
  14757. index 217e701..6a5866e 100644
  14758. --- a/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch
  14759. +++ b/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch
  14760. @@ -18,15 +18,15 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  14761. #define WPA_SUPPLICANT_DRIVER_VERSION 4
  14762. -+#include "drivers/nl80211_copy.h"
  14763. ++#include "ap/sta_info.h"
  14764. #include "common/defs.h"
  14765. + #include "common/ieee802_11_defs.h"
  14766. #include "utils/list.h"
  14767. -
  14768. -@@ -538,6 +539,9 @@ struct wpa_driver_associate_params {
  14769. +@@ -587,6 +588,9 @@ struct wpa_driver_associate_params {
  14770. * responsible for selecting with which BSS to associate. */
  14771. const u8 *bssid;
  14772. -+ unsigned char rates[NL80211_MAX_SUPP_RATES];
  14773. ++ unsigned char rates[WLAN_SUPP_RATES_MAX];
  14774. + int mcast_rate;
  14775. +
  14776. /**
  14777. @@ -34,15 +34,15 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  14778. *
  14779. --- a/wpa_supplicant/config.c
  14780. +++ b/wpa_supplicant/config.c
  14781. -@@ -15,6 +15,7 @@
  14782. - #include "rsn_supp/wpa.h"
  14783. +@@ -16,6 +16,7 @@
  14784. #include "eap_peer/eap.h"
  14785. #include "p2p/p2p.h"
  14786. -+#include "drivers/nl80211_copy.h"
  14787. + #include "fst/fst.h"
  14788. ++#include "ap/sta_info.h"
  14789. #include "config.h"
  14790. -@@ -1722,6 +1723,97 @@ static char * wpa_config_write_mesh_basi
  14791. +@@ -1816,6 +1817,97 @@ static char * wpa_config_write_mesh_basi
  14792. #endif /* CONFIG_MESH */
  14793. @@ -88,7 +88,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  14794. + pos = (char *)value;
  14795. + r = strtok_r(pos, ",", &sptr);
  14796. + i = 0;
  14797. -+ while (pos && i < NL80211_MAX_SUPP_RATES) {
  14798. ++ while (pos && i < WLAN_SUPP_RATES_MAX) {
  14799. + rate = 0.0;
  14800. + if (r)
  14801. + rate = strtod(r, &end);
  14802. @@ -113,11 +113,11 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  14803. + if (ssid->rates[0] <= 0)
  14804. + return NULL;
  14805. +
  14806. -+ value = os_malloc(6 * NL80211_MAX_SUPP_RATES + 1);
  14807. ++ value = os_malloc(6 * WLAN_SUPP_RATES_MAX + 1);
  14808. + if (value == NULL)
  14809. + return NULL;
  14810. + pos = value;
  14811. -+ for (i = 0; i < NL80211_MAX_SUPP_RATES - 1; i++) {
  14812. ++ for (i = 0; i < WLAN_SUPP_RATES_MAX - 1; i++) {
  14813. + res = os_snprintf(pos, 6, "%.1f,", (double)ssid->rates[i] / 2);
  14814. + if (res < 0) {
  14815. + os_free(value);
  14816. @@ -126,13 +126,13 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  14817. + pos += res;
  14818. + }
  14819. + res = os_snprintf(pos, 6, "%.1f",
  14820. -+ (double)ssid->rates[NL80211_MAX_SUPP_RATES - 1] / 2);
  14821. ++ (double)ssid->rates[WLAN_SUPP_RATES_MAX - 1] / 2);
  14822. + if (res < 0) {
  14823. + os_free(value);
  14824. + return NULL;
  14825. + }
  14826. +
  14827. -+ value[6 * NL80211_MAX_SUPP_RATES] = '\0';
  14828. ++ value[6 * WLAN_SUPP_RATES_MAX] = '\0';
  14829. + return value;
  14830. +}
  14831. +#endif /* NO_CONFIG_WRITE */
  14832. @@ -140,7 +140,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  14833. /* Helper macros for network block parser */
  14834. #ifdef OFFSET
  14835. -@@ -1947,6 +2039,9 @@ static const struct parse_data ssid_fiel
  14836. +@@ -2047,6 +2139,9 @@ static const struct parse_data ssid_fiel
  14837. { INT(ap_max_inactivity) },
  14838. { INT(dtim_period) },
  14839. { INT(beacon_int) },
  14840. @@ -152,19 +152,22 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  14841. #endif /* CONFIG_MACSEC */
  14842. --- a/wpa_supplicant/config_ssid.h
  14843. +++ b/wpa_supplicant/config_ssid.h
  14844. -@@ -12,6 +12,7 @@
  14845. +@@ -10,8 +10,10 @@
  14846. + #define CONFIG_SSID_H
  14847. +
  14848. #include "common/defs.h"
  14849. ++#include "ap/sta_info.h"
  14850. #include "utils/list.h"
  14851. #include "eap_peer/eap_config.h"
  14852. +#include "drivers/nl80211_copy.h"
  14853. - #define MAX_SSID_LEN 32
  14854. -@@ -675,6 +676,9 @@ struct wpa_ssid {
  14855. + #define DEFAULT_EAP_WORKAROUND ((unsigned int) -1)
  14856. +@@ -711,6 +713,9 @@ struct wpa_ssid {
  14857. */
  14858. void *parent_cred;
  14859. -+ unsigned char rates[NL80211_MAX_SUPP_RATES];
  14860. ++ unsigned char rates[WLAN_SUPP_RATES_MAX];
  14861. + double mcast_rate;
  14862. +
  14863. #ifdef CONFIG_MACSEC
  14864. @@ -172,13 +175,13 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  14865. * macsec_policy - Determines the policy for MACsec secure session
  14866. --- a/wpa_supplicant/wpa_supplicant.c
  14867. +++ b/wpa_supplicant/wpa_supplicant.c
  14868. -@@ -2266,6 +2266,13 @@ static void wpas_start_assoc_cb(struct w
  14869. +@@ -2518,6 +2518,13 @@ static void wpas_start_assoc_cb(struct w
  14870. params.beacon_int = ssid->beacon_int;
  14871. else
  14872. params.beacon_int = wpa_s->conf->beacon_int;
  14873. + params.fixed_freq = ssid->fixed_freq;
  14874. + i = 0;
  14875. -+ while (i < NL80211_MAX_SUPP_RATES) {
  14876. ++ while (i < WLAN_SUPP_RATES_MAX) {
  14877. + params.rates[i] = ssid->rates[i];
  14878. + i++;
  14879. + }
  14880. 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
  14881. index 730cc31..459bdb9 100644
  14882. --- a/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch
  14883. +++ b/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch
  14884. @@ -10,7 +10,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  14885. --- a/src/drivers/driver_nl80211.c
  14886. +++ b/src/drivers/driver_nl80211.c
  14887. -@@ -4398,7 +4398,7 @@ static int wpa_driver_nl80211_ibss(struc
  14888. +@@ -4644,7 +4644,7 @@ static int wpa_driver_nl80211_ibss(struc
  14889. struct wpa_driver_associate_params *params)
  14890. {
  14891. struct nl_msg *msg;
  14892. @@ -19,7 +19,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  14893. int count = 0;
  14894. wpa_printf(MSG_DEBUG, "nl80211: Join IBSS (ifindex=%d)", drv->ifindex);
  14895. -@@ -4425,6 +4425,37 @@ retry:
  14896. +@@ -4671,6 +4671,37 @@ retry:
  14897. nl80211_put_beacon_int(msg, params->beacon_int))
  14898. goto fail;
  14899. 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
  14900. index 30bb2dc..80fe49c 100644
  14901. --- a/package/network/services/hostapd/patches/462-wpa_s-support-htmode-param.patch
  14902. +++ b/package/network/services/hostapd/patches/462-wpa_s-support-htmode-param.patch
  14903. @@ -16,9 +16,9 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  14904. --- a/src/drivers/driver.h
  14905. +++ b/src/drivers/driver.h
  14906. -@@ -541,6 +541,8 @@ struct wpa_driver_associate_params {
  14907. +@@ -590,6 +590,8 @@ struct wpa_driver_associate_params {
  14908. - unsigned char rates[NL80211_MAX_SUPP_RATES];
  14909. + unsigned char rates[WLAN_SUPP_RATES_MAX];
  14910. int mcast_rate;
  14911. + int ht_set;
  14912. + unsigned int htmode;
  14913. @@ -27,7 +27,7 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  14914. * bssid_hint - BSSID of a proposed AP
  14915. --- a/src/drivers/driver_nl80211.c
  14916. +++ b/src/drivers/driver_nl80211.c
  14917. -@@ -4456,6 +4456,22 @@ retry:
  14918. +@@ -4702,6 +4702,22 @@ retry:
  14919. nla_put_u32(msg, NL80211_ATTR_MCAST_RATE, params->mcast_rate);
  14920. }
  14921. @@ -52,7 +52,7 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  14922. goto fail;
  14923. --- a/wpa_supplicant/config.c
  14924. +++ b/wpa_supplicant/config.c
  14925. -@@ -1754,6 +1754,71 @@ static char * wpa_config_write_mcast_rat
  14926. +@@ -1848,6 +1848,71 @@ static char * wpa_config_write_mcast_rat
  14927. }
  14928. #endif /* NO_CONFIG_WRITE */
  14929. @@ -124,7 +124,7 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  14930. static int wpa_config_parse_rates(const struct parse_data *data,
  14931. struct wpa_ssid *ssid, int line,
  14932. const char *value)
  14933. -@@ -2042,6 +2107,7 @@ static const struct parse_data ssid_fiel
  14934. +@@ -2142,6 +2207,7 @@ static const struct parse_data ssid_fiel
  14935. { INT_RANGE(fixed_freq, 0, 1) },
  14936. { FUNC(rates) },
  14937. { FUNC(mcast_rate) },
  14938. @@ -134,9 +134,9 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  14939. #endif /* CONFIG_MACSEC */
  14940. --- a/wpa_supplicant/config_ssid.h
  14941. +++ b/wpa_supplicant/config_ssid.h
  14942. -@@ -678,6 +678,8 @@ struct wpa_ssid {
  14943. +@@ -715,6 +715,8 @@ struct wpa_ssid {
  14944. - unsigned char rates[NL80211_MAX_SUPP_RATES];
  14945. + unsigned char rates[WLAN_SUPP_RATES_MAX];
  14946. double mcast_rate;
  14947. + int ht_set;
  14948. + unsigned int htmode;
  14949. @@ -145,7 +145,7 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  14950. /**
  14951. --- a/wpa_supplicant/wpa_supplicant.c
  14952. +++ b/wpa_supplicant/wpa_supplicant.c
  14953. -@@ -2273,6 +2273,8 @@ static void wpas_start_assoc_cb(struct w
  14954. +@@ -2525,6 +2525,8 @@ static void wpas_start_assoc_cb(struct w
  14955. i++;
  14956. }
  14957. params.mcast_rate = ssid->mcast_rate;
  14958. diff --git a/package/network/services/hostapd/patches/470-survey_data_fallback.patch b/package/network/services/hostapd/patches/470-survey_data_fallback.patch
  14959. new file mode 100644
  14960. index 0000000..4e40a87
  14961. --- /dev/null
  14962. +++ b/package/network/services/hostapd/patches/470-survey_data_fallback.patch
  14963. @@ -0,0 +1,45 @@
  14964. +--- a/src/ap/acs.c
  14965. ++++ b/src/ap/acs.c
  14966. +@@ -292,18 +292,12 @@ static void acs_fail(struct hostapd_ifac
  14967. + static long double
  14968. + acs_survey_interference_factor(struct freq_survey *survey, s8 min_nf)
  14969. + {
  14970. +- long double factor, busy, total;
  14971. ++ long double factor, busy = 0, total;
  14972. +
  14973. + if (survey->filled & SURVEY_HAS_CHAN_TIME_BUSY)
  14974. + busy = survey->channel_time_busy;
  14975. + else if (survey->filled & SURVEY_HAS_CHAN_TIME_RX)
  14976. + busy = survey->channel_time_rx;
  14977. +- else {
  14978. +- /* This shouldn't really happen as survey data is checked in
  14979. +- * acs_sanity_check() */
  14980. +- wpa_printf(MSG_ERROR, "ACS: Survey data missing");
  14981. +- return 0;
  14982. +- }
  14983. +
  14984. + total = survey->channel_time;
  14985. +
  14986. +@@ -395,20 +389,19 @@ static int acs_usable_vht80_chan(struct
  14987. + static int acs_survey_is_sufficient(struct freq_survey *survey)
  14988. + {
  14989. + if (!(survey->filled & SURVEY_HAS_NF)) {
  14990. ++ survey->nf = -95;
  14991. + wpa_printf(MSG_INFO, "ACS: Survey is missing noise floor");
  14992. +- return 0;
  14993. + }
  14994. +
  14995. + if (!(survey->filled & SURVEY_HAS_CHAN_TIME)) {
  14996. ++ survey->channel_time = 0;
  14997. + wpa_printf(MSG_INFO, "ACS: Survey is missing channel time");
  14998. +- return 0;
  14999. + }
  15000. +
  15001. + if (!(survey->filled & SURVEY_HAS_CHAN_TIME_BUSY) &&
  15002. + !(survey->filled & SURVEY_HAS_CHAN_TIME_RX)) {
  15003. + wpa_printf(MSG_INFO,
  15004. + "ACS: Survey is missing RX and busy time (at least one is required)");
  15005. +- return 0;
  15006. + }
  15007. +
  15008. + return 1;
  15009. 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
  15010. deleted file mode 100644
  15011. index e6bbddd..0000000
  15012. --- a/package/network/services/hostapd/patches/470-wait-for-nullfunc-longer.patch
  15013. +++ /dev/null
  15014. @@ -1,11 +0,0 @@
  15015. ---- a/src/ap/sta_info.h
  15016. -+++ b/src/ap/sta_info.h
  15017. -@@ -179,7 +179,7 @@ struct sta_info {
  15018. - * AP_DISASSOC_DELAY seconds. Similarly, the station will be deauthenticated
  15019. - * after AP_DEAUTH_DELAY seconds has passed after disassociation. */
  15020. - #define AP_MAX_INACTIVITY (5 * 60)
  15021. --#define AP_DISASSOC_DELAY (1)
  15022. -+#define AP_DISASSOC_DELAY (3)
  15023. - #define AP_DEAUTH_DELAY (1)
  15024. - /* Number of seconds to keep STA entry with Authenticated flag after it has
  15025. - * been disassociated. */
  15026. diff --git a/package/network/services/hostapd/patches/600-ubus_support.patch b/package/network/services/hostapd/patches/600-ubus_support.patch
  15027. index df2eac8..feacdf2 100644
  15028. --- a/package/network/services/hostapd/patches/600-ubus_support.patch
  15029. +++ b/package/network/services/hostapd/patches/600-ubus_support.patch
  15030. @@ -1,6 +1,6 @@
  15031. --- a/hostapd/Makefile
  15032. +++ b/hostapd/Makefile
  15033. -@@ -121,6 +121,11 @@ OBJS += ../src/common/hw_features_common
  15034. +@@ -157,6 +157,11 @@ OBJS += ../src/common/hw_features_common
  15035. OBJS += ../src/eapol_auth/eapol_auth_sm.o
  15036. @@ -22,7 +22,7 @@
  15037. struct wpa_ctrl_dst;
  15038. struct radius_server_data;
  15039. -@@ -103,6 +104,7 @@ struct hostapd_data {
  15040. +@@ -118,6 +119,7 @@ struct hostapd_data {
  15041. struct hostapd_iface *iface;
  15042. struct hostapd_config *iconf;
  15043. struct hostapd_bss_config *conf;
  15044. @@ -30,7 +30,7 @@
  15045. int interface_added; /* virtual interface added for this BSS */
  15046. unsigned int started:1;
  15047. unsigned int disabled:1;
  15048. -@@ -286,6 +288,8 @@ struct hostapd_iface {
  15049. +@@ -323,6 +325,8 @@ struct hostapd_iface {
  15050. struct hostapd_config *conf;
  15051. char phy[16]; /* Name of the PHY (radio) */
  15052. @@ -41,10 +41,10 @@
  15053. HAPD_IFACE_DISABLED,
  15054. --- /dev/null
  15055. +++ b/src/ap/ubus.c
  15056. -@@ -0,0 +1,511 @@
  15057. +@@ -0,0 +1,536 @@
  15058. +/*
  15059. + * hostapd / ubus support
  15060. -+ * Copyright (c) 2013, Felix Fietkau <nbd@openwrt.org>
  15061. ++ * Copyright (c) 2013, Felix Fietkau <nbd@nbd.name>
  15062. + *
  15063. + * This software may be distributed under the terms of the BSD license.
  15064. + * See README for more details.
  15065. @@ -58,6 +58,8 @@
  15066. +#include "wps_hostapd.h"
  15067. +#include "sta_info.h"
  15068. +#include "ubus.h"
  15069. ++#include "ap_drv_ops.h"
  15070. ++#include "beacon.h"
  15071. +
  15072. +static struct ubus_context *ctx;
  15073. +static struct blob_buf b;
  15074. @@ -417,6 +419,10 @@
  15075. +{
  15076. + struct blob_attr *tb[__VENDOR_ELEMENTS_MAX];
  15077. + struct hostapd_data *hapd = get_hapd_from_object(obj);
  15078. ++ struct hostapd_bss_config *bss = hapd->conf;
  15079. ++ struct wpabuf *elems;
  15080. ++ const char *pos;
  15081. ++ size_t len;
  15082. +
  15083. + blobmsg_parse(ve_policy, __VENDOR_ELEMENTS_MAX, tb,
  15084. + blob_data(msg), blob_len(msg));
  15085. @@ -424,10 +430,29 @@
  15086. + if (!tb[VENDOR_ELEMENTS])
  15087. + return UBUS_STATUS_INVALID_ARGUMENT;
  15088. +
  15089. -+ const char *vendor_elements = blobmsg_data(tb[VENDOR_ELEMENTS]);
  15090. -+ if (hostapd_set_iface(hapd->iconf, hapd->conf, "vendor_elements",
  15091. -+ vendor_elements) != 0)
  15092. -+ return UBUS_STATUS_NOT_SUPPORTED;
  15093. ++ pos = blobmsg_data(tb[VENDOR_ELEMENTS]);
  15094. ++ len = os_strlen(pos);
  15095. ++ if (len & 0x01)
  15096. ++ return UBUS_STATUS_INVALID_ARGUMENT;
  15097. ++
  15098. ++ len /= 2;
  15099. ++ if (len == 0) {
  15100. ++ wpabuf_free(bss->vendor_elements);
  15101. ++ bss->vendor_elements = NULL;
  15102. ++ return 0;
  15103. ++ }
  15104. ++
  15105. ++ elems = wpabuf_alloc(len);
  15106. ++ if (elems == NULL)
  15107. ++ return 1;
  15108. ++
  15109. ++ if (hexstr2bin(pos, wpabuf_put(elems, len), len)) {
  15110. ++ wpabuf_free(elems);
  15111. ++ return UBUS_STATUS_INVALID_ARGUMENT;
  15112. ++ }
  15113. ++
  15114. ++ wpabuf_free(bss->vendor_elements);
  15115. ++ bss->vendor_elements = elems;
  15116. +
  15117. + /* update beacons if vendor elements were set successfully */
  15118. + if (ieee802_11_update_beacons(hapd->iface) != 0)
  15119. @@ -558,7 +583,7 @@
  15120. @@ -0,0 +1,78 @@
  15121. +/*
  15122. + * hostapd / ubus support
  15123. -+ * Copyright (c) 2013, Felix Fietkau <nbd@openwrt.org>
  15124. ++ * Copyright (c) 2013, Felix Fietkau <nbd@nbd.name>
  15125. + *
  15126. + * This software may be distributed under the terms of the BSD license.
  15127. + * See README for more details.
  15128. @@ -636,7 +661,7 @@
  15129. +#endif
  15130. --- a/src/ap/hostapd.c
  15131. +++ b/src/ap/hostapd.c
  15132. -@@ -277,6 +277,7 @@ static void hostapd_free_hapd_data(struc
  15133. +@@ -284,6 +284,7 @@ static void hostapd_free_hapd_data(struc
  15134. hapd->started = 0;
  15135. wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface);
  15136. @@ -644,7 +669,7 @@
  15137. iapp_deinit(hapd->iapp);
  15138. hapd->iapp = NULL;
  15139. accounting_deinit(hapd);
  15140. -@@ -1098,6 +1099,8 @@ static int hostapd_setup_bss(struct host
  15141. +@@ -1139,6 +1140,8 @@ static int hostapd_setup_bss(struct host
  15142. if (hapd->driver && hapd->driver->set_operstate)
  15143. hapd->driver->set_operstate(hapd->drv_priv, 1);
  15144. @@ -653,7 +678,7 @@
  15145. return 0;
  15146. }
  15147. -@@ -1384,6 +1387,7 @@ int hostapd_setup_interface_complete(str
  15148. +@@ -1664,6 +1667,7 @@ static int hostapd_setup_interface_compl
  15149. if (err)
  15150. goto fail;
  15151. @@ -661,15 +686,15 @@
  15152. wpa_printf(MSG_DEBUG, "Completing interface initialization");
  15153. if (iface->conf->channel) {
  15154. #ifdef NEED_AP_MLME
  15155. -@@ -1544,6 +1548,7 @@ dfs_offload:
  15156. +@@ -1844,6 +1848,7 @@ dfs_offload:
  15157. fail:
  15158. wpa_printf(MSG_ERROR, "Interface initialization failed");
  15159. + hostapd_ubus_free_iface(iface);
  15160. hostapd_set_state(iface, HAPD_IFACE_DISABLED);
  15161. wpa_msg(hapd->msg_ctx, MSG_INFO, AP_EVENT_DISABLED);
  15162. - if (iface->interfaces && iface->interfaces->terminate_on_error)
  15163. -@@ -1873,6 +1878,7 @@ void hostapd_interface_deinit_free(struc
  15164. + #ifdef CONFIG_FST
  15165. +@@ -2277,6 +2282,7 @@ void hostapd_interface_deinit_free(struc
  15166. (unsigned int) iface->conf->num_bss);
  15167. driver = iface->bss[0]->driver;
  15168. drv_priv = iface->bss[0]->drv_priv;
  15169. @@ -679,7 +704,7 @@
  15170. __func__, driver, drv_priv);
  15171. --- a/src/ap/ieee802_11.c
  15172. +++ b/src/ap/ieee802_11.c
  15173. -@@ -881,7 +881,8 @@ int auth_sae_init_committed(struct hosta
  15174. +@@ -980,7 +980,8 @@ int auth_sae_init_committed(struct hosta
  15175. static void handle_auth(struct hostapd_data *hapd,
  15176. @@ -689,7 +714,7 @@
  15177. {
  15178. u16 auth_alg, auth_transaction, status_code;
  15179. u16 resp = WLAN_STATUS_SUCCESS;
  15180. -@@ -897,6 +898,11 @@ static void handle_auth(struct hostapd_d
  15181. +@@ -996,6 +997,11 @@ static void handle_auth(struct hostapd_d
  15182. char *identity = NULL;
  15183. char *radius_cui = NULL;
  15184. u16 seq_ctrl;
  15185. @@ -699,9 +724,9 @@
  15186. + .frame_info = fi,
  15187. + };
  15188. - if (len < IEEE80211_HDRLEN + sizeof(mgmt->u.auth)) {
  15189. - wpa_printf(MSG_INFO, "handle_auth - too short payload (len=%lu)",
  15190. -@@ -983,6 +989,14 @@ static void handle_auth(struct hostapd_d
  15191. + os_memset(&vlan_id, 0, sizeof(vlan_id));
  15192. +
  15193. +@@ -1149,6 +1155,14 @@ static void handle_auth(struct hostapd_d
  15194. resp = WLAN_STATUS_UNSPECIFIED_FAILURE;
  15195. goto fail;
  15196. }
  15197. @@ -716,7 +741,7 @@
  15198. if (res == HOSTAPD_ACL_PENDING) {
  15199. wpa_printf(MSG_DEBUG, "Authentication frame from " MACSTR
  15200. " waiting for an external authentication",
  15201. -@@ -1694,13 +1708,18 @@ static void send_assoc_resp(struct hosta
  15202. +@@ -2033,13 +2047,18 @@ static u16 send_assoc_resp(struct hostap
  15203. static void handle_assoc(struct hostapd_data *hapd,
  15204. const struct ieee80211_mgmt *mgmt, size_t len,
  15205. @@ -724,7 +749,7 @@
  15206. + int reassoc, struct hostapd_frame_info *fi)
  15207. {
  15208. u16 capab_info, listen_interval, seq_ctrl, fc;
  15209. - u16 resp = WLAN_STATUS_SUCCESS;
  15210. + u16 resp = WLAN_STATUS_SUCCESS, reply_res;
  15211. const u8 *pos;
  15212. int left, i;
  15213. struct sta_info *sta;
  15214. @@ -736,9 +761,9 @@
  15215. if (len < IEEE80211_HDRLEN + (reassoc ? sizeof(mgmt->u.reassoc_req) :
  15216. sizeof(mgmt->u.assoc_req))) {
  15217. -@@ -1820,6 +1839,13 @@ static void handle_assoc(struct hostapd_
  15218. - goto fail;
  15219. +@@ -2159,6 +2178,13 @@ static void handle_assoc(struct hostapd_
  15220. }
  15221. + #endif /* CONFIG_MBO */
  15222. + if (hostapd_ubus_handle_event(hapd, &req)) {
  15223. + wpa_printf(MSG_DEBUG, "Station " MACSTR " assoc rejected by ubus handler.\n",
  15224. @@ -747,10 +772,10 @@
  15225. + goto fail;
  15226. + }
  15227. +
  15228. - sta->capability = capab_info;
  15229. - sta->listen_interval = listen_interval;
  15230. -
  15231. -@@ -2236,7 +2262,7 @@ int ieee802_11_mgmt(struct hostapd_data
  15232. + /*
  15233. + * sta->capability is used in check_assoc_ies() for RRM enabled
  15234. + * capability element.
  15235. +@@ -2639,7 +2665,7 @@ int ieee802_11_mgmt(struct hostapd_data
  15236. if (stype == WLAN_FC_STYPE_PROBE_REQ) {
  15237. @@ -759,7 +784,7 @@
  15238. return 1;
  15239. }
  15240. -@@ -2251,17 +2277,17 @@ int ieee802_11_mgmt(struct hostapd_data
  15241. +@@ -2657,17 +2683,17 @@ int ieee802_11_mgmt(struct hostapd_data
  15242. switch (stype) {
  15243. case WLAN_FC_STYPE_AUTH:
  15244. wpa_printf(MSG_DEBUG, "mgmt::auth");
  15245. @@ -782,7 +807,7 @@
  15246. case WLAN_FC_STYPE_DISASSOC:
  15247. --- a/src/ap/beacon.c
  15248. +++ b/src/ap/beacon.c
  15249. -@@ -542,7 +542,7 @@ static enum ssid_match_result ssid_match
  15250. +@@ -675,7 +675,7 @@ sta_track_seen_on(struct hostapd_iface *
  15251. void handle_probe_req(struct hostapd_data *hapd,
  15252. const struct ieee80211_mgmt *mgmt, size_t len,
  15253. @@ -791,22 +816,23 @@
  15254. {
  15255. u8 *resp;
  15256. struct ieee802_11_elems elems;
  15257. -@@ -550,8 +550,14 @@ void handle_probe_req(struct hostapd_dat
  15258. - size_t ie_len;
  15259. - struct sta_info *sta = NULL;
  15260. +@@ -684,9 +684,15 @@ void handle_probe_req(struct hostapd_dat
  15261. size_t i, resp_len;
  15262. -+ int ssi_signal = fi->ssi_signal;
  15263. int noack;
  15264. enum ssid_match_result res;
  15265. ++ int ssi_signal = fi->ssi_signal;
  15266. + int ret;
  15267. + u16 csa_offs[2];
  15268. + size_t csa_offs_len;
  15269. + struct hostapd_ubus_request req = {
  15270. + .type = HOSTAPD_UBUS_PROBE_REQ,
  15271. + .mgmt_frame = mgmt,
  15272. + .frame_info = fi,
  15273. + };
  15274. - ie = mgmt->u.probe_req.variable;
  15275. - if (len < IEEE80211_HDRLEN + sizeof(mgmt->u.probe_req))
  15276. -@@ -710,6 +716,12 @@ void handle_probe_req(struct hostapd_dat
  15277. + if (len < IEEE80211_HDRLEN)
  15278. + return;
  15279. +@@ -838,6 +844,12 @@ void handle_probe_req(struct hostapd_dat
  15280. }
  15281. #endif /* CONFIG_P2P */
  15282. @@ -832,7 +858,7 @@
  15283. int ieee802_11_update_beacons(struct hostapd_iface *iface);
  15284. --- a/src/ap/drv_callbacks.c
  15285. +++ b/src/ap/drv_callbacks.c
  15286. -@@ -49,6 +49,10 @@ int hostapd_notif_assoc(struct hostapd_d
  15287. +@@ -52,6 +52,10 @@ int hostapd_notif_assoc(struct hostapd_d
  15288. u16 reason = WLAN_REASON_UNSPECIFIED;
  15289. u16 status = WLAN_STATUS_SUCCESS;
  15290. const u8 *p2p_dev_addr = NULL;
  15291. @@ -843,9 +869,9 @@
  15292. if (addr == NULL) {
  15293. /*
  15294. -@@ -113,6 +117,12 @@ int hostapd_notif_assoc(struct hostapd_d
  15295. +@@ -124,6 +128,12 @@ int hostapd_notif_assoc(struct hostapd_d
  15296. + goto fail;
  15297. }
  15298. - sta->flags &= ~(WLAN_STA_WPS | WLAN_STA_MAYBE_WPS | WLAN_STA_WPS2);
  15299. + if (hostapd_ubus_handle_event(hapd, &req)) {
  15300. + wpa_printf(MSG_DEBUG, "Station " MACSTR " assoc rejected by ubus handler.\n",
  15301. diff --git a/package/network/utils/iw/Makefile b/package/network/utils/iw/Makefile
  15302. index ad82081..d17cbca 100644
  15303. --- a/package/network/utils/iw/Makefile
  15304. +++ b/package/network/utils/iw/Makefile
  15305. @@ -12,10 +12,10 @@ PKG_VERSION:=4.3
  15306. PKG_RELEASE:=1
  15307. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  15308. -PKG_SOURCE_URL:=https://www.kernel.org/pub/software/network/iw
  15309. +PKG_SOURCE_URL:=@KERNEL/software/network/iw
  15310. PKG_MD5SUM:=7adec72e91ebdd9c55429fa34a23a6f5
  15311. -PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  15312. +PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  15313. PKG_LICENSE:=GPL-2.0
  15314. include $(INCLUDE_DIR)/package.mk
  15315. diff --git a/package/network/utils/iw/patches/001-nl80211_h_sync.patch b/package/network/utils/iw/patches/001-nl80211_h_sync.patch
  15316. index 7de2258..e5ea8f7 100644
  15317. --- a/package/network/utils/iw/patches/001-nl80211_h_sync.patch
  15318. +++ b/package/network/utils/iw/patches/001-nl80211_h_sync.patch
  15319. @@ -8,7 +8,17 @@
  15320. *
  15321. * Permission to use, copy, modify, and/or distribute this software for any
  15322. * purpose with or without fee is hereby granted, provided that the above
  15323. -@@ -328,7 +329,15 @@
  15324. +@@ -321,14 +322,24 @@
  15325. + * @NL80211_CMD_GET_SCAN: get scan results
  15326. + * @NL80211_CMD_TRIGGER_SCAN: trigger a new scan with the given parameters
  15327. + * %NL80211_ATTR_TX_NO_CCK_RATE is used to decide whether to send the
  15328. +- * probe requests at CCK rate or not.
  15329. ++ * probe requests at CCK rate or not. %NL80211_ATTR_MAC can be used to
  15330. ++ * specify a BSSID to scan for; if not included, the wildcard BSSID will
  15331. ++ * be used.
  15332. + * @NL80211_CMD_NEW_SCAN_RESULTS: scan notification (as a reply to
  15333. + * NL80211_CMD_GET_SCAN and on the "scan" multicast group)
  15334. + * @NL80211_CMD_SCAN_ABORTED: scan was aborted, for unspecified reasons,
  15335. * partial scan results may be available
  15336. *
  15337. * @NL80211_CMD_START_SCHED_SCAN: start a scheduled scan at certain
  15338. @@ -25,7 +35,82 @@
  15339. * Like with normal scans, if SSIDs (%NL80211_ATTR_SCAN_SSIDS)
  15340. * are passed, they are used in the probe requests. For
  15341. * broadcast, a broadcast SSID must be passed (ie. an empty
  15342. -@@ -1761,6 +1770,22 @@ enum nl80211_commands {
  15343. +@@ -418,7 +429,11 @@
  15344. + * @NL80211_CMD_ASSOCIATE: association request and notification; like
  15345. + * NL80211_CMD_AUTHENTICATE but for Association and Reassociation
  15346. + * (similar to MLME-ASSOCIATE.request, MLME-REASSOCIATE.request,
  15347. +- * MLME-ASSOCIATE.confirm or MLME-REASSOCIATE.confirm primitives).
  15348. ++ * MLME-ASSOCIATE.confirm or MLME-REASSOCIATE.confirm primitives). The
  15349. ++ * %NL80211_ATTR_PREV_BSSID attribute is used to specify whether the
  15350. ++ * request is for the initial association to an ESS (that attribute not
  15351. ++ * included) or for reassociation within the ESS (that attribute is
  15352. ++ * included).
  15353. + * @NL80211_CMD_DEAUTHENTICATE: deauthentication request and notification; like
  15354. + * NL80211_CMD_AUTHENTICATE but for Deauthentication frames (similar to
  15355. + * MLME-DEAUTHENTICATION.request and MLME-DEAUTHENTICATE.indication
  15356. +@@ -468,6 +483,9 @@
  15357. + * set of BSSID,frequency parameters is used (i.e., either the enforcing
  15358. + * %NL80211_ATTR_MAC,%NL80211_ATTR_WIPHY_FREQ or the less strict
  15359. + * %NL80211_ATTR_MAC_HINT and %NL80211_ATTR_WIPHY_FREQ_HINT).
  15360. ++ * %NL80211_ATTR_PREV_BSSID can be used to request a reassociation within
  15361. ++ * the ESS in case the device is already associated and an association with
  15362. ++ * a different BSS is desired.
  15363. + * Background scan period can optionally be
  15364. + * specified in %NL80211_ATTR_BG_SCAN_PERIOD,
  15365. + * if not specified default background scan configuration
  15366. +@@ -811,6 +829,10 @@
  15367. + * as an event to indicate changes for devices with wiphy-specific regdom
  15368. + * management.
  15369. + *
  15370. ++ * @NL80211_CMD_ABORT_SCAN: Stop an ongoing scan. Returns -ENOENT if a scan is
  15371. ++ * not running. The driver indicates the status of the scan through
  15372. ++ * cfg80211_scan_done().
  15373. ++ *
  15374. + * @NL80211_CMD_MAX: highest used command number
  15375. + * @__NL80211_CMD_AFTER_LAST: internal use
  15376. + */
  15377. +@@ -997,6 +1019,8 @@ enum nl80211_commands {
  15378. +
  15379. + NL80211_CMD_WIPHY_REG_CHANGE,
  15380. +
  15381. ++ NL80211_CMD_ABORT_SCAN,
  15382. ++
  15383. + /* add new commands above here */
  15384. +
  15385. + /* used to define NL80211_CMD_MAX below */
  15386. +@@ -1270,8 +1294,11 @@ enum nl80211_commands {
  15387. + * @NL80211_ATTR_RESP_IE: (Re)association response information elements as
  15388. + * sent by peer, for ROAM and successful CONNECT events.
  15389. + *
  15390. +- * @NL80211_ATTR_PREV_BSSID: previous BSSID, to be used by in ASSOCIATE
  15391. +- * commands to specify using a reassociate frame
  15392. ++ * @NL80211_ATTR_PREV_BSSID: previous BSSID, to be used in ASSOCIATE and CONNECT
  15393. ++ * commands to specify a request to reassociate within an ESS, i.e., to use
  15394. ++ * Reassociate Request frame (with the value of this attribute in the
  15395. ++ * Current AP address field) instead of Association Request frame which is
  15396. ++ * used for the initial association to an ESS.
  15397. + *
  15398. + * @NL80211_ATTR_KEY: key information in a nested attribute with
  15399. + * %NL80211_KEY_* sub-attributes
  15400. +@@ -1712,6 +1739,8 @@ enum nl80211_commands {
  15401. + * underlying device supports these minimal RRM features:
  15402. + * %NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES,
  15403. + * %NL80211_FEATURE_QUIET,
  15404. ++ * Or, if global RRM is supported, see:
  15405. ++ * %NL80211_EXT_FEATURE_RRM
  15406. + * If this flag is used, driver must add the Power Capabilities IE to the
  15407. + * association request. In addition, it must also set the RRM capability
  15408. + * flag in the association request's Capability Info field.
  15409. +@@ -1755,12 +1784,44 @@ enum nl80211_commands {
  15410. + * over all channels.
  15411. + *
  15412. + * @NL80211_ATTR_SCHED_SCAN_DELAY: delay before the first cycle of a
  15413. +- * scheduled scan (or a WoWLAN net-detect scan) is started, u32
  15414. +- * in seconds.
  15415. ++ * scheduled scan is started. Or the delay before a WoWLAN
  15416. ++ * net-detect scan is started, counting from the moment the
  15417. ++ * system is suspended. This value is a u32, in seconds.
  15418. +
  15419. * @NL80211_ATTR_REG_INDOOR: flag attribute, if set indicates that the device
  15420. * is operating in an indoor environment.
  15421. *
  15422. @@ -41,6 +126,21 @@
  15423. + * thus it must not specify the number of iterations, only the interval
  15424. + * between scans. The scan plans are executed sequentially.
  15425. + * Each scan plan is a nested attribute of &enum nl80211_sched_scan_plan.
  15426. ++ * @NL80211_ATTR_PBSS: flag attribute. If set it means operate
  15427. ++ * in a PBSS. Specified in %NL80211_CMD_CONNECT to request
  15428. ++ * connecting to a PCP, and in %NL80211_CMD_START_AP to start
  15429. ++ * a PCP instead of AP. Relevant for DMG networks only.
  15430. ++ * @NL80211_ATTR_BSS_SELECT: nested attribute for driver supporting the
  15431. ++ * BSS selection feature. When used with %NL80211_CMD_GET_WIPHY it contains
  15432. ++ * attributes according &enum nl80211_bss_select_attr to indicate what
  15433. ++ * BSS selection behaviours are supported. When used with %NL80211_CMD_CONNECT
  15434. ++ * it contains the behaviour-specific attribute containing the parameters for
  15435. ++ * BSS selection to be done by driver and/or firmware.
  15436. ++ *
  15437. ++ * @NL80211_ATTR_STA_SUPPORT_P2P_PS: whether P2P PS mechanism supported
  15438. ++ * or not. u8, one of the values of &enum nl80211_sta_p2p_ps_status
  15439. ++ *
  15440. ++ * @NL80211_ATTR_PAD: attribute used for padding for 64-bit alignment
  15441. + *
  15442. + * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce
  15443. + * transmit power to stay within regulatory limits. u32, dBi.
  15444. @@ -48,7 +148,7 @@
  15445. * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  15446. * @NL80211_ATTR_MAX: highest attribute number currently defined
  15447. * @__NL80211_ATTR_AFTER_LAST: internal use
  15448. -@@ -2130,6 +2155,13 @@ enum nl80211_attrs {
  15449. +@@ -2130,6 +2191,21 @@ enum nl80211_attrs {
  15450. NL80211_ATTR_REG_INDOOR,
  15451. @@ -57,30 +157,147 @@
  15452. + NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS,
  15453. + NL80211_ATTR_SCHED_SCAN_PLANS,
  15454. +
  15455. ++ NL80211_ATTR_PBSS,
  15456. ++
  15457. ++ NL80211_ATTR_BSS_SELECT,
  15458. ++
  15459. ++ NL80211_ATTR_STA_SUPPORT_P2P_PS,
  15460. ++
  15461. ++ NL80211_ATTR_PAD,
  15462. ++
  15463. + NL80211_ATTR_WIPHY_ANTENNA_GAIN,
  15464. +
  15465. /* add attributes here, update the policy in nl80211.c */
  15466. __NL80211_ATTR_AFTER_LAST,
  15467. -@@ -3364,6 +3396,9 @@ enum nl80211_bss_scan_width {
  15468. +@@ -2273,6 +2349,20 @@ enum nl80211_sta_flags {
  15469. + NL80211_STA_FLAG_MAX = __NL80211_STA_FLAG_AFTER_LAST - 1
  15470. + };
  15471. +
  15472. ++/**
  15473. ++ * enum nl80211_sta_p2p_ps_status - station support of P2P PS
  15474. ++ *
  15475. ++ * @NL80211_P2P_PS_UNSUPPORTED: station doesn't support P2P PS mechanism
  15476. ++ * @@NL80211_P2P_PS_SUPPORTED: station supports P2P PS mechanism
  15477. ++ * @NUM_NL80211_P2P_PS_STATUS: number of values
  15478. ++ */
  15479. ++enum nl80211_sta_p2p_ps_status {
  15480. ++ NL80211_P2P_PS_UNSUPPORTED = 0,
  15481. ++ NL80211_P2P_PS_SUPPORTED,
  15482. ++
  15483. ++ NUM_NL80211_P2P_PS_STATUS,
  15484. ++};
  15485. ++
  15486. + #define NL80211_STA_FLAG_MAX_OLD_API NL80211_STA_FLAG_TDLS_PEER
  15487. +
  15488. + /**
  15489. +@@ -2430,6 +2520,9 @@ enum nl80211_sta_bss_param {
  15490. + * TID+1 and the special TID 16 (i.e. value 17) is used for non-QoS frames;
  15491. + * each one of those is again nested with &enum nl80211_tid_stats
  15492. + * attributes carrying the actual values.
  15493. ++ * @NL80211_STA_INFO_RX_DURATION: aggregate PPDU duration for all frames
  15494. ++ * received from the station (u64, usec)
  15495. ++ * @NL80211_STA_INFO_PAD: attribute used for padding for 64-bit alignment
  15496. + * @__NL80211_STA_INFO_AFTER_LAST: internal
  15497. + * @NL80211_STA_INFO_MAX: highest possible station info attribute
  15498. + */
  15499. +@@ -2466,6 +2559,8 @@ enum nl80211_sta_info {
  15500. + NL80211_STA_INFO_BEACON_RX,
  15501. + NL80211_STA_INFO_BEACON_SIGNAL_AVG,
  15502. + NL80211_STA_INFO_TID_STATS,
  15503. ++ NL80211_STA_INFO_RX_DURATION,
  15504. ++ NL80211_STA_INFO_PAD,
  15505. +
  15506. + /* keep last */
  15507. + __NL80211_STA_INFO_AFTER_LAST,
  15508. +@@ -2482,6 +2577,7 @@ enum nl80211_sta_info {
  15509. + * transmitted MSDUs (not counting the first attempt; u64)
  15510. + * @NL80211_TID_STATS_TX_MSDU_FAILED: number of failed transmitted
  15511. + * MSDUs (u64)
  15512. ++ * @NL80211_TID_STATS_PAD: attribute used for padding for 64-bit alignment
  15513. + * @NUM_NL80211_TID_STATS: number of attributes here
  15514. + * @NL80211_TID_STATS_MAX: highest numbered attribute here
  15515. + */
  15516. +@@ -2491,6 +2587,7 @@ enum nl80211_tid_stats {
  15517. + NL80211_TID_STATS_TX_MSDU,
  15518. + NL80211_TID_STATS_TX_MSDU_RETRIES,
  15519. + NL80211_TID_STATS_TX_MSDU_FAILED,
  15520. ++ NL80211_TID_STATS_PAD,
  15521. +
  15522. + /* keep last */
  15523. + NUM_NL80211_TID_STATS,
  15524. +@@ -2927,6 +3024,7 @@ enum nl80211_user_reg_hint_type {
  15525. + * transmitting data (on channel or globally)
  15526. + * @NL80211_SURVEY_INFO_TIME_SCAN: time the radio spent for scan
  15527. + * (on this channel or globally)
  15528. ++ * @NL80211_SURVEY_INFO_PAD: attribute used for padding for 64-bit alignment
  15529. + * @NL80211_SURVEY_INFO_MAX: highest survey info attribute number
  15530. + * currently defined
  15531. + * @__NL80211_SURVEY_INFO_AFTER_LAST: internal use
  15532. +@@ -2942,6 +3040,7 @@ enum nl80211_survey_info {
  15533. + NL80211_SURVEY_INFO_TIME_RX,
  15534. + NL80211_SURVEY_INFO_TIME_TX,
  15535. + NL80211_SURVEY_INFO_TIME_SCAN,
  15536. ++ NL80211_SURVEY_INFO_PAD,
  15537. +
  15538. + /* keep last */
  15539. + __NL80211_SURVEY_INFO_AFTER_LAST,
  15540. +@@ -3364,6 +3463,10 @@ enum nl80211_bss_scan_width {
  15541. * (not present if no beacon frame has been received yet)
  15542. * @NL80211_BSS_PRESP_DATA: the data in @NL80211_BSS_INFORMATION_ELEMENTS and
  15543. * @NL80211_BSS_TSF is known to be from a probe response (flag attribute)
  15544. + * @NL80211_BSS_LAST_SEEN_BOOTTIME: CLOCK_BOOTTIME timestamp when this entry
  15545. + * was last updated by a received frame. The value is expected to be
  15546. + * accurate to about 10ms. (u64, nanoseconds)
  15547. ++ * @NL80211_BSS_PAD: attribute used for padding for 64-bit alignment
  15548. * @__NL80211_BSS_AFTER_LAST: internal
  15549. * @NL80211_BSS_MAX: highest BSS attribute
  15550. */
  15551. -@@ -3383,6 +3418,7 @@ enum nl80211_bss {
  15552. +@@ -3383,6 +3486,8 @@ enum nl80211_bss {
  15553. NL80211_BSS_CHAN_WIDTH,
  15554. NL80211_BSS_BEACON_TSF,
  15555. NL80211_BSS_PRESP_DATA,
  15556. + NL80211_BSS_LAST_SEEN_BOOTTIME,
  15557. ++ NL80211_BSS_PAD,
  15558. /* keep last */
  15559. __NL80211_BSS_AFTER_LAST,
  15560. -@@ -4589,4 +4625,28 @@ enum nl80211_tdls_peer_capability {
  15561. +@@ -3568,11 +3673,15 @@ enum nl80211_txrate_gi {
  15562. + * @NL80211_BAND_2GHZ: 2.4 GHz ISM band
  15563. + * @NL80211_BAND_5GHZ: around 5 GHz band (4.9 - 5.7 GHz)
  15564. + * @NL80211_BAND_60GHZ: around 60 GHz band (58.32 - 64.80 GHz)
  15565. ++ * @NUM_NL80211_BANDS: number of bands, avoid using this in userspace
  15566. ++ * since newer kernel versions may support more bands
  15567. + */
  15568. + enum nl80211_band {
  15569. + NL80211_BAND_2GHZ,
  15570. + NL80211_BAND_5GHZ,
  15571. + NL80211_BAND_60GHZ,
  15572. ++
  15573. ++ NUM_NL80211_BANDS,
  15574. + };
  15575. +
  15576. + /**
  15577. +@@ -4358,12 +4467,18 @@ enum nl80211_feature_flags {
  15578. + /**
  15579. + * enum nl80211_ext_feature_index - bit index of extended features.
  15580. + * @NL80211_EXT_FEATURE_VHT_IBSS: This driver supports IBSS with VHT datarates.
  15581. ++ * @NL80211_EXT_FEATURE_RRM: This driver supports RRM. When featured, user can
  15582. ++ * can request to use RRM (see %NL80211_ATTR_USE_RRM) with
  15583. ++ * %NL80211_CMD_ASSOCIATE and %NL80211_CMD_CONNECT requests, which will set
  15584. ++ * the ASSOC_REQ_USE_RRM flag in the association request even if
  15585. ++ * NL80211_FEATURE_QUIET is not advertized.
  15586. + *
  15587. + * @NUM_NL80211_EXT_FEATURES: number of extended features.
  15588. + * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
  15589. + */
  15590. + enum nl80211_ext_feature_index {
  15591. + NL80211_EXT_FEATURE_VHT_IBSS,
  15592. ++ NL80211_EXT_FEATURE_RRM,
  15593. +
  15594. + /* add new features before the definition below */
  15595. + NUM_NL80211_EXT_FEATURES,
  15596. +@@ -4589,4 +4704,72 @@ enum nl80211_tdls_peer_capability {
  15597. NL80211_TDLS_PEER_WMM = 1<<2,
  15598. };
  15599. @@ -108,4 +325,48 @@
  15600. + __NL80211_SCHED_SCAN_PLAN_AFTER_LAST - 1
  15601. +};
  15602. +
  15603. ++/**
  15604. ++ * struct nl80211_bss_select_rssi_adjust - RSSI adjustment parameters.
  15605. ++ *
  15606. ++ * @band: band of BSS that must match for RSSI value adjustment.
  15607. ++ * @delta: value used to adjust the RSSI value of matching BSS.
  15608. ++ */
  15609. ++struct nl80211_bss_select_rssi_adjust {
  15610. ++ __u8 band;
  15611. ++ __s8 delta;
  15612. ++} __attribute__((packed));
  15613. ++
  15614. ++/**
  15615. ++ * enum nl80211_bss_select_attr - attributes for bss selection.
  15616. ++ *
  15617. ++ * @__NL80211_BSS_SELECT_ATTR_INVALID: reserved.
  15618. ++ * @NL80211_BSS_SELECT_ATTR_RSSI: Flag indicating only RSSI-based BSS selection
  15619. ++ * is requested.
  15620. ++ * @NL80211_BSS_SELECT_ATTR_BAND_PREF: attribute indicating BSS
  15621. ++ * selection should be done such that the specified band is preferred.
  15622. ++ * When there are multiple BSS-es in the preferred band, the driver
  15623. ++ * shall use RSSI-based BSS selection as a second step. The value of
  15624. ++ * this attribute is according to &enum nl80211_band (u32).
  15625. ++ * @NL80211_BSS_SELECT_ATTR_RSSI_ADJUST: When present the RSSI level for
  15626. ++ * BSS-es in the specified band is to be adjusted before doing
  15627. ++ * RSSI-based BSS selection. The attribute value is a packed structure
  15628. ++ * value as specified by &struct nl80211_bss_select_rssi_adjust.
  15629. ++ * @NL80211_BSS_SELECT_ATTR_MAX: highest bss select attribute number.
  15630. ++ * @__NL80211_BSS_SELECT_ATTR_AFTER_LAST: internal use.
  15631. ++ *
  15632. ++ * One and only one of these attributes are found within %NL80211_ATTR_BSS_SELECT
  15633. ++ * for %NL80211_CMD_CONNECT. It specifies the required BSS selection behaviour
  15634. ++ * which the driver shall use.
  15635. ++ */
  15636. ++enum nl80211_bss_select_attr {
  15637. ++ __NL80211_BSS_SELECT_ATTR_INVALID,
  15638. ++ NL80211_BSS_SELECT_ATTR_RSSI,
  15639. ++ NL80211_BSS_SELECT_ATTR_BAND_PREF,
  15640. ++ NL80211_BSS_SELECT_ATTR_RSSI_ADJUST,
  15641. ++
  15642. ++ /* keep last */
  15643. ++ __NL80211_BSS_SELECT_ATTR_AFTER_LAST,
  15644. ++ NL80211_BSS_SELECT_ATTR_MAX = __NL80211_BSS_SELECT_ATTR_AFTER_LAST - 1
  15645. ++};
  15646. ++
  15647. #endif /* __LINUX_NL80211_H */
  15648. 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
  15649. index 574c490..2cdf360 100644
  15650. --- a/package/network/utils/iw/patches/300-display_interface_TX_power.patch
  15651. +++ b/package/network/utils/iw/patches/300-display_interface_TX_power.patch
  15652. @@ -12,11 +12,9 @@ Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  15653. interface.c | 7 +++++++
  15654. 1 file changed, 7 insertions(+)
  15655. -diff --git a/interface.c b/interface.c
  15656. -index 73ccecd..4f0821d 100644
  15657. --- a/interface.c
  15658. +++ b/interface.c
  15659. -@@ -368,6 +368,13 @@ static int print_iface_handler(struct nl_msg *msg, void *arg)
  15660. +@@ -368,6 +368,13 @@ static int print_iface_handler(struct nl
  15661. printf("\n");
  15662. }
  15663. diff --git a/package/network/utils/iw/patches/301-ibss_add_VHT80.patch b/package/network/utils/iw/patches/301-ibss_add_VHT80.patch
  15664. index 709fbb2..0627bcc 100644
  15665. --- a/package/network/utils/iw/patches/301-ibss_add_VHT80.patch
  15666. +++ b/package/network/utils/iw/patches/301-ibss_add_VHT80.patch
  15667. @@ -14,8 +14,6 @@ Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  15668. ibss.c | 49 +++++++++++++++++++++++++++++++++++++++++--------
  15669. 1 file changed, 41 insertions(+), 8 deletions(-)
  15670. -diff --git a/ibss.c b/ibss.c
  15671. -index 7a0b707..a99a262 100644
  15672. --- a/ibss.c
  15673. +++ b/ibss.c
  15674. @@ -16,6 +16,39 @@
  15675. @@ -58,7 +56,7 @@ index 7a0b707..a99a262 100644
  15676. static int join_ibss(struct nl80211_state *state,
  15677. struct nl_msg *msg,
  15678. int argc, char **argv,
  15679. -@@ -30,12 +63,8 @@ static int join_ibss(struct nl80211_state *state,
  15680. +@@ -30,12 +63,8 @@ static int join_ibss(struct nl80211_stat
  15681. int bintval;
  15682. int i;
  15683. unsigned long freq;
  15684. @@ -73,7 +71,7 @@ index 7a0b707..a99a262 100644
  15685. { .name = "HT20",
  15686. .width = NL80211_CHAN_WIDTH_20,
  15687. .freq1_diff = 0,
  15688. -@@ -60,6 +89,10 @@ static int join_ibss(struct nl80211_state *state,
  15689. +@@ -60,6 +89,10 @@ static int join_ibss(struct nl80211_stat
  15690. .width = NL80211_CHAN_WIDTH_10,
  15691. .freq1_diff = 0,
  15692. .chantype = -1 },
  15693. @@ -84,7 +82,7 @@ index 7a0b707..a99a262 100644
  15694. };
  15695. if (argc < 2)
  15696. -@@ -90,7 +123,7 @@ static int join_ibss(struct nl80211_state *state,
  15697. +@@ -90,7 +123,7 @@ static int join_ibss(struct nl80211_stat
  15698. NLA_PUT_U32(msg, NL80211_ATTR_CHANNEL_WIDTH,
  15699. chanmode_selected->width);
  15700. NLA_PUT_U32(msg, NL80211_ATTR_CENTER_FREQ1,
  15701. 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
  15702. index fc44427..f96d5ea 100644
  15703. --- a/package/network/utils/iw/patches/302-ibss_use_MHz_instead_MHZ.patch
  15704. +++ b/package/network/utils/iw/patches/302-ibss_use_MHz_instead_MHZ.patch
  15705. @@ -7,11 +7,9 @@ Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  15706. ibss.c | 8 ++++----
  15707. 1 file changed, 4 insertions(+), 4 deletions(-)
  15708. -diff --git a/ibss.c b/ibss.c
  15709. -index a99a262..23bda70 100644
  15710. --- a/ibss.c
  15711. +++ b/ibss.c
  15712. -@@ -81,15 +81,15 @@ static int join_ibss(struct nl80211_state *state,
  15713. +@@ -81,15 +81,15 @@ static int join_ibss(struct nl80211_stat
  15714. .width = NL80211_CHAN_WIDTH_20_NOHT,
  15715. .freq1_diff = 0,
  15716. .chantype = NL80211_CHAN_NO_HT },
  15717. diff --git a/package/network/utils/iw/patches/303-mesh_add_VHT80.patch b/package/network/utils/iw/patches/303-mesh_add_VHT80.patch
  15718. index fe8dc21..956b050 100644
  15719. --- a/package/network/utils/iw/patches/303-mesh_add_VHT80.patch
  15720. +++ b/package/network/utils/iw/patches/303-mesh_add_VHT80.patch
  15721. @@ -15,8 +15,6 @@ Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
  15722. util.c | 26 ++++++++++++++++++++++++++
  15723. 4 files changed, 43 insertions(+), 41 deletions(-)
  15724. -diff --git a/ibss.c b/ibss.c
  15725. -index 23bda70..ac06fc5 100644
  15726. --- a/ibss.c
  15727. +++ b/ibss.c
  15728. @@ -16,39 +16,6 @@
  15729. @@ -59,8 +57,6 @@ index 23bda70..ac06fc5 100644
  15730. static int join_ibss(struct nl80211_state *state,
  15731. struct nl_msg *msg,
  15732. int argc, char **argv,
  15733. -diff --git a/iw.h b/iw.h
  15734. -index cef9da8..8e1a37a 100644
  15735. --- a/iw.h
  15736. +++ b/iw.h
  15737. @@ -59,6 +59,13 @@ struct cmd {
  15738. @@ -77,7 +73,7 @@ index cef9da8..8e1a37a 100644
  15739. #define ARRAY_SIZE(ar) (sizeof(ar)/sizeof(ar[0]))
  15740. #define DIV_ROUND_UP(x, y) (((x) + (y - 1)) / (y))
  15741. -@@ -174,6 +181,8 @@ void print_ies(unsigned char *ie, int ielen, bool unknown,
  15742. +@@ -174,6 +181,8 @@ void print_ies(unsigned char *ie, int ie
  15743. void parse_bitrate(struct nlattr *bitrate_attr, char *buf, int buflen);
  15744. void iw_hexdump(const char *prefix, const __u8 *data, size_t len);
  15745. @@ -86,11 +82,9 @@ index cef9da8..8e1a37a 100644
  15746. #define SCHED_SCAN_OPTIONS "interval <in_msecs> [delay <in_secs>] " \
  15747. "[freqs <freq>+] [matches [ssid <ssid>]+]] [active [ssid <ssid>]+|passive] [randomise[=<addr>/<mask>]]"
  15748. int parse_sched_scan(struct nl_msg *msg, int *argc, char ***argv);
  15749. -diff --git a/mesh.c b/mesh.c
  15750. -index 0090530..930d58f 100644
  15751. --- a/mesh.c
  15752. +++ b/mesh.c
  15753. -@@ -439,12 +439,8 @@ static int join_mesh(struct nl80211_state *state,
  15754. +@@ -439,12 +439,8 @@ static int join_mesh(struct nl80211_stat
  15755. int bintval, dtim_period, i, n_rates = 0;
  15756. char *end, *value = NULL, *sptr = NULL;
  15757. unsigned long freq = 0;
  15758. @@ -105,7 +99,7 @@ index 0090530..930d58f 100644
  15759. { .name = "HT20",
  15760. .width = NL80211_CHAN_WIDTH_20,
  15761. .freq1_diff = 0,
  15762. -@@ -461,6 +457,10 @@ static int join_mesh(struct nl80211_state *state,
  15763. +@@ -461,6 +457,10 @@ static int join_mesh(struct nl80211_stat
  15764. .width = NL80211_CHAN_WIDTH_20_NOHT,
  15765. .freq1_diff = 0,
  15766. .chantype = NL80211_CHAN_NO_HT },
  15767. @@ -116,7 +110,7 @@ index 0090530..930d58f 100644
  15768. };
  15769. if (argc < 1)
  15770. -@@ -497,7 +497,7 @@ static int join_mesh(struct nl80211_state *state,
  15771. +@@ -497,7 +497,7 @@ static int join_mesh(struct nl80211_stat
  15772. NLA_PUT_U32(msg, NL80211_ATTR_CHANNEL_WIDTH,
  15773. chanmode_selected->width);
  15774. NLA_PUT_U32(msg, NL80211_ATTR_CENTER_FREQ1,
  15775. @@ -125,7 +119,7 @@ index 0090530..930d58f 100644
  15776. if (chanmode_selected->chantype != -1)
  15777. NLA_PUT_U32(msg,
  15778. NL80211_ATTR_WIPHY_CHANNEL_TYPE,
  15779. -@@ -599,7 +599,7 @@ static int join_mesh(struct nl80211_state *state,
  15780. +@@ -599,7 +599,7 @@ static int join_mesh(struct nl80211_stat
  15781. nla_put_failure:
  15782. return -ENOBUFS;
  15783. }
  15784. @@ -134,11 +128,9 @@ index 0090530..930d58f 100644
  15785. " [basic-rates <rate in Mbps,rate2,...>]], [mcast-rate <rate in Mbps>]"
  15786. " [beacon-interval <time in TUs>] [dtim-period <value>]"
  15787. " [vendor_sync on|off] [<param>=<value>]*",
  15788. -diff --git a/util.c b/util.c
  15789. -index 4efc4c8..d75ffe0 100644
  15790. --- a/util.c
  15791. +++ b/util.c
  15792. -@@ -728,3 +728,29 @@ void iw_hexdump(const char *prefix, const __u8 *buf, size_t size)
  15793. +@@ -728,3 +728,29 @@ void iw_hexdump(const char *prefix, cons
  15794. }
  15795. printf("\n\n");
  15796. }
  15797. 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
  15798. index d382453..20bb06e 100644
  15799. --- a/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.c
  15800. +++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.c
  15801. @@ -39,6 +39,18 @@ __init void ap9x_pci_setup_wmac_led_pin(unsigned wmac, int pin)
  15802. }
  15803. }
  15804. +__init void ap9x_pci_setup_wmac_led_name(unsigned wmac, const char *led_name)
  15805. +{
  15806. + switch (wmac) {
  15807. + case 0:
  15808. + ap9x_wmac0_data.led_name = led_name;
  15809. + break;
  15810. + case 1:
  15811. + ap9x_wmac1_data.led_name = led_name;
  15812. + break;
  15813. + }
  15814. +}
  15815. +
  15816. __init struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac)
  15817. {
  15818. switch (wmac) {
  15819. @@ -81,6 +93,20 @@ __init void ap9x_pci_setup_wmac_leds(unsigned wmac, struct gpio_led *leds,
  15820. }
  15821. }
  15822. +__init void ap9x_pci_setup_wmac_btns(unsigned wmac,
  15823. + struct gpio_keys_button *btns,
  15824. + unsigned num_btns, unsigned poll_interval)
  15825. +{
  15826. + struct ath9k_platform_data *ap9x_wmac_data;
  15827. +
  15828. + if (!(ap9x_wmac_data = ap9x_pci_get_wmac_data(wmac)))
  15829. + return;
  15830. +
  15831. + ap9x_wmac_data->btns = btns;
  15832. + ap9x_wmac_data->num_btns = num_btns;
  15833. + ap9x_wmac_data->btn_poll_interval = poll_interval;
  15834. +}
  15835. +
  15836. static int ap91_pci_plat_dev_init(struct pci_dev *dev)
  15837. {
  15838. switch (PCI_SLOT(dev->devfn)) {
  15839. 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
  15840. index ad288cb..d7c0185 100644
  15841. --- a/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.h
  15842. +++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.h
  15843. @@ -12,6 +12,7 @@
  15844. #define _ATH79_DEV_AP9X_PCI_H
  15845. struct gpio_led;
  15846. +struct gpio_keys_button;
  15847. struct ath9k_platform_data;
  15848. #if defined(CONFIG_ATH79_DEV_AP9X_PCI)
  15849. @@ -19,6 +20,9 @@ void ap9x_pci_setup_wmac_led_pin(unsigned wmac, int pin);
  15850. void ap9x_pci_setup_wmac_gpio(unsigned wmac, u32 mask, u32 val);
  15851. void ap9x_pci_setup_wmac_leds(unsigned wmac, struct gpio_led *leds,
  15852. int num_leds);
  15853. +void ap9x_pci_setup_wmac_led_name(unsigned wmac, const char *led_name);
  15854. +void ap9x_pci_setup_wmac_btns(unsigned wmac, struct gpio_keys_button *btns,
  15855. + unsigned num_btns, unsigned poll_interval);
  15856. struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac);
  15857. void ap91_pci_init(u8 *cal_data, u8 *mac_addr);
  15858. @@ -33,6 +37,12 @@ static inline void ap9x_pci_setup_wmac_gpio(unsigned wmac,
  15859. static inline void ap9x_pci_setup_wmac_leds(unsigned wmac,
  15860. struct gpio_led *leds,
  15861. int num_leds) {}
  15862. +static inline void ap9x_pci_setup_wmac_led_name(unsigned wmac,
  15863. + const char *led_name) {}
  15864. +static inline void ap9x_pci_setup_wmac_btns(unsigned wmac,
  15865. + struct gpio_keys_button *btns,
  15866. + unsigned num_btns,
  15867. + unsigned poll_interval) {}
  15868. static inline struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac)
  15869. {
  15870. return NULL;
  15871. diff --git a/target/linux/generic/files/include/linux/ath9k_platform.h b/target/linux/generic/files/include/linux/ath9k_platform.h
  15872. index 30ce216..2c19f3b 100644
  15873. --- a/target/linux/generic/files/include/linux/ath9k_platform.h
  15874. +++ b/target/linux/generic/files/include/linux/ath9k_platform.h
  15875. @@ -31,6 +31,10 @@ struct ath9k_platform_data {
  15876. u32 gpio_mask;
  15877. u32 gpio_val;
  15878. + u32 bt_active_pin;
  15879. + u32 bt_priority_pin;
  15880. + u32 wlan_active_pin;
  15881. +
  15882. bool endian_check;
  15883. bool is_clk_25mhz;
  15884. bool tx_gain_buffalo;
  15885. @@ -45,6 +49,11 @@ struct ath9k_platform_data {
  15886. int num_leds;
  15887. const struct gpio_led *leds;
  15888. + const char *led_name;
  15889. +
  15890. + unsigned num_btns;
  15891. + const struct gpio_keys_button *btns;
  15892. + unsigned btn_poll_interval;
  15893. };
  15894. #endif /* _LINUX_ATH9K_PLATFORM_H */