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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969
  1. From: Matthias Schiffer <mschiffer@universe-factory.net>
  2. Date: Wed, 7 Sep 2016 05:04:06 +0200
  3. Subject: mac80211, hostapd, iw, ...: update to LEDE 42f559ed70897a7b74dd3e6293b42e6d2e511eaa
  4. diff --git a/package/firmware/ath10k-firmware/Makefile b/package/firmware/ath10k-firmware/Makefile
  5. index b03d644..624da6a 100644
  6. --- a/package/firmware/ath10k-firmware/Makefile
  7. +++ b/package/firmware/ath10k-firmware/Makefile
  8. @@ -8,7 +8,7 @@
  9. include $(TOPDIR)/rules.mk
  10. PKG_NAME:=ath10k-firmware
  11. -PKG_SOURCE_VERSION:=77f72b5f7dd940386d9e619a17904987759b7186
  12. +PKG_SOURCE_VERSION:=b00eb8d30fbebb6a5047ccacefa8c37e072fca9c
  13. PKG_VERSION:=2014-11-13-$(PKG_SOURCE_VERSION)
  14. PKG_RELEASE:=1
  15. @@ -17,7 +17,7 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  16. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  17. PKG_SOURCE_URL:=https://github.com/kvalo/ath10k-firmware.git
  18. -PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  19. +PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  20. include $(INCLUDE_DIR)/package.mk
  21. @@ -28,14 +28,48 @@ define Package/ath10k-firmware-default
  22. CATEGORY:=Kernel modules
  23. SUBMENU:=$(WMENU)
  24. URL:=$(PKG_SOURCE_URL)
  25. + DEPENDS:=
  26. endef
  27. +define Package/ath10k-firmware-qca9887
  28. +$(Package/ath10k-firmware-default)
  29. + TITLE:=ath10k firmware for QCA9887 devices
  30. +endef
  31. +
  32. +QCA9887_REV:=3cce88e245f2d685e49411c4f80998f94baf67b8
  33. +QCA9887_FIRMWARE_FILE:=firmware-5.bin_10.2.4-1.0-00013
  34. +QCA9887_FIRMWARE_FILE_MD5:=bd9cdcbf49561c7176432a81c29e7e87
  35. +QCA9887_FIRMWARE_FILE_DL:=$(QCA9887_FIRMWARE_FILE).$(QCA9887_FIRMWARE_FILE_MD5)
  36. +QCA9887_BOARD_FILE:=board.bin
  37. +QCA9887_BOARD_FILE_MD5:=ebf3af10160c45373f19e0b8226b02ae
  38. +QCA9887_BOARD_FILE_DL:=$(QCA9887_BOARD_FILE).$(QCA9887_BOARD_FILE_MD5)
  39. +
  40. +define Download/ath10k-qca9887-firmware
  41. + URL:=https://github.com/kvalo/ath10k-firmware/raw/$(QCA9887_REV)/QCA9887/hw1.0/
  42. + URL_FILE:=$(QCA9887_FIRMWARE_FILE)
  43. + FILE:=$(QCA9887_FIRMWARE_FILE_DL)
  44. + MD5SUM:=$(QCA9887_FIRMWARE_FILE_MD5)
  45. +endef
  46. +$(eval $(call Download,ath10k-qca9887-firmware))
  47. +
  48. +define Download/ath10k-qca9887-board
  49. + URL:=https://github.com/kvalo/ath10k-firmware/raw/$(QCA9887_REV)/QCA9887/hw1.0/
  50. + URL_FILE:=$(QCA9887_BOARD_FILE)
  51. + FILE:=$(QCA9887_BOARD_FILE_DL)
  52. + MD5SUM:=$(QCA9887_BOARD_FILE_MD5)
  53. +endef
  54. +$(eval $(call Download,ath10k-qca9887-board))
  55. +
  56. define Package/ath10k-firmware-qca988x
  57. $(Package/ath10k-firmware-default)
  58. + DEFAULT:=PACKAGE_kmod-ath10k
  59. TITLE:=ath10k firmware for QCA988x devices
  60. endef
  61. QCA988X_FIRMWARE_FILE:=firmware-5.bin_10.2.4.97-1
  62. +QCA988X_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-16.1.bin-lede
  63. +QCA99X0_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-7.bin-lede.004
  64. +QCA9984_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-7.bin-lede.004
  65. define Download/ath10k-firmware-qca988x
  66. URL:=https://www.codeaurora.org/cgit/quic/qsdk/oss/firmware/ath10k-firmware/plain/10.2.4/
  67. @@ -44,11 +78,83 @@ define Download/ath10k-firmware-qca988x
  68. endef
  69. $(eval $(call Download,ath10k-firmware-qca988x))
  70. +define Download/ath10k-firmware-qca988x-ct
  71. + URL:=https://www.candelatech.com/downloads/
  72. + FILE:=$(QCA988X_FIRMWARE_FILE_CT)
  73. + MD5SUM:=d7e081e9782936ed544b78994c9133fb
  74. +endef
  75. +$(eval $(call Download,ath10k-firmware-qca988x-ct))
  76. +
  77. +define Download/ath10k-firmware-qca99x0-ct
  78. + URL:=https://www.candelatech.com/downloads/ath10k-10-4/
  79. + FILE:=$(QCA99X0_FIRMWARE_FILE_CT)
  80. + MD5SUM:=809bb9bf8a18ea218a8e1b9ffc0f8447
  81. +endef
  82. +$(eval $(call Download,ath10k-firmware-qca99x0-ct))
  83. +
  84. +define Download/ath10k-firmware-qca9984-ct
  85. + URL:=https://www.candelatech.com/downloads/ath10k-9984-10-4/
  86. + FILE:=$(QCA9984_FIRMWARE_FILE_CT)
  87. + MD5SUM:=924eb8ea30de11299b13e207469a3350
  88. +endef
  89. +$(eval $(call Download,ath10k-firmware-qca9984-ct))
  90. +
  91. define Package/ath10k-firmware-qca99x0
  92. $(Package/ath10k-firmware-default)
  93. TITLE:=ath10k firmware for QCA99x0 devices
  94. endef
  95. +define Package/ath10k-firmware-qca988x-ct
  96. +$(Package/ath10k-firmware-default)
  97. + TITLE:=ath10k CT 10.1 firmware for QCA988x devices
  98. +endef
  99. +
  100. +define Package/ath10k-firmware-qca988x-ct/description
  101. +Alternative ath10k firmware for QCA988X from Candela Technologies.
  102. +Enables IBSS and other features. See:
  103. +http://www.candelatech.com/ath10k-10.1.php
  104. +This firmware will NOT be used unless the standard ath10k-firmware-qca988x
  105. +is un-selected since the driver will try to load firmware-5.bin before
  106. +firmware-2.bin
  107. +endef
  108. +
  109. +define Package/ath10k-firmware-qca99x0-ct/description
  110. +Alternative ath10k firmware for QCA99x0 from Candela Technologies.
  111. +Enables IBSS and other features. See:
  112. +http://www.candelatech.com/ath10k-10.4.php
  113. +This firmware conflicts with the standard 99x0 firmware, so select only
  114. +one.
  115. +endef
  116. +
  117. +define Package/ath10k-firmware-qca9984-ct/description
  118. +Alternative ath10k firmware for QCA9984 from Candela Technologies.
  119. +Enables IBSS and other features. See:
  120. +http://www.candelatech.com/ath10k-10.4-9984.php
  121. +This firmware conflicts with the standard 9984 firmware, so select only
  122. +one.
  123. +endef
  124. +
  125. +define Package/ath10k-firmware-qca99x0/description
  126. +Standard ath10k firmware for QCA99x0 from QCA
  127. +This firmware conflicts with the CT 99x0 firmware, so select only
  128. +one.
  129. +endef
  130. +
  131. +define Package/ath10k-firmware-qca99x0-ct
  132. +$(Package/ath10k-firmware-default)
  133. + TITLE:=ath10k CT 10.4.3 firmware for QCA99x0 devices
  134. +endef
  135. +
  136. +define Package/ath10k-firmware-qca9984-ct
  137. +$(Package/ath10k-firmware-default)
  138. + TITLE:=ath10k CT 10.4.3 firmware for QCA9984 devices
  139. +endef
  140. +
  141. +define Package/ath10k-firmware-qca9984
  142. +$(Package/ath10k-firmware-default)
  143. + TITLE:=ath10k firmware for QCA9984 devices
  144. +endef
  145. +
  146. define Package/ath10k-firmware-qca6174
  147. $(Package/ath10k-firmware-default)
  148. TITLE:=ath10k firmware for QCA6174 devices
  149. @@ -58,8 +164,8 @@ QCA99X0_BOARD_REV:=ddcec9efd245da9365c474f513a855a55f3ac7fe
  150. QCA99X0_BOARD_FILE:=board-2.bin.$(QCA99X0_BOARD_REV)
  151. define Download/qca99x0-board
  152. - URL:=https://www.codeaurora.org/cgit/quic/qsdk/oss/firmware/ath10k-firmware/plain/ath10k/QCA99X0/hw2.0
  153. - URL_FILE:=board-2.bin?id=ddcec9efd245da9365c474f513a855a55f3ac7fe
  154. + URL:=https://source.codeaurora.org/quic/qsdk/oss/firmware/ath10k-firmware/plain/ath10k/QCA99X0/hw2.0
  155. + URL_FILE:=board-2.bin?id=$(QCA99X0_BOARD_REV)
  156. FILE:=$(QCA99X0_BOARD_FILE)
  157. MD5SUM:=a2b3c653c2363a5641200051d6333d0a
  158. endef
  159. @@ -69,6 +175,16 @@ define Build/Compile
  160. endef
  161. +define Package/ath10k-firmware-qca9887/install
  162. + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9887/hw1.0
  163. + $(INSTALL_DATA) \
  164. + $(DL_DIR)/$(QCA9887_FIRMWARE_FILE_DL) \
  165. + $(1)/lib/firmware/ath10k/QCA9887/hw1.0/firmware-5.bin
  166. + $(INSTALL_DATA) \
  167. + $(DL_DIR)/$(QCA9887_BOARD_FILE_DL) \
  168. + $(1)/lib/firmware/ath10k/QCA9887/hw1.0/board.bin
  169. +endef
  170. +
  171. define Package/ath10k-firmware-qca988x/install
  172. $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA988X/hw2.0
  173. $(INSTALL_DATA) \
  174. @@ -79,6 +195,16 @@ define Package/ath10k-firmware-qca988x/install
  175. $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-5.bin
  176. endef
  177. +define Package/ath10k-firmware-qca988x-ct/install
  178. + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA988X/hw2.0
  179. + $(INSTALL_DATA) \
  180. + $(PKG_BUILD_DIR)/QCA988X/board.bin \
  181. + $(1)/lib/firmware/ath10k/QCA988X/hw2.0/
  182. + $(INSTALL_DATA) \
  183. + $(DL_DIR)/$(QCA988X_FIRMWARE_FILE_CT) \
  184. + $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-2.bin
  185. +endef
  186. +
  187. define Package/ath10k-firmware-qca6174/install
  188. $(INSTALL_DIR) $(1)/lib/firmware/ath10k
  189. $(CP) $(PKG_BUILD_DIR)/QCA6174 $(1)/lib/firmware/ath10k/
  190. @@ -97,6 +223,51 @@ define Package/ath10k-firmware-qca99x0/install
  191. $(1)/lib/firmware/ath10k/QCA99X0/hw2.0/firmware-5.bin
  192. endef
  193. +define Package/ath10k-firmware-qca99x0-ct/install
  194. + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA99X0/hw2.0
  195. + $(INSTALL_DATA) \
  196. + $(DL_DIR)/$(QCA99X0_BOARD_FILE) \
  197. + $(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board-2.bin
  198. + $(INSTALL_DATA) \
  199. + $(PKG_BUILD_DIR)/QCA99X0/hw2.0/boardData_AR900B_CUS239_5G_v2_001.bin \
  200. + $(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board.bin
  201. + $(INSTALL_DATA) \
  202. + $(DL_DIR)/$(QCA99X0_FIRMWARE_FILE_CT) \
  203. + $(1)/lib/firmware/ath10k/QCA99X0/hw2.0/firmware-5.bin
  204. +endef
  205. +
  206. +define Package/ath10k-firmware-qca9984/install
  207. + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9984/hw1.0
  208. + ln -s \
  209. + ../../cal-pci-0000:01:00.0.bin \
  210. + $(1)/lib/firmware/ath10k/QCA9984/hw1.0/board.bin
  211. + $(INSTALL_DATA) \
  212. + $(PKG_BUILD_DIR)/QCA9984/hw1.0/board-2.bin \
  213. + $(1)/lib/firmware/ath10k/QCA9984/hw1.0/board-2.bin
  214. + $(INSTALL_DATA) \
  215. + $(PKG_BUILD_DIR)/QCA9984/hw1.0/firmware-5.bin_10.4-3.2-00072 \
  216. + $(1)/lib/firmware/ath10k/QCA9984/hw1.0/firmware-5.bin
  217. +endef
  218. +
  219. +define Package/ath10k-firmware-qca9984-ct/install
  220. + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9984/hw1.0
  221. + ln -s \
  222. + ../../cal-pci-0000:01:00.0.bin \
  223. + $(1)/lib/firmware/ath10k/QCA9984/hw1.0/board.bin
  224. + $(INSTALL_DATA) \
  225. + $(PKG_BUILD_DIR)/QCA9984/hw1.0/board-2.bin \
  226. + $(1)/lib/firmware/ath10k/QCA9984/hw1.0/board-2.bin
  227. + $(INSTALL_DATA) \
  228. + $(DL_DIR)/$(QCA9984_FIRMWARE_FILE_CT) \
  229. + $(1)/lib/firmware/ath10k/QCA9984/hw1.0/firmware-5.bin
  230. +endef
  231. +
  232. +$(eval $(call BuildPackage,ath10k-firmware-qca9887))
  233. $(eval $(call BuildPackage,ath10k-firmware-qca988x))
  234. $(eval $(call BuildPackage,ath10k-firmware-qca99x0))
  235. $(eval $(call BuildPackage,ath10k-firmware-qca6174))
  236. +$(eval $(call BuildPackage,ath10k-firmware-qca9984))
  237. +
  238. +$(eval $(call BuildPackage,ath10k-firmware-qca988x-ct))
  239. +$(eval $(call BuildPackage,ath10k-firmware-qca99x0-ct))
  240. +$(eval $(call BuildPackage,ath10k-firmware-qca9984-ct))
  241. diff --git a/package/firmware/linux-firmware/Makefile b/package/firmware/linux-firmware/Makefile
  242. index 2fcd93b..7a2e977 100644
  243. --- a/package/firmware/linux-firmware/Makefile
  244. +++ b/package/firmware/linux-firmware/Makefile
  245. @@ -16,10 +16,10 @@ PKG_SOURCE_PROTO:=git
  246. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  247. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION)
  248. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
  249. -PKG_SOURCE_URL:=git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
  250. -PKG_MIRROR_MD5SUM:=ca4d289ad9380471cae376fc7dd3660a
  251. +PKG_SOURCE_URL:=https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
  252. +PKG_MIRROR_MD5SUM:=8d44332359de89b1936b4ff608a72614
  253. -PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  254. +PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  255. SCAN_DEPS = *.mk
  256. diff --git a/package/firmware/linux-firmware/realtek.mk b/package/firmware/linux-firmware/realtek.mk
  257. index 0f8b1ce..4229ca0 100644
  258. --- a/package/firmware/linux-firmware/realtek.mk
  259. +++ b/package/firmware/linux-firmware/realtek.mk
  260. @@ -43,8 +43,15 @@ endef
  261. $(eval $(call BuildPackage,rtl8192de-firmware))
  262. Package/rtl8192se-firmware = $(call Package/firmware-default,RealTek RTL8192SE firmware)
  263. -define KernelPackage/rtl8192se/install
  264. +define Package/rtl8192se-firmware/install
  265. $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  266. $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8192sefw.bin $(1)/lib/firmware/rtlwifi
  267. endef
  268. $(eval $(call BuildPackage,rtl8192se-firmware))
  269. +
  270. +Package/rtl8192su-firmware = $(call Package/firmware-default,RealTek RTL8192SU firmware)
  271. +define Package/rtl8192su-firmware/install
  272. + $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  273. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8712u.bin $(1)/lib/firmware/rtlwifi
  274. +endef
  275. +$(eval $(call BuildPackage,rtl8192su-firmware))
  276. diff --git a/package/kernel/acx-mac80211/Makefile b/package/kernel/acx-mac80211/Makefile
  277. index 1820e7a..8fce374 100644
  278. --- a/package/kernel/acx-mac80211/Makefile
  279. +++ b/package/kernel/acx-mac80211/Makefile
  280. @@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk
  281. include $(INCLUDE_DIR)/kernel.mk
  282. PKG_NAME:=acx-mac80211
  283. -PKG_REV:=v20130127
  284. -PKG_VERSION:=20130909
  285. +PKG_REV:=b6fc31491020cb01d2cd1acc170cfa03ced7e726
  286. +PKG_VERSION:=20140216
  287. PKG_RELEASE:=1
  288. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
  289. -PKG_SOURCE_URL:=git://acx100.git.sourceforge.net/gitroot/acx100/acx-mac80211
  290. +PKG_SOURCE_URL:=http://git.code.sf.net/p/acx100/acx-mac80211
  291. PKG_SOURCE_PROTO:=git
  292. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  293. PKG_SOURCE_VERSION:=$(PKG_REV)
  294. @@ -190,7 +190,7 @@ define Build/Compile
  295. CROSS_COMPILE="$(TARGET_CROSS)" \
  296. SUBDIRS="$(PKG_BUILD_DIR)" \
  297. $(PKG_EXTRA_KCONFIG) \
  298. - EXTRA_CFLAGS="$(PKG_EXTRA_CFLAGS) -DCONFIG_ACX_MAC80211_VERSION=\"KERNEL_VERSION(3,14,0)\"" \
  299. + EXTRA_CFLAGS="$(PKG_EXTRA_CFLAGS) -DCONFIG_ACX_MAC80211_VERSION=\"KERNEL_VERSION(4,2,0)\"" \
  300. LINUXINCLUDE="-I$(STAGING_DIR)/usr/include/mac80211-backport/uapi -I$(STAGING_DIR)/usr/include/mac80211-backport \
  301. -I$(STAGING_DIR)/usr/include/mac80211/uapi -I$(STAGING_DIR)/usr/include/mac80211 \
  302. -I$(LINUX_DIR)/include -I$(LINUX_DIR)/include/$(LINUX_UAPI_DIR) \
  303. diff --git a/package/kernel/acx-mac80211/patches/001-pci-mem-Fix-3.8-build.patch b/package/kernel/acx-mac80211/patches/001-pci-mem-Fix-3.8-build.patch
  304. deleted file mode 100644
  305. index fa4a6be..0000000
  306. --- a/package/kernel/acx-mac80211/patches/001-pci-mem-Fix-3.8-build.patch
  307. +++ /dev/null
  308. @@ -1,129 +0,0 @@
  309. -From 8a0f5890019bf43f4bc95ef0754b062ddfcfa9cd Mon Sep 17 00:00:00 2001
  310. -From: Oliver Winker <oliver@oli1170.net>
  311. -Date: Sun, 10 Mar 2013 21:04:23 +0100
  312. -Subject: [PATCH 1/3] pci, mem: Fix 3.8 build
  313. -
  314. -__devexit and __devinit not used anymore in 3.8
  315. -
  316. -Signed-off-by: Reinhard Karcher <reinhard.karcher@gmx.net>
  317. -Signed-off-by: Oliver Winker <oliver@oli1170.net>
  318. ----
  319. - mem.c | 13 ++++++++++++-
  320. - pci.c | 26 +++++++++++++++++++++++++-
  321. - 2 files changed, 37 insertions(+), 2 deletions(-)
  322. -
  323. ---- a/mem.c
  324. -+++ b/mem.c
  325. -@@ -2216,7 +2216,11 @@ int acx100mem_ioctl_set_phy_amp_bias(str
  326. - * ==================================================
  327. - */
  328. -
  329. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  330. - static int __devinit acxmem_probe(struct platform_device *pdev)
  331. -+#else
  332. -+static int acxmem_probe(struct platform_device *pdev)
  333. -+#endif
  334. - {
  335. - acx_device_t *adev = NULL;
  336. - const char *chip_name;
  337. -@@ -2392,7 +2396,11 @@ static int __devinit acxmem_probe(struct
  338. - * pdev - ptr to PCI device structure containing info about pci
  339. - * configuration
  340. - */
  341. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  342. - static int __devexit acxmem_remove(struct platform_device *pdev)
  343. -+#else
  344. -+static int acxmem_remove(struct platform_device *pdev)
  345. -+#endif
  346. - {
  347. - struct ieee80211_hw *hw = (struct ieee80211_hw *)
  348. - platform_get_drvdata(pdev);
  349. -@@ -2594,8 +2602,11 @@ static struct platform_driver acxmem_dri
  350. - .name = "acx-mem",
  351. - },
  352. - .probe = acxmem_probe,
  353. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  354. - .remove = __devexit_p(acxmem_remove),
  355. --
  356. -+#else
  357. -+ .remove = acxmem_remove,
  358. -+#endif
  359. - #ifdef CONFIG_PM
  360. - .suspend = acxmem_e_suspend,
  361. - .resume = acxmem_e_resume
  362. ---- a/pci.c
  363. -+++ b/pci.c
  364. -@@ -1039,7 +1039,11 @@ int acx100pci_ioctl_set_phy_amp_bias(str
  365. - * id - ptr to the device id entry that matched this device
  366. - */
  367. - #ifdef CONFIG_PCI
  368. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  369. - static int __devinit acxpci_probe(struct pci_dev *pdev,
  370. -+#else
  371. -+static int acxpci_probe(struct pci_dev *pdev,
  372. -+#endif
  373. - const struct pci_device_id *id)
  374. - {
  375. - unsigned long mem_region1 = 0;
  376. -@@ -1292,7 +1296,11 @@ static int __devinit acxpci_probe(struct
  377. - *
  378. - * pdev - ptr to PCI device structure containing info about pci configuration
  379. - */
  380. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  381. - static void __devexit acxpci_remove(struct pci_dev *pdev)
  382. -+#else
  383. -+static void acxpci_remove(struct pci_dev *pdev)
  384. -+#endif
  385. - {
  386. - struct ieee80211_hw *hw
  387. - = (struct ieee80211_hw *) pci_get_drvdata(pdev);
  388. -@@ -1505,7 +1513,11 @@ static struct pci_driver acxpci_driver =
  389. - .name = "acx_pci",
  390. - .id_table = acxpci_id_tbl,
  391. - .probe = acxpci_probe,
  392. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  393. - .remove = __devexit_p(acxpci_remove),
  394. -+#else
  395. -+ .remove = acxpci_remove,
  396. -+#endif
  397. - #ifdef CONFIG_PM
  398. - .suspend = acxpci_e_suspend,
  399. - .resume = acxpci_e_resume
  400. -@@ -1603,8 +1615,12 @@ static struct vlynq_device_id acx_vlynq_
  401. - };
  402. -
  403. -
  404. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  405. - static __devinit int vlynq_probe(struct vlynq_device *vdev,
  406. -- struct vlynq_device_id *id)
  407. -+#else
  408. -+static int vlynq_probe(struct vlynq_device *vdev,
  409. -+#endif
  410. -+ struct vlynq_device_id *id)
  411. - {
  412. - int result = -EIO, i;
  413. - u32 addr;
  414. -@@ -1785,7 +1801,11 @@ static __devinit int vlynq_probe(struct
  415. - return result;
  416. - }
  417. -
  418. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  419. - static __devexit void vlynq_remove(struct vlynq_device *vdev)
  420. -+#else
  421. -+static void vlynq_remove(struct vlynq_device *vdev)
  422. -+#endif
  423. - {
  424. - struct ieee80211_hw *hw = vlynq_get_drvdata(vdev);
  425. - acx_device_t *adev = hw2adev(hw);
  426. -@@ -1851,7 +1871,11 @@ static struct vlynq_driver acxvlynq_driv
  427. - .name = "acx_vlynq",
  428. - .id_table = acx_vlynq_id,
  429. - .probe = vlynq_probe,
  430. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  431. - .remove = __devexit_p(vlynq_remove),
  432. -+#else
  433. -+ .remove = vlynq_remove,
  434. -+#endif
  435. - };
  436. - #endif /* CONFIG_VLYNQ */
  437. -
  438. diff --git a/package/kernel/acx-mac80211/patches/003-Fix-3.10-build.patch b/package/kernel/acx-mac80211/patches/003-Fix-3.10-build.patch
  439. deleted file mode 100644
  440. index c737844..0000000
  441. --- a/package/kernel/acx-mac80211/patches/003-Fix-3.10-build.patch
  442. +++ /dev/null
  443. @@ -1,31 +0,0 @@
  444. -From 1daf4bfdb072b08f3b4e412bbfa9645f88dc0a01 Mon Sep 17 00:00:00 2001
  445. -From: Oliver Winker <oliver@oli1170.net>
  446. -Date: Tue, 3 Sep 2013 20:36:36 +0200
  447. -Subject: [PATCH 3/3] Fix 3.10 build
  448. -
  449. -Signed-off-by: Reinhard Karcher <reinhard.karcher@gmx.net>
  450. -Signed-off-by: Oliver Winker <oliver@oli1170.net>
  451. ----
  452. - main.c | 7 +++++++
  453. - 1 file changed, 7 insertions(+)
  454. -
  455. ---- a/main.c
  456. -+++ b/main.c
  457. -@@ -682,10 +682,17 @@ int acx_op_config(struct ieee80211_hw *h
  458. -
  459. - if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
  460. - logf1(L_DEBUG, "IEEE80211_CONF_CHANGE_CHANNEL,"
  461. -+#if CONFIG_ACX_MAC80211_VERSION >= KERNEL_VERSION(3, 10, 0)
  462. -+ "channel->hw_value=%i\n", conf->chandef.chan->hw_value);
  463. -+
  464. -+ acx_set_channel(adev, conf->chandef.chan->hw_value,
  465. -+ conf->chandef.chan->center_freq);
  466. -+#else
  467. - "channel->hw_value=%i\n", conf->channel->hw_value);
  468. -
  469. - acx_set_channel(adev, conf->channel->hw_value,
  470. - conf->channel->center_freq);
  471. -+#endif
  472. -
  473. - changed_not_done &= ~IEEE80211_CONF_CHANGE_CHANNEL;
  474. - }
  475. diff --git a/package/kernel/acx-mac80211/patches/004-Fix-3.14-build.patch b/package/kernel/acx-mac80211/patches/004-Fix-3.14-build.patch
  476. deleted file mode 100644
  477. index 847b573..0000000
  478. --- a/package/kernel/acx-mac80211/patches/004-Fix-3.14-build.patch
  479. +++ /dev/null
  480. @@ -1,22 +0,0 @@
  481. -From d17fcac710e629463591f6bd09d76b66ec591583 Mon Sep 17 00:00:00 2001
  482. -From: Hauke Mehrtens <hauke@hauke-m.de>
  483. -Date: Wed, 5 Feb 2014 20:57:07 +0100
  484. -Subject: [PATCH] Fix 3.14 build
  485. -
  486. -Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
  487. ----
  488. - main.c | 2 ++
  489. - 1 file changed, 2 insertions(+)
  490. -
  491. ---- a/main.c
  492. -+++ b/main.c
  493. -@@ -500,7 +500,9 @@ int acx_init_ieee80211(acx_device_t *ade
  494. - hw->flags &= ~IEEE80211_HW_RX_INCLUDES_FCS;
  495. - hw->queues = 1;
  496. - hw->wiphy->max_scan_ssids = 1;
  497. -+#if CONFIG_ACX_MAC80211_VERSION < KERNEL_VERSION(3, 14, 0)
  498. - hw->channel_change_time = 10000;
  499. -+#endif
  500. -
  501. - /* OW TODO Check if RTS/CTS threshold can be included here */
  502. -
  503. diff --git a/package/kernel/acx-mac80211/patches/300-api_sync.patch b/package/kernel/acx-mac80211/patches/300-api_sync.patch
  504. new file mode 100644
  505. index 0000000..94d6135
  506. --- /dev/null
  507. +++ b/package/kernel/acx-mac80211/patches/300-api_sync.patch
  508. @@ -0,0 +1,83 @@
  509. +--- a/main.c
  510. ++++ b/main.c
  511. +@@ -497,7 +497,7 @@ int acx_free_mechanics(acx_device_t *ade
  512. +
  513. + int acx_init_ieee80211(acx_device_t *adev, struct ieee80211_hw *hw)
  514. + {
  515. +- hw->flags &= ~IEEE80211_HW_RX_INCLUDES_FCS;
  516. ++ __clear_bit(IEEE80211_HW_RX_INCLUDES_FCS, hw->flags);
  517. + hw->queues = 1;
  518. + hw->wiphy->max_scan_ssids = 1;
  519. +
  520. +@@ -525,14 +525,14 @@ int acx_init_ieee80211(acx_device_t *ade
  521. + /* We base signal quality on winlevel approach of previous driver
  522. + * TODO OW 20100615 This should into a common init code
  523. + */
  524. +- hw->flags |= IEEE80211_HW_SIGNAL_UNSPEC;
  525. ++ __set_bit(IEEE80211_HW_SIGNAL_UNSPEC, hw->flags);
  526. + hw->max_signal = 100;
  527. +
  528. + if (IS_ACX100(adev)) {
  529. +- adev->hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
  530. ++ adev->hw->wiphy->bands[NL80211_BAND_2GHZ] =
  531. + &acx100_band_2GHz;
  532. + } else if (IS_ACX111(adev))
  533. +- adev->hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
  534. ++ adev->hw->wiphy->bands[NL80211_BAND_2GHZ] =
  535. + &acx111_band_2GHz;
  536. + else {
  537. + log(L_ANY, "Error: Unknown device");
  538. +@@ -945,8 +945,8 @@ void acx_op_configure_filter(struct ieee
  539. + changed_flags, *total_flags);
  540. +
  541. + /* OWI TODO: Set also FIF_PROBE_REQ ? */
  542. +- *total_flags &= (FIF_PROMISC_IN_BSS | FIF_ALLMULTI | FIF_FCSFAIL
  543. +- | FIF_CONTROL | FIF_OTHER_BSS);
  544. ++ *total_flags &= (FIF_ALLMULTI | FIF_FCSFAIL | FIF_CONTROL
  545. ++ | FIF_OTHER_BSS);
  546. +
  547. + logf1(L_DEBUG, "2: *total_flags=0x%08x\n", *total_flags);
  548. +
  549. +@@ -1045,9 +1045,10 @@ void acx_op_tx(struct ieee80211_hw *hw,
  550. + }
  551. +
  552. + int acx_op_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  553. +- struct cfg80211_scan_request *req)
  554. ++ struct ieee80211_scan_request *hw_req)
  555. + {
  556. + acx_device_t *adev = hw2adev(hw);
  557. ++ struct cfg80211_scan_request *req = &hw_req->req;
  558. + struct sk_buff *skb;
  559. + size_t ssid_len = 0;
  560. + u8 *ssid = NULL;
  561. +@@ -1082,7 +1083,7 @@ int acx_op_hw_scan(struct ieee80211_hw *
  562. + goto out;
  563. + }
  564. + #else
  565. +- skb = ieee80211_probereq_get(adev->hw, adev->vif, ssid, ssid_len,
  566. ++ skb = ieee80211_probereq_get(adev->hw, vif->addr, ssid, ssid_len,
  567. + req->ie_len);
  568. + if (!skb) {
  569. + ret = -ENOMEM;
  570. +--- a/main.h
  571. ++++ b/main.h
  572. +@@ -62,7 +62,7 @@ void acx_op_tx(struct ieee80211_hw *hw,
  573. + #endif
  574. +
  575. + int acx_op_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  576. +- struct cfg80211_scan_request *req);
  577. ++ struct ieee80211_scan_request *req);
  578. +
  579. + int acx_recover_hw(acx_device_t *adev);
  580. +
  581. +--- a/cardsetting.c
  582. ++++ b/cardsetting.c
  583. +@@ -159,7 +159,7 @@ int acx_set_channel(acx_device_t *adev,
  584. + int res = 0;
  585. +
  586. + adev->rx_status.freq = freq;
  587. +- adev->rx_status.band = IEEE80211_BAND_2GHZ;
  588. ++ adev->rx_status.band = NL80211_BAND_2GHZ;
  589. +
  590. + adev->channel = channel;
  591. +
  592. diff --git a/package/kernel/ath10k-ct/Makefile b/package/kernel/ath10k-ct/Makefile
  593. new file mode 100644
  594. index 0000000..bbff8d8
  595. --- /dev/null
  596. +++ b/package/kernel/ath10k-ct/Makefile
  597. @@ -0,0 +1,80 @@
  598. +include $(TOPDIR)/rules.mk
  599. +
  600. +PKG_NAME:=ath10k-ct
  601. +PKG_VERSION:=2016-08-24
  602. +PKG_RELEASE=1
  603. +
  604. +PKG_LICENSE:=GPLv2
  605. +PKG_LICENSE_FILES:=
  606. +
  607. +PKG_SOURCE_URL:=https://github.com/greearb/ath10k-ct.git
  608. +PKG_SOURCE_PROTO:=git
  609. +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  610. +PKG_SOURCE_VERSION:=cd725d5465e1d4476a504794c541afeeba84b479
  611. +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
  612. +
  613. +PKG_MAINTAINER:=Ben Greear <greearb@candelatech.com>
  614. +PKG_BUILD_PARALLEL:=1
  615. +
  616. +STAMP_CONFIGURED_DEPENDS := $(STAGING_DIR)/usr/include/mac80211-backport/backport/autoconf.h
  617. +
  618. +include $(INCLUDE_DIR)/kernel.mk
  619. +include $(INCLUDE_DIR)/package.mk
  620. +
  621. +define KernelPackage/ath10k-ct
  622. + SUBMENU:=Wireless Drivers
  623. + TITLE:=ath10k-ct driver optimized for CT ath10k firmware
  624. + DEPENDS:=+kmod-mac80211 +kmod-ath +@DRIVER_11N_SUPPORT @PCI_SUPPORT +@KERNEL_RELAY
  625. + FILES:=\
  626. + $(PKG_BUILD_DIR)/ath10k/ath10k_pci.ko \
  627. + $(PKG_BUILD_DIR)/ath10k/ath10k_core.ko
  628. + AUTOLOAD:=$(call AutoLoad,50,mac80211 ath ath10k_core ath10k_pci)
  629. +endef
  630. +
  631. +NOSTDINC_FLAGS = \
  632. + -I$(PKG_BUILD_DIR) \
  633. + -I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \
  634. + -I$(STAGING_DIR)/usr/include/mac80211-backport \
  635. + -I$(STAGING_DIR)/usr/include/mac80211/uapi \
  636. + -I$(STAGING_DIR)/usr/include/mac80211 \
  637. + -include backport/autoconf.h \
  638. + -include backport/backport.h
  639. +
  640. +ifdef CONFIG_PACKAGE_MAC80211_MESH
  641. + NOSTDINC_FLAGS += -DCONFIG_MAC80211_MESH
  642. +endif
  643. +
  644. +CT_MAKEDEFS += CONFIG_ATH10K=m CONFIG_ATH10K_PCI=m
  645. +# No AHB support enabled yet. Could conditionally enable it later.
  646. +#CT_MAKEDEFS += CONFIG_ATH10K_AHB=y
  647. +#NOSTDINC_FLAGS += -DCONFIG_ATH10K_AHB
  648. +NOSTDINC_FLAGS += -DSTANDALONE_CT
  649. +
  650. +ifdef CONFIG_PACKAGE_MAC80211_DEBUGFS
  651. + CT_MAKEDEFS += CONFIG_ATH10K_DEBUGFS=y CONFIG_MAC80211_DEBUGFS=y
  652. + NOSTDINC_FLAGS += -DCONFIG_MAC80211_DEBUGFS
  653. + NOSTDINC_FLAGS += -DCONFIG_ATH10K_DEBUGFS
  654. +endif
  655. +
  656. +ifdef CONFIG_PACKAGE_ATH_DEBUG
  657. + NOSTDINC_FLAGS += -DCONFIG_ATH10K_DEBUG
  658. +endif
  659. +
  660. +define Build/Configure
  661. + cp $(STAGING_DIR)/usr/include/mac80211/ath/*.h $(PKG_BUILD_DIR)
  662. +endef
  663. +
  664. +ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
  665. + CT_MAKEDEFS += V=1
  666. +endif
  667. +
  668. +define Build/Compile
  669. + +$(MAKE) $(CT_MAKEDEFS) $(PKG_JOBS) -C "$(LINUX_DIR)" \
  670. + ARCH="$(LINUX_KARCH)" \
  671. + CROSS_COMPILE="$(TARGET_CROSS)" \
  672. + SUBDIRS="$(PKG_BUILD_DIR)/ath10k" \
  673. + NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \
  674. + modules
  675. +endef
  676. +
  677. +$(eval $(call KernelPackage,ath10k-ct))
  678. diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile
  679. index 30da1cf..5c0ca3f 100644
  680. --- a/package/kernel/mac80211/Makefile
  681. +++ b/package/kernel/mac80211/Makefile
  682. @@ -10,20 +10,21 @@ include $(INCLUDE_DIR)/kernel.mk
  683. PKG_NAME:=mac80211
  684. -PKG_VERSION:=2016-01-10
  685. +PKG_VERSION:=2016-06-20
  686. PKG_RELEASE:=1
  687. PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources
  688. PKG_BACKPORT_VERSION:=
  689. -PKG_MD5SUM:=be5fae2e8d6f7490f9b073374fb895ba
  690. +PKG_MD5SUM:=29c79bdc3928ef5113b17042ebda9237
  691. PKG_SOURCE:=compat-wireless-$(PKG_VERSION)$(PKG_BACKPORT_VERSION).tar.bz2
  692. PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/compat-wireless-$(PKG_VERSION)
  693. PKG_BUILD_PARALLEL:=1
  694. -PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  695. +PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  696. PKG_DRIVERS = \
  697. adm8211 \
  698. + airo \
  699. ath ath5k ath9k ath9k-common ath9k-htc ath10k \
  700. b43 b43legacy \
  701. carl9170 \
  702. @@ -52,6 +53,7 @@ PKG_CONFIG_DEPENDS:= \
  703. $(patsubst %,CONFIG_PACKAGE_kmod-%,$(PKG_DRIVERS)) \
  704. CONFIG_PACKAGE_MAC80211_DEBUGFS \
  705. CONFIG_PACKAGE_MAC80211_MESH \
  706. + CONFIG_PACKAGE_MAC80211_TRACING \
  707. CONFIG_PACKAGE_ATH_DEBUG \
  708. CONFIG_PACKAGE_ATH_DFS \
  709. CONFIG_PACKAGE_B43_DEBUG \
  710. @@ -63,7 +65,12 @@ PKG_CONFIG_DEPENDS:= \
  711. CONFIG_PACKAGE_B43_BUSES_BCMA_AND_SSB \
  712. CONFIG_PACKAGE_B43_BUSES_BCMA \
  713. CONFIG_PACKAGE_B43_BUSES_SSB \
  714. + CONFIG_PACKAGE_BRCM80211_DEBUG \
  715. + CONFIG_PACKAGE_IWLWIFI_DEBUG \
  716. + CONFIG_PACKAGE_IWLWIFI_DEBUGFS \
  717. CONFIG_PACKAGE_RTLWIFI_DEBUG \
  718. + CONFIG_ATH9K_SUPPORT_PCOEM \
  719. + CONFIG_ATH9K_TX99 \
  720. CONFIG_ATH_USER_REGD \
  721. include $(INCLUDE_DIR)/package.mk
  722. @@ -73,7 +80,7 @@ WMENU:=Wireless Drivers
  723. define KernelPackage/mac80211/Default
  724. SUBMENU:=$(WMENU)
  725. URL:=https://wireless.wiki.kernel.org/
  726. - MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  727. + MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  728. endef
  729. define KernelPackage/cfg80211
  730. @@ -92,7 +99,7 @@ endef
  731. define KernelPackage/mac80211
  732. $(call KernelPackage/mac80211/Default)
  733. TITLE:=Linux 802.11 Wireless Networking Stack
  734. - DEPENDS+= +kmod-cfg80211 +hostapd-common +kmod-crypto-core +kmod-crypto-arc4
  735. + DEPENDS+= +kmod-cfg80211 +hostapd-common
  736. KCONFIG:=\
  737. CONFIG_AVERAGE=y
  738. FILES:= $(PKG_BUILD_DIR)/net/mac80211/mac80211.ko
  739. @@ -138,10 +145,23 @@ define KernelPackage/adm8211
  740. AUTOLOAD:=$(call AutoProbe,adm8211)
  741. endef
  742. +define KernelPackage/airo
  743. + $(call KernelPackage/mac80211/Default)
  744. + TITLE:=Cisco Aironet driver
  745. + DEPENDS+=@PCI_SUPPORT +@DRIVER_WEXT_SUPPORT +kmod-cfg80211 @TARGET_x86
  746. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/cisco/airo.ko
  747. + AUTOLOAD:=$(call AutoProbe,airo)
  748. +endef
  749. +
  750. +define KernelPackage/airo/description
  751. + Kernel support for Cisco Aironet cards
  752. +endef
  753. +
  754. define KernelPackage/ath/config
  755. if PACKAGE_kmod-ath
  756. config ATH_USER_REGD
  757. bool "Force Atheros drivers to respect the user's regdomain settings"
  758. + default y
  759. help
  760. Atheros' idea of regulatory handling is that the EEPROM of the card defines
  761. the regulatory limits and the user is only allowed to restrict the settings
  762. @@ -199,6 +219,7 @@ define KernelPackage/ath9k-common
  763. $(call KernelPackage/mac80211/Default)
  764. TITLE:=Atheros 802.11n wireless devices (common code for ath9k and ath9k_htc)
  765. URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
  766. + HIDDEN:=1
  767. DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT +@KERNEL_RELAY
  768. FILES:= \
  769. $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_common.ko \
  770. @@ -226,6 +247,10 @@ define KernelPackage/ath9k/config
  771. bool "Support chips used in PC OEM cards"
  772. depends on PACKAGE_kmod-ath9k
  773. + config ATH9K_TX99
  774. + bool "Enable TX99 support"
  775. + depends on PACKAGE_kmod-ath9k
  776. +
  777. endef
  778. define KernelPackage/ath9k-htc
  779. @@ -247,7 +272,7 @@ define KernelPackage/ath10k
  780. $(call KernelPackage/mac80211/Default)
  781. TITLE:=Atheros 802.11ac wireless cards support
  782. URL:=https://wireless.wiki.kernel.org/en/users/Drivers/ath10k
  783. - DEPENDS+= @PCI_SUPPORT +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT +@KERNEL_RELAY +ath10k-firmware-qca988x
  784. + DEPENDS+= @PCI_SUPPORT +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT +@KERNEL_RELAY
  785. FILES:= \
  786. $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_core.ko \
  787. $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_pci.ko
  788. @@ -673,6 +698,7 @@ define KernelPackage/brcmfmac/config
  789. config BRCMFMAC_SDIO
  790. bool "Enable SDIO bus interface support"
  791. + default y if TARGET_brcm2708
  792. default n
  793. help
  794. Enable support for cards attached to an SDIO bus.
  795. @@ -761,7 +787,7 @@ endef
  796. define KernelPackage/iwlwifi
  797. $(call KernelPackage/mac80211/Default)
  798. - DEPENDS:= +kmod-mac80211 @PCI_SUPPORT +@DRIVER_11N_SUPPORT +iwlwifi-firmware
  799. + DEPENDS:= +kmod-mac80211 @PCI_SUPPORT +@DRIVER_11N_SUPPORT +iwlwifi-firmware @!LINUX_3_18
  800. TITLE:=Intel AGN Wireless support
  801. FILES:= \
  802. $(PKG_BUILD_DIR)/drivers/net/wireless/intel/iwlwifi/iwlwifi.ko \
  803. @@ -870,7 +896,7 @@ endef
  804. define KernelPackage/lib80211
  805. $(call KernelPackage/mac80211/Default)
  806. TITLE:=802.11 Networking stack
  807. - DEPENDS:=+kmod-cfg80211
  808. + DEPENDS:=+kmod-cfg80211 +kmod-crypto-hash
  809. FILES:= \
  810. $(PKG_BUILD_DIR)/net/wireless/lib80211.ko \
  811. $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_wep.ko \
  812. @@ -897,7 +923,7 @@ endef
  813. define KernelPackage/libipw
  814. $(call KernelPackage/mac80211/Default)
  815. TITLE:=libipw for ipw2100 and ipw2200
  816. - DEPENDS:=@PCI_SUPPORT +kmod-crypto-michael-mic +kmod-crypto-core +kmod-crypto-arc4 +kmod-lib80211 +kmod-cfg80211 +@DRIVER_WEXT_SUPPORT @!BIG_ENDIAN
  817. + DEPENDS:=@PCI_SUPPORT +kmod-crypto-michael-mic +kmod-lib80211 +kmod-cfg80211 +@DRIVER_WEXT_SUPPORT @!BIG_ENDIAN
  818. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intel/ipw2x00/libipw.ko
  819. AUTOLOAD:=$(call AutoProbe,libipw)
  820. endef
  821. @@ -978,7 +1004,7 @@ endef
  822. define KernelPackage/libertas-spi
  823. $(call KernelPackage/mac80211/Default)
  824. SUBMENU:=Wireless Drivers
  825. - DEPENDS+= +kmod-cfg80211 +kmod-lib80211 +@DRIVER_WEXT_SUPPORT +libertas-spi-firmware
  826. + DEPENDS+= +kmod-cfg80211 +kmod-lib80211 +@DRIVER_WEXT_SUPPORT @!TARGET_uml +libertas-spi-firmware
  827. KCONFIG := \
  828. CONFIG_SPI=y \
  829. CONFIG_SPI_MASTER=y
  830. @@ -1036,33 +1062,6 @@ define KernelPackage/mwifiex-pcie/description
  831. Kernel modules for Marvell 802.11n/802.11ac PCIe Wireless cards
  832. endef
  833. -
  834. -# Prism54 drivers
  835. -P54PCIFW:=2.13.12.0.arm
  836. -P54USBFW:=2.13.24.0.lm87.arm
  837. -P54SPIFW:=2.13.0.0.a.13.14.arm
  838. -
  839. -define Download/p54usb
  840. - FILE:=$(P54USBFW)
  841. - URL:=http://daemonizer.de/prism54/prism54-fw/fw-usb
  842. - MD5SUM:=8e8ab005a4f8f0123bcdc51bc25b47f6
  843. -endef
  844. -$(eval $(call Download,p54usb))
  845. -
  846. -define Download/p54pci
  847. - FILE:=$(P54PCIFW)
  848. - URL:=http://daemonizer.de/prism54/prism54-fw/fw-softmac
  849. - MD5SUM:=ff7536af2092b1c4b21315bd103ef4c4
  850. -endef
  851. -$(eval $(call Download,p54pci))
  852. -
  853. -define Download/p54spi
  854. - FILE:=$(P54SPIFW)
  855. - URL:=http://daemonizer.de/prism54/prism54-fw/stlc4560
  856. - MD5SUM:=42661f8ecbadd88012807493f596081d
  857. -endef
  858. -$(eval $(call Download,p54spi))
  859. -
  860. define KernelPackage/p54/Default
  861. $(call KernelPackage/mac80211/Default)
  862. TITLE:=Prism54 Drivers
  863. @@ -1082,7 +1081,7 @@ endef
  864. define KernelPackage/p54-pci
  865. $(call KernelPackage/p54/Default)
  866. TITLE+= (PCI)
  867. - DEPENDS+= @PCI_SUPPORT +kmod-p54-common
  868. + DEPENDS+= @PCI_SUPPORT +kmod-p54-common +p54-pci-firmware
  869. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/p54/p54pci.ko
  870. AUTOLOAD:=$(call AutoProbe,p54pci)
  871. endef
  872. @@ -1090,7 +1089,7 @@ endef
  873. define KernelPackage/p54-usb
  874. $(call KernelPackage/p54/Default)
  875. TITLE+= (USB)
  876. - DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-p54-common
  877. + DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-p54-common +p54-usb-firmware
  878. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/p54/p54usb.ko
  879. AUTOLOAD:=$(call AutoProbe,p54usb)
  880. endef
  881. @@ -1098,7 +1097,7 @@ endef
  882. define KernelPackage/p54-spi
  883. $(call KernelPackage/p54/Default)
  884. TITLE+= (SPI)
  885. - DEPENDS+= @TARGET_omap24xx +kmod-p54-common
  886. + DEPENDS+= @TARGET_omap24xx +kmod-p54-common +p54-spi-firmware
  887. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/p54/p54spi.ko
  888. AUTOLOAD:=$(call AutoProbe,p54spi)
  889. endef
  890. @@ -1453,6 +1452,7 @@ config-y:= \
  891. WLAN_VENDOR_ATH \
  892. WLAN_VENDOR_ATMEL \
  893. WLAN_VENDOR_BROADCOM \
  894. + WLAN_VENDOR_CISCO \
  895. WLAN_VENDOR_INTEL \
  896. WLAN_VENDOR_INTERSIL \
  897. WLAN_VENDOR_MARVELL \
  898. @@ -1491,8 +1491,10 @@ endif
  899. config-$(call config_package,lib80211) += LIB80211 LIB80211_CRYPT_WEP LIB80211_CRYPT_CCMP LIB80211_CRYPT_TKIP
  900. +config-$(call config_package,airo) += AIRO
  901. +
  902. config-$(call config_package,ath) += ATH_CARDS ATH_COMMON
  903. -config-$(CONFIG_PACKAGE_ATH_DEBUG) += ATH_DEBUG ATH10K_DEBUG
  904. +config-$(CONFIG_PACKAGE_ATH_DEBUG) += ATH_DEBUG ATH10K_DEBUG ATH9K_STATION_STATISTICS
  905. config-$(CONFIG_PACKAGE_ATH_DFS) += ATH9K_DFS_CERTIFIED ATH10K_DFS_CERTIFIED
  906. config-$(call config_package,ath9k) += ATH9K
  907. @@ -1501,6 +1503,7 @@ config-$(CONFIG_TARGET_ar71xx) += ATH9K_AHB
  908. config-$(CONFIG_PCI) += ATH9K_PCI
  909. config-$(CONFIG_ATH_USER_REGD) += ATH_USER_REGD
  910. config-$(CONFIG_ATH9K_SUPPORT_PCOEM) += ATH9K_PCOEM
  911. +config-$(CONFIG_ATH9K_TX99) += ATH9K_TX99
  912. config-$(call config_package,ath9k-htc) += ATH9K_HTC
  913. config-$(call config_package,ath10k) += ATH10K ATH10K_PCI
  914. @@ -1742,21 +1745,6 @@ define KernelPackage/ipw2200/install
  915. $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(IPW2200_NAME)-$(IPW2200_VERSION)/ipw2200*.fw $(1)/lib/firmware
  916. endef
  917. -define KernelPackage/p54-pci/install
  918. - $(INSTALL_DIR) $(1)/lib/firmware
  919. - $(INSTALL_DATA) $(DL_DIR)/$(P54PCIFW) $(1)/lib/firmware/isl3886pci
  920. -endef
  921. -
  922. -define KernelPackage/p54-usb/install
  923. - $(INSTALL_DIR) $(1)/lib/firmware
  924. - $(INSTALL_DATA) $(DL_DIR)/$(P54USBFW) $(1)/lib/firmware/isl3887usb
  925. -endef
  926. -
  927. -define KernelPackage/p54-spi/install
  928. - $(INSTALL_DIR) $(1)/lib/firmware
  929. - $(INSTALL_DATA) $(DL_DIR)/$(P54SPIFW) $(1)/lib/firmware/3826.arm
  930. -endef
  931. -
  932. define KernelPackage/zd1211rw/install
  933. $(INSTALL_DIR) $(1)/lib/firmware/zd1211
  934. $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(ZD1211FW_NAME)/zd1211* $(1)/lib/firmware/zd1211
  935. @@ -1764,6 +1752,7 @@ endef
  936. $(eval $(call KernelPackage,adm8211))
  937. +$(eval $(call KernelPackage,airo))
  938. $(eval $(call KernelPackage,ath))
  939. $(eval $(call KernelPackage,ath10k))
  940. $(eval $(call KernelPackage,ath5k))
  941. diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
  942. index fb2f928..e3d612e 100644
  943. --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
  944. +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
  945. @@ -23,6 +23,7 @@ drv_mac80211_init_device_config() {
  946. config_add_int rxantenna txantenna antenna_gain txpower distance
  947. config_add_boolean noscan ht_coex
  948. config_add_array ht_capab
  949. + config_add_array channels
  950. config_add_boolean \
  951. rxldpc \
  952. short_gi_80 \
  953. @@ -89,6 +90,7 @@ mac80211_hostapd_setup_base() {
  954. json_select config
  955. [ "$auto_channel" -gt 0 ] && channel=acs_survey
  956. + [ "$auto_channel" -gt 0 ] && json_get_values channel_list channels
  957. json_get_vars noscan ht_coex
  958. json_get_values ht_capab_list ht_capab
  959. @@ -218,7 +220,6 @@ mac80211_hostapd_setup_base() {
  960. vht_max_a_mpdu_len_exp:7 \
  961. vht_max_mpdu:11454 \
  962. rx_stbc:4 \
  963. - tx_stbc:4 \
  964. vht_link_adapt:3 \
  965. vht160:2
  966. @@ -230,13 +231,13 @@ mac80211_hostapd_setup_base() {
  967. cap_rx_stbc=$((($vht_cap >> 8) & 7))
  968. [ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc="$rx_stbc"
  969. - ht_cap_mask="$(( ($vht_cap & ~(0x700)) | ($cap_rx_stbc << 8) ))"
  970. + vht_cap="$(( ($vht_cap & ~(0x700)) | ($cap_rx_stbc << 8) ))"
  971. mac80211_add_capabilities vht_capab $vht_cap \
  972. RXLDPC:0x10::$rxldpc \
  973. SHORT-GI-80:0x20::$short_gi_80 \
  974. SHORT-GI-160:0x40::$short_gi_160 \
  975. - TX-STBC-2BY1:0x80::$tx_stbc \
  976. + TX-STBC-2BY1:0x80::$tx_stbc_2by1 \
  977. SU-BEAMFORMER:0x800::$su_beamformer \
  978. SU-BEAMFORMEE:0x1000::$su_beamformee \
  979. MU-BEAMFORMER:0x80000::$mu_beamformer \
  980. @@ -245,10 +246,10 @@ mac80211_hostapd_setup_base() {
  981. HTC-VHT:0x400000::$htc_vht \
  982. RX-ANTENNA-PATTERN:0x10000000::$rx_antenna_pattern \
  983. TX-ANTENNA-PATTERN:0x20000000::$tx_antenna_pattern \
  984. - RX-STBC1:0x700:0x100:1 \
  985. - RX-STBC12:0x700:0x200:1 \
  986. - RX-STBC123:0x700:0x300:1 \
  987. - RX-STBC1234:0x700:0x400:1 \
  988. + RX-STBC-1:0x700:0x100:1 \
  989. + RX-STBC-12:0x700:0x200:1 \
  990. + RX-STBC-123:0x700:0x300:1 \
  991. + RX-STBC-1234:0x700:0x400:1 \
  992. # supported Channel widths
  993. vht160_hw=0
  994. @@ -301,6 +302,7 @@ mac80211_hostapd_setup_base() {
  995. hostapd_prepare_device_config "$hostapd_conf_file" nl80211
  996. cat >> "$hostapd_conf_file" <<EOF
  997. ${channel:+channel=$channel}
  998. +${channel_list:+chanlist=$channel_list}
  999. ${noscan:+noscan=$noscan}
  1000. $base_cfg
  1001. @@ -391,11 +393,10 @@ mac80211_generate_mac() {
  1002. find_phy() {
  1003. [ -n "$phy" -a -d /sys/class/ieee80211/$phy ] && return 0
  1004. [ -n "$path" ] && {
  1005. - for phy in /sys/devices/$path/ieee80211/phy*; do
  1006. - [ -e "$phy" ] && {
  1007. - phy="${phy##*/}"
  1008. - return 0
  1009. - }
  1010. + for phy in $(ls /sys/class/ieee80211 2>/dev/null); do
  1011. + case "$(readlink -f /sys/class/ieee80211/$phy/device)" in
  1012. + *$path) return 0;;
  1013. + esac
  1014. done
  1015. }
  1016. [ -n "$macaddr" ] && {
  1017. @@ -481,7 +482,7 @@ mac80211_prepare_vif() {
  1018. # All interfaces must have unique mac addresses
  1019. # which can either be explicitly set in the device
  1020. # section, or automatically generated
  1021. - ifconfig "$ifname" hw ether "$macaddr"
  1022. + ip link set dev "$ifname" address "$macaddr"
  1023. fi
  1024. json_select ..
  1025. @@ -496,7 +497,7 @@ mac80211_setup_supplicant() {
  1026. mac80211_setup_adhoc_htmode() {
  1027. case "$htmode" in
  1028. VHT20|HT20) ibss_htmode=HT20;;
  1029. - HT40*|VHT40|VHT80|VHT160)
  1030. + HT40*|VHT40|VHT160)
  1031. case "$hwmode" in
  1032. a)
  1033. case "$(( ($channel / 4) % 2 ))" in
  1034. @@ -520,6 +521,9 @@ mac80211_setup_adhoc_htmode() {
  1035. esac
  1036. [ "$auto_channel" -gt 0 ] && ibss_htmode="HT40+"
  1037. ;;
  1038. + VHT80)
  1039. + ibss_htmode="80MHZ"
  1040. + ;;
  1041. NONE|NOHT)
  1042. ibss_htmode="NOHT"
  1043. ;;
  1044. @@ -580,7 +584,7 @@ mac80211_setup_vif() {
  1045. json_get_vars mode
  1046. json_get_var vif_txpower txpower
  1047. - ifconfig "$ifname" up || {
  1048. + ip link set dev "$ifname" up || {
  1049. wireless_setup_vif_failed IFUP_ERROR
  1050. json_select ..
  1051. return
  1052. @@ -643,7 +647,7 @@ mac80211_interface_cleanup() {
  1053. local phy="$1"
  1054. for wdev in $(list_phy_interfaces "$phy"); do
  1055. - ifconfig "$wdev" down 2>/dev/null
  1056. + ip link set dev "$wdev" down 2>/dev/null
  1057. iw dev "$wdev" del
  1058. done
  1059. }
  1060. diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
  1061. index ea229d6..06f3b8b 100644
  1062. --- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh
  1063. +++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
  1064. @@ -9,11 +9,10 @@ lookup_phy() {
  1065. local devpath
  1066. config_get devpath "$device" path
  1067. [ -n "$devpath" ] && {
  1068. - for _phy in /sys/devices/$devpath/ieee80211/phy*; do
  1069. - [ -e "$_phy" ] && {
  1070. - phy="${_phy##*/}"
  1071. - return
  1072. - }
  1073. + for phy in $(ls /sys/class/ieee80211 2>/dev/null); do
  1074. + case "$(readlink -f /sys/class/ieee80211/$phy/device)" in
  1075. + *$devpath) return;;
  1076. + esac
  1077. done
  1078. }
  1079. @@ -102,6 +101,9 @@ detect_mac80211() {
  1080. fi
  1081. if [ -n "$path" ]; then
  1082. path="${path##/sys/devices/}"
  1083. + case "$path" in
  1084. + platform*/pci*) path="${path##platform/}";;
  1085. + esac
  1086. dev_id=" option path '$path'"
  1087. else
  1088. dev_id=" option macaddr $(cat /sys/class/ieee80211/${dev}/macaddress)"
  1089. diff --git a/package/kernel/mac80211/files/regdb.txt b/package/kernel/mac80211/files/regdb.txt
  1090. index 463ace3..c4a9b2d 100644
  1091. --- a/package/kernel/mac80211/files/regdb.txt
  1092. +++ b/package/kernel/mac80211/files/regdb.txt
  1093. @@ -136,19 +136,35 @@ country BF: DFS-FCC
  1094. (5490 - 5730 @ 160), (24), DFS
  1095. (5735 - 5835 @ 80), (30)
  1096. +# Bulgarian rules as defined by the Communications Regulation Commission in the
  1097. +# following documents:
  1098. +#
  1099. +# Rules for carrying out electronic communications through radio equipment using
  1100. +# radio spectrum, which does not need to be individually assigned (the Rules):
  1101. +# http://www.crc.bg/files/_bg/Pravila_09_06_2015.pdf
  1102. +#
  1103. +# List of radio equipment that uses harmonized within the European Union bands
  1104. +# and electronic communications terminal equipment (the List):
  1105. +# http://www.crc.bg/files/_bg/Spisak_2015.pdf
  1106. +#
  1107. +# Note: The transmit power limits in the 5250-5350 MHz and 5470-5725 MHz bands
  1108. +# can be raised by 3 dBm if TPC is enabled. Refer to BDS EN 301 893 for details.
  1109. country BG: DFS-ETSI
  1110. + # Wideband data transmission systems (WDTS) in the 2.4GHz ISM band, ref:
  1111. + # I.22 of the List, BDS EN 300 328
  1112. (2402 - 2482 @ 40), (20)
  1113. - (5170 - 5250 @ 80), (20), AUTO-BW
  1114. + # 5 GHz Radio Local Area Networks (RLANs), ref:
  1115. + # II.H01 of the List, BDS EN 301 893
  1116. + (5170 - 5250 @ 80), (23), AUTO-BW
  1117. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  1118. + # II.H01 of the List, I.54 from the List, BDS EN 301 893
  1119. (5490 - 5710 @ 160), (27), DFS
  1120. - # 5 GHz Short Range Devices, ref:
  1121. - # Etsi EN 300 440-1
  1122. - # Etsi EN 300 440-2
  1123. - # http://crc.bg/files/_bg/Spisak_2015.pdf
  1124. - # http://crc.bg/files/_bg/Pravila_2015_resh24.pdf
  1125. + # Short range devices (SRDs) in the 5725-5875 MHz frequency range, ref:
  1126. + # I.43 of the List, BDS EN 300 440-2, BDS EN 300 440-1
  1127. (5725 - 5875 @ 80), (14)
  1128. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  1129. - (57000 - 66000 @ 2160), (40)
  1130. + # 60 GHz Multiple-Gigabit RLAN Systems, ref:
  1131. + # II.H03 of the List, BDS EN 302 567-2
  1132. + (57000 - 66000 @ 2160), (40), NO-OUTDOOR
  1133. country BH: DFS-JP
  1134. (2402 - 2482 @ 40), (20)
  1135. @@ -275,6 +291,12 @@ country CR: DFS-FCC
  1136. (5490 - 5730 @ 20), (24), DFS
  1137. (5735 - 5835 @ 20), (30)
  1138. +# http://www.mincom.gob.cu/?q=marcoregulatorio
  1139. +# - Redes Informáticas
  1140. +# Resolución 127, 2011 - Reglamento Banda 2,4 GHz.
  1141. +country CU: DFS-FCC
  1142. + (2400 - 2483.5 @ 40), (200 mW)
  1143. +
  1144. country CX: DFS-FCC
  1145. (2402 - 2482 @ 40), (20)
  1146. (5170 - 5250 @ 80), (24), AUTO-BW
  1147. @@ -302,28 +324,41 @@ country CZ: DFS-ETSI
  1148. # 60 GHz band channels 1-4, ref: Etsi En 302 567
  1149. (57000 - 66000 @ 2160), (40)
  1150. -# Data from "Frequenznutzungsplan" (as published in April 2008), downloaded from
  1151. -# http://www.bundesnetzagentur.de/cae/servlet/contentblob/38448/publicationFile/2659/Frequenznutzungsplan2008_Id17448pdf.pdf
  1152. -# For the 5GHz range also see
  1153. -# http://www.bundesnetzagentur.de/cae/servlet/contentblob/38216/publicationFile/6579/WLAN5GHzVfg7_2010_28042010pdf.pdf
  1154. -# The values have been reduced by a factor of 2 (3db) for non TPC devices
  1155. -# (in other words: devices with TPC can use twice the tx power of this table).
  1156. -# Note that the docs do not require TPC for 5150--5250; the reduction to
  1157. -# 100mW thus is not strictly required -- however the conservative 100mW
  1158. +# Allocation for the 2.4 GHz band (Vfg 10 / 2013, Allgemeinzuteilung von
  1159. +# Frequenzen für die Nutzung in lokalen Netzwerken; Wireless Local Area
  1160. +# Networks (WLAN-Funkanwendungen).
  1161. +# https://www.bundesnetzagentur.de/SharedDocs/Downloads/DE/Sachgebiete/Telekommunikation/Unternehmen_Institutionen/Frequenzen/Allgemeinzuteilungen/2013_10_WLAN_2,4GHz_pdf.pdf
  1162. +#
  1163. +# Allocation for the 5 GHz band (Vfg. 7 / 2010, Allgemeinzuteilung von
  1164. +# Frequenzen in den Bereichen 5150 MHz - 5350 MHz und 5470 MHz - 5725 MHz für
  1165. +# Funkanwendungen zur breitbandigen Datenübertragung, WAS/WLAN („Wireless
  1166. +# Access Systems including Wireless Local Area Networks“).
  1167. +# https://www.bundesnetzagentur.de/SharedDocs/Downloads/DE/Sachgebiete/Telekommunikation/Unternehmen_Institutionen/Frequenzen/Allgemeinzuteilungen/2010_07_WLAN_5GHz_pdf.pdf
  1168. +# The values for the 5 GHz have been reduced by a factor of 2 (3db) for non TPC
  1169. +# devices (in other words: devices with TPC can use twice the tx power of this
  1170. +# table). Note that the docs do not require TPC for 5150--5250; the reduction
  1171. +# to 100mW thus is not strictly required -- however the conservative 100mW
  1172. # limit is used here as the non-interference with radar and satellite
  1173. # apps relies on the attenuation by the building walls only in the
  1174. # absence of DFS; the neighbour countries have 100mW limit here as well.
  1175. +#
  1176. +# The ETSI EN 300 440-1 standard for short range devices in the 5 GHz band has
  1177. +# been implemented in Germany:
  1178. +# https://www.bundesnetzagentur.de/SharedDocs/Downloads/DE/Sachgebiete/Telekommunikation/Unternehmen_Institutionen/Frequenzen/Allgemeinzuteilungen/2014_69_SRD_pdf.pdf
  1179. +#
  1180. +# Allocation for the 60 GHz band (Allgemeinzuteilung von Frequenzen im
  1181. +# Bereich 57 GHz - 66 GHz für Funkanwendungen für weitbandige
  1182. +# Datenübertragungssysteme; „Multiple Gigabit WAS/RLAN Systems (MGWS)“).
  1183. +# https://www.bundesnetzagentur.de/SharedDocs/Downloads/DE/Sachgebiete/Telekommunikation/Unternehmen_Institutionen/Frequenzen/Allgemeinzuteilungen/2011_08_MGWS_pdf.pdf
  1184. country DE: DFS-ETSI
  1185. - # entries 279004 and 280006
  1186. (2400 - 2483.5 @ 40), (100 mW)
  1187. - # entry 303005
  1188. (5150 - 5250 @ 80), (100 mW), NO-OUTDOOR, AUTO-BW
  1189. - # entries 304002 and 305002
  1190. (5250 - 5350 @ 80), (100 mW), NO-OUTDOOR, DFS, AUTO-BW
  1191. - # entries 308002, 309001 and 310003
  1192. (5470 - 5725 @ 160), (500 mW), DFS
  1193. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  1194. + # short range devices (ETSI EN 300 440-1)
  1195. + (5725 - 5875 @ 80), (25 mW)
  1196. + # 60 GHz band channels 1-4 (ETSI EN 302 567)
  1197. (57000 - 66000 @ 2160), (40)
  1198. country DK: DFS-ETSI
  1199. @@ -629,6 +664,9 @@ country KR: DFS-JP
  1200. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  1201. (5490 - 5710 @ 160), (30), DFS
  1202. (5735 - 5835 @ 80), (30)
  1203. + # 60 GHz band channels 1-4,
  1204. + # ref: http://www.law.go.kr/%ED%96%89%EC%A0%95%EA%B7%9C%EC%B9%99/%EB%AC%B4%EC%84%A0%EC%84%A4%EB%B9%84%EA%B7%9C%EC%B9%99
  1205. + (57000 - 66000 @ 2160), (43)
  1206. country KW: DFS-ETSI
  1207. (2402 - 2482 @ 40), (20)
  1208. @@ -844,11 +882,18 @@ country NI: DFS-FCC
  1209. (5490 - 5730 @ 160), (24), DFS
  1210. (5735 - 5835 @ 80), (30)
  1211. +# Regulation on the use of frequency space without a license and
  1212. +# without notification 2015
  1213. +#
  1214. +# http://wetten.overheid.nl/BWBR0036378/2015-03-05
  1215. +
  1216. country NL: DFS-ETSI
  1217. (2402 - 2482 @ 40), (20)
  1218. (5170 - 5250 @ 80), (20), NO-OUTDOOR, AUTO-BW
  1219. (5250 - 5330 @ 80), (20), NO-OUTDOOR, DFS, AUTO-BW
  1220. (5490 - 5710 @ 160), (27), DFS
  1221. + # short range devices (ETSI EN 300 440-1)
  1222. + (5725 - 5875 @ 80), (25 mW)
  1223. # 60 GHz band channels 1-4, ref: Etsi En 302 567
  1224. (57000 - 66000 @ 2160), (40)
  1225. diff --git a/package/kernel/mac80211/patches/004-backports-add-skb_free_frag.patch b/package/kernel/mac80211/patches/004-backports-add-skb_free_frag.patch
  1226. deleted file mode 100644
  1227. index 9adfd8f..0000000
  1228. --- a/package/kernel/mac80211/patches/004-backports-add-skb_free_frag.patch
  1229. +++ /dev/null
  1230. @@ -1,21 +0,0 @@
  1231. -From: Felix Fietkau <nbd@openwrt.org>
  1232. -Date: Thu, 28 Jan 2016 15:16:35 +0100
  1233. -Subject: [PATCH] backports: add skb_free_frag()
  1234. -
  1235. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  1236. ----
  1237. -
  1238. ---- a/backport-include/linux/skbuff.h
  1239. -+++ b/backport-include/linux/skbuff.h
  1240. -@@ -300,4 +300,11 @@ int skb_ensure_writable(struct sk_buff *
  1241. -
  1242. - #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) */
  1243. -
  1244. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
  1245. -+static inline void skb_free_frag(void *data)
  1246. -+{
  1247. -+ put_page(virt_to_head_page(data));
  1248. -+}
  1249. -+#endif
  1250. -+
  1251. - #endif /* __BACKPORT_SKBUFF_H */
  1252. diff --git a/package/kernel/mac80211/patches/004-fix_duplicate_skcipher_backport.patch b/package/kernel/mac80211/patches/004-fix_duplicate_skcipher_backport.patch
  1253. new file mode 100644
  1254. index 0000000..38b3179
  1255. --- /dev/null
  1256. +++ b/package/kernel/mac80211/patches/004-fix_duplicate_skcipher_backport.patch
  1257. @@ -0,0 +1,11 @@
  1258. +--- a/compat/Makefile
  1259. ++++ b/compat/Makefile
  1260. +@@ -35,8 +35,6 @@ compat-$(CPTCFG_KERNEL_4_6) += backport-
  1261. +
  1262. + compat-$(CPTCFG_BPAUTO_BUILD_CRYPTO_CCM) += crypto-ccm.o
  1263. + compat-$(CPTCFG_BPAUTO_CRYPTO_SKCIPHER) += crypto-skcipher.o
  1264. +-skcipher-objs += crypto-skcipher.o
  1265. +-obj-$(CPTCFG_BPAUTO_CRYPTO_SKCIPHER) += skcipher.o
  1266. + compat-$(CPTCFG_BPAUTO_BUILD_WANT_DEV_COREDUMP) += drivers-base-devcoredump.o
  1267. + compat-$(CPTCFG_BPAUTO_RHASHTABLE) += lib-rhashtable.o
  1268. + cordic-objs += lib-cordic.o
  1269. diff --git a/package/kernel/mac80211/patches/005-backport_skb_get_hash_perturb.patch b/package/kernel/mac80211/patches/005-backport_skb_get_hash_perturb.patch
  1270. new file mode 100644
  1271. index 0000000..29bccc1
  1272. --- /dev/null
  1273. +++ b/package/kernel/mac80211/patches/005-backport_skb_get_hash_perturb.patch
  1274. @@ -0,0 +1,22 @@
  1275. +--- a/backport-include/linux/skbuff.h
  1276. ++++ b/backport-include/linux/skbuff.h
  1277. +@@ -305,6 +305,19 @@ static inline void skb_free_frag(void *d
  1278. + {
  1279. + put_page(virt_to_head_page(data));
  1280. + }
  1281. ++
  1282. ++#include <net/flow_keys.h>
  1283. ++#include <linux/jhash.h>
  1284. ++
  1285. ++static inline u32 skb_get_hash_perturb(struct sk_buff *skb, u32 key)
  1286. ++{
  1287. ++ struct flow_keys keys;
  1288. ++
  1289. ++ skb_flow_dissect(skb, &keys);
  1290. ++ return jhash_3words((__force u32)keys.dst,
  1291. ++ (__force u32)keys.src ^ keys.ip_proto,
  1292. ++ (__force u32)keys.ports, key);
  1293. ++}
  1294. + #endif
  1295. +
  1296. + #endif /* __BACKPORT_SKBUFF_H */
  1297. diff --git a/package/kernel/mac80211/patches/005-backports-add-napi_alloc_frag.patch b/package/kernel/mac80211/patches/005-backports-add-napi_alloc_frag.patch
  1298. deleted file mode 100644
  1299. index 9b672a8..0000000
  1300. --- a/package/kernel/mac80211/patches/005-backports-add-napi_alloc_frag.patch
  1301. +++ /dev/null
  1302. @@ -1,20 +0,0 @@
  1303. -From: Felix Fietkau <nbd@openwrt.org>
  1304. -Date: Thu, 28 Jan 2016 15:19:22 +0100
  1305. -Subject: [PATCH] backports: add napi_alloc_frag
  1306. -
  1307. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  1308. ----
  1309. -
  1310. ---- a/backport-include/linux/netdevice.h
  1311. -+++ b/backport-include/linux/netdevice.h
  1312. -@@ -232,6 +232,10 @@ static inline void backport_unregister_n
  1313. - #define unregister_netdevice_many LINUX_BACKPORT(unregister_netdevice_many)
  1314. - #endif
  1315. -
  1316. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
  1317. -+#define napi_alloc_frag netdev_alloc_frag
  1318. -+#endif
  1319. -+
  1320. - /*
  1321. - * Complicated way of saying: We only backport netdev_rss_key stuff on kernels
  1322. - * that either already have net_get_random_once() (>= 3.13) or where we've been
  1323. diff --git a/package/kernel/mac80211/patches/006-add-basic-register-field-manipulation-macros.patch b/package/kernel/mac80211/patches/006-add-basic-register-field-manipulation-macros.patch
  1324. new file mode 100644
  1325. index 0000000..a51edf8
  1326. --- /dev/null
  1327. +++ b/package/kernel/mac80211/patches/006-add-basic-register-field-manipulation-macros.patch
  1328. @@ -0,0 +1,145 @@
  1329. +From: Jakub Kicinski <jakub.kicinski@netronome.com>
  1330. +Date: Wed, 31 Aug 2016 12:46:44 +0100
  1331. +Subject: [PATCH] add basic register-field manipulation macros
  1332. +
  1333. +Common approach to accessing register fields is to define
  1334. +structures or sets of macros containing mask and shift pair.
  1335. +Operations on the register are then performed as follows:
  1336. +
  1337. + field = (reg >> shift) & mask;
  1338. +
  1339. + reg &= ~(mask << shift);
  1340. + reg |= (field & mask) << shift;
  1341. +
  1342. +Defining shift and mask separately is tedious. Ivo van Doorn
  1343. +came up with an idea of computing them at compilation time
  1344. +based on a single shifted mask (later refined by Felix) which
  1345. +can be used like this:
  1346. +
  1347. + #define REG_FIELD 0x000ff000
  1348. +
  1349. + field = FIELD_GET(REG_FIELD, reg);
  1350. +
  1351. + reg &= ~REG_FIELD;
  1352. + reg |= FIELD_PREP(REG_FIELD, field);
  1353. +
  1354. +FIELD_{GET,PREP} macros take care of finding out what the
  1355. +appropriate shift is based on compilation time ffs operation.
  1356. +
  1357. +GENMASK can be used to define registers (which is usually
  1358. +less error-prone and easier to match with datasheets).
  1359. +
  1360. +This approach is the most convenient I've seen so to limit code
  1361. +multiplication let's move the macros to a global header file.
  1362. +Attempts to use static inlines instead of macros failed due
  1363. +to false positive triggering of BUILD_BUG_ON()s, especially with
  1364. +GCC < 6.0.
  1365. +
  1366. +Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
  1367. +Reviewed-by: Dinan Gunawardena <dinan.gunawardena@netronome.com>
  1368. +---
  1369. + create mode 100644 include/linux/bitfield.h
  1370. +
  1371. +--- /dev/null
  1372. ++++ b/include/linux/bitfield.h
  1373. +@@ -0,0 +1,100 @@
  1374. ++/*
  1375. ++ * Copyright (C) 2014 Felix Fietkau <nbd@nbd.name>
  1376. ++ * Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
  1377. ++ *
  1378. ++ * This program is free software; you can redistribute it and/or modify
  1379. ++ * it under the terms of the GNU General Public License version 2
  1380. ++ * as published by the Free Software Foundation
  1381. ++ *
  1382. ++ * This program is distributed in the hope that it will be useful,
  1383. ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1384. ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  1385. ++ * GNU General Public License for more details.
  1386. ++ */
  1387. ++
  1388. ++#ifndef _LINUX_BITFIELD_H
  1389. ++#define _LINUX_BITFIELD_H
  1390. ++
  1391. ++#include <linux/bug.h>
  1392. ++
  1393. ++#ifdef __CHECKER__
  1394. ++#define __BUILD_BUG_ON_NOT_POWER_OF_2(n) (0)
  1395. ++#else
  1396. ++#define __BUILD_BUG_ON_NOT_POWER_OF_2(n) \
  1397. ++ BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
  1398. ++#endif
  1399. ++
  1400. ++/*
  1401. ++ * Bitfield access macros
  1402. ++ *
  1403. ++ * FIELD_{GET,PREP} macros take as first parameter shifted mask
  1404. ++ * from which they extract the base mask and shift amount.
  1405. ++ * Mask must be a compilation time constant.
  1406. ++ *
  1407. ++ * Example:
  1408. ++ *
  1409. ++ * #define REG_FIELD_A GENMASK(6, 0)
  1410. ++ * #define REG_FIELD_B BIT(7)
  1411. ++ * #define REG_FIELD_C GENMASK(15, 8)
  1412. ++ * #define REG_FIELD_D GENMASK(31, 16)
  1413. ++ *
  1414. ++ * Get:
  1415. ++ * a = FIELD_GET(REG_FIELD_A, reg);
  1416. ++ * b = FIELD_GET(REG_FIELD_B, reg);
  1417. ++ *
  1418. ++ * Set:
  1419. ++ * reg = FIELD_PREP(REG_FIELD_A, 1) |
  1420. ++ * FIELD_PREP(REG_FIELD_B, 0) |
  1421. ++ * FIELD_PREP(REG_FIELD_C, c) |
  1422. ++ * FIELD_PREP(REG_FIELD_D, 0x40);
  1423. ++ *
  1424. ++ * Modify:
  1425. ++ * reg &= ~REG_FIELD_C;
  1426. ++ * reg |= FIELD_PREP(REG_FIELD_C, c);
  1427. ++ */
  1428. ++
  1429. ++#define __bf_shf(x) (__builtin_ffsll(x) - 1)
  1430. ++
  1431. ++#define __BF_FIELD_CHECK(_mask, _reg, _val, _pfx) \
  1432. ++ ({ \
  1433. ++ BUILD_BUG_ON_MSG(!__builtin_constant_p(_mask), \
  1434. ++ _pfx "mask is not constant"); \
  1435. ++ BUILD_BUG_ON_MSG(!(_mask), _pfx "mask is zero"); \
  1436. ++ BUILD_BUG_ON_MSG(__builtin_constant_p(_val) ? \
  1437. ++ ~((_mask) >> __bf_shf(_mask)) & (_val) : 0, \
  1438. ++ _pfx "value too large for the field"); \
  1439. ++ BUILD_BUG_ON_MSG((_mask) > (typeof(_reg))~0ull, \
  1440. ++ _pfx "type of reg too small for mask"); \
  1441. ++ __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) + \
  1442. ++ (1ULL << __bf_shf(_mask))); \
  1443. ++ })
  1444. ++
  1445. ++/**
  1446. ++ * FIELD_PREP() - prepare a bitfield element
  1447. ++ * @_mask: shifted mask defining the field's length and position
  1448. ++ * @_val: value to put in the field
  1449. ++ *
  1450. ++ * FIELD_PREP() masks and shifts up the value. The result should
  1451. ++ * be combined with other fields of the bitfield using logical OR.
  1452. ++ */
  1453. ++#define FIELD_PREP(_mask, _val) \
  1454. ++ ({ \
  1455. ++ __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
  1456. ++ ((typeof(_mask))(_val) << __bf_shf(_mask)) & (_mask); \
  1457. ++ })
  1458. ++
  1459. ++/**
  1460. ++ * FIELD_GET() - extract a bitfield element
  1461. ++ * @_mask: shifted mask defining the field's length and position
  1462. ++ * @_reg: 32bit value of entire bitfield
  1463. ++ *
  1464. ++ * FIELD_GET() extracts the field specified by @_mask from the
  1465. ++ * bitfield passed in as @_reg by masking and shifting it down.
  1466. ++ */
  1467. ++#define FIELD_GET(_mask, _reg) \
  1468. ++ ({ \
  1469. ++ __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
  1470. ++ (typeof(_mask))(((_reg) & (_mask)) >> __bf_shf(_mask)); \
  1471. ++ })
  1472. ++
  1473. ++#endif
  1474. diff --git a/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch b/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
  1475. index fd1e1cf..8be5fa1 100644
  1476. --- a/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
  1477. +++ b/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
  1478. @@ -1,6 +1,6 @@
  1479. --- a/.local-symbols
  1480. +++ b/.local-symbols
  1481. -@@ -476,44 +476,6 @@ USB_IPHETH=
  1482. +@@ -481,45 +481,6 @@ USB_IPHETH=
  1483. USB_SIERRA_NET=
  1484. USB_VL600=
  1485. USB_NET_CH9200=
  1486. @@ -37,6 +37,7 @@
  1487. -BCMA_DRIVER_PCI=
  1488. -BCMA_DRIVER_PCI_HOSTMODE=
  1489. -BCMA_DRIVER_MIPS=
  1490. +-BCMA_PFLASH=
  1491. -BCMA_SFLASH=
  1492. -BCMA_NFLASH=
  1493. -BCMA_DRIVER_GMAC_CMN=
  1494. @@ -56,7 +57,7 @@
  1495. return (bus->chipco.dev ? bus->chipco.dev : bus->pcicore.dev);
  1496. #else
  1497. return bus->chipco.dev;
  1498. -@@ -4903,7 +4903,7 @@ static int b43_wireless_core_init(struct
  1499. +@@ -4883,7 +4883,7 @@ static int b43_wireless_core_init(struct
  1500. }
  1501. if (sprom->boardflags_lo & B43_BFL_XTAL_NOSLOW)
  1502. hf |= B43_HF_DSCRQ; /* Disable slowclock requests from ucode. */
  1503. diff --git a/package/kernel/mac80211/patches/080-disable_clk_backport.patch b/package/kernel/mac80211/patches/080-disable_clk_backport.patch
  1504. deleted file mode 100644
  1505. index 3765591..0000000
  1506. --- a/package/kernel/mac80211/patches/080-disable_clk_backport.patch
  1507. +++ /dev/null
  1508. @@ -1,20 +0,0 @@
  1509. ---- a/compat/compat-3.6.c
  1510. -+++ b/compat/compat-3.6.c
  1511. -@@ -147,17 +147,3 @@ int sg_alloc_table_from_pages(struct sg_
  1512. - return 0;
  1513. - }
  1514. - EXPORT_SYMBOL_GPL(sg_alloc_table_from_pages);
  1515. --
  1516. --/* whoopsie ! */
  1517. --#ifndef CONFIG_COMMON_CLK
  1518. --int clk_enable(struct clk *clk)
  1519. --{
  1520. -- return 0;
  1521. --}
  1522. --EXPORT_SYMBOL_GPL(clk_enable);
  1523. --
  1524. --void clk_disable(struct clk *clk)
  1525. --{
  1526. --}
  1527. --EXPORT_SYMBOL_GPL(clk_disable);
  1528. --#endif
  1529. diff --git a/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch b/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
  1530. index 02f46c7..fbe22e5 100644
  1531. --- a/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
  1532. +++ b/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
  1533. @@ -309,7 +309,7 @@
  1534. #endif /* AES_GMAC_H */
  1535. --- a/net/mac80211/key.h
  1536. +++ b/net/mac80211/key.h
  1537. -@@ -84,7 +84,7 @@ struct ieee80211_key {
  1538. +@@ -88,7 +88,7 @@ struct ieee80211_key {
  1539. * Management frames.
  1540. */
  1541. u8 rx_pn[IEEE80211_NUM_TIDS + 1][IEEE80211_CCMP_PN_LEN];
  1542. @@ -320,7 +320,7 @@
  1543. struct {
  1544. --- a/net/mac80211/wpa.c
  1545. +++ b/net/mac80211/wpa.c
  1546. -@@ -307,7 +307,8 @@ ieee80211_crypto_tkip_decrypt(struct iee
  1547. +@@ -304,7 +304,8 @@ ieee80211_crypto_tkip_decrypt(struct iee
  1548. }
  1549. @@ -330,7 +330,7 @@
  1550. {
  1551. __le16 mask_fc;
  1552. int a4_included, mgmt;
  1553. -@@ -337,14 +338,8 @@ static void ccmp_special_blocks(struct s
  1554. +@@ -334,14 +335,8 @@ static void ccmp_special_blocks(struct s
  1555. else
  1556. qos_tid = 0;
  1557. @@ -347,7 +347,7 @@
  1558. /* Nonce: Nonce Flags | A2 | PN
  1559. * Nonce Flags: Priority (b0..b3) | Management (b4) | Reserved (b5..b7)
  1560. -@@ -352,6 +347,8 @@ static void ccmp_special_blocks(struct s
  1561. +@@ -349,6 +344,8 @@ static void ccmp_special_blocks(struct s
  1562. b_0[1] = qos_tid | (mgmt << 4);
  1563. memcpy(&b_0[2], hdr->addr2, ETH_ALEN);
  1564. memcpy(&b_0[8], pn, IEEE80211_CCMP_PN_LEN);
  1565. @@ -356,7 +356,7 @@
  1566. /* AAD (extra authenticate-only data) / masked 802.11 header
  1567. * FC | A1 | A2 | A3 | SC | [A4] | [QC] */
  1568. -@@ -463,7 +460,7 @@ static int ccmp_encrypt_skb(struct ieee8
  1569. +@@ -460,7 +457,7 @@ static int ccmp_encrypt_skb(struct ieee8
  1570. return 0;
  1571. pos += IEEE80211_CCMP_HDR_LEN;
  1572. @@ -365,7 +365,7 @@
  1573. ieee80211_aes_ccm_encrypt(key->u.ccmp.tfm, b_0, aad, pos, len,
  1574. skb_put(skb, mic_len), mic_len);
  1575. -@@ -534,7 +531,7 @@ ieee80211_crypto_ccmp_decrypt(struct iee
  1576. +@@ -537,7 +534,7 @@ ieee80211_crypto_ccmp_decrypt(struct iee
  1577. u8 aad[2 * AES_BLOCK_SIZE];
  1578. u8 b_0[AES_BLOCK_SIZE];
  1579. /* hardware didn't decrypt/verify MIC */
  1580. diff --git a/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch b/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch
  1581. index d1d9fbd..3ca166f 100644
  1582. --- a/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch
  1583. +++ b/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch
  1584. @@ -2,7 +2,7 @@ Used for AP+STA support in OpenWrt - preserve AP mode keys across STA reconnects
  1585. --- a/net/mac80211/cfg.c
  1586. +++ b/net/mac80211/cfg.c
  1587. -@@ -846,7 +846,6 @@ static int ieee80211_stop_ap(struct wiph
  1588. +@@ -850,7 +850,6 @@ static int ieee80211_stop_ap(struct wiph
  1589. sdata->u.ap.driver_smps_mode = IEEE80211_SMPS_OFF;
  1590. __sta_info_flush(sdata, true);
  1591. diff --git a/package/kernel/mac80211/patches/150-disable_addr_notifier.patch b/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
  1592. index 2855a88..16fab84 100644
  1593. --- a/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
  1594. +++ b/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
  1595. @@ -18,9 +18,9 @@
  1596. static int ieee80211_ifa6_changed(struct notifier_block *nb,
  1597. unsigned long data, void *arg)
  1598. {
  1599. -@@ -1087,14 +1087,14 @@ int ieee80211_register_hw(struct ieee802
  1600. -
  1601. - rtnl_unlock();
  1602. +@@ -1090,14 +1090,14 @@ int ieee80211_register_hw(struct ieee802
  1603. + if (result)
  1604. + goto fail_flows;
  1605. -#ifdef CONFIG_INET
  1606. +#ifdef __disabled__CONFIG_INET
  1607. @@ -35,7 +35,7 @@
  1608. local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed;
  1609. result = register_inet6addr_notifier(&local->ifa6_notifier);
  1610. if (result)
  1611. -@@ -1103,13 +1103,13 @@ int ieee80211_register_hw(struct ieee802
  1612. +@@ -1106,13 +1106,13 @@ int ieee80211_register_hw(struct ieee802
  1613. return 0;
  1614. @@ -51,8 +51,8 @@
  1615. +#if defined(__disabled__CONFIG_INET) || defined(__disabled__CONFIG_IPV6)
  1616. fail_ifa:
  1617. #endif
  1618. - rtnl_lock();
  1619. -@@ -1137,10 +1137,10 @@ void ieee80211_unregister_hw(struct ieee
  1620. + ieee80211_txq_teardown_flows(local);
  1621. +@@ -1142,10 +1142,10 @@ void ieee80211_unregister_hw(struct ieee
  1622. tasklet_kill(&local->tx_pending_tasklet);
  1623. tasklet_kill(&local->tasklet);
  1624. diff --git a/package/kernel/mac80211/patches/210-ap_scan.patch b/package/kernel/mac80211/patches/210-ap_scan.patch
  1625. index a99cbd2..29f05c4 100644
  1626. --- a/package/kernel/mac80211/patches/210-ap_scan.patch
  1627. +++ b/package/kernel/mac80211/patches/210-ap_scan.patch
  1628. @@ -1,6 +1,6 @@
  1629. --- a/net/mac80211/cfg.c
  1630. +++ b/net/mac80211/cfg.c
  1631. -@@ -1999,7 +1999,7 @@ static int ieee80211_scan(struct wiphy *
  1632. +@@ -2008,7 +2008,7 @@ static int ieee80211_scan(struct wiphy *
  1633. * the frames sent while scanning on other channel will be
  1634. * lost)
  1635. */
  1636. diff --git a/package/kernel/mac80211/patches/220-fq_disable_hack.patch b/package/kernel/mac80211/patches/220-fq_disable_hack.patch
  1637. new file mode 100644
  1638. index 0000000..7f420be
  1639. --- /dev/null
  1640. +++ b/package/kernel/mac80211/patches/220-fq_disable_hack.patch
  1641. @@ -0,0 +1,15 @@
  1642. +mac80211 fq has been found to cause a regression in multi-stream TCP
  1643. +performance. Disable it until the cause has been found and fixed
  1644. +
  1645. +--- a/include/net/fq_impl.h
  1646. ++++ b/include/net/fq_impl.h
  1647. +@@ -104,6 +104,9 @@ static struct fq_flow *fq_flow_classify(
  1648. +
  1649. + lockdep_assert_held(&fq->lock);
  1650. +
  1651. ++ /* HACK: disable fq for now until TCP issues are fixed */
  1652. ++ return get_default_func(fq, tin, 0, skb);
  1653. ++
  1654. + hash = skb_get_hash_perturb(skb, fq->perturbation);
  1655. + idx = reciprocal_scale(hash, fq->flows_cnt);
  1656. + flow = &fq->flows[idx];
  1657. diff --git a/package/kernel/mac80211/patches/300-ath9k-force-rx_clear-when-disabling-rx.patch b/package/kernel/mac80211/patches/300-ath9k-force-rx_clear-when-disabling-rx.patch
  1658. index bddb15a..098bda7 100644
  1659. --- a/package/kernel/mac80211/patches/300-ath9k-force-rx_clear-when-disabling-rx.patch
  1660. +++ b/package/kernel/mac80211/patches/300-ath9k-force-rx_clear-when-disabling-rx.patch
  1661. @@ -3,15 +3,16 @@ Date: Sun, 7 Jun 2015 13:53:35 +0200
  1662. Subject: [PATCH] ath9k: force rx_clear when disabling rx
  1663. This makes stopping Rx more reliable and should reduce the frequency of
  1664. -Rx related DMA stop warnings
  1665. +Rx related DMA stop warnings. Don't use rx_clear in TX99 mode.
  1666. Cc: stable@vger.kernel.org
  1667. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  1668. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  1669. +Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
  1670. ---
  1671. --- a/drivers/net/wireless/ath/ath9k/mac.c
  1672. +++ b/drivers/net/wireless/ath/ath9k/mac.c
  1673. -@@ -677,13 +677,15 @@ void ath9k_hw_startpcureceive(struct ath
  1674. +@@ -677,13 +677,18 @@ void ath9k_hw_startpcureceive(struct ath
  1675. ath9k_ani_reset(ah, is_scanning);
  1676. @@ -24,8 +25,11 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  1677. void ath9k_hw_abortpcurecv(struct ath_hw *ah)
  1678. {
  1679. - REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_ABORT | AR_DIAG_RX_DIS);
  1680. -+ REG_SET_BIT(ah, AR_DIAG_SW,
  1681. -+ AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT | AR_DIAG_FORCE_RX_CLEAR);
  1682. ++ u32 reg = AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT;
  1683. ++
  1684. ++ if (!config_enabled(CPTCFG_ATH9K_TX99))
  1685. ++ reg |= AR_DIAG_FORCE_RX_CLEAR;
  1686. ++ REG_SET_BIT(ah, AR_DIAG_SW, reg);
  1687. ath9k_hw_disable_mib_counters(ah);
  1688. }
  1689. diff --git a/package/kernel/mac80211/patches/302-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch b/package/kernel/mac80211/patches/302-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch
  1690. new file mode 100644
  1691. index 0000000..7caa9be
  1692. --- /dev/null
  1693. +++ b/package/kernel/mac80211/patches/302-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch
  1694. @@ -0,0 +1,37 @@
  1695. +From: Felix Fietkau <nbd@nbd.name>
  1696. +Date: Sat, 14 May 2016 14:51:02 +0200
  1697. +Subject: [PATCH] Revert "ath9k: interpret requested txpower in EIRP
  1698. + domain"
  1699. +
  1700. +This reverts commit 71f5137bf010c6faffab50c0ec15374c59c4a411.
  1701. +---
  1702. +
  1703. +--- a/drivers/net/wireless/ath/ath9k/hw.c
  1704. ++++ b/drivers/net/wireless/ath/ath9k/hw.c
  1705. +@@ -2914,7 +2914,8 @@ void ath9k_hw_apply_txpower(struct ath_h
  1706. + {
  1707. + struct ath_regulatory *reg = ath9k_hw_regulatory(ah);
  1708. + struct ieee80211_channel *channel;
  1709. +- int chan_pwr, new_pwr;
  1710. ++ int chan_pwr, new_pwr, max_gain;
  1711. ++ int ant_gain, ant_reduction = 0;
  1712. +
  1713. + if (!chan)
  1714. + return;
  1715. +@@ -2922,10 +2923,15 @@ void ath9k_hw_apply_txpower(struct ath_h
  1716. + channel = chan->chan;
  1717. + chan_pwr = min_t(int, channel->max_power * 2, MAX_RATE_POWER);
  1718. + new_pwr = min_t(int, chan_pwr, reg->power_limit);
  1719. ++ max_gain = chan_pwr - new_pwr + channel->max_antenna_gain * 2;
  1720. ++
  1721. ++ ant_gain = get_antenna_gain(ah, chan);
  1722. ++ if (ant_gain > max_gain)
  1723. ++ ant_reduction = ant_gain - max_gain;
  1724. +
  1725. + ah->eep_ops->set_txpower(ah, chan,
  1726. + ath9k_regd_get_ctl(reg, chan),
  1727. +- get_antenna_gain(ah, chan), new_pwr, test);
  1728. ++ ant_reduction, new_pwr, test);
  1729. + }
  1730. +
  1731. + void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test)
  1732. diff --git a/package/kernel/mac80211/patches/302-ath9k_hw-add-low-power-tx-gain-table-for-AR953x.patch b/package/kernel/mac80211/patches/302-ath9k_hw-add-low-power-tx-gain-table-for-AR953x.patch
  1733. deleted file mode 100644
  1734. index 22b987a..0000000
  1735. --- a/package/kernel/mac80211/patches/302-ath9k_hw-add-low-power-tx-gain-table-for-AR953x.patch
  1736. +++ /dev/null
  1737. @@ -1,95 +0,0 @@
  1738. -From: Felix Fietkau <nbd@openwrt.org>
  1739. -Date: Thu, 14 Jan 2016 03:14:03 +0100
  1740. -Subject: [PATCH] ath9k_hw: add low power tx gain table for AR953x
  1741. -
  1742. -Used in some newer TP-Link AR9533 devices.
  1743. -
  1744. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  1745. ----
  1746. -
  1747. ---- a/drivers/net/wireless/ath/ath9k/ar9003_hw.c
  1748. -+++ b/drivers/net/wireless/ath/ath9k/ar9003_hw.c
  1749. -@@ -698,6 +698,9 @@ static void ar9003_tx_gain_table_mode2(s
  1750. - else if (AR_SREV_9340(ah))
  1751. - INIT_INI_ARRAY(&ah->iniModesTxGain,
  1752. - ar9340Modes_low_ob_db_tx_gain_table_1p0);
  1753. -+ else if (AR_SREV_9531_11(ah))
  1754. -+ INIT_INI_ARRAY(&ah->iniModesTxGain,
  1755. -+ qca953x_1p1_modes_no_xpa_low_power_tx_gain_table);
  1756. - else if (AR_SREV_9485_11_OR_LATER(ah))
  1757. - INIT_INI_ARRAY(&ah->iniModesTxGain,
  1758. - ar9485Modes_low_ob_db_tx_gain_1_1);
  1759. ---- a/drivers/net/wireless/ath/ath9k/ar953x_initvals.h
  1760. -+++ b/drivers/net/wireless/ath/ath9k/ar953x_initvals.h
  1761. -@@ -757,6 +757,71 @@ static const u32 qca953x_1p1_modes_xpa_t
  1762. - {0x00016448, 0x6c927a70},
  1763. - };
  1764. -
  1765. -+static const u32 qca953x_1p1_modes_no_xpa_low_power_tx_gain_table[][2] = {
  1766. -+ /* Addr allmodes */
  1767. -+ {0x0000a2dc, 0xfff55592},
  1768. -+ {0x0000a2e0, 0xfff99924},
  1769. -+ {0x0000a2e4, 0xfffe1e00},
  1770. -+ {0x0000a2e8, 0xffffe000},
  1771. -+ {0x0000a410, 0x000050d6},
  1772. -+ {0x0000a500, 0x00000069},
  1773. -+ {0x0000a504, 0x0400006b},
  1774. -+ {0x0000a508, 0x0800006d},
  1775. -+ {0x0000a50c, 0x0c000269},
  1776. -+ {0x0000a510, 0x1000026b},
  1777. -+ {0x0000a514, 0x1400026d},
  1778. -+ {0x0000a518, 0x18000669},
  1779. -+ {0x0000a51c, 0x1c00066b},
  1780. -+ {0x0000a520, 0x1d000a68},
  1781. -+ {0x0000a524, 0x21000a6a},
  1782. -+ {0x0000a528, 0x25000a6c},
  1783. -+ {0x0000a52c, 0x29000a6e},
  1784. -+ {0x0000a530, 0x2d0012a9},
  1785. -+ {0x0000a534, 0x310012ab},
  1786. -+ {0x0000a538, 0x350012ad},
  1787. -+ {0x0000a53c, 0x39001b0a},
  1788. -+ {0x0000a540, 0x3d001b0c},
  1789. -+ {0x0000a544, 0x41001b0e},
  1790. -+ {0x0000a548, 0x43001bae},
  1791. -+ {0x0000a54c, 0x45001914},
  1792. -+ {0x0000a550, 0x47001916},
  1793. -+ {0x0000a554, 0x49001b96},
  1794. -+ {0x0000a558, 0x49001b96},
  1795. -+ {0x0000a55c, 0x49001b96},
  1796. -+ {0x0000a560, 0x49001b96},
  1797. -+ {0x0000a564, 0x49001b96},
  1798. -+ {0x0000a568, 0x49001b96},
  1799. -+ {0x0000a56c, 0x49001b96},
  1800. -+ {0x0000a570, 0x49001b96},
  1801. -+ {0x0000a574, 0x49001b96},
  1802. -+ {0x0000a578, 0x49001b96},
  1803. -+ {0x0000a57c, 0x49001b96},
  1804. -+ {0x0000a600, 0x00000000},
  1805. -+ {0x0000a604, 0x00000000},
  1806. -+ {0x0000a608, 0x00000000},
  1807. -+ {0x0000a60c, 0x00000000},
  1808. -+ {0x0000a610, 0x00000000},
  1809. -+ {0x0000a614, 0x00000000},
  1810. -+ {0x0000a618, 0x00804201},
  1811. -+ {0x0000a61c, 0x01408201},
  1812. -+ {0x0000a620, 0x01408502},
  1813. -+ {0x0000a624, 0x01408502},
  1814. -+ {0x0000a628, 0x01408502},
  1815. -+ {0x0000a62c, 0x01408502},
  1816. -+ {0x0000a630, 0x01408502},
  1817. -+ {0x0000a634, 0x01408502},
  1818. -+ {0x0000a638, 0x01408502},
  1819. -+ {0x0000a63c, 0x01408502},
  1820. -+ {0x0000b2dc, 0xfff55592},
  1821. -+ {0x0000b2e0, 0xfff99924},
  1822. -+ {0x0000b2e4, 0xfffe1e00},
  1823. -+ {0x0000b2e8, 0xffffe000},
  1824. -+ {0x00016044, 0x044922db},
  1825. -+ {0x00016048, 0x6c927a70},
  1826. -+ {0x00016444, 0x044922db},
  1827. -+ {0x00016448, 0x6c927a70},
  1828. -+};
  1829. -+
  1830. - static const u32 qca953x_2p0_baseband_core[][2] = {
  1831. - /* Addr allmodes */
  1832. - {0x00009800, 0xafe68e30},
  1833. diff --git a/package/kernel/mac80211/patches/303-ath10k-Ensure-txrx-compl-task-is-stopped-when-cleani.patch b/package/kernel/mac80211/patches/303-ath10k-Ensure-txrx-compl-task-is-stopped-when-cleani.patch
  1834. new file mode 100644
  1835. index 0000000..73accd8
  1836. --- /dev/null
  1837. +++ b/package/kernel/mac80211/patches/303-ath10k-Ensure-txrx-compl-task-is-stopped-when-cleani.patch
  1838. @@ -0,0 +1,21 @@
  1839. +From: Ben Greear <greearb@candelatech.com>
  1840. +Date: Fri, 1 Apr 2016 14:12:08 -0700
  1841. +Subject: [PATCH] ath10k: Ensure txrx-compl-task is stopped when cleaning
  1842. + htt-tx.
  1843. +
  1844. +Otherwise, the txrx-compl-task may access some bad memory?
  1845. +
  1846. +Signed-off-by: Ben Greear <greearb@candelatech.com>
  1847. +---
  1848. +
  1849. +--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
  1850. ++++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
  1851. +@@ -388,6 +388,8 @@ void ath10k_htt_tx_free(struct ath10k_ht
  1852. + {
  1853. + int size;
  1854. +
  1855. ++ tasklet_kill(&htt->txrx_compl_task);
  1856. ++
  1857. + idr_for_each(&htt->pending_tx, ath10k_htt_tx_clean_up_pending, htt->ar);
  1858. + idr_destroy(&htt->pending_tx);
  1859. +
  1860. diff --git a/package/kernel/mac80211/patches/303-rt2x00-fix-monitor-mode-regression.patch b/package/kernel/mac80211/patches/303-rt2x00-fix-monitor-mode-regression.patch
  1861. deleted file mode 100644
  1862. index 7bb7435..0000000
  1863. --- a/package/kernel/mac80211/patches/303-rt2x00-fix-monitor-mode-regression.patch
  1864. +++ /dev/null
  1865. @@ -1,156 +0,0 @@
  1866. -From: Eli Cooper <elicooper@gmx.com>
  1867. -Date: Thu, 14 Jan 2016 00:07:12 +0800
  1868. -Subject: [PATCH] rt2x00: fix monitor mode regression
  1869. -
  1870. -Since commit df1404650ccbfeb76a84f301f22316be0d00a864 monitor mode for rt2x00
  1871. -has been made effectively useless because the hardware filter is configured to
  1872. -drop packets whose intended recipient is not the device, regardless of the
  1873. -presence of monitor mode interfaces.
  1874. -
  1875. -This patch fixes this regression by adding explicit monitor mode support, and
  1876. -configuring the hardware filter accordingly.
  1877. -
  1878. -Signed-off-by: Eli Cooper <elicooper@gmx.com>
  1879. ----
  1880. -
  1881. ---- a/drivers/net/wireless/ralink/rt2x00/rt2400pci.c
  1882. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2400pci.c
  1883. -@@ -273,8 +273,10 @@ static void rt2400pci_config_filter(stru
  1884. - !(filter_flags & FIF_PLCPFAIL));
  1885. - rt2x00_set_field32(&reg, RXCSR0_DROP_CONTROL,
  1886. - !(filter_flags & FIF_CONTROL));
  1887. -- rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME, 1);
  1888. -+ rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME,
  1889. -+ !rt2x00dev->is_monitoring);
  1890. - rt2x00_set_field32(&reg, RXCSR0_DROP_TODS,
  1891. -+ !rt2x00dev->is_monitoring &&
  1892. - !rt2x00dev->intf_ap_count);
  1893. - rt2x00_set_field32(&reg, RXCSR0_DROP_VERSION_ERROR, 1);
  1894. - rt2x00mmio_register_write(rt2x00dev, RXCSR0, reg);
  1895. ---- a/drivers/net/wireless/ralink/rt2x00/rt2500pci.c
  1896. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2500pci.c
  1897. -@@ -274,8 +274,10 @@ static void rt2500pci_config_filter(stru
  1898. - !(filter_flags & FIF_PLCPFAIL));
  1899. - rt2x00_set_field32(&reg, RXCSR0_DROP_CONTROL,
  1900. - !(filter_flags & FIF_CONTROL));
  1901. -- rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME, 1);
  1902. -+ rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME,
  1903. -+ !rt2x00dev->is_monitoring);
  1904. - rt2x00_set_field32(&reg, RXCSR0_DROP_TODS,
  1905. -+ !rt2x00dev->is_monitoring &&
  1906. - !rt2x00dev->intf_ap_count);
  1907. - rt2x00_set_field32(&reg, RXCSR0_DROP_VERSION_ERROR, 1);
  1908. - rt2x00_set_field32(&reg, RXCSR0_DROP_MCAST,
  1909. ---- a/drivers/net/wireless/ralink/rt2x00/rt2500usb.c
  1910. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2500usb.c
  1911. -@@ -437,8 +437,10 @@ static void rt2500usb_config_filter(stru
  1912. - !(filter_flags & FIF_PLCPFAIL));
  1913. - rt2x00_set_field16(&reg, TXRX_CSR2_DROP_CONTROL,
  1914. - !(filter_flags & FIF_CONTROL));
  1915. -- rt2x00_set_field16(&reg, TXRX_CSR2_DROP_NOT_TO_ME, 1);
  1916. -+ rt2x00_set_field16(&reg, TXRX_CSR2_DROP_NOT_TO_ME,
  1917. -+ !rt2x00dev->is_monitoring);
  1918. - rt2x00_set_field16(&reg, TXRX_CSR2_DROP_TODS,
  1919. -+ !rt2x00dev->is_monitoring &&
  1920. - !rt2x00dev->intf_ap_count);
  1921. - rt2x00_set_field16(&reg, TXRX_CSR2_DROP_VERSION_ERROR, 1);
  1922. - rt2x00_set_field16(&reg, TXRX_CSR2_DROP_MULTICAST,
  1923. ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  1924. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  1925. -@@ -1490,7 +1490,8 @@ void rt2800_config_filter(struct rt2x00_
  1926. - !(filter_flags & FIF_FCSFAIL));
  1927. - rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_PHY_ERROR,
  1928. - !(filter_flags & FIF_PLCPFAIL));
  1929. -- rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_TO_ME, 1);
  1930. -+ rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_TO_ME,
  1931. -+ !rt2x00dev->is_monitoring);
  1932. - rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_MY_BSSD, 0);
  1933. - rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_VER_ERROR, 1);
  1934. - rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_MULTICAST,
  1935. ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  1936. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  1937. -@@ -844,11 +844,13 @@ struct rt2x00_dev {
  1938. - * - Open sta interface count.
  1939. - * - Association count.
  1940. - * - Beaconing enabled count.
  1941. -+ * - Whether the device is monitoring.
  1942. - */
  1943. - unsigned int intf_ap_count;
  1944. - unsigned int intf_sta_count;
  1945. - unsigned int intf_associated;
  1946. - unsigned int intf_beaconing;
  1947. -+ bool is_monitoring;
  1948. -
  1949. - /*
  1950. - * Interface combinations
  1951. ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00config.c
  1952. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00config.c
  1953. -@@ -244,6 +244,16 @@ void rt2x00lib_config(struct rt2x00_dev
  1954. - (ieee80211_flags & IEEE80211_CONF_CHANGE_PS))
  1955. - cancel_delayed_work_sync(&rt2x00dev->autowakeup_work);
  1956. -
  1957. -+ if (ieee80211_flags & IEEE80211_CONF_CHANGE_MONITOR) {
  1958. -+ if (conf->flags & IEEE80211_CONF_MONITOR) {
  1959. -+ rt2x00_dbg(rt2x00dev, "Monitor mode is enabled\n");
  1960. -+ rt2x00dev->is_monitoring = true;
  1961. -+ } else {
  1962. -+ rt2x00_dbg(rt2x00dev, "Monitor mode is disabled\n");
  1963. -+ rt2x00dev->is_monitoring = false;
  1964. -+ }
  1965. -+ }
  1966. -+
  1967. - /*
  1968. - * Start configuration.
  1969. - */
  1970. ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  1971. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  1972. -@@ -1204,6 +1204,7 @@ int rt2x00lib_start(struct rt2x00_dev *r
  1973. - rt2x00dev->intf_ap_count = 0;
  1974. - rt2x00dev->intf_sta_count = 0;
  1975. - rt2x00dev->intf_associated = 0;
  1976. -+ rt2x00dev->is_monitoring = false;
  1977. -
  1978. - /* Enable the radio */
  1979. - retval = rt2x00lib_enable_radio(rt2x00dev);
  1980. ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
  1981. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
  1982. -@@ -385,11 +385,6 @@ void rt2x00mac_configure_filter(struct i
  1983. - *total_flags |= FIF_PSPOLL;
  1984. - }
  1985. -
  1986. -- /*
  1987. -- * Check if there is any work left for us.
  1988. -- */
  1989. -- if (rt2x00dev->packet_filter == *total_flags)
  1990. -- return;
  1991. - rt2x00dev->packet_filter = *total_flags;
  1992. -
  1993. - rt2x00dev->ops->lib->config_filter(rt2x00dev, *total_flags);
  1994. ---- a/drivers/net/wireless/ralink/rt2x00/rt61pci.c
  1995. -+++ b/drivers/net/wireless/ralink/rt2x00/rt61pci.c
  1996. -@@ -530,8 +530,10 @@ static void rt61pci_config_filter(struct
  1997. - !(filter_flags & FIF_PLCPFAIL));
  1998. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_CONTROL,
  1999. - !(filter_flags & (FIF_CONTROL | FIF_PSPOLL)));
  2000. -- rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME, 1);
  2001. -+ rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME,
  2002. -+ !rt2x00dev->is_monitoring);
  2003. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_TO_DS,
  2004. -+ !rt2x00dev->is_monitoring &&
  2005. - !rt2x00dev->intf_ap_count);
  2006. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_VERSION_ERROR, 1);
  2007. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_MULTICAST,
  2008. ---- a/drivers/net/wireless/ralink/rt2x00/rt73usb.c
  2009. -+++ b/drivers/net/wireless/ralink/rt2x00/rt73usb.c
  2010. -@@ -480,8 +480,10 @@ static void rt73usb_config_filter(struct
  2011. - !(filter_flags & FIF_PLCPFAIL));
  2012. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_CONTROL,
  2013. - !(filter_flags & (FIF_CONTROL | FIF_PSPOLL)));
  2014. -- rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME, 1);
  2015. -+ rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME,
  2016. -+ !rt2x00dev->is_monitoring);
  2017. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_TO_DS,
  2018. -+ !rt2x00dev->is_monitoring &&
  2019. - !rt2x00dev->intf_ap_count);
  2020. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_VERSION_ERROR, 1);
  2021. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_MULTICAST,
  2022. diff --git a/package/kernel/mac80211/patches/304-ath10k-Ensure-peer_map-references-are-cleaned-up.patch b/package/kernel/mac80211/patches/304-ath10k-Ensure-peer_map-references-are-cleaned-up.patch
  2023. new file mode 100644
  2024. index 0000000..7dec1fb
  2025. --- /dev/null
  2026. +++ b/package/kernel/mac80211/patches/304-ath10k-Ensure-peer_map-references-are-cleaned-up.patch
  2027. @@ -0,0 +1,60 @@
  2028. +From: Ben Greear <greearb@candelatech.com>
  2029. +Date: Fri, 1 Apr 2016 14:12:09 -0700
  2030. +Subject: [PATCH] ath10k: Ensure peer_map references are cleaned up.
  2031. +
  2032. +While debugging OS crashes due to firmware crashes, I enabled
  2033. +kasan, and it noticed that peer objects were being used-after-freed.
  2034. +
  2035. +Looks like there are two places we could be leaving stale references
  2036. +in the peer-map, so clean that up.
  2037. +
  2038. +Signed-off-by: Ben Greear <greearb@candelatech.com>
  2039. +---
  2040. +
  2041. +--- a/drivers/net/wireless/ath/ath10k/mac.c
  2042. ++++ b/drivers/net/wireless/ath/ath10k/mac.c
  2043. +@@ -802,6 +802,7 @@ static void ath10k_peer_cleanup(struct a
  2044. + {
  2045. + struct ath10k_peer *peer, *tmp;
  2046. + int peer_id;
  2047. ++ int i;
  2048. +
  2049. + lockdep_assert_held(&ar->conf_mutex);
  2050. +
  2051. +@@ -818,6 +819,17 @@ static void ath10k_peer_cleanup(struct a
  2052. + ar->peer_map[peer_id] = NULL;
  2053. + }
  2054. +
  2055. ++ /* Double check that peer is properly un-referenced from
  2056. ++ * the peer_map
  2057. ++ */
  2058. ++ for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) {
  2059. ++ if (ar->peer_map[i] == peer) {
  2060. ++ ath10k_warn(ar, "removing stale peer_map entry for %pM (ptr %p idx %d)\n",
  2061. ++ peer->addr, peer, i);
  2062. ++ ar->peer_map[i] = NULL;
  2063. ++ }
  2064. ++ }
  2065. ++
  2066. + list_del(&peer->list);
  2067. + kfree(peer);
  2068. + ar->num_peers--;
  2069. +@@ -828,6 +840,7 @@ static void ath10k_peer_cleanup(struct a
  2070. + static void ath10k_peer_cleanup_all(struct ath10k *ar)
  2071. + {
  2072. + struct ath10k_peer *peer, *tmp;
  2073. ++ int i;
  2074. +
  2075. + lockdep_assert_held(&ar->conf_mutex);
  2076. +
  2077. +@@ -836,6 +849,10 @@ static void ath10k_peer_cleanup_all(stru
  2078. + list_del(&peer->list);
  2079. + kfree(peer);
  2080. + }
  2081. ++
  2082. ++ for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++)
  2083. ++ ar->peer_map[i] = NULL;
  2084. ++
  2085. + spin_unlock_bh(&ar->data_lock);
  2086. +
  2087. + ar->num_peers = 0;
  2088. diff --git a/package/kernel/mac80211/patches/304-ath9k-avoid-ANI-restart-if-no-trigger.patch b/package/kernel/mac80211/patches/304-ath9k-avoid-ANI-restart-if-no-trigger.patch
  2089. deleted file mode 100644
  2090. index 049059a..0000000
  2091. --- a/package/kernel/mac80211/patches/304-ath9k-avoid-ANI-restart-if-no-trigger.patch
  2092. +++ /dev/null
  2093. @@ -1,32 +0,0 @@
  2094. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  2095. -Date: Fri, 15 Jan 2016 18:17:17 +0800
  2096. -Subject: [PATCH] ath9k: avoid ANI restart if no trigger
  2097. -
  2098. -Fixes commit 54da20d83f0e ("ath9k_hw: improve ANI processing and rx desensitizing parameters")
  2099. -
  2100. -Call ath9k_ani_restart() only when the phy error rate reach the
  2101. -ANI immunity threshold. Sync the logic with internal code base.
  2102. -
  2103. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  2104. ----
  2105. -
  2106. ---- a/drivers/net/wireless/ath/ath9k/ani.c
  2107. -+++ b/drivers/net/wireless/ath/ath9k/ani.c
  2108. -@@ -444,14 +444,16 @@ void ath9k_hw_ani_monitor(struct ath_hw
  2109. - ofdmPhyErrRate < ah->config.ofdm_trig_low) {
  2110. - ath9k_hw_ani_lower_immunity(ah);
  2111. - aniState->ofdmsTurn = !aniState->ofdmsTurn;
  2112. -+ ath9k_ani_restart(ah);
  2113. - } else if (ofdmPhyErrRate > ah->config.ofdm_trig_high) {
  2114. - ath9k_hw_ani_ofdm_err_trigger(ah);
  2115. - aniState->ofdmsTurn = false;
  2116. -+ ath9k_ani_restart(ah);
  2117. - } else if (cckPhyErrRate > ah->config.cck_trig_high) {
  2118. - ath9k_hw_ani_cck_err_trigger(ah);
  2119. - aniState->ofdmsTurn = true;
  2120. -+ ath9k_ani_restart(ah);
  2121. - }
  2122. -- ath9k_ani_restart(ah);
  2123. - }
  2124. - }
  2125. - EXPORT_SYMBOL(ath9k_hw_ani_monitor);
  2126. diff --git a/package/kernel/mac80211/patches/305-ath10k-Clean-up-peer-when-sta-goes-away.patch b/package/kernel/mac80211/patches/305-ath10k-Clean-up-peer-when-sta-goes-away.patch
  2127. new file mode 100644
  2128. index 0000000..7248a8c
  2129. --- /dev/null
  2130. +++ b/package/kernel/mac80211/patches/305-ath10k-Clean-up-peer-when-sta-goes-away.patch
  2131. @@ -0,0 +1,32 @@
  2132. +From: Ben Greear <greearb@candelatech.com>
  2133. +Date: Fri, 1 Apr 2016 14:12:11 -0700
  2134. +Subject: [PATCH] ath10k: Clean up peer when sta goes away.
  2135. +
  2136. +If WMI and/or firmware has issues removing the peer object,
  2137. +then we still need to clean up the peer object in the driver.
  2138. +
  2139. +Signed-off-by: Ben Greear <greearb@candelatech.com>
  2140. +---
  2141. +
  2142. +--- a/drivers/net/wireless/ath/ath10k/mac.c
  2143. ++++ b/drivers/net/wireless/ath/ath10k/mac.c
  2144. +@@ -5992,9 +5992,17 @@ static int ath10k_sta_state(struct ieee8
  2145. + continue;
  2146. +
  2147. + if (peer->sta == sta) {
  2148. +- ath10k_warn(ar, "found sta peer %pM entry on vdev %i after it was supposedly removed\n",
  2149. +- sta->addr, arvif->vdev_id);
  2150. ++ ath10k_warn(ar, "found sta peer %pM (ptr %p id %d) entry on vdev %i after it was supposedly removed\n",
  2151. ++ sta->addr, peer, i, arvif->vdev_id);
  2152. + peer->sta = NULL;
  2153. ++
  2154. ++ /* Clean up the peer object as well since we
  2155. ++ * must have failed to do this above.
  2156. ++ */
  2157. ++ list_del(&peer->list);
  2158. ++ ar->peer_map[i] = NULL;
  2159. ++ kfree(peer);
  2160. ++ ar->num_peers--;
  2161. + }
  2162. + }
  2163. + spin_unlock_bh(&ar->data_lock);
  2164. diff --git a/package/kernel/mac80211/patches/305-ath9k-clean-up-ANI-per-channel-pointer-checking.patch b/package/kernel/mac80211/patches/305-ath9k-clean-up-ANI-per-channel-pointer-checking.patch
  2165. deleted file mode 100644
  2166. index a1ac67c..0000000
  2167. --- a/package/kernel/mac80211/patches/305-ath9k-clean-up-ANI-per-channel-pointer-checking.patch
  2168. +++ /dev/null
  2169. @@ -1,91 +0,0 @@
  2170. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  2171. -Date: Fri, 15 Jan 2016 18:17:18 +0800
  2172. -Subject: [PATCH] ath9k: clean up ANI per-channel pointer checking
  2173. -
  2174. -commit c24bd3620c50 ("ath9k: Do not maintain ANI state per-channel")
  2175. -removed per-channel handling, the code to check 'curchan' also
  2176. -should be removed as never used.
  2177. -
  2178. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  2179. ----
  2180. -
  2181. ---- a/drivers/net/wireless/ath/ath9k/ani.c
  2182. -+++ b/drivers/net/wireless/ath/ath9k/ani.c
  2183. -@@ -126,12 +126,8 @@ static void ath9k_hw_update_mibstats(str
  2184. -
  2185. - static void ath9k_ani_restart(struct ath_hw *ah)
  2186. - {
  2187. -- struct ar5416AniState *aniState;
  2188. --
  2189. -- if (!ah->curchan)
  2190. -- return;
  2191. -+ struct ar5416AniState *aniState = &ah->ani;
  2192. -
  2193. -- aniState = &ah->ani;
  2194. - aniState->listenTime = 0;
  2195. -
  2196. - ENABLE_REGWRITE_BUFFER(ah);
  2197. -@@ -221,12 +217,7 @@ static void ath9k_hw_set_ofdm_nil(struct
  2198. -
  2199. - static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hw *ah)
  2200. - {
  2201. -- struct ar5416AniState *aniState;
  2202. --
  2203. -- if (!ah->curchan)
  2204. -- return;
  2205. --
  2206. -- aniState = &ah->ani;
  2207. -+ struct ar5416AniState *aniState = &ah->ani;
  2208. -
  2209. - if (aniState->ofdmNoiseImmunityLevel < ATH9K_ANI_OFDM_MAX_LEVEL)
  2210. - ath9k_hw_set_ofdm_nil(ah, aniState->ofdmNoiseImmunityLevel + 1, false);
  2211. -@@ -281,12 +272,7 @@ static void ath9k_hw_set_cck_nil(struct
  2212. -
  2213. - static void ath9k_hw_ani_cck_err_trigger(struct ath_hw *ah)
  2214. - {
  2215. -- struct ar5416AniState *aniState;
  2216. --
  2217. -- if (!ah->curchan)
  2218. -- return;
  2219. --
  2220. -- aniState = &ah->ani;
  2221. -+ struct ar5416AniState *aniState = &ah->ani;
  2222. -
  2223. - if (aniState->cckNoiseImmunityLevel < ATH9K_ANI_CCK_MAX_LEVEL)
  2224. - ath9k_hw_set_cck_nil(ah, aniState->cckNoiseImmunityLevel + 1,
  2225. -@@ -299,9 +285,7 @@ static void ath9k_hw_ani_cck_err_trigger
  2226. - */
  2227. - static void ath9k_hw_ani_lower_immunity(struct ath_hw *ah)
  2228. - {
  2229. -- struct ar5416AniState *aniState;
  2230. --
  2231. -- aniState = &ah->ani;
  2232. -+ struct ar5416AniState *aniState = &ah->ani;
  2233. -
  2234. - /* lower OFDM noise immunity */
  2235. - if (aniState->ofdmNoiseImmunityLevel > 0 &&
  2236. -@@ -329,7 +313,7 @@ void ath9k_ani_reset(struct ath_hw *ah,
  2237. - struct ath_common *common = ath9k_hw_common(ah);
  2238. - int ofdm_nil, cck_nil;
  2239. -
  2240. -- if (!ah->curchan)
  2241. -+ if (!chan)
  2242. - return;
  2243. -
  2244. - BUG_ON(aniState == NULL);
  2245. -@@ -416,14 +400,10 @@ static bool ath9k_hw_ani_read_counters(s
  2246. -
  2247. - void ath9k_hw_ani_monitor(struct ath_hw *ah, struct ath9k_channel *chan)
  2248. - {
  2249. -- struct ar5416AniState *aniState;
  2250. -+ struct ar5416AniState *aniState = &ah->ani;
  2251. - struct ath_common *common = ath9k_hw_common(ah);
  2252. - u32 ofdmPhyErrRate, cckPhyErrRate;
  2253. -
  2254. -- if (!ah->curchan)
  2255. -- return;
  2256. --
  2257. -- aniState = &ah->ani;
  2258. - if (!ath9k_hw_ani_read_counters(ah))
  2259. - return;
  2260. -
  2261. diff --git a/package/kernel/mac80211/patches/306-ath9k-do-not-reset-while-BB-panic-0x4000409-on-ar956.patch b/package/kernel/mac80211/patches/306-ath9k-do-not-reset-while-BB-panic-0x4000409-on-ar956.patch
  2262. deleted file mode 100644
  2263. index cf8194a..0000000
  2264. --- a/package/kernel/mac80211/patches/306-ath9k-do-not-reset-while-BB-panic-0x4000409-on-ar956.patch
  2265. +++ /dev/null
  2266. @@ -1,31 +0,0 @@
  2267. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  2268. -Date: Fri, 15 Jan 2016 18:17:19 +0800
  2269. -Subject: [PATCH] ath9k: do not reset while BB panic(0x4000409) on ar9561
  2270. -
  2271. -BB panic(0x4000409) observed while AP enabling/disabling
  2272. -bursting.
  2273. -
  2274. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  2275. ----
  2276. -
  2277. ---- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  2278. -+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  2279. -@@ -2071,7 +2071,8 @@ void ar9003_hw_attach_phy_ops(struct ath
  2280. - * to be disabled.
  2281. - *
  2282. - * 0x04000409: Packet stuck on receive.
  2283. -- * Full chip reset is required for all chips except AR9340.
  2284. -+ * Full chip reset is required for all chips except
  2285. -+ * AR9340, AR9531 and AR9561.
  2286. - */
  2287. -
  2288. - /*
  2289. -@@ -2100,7 +2101,7 @@ bool ar9003_hw_bb_watchdog_check(struct
  2290. - case 0x04000b09:
  2291. - return true;
  2292. - case 0x04000409:
  2293. -- if (AR_SREV_9340(ah) || AR_SREV_9531(ah))
  2294. -+ if (AR_SREV_9340(ah) || AR_SREV_9531(ah) || AR_SREV_9561(ah))
  2295. - return false;
  2296. - else
  2297. - return true;
  2298. diff --git a/package/kernel/mac80211/patches/306-mac80211-add-hdrlen-to-ieee80211_tx_data.patch b/package/kernel/mac80211/patches/306-mac80211-add-hdrlen-to-ieee80211_tx_data.patch
  2299. new file mode 100644
  2300. index 0000000..4a8f143
  2301. --- /dev/null
  2302. +++ b/package/kernel/mac80211/patches/306-mac80211-add-hdrlen-to-ieee80211_tx_data.patch
  2303. @@ -0,0 +1,203 @@
  2304. +From: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  2305. +Date: Fri, 19 Feb 2016 11:01:49 +0100
  2306. +Subject: [PATCH] mac80211: add hdrlen to ieee80211_tx_data
  2307. +
  2308. +Add hdrlen to ieee80211_tx_data and use this
  2309. +when wep/ccmd/tkip. This is preparation for
  2310. +aligned4 code.
  2311. +
  2312. +Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  2313. +---
  2314. +
  2315. +--- a/net/mac80211/ieee80211_i.h
  2316. ++++ b/net/mac80211/ieee80211_i.h
  2317. +@@ -173,6 +173,7 @@ struct ieee80211_tx_data {
  2318. + struct ieee80211_tx_rate rate;
  2319. +
  2320. + unsigned int flags;
  2321. ++ unsigned int hdrlen;
  2322. + };
  2323. +
  2324. +
  2325. +--- a/net/mac80211/tx.c
  2326. ++++ b/net/mac80211/tx.c
  2327. +@@ -922,7 +922,7 @@ ieee80211_tx_h_fragment(struct ieee80211
  2328. + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  2329. + struct ieee80211_hdr *hdr = (void *)skb->data;
  2330. + int frag_threshold = tx->local->hw.wiphy->frag_threshold;
  2331. +- int hdrlen;
  2332. ++ int hdrlen = tx->hdrlen;
  2333. + int fragnum;
  2334. +
  2335. + /* no matter what happens, tx->skb moves to tx->skbs */
  2336. +@@ -943,8 +943,6 @@ ieee80211_tx_h_fragment(struct ieee80211
  2337. + if (WARN_ON(info->flags & IEEE80211_TX_CTL_AMPDU))
  2338. + return TX_DROP;
  2339. +
  2340. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2341. +-
  2342. + /* internal error, why isn't DONTFRAG set? */
  2343. + if (WARN_ON(skb->len + FCS_LEN <= frag_threshold))
  2344. + return TX_DROP;
  2345. +@@ -1176,6 +1174,8 @@ ieee80211_tx_prepare(struct ieee80211_su
  2346. +
  2347. + hdr = (struct ieee80211_hdr *) skb->data;
  2348. +
  2349. ++ tx->hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2350. ++
  2351. + if (likely(sta)) {
  2352. + if (!IS_ERR(sta))
  2353. + tx->sta = sta;
  2354. +--- a/net/mac80211/util.c
  2355. ++++ b/net/mac80211/util.c
  2356. +@@ -1226,6 +1226,7 @@ void ieee80211_send_auth(struct ieee8021
  2357. + struct ieee80211_local *local = sdata->local;
  2358. + struct sk_buff *skb;
  2359. + struct ieee80211_mgmt *mgmt;
  2360. ++ unsigned int hdrlen;
  2361. + int err;
  2362. +
  2363. + /* 24 + 6 = header + auth_algo + auth_transaction + status_code */
  2364. +@@ -1250,8 +1251,10 @@ void ieee80211_send_auth(struct ieee8021
  2365. + memcpy(skb_put(skb, extra_len), extra, extra_len);
  2366. +
  2367. + if (auth_alg == WLAN_AUTH_SHARED_KEY && transaction == 3) {
  2368. ++ hdrlen = ieee80211_hdrlen(mgmt->frame_control);
  2369. + mgmt->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
  2370. +- err = ieee80211_wep_encrypt(local, skb, key, key_len, key_idx);
  2371. ++ err = ieee80211_wep_encrypt(local, skb, hdrlen, key,
  2372. ++ key_len, key_idx);
  2373. + WARN_ON(err);
  2374. + }
  2375. +
  2376. +--- a/net/mac80211/wep.c
  2377. ++++ b/net/mac80211/wep.c
  2378. +@@ -89,11 +89,11 @@ static void ieee80211_wep_get_iv(struct
  2379. +
  2380. + static u8 *ieee80211_wep_add_iv(struct ieee80211_local *local,
  2381. + struct sk_buff *skb,
  2382. ++ unsigned int hdrlen,
  2383. + int keylen, int keyidx)
  2384. + {
  2385. + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  2386. + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  2387. +- unsigned int hdrlen;
  2388. + u8 *newhdr;
  2389. +
  2390. + hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
  2391. +@@ -101,7 +101,6 @@ static u8 *ieee80211_wep_add_iv(struct i
  2392. + if (WARN_ON(skb_headroom(skb) < IEEE80211_WEP_IV_LEN))
  2393. + return NULL;
  2394. +
  2395. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2396. + newhdr = skb_push(skb, IEEE80211_WEP_IV_LEN);
  2397. + memmove(newhdr, newhdr + IEEE80211_WEP_IV_LEN, hdrlen);
  2398. +
  2399. +@@ -160,6 +159,7 @@ int ieee80211_wep_encrypt_data(struct cr
  2400. + */
  2401. + int ieee80211_wep_encrypt(struct ieee80211_local *local,
  2402. + struct sk_buff *skb,
  2403. ++ unsigned int hdrlen,
  2404. + const u8 *key, int keylen, int keyidx)
  2405. + {
  2406. + u8 *iv;
  2407. +@@ -169,7 +169,7 @@ int ieee80211_wep_encrypt(struct ieee802
  2408. + if (WARN_ON(skb_tailroom(skb) < IEEE80211_WEP_ICV_LEN))
  2409. + return -1;
  2410. +
  2411. +- iv = ieee80211_wep_add_iv(local, skb, keylen, keyidx);
  2412. ++ iv = ieee80211_wep_add_iv(local, skb, hdrlen, keylen, keyidx);
  2413. + if (!iv)
  2414. + return -1;
  2415. +
  2416. +@@ -306,13 +306,14 @@ static int wep_encrypt_skb(struct ieee80
  2417. + struct ieee80211_key_conf *hw_key = info->control.hw_key;
  2418. +
  2419. + if (!hw_key) {
  2420. +- if (ieee80211_wep_encrypt(tx->local, skb, tx->key->conf.key,
  2421. ++ if (ieee80211_wep_encrypt(tx->local, skb, tx->hdrlen,
  2422. ++ tx->key->conf.key,
  2423. + tx->key->conf.keylen,
  2424. + tx->key->conf.keyidx))
  2425. + return -1;
  2426. + } else if ((hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV) ||
  2427. + (hw_key->flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE)) {
  2428. +- if (!ieee80211_wep_add_iv(tx->local, skb,
  2429. ++ if (!ieee80211_wep_add_iv(tx->local, skb, tx->hdrlen,
  2430. + tx->key->conf.keylen,
  2431. + tx->key->conf.keyidx))
  2432. + return -1;
  2433. +--- a/net/mac80211/wep.h
  2434. ++++ b/net/mac80211/wep.h
  2435. +@@ -22,6 +22,7 @@ int ieee80211_wep_encrypt_data(struct cr
  2436. + size_t klen, u8 *data, size_t data_len);
  2437. + int ieee80211_wep_encrypt(struct ieee80211_local *local,
  2438. + struct sk_buff *skb,
  2439. ++ unsigned int hdrlen,
  2440. + const u8 *key, int keylen, int keyidx);
  2441. + int ieee80211_wep_decrypt_data(struct crypto_cipher *tfm, u8 *rc4key,
  2442. + size_t klen, u8 *data, size_t data_len);
  2443. +--- a/net/mac80211/wpa.c
  2444. ++++ b/net/mac80211/wpa.c
  2445. +@@ -43,7 +43,7 @@ ieee80211_tx_h_michael_mic_add(struct ie
  2446. + skb->len < 24 || !ieee80211_is_data_present(hdr->frame_control))
  2447. + return TX_CONTINUE;
  2448. +
  2449. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2450. ++ hdrlen = tx->hdrlen;
  2451. + if (skb->len < hdrlen)
  2452. + return TX_DROP;
  2453. +
  2454. +@@ -186,7 +186,6 @@ mic_fail_no_key:
  2455. +
  2456. + static int tkip_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
  2457. + {
  2458. +- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
  2459. + struct ieee80211_key *key = tx->key;
  2460. + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  2461. + unsigned int hdrlen;
  2462. +@@ -201,7 +200,7 @@ static int tkip_encrypt_skb(struct ieee8
  2463. + return 0;
  2464. + }
  2465. +
  2466. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2467. ++ hdrlen = tx->hdrlen;
  2468. + len = skb->len - hdrlen;
  2469. +
  2470. + if (info->control.hw_key)
  2471. +@@ -418,7 +417,7 @@ static int ccmp_encrypt_skb(struct ieee8
  2472. + return 0;
  2473. + }
  2474. +
  2475. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2476. ++ hdrlen = tx->hdrlen;
  2477. + len = skb->len - hdrlen;
  2478. +
  2479. + if (info->control.hw_key)
  2480. +@@ -651,7 +650,7 @@ static int gcmp_encrypt_skb(struct ieee8
  2481. + return 0;
  2482. + }
  2483. +
  2484. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2485. ++ hdrlen = tx->hdrlen;
  2486. + len = skb->len - hdrlen;
  2487. +
  2488. + if (info->control.hw_key)
  2489. +@@ -791,7 +790,6 @@ static ieee80211_tx_result
  2490. + ieee80211_crypto_cs_encrypt(struct ieee80211_tx_data *tx,
  2491. + struct sk_buff *skb)
  2492. + {
  2493. +- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  2494. + struct ieee80211_key *key = tx->key;
  2495. + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  2496. + int hdrlen;
  2497. +@@ -807,8 +805,7 @@ ieee80211_crypto_cs_encrypt(struct ieee8
  2498. + pskb_expand_head(skb, iv_len, 0, GFP_ATOMIC)))
  2499. + return TX_DROP;
  2500. +
  2501. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2502. +-
  2503. ++ hdrlen = tx->hdrlen;
  2504. + pos = skb_push(skb, iv_len);
  2505. + memmove(pos, pos + iv_len, hdrlen);
  2506. +
  2507. diff --git a/package/kernel/mac80211/patches/307-ath9k-fix-inconsistent-use-of-tab-and-space-in-inden.patch b/package/kernel/mac80211/patches/307-ath9k-fix-inconsistent-use-of-tab-and-space-in-inden.patch
  2508. deleted file mode 100644
  2509. index 80b781c..0000000
  2510. --- a/package/kernel/mac80211/patches/307-ath9k-fix-inconsistent-use-of-tab-and-space-in-inden.patch
  2511. +++ /dev/null
  2512. @@ -1,27 +0,0 @@
  2513. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  2514. -Date: Fri, 15 Jan 2016 18:17:20 +0800
  2515. -Subject: [PATCH] ath9k: fix inconsistent use of tab and space in
  2516. - indentation
  2517. -
  2518. -Minor changes for indenting.
  2519. -
  2520. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  2521. ----
  2522. -
  2523. ---- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
  2524. -+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
  2525. -@@ -5485,11 +5485,11 @@ unsigned int ar9003_get_paprd_scale_fact
  2526. - AR9300_PAPRD_SCALE_1);
  2527. - else {
  2528. - if (chan->channel >= 5700)
  2529. -- return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt20),
  2530. -- AR9300_PAPRD_SCALE_1);
  2531. -+ return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt20),
  2532. -+ AR9300_PAPRD_SCALE_1);
  2533. - else if (chan->channel >= 5400)
  2534. - return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt40),
  2535. -- AR9300_PAPRD_SCALE_2);
  2536. -+ AR9300_PAPRD_SCALE_2);
  2537. - else
  2538. - return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt40),
  2539. - AR9300_PAPRD_SCALE_1);
  2540. diff --git a/package/kernel/mac80211/patches/307-mac80211-add-NEED_ALIGNED4_SKBS-hw-flag.patch b/package/kernel/mac80211/patches/307-mac80211-add-NEED_ALIGNED4_SKBS-hw-flag.patch
  2541. new file mode 100644
  2542. index 0000000..eeb881e
  2543. --- /dev/null
  2544. +++ b/package/kernel/mac80211/patches/307-mac80211-add-NEED_ALIGNED4_SKBS-hw-flag.patch
  2545. @@ -0,0 +1,235 @@
  2546. +From: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  2547. +Date: Fri, 19 Feb 2016 11:01:50 +0100
  2548. +Subject: [PATCH] mac80211: add NEED_ALIGNED4_SKBS hw flag
  2549. +
  2550. +HW/driver should set NEED_ALIGNED4_SKBS flag in case
  2551. +require aligned skbs to four-byte boundaries.
  2552. +This affect only TX direction.
  2553. +
  2554. +Padding is added after ieee80211_hdr, before IV/LLC.
  2555. +
  2556. +Before we have to do memmove(hdrlen) twice in the
  2557. +dirver. Once before we pass this to HW and next
  2558. +in tx completion (to be sure monitor will report
  2559. +this tx frame correctly).
  2560. +
  2561. +With this patch we can skip this memmove() and save CPU.
  2562. +
  2563. +Currently this was tested with ath9k, both hw/sw crypt for
  2564. +wep/tkip/ccmp.
  2565. +
  2566. +Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  2567. +---
  2568. +
  2569. +--- a/include/net/mac80211.h
  2570. ++++ b/include/net/mac80211.h
  2571. +@@ -2014,6 +2014,9 @@ struct ieee80211_txq {
  2572. + * @IEEE80211_HW_TX_FRAG_LIST: Hardware (or driver) supports sending frag_list
  2573. + * skbs, needed for zero-copy software A-MSDU.
  2574. + *
  2575. ++ * @IEEE80211_HW_NEEDS_ALIGNED4_SKBS: Driver need aligned skbs to four-byte.
  2576. ++ * Padding will be added after ieee80211_hdr, before IV/LLC.
  2577. ++ *
  2578. + * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
  2579. + */
  2580. + enum ieee80211_hw_flags {
  2581. +@@ -2054,6 +2057,7 @@ enum ieee80211_hw_flags {
  2582. + IEEE80211_HW_USES_RSS,
  2583. + IEEE80211_HW_TX_AMSDU,
  2584. + IEEE80211_HW_TX_FRAG_LIST,
  2585. ++ IEEE80211_HW_NEEDS_ALIGNED4_SKBS,
  2586. +
  2587. + /* keep last, obviously */
  2588. + NUM_IEEE80211_HW_FLAGS
  2589. +--- a/net/mac80211/debugfs.c
  2590. ++++ b/net/mac80211/debugfs.c
  2591. +@@ -302,6 +302,7 @@ static const char *hw_flag_names[] = {
  2592. + FLAG(USES_RSS),
  2593. + FLAG(TX_AMSDU),
  2594. + FLAG(TX_FRAG_LIST),
  2595. ++ FLAG(NEEDS_ALIGNED4_SKBS),
  2596. + #undef FLAG
  2597. + };
  2598. +
  2599. +--- a/net/mac80211/ieee80211_i.h
  2600. ++++ b/net/mac80211/ieee80211_i.h
  2601. +@@ -1497,6 +1497,29 @@ ieee80211_have_rx_timestamp(struct ieee8
  2602. + return false;
  2603. + }
  2604. +
  2605. ++static inline unsigned int
  2606. ++ieee80211_hdr_padsize(struct ieee80211_hw *hw, unsigned int hdrlen)
  2607. ++{
  2608. ++ /*
  2609. ++ * While hdrlen is already aligned to two-byte boundaries,
  2610. ++ * simple check with & 2 will return correct padsize.
  2611. ++ */
  2612. ++ if (ieee80211_hw_check(hw, NEEDS_ALIGNED4_SKBS))
  2613. ++ return hdrlen & 2;
  2614. ++ return 0;
  2615. ++}
  2616. ++
  2617. ++static inline unsigned int
  2618. ++ieee80211_padded_hdrlen(struct ieee80211_hw *hw, __le16 fc)
  2619. ++{
  2620. ++ unsigned int hdrlen;
  2621. ++
  2622. ++ hdrlen = ieee80211_hdrlen(fc);
  2623. ++ hdrlen += ieee80211_hdr_padsize(hw, hdrlen);
  2624. ++
  2625. ++ return hdrlen;
  2626. ++}
  2627. ++
  2628. + u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local,
  2629. + struct ieee80211_rx_status *status,
  2630. + unsigned int mpdu_len,
  2631. +--- a/net/mac80211/sta_info.h
  2632. ++++ b/net/mac80211/sta_info.h
  2633. +@@ -279,7 +279,7 @@ struct ieee80211_fast_tx {
  2634. + u8 hdr_len;
  2635. + u8 sa_offs, da_offs, pn_offs;
  2636. + u8 band;
  2637. +- u8 hdr[30 + 2 + IEEE80211_FAST_XMIT_MAX_IV +
  2638. ++ u8 hdr[30 + 2 + 2 + IEEE80211_FAST_XMIT_MAX_IV +
  2639. + sizeof(rfc1042_header)] __aligned(2);
  2640. +
  2641. + struct rcu_head rcu_head;
  2642. +--- a/net/mac80211/status.c
  2643. ++++ b/net/mac80211/status.c
  2644. +@@ -683,9 +683,22 @@ void ieee80211_tx_monitor(struct ieee802
  2645. + struct sk_buff *skb2;
  2646. + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  2647. + struct ieee80211_sub_if_data *sdata;
  2648. ++ struct ieee80211_hdr *hdr = (void *)skb->data;
  2649. + struct net_device *prev_dev = NULL;
  2650. ++ unsigned int hdrlen, padsize;
  2651. + int rtap_len;
  2652. +
  2653. ++ /* Remove padding if was added */
  2654. ++ if (ieee80211_hw_check(&local->hw, NEEDS_ALIGNED4_SKBS)) {
  2655. ++ hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2656. ++ padsize = ieee80211_hdr_padsize(&local->hw, hdrlen);
  2657. ++
  2658. ++ if (padsize && skb->len > hdrlen + padsize) {
  2659. ++ memmove(skb->data + padsize, skb->data, hdrlen);
  2660. ++ skb_pull(skb, padsize);
  2661. ++ }
  2662. ++ }
  2663. ++
  2664. + /* send frame to monitor interfaces now */
  2665. + rtap_len = ieee80211_tx_radiotap_len(info);
  2666. + if (WARN_ON_ONCE(skb_headroom(skb) < rtap_len)) {
  2667. +--- a/net/mac80211/tkip.c
  2668. ++++ b/net/mac80211/tkip.c
  2669. +@@ -201,10 +201,12 @@ void ieee80211_get_tkip_p2k(struct ieee8
  2670. + {
  2671. + struct ieee80211_key *key = (struct ieee80211_key *)
  2672. + container_of(keyconf, struct ieee80211_key, conf);
  2673. ++ struct ieee80211_hw *hw = &key->local->hw;
  2674. + const u8 *tk = &key->conf.key[NL80211_TKIP_DATA_OFFSET_ENCR_KEY];
  2675. + struct tkip_ctx *ctx = &key->u.tkip.tx;
  2676. + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  2677. +- const u8 *data = (u8 *)hdr + ieee80211_hdrlen(hdr->frame_control);
  2678. ++ const u8 *data = (u8 *)hdr + ieee80211_padded_hdrlen(hw,
  2679. ++ hdr->frame_control);
  2680. + u32 iv32 = get_unaligned_le32(&data[4]);
  2681. + u16 iv16 = data[2] | (data[0] << 8);
  2682. +
  2683. +--- a/net/mac80211/tx.c
  2684. ++++ b/net/mac80211/tx.c
  2685. +@@ -1173,8 +1173,7 @@ ieee80211_tx_prepare(struct ieee80211_su
  2686. + info->flags &= ~IEEE80211_TX_INTFL_NEED_TXPROCESSING;
  2687. +
  2688. + hdr = (struct ieee80211_hdr *) skb->data;
  2689. +-
  2690. +- tx->hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2691. ++ tx->hdrlen = ieee80211_padded_hdrlen(&local->hw, hdr->frame_control);
  2692. +
  2693. + if (likely(sta)) {
  2694. + if (!IS_ERR(sta))
  2695. +@@ -2108,7 +2107,7 @@ netdev_tx_t ieee80211_monitor_start_xmit
  2696. + goto fail;
  2697. +
  2698. + hdr = (struct ieee80211_hdr *)(skb->data + len_rthdr);
  2699. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2700. ++ hdrlen = ieee80211_padded_hdrlen(&local->hw, hdr->frame_control);
  2701. +
  2702. + if (skb->len < len_rthdr + hdrlen)
  2703. + goto fail;
  2704. +@@ -2334,7 +2333,7 @@ static struct sk_buff *ieee80211_build_h
  2705. + struct ieee80211_chanctx_conf *chanctx_conf;
  2706. + struct ieee80211_sub_if_data *ap_sdata;
  2707. + enum nl80211_band band;
  2708. +- int ret;
  2709. ++ int padsize, ret;
  2710. +
  2711. + if (IS_ERR(sta))
  2712. + sta = NULL;
  2713. +@@ -2554,6 +2553,9 @@ static struct sk_buff *ieee80211_build_h
  2714. + hdrlen += 2;
  2715. + }
  2716. +
  2717. ++ /* Check aligned4 skb required */
  2718. ++ padsize = ieee80211_hdr_padsize(&sdata->local->hw, hdrlen);
  2719. ++
  2720. + /*
  2721. + * Drop unicast frames to unauthorised stations unless they are
  2722. + * EAPOL frames from the local station.
  2723. +@@ -2640,6 +2642,7 @@ static struct sk_buff *ieee80211_build_h
  2724. + h_pos -= skip_header_bytes;
  2725. +
  2726. + head_need = hdrlen + encaps_len + meshhdrlen - skb_headroom(skb);
  2727. ++ head_need += padsize;
  2728. +
  2729. + /*
  2730. + * So we need to modify the skb header and hence need a copy of
  2731. +@@ -2678,6 +2681,9 @@ static struct sk_buff *ieee80211_build_h
  2732. + }
  2733. + #endif
  2734. +
  2735. ++ if (padsize)
  2736. ++ memset(skb_push(skb, padsize), 0, padsize);
  2737. ++
  2738. + if (ieee80211_is_data_qos(fc)) {
  2739. + __le16 *qos_control;
  2740. +
  2741. +@@ -2691,8 +2697,8 @@ static struct sk_buff *ieee80211_build_h
  2742. + } else
  2743. + memcpy(skb_push(skb, hdrlen), &hdr, hdrlen);
  2744. +
  2745. +- nh_pos += hdrlen;
  2746. +- h_pos += hdrlen;
  2747. ++ nh_pos += hdrlen + padsize;
  2748. ++ h_pos += hdrlen + padsize;
  2749. +
  2750. + /* Update skb pointers to various headers since this modified frame
  2751. + * is going to go through Linux networking code that may potentially
  2752. +@@ -2861,6 +2867,9 @@ void ieee80211_check_fast_xmit(struct st
  2753. + fc |= cpu_to_le16(IEEE80211_STYPE_QOS_DATA);
  2754. + }
  2755. +
  2756. ++ /* Check aligned4 skb required */
  2757. ++ build.hdr_len += ieee80211_hdr_padsize(&local->hw, build.hdr_len);
  2758. ++
  2759. + /* We store the key here so there's no point in using rcu_dereference()
  2760. + * but that's fine because the code that changes the pointers will call
  2761. + * this function after doing so. For a single CPU that would be enough,
  2762. +--- a/net/mac80211/util.c
  2763. ++++ b/net/mac80211/util.c
  2764. +@@ -1224,6 +1224,7 @@ void ieee80211_send_auth(struct ieee8021
  2765. + u32 tx_flags)
  2766. + {
  2767. + struct ieee80211_local *local = sdata->local;
  2768. ++ struct ieee80211_hw *hw = &local->hw;
  2769. + struct sk_buff *skb;
  2770. + struct ieee80211_mgmt *mgmt;
  2771. + unsigned int hdrlen;
  2772. +@@ -1251,7 +1252,7 @@ void ieee80211_send_auth(struct ieee8021
  2773. + memcpy(skb_put(skb, extra_len), extra, extra_len);
  2774. +
  2775. + if (auth_alg == WLAN_AUTH_SHARED_KEY && transaction == 3) {
  2776. +- hdrlen = ieee80211_hdrlen(mgmt->frame_control);
  2777. ++ hdrlen = ieee80211_padded_hdrlen(hw, mgmt->frame_control);
  2778. + mgmt->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
  2779. + err = ieee80211_wep_encrypt(local, skb, hdrlen, key,
  2780. + key_len, key_idx);
  2781. diff --git a/package/kernel/mac80211/patches/308-ath10k-Fix-sending-NULL-Qos-NULL-data-frames-for-QCA.patch b/package/kernel/mac80211/patches/308-ath10k-Fix-sending-NULL-Qos-NULL-data-frames-for-QCA.patch
  2782. new file mode 100644
  2783. index 0000000..8590aad
  2784. --- /dev/null
  2785. +++ b/package/kernel/mac80211/patches/308-ath10k-Fix-sending-NULL-Qos-NULL-data-frames-for-QCA.patch
  2786. @@ -0,0 +1,72 @@
  2787. +From: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
  2788. +Date: Thu, 23 Jun 2016 22:10:01 +0530
  2789. +Subject: [PATCH] ath10k: Fix sending NULL/ Qos NULL data frames for
  2790. + QCA99X0 and later
  2791. +
  2792. +For chipsets like QCA99X0, IPQ4019 and later we are not getting proper
  2793. +NULL func status (always acked/successs !!) when hostapd does a
  2794. +PROBE_CLIENT via nullfunc frames when the station is powered off
  2795. +abruptly (inactive timer probes client via null func after the inactive
  2796. +time reaches beyond the threshold). Fix this by disabling the workaround
  2797. +(getting the ACK status of NULL func frames by sending via HTT mgmt-tx
  2798. + path) introduced by the change ("ath10k: fix beacon loss handling ")
  2799. +for QCA99X0 and later chipsets. The normal tx path provides the proper
  2800. +ACK status for NULL data frames. As of now disable this workaround for
  2801. +chipsets QCA99X0 and later, once the 10.1 firmware is obselete we can
  2802. +completely get rid of this workaround for all the chipsets
  2803. +
  2804. +Signed-off-by: Tamizh chelvam <c_traja@qti.qualcomm.com>
  2805. +Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
  2806. +---
  2807. +
  2808. +--- a/drivers/net/wireless/ath/ath10k/core.c
  2809. ++++ b/drivers/net/wireless/ath/ath10k/core.c
  2810. +@@ -181,6 +181,7 @@ static const struct ath10k_hw_params ath
  2811. + .board = QCA99X0_HW_2_0_BOARD_DATA_FILE,
  2812. + .board_size = QCA99X0_BOARD_DATA_SZ,
  2813. + .board_ext_size = QCA99X0_BOARD_EXT_DATA_SZ,
  2814. ++ .disable_null_func_workaround = true,
  2815. + },
  2816. + },
  2817. + {
  2818. +@@ -204,6 +205,7 @@ static const struct ath10k_hw_params ath
  2819. + .board = QCA9984_HW_1_0_BOARD_DATA_FILE,
  2820. + .board_size = QCA99X0_BOARD_DATA_SZ,
  2821. + .board_ext_size = QCA99X0_BOARD_EXT_DATA_SZ,
  2822. ++ .disable_null_func_workaround = true,
  2823. + },
  2824. + },
  2825. + {
  2826. +@@ -262,6 +264,7 @@ static const struct ath10k_hw_params ath
  2827. + .board = QCA4019_HW_1_0_BOARD_DATA_FILE,
  2828. + .board_size = QCA4019_BOARD_DATA_SZ,
  2829. + .board_ext_size = QCA4019_BOARD_EXT_DATA_SZ,
  2830. ++ .disable_null_func_workaround = true,
  2831. + },
  2832. + },
  2833. + };
  2834. +--- a/drivers/net/wireless/ath/ath10k/core.h
  2835. ++++ b/drivers/net/wireless/ath/ath10k/core.h
  2836. +@@ -750,6 +750,12 @@ struct ath10k {
  2837. + const char *board;
  2838. + size_t board_size;
  2839. + size_t board_ext_size;
  2840. ++ /* Workaround of sending NULL data frames via
  2841. ++ * HTT mgmt TX and getting the proper ACK status does
  2842. ++ * not works for chipsets QCA99X0 and later, while
  2843. ++ * Tx data path reports the ACK status properly.
  2844. ++ */
  2845. ++ bool disable_null_func_workaround;
  2846. + } fw;
  2847. + } hw_params;
  2848. +
  2849. +--- a/drivers/net/wireless/ath/ath10k/mac.c
  2850. ++++ b/drivers/net/wireless/ath/ath10k/mac.c
  2851. +@@ -3253,6 +3253,7 @@ ath10k_mac_tx_h_get_txmode(struct ath10k
  2852. + * mode though because AP don't sleep.
  2853. + */
  2854. + if (ar->htt.target_version_major < 3 &&
  2855. ++ !ar->hw_params.fw.disable_null_func_workaround &&
  2856. + (ieee80211_is_nullfunc(fc) || ieee80211_is_qos_nullfunc(fc)) &&
  2857. + !test_bit(ATH10K_FW_FEATURE_HAS_WMI_MGMT_TX,
  2858. + ar->running_fw->fw_file.fw_features))
  2859. diff --git a/package/kernel/mac80211/patches/308-ath9k-fix-data-bus-error-on-ar9300-and-ar9580.patch b/package/kernel/mac80211/patches/308-ath9k-fix-data-bus-error-on-ar9300-and-ar9580.patch
  2860. deleted file mode 100644
  2861. index d408866..0000000
  2862. --- a/package/kernel/mac80211/patches/308-ath9k-fix-data-bus-error-on-ar9300-and-ar9580.patch
  2863. +++ /dev/null
  2864. @@ -1,65 +0,0 @@
  2865. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  2866. -Date: Fri, 15 Jan 2016 18:17:21 +0800
  2867. -Subject: [PATCH] ath9k: fix data bus error on ar9300 and ar9580
  2868. -
  2869. -One crash issue be found on ar9300: RTC_RC reg read leads crash, leading
  2870. -the data bus error, due to RTC_RC reg write not happen properly.
  2871. -
  2872. -Warm Reset trigger in continuous beacon stuck for one of the customer for
  2873. -other chip, noticed the MAC was stuck in RTC reset. After analysis noticed
  2874. -DMA did not complete when RTC was put in reset.
  2875. -
  2876. -So, before resetting the MAC need to make sure there are no pending DMA
  2877. -transactions because this reset does not reset all parts of the chip.
  2878. -
  2879. -The 12th and 11th bit of MAC _DMA_CFG register used to do that.
  2880. - 12 cfg_halt_ack 0x0
  2881. - 0 DMA has not yet halted
  2882. - 1 DMA has halted
  2883. - 11 cfg_halt_req 0x0
  2884. - 0 DMA logic operates normally
  2885. - 1 Request DMA logic to stop so software can reset the MAC
  2886. -
  2887. -The Bit [12] of this register indicates when the halt has taken effect or
  2888. -not. the DMA halt IS NOT recoverable; once software sets bit [11] to
  2889. -request a DMA halt, software must wait for bit [12] to be set and reset
  2890. -the MAC.
  2891. -
  2892. -So, the same thing we implemented for ar9580 chip.
  2893. -
  2894. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  2895. ----
  2896. -
  2897. ---- a/drivers/net/wireless/ath/ath9k/hw.c
  2898. -+++ b/drivers/net/wireless/ath/ath9k/hw.c
  2899. -@@ -1368,6 +1368,16 @@ static bool ath9k_hw_set_reset(struct at
  2900. - if (ath9k_hw_mci_is_enabled(ah))
  2901. - ar9003_mci_check_gpm_offset(ah);
  2902. -
  2903. -+ /* DMA HALT added to resolve ar9300 and ar9580 bus error during
  2904. -+ * RTC_RC reg read
  2905. -+ */
  2906. -+ if (AR_SREV_9300(ah) || AR_SREV_9580(ah)) {
  2907. -+ REG_SET_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  2908. -+ ath9k_hw_wait(ah, AR_CFG, AR_CFG_HALT_ACK, AR_CFG_HALT_ACK,
  2909. -+ 20 * AH_WAIT_TIMEOUT);
  2910. -+ REG_CLR_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  2911. -+ }
  2912. -+
  2913. - REG_WRITE(ah, AR_RTC_RC, rst_flags);
  2914. -
  2915. - REGWRITE_BUFFER_FLUSH(ah);
  2916. ---- a/drivers/net/wireless/ath/ath9k/reg.h
  2917. -+++ b/drivers/net/wireless/ath/ath9k/reg.h
  2918. -@@ -34,8 +34,10 @@
  2919. - #define AR_CFG_SWRG 0x00000010
  2920. - #define AR_CFG_AP_ADHOC_INDICATION 0x00000020
  2921. - #define AR_CFG_PHOK 0x00000100
  2922. --#define AR_CFG_CLK_GATE_DIS 0x00000400
  2923. - #define AR_CFG_EEBS 0x00000200
  2924. -+#define AR_CFG_CLK_GATE_DIS 0x00000400
  2925. -+#define AR_CFG_HALT_REQ 0x00000800
  2926. -+#define AR_CFG_HALT_ACK 0x00001000
  2927. - #define AR_CFG_PCI_MASTER_REQ_Q_THRESH 0x00060000
  2928. - #define AR_CFG_PCI_MASTER_REQ_Q_THRESH_S 17
  2929. -
  2930. diff --git a/package/kernel/mac80211/patches/309-01-brcmfmac-add-missing-include.patch b/package/kernel/mac80211/patches/309-01-brcmfmac-add-missing-include.patch
  2931. deleted file mode 100644
  2932. index d9511c8..0000000
  2933. --- a/package/kernel/mac80211/patches/309-01-brcmfmac-add-missing-include.patch
  2934. +++ /dev/null
  2935. @@ -1,19 +0,0 @@
  2936. -From: Felix Fietkau <nbd@openwrt.org>
  2937. -Date: Fri, 15 Jan 2016 15:59:45 +0100
  2938. -Subject: [PATCH] brcmfmac: add missing include
  2939. -
  2940. -linux/module.h is required for defining module parameters
  2941. -
  2942. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  2943. ----
  2944. -
  2945. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  2946. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  2947. -@@ -17,6 +17,7 @@
  2948. - #include <linux/kernel.h>
  2949. - #include <linux/string.h>
  2950. - #include <linux/netdevice.h>
  2951. -+#include <linux/module.h>
  2952. - #include <brcmu_wifi.h>
  2953. - #include <brcmu_utils.h>
  2954. - #include "core.h"
  2955. diff --git a/package/kernel/mac80211/patches/309-02-brcmfmac-fix-sdio-sg-table-alloc-crash.patch b/package/kernel/mac80211/patches/309-02-brcmfmac-fix-sdio-sg-table-alloc-crash.patch
  2956. deleted file mode 100644
  2957. index 711e019..0000000
  2958. --- a/package/kernel/mac80211/patches/309-02-brcmfmac-fix-sdio-sg-table-alloc-crash.patch
  2959. +++ /dev/null
  2960. @@ -1,118 +0,0 @@
  2961. -From: Hante Meuleman <meuleman@broadcom.com>
  2962. -Date: Tue, 19 Jan 2016 12:39:24 +0100
  2963. -Subject: [PATCH] brcmfmac: fix sdio sg table alloc crash
  2964. -
  2965. -With commit 7d34b0560567 ("brcmfmac: Move all module parameters to
  2966. -one place") a bug was introduced causing a null pointer exception.
  2967. -This patch fixes the bug by initializing the sg table till after
  2968. -the settings have been initialized.
  2969. -
  2970. -Fixes: 7d34b0560567 ("brcmfmac: Move all module parameters to one place")
  2971. -Reported-by: Marc Zyngier <marc.zyngier@arm.com>
  2972. -Tested-by: Marc Zyngier <marc.zyngier@arm.com>
  2973. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  2974. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  2975. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  2976. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  2977. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  2978. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  2979. ----
  2980. -
  2981. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  2982. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  2983. -@@ -879,11 +879,24 @@ int brcmf_sdiod_abort(struct brcmf_sdio_
  2984. - return 0;
  2985. - }
  2986. -
  2987. --static void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev)
  2988. -+void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev)
  2989. - {
  2990. -+ struct sdio_func *func;
  2991. -+ struct mmc_host *host;
  2992. -+ uint max_blocks;
  2993. - uint nents;
  2994. - int err;
  2995. -
  2996. -+ func = sdiodev->func[2];
  2997. -+ host = func->card->host;
  2998. -+ sdiodev->sg_support = host->max_segs > 1;
  2999. -+ max_blocks = min_t(uint, host->max_blk_count, 511u);
  3000. -+ sdiodev->max_request_size = min_t(uint, host->max_req_size,
  3001. -+ max_blocks * func->cur_blksize);
  3002. -+ sdiodev->max_segment_count = min_t(uint, host->max_segs,
  3003. -+ SG_MAX_SINGLE_ALLOC);
  3004. -+ sdiodev->max_segment_size = host->max_seg_size;
  3005. -+
  3006. - if (!sdiodev->sg_support)
  3007. - return;
  3008. -
  3009. -@@ -1021,9 +1034,6 @@ static void brcmf_sdiod_host_fixup(struc
  3010. -
  3011. - static int brcmf_sdiod_probe(struct brcmf_sdio_dev *sdiodev)
  3012. - {
  3013. -- struct sdio_func *func;
  3014. -- struct mmc_host *host;
  3015. -- uint max_blocks;
  3016. - int ret = 0;
  3017. -
  3018. - sdiodev->num_funcs = 2;
  3019. -@@ -1054,26 +1064,6 @@ static int brcmf_sdiod_probe(struct brcm
  3020. - goto out;
  3021. - }
  3022. -
  3023. -- /*
  3024. -- * determine host related variables after brcmf_sdiod_probe()
  3025. -- * as func->cur_blksize is properly set and F2 init has been
  3026. -- * completed successfully.
  3027. -- */
  3028. -- func = sdiodev->func[2];
  3029. -- host = func->card->host;
  3030. -- sdiodev->sg_support = host->max_segs > 1;
  3031. -- max_blocks = min_t(uint, host->max_blk_count, 511u);
  3032. -- sdiodev->max_request_size = min_t(uint, host->max_req_size,
  3033. -- max_blocks * func->cur_blksize);
  3034. -- sdiodev->max_segment_count = min_t(uint, host->max_segs,
  3035. -- SG_MAX_SINGLE_ALLOC);
  3036. -- sdiodev->max_segment_size = host->max_seg_size;
  3037. --
  3038. -- /* allocate scatter-gather table. sg support
  3039. -- * will be disabled upon allocation failure.
  3040. -- */
  3041. -- brcmf_sdiod_sgtable_alloc(sdiodev);
  3042. --
  3043. - ret = brcmf_sdiod_freezer_attach(sdiodev);
  3044. - if (ret)
  3045. - goto out;
  3046. -@@ -1084,7 +1074,7 @@ static int brcmf_sdiod_probe(struct brcm
  3047. - ret = -ENODEV;
  3048. - goto out;
  3049. - }
  3050. -- brcmf_sdiod_host_fixup(host);
  3051. -+ brcmf_sdiod_host_fixup(sdiodev->func[2]->card->host);
  3052. - out:
  3053. - if (ret)
  3054. - brcmf_sdiod_remove(sdiodev);
  3055. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  3056. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  3057. -@@ -4114,6 +4114,11 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
  3058. - goto fail;
  3059. - }
  3060. -
  3061. -+ /* allocate scatter-gather table. sg support
  3062. -+ * will be disabled upon allocation failure.
  3063. -+ */
  3064. -+ brcmf_sdiod_sgtable_alloc(bus->sdiodev);
  3065. -+
  3066. - /* Query the F2 block size, set roundup accordingly */
  3067. - bus->blocksize = bus->sdiodev->func[2]->cur_blksize;
  3068. - bus->roundup = min(max_roundup, bus->blocksize);
  3069. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
  3070. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
  3071. -@@ -342,6 +342,7 @@ int brcmf_sdiod_ramrw(struct brcmf_sdio_
  3072. -
  3073. - /* Issue an abort to the specified function */
  3074. - int brcmf_sdiod_abort(struct brcmf_sdio_dev *sdiodev, uint fn);
  3075. -+void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev);
  3076. - void brcmf_sdiod_change_state(struct brcmf_sdio_dev *sdiodev,
  3077. - enum brcmf_sdiod_state state);
  3078. - #ifdef CONFIG_PM_SLEEP
  3079. diff --git a/package/kernel/mac80211/patches/309-cfg80211-fix-proto-in-ieee80211_data_to_8023-for-fra.patch b/package/kernel/mac80211/patches/309-cfg80211-fix-proto-in-ieee80211_data_to_8023-for-fra.patch
  3080. new file mode 100644
  3081. index 0000000..41c27ca
  3082. --- /dev/null
  3083. +++ b/package/kernel/mac80211/patches/309-cfg80211-fix-proto-in-ieee80211_data_to_8023-for-fra.patch
  3084. @@ -0,0 +1,37 @@
  3085. +From: Felix Fietkau <nbd@nbd.name>
  3086. +Date: Wed, 29 Jun 2016 10:02:32 +0200
  3087. +Subject: [PATCH] cfg80211: fix proto in ieee80211_data_to_8023 for frames
  3088. + without LLC header
  3089. +
  3090. +The PDU length of incoming LLC frames is set to the total skb payload size
  3091. +in __ieee80211_data_to_8023() of net/wireless/util.c which incorrectly
  3092. +includes the length of the IEEE 802.11 header.
  3093. +
  3094. +The resulting LLC frame header has a too large PDU length, causing the
  3095. +llc_fixup_skb() function of net/llc/llc_input.c to reject the incoming
  3096. +skb, effectively breaking STP.
  3097. +
  3098. +Solve the problem by properly substracting the IEEE 802.11 frame header size
  3099. +from the PDU length, allowing the LLC processor to pick up the incoming
  3100. +control messages.
  3101. +
  3102. +Special thanks to Gerry Rozema for tracking down the regression and proposing
  3103. +a suitable patch.
  3104. +
  3105. +Fixes: 2d1c304cb2d5 ("cfg80211: add function for 802.3 conversion with separate output buffer")
  3106. +Cc: stable@vger.kernel.org
  3107. +Reported-by: Gerry Rozema <gerryr@rozeware.com>
  3108. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  3109. +---
  3110. +
  3111. +--- a/net/wireless/util.c
  3112. ++++ b/net/wireless/util.c
  3113. +@@ -509,7 +509,7 @@ static int __ieee80211_data_to_8023(stru
  3114. + * replace EtherType */
  3115. + hdrlen += ETH_ALEN + 2;
  3116. + else
  3117. +- tmp.h_proto = htons(skb->len);
  3118. ++ tmp.h_proto = htons(skb->len - hdrlen);
  3119. +
  3120. + pskb_pull(skb, hdrlen);
  3121. +
  3122. diff --git a/package/kernel/mac80211/patches/310-ath9k_hw-ignore-eeprom-magic-mismatch-on-flash-based.patch b/package/kernel/mac80211/patches/310-ath9k_hw-ignore-eeprom-magic-mismatch-on-flash-based.patch
  3123. deleted file mode 100644
  3124. index 287d6e1..0000000
  3125. --- a/package/kernel/mac80211/patches/310-ath9k_hw-ignore-eeprom-magic-mismatch-on-flash-based.patch
  3126. +++ /dev/null
  3127. @@ -1,38 +0,0 @@
  3128. -From: Felix Fietkau <nbd@openwrt.org>
  3129. -Date: Thu, 21 Jan 2016 16:28:44 +0100
  3130. -Subject: [PATCH] ath9k_hw: ignore eeprom magic mismatch on flash based devices
  3131. -
  3132. -Many AR913x based devices (maybe others too) do not have a valid EEPROM
  3133. -magic in their calibration data partition.
  3134. -
  3135. -Fixes: 6fa658fd5ab2 ("ath9k: Simplify and fix eeprom endianness swapping")
  3136. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  3137. ----
  3138. -
  3139. ---- a/drivers/net/wireless/ath/ath9k/eeprom.c
  3140. -+++ b/drivers/net/wireless/ath/ath9k/eeprom.c
  3141. -@@ -150,18 +150,18 @@ int ath9k_hw_nvram_swap_data(struct ath_
  3142. - return -EIO;
  3143. - }
  3144. -
  3145. -- if (magic == AR5416_EEPROM_MAGIC) {
  3146. -- *swap_needed = false;
  3147. -- } else if (swab16(magic) == AR5416_EEPROM_MAGIC) {
  3148. -+ *swap_needed = false;
  3149. -+ if (swab16(magic) == AR5416_EEPROM_MAGIC) {
  3150. - if (ah->ah_flags & AH_NO_EEP_SWAP) {
  3151. - ath_info(common,
  3152. - "Ignoring endianness difference in EEPROM magic bytes.\n");
  3153. --
  3154. -- *swap_needed = false;
  3155. - } else {
  3156. - *swap_needed = true;
  3157. - }
  3158. -- } else {
  3159. -+ } else if (magic != AR5416_EEPROM_MAGIC) {
  3160. -+ if (ath9k_hw_use_flash(ah))
  3161. -+ return 0;
  3162. -+
  3163. - ath_err(common,
  3164. - "Invalid EEPROM Magic (0x%04x).\n", magic);
  3165. - return -EINVAL;
  3166. diff --git a/package/kernel/mac80211/patches/310-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch b/package/kernel/mac80211/patches/310-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch
  3167. new file mode 100644
  3168. index 0000000..25929c9
  3169. --- /dev/null
  3170. +++ b/package/kernel/mac80211/patches/310-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch
  3171. @@ -0,0 +1,81 @@
  3172. +From: Chaitanya T K <chaitanya.mgit@gmail.com>
  3173. +Date: Mon, 27 Jun 2016 15:23:26 +0530
  3174. +Subject: [PATCH] mac80211: minstrel: Enable STBC and LDPC for VHT Rates
  3175. +
  3176. +If peer support reception of STBC and LDPC, enable them for better
  3177. +performance.
  3178. +
  3179. +Signed-off-by: Chaitanya TK <chaitanya.mgit@gmail.com>
  3180. +---
  3181. +
  3182. +--- a/include/linux/ieee80211.h
  3183. ++++ b/include/linux/ieee80211.h
  3184. +@@ -1550,6 +1550,7 @@ struct ieee80211_vht_operation {
  3185. + #define IEEE80211_VHT_CAP_RXSTBC_3 0x00000300
  3186. + #define IEEE80211_VHT_CAP_RXSTBC_4 0x00000400
  3187. + #define IEEE80211_VHT_CAP_RXSTBC_MASK 0x00000700
  3188. ++#define IEEE80211_VHT_CAP_RXSTBC_SHIFT 8
  3189. + #define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800
  3190. + #define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000
  3191. + #define IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT 13
  3192. +--- a/net/mac80211/rc80211_minstrel_ht.c
  3193. ++++ b/net/mac80211/rc80211_minstrel_ht.c
  3194. +@@ -1166,13 +1166,14 @@ minstrel_ht_update_caps(void *priv, stru
  3195. + struct minstrel_ht_sta_priv *msp = priv_sta;
  3196. + struct minstrel_ht_sta *mi = &msp->ht;
  3197. + struct ieee80211_mcs_info *mcs = &sta->ht_cap.mcs;
  3198. +- u16 sta_cap = sta->ht_cap.cap;
  3199. ++ u16 ht_cap = sta->ht_cap.cap;
  3200. + struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap;
  3201. + int use_vht;
  3202. + int n_supported = 0;
  3203. + int ack_dur;
  3204. + int stbc;
  3205. + int i;
  3206. ++ bool ldpc = false;
  3207. +
  3208. + /* fall back to the old minstrel for legacy stations */
  3209. + if (!sta->ht_cap.ht_supported)
  3210. +@@ -1210,16 +1211,24 @@ minstrel_ht_update_caps(void *priv, stru
  3211. + }
  3212. + mi->sample_tries = 4;
  3213. +
  3214. +- /* TODO tx_flags for vht - ATM the RC API is not fine-grained enough */
  3215. + if (!use_vht) {
  3216. +- stbc = (sta_cap & IEEE80211_HT_CAP_RX_STBC) >>
  3217. ++ stbc = (ht_cap & IEEE80211_HT_CAP_RX_STBC) >>
  3218. + IEEE80211_HT_CAP_RX_STBC_SHIFT;
  3219. +- mi->tx_flags |= stbc << IEEE80211_TX_CTL_STBC_SHIFT;
  3220. +
  3221. +- if (sta_cap & IEEE80211_HT_CAP_LDPC_CODING)
  3222. +- mi->tx_flags |= IEEE80211_TX_CTL_LDPC;
  3223. ++ if (ht_cap & IEEE80211_HT_CAP_LDPC_CODING)
  3224. ++ ldpc = true;
  3225. ++ } else {
  3226. ++ stbc = (vht_cap->cap & IEEE80211_VHT_CAP_RXSTBC_MASK) >>
  3227. ++ IEEE80211_VHT_CAP_RXSTBC_SHIFT;
  3228. ++
  3229. ++ if (vht_cap->cap & IEEE80211_VHT_CAP_RXLDPC)
  3230. ++ ldpc = true;
  3231. + }
  3232. +
  3233. ++ mi->tx_flags |= stbc << IEEE80211_TX_CTL_STBC_SHIFT;
  3234. ++ if (ldpc)
  3235. ++ mi->tx_flags |= IEEE80211_TX_CTL_LDPC;
  3236. ++
  3237. + for (i = 0; i < ARRAY_SIZE(mi->groups); i++) {
  3238. + u32 gflags = minstrel_mcs_groups[i].flags;
  3239. + int bw, nss;
  3240. +@@ -1232,10 +1241,10 @@ minstrel_ht_update_caps(void *priv, stru
  3241. +
  3242. + if (gflags & IEEE80211_TX_RC_SHORT_GI) {
  3243. + if (gflags & IEEE80211_TX_RC_40_MHZ_WIDTH) {
  3244. +- if (!(sta_cap & IEEE80211_HT_CAP_SGI_40))
  3245. ++ if (!(ht_cap & IEEE80211_HT_CAP_SGI_40))
  3246. + continue;
  3247. + } else {
  3248. +- if (!(sta_cap & IEEE80211_HT_CAP_SGI_20))
  3249. ++ if (!(ht_cap & IEEE80211_HT_CAP_SGI_20))
  3250. + continue;
  3251. + }
  3252. + }
  3253. diff --git a/package/kernel/mac80211/patches/311-ath10k-disable-wake_tx_queue-for-older-devices.patch b/package/kernel/mac80211/patches/311-ath10k-disable-wake_tx_queue-for-older-devices.patch
  3254. new file mode 100644
  3255. index 0000000..4cf26a6
  3256. --- /dev/null
  3257. +++ b/package/kernel/mac80211/patches/311-ath10k-disable-wake_tx_queue-for-older-devices.patch
  3258. @@ -0,0 +1,73 @@
  3259. +From: Michal Kazior <michal.kazior@tieto.com>
  3260. +Date: Tue, 17 May 2016 14:47:01 +0200
  3261. +Subject: [PATCH] ath10k: disable wake_tx_queue for older devices
  3262. +
  3263. +Some setups suffer performance regressions with
  3264. +current wake_tx_queue implementation.
  3265. +
  3266. +Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
  3267. +---
  3268. +
  3269. +--- a/drivers/net/wireless/ath/ath10k/core.h
  3270. ++++ b/drivers/net/wireless/ath/ath10k/core.h
  3271. +@@ -667,6 +667,7 @@ struct ath10k_fw_components {
  3272. + struct ath10k {
  3273. + struct ath_common ath_common;
  3274. + struct ieee80211_hw *hw;
  3275. ++ struct ieee80211_ops *ops;
  3276. + struct device *dev;
  3277. + u8 mac_addr[ETH_ALEN];
  3278. +
  3279. +--- a/drivers/net/wireless/ath/ath10k/mac.c
  3280. ++++ b/drivers/net/wireless/ath/ath10k/mac.c
  3281. +@@ -7497,21 +7497,32 @@ static const struct ieee80211_channel at
  3282. + struct ath10k *ath10k_mac_create(size_t priv_size)
  3283. + {
  3284. + struct ieee80211_hw *hw;
  3285. ++ struct ieee80211_ops *ops;
  3286. + struct ath10k *ar;
  3287. +
  3288. +- hw = ieee80211_alloc_hw(sizeof(struct ath10k) + priv_size, &ath10k_ops);
  3289. +- if (!hw)
  3290. ++ ops = kmemdup(&ath10k_ops, sizeof(ath10k_ops), GFP_KERNEL);
  3291. ++ if (!ops)
  3292. ++ return NULL;
  3293. ++
  3294. ++ hw = ieee80211_alloc_hw(sizeof(struct ath10k) + priv_size, ops);
  3295. ++ if (!hw) {
  3296. ++ kfree(ops);
  3297. + return NULL;
  3298. ++ }
  3299. +
  3300. + ar = hw->priv;
  3301. + ar->hw = hw;
  3302. ++ ar->ops = ops;
  3303. +
  3304. + return ar;
  3305. + }
  3306. +
  3307. + void ath10k_mac_destroy(struct ath10k *ar)
  3308. + {
  3309. ++ struct ieee80211_ops *ops = ar->ops;
  3310. ++
  3311. + ieee80211_free_hw(ar->hw);
  3312. ++ kfree(ops);
  3313. + }
  3314. +
  3315. + static const struct ieee80211_iface_limit ath10k_if_limits[] = {
  3316. +@@ -7945,6 +7956,15 @@ int ath10k_mac_register(struct ath10k *a
  3317. + ath10k_warn(ar, "failed to initialise DFS pattern detector\n");
  3318. + }
  3319. +
  3320. ++ /* Current wake_tx_queue implementation imposes a significant
  3321. ++ * performance penalty in some setups. The tx scheduling code needs
  3322. ++ * more work anyway so disable the wake_tx_queue unless firmware
  3323. ++ * supports the pull-push mechanism.
  3324. ++ */
  3325. ++ if (!test_bit(ATH10K_FW_FEATURE_PEER_FLOW_CONTROL,
  3326. ++ ar->running_fw->fw_file.fw_features))
  3327. ++ ar->ops->wake_tx_queue = NULL;
  3328. ++
  3329. + ret = ath_regd_init(&ar->ath_common.regulatory, ar->hw->wiphy,
  3330. + ath10k_reg_notifier);
  3331. + if (ret) {
  3332. diff --git a/package/kernel/mac80211/patches/311-ath9k-do-not-limit-the-number-of-DFS-interfaces-to-1.patch b/package/kernel/mac80211/patches/311-ath9k-do-not-limit-the-number-of-DFS-interfaces-to-1.patch
  3333. deleted file mode 100644
  3334. index 070efa9..0000000
  3335. --- a/package/kernel/mac80211/patches/311-ath9k-do-not-limit-the-number-of-DFS-interfaces-to-1.patch
  3336. +++ /dev/null
  3337. @@ -1,55 +0,0 @@
  3338. -From: Felix Fietkau <nbd@openwrt.org>
  3339. -Date: Fri, 22 Jan 2016 01:05:56 +0100
  3340. -Subject: [PATCH] ath9k: do not limit the number of DFS interfaces to 1
  3341. -
  3342. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  3343. ----
  3344. -
  3345. ---- a/drivers/net/wireless/ath/ath9k/init.c
  3346. -+++ b/drivers/net/wireless/ath/ath9k/init.c
  3347. -@@ -751,14 +751,6 @@ static const struct ieee80211_iface_comb
  3348. -
  3349. - #endif /* CPTCFG_ATH9K_CHANNEL_CONTEXT */
  3350. -
  3351. --static const struct ieee80211_iface_limit if_dfs_limits[] = {
  3352. -- { .max = 1, .types = BIT(NL80211_IFTYPE_AP) |
  3353. --#ifdef CPTCFG_MAC80211_MESH
  3354. -- BIT(NL80211_IFTYPE_MESH_POINT) |
  3355. --#endif
  3356. -- BIT(NL80211_IFTYPE_ADHOC) },
  3357. --};
  3358. --
  3359. - static const struct ieee80211_iface_combination if_comb[] = {
  3360. - {
  3361. - .limits = if_limits,
  3362. -@@ -766,6 +758,11 @@ static const struct ieee80211_iface_comb
  3363. - .max_interfaces = 2048,
  3364. - .num_different_channels = 1,
  3365. - .beacon_int_infra_match = true,
  3366. -+#ifdef CPTCFG_ATH9K_DFS_CERTIFIED
  3367. -+ .radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) |
  3368. -+ BIT(NL80211_CHAN_WIDTH_20) |
  3369. -+ BIT(NL80211_CHAN_WIDTH_40),
  3370. -+#endif
  3371. - },
  3372. - {
  3373. - .limits = wds_limits,
  3374. -@@ -774,18 +771,6 @@ static const struct ieee80211_iface_comb
  3375. - .num_different_channels = 1,
  3376. - .beacon_int_infra_match = true,
  3377. - },
  3378. --#ifdef CPTCFG_ATH9K_DFS_CERTIFIED
  3379. -- {
  3380. -- .limits = if_dfs_limits,
  3381. -- .n_limits = ARRAY_SIZE(if_dfs_limits),
  3382. -- .max_interfaces = 1,
  3383. -- .num_different_channels = 1,
  3384. -- .beacon_int_infra_match = true,
  3385. -- .radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) |
  3386. -- BIT(NL80211_CHAN_WIDTH_20) |
  3387. -- BIT(NL80211_CHAN_WIDTH_40),
  3388. -- }
  3389. --#endif
  3390. - };
  3391. -
  3392. - #ifdef CPTCFG_ATH9K_CHANNEL_CONTEXT
  3393. diff --git a/package/kernel/mac80211/patches/312-ath9k-Correct-TSF-adjustment-to-align-the-beacon-tim.patch b/package/kernel/mac80211/patches/312-ath9k-Correct-TSF-adjustment-to-align-the-beacon-tim.patch
  3394. new file mode 100644
  3395. index 0000000..df43105
  3396. --- /dev/null
  3397. +++ b/package/kernel/mac80211/patches/312-ath9k-Correct-TSF-adjustment-to-align-the-beacon-tim.patch
  3398. @@ -0,0 +1,45 @@
  3399. +From: Benjamin Berg <benjamin.berg@open-mesh.com>
  3400. +Date: Mon, 4 Jul 2016 14:37:20 +0200
  3401. +Subject: [PATCH] ath9k: Correct TSF adjustment to align the beacon time
  3402. + correctly
  3403. +
  3404. +Beacons were not send out at (timestamp % beacon_time == 0) for interfaces
  3405. +other than the primary one. To send out beacons with the correct timestamp
  3406. +according to 10.1.3.2 of the 802.11 standard the tsf_adjustment has to be
  3407. +set to the negative time difference instead of positive. This way the
  3408. +later beacons get corrected to have a lower (and similar) timestamp with
  3409. +regard to the beacon from slot 0.
  3410. +
  3411. +I am not aware about any issues that have been caused by this.
  3412. +
  3413. +Signed-off-by: Benjamin Berg <benjamin.berg@open-mesh.com>
  3414. +---
  3415. +
  3416. +--- a/drivers/net/wireless/ath/ath9k/beacon.c
  3417. ++++ b/drivers/net/wireless/ath/ath9k/beacon.c
  3418. +@@ -279,17 +279,21 @@ static void ath9k_set_tsfadjust(struct a
  3419. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  3420. + struct ath_vif *avp = (void *)vif->drv_priv;
  3421. + struct ath_beacon_config *cur_conf = &avp->chanctx->beacon;
  3422. +- u32 tsfadjust;
  3423. ++ s64 tsfadjust;
  3424. +
  3425. + if (avp->av_bslot == 0)
  3426. + return;
  3427. +
  3428. ++ /* tsf_adjust is added to the TSF value. We send out the beacon late,
  3429. ++ * so need to adjust the TSF starting point to be later in time (i.e.
  3430. ++ * the theoretical first beacon has a TSF of 0 after correction).
  3431. ++ */
  3432. + tsfadjust = cur_conf->beacon_interval * avp->av_bslot;
  3433. +- tsfadjust = TU_TO_USEC(tsfadjust) / ATH_BCBUF;
  3434. ++ tsfadjust = -TU_TO_USEC(tsfadjust) / ATH_BCBUF;
  3435. + avp->tsf_adjust = cpu_to_le64(tsfadjust);
  3436. +
  3437. +- ath_dbg(common, CONFIG, "tsfadjust is: %llu for bslot: %d\n",
  3438. +- (unsigned long long)tsfadjust, avp->av_bslot);
  3439. ++ ath_dbg(common, CONFIG, "tsfadjust is: %lld for bslot: %d\n",
  3440. ++ (signed long long)tsfadjust, avp->av_bslot);
  3441. + }
  3442. +
  3443. + bool ath9k_csa_is_finished(struct ath_softc *sc, struct ieee80211_vif *vif)
  3444. diff --git a/package/kernel/mac80211/patches/312-mac80211-fix-txq-queue-related-crashes.patch b/package/kernel/mac80211/patches/312-mac80211-fix-txq-queue-related-crashes.patch
  3445. deleted file mode 100644
  3446. index 61cafc7..0000000
  3447. --- a/package/kernel/mac80211/patches/312-mac80211-fix-txq-queue-related-crashes.patch
  3448. +++ /dev/null
  3449. @@ -1,27 +0,0 @@
  3450. -From: Michal Kazior <michal.kazior@tieto.com>
  3451. -Date: Thu, 21 Jan 2016 14:23:07 +0100
  3452. -Subject: [PATCH] mac80211: fix txq queue related crashes
  3453. -
  3454. -The driver can access the queue simultanously
  3455. -while mac80211 tears down the interface. Without
  3456. -spinlock protection this could lead to corrupting
  3457. -sk_buff_head and subsequently to an invalid
  3458. -pointer dereference.
  3459. -
  3460. -Fixes: ba8c3d6f16a1 ("mac80211: add an intermediate software queue implementation")
  3461. -Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
  3462. ----
  3463. -
  3464. ---- a/net/mac80211/iface.c
  3465. -+++ b/net/mac80211/iface.c
  3466. -@@ -977,7 +977,10 @@ static void ieee80211_do_stop(struct iee
  3467. - if (sdata->vif.txq) {
  3468. - struct txq_info *txqi = to_txq_info(sdata->vif.txq);
  3469. -
  3470. -+ spin_lock_bh(&txqi->queue.lock);
  3471. - ieee80211_purge_tx_queue(&local->hw, &txqi->queue);
  3472. -+ spin_unlock_bh(&txqi->queue.lock);
  3473. -+
  3474. - atomic_set(&sdata->txqs_len[txqi->txq.ac], 0);
  3475. - }
  3476. -
  3477. diff --git a/package/kernel/mac80211/patches/313-ath9k-Handle-channel-context-in-get_-set_-reset_tsf.patch b/package/kernel/mac80211/patches/313-ath9k-Handle-channel-context-in-get_-set_-reset_tsf.patch
  3478. new file mode 100644
  3479. index 0000000..ef0afbe
  3480. --- /dev/null
  3481. +++ b/package/kernel/mac80211/patches/313-ath9k-Handle-channel-context-in-get_-set_-reset_tsf.patch
  3482. @@ -0,0 +1,70 @@
  3483. +From: Benjamin Berg <benjamin.berg@open-mesh.com>
  3484. +Date: Mon, 4 Jul 2016 14:37:21 +0200
  3485. +Subject: [PATCH] ath9k: Handle channel context in get_/set_/reset_tsf
  3486. +
  3487. +The ath9k TSF handling routines need to be aware of the channel context that
  3488. +is being modified. With this change the TSF related values that are stored
  3489. +in each channel context will be correctly tracked and the harware will only
  3490. +be updated if the modified context is currently the active one.
  3491. +
  3492. +Without this change the TSF modifications done using these routines would
  3493. +for example be lost during a hardware reset as done by ath_complete_reset.
  3494. +
  3495. +Signed-off-by: Benjamin Berg <benjamin.berg@open-mesh.com>
  3496. +---
  3497. +
  3498. +--- a/drivers/net/wireless/ath/ath9k/main.c
  3499. ++++ b/drivers/net/wireless/ath/ath9k/main.c
  3500. +@@ -1823,11 +1823,18 @@ static void ath9k_bss_info_changed(struc
  3501. + static u64 ath9k_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
  3502. + {
  3503. + struct ath_softc *sc = hw->priv;
  3504. ++ struct ath_vif *avp = (void *)vif->drv_priv;
  3505. + u64 tsf;
  3506. +
  3507. + mutex_lock(&sc->mutex);
  3508. + ath9k_ps_wakeup(sc);
  3509. +- tsf = ath9k_hw_gettsf64(sc->sc_ah);
  3510. ++ /* Get current TSF either from HW or kernel time. */
  3511. ++ if (sc->cur_chan == avp->chanctx) {
  3512. ++ tsf = ath9k_hw_gettsf64(sc->sc_ah);
  3513. ++ } else {
  3514. ++ tsf = sc->cur_chan->tsf_val +
  3515. ++ ath9k_hw_get_tsf_offset(&sc->cur_chan->tsf_ts, NULL);
  3516. ++ }
  3517. + ath9k_ps_restore(sc);
  3518. + mutex_unlock(&sc->mutex);
  3519. +
  3520. +@@ -1839,10 +1846,14 @@ static void ath9k_set_tsf(struct ieee802
  3521. + u64 tsf)
  3522. + {
  3523. + struct ath_softc *sc = hw->priv;
  3524. ++ struct ath_vif *avp = (void *)vif->drv_priv;
  3525. +
  3526. + mutex_lock(&sc->mutex);
  3527. + ath9k_ps_wakeup(sc);
  3528. +- ath9k_hw_settsf64(sc->sc_ah, tsf);
  3529. ++ getrawmonotonic(&avp->chanctx->tsf_ts);
  3530. ++ if (sc->cur_chan == avp->chanctx)
  3531. ++ ath9k_hw_settsf64(sc->sc_ah, tsf);
  3532. ++ avp->chanctx->tsf_val = tsf;
  3533. + ath9k_ps_restore(sc);
  3534. + mutex_unlock(&sc->mutex);
  3535. + }
  3536. +@@ -1850,11 +1861,15 @@ static void ath9k_set_tsf(struct ieee802
  3537. + static void ath9k_reset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
  3538. + {
  3539. + struct ath_softc *sc = hw->priv;
  3540. ++ struct ath_vif *avp = (void *)vif->drv_priv;
  3541. +
  3542. + mutex_lock(&sc->mutex);
  3543. +
  3544. + ath9k_ps_wakeup(sc);
  3545. +- ath9k_hw_reset_tsf(sc->sc_ah);
  3546. ++ getrawmonotonic(&avp->chanctx->tsf_ts);
  3547. ++ if (sc->cur_chan == avp->chanctx)
  3548. ++ ath9k_hw_reset_tsf(sc->sc_ah);
  3549. ++ avp->chanctx->tsf_val = 0;
  3550. + ath9k_ps_restore(sc);
  3551. +
  3552. + mutex_unlock(&sc->mutex);
  3553. diff --git a/package/kernel/mac80211/patches/313-mac80211-fix-unnecessary-frame-drops-in-mesh-fwding.patch b/package/kernel/mac80211/patches/313-mac80211-fix-unnecessary-frame-drops-in-mesh-fwding.patch
  3554. deleted file mode 100644
  3555. index 844d43b..0000000
  3556. --- a/package/kernel/mac80211/patches/313-mac80211-fix-unnecessary-frame-drops-in-mesh-fwding.patch
  3557. +++ /dev/null
  3558. @@ -1,57 +0,0 @@
  3559. -From: Michal Kazior <michal.kazior@tieto.com>
  3560. -Date: Mon, 25 Jan 2016 14:43:24 +0100
  3561. -Subject: [PATCH] mac80211: fix unnecessary frame drops in mesh fwding
  3562. -
  3563. -The ieee80211_queue_stopped() expects hw queue
  3564. -number but it was given raw WMM AC number instead.
  3565. -
  3566. -This could cause frame drops and problems with
  3567. -traffic in some cases - most notably if driver
  3568. -doesn't map AC numbers to queue numbers 1:1 and
  3569. -uses ieee80211_stop_queues() and
  3570. -ieee80211_wake_queue() only without ever calling
  3571. -ieee80211_wake_queues().
  3572. -
  3573. -On ath10k it was possible to hit this problem in
  3574. -the following case:
  3575. -
  3576. - 1. wlan0 uses queue 0
  3577. - (ath10k maps queues per vif)
  3578. - 2. offchannel uses queue 15
  3579. - 3. queues 1-14 are unused
  3580. - 4. ieee80211_stop_queues()
  3581. - 5. ieee80211_wake_queue(q=0)
  3582. - 6. ieee80211_wake_queue(q=15)
  3583. - (other queues are not woken up because both
  3584. - driver and mac80211 know other queues are
  3585. - unused)
  3586. - 7. ieee80211_rx_h_mesh_fwding()
  3587. - 8. ieee80211_select_queue_80211() returns 2
  3588. - 9. ieee80211_queue_stopped(q=2) returns true
  3589. - 10. frame is dropped (oops!)
  3590. -
  3591. -Fixes: d3c1597b8d1b ("mac80211: fix forwarded mesh frame queue mapping")
  3592. -Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
  3593. ----
  3594. -
  3595. ---- a/net/mac80211/rx.c
  3596. -+++ b/net/mac80211/rx.c
  3597. -@@ -2235,7 +2235,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
  3598. - struct ieee80211_local *local = rx->local;
  3599. - struct ieee80211_sub_if_data *sdata = rx->sdata;
  3600. - struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
  3601. -- u16 q, hdrlen;
  3602. -+ u16 ac, q, hdrlen;
  3603. -
  3604. - hdr = (struct ieee80211_hdr *) skb->data;
  3605. - hdrlen = ieee80211_hdrlen(hdr->frame_control);
  3606. -@@ -2304,7 +2304,8 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
  3607. - ether_addr_equal(sdata->vif.addr, hdr->addr3))
  3608. - return RX_CONTINUE;
  3609. -
  3610. -- q = ieee80211_select_queue_80211(sdata, skb, hdr);
  3611. -+ ac = ieee80211_select_queue_80211(sdata, skb, hdr);
  3612. -+ q = sdata->vif.hw_queue[ac];
  3613. - if (ieee80211_queue_stopped(&local->hw, q)) {
  3614. - IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_congestion);
  3615. - return RX_DROP_MONITOR;
  3616. diff --git a/package/kernel/mac80211/patches/314-ath9k-Use-tsf-offset-helper-in-ath9k_hw_reset.patch b/package/kernel/mac80211/patches/314-ath9k-Use-tsf-offset-helper-in-ath9k_hw_reset.patch
  3617. new file mode 100644
  3618. index 0000000..e725a8b
  3619. --- /dev/null
  3620. +++ b/package/kernel/mac80211/patches/314-ath9k-Use-tsf-offset-helper-in-ath9k_hw_reset.patch
  3621. @@ -0,0 +1,65 @@
  3622. +From: Benjamin Berg <benjamin.berg@open-mesh.com>
  3623. +Date: Mon, 4 Jul 2016 14:37:22 +0200
  3624. +Subject: [PATCH] ath9k: Use tsf offset helper in ath9k_hw_reset
  3625. +
  3626. +These changes make ath9k_hw_reset more consistent with other places that
  3627. +handle the TSF value by using the same helper routine.
  3628. +
  3629. +A slight improvement is to not assume that a fixed time of 1.5ms has
  3630. +passed for the initval writes when compared to the first write attempt.
  3631. +Instead the TSF value is re-calculated which will yield a higher accuracy
  3632. +of the restored TSF timer.
  3633. +
  3634. +Signed-off-by: Benjamin Berg <benjamin.berg@open-mesh.com>
  3635. +---
  3636. +
  3637. +--- a/drivers/net/wireless/ath/ath9k/hw.c
  3638. ++++ b/drivers/net/wireless/ath/ath9k/hw.c
  3639. +@@ -1832,8 +1832,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  3640. + u32 saveLedState;
  3641. + u32 saveDefAntenna;
  3642. + u32 macStaId1;
  3643. ++ struct timespec tsf_ts;
  3644. ++ u32 tsf_offset;
  3645. + u64 tsf = 0;
  3646. +- s64 usec = 0;
  3647. + int r;
  3648. + bool start_mci_reset = false;
  3649. + bool save_fullsleep = ah->chip_fullsleep;
  3650. +@@ -1877,8 +1878,8 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  3651. + macStaId1 = REG_READ(ah, AR_STA_ID1) & AR_STA_ID1_BASE_RATE_11B;
  3652. +
  3653. + /* Save TSF before chip reset, a cold reset clears it */
  3654. ++ getrawmonotonic(&tsf_ts);
  3655. + tsf = ath9k_hw_gettsf64(ah);
  3656. +- usec = ktime_to_us(ktime_get_raw());
  3657. +
  3658. + saveLedState = REG_READ(ah, AR_CFG_LED) &
  3659. + (AR_CFG_LED_ASSOC_CTL | AR_CFG_LED_MODE_SEL |
  3660. +@@ -1911,8 +1912,8 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  3661. + }
  3662. +
  3663. + /* Restore TSF */
  3664. +- usec = ktime_to_us(ktime_get_raw()) - usec;
  3665. +- ath9k_hw_settsf64(ah, tsf + usec);
  3666. ++ tsf_offset = ath9k_hw_get_tsf_offset(&tsf_ts, NULL);
  3667. ++ ath9k_hw_settsf64(ah, tsf + tsf_offset);
  3668. +
  3669. + if (AR_SREV_9280_20_OR_LATER(ah))
  3670. + REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL, AR_GPIO_JTAG_DISABLE);
  3671. +@@ -1932,12 +1933,11 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  3672. + /*
  3673. + * Some AR91xx SoC devices frequently fail to accept TSF writes
  3674. + * right after the chip reset. When that happens, write a new
  3675. +- * value after the initvals have been applied, with an offset
  3676. +- * based on measured time difference
  3677. ++ * value after the initvals have been applied.
  3678. + */
  3679. + if (AR_SREV_9100(ah) && (ath9k_hw_gettsf64(ah) < tsf)) {
  3680. +- tsf += 1500;
  3681. +- ath9k_hw_settsf64(ah, tsf);
  3682. ++ tsf_offset = ath9k_hw_get_tsf_offset(&tsf_ts, NULL);
  3683. ++ ath9k_hw_settsf64(ah, tsf + tsf_offset);
  3684. + }
  3685. +
  3686. + ath9k_hw_init_mfp(ah);
  3687. diff --git a/package/kernel/mac80211/patches/314-mac80211-Requeue-work-after-scan-complete-for-all-VI.patch b/package/kernel/mac80211/patches/314-mac80211-Requeue-work-after-scan-complete-for-all-VI.patch
  3688. deleted file mode 100644
  3689. index 5b3efbd..0000000
  3690. --- a/package/kernel/mac80211/patches/314-mac80211-Requeue-work-after-scan-complete-for-all-VI.patch
  3691. +++ /dev/null
  3692. @@ -1,103 +0,0 @@
  3693. -From: Sachin Kulkarni <Sachin.Kulkarni@imgtec.com>
  3694. -Date: Tue, 12 Jan 2016 14:30:19 +0530
  3695. -Subject: [PATCH] mac80211: Requeue work after scan complete for all VIF
  3696. - types.
  3697. -
  3698. -During a sw scan ieee80211_iface_work ignores work items for all vifs.
  3699. -However after the scan complete work is requeued only for STA, ADHOC
  3700. -and MESH iftypes.
  3701. -
  3702. -This occasionally results in event processing getting delayed/not
  3703. -processed for iftype AP when it coexists with a STA. This can result
  3704. -in data halt and eventually disconnection on the AP interface.
  3705. -
  3706. -Signed-off-by: Sachin Kulkarni <Sachin.Kulkarni@imgtec.com>
  3707. -Cc: linux-wireless@vger.kernel.org
  3708. -Cc: johannes@sipsolutions.net
  3709. ----
  3710. -
  3711. ---- a/net/mac80211/ibss.c
  3712. -+++ b/net/mac80211/ibss.c
  3713. -@@ -1731,7 +1731,6 @@ void ieee80211_ibss_notify_scan_complete
  3714. - if (sdata->vif.type != NL80211_IFTYPE_ADHOC)
  3715. - continue;
  3716. - sdata->u.ibss.last_scan_completed = jiffies;
  3717. -- ieee80211_queue_work(&local->hw, &sdata->work);
  3718. - }
  3719. - mutex_unlock(&local->iflist_mtx);
  3720. - }
  3721. ---- a/net/mac80211/mesh.c
  3722. -+++ b/net/mac80211/mesh.c
  3723. -@@ -1369,17 +1369,6 @@ out:
  3724. - sdata_unlock(sdata);
  3725. - }
  3726. -
  3727. --void ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local)
  3728. --{
  3729. -- struct ieee80211_sub_if_data *sdata;
  3730. --
  3731. -- rcu_read_lock();
  3732. -- list_for_each_entry_rcu(sdata, &local->interfaces, list)
  3733. -- if (ieee80211_vif_is_mesh(&sdata->vif) &&
  3734. -- ieee80211_sdata_running(sdata))
  3735. -- ieee80211_queue_work(&local->hw, &sdata->work);
  3736. -- rcu_read_unlock();
  3737. --}
  3738. -
  3739. - void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata)
  3740. - {
  3741. ---- a/net/mac80211/mesh.h
  3742. -+++ b/net/mac80211/mesh.h
  3743. -@@ -362,14 +362,10 @@ static inline bool mesh_path_sel_is_hwmp
  3744. - return sdata->u.mesh.mesh_pp_id == IEEE80211_PATH_PROTOCOL_HWMP;
  3745. - }
  3746. -
  3747. --void ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local);
  3748. --
  3749. - void mesh_path_flush_by_iface(struct ieee80211_sub_if_data *sdata);
  3750. - void mesh_sync_adjust_tbtt(struct ieee80211_sub_if_data *sdata);
  3751. - void ieee80211s_stop(void);
  3752. - #else
  3753. --static inline void
  3754. --ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local) {}
  3755. - static inline bool mesh_path_sel_is_hwmp(struct ieee80211_sub_if_data *sdata)
  3756. - { return false; }
  3757. - static inline void mesh_path_flush_by_iface(struct ieee80211_sub_if_data *sdata)
  3758. ---- a/net/mac80211/mlme.c
  3759. -+++ b/net/mac80211/mlme.c
  3760. -@@ -3978,8 +3978,6 @@ static void ieee80211_restart_sta_timer(
  3761. - if (!ieee80211_hw_check(&sdata->local->hw, CONNECTION_MONITOR))
  3762. - ieee80211_queue_work(&sdata->local->hw,
  3763. - &sdata->u.mgd.monitor_work);
  3764. -- /* and do all the other regular work too */
  3765. -- ieee80211_queue_work(&sdata->local->hw, &sdata->work);
  3766. - }
  3767. - }
  3768. -
  3769. ---- a/net/mac80211/scan.c
  3770. -+++ b/net/mac80211/scan.c
  3771. -@@ -314,6 +314,7 @@ static void __ieee80211_scan_completed(s
  3772. - bool was_scanning = local->scanning;
  3773. - struct cfg80211_scan_request *scan_req;
  3774. - struct ieee80211_sub_if_data *scan_sdata;
  3775. -+ struct ieee80211_sub_if_data *sdata;
  3776. -
  3777. - lockdep_assert_held(&local->mtx);
  3778. -
  3779. -@@ -373,7 +374,15 @@ static void __ieee80211_scan_completed(s
  3780. -
  3781. - ieee80211_mlme_notify_scan_completed(local);
  3782. - ieee80211_ibss_notify_scan_completed(local);
  3783. -- ieee80211_mesh_notify_scan_completed(local);
  3784. -+
  3785. -+ /* Requeue all the work that might have been ignored while
  3786. -+ * the scan was in progress
  3787. -+ */
  3788. -+ list_for_each_entry_rcu(sdata, &local->interfaces, list) {
  3789. -+ if (ieee80211_sdata_running(sdata))
  3790. -+ ieee80211_queue_work(&sdata->local->hw, &sdata->work);
  3791. -+ }
  3792. -+
  3793. - if (was_scanning)
  3794. - ieee80211_start_next_roc(local);
  3795. - }
  3796. diff --git a/package/kernel/mac80211/patches/315-ath9k-Expose-tsf_adjustment-in-mac80211-tsf-getters-.patch b/package/kernel/mac80211/patches/315-ath9k-Expose-tsf_adjustment-in-mac80211-tsf-getters-.patch
  3797. new file mode 100644
  3798. index 0000000..c95ab7e
  3799. --- /dev/null
  3800. +++ b/package/kernel/mac80211/patches/315-ath9k-Expose-tsf_adjustment-in-mac80211-tsf-getters-.patch
  3801. @@ -0,0 +1,32 @@
  3802. +From: Benjamin Berg <benjamin.berg@open-mesh.com>
  3803. +Date: Mon, 4 Jul 2016 14:37:23 +0200
  3804. +Subject: [PATCH] ath9k: Expose tsf_adjustment in mac80211 tsf getters and
  3805. + setters.
  3806. +
  3807. +The ath9k driver modifies the TSF for VIFs for the purpose of sending
  3808. +beacons in a staggered fashion. This patch exposes this VIF specific
  3809. +adjustment of the TSF value to mac80211. Without the change the TSF
  3810. +routines handle the hardware TSF value instead of the actual TSF value as
  3811. +seen on the air.
  3812. +
  3813. +Signed-off-by: Benjamin Berg <benjamin.berg@open-mesh.com>
  3814. +---
  3815. +
  3816. +--- a/drivers/net/wireless/ath/ath9k/main.c
  3817. ++++ b/drivers/net/wireless/ath/ath9k/main.c
  3818. +@@ -1835,6 +1835,7 @@ static u64 ath9k_get_tsf(struct ieee8021
  3819. + tsf = sc->cur_chan->tsf_val +
  3820. + ath9k_hw_get_tsf_offset(&sc->cur_chan->tsf_ts, NULL);
  3821. + }
  3822. ++ tsf += le64_to_cpu(avp->tsf_adjust);
  3823. + ath9k_ps_restore(sc);
  3824. + mutex_unlock(&sc->mutex);
  3825. +
  3826. +@@ -1850,6 +1851,7 @@ static void ath9k_set_tsf(struct ieee802
  3827. +
  3828. + mutex_lock(&sc->mutex);
  3829. + ath9k_ps_wakeup(sc);
  3830. ++ tsf -= le64_to_cpu(avp->tsf_adjust);
  3831. + getrawmonotonic(&avp->chanctx->tsf_ts);
  3832. + if (sc->cur_chan == avp->chanctx)
  3833. + ath9k_hw_settsf64(sc->sc_ah, tsf);
  3834. diff --git a/package/kernel/mac80211/patches/315-mac80211-fix-ibss-scan-parameters.patch b/package/kernel/mac80211/patches/315-mac80211-fix-ibss-scan-parameters.patch
  3835. deleted file mode 100644
  3836. index 52fecb9..0000000
  3837. --- a/package/kernel/mac80211/patches/315-mac80211-fix-ibss-scan-parameters.patch
  3838. +++ /dev/null
  3839. @@ -1,57 +0,0 @@
  3840. -From: Sara Sharon <sara.sharon@intel.com>
  3841. -Date: Mon, 25 Jan 2016 15:46:35 +0200
  3842. -Subject: [PATCH] mac80211: fix ibss scan parameters
  3843. -
  3844. -When joining IBSS a full scan should be initiated in order to search
  3845. -for existing cell, unless the fixed_channel parameter was set.
  3846. -A default channel to create the IBSS on if no cell was found is
  3847. -provided as well.
  3848. -However - a scan is initiated only on the default channel provided
  3849. -regardless of whether ifibss->fixed_channel is set or not, with the
  3850. -obvious result of the cell not joining existing IBSS cell that is
  3851. -on another channel.
  3852. -
  3853. -Fixes: 76bed0f43b27 ("mac80211: IBSS fix scan request")
  3854. -Signed-off-by: Sara Sharon <sara.sharon@intel.com>
  3855. -Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
  3856. ----
  3857. -
  3858. ---- a/net/mac80211/ibss.c
  3859. -+++ b/net/mac80211/ibss.c
  3860. -@@ -7,6 +7,7 @@
  3861. - * Copyright 2007, Michael Wu <flamingice@sourmilk.net>
  3862. - * Copyright 2009, Johannes Berg <johannes@sipsolutions.net>
  3863. - * Copyright 2013-2014 Intel Mobile Communications GmbH
  3864. -+ * Copyright(c) 2016 Intel Deutschland GmbH
  3865. - *
  3866. - * This program is free software; you can redistribute it and/or modify
  3867. - * it under the terms of the GNU General Public License version 2 as
  3868. -@@ -1483,14 +1484,21 @@ static void ieee80211_sta_find_ibss(stru
  3869. -
  3870. - sdata_info(sdata, "Trigger new scan to find an IBSS to join\n");
  3871. -
  3872. -- num = ieee80211_ibss_setup_scan_channels(local->hw.wiphy,
  3873. -- &ifibss->chandef,
  3874. -- channels,
  3875. -- ARRAY_SIZE(channels));
  3876. - scan_width = cfg80211_chandef_to_scan_width(&ifibss->chandef);
  3877. -- ieee80211_request_ibss_scan(sdata, ifibss->ssid,
  3878. -- ifibss->ssid_len, channels, num,
  3879. -- scan_width);
  3880. -+
  3881. -+ if (ifibss->fixed_channel) {
  3882. -+ num = ieee80211_ibss_setup_scan_channels(local->hw.wiphy,
  3883. -+ &ifibss->chandef,
  3884. -+ channels,
  3885. -+ ARRAY_SIZE(channels));
  3886. -+ ieee80211_request_ibss_scan(sdata, ifibss->ssid,
  3887. -+ ifibss->ssid_len, channels,
  3888. -+ num, scan_width);
  3889. -+ } else {
  3890. -+ ieee80211_request_ibss_scan(sdata, ifibss->ssid,
  3891. -+ ifibss->ssid_len, NULL,
  3892. -+ 0, scan_width);
  3893. -+ }
  3894. - } else {
  3895. - int interval = IEEE80211_SCAN_INTERVAL;
  3896. -
  3897. diff --git a/package/kernel/mac80211/patches/316-ath9k-Remove-some-defined-constants-to-decrease-verb.patch b/package/kernel/mac80211/patches/316-ath9k-Remove-some-defined-constants-to-decrease-verb.patch
  3898. new file mode 100644
  3899. index 0000000..36aaa10
  3900. --- /dev/null
  3901. +++ b/package/kernel/mac80211/patches/316-ath9k-Remove-some-defined-constants-to-decrease-verb.patch
  3902. @@ -0,0 +1,137 @@
  3903. +From: Benjamin Berg <benjamin.berg@open-mesh.com>
  3904. +Date: Mon, 4 Jul 2016 14:37:24 +0200
  3905. +Subject: [PATCH] ath9k: Remove some #defined constants to decrease
  3906. + verbosity
  3907. +
  3908. +The removed ATH9K_SLOT_TIME_X constants simply map the value in microseconds
  3909. +to the same integer. These constants were not used consistently, so fix the
  3910. +inconsistency issue by replacing all occurances with the integer equivalent.
  3911. +
  3912. +Signed-off-by: Benjamin Berg <benjamin.berg@open-mesh.com>
  3913. +---
  3914. +
  3915. +--- a/drivers/net/wireless/ath/ath9k/beacon.c
  3916. ++++ b/drivers/net/wireless/ath/ath9k/beacon.c
  3917. +@@ -50,7 +50,7 @@ static void ath9k_beaconq_config(struct
  3918. + txq = sc->tx.txq_map[IEEE80211_AC_BE];
  3919. + ath9k_hw_get_txq_props(ah, txq->axq_qnum, &qi_be);
  3920. + qi.tqi_aifs = qi_be.tqi_aifs;
  3921. +- if (ah->slottime == ATH9K_SLOT_TIME_20)
  3922. ++ if (ah->slottime == 20)
  3923. + qi.tqi_cwmin = 2*qi_be.tqi_cwmin;
  3924. + else
  3925. + qi.tqi_cwmin = 4*qi_be.tqi_cwmin;
  3926. +--- a/drivers/net/wireless/ath/ath9k/dynack.c
  3927. ++++ b/drivers/net/wireless/ath/ath9k/dynack.c
  3928. +@@ -280,7 +280,7 @@ EXPORT_SYMBOL(ath_dynack_sample_ack_ts);
  3929. + void ath_dynack_node_init(struct ath_hw *ah, struct ath_node *an)
  3930. + {
  3931. + /* ackto = slottime + sifs + air delay */
  3932. +- u32 ackto = ATH9K_SLOT_TIME_9 + 16 + 64;
  3933. ++ u32 ackto = 9 + 16 + 64;
  3934. + struct ath_dynack *da = &ah->dynack;
  3935. +
  3936. + an->ackto = ackto;
  3937. +@@ -315,7 +315,7 @@ EXPORT_SYMBOL(ath_dynack_node_deinit);
  3938. + void ath_dynack_reset(struct ath_hw *ah)
  3939. + {
  3940. + /* ackto = slottime + sifs + air delay */
  3941. +- u32 ackto = ATH9K_SLOT_TIME_9 + 16 + 64;
  3942. ++ u32 ackto = 9 + 16 + 64;
  3943. + struct ath_dynack *da = &ah->dynack;
  3944. +
  3945. + da->lto = jiffies;
  3946. +--- a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
  3947. ++++ b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
  3948. +@@ -45,7 +45,7 @@ void ath9k_htc_beaconq_config(struct ath
  3949. + * Long slot time : 2x cwmin
  3950. + * Short slot time : 4x cwmin
  3951. + */
  3952. +- if (ah->slottime == ATH9K_SLOT_TIME_20)
  3953. ++ if (ah->slottime == 20)
  3954. + qi.tqi_cwmin = 2*qi_be.tqi_cwmin;
  3955. + else
  3956. + qi.tqi_cwmin = 4*qi_be.tqi_cwmin;
  3957. +--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
  3958. ++++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
  3959. +@@ -678,7 +678,7 @@ static int ath9k_init_priv(struct ath9k_
  3960. +
  3961. + for (i = 0; i < ATH9K_HTC_MAX_BCN_VIF; i++)
  3962. + priv->beacon.bslot[i] = NULL;
  3963. +- priv->beacon.slottime = ATH9K_SLOT_TIME_9;
  3964. ++ priv->beacon.slottime = 9;
  3965. +
  3966. + ath9k_cmn_init_channels_rates(common);
  3967. + ath9k_cmn_init_crypto(ah);
  3968. +--- a/drivers/net/wireless/ath/ath9k/hw.c
  3969. ++++ b/drivers/net/wireless/ath/ath9k/hw.c
  3970. +@@ -454,7 +454,7 @@ static void ath9k_hw_init_defaults(struc
  3971. + if (AR_SREV_9100(ah))
  3972. + ah->sta_id1_defaults |= AR_STA_ID1_AR9100_BA_FIX;
  3973. +
  3974. +- ah->slottime = ATH9K_SLOT_TIME_9;
  3975. ++ ah->slottime = 9;
  3976. + ah->globaltxtimeout = (u32) -1;
  3977. + ah->power_mode = ATH9K_PM_UNDEFINED;
  3978. + ah->htc_reset_init = true;
  3979. +--- a/drivers/net/wireless/ath/ath9k/init.c
  3980. ++++ b/drivers/net/wireless/ath/ath9k/init.c
  3981. +@@ -372,7 +372,7 @@ static void ath9k_init_misc(struct ath_s
  3982. +
  3983. + common->last_rssi = ATH_RSSI_DUMMY_MARKER;
  3984. + memcpy(common->bssidmask, ath_bcast_mac, ETH_ALEN);
  3985. +- sc->beacon.slottime = ATH9K_SLOT_TIME_9;
  3986. ++ sc->beacon.slottime = 9;
  3987. +
  3988. + for (i = 0; i < ARRAY_SIZE(sc->beacon.bslot); i++)
  3989. + sc->beacon.bslot[i] = NULL;
  3990. +--- a/drivers/net/wireless/ath/ath9k/mac.h
  3991. ++++ b/drivers/net/wireless/ath/ath9k/mac.h
  3992. +@@ -65,10 +65,6 @@
  3993. + #define INIT_SSH_RETRY 32
  3994. + #define INIT_SLG_RETRY 32
  3995. +
  3996. +-#define ATH9K_SLOT_TIME_6 6
  3997. +-#define ATH9K_SLOT_TIME_9 9
  3998. +-#define ATH9K_SLOT_TIME_20 20
  3999. +-
  4000. + #define ATH9K_TXERR_XRETRY 0x01
  4001. + #define ATH9K_TXERR_FILT 0x02
  4002. + #define ATH9K_TXERR_FIFO 0x04
  4003. +--- a/drivers/net/wireless/ath/ath9k/main.c
  4004. ++++ b/drivers/net/wireless/ath/ath9k/main.c
  4005. +@@ -926,7 +926,7 @@ static void ath9k_vif_iter(struct ath9k_
  4006. + }
  4007. +
  4008. + if (!vif->bss_conf.use_short_slot)
  4009. +- iter_data->slottime = ATH9K_SLOT_TIME_20;
  4010. ++ iter_data->slottime = 20;
  4011. +
  4012. + switch (vif->type) {
  4013. + case NL80211_IFTYPE_AP:
  4014. +@@ -999,7 +999,7 @@ void ath9k_calculate_iter_data(struct at
  4015. + */
  4016. + memset(iter_data, 0, sizeof(*iter_data));
  4017. + eth_broadcast_addr(iter_data->mask);
  4018. +- iter_data->slottime = ATH9K_SLOT_TIME_9;
  4019. ++ iter_data->slottime = 9;
  4020. +
  4021. + list_for_each_entry(avp, &ctx->vifs, list)
  4022. + ath9k_vif_iter(iter_data, avp->vif->addr, avp->vif);
  4023. +@@ -1061,7 +1061,7 @@ static void ath9k_set_offchannel_state(s
  4024. + ah->opmode = vif->type;
  4025. + ah->imask &= ~ATH9K_INT_SWBA;
  4026. + ah->imask &= ~ATH9K_INT_TSFOOR;
  4027. +- ah->slottime = ATH9K_SLOT_TIME_9;
  4028. ++ ah->slottime = 9;
  4029. +
  4030. + ath_hw_setbssidmask(common);
  4031. + ath9k_hw_setopmode(ah);
  4032. +@@ -1788,6 +1788,7 @@ static void ath9k_bss_info_changed(struc
  4033. + slottime = 9;
  4034. + else
  4035. + slottime = 20;
  4036. ++
  4037. + if (vif->type == NL80211_IFTYPE_AP) {
  4038. + /*
  4039. + * Defer update, so that connected stations can adjust
  4040. diff --git a/package/kernel/mac80211/patches/316-net-mac80211-agg-rx.c-fix-use-of-uninitialised-value.patch b/package/kernel/mac80211/patches/316-net-mac80211-agg-rx.c-fix-use-of-uninitialised-value.patch
  4041. deleted file mode 100644
  4042. index e78df36..0000000
  4043. --- a/package/kernel/mac80211/patches/316-net-mac80211-agg-rx.c-fix-use-of-uninitialised-value.patch
  4044. +++ /dev/null
  4045. @@ -1,50 +0,0 @@
  4046. -From: Chris Bainbridge <chris.bainbridge@gmail.com>
  4047. -Date: Wed, 27 Jan 2016 15:46:18 +0000
  4048. -Subject: [PATCH] net/mac80211/agg-rx.c: fix use of uninitialised values
  4049. -
  4050. -Use kzalloc instead of kmalloc for struct tid_ampdu_rx. Fixes:
  4051. -
  4052. -[ 7.976605] UBSAN: Undefined behaviour in net/mac80211/rx.c:932:29
  4053. -[ 7.976608] load of value 2 is not a valid value for type '_Bool'
  4054. -[ 7.976611] CPU: 3 PID: 1134 Comm: kworker/u16:7 Not tainted 4.5.0-rc1+ #265
  4055. -[ 7.976613] Hardware name: Apple Inc. MacBookPro10,2/Mac-AFD8A9D944EA4843, BIOS MBP102.88Z.0106.B0A.1509130955 09/13/2015
  4056. -[ 7.976616] Workqueue: phy0 rt2x00usb_work_rxdone
  4057. -[ 7.976619] 0000000000000004 ffff880254a7ba50 ffffffff8181d866 0000000000000007
  4058. -[ 7.976622] ffff880254a7ba78 ffff880254a7ba68 ffffffff8188422d ffffffff8379b500
  4059. -[ 7.976626] ffff880254a7bab8 ffffffff81884747 0000000000000202 0000000348620032
  4060. -[ 7.976629] Call Trace:
  4061. -[ 7.976633] [<ffffffff8181d866>] dump_stack+0x45/0x5f
  4062. -[ 7.976637] [<ffffffff8188422d>] ubsan_epilogue+0xd/0x40
  4063. -[ 7.976642] [<ffffffff81884747>] __ubsan_handle_load_invalid_value+0x67/0x70
  4064. -[ 7.976646] [<ffffffff82227b4d>] ieee80211_sta_reorder_release.isra.16+0x5ed/0x730
  4065. -[ 7.976650] [<ffffffff8222ca14>] ieee80211_prepare_and_rx_handle+0xd04/0x1c00
  4066. -[ 7.976654] [<ffffffff81cb27ce>] ? usb_hcd_map_urb_for_dma+0x65e/0x960
  4067. -[ 7.976659] [<ffffffff8222db03>] __ieee80211_rx_handle_packet+0x1f3/0x750
  4068. -[ 7.976663] [<ffffffff8222e4a7>] ieee80211_rx_napi+0x447/0x990
  4069. -[ 7.976667] [<ffffffff81c5fb85>] rt2x00lib_rxdone+0x305/0xbd0
  4070. -[ 7.976670] [<ffffffff811ac23f>] ? dequeue_task_fair+0x64f/0x1de0
  4071. -[ 7.976674] [<ffffffff811a1516>] ? sched_clock_cpu+0xe6/0x150
  4072. -[ 7.976678] [<ffffffff81c6c45c>] rt2x00usb_work_rxdone+0x7c/0x140
  4073. -[ 7.976682] [<ffffffff8117aef6>] process_one_work+0x226/0x860
  4074. -[ 7.976686] [<ffffffff8117b58c>] worker_thread+0x5c/0x680
  4075. -[ 7.976690] [<ffffffff8117b530>] ? process_one_work+0x860/0x860
  4076. -[ 7.976693] [<ffffffff81184f86>] kthread+0xf6/0x150
  4077. -[ 7.976697] [<ffffffff81184e90>] ? kthread_worker_fn+0x310/0x310
  4078. -[ 7.976700] [<ffffffff822a94df>] ret_from_fork+0x3f/0x70
  4079. -[ 7.976703] [<ffffffff81184e90>] ? kthread_worker_fn+0x310/0x310
  4080. -
  4081. -Link: https://lkml.org/lkml/2016/1/26/230
  4082. -Signed-off-by: Chris Bainbridge <chris.bainbridge@gmail.com>
  4083. ----
  4084. -
  4085. ---- a/net/mac80211/agg-rx.c
  4086. -+++ b/net/mac80211/agg-rx.c
  4087. -@@ -327,7 +327,7 @@ void __ieee80211_start_rx_ba_session(str
  4088. - }
  4089. -
  4090. - /* prepare A-MPDU MLME for Rx aggregation */
  4091. -- tid_agg_rx = kmalloc(sizeof(struct tid_ampdu_rx), GFP_KERNEL);
  4092. -+ tid_agg_rx = kzalloc(sizeof(struct tid_ampdu_rx), GFP_KERNEL);
  4093. - if (!tid_agg_rx)
  4094. - goto end;
  4095. -
  4096. diff --git a/package/kernel/mac80211/patches/317-ath9k-Fix-beacon-configuration-for-addition-removal-.patch b/package/kernel/mac80211/patches/317-ath9k-Fix-beacon-configuration-for-addition-removal-.patch
  4097. new file mode 100644
  4098. index 0000000..360dfbf
  4099. --- /dev/null
  4100. +++ b/package/kernel/mac80211/patches/317-ath9k-Fix-beacon-configuration-for-addition-removal-.patch
  4101. @@ -0,0 +1,544 @@
  4102. +From: Benjamin Berg <benjamin.berg@open-mesh.com>
  4103. +Date: Mon, 4 Jul 2016 14:37:25 +0200
  4104. +Subject: [PATCH] ath9k: Fix beacon configuration for addition/removal of
  4105. + interfaces
  4106. +
  4107. +This patch fixes some issues with interface reconfiguration. It could
  4108. +for example happen that an AP interface in beacon slot 0 was removed
  4109. +leaving an IBSS station in one of the other slots. When this happens
  4110. +the driver never sends out the beacon as it only tries to send a beacon
  4111. +from slot 0.
  4112. +
  4113. +Appart from that the tracking of required changes to the beacon config is
  4114. +relatively complicated and prone to errors.
  4115. +
  4116. +The approach taken here is to solve reconfiguration issues is to
  4117. +reconfigure the beacons when any interface changes. This means that
  4118. +the complexity of deciding whether an interface change may modify the
  4119. +beacon configuration is gone. It also means that the beacon config will
  4120. +be reliably updated when an interface is removed.
  4121. +
  4122. +The issue that a single non-AP interface might not be in beacon
  4123. +slot 0 and wouldn't be send out is solved by moving it into the
  4124. +first slot. The TSF value in hardware is adjusted accordingly so
  4125. +that the timestamp of the beacons stay consistent.
  4126. +
  4127. +Signed-off-by: Benjamin Berg <benjamin.berg@open-mesh.com>
  4128. +---
  4129. +
  4130. +--- a/drivers/net/wireless/ath/ath9k/ath9k.h
  4131. ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  4132. +@@ -637,6 +637,8 @@ struct ath9k_vif_iter_data {
  4133. + int nwds; /* number of WDS vifs */
  4134. + int nadhocs; /* number of adhoc vifs */
  4135. + int nocbs; /* number of OCB vifs */
  4136. ++ int nbcnvifs; /* number of beaconing vifs */
  4137. ++ struct ieee80211_vif *primary_beacon_vif;
  4138. + struct ieee80211_vif *primary_sta;
  4139. + };
  4140. +
  4141. +@@ -685,10 +687,11 @@ struct ath_beacon {
  4142. + };
  4143. +
  4144. + void ath9k_beacon_tasklet(unsigned long data);
  4145. +-void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif,
  4146. +- u32 changed);
  4147. ++void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *main_vif,
  4148. ++ bool beacons);
  4149. + void ath9k_beacon_assign_slot(struct ath_softc *sc, struct ieee80211_vif *vif);
  4150. + void ath9k_beacon_remove_slot(struct ath_softc *sc, struct ieee80211_vif *vif);
  4151. ++void ath9k_beacon_ensure_primary_slot(struct ath_softc *sc);
  4152. + void ath9k_set_beacon(struct ath_softc *sc);
  4153. + bool ath9k_csa_is_finished(struct ath_softc *sc, struct ieee80211_vif *vif);
  4154. + void ath9k_csa_update(struct ath_softc *sc);
  4155. +--- a/drivers/net/wireless/ath/ath9k/beacon.c
  4156. ++++ b/drivers/net/wireless/ath/ath9k/beacon.c
  4157. +@@ -209,7 +209,6 @@ void ath9k_beacon_assign_slot(struct ath
  4158. + }
  4159. +
  4160. + sc->beacon.bslot[avp->av_bslot] = vif;
  4161. +- sc->nbcnvifs++;
  4162. +
  4163. + ath_dbg(common, CONFIG, "Added interface at beacon slot: %d\n",
  4164. + avp->av_bslot);
  4165. +@@ -220,15 +219,12 @@ void ath9k_beacon_remove_slot(struct ath
  4166. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  4167. + struct ath_vif *avp = (void *)vif->drv_priv;
  4168. + struct ath_buf *bf = avp->av_bcbuf;
  4169. +- struct ath_beacon_config *cur_conf = &sc->cur_chan->beacon;
  4170. +
  4171. + ath_dbg(common, CONFIG, "Removing interface at beacon slot: %d\n",
  4172. + avp->av_bslot);
  4173. +
  4174. + tasklet_disable(&sc->bcon_tasklet);
  4175. +
  4176. +- cur_conf->enable_beacon &= ~BIT(avp->av_bslot);
  4177. +-
  4178. + if (bf && bf->bf_mpdu) {
  4179. + struct sk_buff *skb = bf->bf_mpdu;
  4180. + dma_unmap_single(sc->dev, bf->bf_buf_addr,
  4181. +@@ -240,12 +236,73 @@ void ath9k_beacon_remove_slot(struct ath
  4182. +
  4183. + avp->av_bcbuf = NULL;
  4184. + sc->beacon.bslot[avp->av_bslot] = NULL;
  4185. +- sc->nbcnvifs--;
  4186. + list_add_tail(&bf->list, &sc->beacon.bbuf);
  4187. +
  4188. + tasklet_enable(&sc->bcon_tasklet);
  4189. + }
  4190. +
  4191. ++void ath9k_beacon_ensure_primary_slot(struct ath_softc *sc)
  4192. ++{
  4193. ++ struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  4194. ++ struct ieee80211_vif *vif;
  4195. ++ struct ath_vif *avp;
  4196. ++ s64 tsfadjust;
  4197. ++ u32 offset;
  4198. ++ int first_slot = ATH_BCBUF;
  4199. ++ int slot;
  4200. ++
  4201. ++ tasklet_disable(&sc->bcon_tasklet);
  4202. ++
  4203. ++ /* Find first taken slot. */
  4204. ++ for (slot = 0; slot < ATH_BCBUF; slot++) {
  4205. ++ if (sc->beacon.bslot[slot]) {
  4206. ++ first_slot = slot;
  4207. ++ break;
  4208. ++ }
  4209. ++ }
  4210. ++ if (first_slot == 0)
  4211. ++ goto out;
  4212. ++
  4213. ++ /* Re-enumarate all slots, moving them forward. */
  4214. ++ for (slot = 0; slot < ATH_BCBUF; slot++) {
  4215. ++ if (slot + first_slot < ATH_BCBUF) {
  4216. ++ vif = sc->beacon.bslot[slot + first_slot];
  4217. ++ sc->beacon.bslot[slot] = vif;
  4218. ++
  4219. ++ if (vif) {
  4220. ++ avp = (void *)vif->drv_priv;
  4221. ++ avp->av_bslot = slot;
  4222. ++ }
  4223. ++ } else {
  4224. ++ sc->beacon.bslot[slot] = NULL;
  4225. ++ }
  4226. ++ }
  4227. ++
  4228. ++ vif = sc->beacon.bslot[0];
  4229. ++ if (WARN_ON(!vif))
  4230. ++ goto out;
  4231. ++
  4232. ++ /* Get the tsf_adjust value for the new first slot. */
  4233. ++ avp = (void *)vif->drv_priv;
  4234. ++ tsfadjust = le64_to_cpu(avp->tsf_adjust);
  4235. ++
  4236. ++ ath_dbg(common, CONFIG,
  4237. ++ "Adjusting global TSF after beacon slot reassignment: %lld\n",
  4238. ++ (signed long long)tsfadjust);
  4239. ++
  4240. ++ /* Modify TSF as required and update the HW. */
  4241. ++ avp->chanctx->tsf_val += tsfadjust;
  4242. ++ if (sc->cur_chan == avp->chanctx) {
  4243. ++ offset = ath9k_hw_get_tsf_offset(&avp->chanctx->tsf_ts, NULL);
  4244. ++ ath9k_hw_settsf64(sc->sc_ah, avp->chanctx->tsf_val + offset);
  4245. ++ }
  4246. ++
  4247. ++ /* The slots tsf_adjust will be updated by ath9k_beacon_config later. */
  4248. ++
  4249. ++out:
  4250. ++ tasklet_enable(&sc->bcon_tasklet);
  4251. ++}
  4252. ++
  4253. + static int ath9k_beacon_choose_slot(struct ath_softc *sc)
  4254. + {
  4255. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  4256. +@@ -274,26 +331,33 @@ static int ath9k_beacon_choose_slot(stru
  4257. + return slot;
  4258. + }
  4259. +
  4260. +-static void ath9k_set_tsfadjust(struct ath_softc *sc, struct ieee80211_vif *vif)
  4261. ++static void ath9k_set_tsfadjust(struct ath_softc *sc,
  4262. ++ struct ath_beacon_config *cur_conf)
  4263. + {
  4264. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  4265. +- struct ath_vif *avp = (void *)vif->drv_priv;
  4266. +- struct ath_beacon_config *cur_conf = &avp->chanctx->beacon;
  4267. + s64 tsfadjust;
  4268. ++ int slot;
  4269. +
  4270. +- if (avp->av_bslot == 0)
  4271. +- return;
  4272. ++ for (slot = 0; slot < ATH_BCBUF; slot++) {
  4273. ++ struct ath_vif *avp;
  4274. +
  4275. +- /* tsf_adjust is added to the TSF value. We send out the beacon late,
  4276. +- * so need to adjust the TSF starting point to be later in time (i.e.
  4277. +- * the theoretical first beacon has a TSF of 0 after correction).
  4278. +- */
  4279. +- tsfadjust = cur_conf->beacon_interval * avp->av_bslot;
  4280. +- tsfadjust = -TU_TO_USEC(tsfadjust) / ATH_BCBUF;
  4281. +- avp->tsf_adjust = cpu_to_le64(tsfadjust);
  4282. ++ if (!sc->beacon.bslot[slot])
  4283. ++ continue;
  4284. +
  4285. +- ath_dbg(common, CONFIG, "tsfadjust is: %lld for bslot: %d\n",
  4286. +- (signed long long)tsfadjust, avp->av_bslot);
  4287. ++ avp = (void *)sc->beacon.bslot[slot]->drv_priv;
  4288. ++
  4289. ++ /* tsf_adjust is added to the TSF value. We send out the
  4290. ++ * beacon late, so need to adjust the TSF starting point to be
  4291. ++ * later in time (i.e. the theoretical first beacon has a TSF
  4292. ++ * of 0 after correction).
  4293. ++ */
  4294. ++ tsfadjust = cur_conf->beacon_interval * avp->av_bslot;
  4295. ++ tsfadjust = -TU_TO_USEC(tsfadjust) / ATH_BCBUF;
  4296. ++ avp->tsf_adjust = cpu_to_le64(tsfadjust);
  4297. ++
  4298. ++ ath_dbg(common, CONFIG, "tsfadjust is: %lld for bslot: %d\n",
  4299. ++ (signed long long)tsfadjust, avp->av_bslot);
  4300. ++ }
  4301. + }
  4302. +
  4303. + bool ath9k_csa_is_finished(struct ath_softc *sc, struct ieee80211_vif *vif)
  4304. +@@ -447,20 +511,28 @@ void ath9k_beacon_tasklet(unsigned long
  4305. + * Both nexttbtt and intval have to be in usecs.
  4306. + */
  4307. + static void ath9k_beacon_init(struct ath_softc *sc, u32 nexttbtt,
  4308. +- u32 intval, bool reset_tsf)
  4309. ++ u32 intval)
  4310. + {
  4311. + struct ath_hw *ah = sc->sc_ah;
  4312. +
  4313. + ath9k_hw_disable_interrupts(ah);
  4314. +- if (reset_tsf)
  4315. +- ath9k_hw_reset_tsf(ah);
  4316. + ath9k_beaconq_config(sc);
  4317. + ath9k_hw_beaconinit(ah, nexttbtt, intval);
  4318. ++ ah->imask |= ATH9K_INT_SWBA;
  4319. + sc->beacon.bmisscnt = 0;
  4320. + ath9k_hw_set_interrupts(ah);
  4321. + ath9k_hw_enable_interrupts(ah);
  4322. + }
  4323. +
  4324. ++static void ath9k_beacon_stop(struct ath_softc *sc)
  4325. ++{
  4326. ++ ath9k_hw_disable_interrupts(sc->sc_ah);
  4327. ++ sc->sc_ah->imask &= ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS);
  4328. ++ sc->beacon.bmisscnt = 0;
  4329. ++ ath9k_hw_set_interrupts(sc->sc_ah);
  4330. ++ ath9k_hw_enable_interrupts(sc->sc_ah);
  4331. ++}
  4332. ++
  4333. + /*
  4334. + * For multi-bss ap support beacons are either staggered evenly over N slots or
  4335. + * burst together. For the former arrange for the SWBA to be delivered for each
  4336. +@@ -472,7 +544,7 @@ static void ath9k_beacon_config_ap(struc
  4337. + struct ath_hw *ah = sc->sc_ah;
  4338. +
  4339. + ath9k_cmn_beacon_config_ap(ah, conf, ATH_BCBUF);
  4340. +- ath9k_beacon_init(sc, conf->nexttbtt, conf->intval, false);
  4341. ++ ath9k_beacon_init(sc, conf->nexttbtt, conf->intval);
  4342. + }
  4343. +
  4344. + static void ath9k_beacon_config_sta(struct ath_hw *ah,
  4345. +@@ -501,7 +573,7 @@ static void ath9k_beacon_config_adhoc(st
  4346. +
  4347. + ath9k_cmn_beacon_config_adhoc(ah, conf);
  4348. +
  4349. +- ath9k_beacon_init(sc, conf->nexttbtt, conf->intval, conf->ibss_creator);
  4350. ++ ath9k_beacon_init(sc, conf->nexttbtt, conf->intval);
  4351. +
  4352. + /*
  4353. + * Set the global 'beacon has been configured' flag for the
  4354. +@@ -511,44 +583,6 @@ static void ath9k_beacon_config_adhoc(st
  4355. + set_bit(ATH_OP_BEACONS, &common->op_flags);
  4356. + }
  4357. +
  4358. +-static bool ath9k_allow_beacon_config(struct ath_softc *sc,
  4359. +- struct ieee80211_vif *vif)
  4360. +-{
  4361. +- struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  4362. +- struct ath_vif *avp = (void *)vif->drv_priv;
  4363. +-
  4364. +- if (ath9k_is_chanctx_enabled()) {
  4365. +- /*
  4366. +- * If the VIF is not present in the current channel context,
  4367. +- * then we can't do the usual opmode checks. Allow the
  4368. +- * beacon config for the VIF to be updated in this case and
  4369. +- * return immediately.
  4370. +- */
  4371. +- if (sc->cur_chan != avp->chanctx)
  4372. +- return true;
  4373. +- }
  4374. +-
  4375. +- if (sc->sc_ah->opmode == NL80211_IFTYPE_AP) {
  4376. +- if (vif->type != NL80211_IFTYPE_AP) {
  4377. +- ath_dbg(common, CONFIG,
  4378. +- "An AP interface is already present !\n");
  4379. +- return false;
  4380. +- }
  4381. +- }
  4382. +-
  4383. +- if (sc->sc_ah->opmode == NL80211_IFTYPE_STATION) {
  4384. +- if ((vif->type == NL80211_IFTYPE_STATION) &&
  4385. +- test_bit(ATH_OP_BEACONS, &common->op_flags) &&
  4386. +- vif != sc->cur_chan->primary_sta) {
  4387. +- ath_dbg(common, CONFIG,
  4388. +- "Beacon already configured for a station interface\n");
  4389. +- return false;
  4390. +- }
  4391. +- }
  4392. +-
  4393. +- return true;
  4394. +-}
  4395. +-
  4396. + static void ath9k_cache_beacon_config(struct ath_softc *sc,
  4397. + struct ath_chanctx *ctx,
  4398. + struct ieee80211_bss_conf *bss_conf)
  4399. +@@ -584,87 +618,79 @@ static void ath9k_cache_beacon_config(st
  4400. + if (cur_conf->dtim_period == 0)
  4401. + cur_conf->dtim_period = 1;
  4402. +
  4403. ++ ath9k_set_tsfadjust(sc, cur_conf);
  4404. + }
  4405. +
  4406. +-void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif,
  4407. +- u32 changed)
  4408. ++void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *main_vif,
  4409. ++ bool beacons)
  4410. + {
  4411. +- struct ieee80211_bss_conf *bss_conf = &vif->bss_conf;
  4412. +- struct ath_hw *ah = sc->sc_ah;
  4413. +- struct ath_common *common = ath9k_hw_common(ah);
  4414. +- struct ath_vif *avp = (void *)vif->drv_priv;
  4415. +- struct ath_chanctx *ctx = avp->chanctx;
  4416. ++ struct ath_hw *ah = sc->sc_ah;
  4417. ++ struct ath_common *common = ath9k_hw_common(ah);
  4418. ++ struct ath_vif *avp;
  4419. ++ struct ath_chanctx *ctx;
  4420. + struct ath_beacon_config *cur_conf;
  4421. + unsigned long flags;
  4422. ++ bool enabled;
  4423. + bool skip_beacon = false;
  4424. +
  4425. +- if (!ctx)
  4426. ++ if (!beacons) {
  4427. ++ clear_bit(ATH_OP_BEACONS, &common->op_flags);
  4428. ++ ath9k_beacon_stop(sc);
  4429. + return;
  4430. ++ }
  4431. +
  4432. +- cur_conf = &avp->chanctx->beacon;
  4433. +- if (vif->type == NL80211_IFTYPE_AP)
  4434. +- ath9k_set_tsfadjust(sc, vif);
  4435. +-
  4436. +- if (!ath9k_allow_beacon_config(sc, vif))
  4437. ++ if (WARN_ON(!main_vif))
  4438. + return;
  4439. +
  4440. +- if (vif->type == NL80211_IFTYPE_STATION) {
  4441. +- ath9k_cache_beacon_config(sc, ctx, bss_conf);
  4442. +- if (ctx != sc->cur_chan)
  4443. +- return;
  4444. ++ avp = (void *)main_vif->drv_priv;
  4445. ++ ctx = avp->chanctx;
  4446. ++ cur_conf = &ctx->beacon;
  4447. ++ enabled = cur_conf->enable_beacon;
  4448. ++ cur_conf->enable_beacon = beacons;
  4449. ++
  4450. ++ if (sc->sc_ah->opmode == NL80211_IFTYPE_STATION) {
  4451. ++ ath9k_cache_beacon_config(sc, ctx, &main_vif->bss_conf);
  4452. +
  4453. + ath9k_set_beacon(sc);
  4454. + set_bit(ATH_OP_BEACONS, &common->op_flags);
  4455. + return;
  4456. + }
  4457. +
  4458. +- /*
  4459. +- * Take care of multiple interfaces when
  4460. +- * enabling/disabling SWBA.
  4461. +- */
  4462. +- if (changed & BSS_CHANGED_BEACON_ENABLED) {
  4463. +- bool enabled = cur_conf->enable_beacon;
  4464. +-
  4465. +- if (!bss_conf->enable_beacon) {
  4466. +- cur_conf->enable_beacon &= ~BIT(avp->av_bslot);
  4467. +- } else {
  4468. +- cur_conf->enable_beacon |= BIT(avp->av_bslot);
  4469. +- if (!enabled)
  4470. +- ath9k_cache_beacon_config(sc, ctx, bss_conf);
  4471. +- }
  4472. +- }
  4473. +-
  4474. +- if (ctx != sc->cur_chan)
  4475. +- return;
  4476. ++ /* Update the beacon configuration. */
  4477. ++ ath9k_cache_beacon_config(sc, ctx, &main_vif->bss_conf);
  4478. +
  4479. + /*
  4480. + * Configure the HW beacon registers only when we have a valid
  4481. + * beacon interval.
  4482. + */
  4483. + if (cur_conf->beacon_interval) {
  4484. +- /*
  4485. +- * If we are joining an existing IBSS network, start beaconing
  4486. +- * only after a TSF-sync has taken place. Ensure that this
  4487. +- * happens by setting the appropriate flags.
  4488. ++ /* Special case to sync the TSF when joining an existing IBSS.
  4489. ++ * This is only done if no AP interface is active.
  4490. ++ * Note that mac80211 always resets the TSF when creating a new
  4491. ++ * IBSS interface.
  4492. + */
  4493. +- if ((changed & BSS_CHANGED_IBSS) && !bss_conf->ibss_creator &&
  4494. +- bss_conf->enable_beacon) {
  4495. ++ if (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC &&
  4496. ++ !enabled && beacons && !main_vif->bss_conf.ibss_creator) {
  4497. + spin_lock_irqsave(&sc->sc_pm_lock, flags);
  4498. + sc->ps_flags |= PS_BEACON_SYNC | PS_WAIT_FOR_BEACON;
  4499. + spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
  4500. + skip_beacon = true;
  4501. +- } else {
  4502. +- ath9k_set_beacon(sc);
  4503. + }
  4504. +
  4505. + /*
  4506. + * Do not set the ATH_OP_BEACONS flag for IBSS joiner mode
  4507. + * here, it is done in ath9k_beacon_config_adhoc().
  4508. + */
  4509. +- if (cur_conf->enable_beacon && !skip_beacon)
  4510. ++ if (beacons && !skip_beacon) {
  4511. + set_bit(ATH_OP_BEACONS, &common->op_flags);
  4512. +- else
  4513. ++ ath9k_set_beacon(sc);
  4514. ++ } else {
  4515. + clear_bit(ATH_OP_BEACONS, &common->op_flags);
  4516. ++ ath9k_beacon_stop(sc);
  4517. ++ }
  4518. ++ } else {
  4519. ++ clear_bit(ATH_OP_BEACONS, &common->op_flags);
  4520. ++ ath9k_beacon_stop(sc);
  4521. + }
  4522. + }
  4523. +
  4524. +--- a/drivers/net/wireless/ath/ath9k/common.h
  4525. ++++ b/drivers/net/wireless/ath/ath9k/common.h
  4526. +@@ -50,6 +50,7 @@
  4527. + #define IEEE80211_MS_TO_TU(x) (((x) * 1000) / 1024)
  4528. +
  4529. + struct ath_beacon_config {
  4530. ++ struct ieee80211_vif *main_vif;
  4531. + int beacon_interval;
  4532. + u16 dtim_period;
  4533. + u16 bmiss_timeout;
  4534. +--- a/drivers/net/wireless/ath/ath9k/main.c
  4535. ++++ b/drivers/net/wireless/ath/ath9k/main.c
  4536. +@@ -910,6 +910,22 @@ static bool ath9k_uses_beacons(int type)
  4537. + }
  4538. + }
  4539. +
  4540. ++static void ath9k_vif_iter_set_beacon(struct ath9k_vif_iter_data *iter_data,
  4541. ++ struct ieee80211_vif *vif)
  4542. ++{
  4543. ++ /* Use the first (configured) interface, but prefering AP interfaces. */
  4544. ++ if (!iter_data->primary_beacon_vif) {
  4545. ++ iter_data->primary_beacon_vif = vif;
  4546. ++ } else {
  4547. ++ if (iter_data->primary_beacon_vif->type != NL80211_IFTYPE_AP &&
  4548. ++ vif->type == NL80211_IFTYPE_AP)
  4549. ++ iter_data->primary_beacon_vif = vif;
  4550. ++ }
  4551. ++
  4552. ++ iter_data->beacons = true;
  4553. ++ iter_data->nbcnvifs += 1;
  4554. ++}
  4555. ++
  4556. + static void ath9k_vif_iter(struct ath9k_vif_iter_data *iter_data,
  4557. + u8 *mac, struct ieee80211_vif *vif)
  4558. + {
  4559. +@@ -931,6 +947,8 @@ static void ath9k_vif_iter(struct ath9k_
  4560. + switch (vif->type) {
  4561. + case NL80211_IFTYPE_AP:
  4562. + iter_data->naps++;
  4563. ++ if (vif->bss_conf.enable_beacon)
  4564. ++ ath9k_vif_iter_set_beacon(iter_data, vif);
  4565. + break;
  4566. + case NL80211_IFTYPE_STATION:
  4567. + iter_data->nstations++;
  4568. +@@ -943,12 +961,12 @@ static void ath9k_vif_iter(struct ath9k_
  4569. + case NL80211_IFTYPE_ADHOC:
  4570. + iter_data->nadhocs++;
  4571. + if (vif->bss_conf.enable_beacon)
  4572. +- iter_data->beacons = true;
  4573. ++ ath9k_vif_iter_set_beacon(iter_data, vif);
  4574. + break;
  4575. + case NL80211_IFTYPE_MESH_POINT:
  4576. + iter_data->nmeshes++;
  4577. + if (vif->bss_conf.enable_beacon)
  4578. +- iter_data->beacons = true;
  4579. ++ ath9k_vif_iter_set_beacon(iter_data, vif);
  4580. + break;
  4581. + case NL80211_IFTYPE_WDS:
  4582. + iter_data->nwds++;
  4583. +@@ -1081,7 +1099,6 @@ void ath9k_calculate_summary_state(struc
  4584. + struct ath_hw *ah = sc->sc_ah;
  4585. + struct ath_common *common = ath9k_hw_common(ah);
  4586. + struct ath9k_vif_iter_data iter_data;
  4587. +- struct ath_beacon_config *cur_conf;
  4588. +
  4589. + ath_chanctx_check_active(sc, ctx);
  4590. +
  4591. +@@ -1103,13 +1120,12 @@ void ath9k_calculate_summary_state(struc
  4592. + ath_hw_setbssidmask(common);
  4593. +
  4594. + if (iter_data.naps > 0) {
  4595. +- cur_conf = &ctx->beacon;
  4596. + ath9k_hw_set_tsfadjust(ah, true);
  4597. + ah->opmode = NL80211_IFTYPE_AP;
  4598. +- if (cur_conf->enable_beacon)
  4599. +- iter_data.beacons = true;
  4600. + } else {
  4601. + ath9k_hw_set_tsfadjust(ah, false);
  4602. ++ if (iter_data.beacons)
  4603. ++ ath9k_beacon_ensure_primary_slot(sc);
  4604. +
  4605. + if (iter_data.nmeshes)
  4606. + ah->opmode = NL80211_IFTYPE_MESH_POINT;
  4607. +@@ -1134,7 +1150,6 @@ void ath9k_calculate_summary_state(struc
  4608. + ctx->switch_after_beacon = true;
  4609. + }
  4610. +
  4611. +- ah->imask &= ~ATH9K_INT_SWBA;
  4612. + if (ah->opmode == NL80211_IFTYPE_STATION) {
  4613. + bool changed = (iter_data.primary_sta != ctx->primary_sta);
  4614. +
  4615. +@@ -1151,16 +1166,12 @@ void ath9k_calculate_summary_state(struc
  4616. + if (ath9k_hw_mci_is_enabled(sc->sc_ah))
  4617. + ath9k_mci_update_wlan_channels(sc, true);
  4618. + }
  4619. +- } else if (iter_data.beacons) {
  4620. +- ah->imask |= ATH9K_INT_SWBA;
  4621. + }
  4622. ++ sc->nbcnvifs = iter_data.nbcnvifs;
  4623. ++ ath9k_beacon_config(sc, iter_data.primary_beacon_vif,
  4624. ++ iter_data.beacons);
  4625. + ath9k_hw_set_interrupts(ah);
  4626. +
  4627. +- if (iter_data.beacons)
  4628. +- set_bit(ATH_OP_BEACONS, &common->op_flags);
  4629. +- else
  4630. +- clear_bit(ATH_OP_BEACONS, &common->op_flags);
  4631. +-
  4632. + if (ah->slottime != iter_data.slottime) {
  4633. + ah->slottime = iter_data.slottime;
  4634. + ath9k_hw_init_global_settings(ah);
  4635. +@@ -1777,9 +1788,7 @@ static void ath9k_bss_info_changed(struc
  4636. + if ((changed & BSS_CHANGED_BEACON_ENABLED) ||
  4637. + (changed & BSS_CHANGED_BEACON_INT) ||
  4638. + (changed & BSS_CHANGED_BEACON_INFO)) {
  4639. +- ath9k_beacon_config(sc, vif, changed);
  4640. +- if (changed & BSS_CHANGED_BEACON_ENABLED)
  4641. +- ath9k_calculate_summary_state(sc, avp->chanctx);
  4642. ++ ath9k_calculate_summary_state(sc, avp->chanctx);
  4643. + }
  4644. +
  4645. + if ((avp->chanctx == sc->cur_chan) &&
  4646. diff --git a/package/kernel/mac80211/patches/317-mac80211-minstrel_ht-fix-out-of-bound-in-minstrel_ht.patch b/package/kernel/mac80211/patches/317-mac80211-minstrel_ht-fix-out-of-bound-in-minstrel_ht.patch
  4647. deleted file mode 100644
  4648. index 5bf53b9..0000000
  4649. --- a/package/kernel/mac80211/patches/317-mac80211-minstrel_ht-fix-out-of-bound-in-minstrel_ht.patch
  4650. +++ /dev/null
  4651. @@ -1,45 +0,0 @@
  4652. -From: Konstantin Khlebnikov <koct9i@gmail.com>
  4653. -Date: Fri, 29 Jan 2016 11:35:12 +0300
  4654. -Subject: [PATCH] mac80211: minstrel_ht: fix out-of-bound in
  4655. - minstrel_ht_set_best_prob_rate
  4656. -
  4657. -Patch fixes this splat
  4658. -
  4659. -BUG: KASAN: slab-out-of-bounds in minstrel_ht_update_stats.isra.7+0x6e1/0x9e0
  4660. -[mac80211] at addr ffff8800cee640f4 Read of size 4 by task swapper/3/0
  4661. -
  4662. -Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>
  4663. -Link: http://lkml.kernel.org/r/CALYGNiNyJhSaVnE35qS6UCGaSb2Dx1_i5HcRavuOX14oTz2P+w@mail.gmail.com
  4664. ----
  4665. -
  4666. ---- a/net/mac80211/rc80211_minstrel_ht.c
  4667. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  4668. -@@ -414,15 +414,16 @@ minstrel_ht_set_best_prob_rate(struct mi
  4669. - (max_tp_group != MINSTREL_CCK_GROUP))
  4670. - return;
  4671. -
  4672. -+ max_gpr_group = mg->max_group_prob_rate / MCS_GROUP_RATES;
  4673. -+ max_gpr_idx = mg->max_group_prob_rate % MCS_GROUP_RATES;
  4674. -+ max_gpr_prob = mi->groups[max_gpr_group].rates[max_gpr_idx].prob_ewma;
  4675. -+
  4676. - if (mrs->prob_ewma > MINSTREL_FRAC(75, 100)) {
  4677. - cur_tp_avg = minstrel_ht_get_tp_avg(mi, cur_group, cur_idx,
  4678. - mrs->prob_ewma);
  4679. - if (cur_tp_avg > tmp_tp_avg)
  4680. - mi->max_prob_rate = index;
  4681. -
  4682. -- max_gpr_group = mg->max_group_prob_rate / MCS_GROUP_RATES;
  4683. -- max_gpr_idx = mg->max_group_prob_rate % MCS_GROUP_RATES;
  4684. -- max_gpr_prob = mi->groups[max_gpr_group].rates[max_gpr_idx].prob_ewma;
  4685. - max_gpr_tp_avg = minstrel_ht_get_tp_avg(mi, max_gpr_group,
  4686. - max_gpr_idx,
  4687. - max_gpr_prob);
  4688. -@@ -431,7 +432,7 @@ minstrel_ht_set_best_prob_rate(struct mi
  4689. - } else {
  4690. - if (mrs->prob_ewma > tmp_prob)
  4691. - mi->max_prob_rate = index;
  4692. -- if (mrs->prob_ewma > mg->rates[mg->max_group_prob_rate].prob_ewma)
  4693. -+ if (mrs->prob_ewma > max_gpr_prob)
  4694. - mg->max_group_prob_rate = index;
  4695. - }
  4696. - }
  4697. diff --git a/package/kernel/mac80211/patches/318-brcmfmac-slightly-simplify-building-interface-combin.patch b/package/kernel/mac80211/patches/318-brcmfmac-slightly-simplify-building-interface-combin.patch
  4698. new file mode 100644
  4699. index 0000000..d946ecc
  4700. --- /dev/null
  4701. +++ b/package/kernel/mac80211/patches/318-brcmfmac-slightly-simplify-building-interface-combin.patch
  4702. @@ -0,0 +1,108 @@
  4703. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4704. +Date: Tue, 7 Jun 2016 21:10:18 +0200
  4705. +Subject: [PATCH] brcmfmac: slightly simplify building interface combinations
  4706. +MIME-Version: 1.0
  4707. +Content-Type: text/plain; charset=UTF-8
  4708. +Content-Transfer-Encoding: 8bit
  4709. +
  4710. +This change reorders some operations in brcmf_setup_ifmodes in hope to
  4711. +make it simpler:
  4712. +1) It allocates arrays right before filling them. This way it's easier
  4713. + to follow requested array length as it's immediately followed by
  4714. + code filling it. It's easier to check e.g. why we need 4 entries for
  4715. + P2P. Other than that it deduplicates some checks (e.g. for P2P).
  4716. +2) It reorders code to first prepare limits and then define a new combo.
  4717. + Previously this was mixed (e.g. we were setting num of channels
  4718. + before preparing limits).
  4719. +3) It modifies mbss code to use i variable just like other combos do.
  4720. +
  4721. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4722. +Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  4723. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4724. +---
  4725. +
  4726. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  4727. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  4728. +@@ -6284,29 +6284,15 @@ static int brcmf_setup_ifmodes(struct wi
  4729. + if (!combo)
  4730. + goto err;
  4731. +
  4732. +- c0_limits = kcalloc(p2p ? 3 : 2, sizeof(*c0_limits), GFP_KERNEL);
  4733. +- if (!c0_limits)
  4734. +- goto err;
  4735. +-
  4736. +- if (p2p) {
  4737. +- p2p_limits = kcalloc(4, sizeof(*p2p_limits), GFP_KERNEL);
  4738. +- if (!p2p_limits)
  4739. +- goto err;
  4740. +- }
  4741. +-
  4742. +- if (mbss) {
  4743. +- mbss_limits = kcalloc(1, sizeof(*mbss_limits), GFP_KERNEL);
  4744. +- if (!mbss_limits)
  4745. +- goto err;
  4746. +- }
  4747. +-
  4748. + wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
  4749. + BIT(NL80211_IFTYPE_ADHOC) |
  4750. + BIT(NL80211_IFTYPE_AP);
  4751. +
  4752. + c = 0;
  4753. + i = 0;
  4754. +- combo[c].num_different_channels = 1;
  4755. ++ c0_limits = kcalloc(p2p ? 3 : 2, sizeof(*c0_limits), GFP_KERNEL);
  4756. ++ if (!c0_limits)
  4757. ++ goto err;
  4758. + c0_limits[i].max = 1;
  4759. + c0_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  4760. + if (p2p) {
  4761. +@@ -6324,6 +6310,7 @@ static int brcmf_setup_ifmodes(struct wi
  4762. + c0_limits[i].max = 1;
  4763. + c0_limits[i++].types = BIT(NL80211_IFTYPE_AP);
  4764. + }
  4765. ++ combo[c].num_different_channels = 1;
  4766. + combo[c].max_interfaces = i;
  4767. + combo[c].n_limits = i;
  4768. + combo[c].limits = c0_limits;
  4769. +@@ -6331,7 +6318,9 @@ static int brcmf_setup_ifmodes(struct wi
  4770. + if (p2p) {
  4771. + c++;
  4772. + i = 0;
  4773. +- combo[c].num_different_channels = 1;
  4774. ++ p2p_limits = kcalloc(4, sizeof(*p2p_limits), GFP_KERNEL);
  4775. ++ if (!p2p_limits)
  4776. ++ goto err;
  4777. + p2p_limits[i].max = 1;
  4778. + p2p_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  4779. + p2p_limits[i].max = 1;
  4780. +@@ -6340,6 +6329,7 @@ static int brcmf_setup_ifmodes(struct wi
  4781. + p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT);
  4782. + p2p_limits[i].max = 1;
  4783. + p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  4784. ++ combo[c].num_different_channels = 1;
  4785. + combo[c].max_interfaces = i;
  4786. + combo[c].n_limits = i;
  4787. + combo[c].limits = p2p_limits;
  4788. +@@ -6347,14 +6337,19 @@ static int brcmf_setup_ifmodes(struct wi
  4789. +
  4790. + if (mbss) {
  4791. + c++;
  4792. ++ i = 0;
  4793. ++ mbss_limits = kcalloc(1, sizeof(*mbss_limits), GFP_KERNEL);
  4794. ++ if (!mbss_limits)
  4795. ++ goto err;
  4796. ++ mbss_limits[i].max = 4;
  4797. ++ mbss_limits[i++].types = BIT(NL80211_IFTYPE_AP);
  4798. + combo[c].beacon_int_infra_match = true;
  4799. + combo[c].num_different_channels = 1;
  4800. +- mbss_limits[0].max = 4;
  4801. +- mbss_limits[0].types = BIT(NL80211_IFTYPE_AP);
  4802. + combo[c].max_interfaces = 4;
  4803. +- combo[c].n_limits = 1;
  4804. ++ combo[c].n_limits = i;
  4805. + combo[c].limits = mbss_limits;
  4806. + }
  4807. ++
  4808. + wiphy->n_iface_combinations = n_combos;
  4809. + wiphy->iface_combinations = combo;
  4810. + return 0;
  4811. diff --git a/package/kernel/mac80211/patches/318-mac80211-move-A-MSDU-skb_linearize-call-to-ieee80211.patch b/package/kernel/mac80211/patches/318-mac80211-move-A-MSDU-skb_linearize-call-to-ieee80211.patch
  4812. deleted file mode 100644
  4813. index 655dc4b..0000000
  4814. --- a/package/kernel/mac80211/patches/318-mac80211-move-A-MSDU-skb_linearize-call-to-ieee80211.patch
  4815. +++ /dev/null
  4816. @@ -1,35 +0,0 @@
  4817. -From: Felix Fietkau <nbd@openwrt.org>
  4818. -Date: Tue, 2 Feb 2016 14:39:08 +0100
  4819. -Subject: [PATCH] mac80211: move A-MSDU skb_linearize call to
  4820. - ieee80211_amsdu_to_8023s
  4821. -
  4822. -Prepararation for zero-copy A-MSDU support with page fragment SKBs
  4823. -
  4824. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  4825. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  4826. ----
  4827. -
  4828. ---- a/net/mac80211/rx.c
  4829. -+++ b/net/mac80211/rx.c
  4830. -@@ -2203,9 +2203,6 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx
  4831. - skb->dev = dev;
  4832. - __skb_queue_head_init(&frame_list);
  4833. -
  4834. -- if (skb_linearize(skb))
  4835. -- return RX_DROP_UNUSABLE;
  4836. --
  4837. - ieee80211_amsdu_to_8023s(skb, &frame_list, dev->dev_addr,
  4838. - rx->sdata->vif.type,
  4839. - rx->local->hw.extra_tx_headroom, true);
  4840. ---- a/net/wireless/util.c
  4841. -+++ b/net/wireless/util.c
  4842. -@@ -657,6 +657,9 @@ void ieee80211_amsdu_to_8023s(struct sk_
  4843. - int remaining, err;
  4844. - u8 dst[ETH_ALEN], src[ETH_ALEN];
  4845. -
  4846. -+ if (skb_linearize(skb))
  4847. -+ goto out;
  4848. -+
  4849. - if (has_80211_header) {
  4850. - err = ieee80211_data_to_8023(skb, addr, iftype);
  4851. - if (err)
  4852. diff --git a/package/kernel/mac80211/patches/319-0001-brcmfmac-fix-lockup-when-removing-P2P-interface-afte.patch b/package/kernel/mac80211/patches/319-0001-brcmfmac-fix-lockup-when-removing-P2P-interface-afte.patch
  4853. new file mode 100644
  4854. index 0000000..073d012
  4855. --- /dev/null
  4856. +++ b/package/kernel/mac80211/patches/319-0001-brcmfmac-fix-lockup-when-removing-P2P-interface-afte.patch
  4857. @@ -0,0 +1,154 @@
  4858. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4859. +Date: Fri, 17 Jun 2016 12:29:21 +0200
  4860. +Subject: [PATCH] brcmfmac: fix lockup when removing P2P interface after
  4861. + event timeout
  4862. +MIME-Version: 1.0
  4863. +Content-Type: text/plain; charset=UTF-8
  4864. +Content-Transfer-Encoding: 8bit
  4865. +
  4866. +Removing P2P interface is handled by sending a proper request to the
  4867. +firmware. On success firmware triggers an event and driver's handler
  4868. +removes a matching interface.
  4869. +
  4870. +However on event timeout we remove interface directly from the cfg80211
  4871. +callback. Current code doesn't handle this case correctly as it always
  4872. +assumes rtnl to be unlocked.
  4873. +
  4874. +Fix it by adding an extra rtnl_locked parameter to functions and calling
  4875. +unregister_netdevice when needed.
  4876. +
  4877. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4878. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4879. +---
  4880. +
  4881. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  4882. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  4883. +@@ -548,12 +548,16 @@ fail:
  4884. + return -EBADE;
  4885. + }
  4886. +
  4887. +-static void brcmf_net_detach(struct net_device *ndev)
  4888. ++static void brcmf_net_detach(struct net_device *ndev, bool rtnl_locked)
  4889. + {
  4890. +- if (ndev->reg_state == NETREG_REGISTERED)
  4891. +- unregister_netdev(ndev);
  4892. +- else
  4893. ++ if (ndev->reg_state == NETREG_REGISTERED) {
  4894. ++ if (rtnl_locked)
  4895. ++ unregister_netdevice(ndev);
  4896. ++ else
  4897. ++ unregister_netdev(ndev);
  4898. ++ } else {
  4899. + brcmf_cfg80211_free_netdev(ndev);
  4900. ++ }
  4901. + }
  4902. +
  4903. + void brcmf_net_setcarrier(struct brcmf_if *ifp, bool on)
  4904. +@@ -651,7 +655,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  4905. + brcmf_err("ERROR: netdev:%s already exists\n",
  4906. + ifp->ndev->name);
  4907. + netif_stop_queue(ifp->ndev);
  4908. +- brcmf_net_detach(ifp->ndev);
  4909. ++ brcmf_net_detach(ifp->ndev, false);
  4910. + drvr->iflist[bsscfgidx] = NULL;
  4911. + } else {
  4912. + brcmf_dbg(INFO, "netdev:%s ignore IF event\n",
  4913. +@@ -699,7 +703,8 @@ struct brcmf_if *brcmf_add_if(struct brc
  4914. + return ifp;
  4915. + }
  4916. +
  4917. +-static void brcmf_del_if(struct brcmf_pub *drvr, s32 bsscfgidx)
  4918. ++static void brcmf_del_if(struct brcmf_pub *drvr, s32 bsscfgidx,
  4919. ++ bool rtnl_locked)
  4920. + {
  4921. + struct brcmf_if *ifp;
  4922. +
  4923. +@@ -729,7 +734,7 @@ static void brcmf_del_if(struct brcmf_pu
  4924. + cancel_work_sync(&ifp->multicast_work);
  4925. + cancel_work_sync(&ifp->ndoffload_work);
  4926. + }
  4927. +- brcmf_net_detach(ifp->ndev);
  4928. ++ brcmf_net_detach(ifp->ndev, rtnl_locked);
  4929. + } else {
  4930. + /* Only p2p device interfaces which get dynamically created
  4931. + * end up here. In this case the p2p module should be informed
  4932. +@@ -743,14 +748,14 @@ static void brcmf_del_if(struct brcmf_pu
  4933. + }
  4934. + }
  4935. +
  4936. +-void brcmf_remove_interface(struct brcmf_if *ifp)
  4937. ++void brcmf_remove_interface(struct brcmf_if *ifp, bool rtnl_locked)
  4938. + {
  4939. + if (!ifp || WARN_ON(ifp->drvr->iflist[ifp->bsscfgidx] != ifp))
  4940. + return;
  4941. + brcmf_dbg(TRACE, "Enter, bsscfgidx=%d, ifidx=%d\n", ifp->bsscfgidx,
  4942. + ifp->ifidx);
  4943. + brcmf_fws_del_interface(ifp);
  4944. +- brcmf_del_if(ifp->drvr, ifp->bsscfgidx);
  4945. ++ brcmf_del_if(ifp->drvr, ifp->bsscfgidx, rtnl_locked);
  4946. + }
  4947. +
  4948. + #ifdef CONFIG_INET
  4949. +@@ -1057,9 +1062,9 @@ fail:
  4950. + brcmf_fws_deinit(drvr);
  4951. + }
  4952. + if (ifp)
  4953. +- brcmf_net_detach(ifp->ndev);
  4954. ++ brcmf_net_detach(ifp->ndev, false);
  4955. + if (p2p_ifp)
  4956. +- brcmf_net_detach(p2p_ifp->ndev);
  4957. ++ brcmf_net_detach(p2p_ifp->ndev, false);
  4958. + drvr->iflist[0] = NULL;
  4959. + drvr->iflist[1] = NULL;
  4960. + if (drvr->settings->ignore_probe_fail)
  4961. +@@ -1128,7 +1133,7 @@ void brcmf_detach(struct device *dev)
  4962. +
  4963. + /* make sure primary interface removed last */
  4964. + for (i = BRCMF_MAX_IFS-1; i > -1; i--)
  4965. +- brcmf_remove_interface(drvr->iflist[i]);
  4966. ++ brcmf_remove_interface(drvr->iflist[i], false);
  4967. +
  4968. + brcmf_cfg80211_detach(drvr->config);
  4969. +
  4970. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  4971. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  4972. +@@ -216,7 +216,7 @@ struct brcmf_if *brcmf_get_ifp(struct br
  4973. + int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  4974. + struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
  4975. + bool is_p2pdev, char *name, u8 *mac_addr);
  4976. +-void brcmf_remove_interface(struct brcmf_if *ifp);
  4977. ++void brcmf_remove_interface(struct brcmf_if *ifp, bool rtnl_locked);
  4978. + void brcmf_txflowblock_if(struct brcmf_if *ifp,
  4979. + enum brcmf_netif_stop_reason reason, bool state);
  4980. + void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
  4981. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  4982. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  4983. +@@ -183,7 +183,7 @@ static void brcmf_fweh_handle_if_event(s
  4984. + err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data);
  4985. +
  4986. + if (ifp && ifevent->action == BRCMF_E_IF_DEL)
  4987. +- brcmf_remove_interface(ifp);
  4988. ++ brcmf_remove_interface(ifp, false);
  4989. + }
  4990. +
  4991. + /**
  4992. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  4993. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  4994. +@@ -2289,7 +2289,7 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  4995. + err = 0;
  4996. + }
  4997. + if (err)
  4998. +- brcmf_remove_interface(vif->ifp);
  4999. ++ brcmf_remove_interface(vif->ifp, true);
  5000. +
  5001. + brcmf_cfg80211_arm_vif_event(cfg, NULL);
  5002. + if (vif->wdev.iftype != NL80211_IFTYPE_P2P_DEVICE)
  5003. +@@ -2395,7 +2395,7 @@ void brcmf_p2p_detach(struct brcmf_p2p_i
  5004. + if (vif != NULL) {
  5005. + brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  5006. + brcmf_p2p_deinit_discovery(p2p);
  5007. +- brcmf_remove_interface(vif->ifp);
  5008. ++ brcmf_remove_interface(vif->ifp, false);
  5009. + }
  5010. + /* just set it all to zero */
  5011. + memset(p2p, 0, sizeof(*p2p));
  5012. diff --git a/package/kernel/mac80211/patches/319-0002-brcmfmac-use-const-char-for-interface-name-in-brcmf_.patch b/package/kernel/mac80211/patches/319-0002-brcmfmac-use-const-char-for-interface-name-in-brcmf_.patch
  5013. new file mode 100644
  5014. index 0000000..6d3f3c6
  5015. --- /dev/null
  5016. +++ b/package/kernel/mac80211/patches/319-0002-brcmfmac-use-const-char-for-interface-name-in-brcmf_.patch
  5017. @@ -0,0 +1,40 @@
  5018. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  5019. +Date: Fri, 17 Jun 2016 12:48:44 +0200
  5020. +Subject: [PATCH] brcmfmac: use const char * for interface name in
  5021. + brcmf_add_if
  5022. +MIME-Version: 1.0
  5023. +Content-Type: text/plain; charset=UTF-8
  5024. +Content-Transfer-Encoding: 8bit
  5025. +
  5026. +This function can work just fine with const pointer, it only calls
  5027. +alloc_netdev which take const as well. Moreover it makes this function
  5028. +more flexible as some cfg80211 callback may provide const char * as
  5029. +well, e.g. add_virtual_intf. This will be needed for more advanced
  5030. +interface management.
  5031. +
  5032. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  5033. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  5034. +---
  5035. +
  5036. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  5037. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  5038. +@@ -638,7 +638,7 @@ fail:
  5039. + }
  5040. +
  5041. + struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
  5042. +- bool is_p2pdev, char *name, u8 *mac_addr)
  5043. ++ bool is_p2pdev, const char *name, u8 *mac_addr)
  5044. + {
  5045. + struct brcmf_if *ifp;
  5046. + struct net_device *ndev;
  5047. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  5048. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  5049. +@@ -215,7 +215,7 @@ char *brcmf_ifname(struct brcmf_if *ifp)
  5050. + struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx);
  5051. + int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  5052. + struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
  5053. +- bool is_p2pdev, char *name, u8 *mac_addr);
  5054. ++ bool is_p2pdev, const char *name, u8 *mac_addr);
  5055. + void brcmf_remove_interface(struct brcmf_if *ifp, bool rtnl_locked);
  5056. + void brcmf_txflowblock_if(struct brcmf_if *ifp,
  5057. + enum brcmf_netif_stop_reason reason, bool state);
  5058. diff --git a/package/kernel/mac80211/patches/319-0003-brcmfmac-include-also-core.h-header-in-cfg80211.h.patch b/package/kernel/mac80211/patches/319-0003-brcmfmac-include-also-core.h-header-in-cfg80211.h.patch
  5059. new file mode 100644
  5060. index 0000000..eeda766
  5061. --- /dev/null
  5062. +++ b/package/kernel/mac80211/patches/319-0003-brcmfmac-include-also-core.h-header-in-cfg80211.h.patch
  5063. @@ -0,0 +1,33 @@
  5064. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  5065. +Date: Sat, 18 Jun 2016 18:49:38 +0200
  5066. +Subject: [PATCH] brcmfmac: include also core.h header in cfg80211.h
  5067. +MIME-Version: 1.0
  5068. +Content-Type: text/plain; charset=UTF-8
  5069. +Content-Transfer-Encoding: 8bit
  5070. +
  5071. +This header provides two inline functions using struct brcmf_if so we
  5072. +need core.h to avoid:
  5073. +
  5074. +drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h: In function ‘ndev_to_prof’:
  5075. +drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h:368:13: error: dereferencing pointer to incomplete type
  5076. + return &ifp->vif->profile;
  5077. + ^
  5078. +drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h: In function ‘ndev_to_vif’:
  5079. +drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h:374:12: error: dereferencing pointer to incomplete type
  5080. + return ifp->vif;
  5081. + ^
  5082. +
  5083. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  5084. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  5085. +---
  5086. +
  5087. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  5088. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  5089. +@@ -20,6 +20,7 @@
  5090. + /* for brcmu_d11inf */
  5091. + #include <brcmu_d11.h>
  5092. +
  5093. ++#include "core.h"
  5094. + #include "fwil_types.h"
  5095. + #include "p2p.h"
  5096. +
  5097. diff --git a/package/kernel/mac80211/patches/319-0004-brcmfmac-add-missing-break-when-deleting-P2P_DEVICE.patch b/package/kernel/mac80211/patches/319-0004-brcmfmac-add-missing-break-when-deleting-P2P_DEVICE.patch
  5098. new file mode 100644
  5099. index 0000000..3819248
  5100. --- /dev/null
  5101. +++ b/package/kernel/mac80211/patches/319-0004-brcmfmac-add-missing-break-when-deleting-P2P_DEVICE.patch
  5102. @@ -0,0 +1,27 @@
  5103. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  5104. +Date: Sun, 19 Jun 2016 01:55:57 +0200
  5105. +Subject: [PATCH] brcmfmac: add missing break when deleting P2P_DEVICE
  5106. +MIME-Version: 1.0
  5107. +Content-Type: text/plain; charset=UTF-8
  5108. +Content-Transfer-Encoding: 8bit
  5109. +
  5110. +We obviously don't want to fall through in that switch. With this change
  5111. +1) We wait for event (triggered by p2p_disc) as expected
  5112. +2) We remove interface manually on timeout
  5113. +3) We return 0 on success instead of -ENOTSUPP
  5114. +
  5115. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  5116. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  5117. +---
  5118. +
  5119. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  5120. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  5121. +@@ -2263,6 +2263,8 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  5122. + return 0;
  5123. + brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  5124. + brcmf_p2p_deinit_discovery(p2p);
  5125. ++ break;
  5126. ++
  5127. + default:
  5128. + return -ENOTSUPP;
  5129. + }
  5130. diff --git a/package/kernel/mac80211/patches/319-0005-brcmfmac-delete-interface-directly-in-code-that-sent.patch b/package/kernel/mac80211/patches/319-0005-brcmfmac-delete-interface-directly-in-code-that-sent.patch
  5131. new file mode 100644
  5132. index 0000000..12d7eb4
  5133. --- /dev/null
  5134. +++ b/package/kernel/mac80211/patches/319-0005-brcmfmac-delete-interface-directly-in-code-that-sent.patch
  5135. @@ -0,0 +1,75 @@
  5136. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  5137. +Date: Wed, 29 Jun 2016 21:54:26 +0200
  5138. +Subject: [PATCH] brcmfmac: delete interface directly in code that sent fw
  5139. + request
  5140. +MIME-Version: 1.0
  5141. +Content-Type: text/plain; charset=UTF-8
  5142. +Content-Transfer-Encoding: 8bit
  5143. +
  5144. +So far when receiving event about in-firmware-interface removal our
  5145. +event worker was notifying listener and afterwards it was removing Linux
  5146. +interface.
  5147. +
  5148. +First of all it was resulting in slightly unexpected order. The listener
  5149. +(del_virtual_intf callback) was (usually) returning with success before
  5150. +we even called unregister_netdev(ice).
  5151. +
  5152. +Please note this couldn't be simply fixed by changing order of calls in
  5153. +brcmf_fweh_handle_if_event as unregistering interface earlier could free
  5154. +struct brcmf_if.
  5155. +
  5156. +Another problem of current implementation are possible lockups. Focus on
  5157. +the time slot between calling event handler and removing Linux
  5158. +interface. During that time original caller may leave (unlocking rtnl
  5159. +semaphore) *and* another call to the same code may be done (locking it
  5160. +again). If that happens our event handler will stuck at removing Linux
  5161. +interface, it won't handle another event and will block process holding
  5162. +rtnl lock.
  5163. +
  5164. +This can be simply solved by unregistering interface in a proper
  5165. +callback, right after receiving confirmation event from firmware. This
  5166. +only required modifying worker to don't unregister on its own if there
  5167. +is someone waiting for the event.
  5168. +
  5169. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  5170. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  5171. +---
  5172. +
  5173. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  5174. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  5175. +@@ -18,6 +18,7 @@
  5176. + #include "brcmu_wifi.h"
  5177. + #include "brcmu_utils.h"
  5178. +
  5179. ++#include "cfg80211.h"
  5180. + #include "core.h"
  5181. + #include "debug.h"
  5182. + #include "tracepoint.h"
  5183. +@@ -182,8 +183,13 @@ static void brcmf_fweh_handle_if_event(s
  5184. +
  5185. + err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data);
  5186. +
  5187. +- if (ifp && ifevent->action == BRCMF_E_IF_DEL)
  5188. +- brcmf_remove_interface(ifp, false);
  5189. ++ if (ifp && ifevent->action == BRCMF_E_IF_DEL) {
  5190. ++ bool armed = brcmf_cfg80211_vif_event_armed(drvr->config);
  5191. ++
  5192. ++ /* Default handling in case no-one waits for this event */
  5193. ++ if (!armed)
  5194. ++ brcmf_remove_interface(ifp, false);
  5195. ++ }
  5196. + }
  5197. +
  5198. + /**
  5199. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  5200. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  5201. +@@ -2290,8 +2290,7 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  5202. + else
  5203. + err = 0;
  5204. + }
  5205. +- if (err)
  5206. +- brcmf_remove_interface(vif->ifp, true);
  5207. ++ brcmf_remove_interface(vif->ifp, true);
  5208. +
  5209. + brcmf_cfg80211_arm_vif_event(cfg, NULL);
  5210. + if (vif->wdev.iftype != NL80211_IFTYPE_P2P_DEVICE)
  5211. diff --git a/package/kernel/mac80211/patches/319-0006-brcmfmac-support-removing-AP-interfaces-with-interfa.patch b/package/kernel/mac80211/patches/319-0006-brcmfmac-support-removing-AP-interfaces-with-interfa.patch
  5212. new file mode 100644
  5213. index 0000000..2f7165e
  5214. --- /dev/null
  5215. +++ b/package/kernel/mac80211/patches/319-0006-brcmfmac-support-removing-AP-interfaces-with-interfa.patch
  5216. @@ -0,0 +1,84 @@
  5217. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  5218. +Date: Wed, 29 Jun 2016 21:54:27 +0200
  5219. +Subject: [PATCH] brcmfmac: support removing AP interfaces with
  5220. + "interface_remove"
  5221. +MIME-Version: 1.0
  5222. +Content-Type: text/plain; charset=UTF-8
  5223. +Content-Transfer-Encoding: 8bit
  5224. +
  5225. +New firmwares (e.g. 10.10.69.36 for BCM4366) support "interface_remove"
  5226. +for removing interfaces. Try to use this method on cfg80211 request. In
  5227. +case of older firmwares (e.g. 7.35.177.56 for BCM43602 as I tested) this
  5228. +will just result in firmware rejecting command and this won't change any
  5229. +behavior.
  5230. +
  5231. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  5232. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  5233. +---
  5234. +
  5235. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  5236. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  5237. +@@ -785,12 +785,48 @@ s32 brcmf_notify_escan_complete(struct b
  5238. + return err;
  5239. + }
  5240. +
  5241. ++static int brcmf_cfg80211_del_ap_iface(struct wiphy *wiphy,
  5242. ++ struct wireless_dev *wdev)
  5243. ++{
  5244. ++ struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy);
  5245. ++ struct net_device *ndev = wdev->netdev;
  5246. ++ struct brcmf_if *ifp = netdev_priv(ndev);
  5247. ++ int ret;
  5248. ++ int err;
  5249. ++
  5250. ++ brcmf_cfg80211_arm_vif_event(cfg, ifp->vif);
  5251. ++
  5252. ++ err = brcmf_fil_bsscfg_data_set(ifp, "interface_remove", NULL, 0);
  5253. ++ if (err) {
  5254. ++ brcmf_err("interface_remove failed %d\n", err);
  5255. ++ goto err_unarm;
  5256. ++ }
  5257. ++
  5258. ++ /* wait for firmware event */
  5259. ++ ret = brcmf_cfg80211_wait_vif_event(cfg, BRCMF_E_IF_DEL,
  5260. ++ BRCMF_VIF_EVENT_TIMEOUT);
  5261. ++ if (!ret) {
  5262. ++ brcmf_err("timeout occurred\n");
  5263. ++ err = -EIO;
  5264. ++ goto err_unarm;
  5265. ++ }
  5266. ++
  5267. ++ brcmf_remove_interface(ifp, true);
  5268. ++
  5269. ++err_unarm:
  5270. ++ brcmf_cfg80211_arm_vif_event(cfg, NULL);
  5271. ++ return err;
  5272. ++}
  5273. ++
  5274. + static
  5275. + int brcmf_cfg80211_del_iface(struct wiphy *wiphy, struct wireless_dev *wdev)
  5276. + {
  5277. + struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy);
  5278. + struct net_device *ndev = wdev->netdev;
  5279. +
  5280. ++ if (ndev && ndev == cfg_to_ndev(cfg))
  5281. ++ return -ENOTSUPP;
  5282. ++
  5283. + /* vif event pending in firmware */
  5284. + if (brcmf_cfg80211_vif_event_armed(cfg))
  5285. + return -EBUSY;
  5286. +@@ -807,12 +843,13 @@ int brcmf_cfg80211_del_iface(struct wiph
  5287. + switch (wdev->iftype) {
  5288. + case NL80211_IFTYPE_ADHOC:
  5289. + case NL80211_IFTYPE_STATION:
  5290. +- case NL80211_IFTYPE_AP:
  5291. + case NL80211_IFTYPE_AP_VLAN:
  5292. + case NL80211_IFTYPE_WDS:
  5293. + case NL80211_IFTYPE_MONITOR:
  5294. + case NL80211_IFTYPE_MESH_POINT:
  5295. + return -EOPNOTSUPP;
  5296. ++ case NL80211_IFTYPE_AP:
  5297. ++ return brcmf_cfg80211_del_ap_iface(wiphy, wdev);
  5298. + case NL80211_IFTYPE_P2P_CLIENT:
  5299. + case NL80211_IFTYPE_P2P_GO:
  5300. + case NL80211_IFTYPE_P2P_DEVICE:
  5301. diff --git a/package/kernel/mac80211/patches/319-cfg80211-add-function-for-802.3-conversion-with-sepa.patch b/package/kernel/mac80211/patches/319-cfg80211-add-function-for-802.3-conversion-with-sepa.patch
  5302. deleted file mode 100644
  5303. index b646ab3..0000000
  5304. --- a/package/kernel/mac80211/patches/319-cfg80211-add-function-for-802.3-conversion-with-sepa.patch
  5305. +++ /dev/null
  5306. @@ -1,186 +0,0 @@
  5307. -From: Felix Fietkau <nbd@openwrt.org>
  5308. -Date: Tue, 2 Feb 2016 14:39:09 +0100
  5309. -Subject: [PATCH] cfg80211: add function for 802.3 conversion with separate
  5310. - output buffer
  5311. -
  5312. -Use skb_copy_bits in preparation for allowing fragmented skbs
  5313. -
  5314. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  5315. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  5316. ----
  5317. -
  5318. ---- a/net/wireless/util.c
  5319. -+++ b/net/wireless/util.c
  5320. -@@ -393,9 +393,9 @@ unsigned int ieee80211_get_hdrlen_from_s
  5321. - }
  5322. - EXPORT_SYMBOL(ieee80211_get_hdrlen_from_skb);
  5323. -
  5324. --unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr)
  5325. -+static unsigned int __ieee80211_get_mesh_hdrlen(u8 flags)
  5326. - {
  5327. -- int ae = meshhdr->flags & MESH_FLAGS_AE;
  5328. -+ int ae = flags & MESH_FLAGS_AE;
  5329. - /* 802.11-2012, 8.2.4.7.3 */
  5330. - switch (ae) {
  5331. - default:
  5332. -@@ -407,21 +407,31 @@ unsigned int ieee80211_get_mesh_hdrlen(s
  5333. - return 18;
  5334. - }
  5335. - }
  5336. -+
  5337. -+unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr)
  5338. -+{
  5339. -+ return __ieee80211_get_mesh_hdrlen(meshhdr->flags);
  5340. -+}
  5341. - EXPORT_SYMBOL(ieee80211_get_mesh_hdrlen);
  5342. -
  5343. --int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
  5344. -- enum nl80211_iftype iftype)
  5345. -+static int __ieee80211_data_to_8023(struct sk_buff *skb, struct ethhdr *ehdr,
  5346. -+ const u8 *addr, enum nl80211_iftype iftype)
  5347. - {
  5348. - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
  5349. -- u16 hdrlen, ethertype;
  5350. -- u8 *payload;
  5351. -- u8 dst[ETH_ALEN];
  5352. -- u8 src[ETH_ALEN] __aligned(2);
  5353. -+ struct {
  5354. -+ u8 hdr[ETH_ALEN] __aligned(2);
  5355. -+ __be16 proto;
  5356. -+ } payload;
  5357. -+ struct ethhdr tmp;
  5358. -+ u16 hdrlen;
  5359. -+ u8 mesh_flags = 0;
  5360. -
  5361. - if (unlikely(!ieee80211_is_data_present(hdr->frame_control)))
  5362. - return -1;
  5363. -
  5364. - hdrlen = ieee80211_hdrlen(hdr->frame_control);
  5365. -+ if (skb->len < hdrlen + 8)
  5366. -+ return -1;
  5367. -
  5368. - /* convert IEEE 802.11 header + possible LLC headers into Ethernet
  5369. - * header
  5370. -@@ -432,8 +442,11 @@ int ieee80211_data_to_8023(struct sk_buf
  5371. - * 1 0 BSSID SA DA n/a
  5372. - * 1 1 RA TA DA SA
  5373. - */
  5374. -- memcpy(dst, ieee80211_get_DA(hdr), ETH_ALEN);
  5375. -- memcpy(src, ieee80211_get_SA(hdr), ETH_ALEN);
  5376. -+ memcpy(tmp.h_dest, ieee80211_get_DA(hdr), ETH_ALEN);
  5377. -+ memcpy(tmp.h_source, ieee80211_get_SA(hdr), ETH_ALEN);
  5378. -+
  5379. -+ if (iftype == NL80211_IFTYPE_MESH_POINT)
  5380. -+ skb_copy_bits(skb, hdrlen, &mesh_flags, 1);
  5381. -
  5382. - switch (hdr->frame_control &
  5383. - cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) {
  5384. -@@ -450,44 +463,31 @@ int ieee80211_data_to_8023(struct sk_buf
  5385. - iftype != NL80211_IFTYPE_STATION))
  5386. - return -1;
  5387. - if (iftype == NL80211_IFTYPE_MESH_POINT) {
  5388. -- struct ieee80211s_hdr *meshdr =
  5389. -- (struct ieee80211s_hdr *) (skb->data + hdrlen);
  5390. -- /* make sure meshdr->flags is on the linear part */
  5391. -- if (!pskb_may_pull(skb, hdrlen + 1))
  5392. -- return -1;
  5393. -- if (meshdr->flags & MESH_FLAGS_AE_A4)
  5394. -+ if (mesh_flags & MESH_FLAGS_AE_A4)
  5395. - return -1;
  5396. -- if (meshdr->flags & MESH_FLAGS_AE_A5_A6) {
  5397. -+ if (mesh_flags & MESH_FLAGS_AE_A5_A6) {
  5398. - skb_copy_bits(skb, hdrlen +
  5399. - offsetof(struct ieee80211s_hdr, eaddr1),
  5400. -- dst, ETH_ALEN);
  5401. -- skb_copy_bits(skb, hdrlen +
  5402. -- offsetof(struct ieee80211s_hdr, eaddr2),
  5403. -- src, ETH_ALEN);
  5404. -+ tmp.h_dest, 2 * ETH_ALEN);
  5405. - }
  5406. -- hdrlen += ieee80211_get_mesh_hdrlen(meshdr);
  5407. -+ hdrlen += __ieee80211_get_mesh_hdrlen(mesh_flags);
  5408. - }
  5409. - break;
  5410. - case cpu_to_le16(IEEE80211_FCTL_FROMDS):
  5411. - if ((iftype != NL80211_IFTYPE_STATION &&
  5412. - iftype != NL80211_IFTYPE_P2P_CLIENT &&
  5413. - iftype != NL80211_IFTYPE_MESH_POINT) ||
  5414. -- (is_multicast_ether_addr(dst) &&
  5415. -- ether_addr_equal(src, addr)))
  5416. -+ (is_multicast_ether_addr(tmp.h_dest) &&
  5417. -+ ether_addr_equal(tmp.h_source, addr)))
  5418. - return -1;
  5419. - if (iftype == NL80211_IFTYPE_MESH_POINT) {
  5420. -- struct ieee80211s_hdr *meshdr =
  5421. -- (struct ieee80211s_hdr *) (skb->data + hdrlen);
  5422. -- /* make sure meshdr->flags is on the linear part */
  5423. -- if (!pskb_may_pull(skb, hdrlen + 1))
  5424. -- return -1;
  5425. -- if (meshdr->flags & MESH_FLAGS_AE_A5_A6)
  5426. -+ if (mesh_flags & MESH_FLAGS_AE_A5_A6)
  5427. - return -1;
  5428. -- if (meshdr->flags & MESH_FLAGS_AE_A4)
  5429. -+ if (mesh_flags & MESH_FLAGS_AE_A4)
  5430. - skb_copy_bits(skb, hdrlen +
  5431. - offsetof(struct ieee80211s_hdr, eaddr1),
  5432. -- src, ETH_ALEN);
  5433. -- hdrlen += ieee80211_get_mesh_hdrlen(meshdr);
  5434. -+ tmp.h_source, ETH_ALEN);
  5435. -+ hdrlen += __ieee80211_get_mesh_hdrlen(mesh_flags);
  5436. - }
  5437. - break;
  5438. - case cpu_to_le16(0):
  5439. -@@ -498,33 +498,33 @@ int ieee80211_data_to_8023(struct sk_buf
  5440. - break;
  5441. - }
  5442. -
  5443. -- if (!pskb_may_pull(skb, hdrlen + 8))
  5444. -- return -1;
  5445. --
  5446. -- payload = skb->data + hdrlen;
  5447. -- ethertype = (payload[6] << 8) | payload[7];
  5448. -+ skb_copy_bits(skb, hdrlen, &payload, sizeof(payload));
  5449. -+ tmp.h_proto = payload.proto;
  5450. -
  5451. -- if (likely((ether_addr_equal(payload, rfc1042_header) &&
  5452. -- ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) ||
  5453. -- ether_addr_equal(payload, bridge_tunnel_header))) {
  5454. -+ if (likely((ether_addr_equal(payload.hdr, rfc1042_header) &&
  5455. -+ tmp.h_proto != htons(ETH_P_AARP) &&
  5456. -+ tmp.h_proto != htons(ETH_P_IPX)) ||
  5457. -+ ether_addr_equal(payload.hdr, bridge_tunnel_header)))
  5458. - /* remove RFC1042 or Bridge-Tunnel encapsulation and
  5459. - * replace EtherType */
  5460. -- skb_pull(skb, hdrlen + 6);
  5461. -- memcpy(skb_push(skb, ETH_ALEN), src, ETH_ALEN);
  5462. -- memcpy(skb_push(skb, ETH_ALEN), dst, ETH_ALEN);
  5463. -- } else {
  5464. -- struct ethhdr *ehdr;
  5465. -- __be16 len;
  5466. -+ hdrlen += ETH_ALEN + 2;
  5467. -+ else
  5468. -+ tmp.h_proto = htons(skb->len);
  5469. -
  5470. -- skb_pull(skb, hdrlen);
  5471. -- len = htons(skb->len);
  5472. -+ pskb_pull(skb, hdrlen);
  5473. -+
  5474. -+ if (!ehdr)
  5475. - ehdr = (struct ethhdr *) skb_push(skb, sizeof(struct ethhdr));
  5476. -- memcpy(ehdr->h_dest, dst, ETH_ALEN);
  5477. -- memcpy(ehdr->h_source, src, ETH_ALEN);
  5478. -- ehdr->h_proto = len;
  5479. -- }
  5480. -+ memcpy(ehdr, &tmp, sizeof(tmp));
  5481. -+
  5482. - return 0;
  5483. - }
  5484. -+
  5485. -+int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
  5486. -+ enum nl80211_iftype iftype)
  5487. -+{
  5488. -+ return __ieee80211_data_to_8023(skb, NULL, addr, iftype);
  5489. -+}
  5490. - EXPORT_SYMBOL(ieee80211_data_to_8023);
  5491. -
  5492. - int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr,
  5493. diff --git a/package/kernel/mac80211/patches/320-ath9k-fix-using-sta-drv_priv-before-initializing-it.patch b/package/kernel/mac80211/patches/320-ath9k-fix-using-sta-drv_priv-before-initializing-it.patch
  5494. new file mode 100644
  5495. index 0000000..aaa6706
  5496. --- /dev/null
  5497. +++ b/package/kernel/mac80211/patches/320-ath9k-fix-using-sta-drv_priv-before-initializing-it.patch
  5498. @@ -0,0 +1,33 @@
  5499. +From: Felix Fietkau <nbd@nbd.name>
  5500. +Date: Tue, 2 Aug 2016 13:00:01 +0200
  5501. +Subject: [PATCH] ath9k: fix using sta->drv_priv before initializing it
  5502. +
  5503. +A station pointer can be passed to the driver on tx, before it has been
  5504. +marked as associated. Since ath9k_sta_state was initializing the entry
  5505. +too late, it resulted in some spurious crashes.
  5506. +
  5507. +Fixes: df3c6eb34da5 ("ath9k: Use sta_state() callback")
  5508. +Cc: stable@vger.kernel.org
  5509. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  5510. +---
  5511. +
  5512. +--- a/drivers/net/wireless/ath/ath9k/main.c
  5513. ++++ b/drivers/net/wireless/ath/ath9k/main.c
  5514. +@@ -1563,13 +1563,13 @@ static int ath9k_sta_state(struct ieee80
  5515. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  5516. + int ret = 0;
  5517. +
  5518. +- if (old_state == IEEE80211_STA_AUTH &&
  5519. +- new_state == IEEE80211_STA_ASSOC) {
  5520. ++ if (old_state == IEEE80211_STA_NOTEXIST &&
  5521. ++ new_state == IEEE80211_STA_NONE) {
  5522. + ret = ath9k_sta_add(hw, vif, sta);
  5523. + ath_dbg(common, CONFIG,
  5524. + "Add station: %pM\n", sta->addr);
  5525. +- } else if (old_state == IEEE80211_STA_ASSOC &&
  5526. +- new_state == IEEE80211_STA_AUTH) {
  5527. ++ } else if (old_state == IEEE80211_STA_NONE &&
  5528. ++ new_state == IEEE80211_STA_NOTEXIST) {
  5529. + ret = ath9k_sta_remove(hw, vif, sta);
  5530. + ath_dbg(common, CONFIG,
  5531. + "Remove station: %pM\n", sta->addr);
  5532. diff --git a/package/kernel/mac80211/patches/320-cfg80211-add-support-for-non-linear-skbs-in-ieee8021.patch b/package/kernel/mac80211/patches/320-cfg80211-add-support-for-non-linear-skbs-in-ieee8021.patch
  5533. deleted file mode 100644
  5534. index 2eeed22..0000000
  5535. --- a/package/kernel/mac80211/patches/320-cfg80211-add-support-for-non-linear-skbs-in-ieee8021.patch
  5536. +++ /dev/null
  5537. @@ -1,159 +0,0 @@
  5538. -From: Felix Fietkau <nbd@openwrt.org>
  5539. -Date: Tue, 2 Feb 2016 14:39:10 +0100
  5540. -Subject: [PATCH] cfg80211: add support for non-linear skbs in
  5541. - ieee80211_amsdu_to_8023s
  5542. -
  5543. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  5544. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  5545. ----
  5546. -
  5547. ---- a/net/wireless/util.c
  5548. -+++ b/net/wireless/util.c
  5549. -@@ -644,73 +644,75 @@ int ieee80211_data_from_8023(struct sk_b
  5550. - }
  5551. - EXPORT_SYMBOL(ieee80211_data_from_8023);
  5552. -
  5553. -+static struct sk_buff *
  5554. -+__ieee80211_amsdu_copy(struct sk_buff *skb, unsigned int hlen,
  5555. -+ int offset, int len)
  5556. -+{
  5557. -+ struct sk_buff *frame;
  5558. -+
  5559. -+ if (skb->len - offset < len)
  5560. -+ return NULL;
  5561. -+
  5562. -+ /*
  5563. -+ * Allocate and reserve two bytes more for payload
  5564. -+ * alignment since sizeof(struct ethhdr) is 14.
  5565. -+ */
  5566. -+ frame = dev_alloc_skb(hlen + sizeof(struct ethhdr) + 2 + len);
  5567. -+
  5568. -+ skb_reserve(frame, hlen + sizeof(struct ethhdr) + 2);
  5569. -+ skb_copy_bits(skb, offset, skb_put(frame, len), len);
  5570. -+
  5571. -+ return frame;
  5572. -+}
  5573. -
  5574. - void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
  5575. - const u8 *addr, enum nl80211_iftype iftype,
  5576. - const unsigned int extra_headroom,
  5577. - bool has_80211_header)
  5578. - {
  5579. -+ unsigned int hlen = ALIGN(extra_headroom, 4);
  5580. - struct sk_buff *frame = NULL;
  5581. - u16 ethertype;
  5582. - u8 *payload;
  5583. -- const struct ethhdr *eth;
  5584. -- int remaining, err;
  5585. -- u8 dst[ETH_ALEN], src[ETH_ALEN];
  5586. --
  5587. -- if (skb_linearize(skb))
  5588. -- goto out;
  5589. -+ int offset = 0, remaining, err;
  5590. -+ struct ethhdr eth;
  5591. -+ bool reuse_skb = true;
  5592. -+ bool last = false;
  5593. -
  5594. - if (has_80211_header) {
  5595. -- err = ieee80211_data_to_8023(skb, addr, iftype);
  5596. -+ err = __ieee80211_data_to_8023(skb, &eth, addr, iftype);
  5597. - if (err)
  5598. - goto out;
  5599. --
  5600. -- /* skip the wrapping header */
  5601. -- eth = (struct ethhdr *) skb_pull(skb, sizeof(struct ethhdr));
  5602. -- if (!eth)
  5603. -- goto out;
  5604. -- } else {
  5605. -- eth = (struct ethhdr *) skb->data;
  5606. - }
  5607. -
  5608. -- while (skb != frame) {
  5609. -+ while (!last) {
  5610. -+ unsigned int subframe_len;
  5611. -+ int len;
  5612. - u8 padding;
  5613. -- __be16 len = eth->h_proto;
  5614. -- unsigned int subframe_len = sizeof(struct ethhdr) + ntohs(len);
  5615. --
  5616. -- remaining = skb->len;
  5617. -- memcpy(dst, eth->h_dest, ETH_ALEN);
  5618. -- memcpy(src, eth->h_source, ETH_ALEN);
  5619. -
  5620. -+ skb_copy_bits(skb, offset, &eth, sizeof(eth));
  5621. -+ len = ntohs(eth.h_proto);
  5622. -+ subframe_len = sizeof(struct ethhdr) + len;
  5623. - padding = (4 - subframe_len) & 0x3;
  5624. -+
  5625. - /* the last MSDU has no padding */
  5626. -+ remaining = skb->len - offset;
  5627. - if (subframe_len > remaining)
  5628. - goto purge;
  5629. -
  5630. -- skb_pull(skb, sizeof(struct ethhdr));
  5631. -+ offset += sizeof(struct ethhdr);
  5632. - /* reuse skb for the last subframe */
  5633. -- if (remaining <= subframe_len + padding)
  5634. -+ last = remaining <= subframe_len + padding;
  5635. -+ if (!skb_is_nonlinear(skb) && last) {
  5636. -+ skb_pull(skb, offset);
  5637. - frame = skb;
  5638. -- else {
  5639. -- unsigned int hlen = ALIGN(extra_headroom, 4);
  5640. -- /*
  5641. -- * Allocate and reserve two bytes more for payload
  5642. -- * alignment since sizeof(struct ethhdr) is 14.
  5643. -- */
  5644. -- frame = dev_alloc_skb(hlen + subframe_len + 2);
  5645. -+ reuse_skb = true;
  5646. -+ } else {
  5647. -+ frame = __ieee80211_amsdu_copy(skb, hlen, offset, len);
  5648. - if (!frame)
  5649. - goto purge;
  5650. -
  5651. -- skb_reserve(frame, hlen + sizeof(struct ethhdr) + 2);
  5652. -- memcpy(skb_put(frame, ntohs(len)), skb->data,
  5653. -- ntohs(len));
  5654. --
  5655. -- eth = (struct ethhdr *)skb_pull(skb, ntohs(len) +
  5656. -- padding);
  5657. -- if (!eth) {
  5658. -- dev_kfree_skb(frame);
  5659. -- goto purge;
  5660. -- }
  5661. -+ offset += len + padding;
  5662. - }
  5663. -
  5664. - skb_reset_network_header(frame);
  5665. -@@ -719,24 +721,20 @@ void ieee80211_amsdu_to_8023s(struct sk_
  5666. -
  5667. - payload = frame->data;
  5668. - ethertype = (payload[6] << 8) | payload[7];
  5669. --
  5670. - if (likely((ether_addr_equal(payload, rfc1042_header) &&
  5671. - ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) ||
  5672. - ether_addr_equal(payload, bridge_tunnel_header))) {
  5673. -- /* remove RFC1042 or Bridge-Tunnel
  5674. -- * encapsulation and replace EtherType */
  5675. -- skb_pull(frame, 6);
  5676. -- memcpy(skb_push(frame, ETH_ALEN), src, ETH_ALEN);
  5677. -- memcpy(skb_push(frame, ETH_ALEN), dst, ETH_ALEN);
  5678. -- } else {
  5679. -- memcpy(skb_push(frame, sizeof(__be16)), &len,
  5680. -- sizeof(__be16));
  5681. -- memcpy(skb_push(frame, ETH_ALEN), src, ETH_ALEN);
  5682. -- memcpy(skb_push(frame, ETH_ALEN), dst, ETH_ALEN);
  5683. -+ eth.h_proto = htons(ethertype);
  5684. -+ skb_pull(frame, ETH_ALEN + 2);
  5685. - }
  5686. -+
  5687. -+ memcpy(skb_push(frame, sizeof(eth)), &eth, sizeof(eth));
  5688. - __skb_queue_tail(list, frame);
  5689. - }
  5690. -
  5691. -+ if (!reuse_skb)
  5692. -+ dev_kfree_skb(skb);
  5693. -+
  5694. - return;
  5695. -
  5696. - purge:
  5697. diff --git a/package/kernel/mac80211/patches/321-ath9k_hw-reset-AHB-WMAC-interface-on-AR91xx.patch b/package/kernel/mac80211/patches/321-ath9k_hw-reset-AHB-WMAC-interface-on-AR91xx.patch
  5698. new file mode 100644
  5699. index 0000000..9caa76d
  5700. --- /dev/null
  5701. +++ b/package/kernel/mac80211/patches/321-ath9k_hw-reset-AHB-WMAC-interface-on-AR91xx.patch
  5702. @@ -0,0 +1,25 @@
  5703. +From: Felix Fietkau <nbd@nbd.name>
  5704. +Date: Sat, 9 Jul 2016 15:25:24 +0200
  5705. +Subject: [PATCH] ath9k_hw: reset AHB-WMAC interface on AR91xx
  5706. +
  5707. +Should fix a few stability issues
  5708. +
  5709. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  5710. +---
  5711. +
  5712. +--- a/drivers/net/wireless/ath/ath9k/hw.c
  5713. ++++ b/drivers/net/wireless/ath/ath9k/hw.c
  5714. +@@ -1398,8 +1398,12 @@ static bool ath9k_hw_set_reset(struct at
  5715. + if (!AR_SREV_9100(ah))
  5716. + REG_WRITE(ah, AR_RC, 0);
  5717. +
  5718. +- if (AR_SREV_9100(ah))
  5719. ++ if (AR_SREV_9100(ah)) {
  5720. ++ /* Reset the AHB-WMAC interface */
  5721. ++ if (ah->external_reset)
  5722. ++ ah->external_reset();
  5723. + udelay(50);
  5724. ++ }
  5725. +
  5726. + return true;
  5727. + }
  5728. diff --git a/package/kernel/mac80211/patches/321-mac80211-Parse-legacy-and-HT-rate-in-injected-frames.patch b/package/kernel/mac80211/patches/321-mac80211-Parse-legacy-and-HT-rate-in-injected-frames.patch
  5729. deleted file mode 100644
  5730. index c4155a1..0000000
  5731. --- a/package/kernel/mac80211/patches/321-mac80211-Parse-legacy-and-HT-rate-in-injected-frames.patch
  5732. +++ /dev/null
  5733. @@ -1,155 +0,0 @@
  5734. -From: Sven Eckelmann <sven@narfation.org>
  5735. -Date: Tue, 26 Jan 2016 17:11:13 +0100
  5736. -Subject: [PATCH] mac80211: Parse legacy and HT rate in injected frames
  5737. -
  5738. -Drivers/devices without their own rate control algorithm can get the
  5739. -information what rates they should use from either the radiotap header of
  5740. -injected frames or from the rate control algorithm. But the parsing of the
  5741. -legacy rate information from the radiotap header was removed in commit
  5742. -e6a9854b05c1 ("mac80211/drivers: rewrite the rate control API").
  5743. -
  5744. -The removal of this feature heavily reduced the usefulness of frame
  5745. -injection when wanting to simulate specific transmission behavior. Having
  5746. -rate parsing together with MCS rates and retry support allows a fine
  5747. -grained selection of the tx behavior of injected frames for these kind of
  5748. -tests.
  5749. -
  5750. -Signed-off-by: Sven Eckelmann <sven@narfation.org>
  5751. -Cc: Simon Wunderlich <sw@simonwunderlich.de>
  5752. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  5753. ----
  5754. -
  5755. ---- a/include/net/mac80211.h
  5756. -+++ b/include/net/mac80211.h
  5757. -@@ -708,12 +708,14 @@ enum mac80211_tx_info_flags {
  5758. - * protocol frame (e.g. EAP)
  5759. - * @IEEE80211_TX_CTRL_PS_RESPONSE: This frame is a response to a poll
  5760. - * frame (PS-Poll or uAPSD).
  5761. -+ * @IEEE80211_TX_CTRL_RATE_INJECT: This frame is injected with rate information
  5762. - *
  5763. - * These flags are used in tx_info->control.flags.
  5764. - */
  5765. - enum mac80211_tx_control_flags {
  5766. - IEEE80211_TX_CTRL_PORT_CTRL_PROTO = BIT(0),
  5767. - IEEE80211_TX_CTRL_PS_RESPONSE = BIT(1),
  5768. -+ IEEE80211_TX_CTRL_RATE_INJECT = BIT(2),
  5769. - };
  5770. -
  5771. - /*
  5772. ---- a/net/mac80211/tx.c
  5773. -+++ b/net/mac80211/tx.c
  5774. -@@ -710,6 +710,10 @@ ieee80211_tx_h_rate_ctrl(struct ieee8021
  5775. -
  5776. - info->control.short_preamble = txrc.short_preamble;
  5777. -
  5778. -+ /* don't ask rate control when rate already injected via radiotap */
  5779. -+ if (info->control.flags & IEEE80211_TX_CTRL_RATE_INJECT)
  5780. -+ return TX_CONTINUE;
  5781. -+
  5782. - if (tx->sta)
  5783. - assoc = test_sta_flag(tx->sta, WLAN_STA_ASSOC);
  5784. -
  5785. -@@ -1665,15 +1669,24 @@ void ieee80211_xmit(struct ieee80211_sub
  5786. - ieee80211_tx(sdata, sta, skb, false);
  5787. - }
  5788. -
  5789. --static bool ieee80211_parse_tx_radiotap(struct sk_buff *skb)
  5790. -+static bool ieee80211_parse_tx_radiotap(struct ieee80211_local *local,
  5791. -+ struct sk_buff *skb)
  5792. - {
  5793. - struct ieee80211_radiotap_iterator iterator;
  5794. - struct ieee80211_radiotap_header *rthdr =
  5795. - (struct ieee80211_radiotap_header *) skb->data;
  5796. - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  5797. -+ struct ieee80211_supported_band *sband =
  5798. -+ local->hw.wiphy->bands[info->band];
  5799. - int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len,
  5800. - NULL);
  5801. - u16 txflags;
  5802. -+ u16 rate = 0;
  5803. -+ bool rate_found = false;
  5804. -+ u8 rate_retries = 0;
  5805. -+ u16 rate_flags = 0;
  5806. -+ u8 mcs_known, mcs_flags;
  5807. -+ int i;
  5808. -
  5809. - info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT |
  5810. - IEEE80211_TX_CTL_DONTFRAG;
  5811. -@@ -1724,6 +1737,35 @@ static bool ieee80211_parse_tx_radiotap(
  5812. - info->flags |= IEEE80211_TX_CTL_NO_ACK;
  5813. - break;
  5814. -
  5815. -+ case IEEE80211_RADIOTAP_RATE:
  5816. -+ rate = *iterator.this_arg;
  5817. -+ rate_flags = 0;
  5818. -+ rate_found = true;
  5819. -+ break;
  5820. -+
  5821. -+ case IEEE80211_RADIOTAP_DATA_RETRIES:
  5822. -+ rate_retries = *iterator.this_arg;
  5823. -+ break;
  5824. -+
  5825. -+ case IEEE80211_RADIOTAP_MCS:
  5826. -+ mcs_known = iterator.this_arg[0];
  5827. -+ mcs_flags = iterator.this_arg[1];
  5828. -+ if (!(mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_MCS))
  5829. -+ break;
  5830. -+
  5831. -+ rate_found = true;
  5832. -+ rate = iterator.this_arg[2];
  5833. -+ rate_flags = IEEE80211_TX_RC_MCS;
  5834. -+
  5835. -+ if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_GI &&
  5836. -+ mcs_flags & IEEE80211_RADIOTAP_MCS_SGI)
  5837. -+ rate_flags |= IEEE80211_TX_RC_SHORT_GI;
  5838. -+
  5839. -+ if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_BW &&
  5840. -+ mcs_flags & IEEE80211_RADIOTAP_MCS_BW_40)
  5841. -+ rate_flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
  5842. -+ break;
  5843. -+
  5844. - /*
  5845. - * Please update the file
  5846. - * Documentation/networking/mac80211-injection.txt
  5847. -@@ -1738,6 +1780,32 @@ static bool ieee80211_parse_tx_radiotap(
  5848. - if (ret != -ENOENT) /* ie, if we didn't simply run out of fields */
  5849. - return false;
  5850. -
  5851. -+ if (rate_found) {
  5852. -+ info->control.flags |= IEEE80211_TX_CTRL_RATE_INJECT;
  5853. -+
  5854. -+ for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) {
  5855. -+ info->control.rates[i].idx = -1;
  5856. -+ info->control.rates[i].flags = 0;
  5857. -+ info->control.rates[i].count = 0;
  5858. -+ }
  5859. -+
  5860. -+ if (rate_flags & IEEE80211_TX_RC_MCS) {
  5861. -+ info->control.rates[0].idx = rate;
  5862. -+ } else {
  5863. -+ for (i = 0; i < sband->n_bitrates; i++) {
  5864. -+ if (rate * 5 != sband->bitrates[i].bitrate)
  5865. -+ continue;
  5866. -+
  5867. -+ info->control.rates[0].idx = i;
  5868. -+ break;
  5869. -+ }
  5870. -+ }
  5871. -+
  5872. -+ info->control.rates[0].flags = rate_flags;
  5873. -+ info->control.rates[0].count = min_t(u8, rate_retries + 1,
  5874. -+ local->hw.max_rate_tries);
  5875. -+ }
  5876. -+
  5877. - /*
  5878. - * remove the radiotap header
  5879. - * iterator->_max_length was sanity-checked against
  5880. -@@ -1819,7 +1887,7 @@ netdev_tx_t ieee80211_monitor_start_xmit
  5881. - IEEE80211_TX_CTL_INJECTED;
  5882. -
  5883. - /* process and remove the injection radiotap header */
  5884. -- if (!ieee80211_parse_tx_radiotap(skb))
  5885. -+ if (!ieee80211_parse_tx_radiotap(local, skb))
  5886. - goto fail;
  5887. -
  5888. - rcu_read_lock();
  5889. diff --git a/package/kernel/mac80211/patches/322-ath9k_hw-issue-external-reset-for-QCA9550.patch b/package/kernel/mac80211/patches/322-ath9k_hw-issue-external-reset-for-QCA9550.patch
  5890. new file mode 100644
  5891. index 0000000..5d4e849
  5892. --- /dev/null
  5893. +++ b/package/kernel/mac80211/patches/322-ath9k_hw-issue-external-reset-for-QCA9550.patch
  5894. @@ -0,0 +1,125 @@
  5895. +From: Felix Fietkau <nbd@nbd.name>
  5896. +Date: Sat, 9 Jul 2016 15:26:44 +0200
  5897. +Subject: [PATCH] ath9k_hw: issue external reset for QCA9550
  5898. +
  5899. +The RTC interface on the SoC needs to be reset along with the rest of
  5900. +the WMAC.
  5901. +
  5902. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  5903. +---
  5904. +
  5905. +--- a/drivers/net/wireless/ath/ath9k/hw.c
  5906. ++++ b/drivers/net/wireless/ath/ath9k/hw.c
  5907. +@@ -1275,39 +1275,56 @@ void ath9k_hw_get_delta_slope_vals(struc
  5908. + *coef_exponent = coef_exp - 16;
  5909. + }
  5910. +
  5911. +-/* AR9330 WAR:
  5912. +- * call external reset function to reset WMAC if:
  5913. +- * - doing a cold reset
  5914. +- * - we have pending frames in the TX queues.
  5915. +- */
  5916. +-static bool ath9k_hw_ar9330_reset_war(struct ath_hw *ah, int type)
  5917. ++static bool ath9k_hw_need_external_reset(struct ath_hw *ah, int type)
  5918. + {
  5919. +- int i, npend = 0;
  5920. ++ int i;
  5921. +
  5922. +- for (i = 0; i < AR_NUM_QCU; i++) {
  5923. +- npend = ath9k_hw_numtxpending(ah, i);
  5924. +- if (npend)
  5925. +- break;
  5926. ++ if (type == ATH9K_RESET_COLD)
  5927. ++ return true;
  5928. ++
  5929. ++ if (AR_SREV_9550(ah))
  5930. ++ return true;
  5931. ++
  5932. ++ /* AR9330 WAR:
  5933. ++ * call external reset function to reset WMAC if:
  5934. ++ * - doing a cold reset
  5935. ++ * - we have pending frames in the TX queues.
  5936. ++ */
  5937. ++ if (AR_SREV_9330(ah)) {
  5938. ++ for (i = 0; i < AR_NUM_QCU; i++) {
  5939. ++ if (ath9k_hw_numtxpending(ah, i))
  5940. ++ return true;
  5941. ++ }
  5942. + }
  5943. +
  5944. +- if (ah->external_reset &&
  5945. +- (npend || type == ATH9K_RESET_COLD)) {
  5946. +- int reset_err = 0;
  5947. ++ return false;
  5948. ++}
  5949. +
  5950. +- ath_dbg(ath9k_hw_common(ah), RESET,
  5951. +- "reset MAC via external reset\n");
  5952. ++static bool ath9k_hw_external_reset(struct ath_hw *ah, int type)
  5953. ++{
  5954. ++ int err;
  5955. +
  5956. +- reset_err = ah->external_reset();
  5957. +- if (reset_err) {
  5958. +- ath_err(ath9k_hw_common(ah),
  5959. +- "External reset failed, err=%d\n",
  5960. +- reset_err);
  5961. +- return false;
  5962. +- }
  5963. ++ if (!ah->external_reset || !ath9k_hw_need_external_reset(ah, type))
  5964. ++ return true;
  5965. +
  5966. +- REG_WRITE(ah, AR_RTC_RESET, 1);
  5967. ++ ath_dbg(ath9k_hw_common(ah), RESET,
  5968. ++ "reset MAC via external reset\n");
  5969. ++
  5970. ++ err = ah->external_reset();
  5971. ++ if (err) {
  5972. ++ ath_err(ath9k_hw_common(ah),
  5973. ++ "External reset failed, err=%d\n", err);
  5974. ++ return false;
  5975. ++ }
  5976. ++
  5977. ++ if (AR_SREV_9550(ah)) {
  5978. ++ REG_WRITE(ah, AR_RTC_RESET, 0);
  5979. ++ udelay(10);
  5980. + }
  5981. +
  5982. ++ REG_WRITE(ah, AR_RTC_RESET, 1);
  5983. ++ udelay(10);
  5984. ++
  5985. + return true;
  5986. + }
  5987. +
  5988. +@@ -1360,24 +1377,23 @@ static bool ath9k_hw_set_reset(struct at
  5989. + rst_flags |= AR_RTC_RC_MAC_COLD;
  5990. + }
  5991. +
  5992. +- if (AR_SREV_9330(ah)) {
  5993. +- if (!ath9k_hw_ar9330_reset_war(ah, type))
  5994. +- return false;
  5995. +- }
  5996. +-
  5997. + if (ath9k_hw_mci_is_enabled(ah))
  5998. + ar9003_mci_check_gpm_offset(ah);
  5999. +
  6000. + /* DMA HALT added to resolve ar9300 and ar9580 bus error during
  6001. +- * RTC_RC reg read
  6002. ++ * RTC_RC reg read. Also needed for AR9550 external reset
  6003. + */
  6004. +- if (AR_SREV_9300(ah) || AR_SREV_9580(ah)) {
  6005. ++ if (AR_SREV_9300(ah) || AR_SREV_9580(ah) || AR_SREV_9550(ah)) {
  6006. + REG_SET_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  6007. + ath9k_hw_wait(ah, AR_CFG, AR_CFG_HALT_ACK, AR_CFG_HALT_ACK,
  6008. + 20 * AH_WAIT_TIMEOUT);
  6009. +- REG_CLR_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  6010. + }
  6011. +
  6012. ++ ath9k_hw_external_reset(ah, type);
  6013. ++
  6014. ++ if (AR_SREV_9300(ah) || AR_SREV_9580(ah))
  6015. ++ REG_CLR_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  6016. ++
  6017. + REG_WRITE(ah, AR_RTC_RC, rst_flags);
  6018. +
  6019. + REGWRITE_BUFFER_FLUSH(ah);
  6020. diff --git a/package/kernel/mac80211/patches/322-mac80211-add-A-MSDU-tx-support.patch b/package/kernel/mac80211/patches/322-mac80211-add-A-MSDU-tx-support.patch
  6021. deleted file mode 100644
  6022. index e7bfb9c..0000000
  6023. --- a/package/kernel/mac80211/patches/322-mac80211-add-A-MSDU-tx-support.patch
  6024. +++ /dev/null
  6025. @@ -1,317 +0,0 @@
  6026. -From: Felix Fietkau <nbd@openwrt.org>
  6027. -Date: Fri, 5 Feb 2016 01:38:51 +0100
  6028. -Subject: [PATCH] mac80211: add A-MSDU tx support
  6029. -
  6030. -Requires software tx queueing support. frag_list support (for zero-copy)
  6031. -is optional.
  6032. -
  6033. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  6034. ----
  6035. -
  6036. ---- a/include/net/mac80211.h
  6037. -+++ b/include/net/mac80211.h
  6038. -@@ -709,6 +709,7 @@ enum mac80211_tx_info_flags {
  6039. - * @IEEE80211_TX_CTRL_PS_RESPONSE: This frame is a response to a poll
  6040. - * frame (PS-Poll or uAPSD).
  6041. - * @IEEE80211_TX_CTRL_RATE_INJECT: This frame is injected with rate information
  6042. -+ * @IEEE80211_TX_CTRL_AMSDU: This frame is an A-MSDU frame
  6043. - *
  6044. - * These flags are used in tx_info->control.flags.
  6045. - */
  6046. -@@ -716,6 +717,7 @@ enum mac80211_tx_control_flags {
  6047. - IEEE80211_TX_CTRL_PORT_CTRL_PROTO = BIT(0),
  6048. - IEEE80211_TX_CTRL_PS_RESPONSE = BIT(1),
  6049. - IEEE80211_TX_CTRL_RATE_INJECT = BIT(2),
  6050. -+ IEEE80211_TX_CTRL_AMSDU = BIT(3),
  6051. - };
  6052. -
  6053. - /*
  6054. -@@ -1728,6 +1730,7 @@ struct ieee80211_sta_rates {
  6055. - * size is min(max_amsdu_len, 7935) bytes.
  6056. - * Both additional HT limits must be enforced by the low level driver.
  6057. - * This is defined by the spec (IEEE 802.11-2012 section 8.3.2.2 NOTE 2).
  6058. -+ * @max_rc_amsdu_len: Maximum A-MSDU size in bytes recommended by rate control.
  6059. - * @txq: per-TID data TX queues (if driver uses the TXQ abstraction)
  6060. - */
  6061. - struct ieee80211_sta {
  6062. -@@ -1748,6 +1751,7 @@ struct ieee80211_sta {
  6063. - bool mfp;
  6064. - u8 max_amsdu_subframes;
  6065. - u16 max_amsdu_len;
  6066. -+ u16 max_rc_amsdu_len;
  6067. -
  6068. - struct ieee80211_txq *txq[IEEE80211_NUM_TIDS];
  6069. -
  6070. -@@ -1961,6 +1965,15 @@ struct ieee80211_txq {
  6071. - * order and does not need to manage its own reorder buffer or BA session
  6072. - * timeout.
  6073. - *
  6074. -+ * @IEEE80211_HW_TX_AMSDU: Hardware (or driver) supports software aggregated
  6075. -+ * A-MSDU frames. Requires software tx queueing and fast-xmit support.
  6076. -+ * When not using minstrel/minstrel_ht rate control, the driver should
  6077. -+ * limit the maximum A-MSDU size based on the current tx rate by setting
  6078. -+ * max_rc_amsdu_len in struct ieee80211_sta.
  6079. -+ *
  6080. -+ * @IEEE80211_HW_TX_FRAG_LIST: Hardware (or driver) supports sending frag_list
  6081. -+ * skbs, needed for zero-copy software A-MSDU.
  6082. -+ *
  6083. - * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
  6084. - */
  6085. - enum ieee80211_hw_flags {
  6086. -@@ -1998,6 +2011,8 @@ enum ieee80211_hw_flags {
  6087. - IEEE80211_HW_BEACON_TX_STATUS,
  6088. - IEEE80211_HW_NEEDS_UNIQUE_STA_ADDR,
  6089. - IEEE80211_HW_SUPPORTS_REORDERING_BUFFER,
  6090. -+ IEEE80211_HW_TX_AMSDU,
  6091. -+ IEEE80211_HW_TX_FRAG_LIST,
  6092. -
  6093. - /* keep last, obviously */
  6094. - NUM_IEEE80211_HW_FLAGS
  6095. -@@ -2070,6 +2085,9 @@ enum ieee80211_hw_flags {
  6096. - * size is smaller (an example is LinkSys WRT120N with FW v1.0.07
  6097. - * build 002 Jun 18 2012).
  6098. - *
  6099. -+ * @max_tx_fragments: maximum number of tx buffers per (A)-MSDU, sum
  6100. -+ * of 1 + skb_shinfo(skb)->nr_frags for each skb in the frag_list.
  6101. -+ *
  6102. - * @offchannel_tx_hw_queue: HW queue ID to use for offchannel TX
  6103. - * (if %IEEE80211_HW_QUEUE_CONTROL is set)
  6104. - *
  6105. -@@ -2124,6 +2142,7 @@ struct ieee80211_hw {
  6106. - u8 max_rate_tries;
  6107. - u8 max_rx_aggregation_subframes;
  6108. - u8 max_tx_aggregation_subframes;
  6109. -+ u8 max_tx_fragments;
  6110. - u8 offchannel_tx_hw_queue;
  6111. - u8 radiotap_mcs_details;
  6112. - u16 radiotap_vht_details;
  6113. ---- a/net/mac80211/agg-tx.c
  6114. -+++ b/net/mac80211/agg-tx.c
  6115. -@@ -935,6 +935,7 @@ void ieee80211_process_addba_resp(struct
  6116. - size_t len)
  6117. - {
  6118. - struct tid_ampdu_tx *tid_tx;
  6119. -+ struct ieee80211_txq *txq;
  6120. - u16 capab, tid;
  6121. - u8 buf_size;
  6122. - bool amsdu;
  6123. -@@ -945,6 +946,10 @@ void ieee80211_process_addba_resp(struct
  6124. - buf_size = (capab & IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK) >> 6;
  6125. - buf_size = min(buf_size, local->hw.max_tx_aggregation_subframes);
  6126. -
  6127. -+ txq = sta->sta.txq[tid];
  6128. -+ if (!amsdu && txq)
  6129. -+ set_bit(IEEE80211_TXQ_NO_AMSDU, &to_txq_info(txq)->flags);
  6130. -+
  6131. - mutex_lock(&sta->ampdu_mlme.mtx);
  6132. -
  6133. - tid_tx = rcu_dereference_protected_tid_tx(sta, tid);
  6134. ---- a/net/mac80211/debugfs.c
  6135. -+++ b/net/mac80211/debugfs.c
  6136. -@@ -127,6 +127,8 @@ static const char *hw_flag_names[NUM_IEE
  6137. - FLAG(BEACON_TX_STATUS),
  6138. - FLAG(NEEDS_UNIQUE_STA_ADDR),
  6139. - FLAG(SUPPORTS_REORDERING_BUFFER),
  6140. -+ FLAG(TX_AMSDU),
  6141. -+ FLAG(TX_FRAG_LIST),
  6142. -
  6143. - /* keep last for the build bug below */
  6144. - (void *)0x1
  6145. ---- a/net/mac80211/ieee80211_i.h
  6146. -+++ b/net/mac80211/ieee80211_i.h
  6147. -@@ -799,6 +799,7 @@ struct mac80211_qos_map {
  6148. - enum txq_info_flags {
  6149. - IEEE80211_TXQ_STOP,
  6150. - IEEE80211_TXQ_AMPDU,
  6151. -+ IEEE80211_TXQ_NO_AMSDU,
  6152. - };
  6153. -
  6154. - struct txq_info {
  6155. ---- a/net/mac80211/tx.c
  6156. -+++ b/net/mac80211/tx.c
  6157. -@@ -1318,6 +1318,10 @@ struct sk_buff *ieee80211_tx_dequeue(str
  6158. - out:
  6159. - spin_unlock_bh(&txqi->queue.lock);
  6160. -
  6161. -+ if (skb && skb_has_frag_list(skb) &&
  6162. -+ !ieee80211_hw_check(&local->hw, TX_FRAG_LIST))
  6163. -+ skb_linearize(skb);
  6164. -+
  6165. - return skb;
  6166. - }
  6167. - EXPORT_SYMBOL(ieee80211_tx_dequeue);
  6168. -@@ -2757,6 +2761,163 @@ void ieee80211_clear_fast_xmit(struct st
  6169. - kfree_rcu(fast_tx, rcu_head);
  6170. - }
  6171. -
  6172. -+static bool ieee80211_amsdu_realloc_pad(struct ieee80211_local *local,
  6173. -+ struct sk_buff *skb, int headroom,
  6174. -+ int *subframe_len)
  6175. -+{
  6176. -+ int amsdu_len = *subframe_len + sizeof(struct ethhdr);
  6177. -+ int padding = (4 - amsdu_len) & 3;
  6178. -+
  6179. -+ if (skb_headroom(skb) < headroom || skb_tailroom(skb) < padding) {
  6180. -+ I802_DEBUG_INC(local->tx_expand_skb_head);
  6181. -+
  6182. -+ if (pskb_expand_head(skb, headroom, padding, GFP_ATOMIC)) {
  6183. -+ wiphy_debug(local->hw.wiphy,
  6184. -+ "failed to reallocate TX buffer\n");
  6185. -+ return false;
  6186. -+ }
  6187. -+ }
  6188. -+
  6189. -+ if (padding) {
  6190. -+ *subframe_len += padding;
  6191. -+ memset(skb_put(skb, padding), 0, padding);
  6192. -+ }
  6193. -+
  6194. -+ return true;
  6195. -+}
  6196. -+
  6197. -+static bool ieee80211_amsdu_prepare_head(struct ieee80211_sub_if_data *sdata,
  6198. -+ struct ieee80211_fast_tx *fast_tx,
  6199. -+ struct sk_buff *skb)
  6200. -+{
  6201. -+ struct ieee80211_local *local = sdata->local;
  6202. -+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  6203. -+ struct ieee80211_hdr *hdr;
  6204. -+ struct ethhdr amsdu_hdr;
  6205. -+ int hdr_len = fast_tx->hdr_len - sizeof(rfc1042_header);
  6206. -+ int subframe_len = skb->len - hdr_len;
  6207. -+ void *data;
  6208. -+ u8 *qc;
  6209. -+
  6210. -+ if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE)
  6211. -+ return false;
  6212. -+
  6213. -+ if (info->control.flags & IEEE80211_TX_CTRL_AMSDU)
  6214. -+ return true;
  6215. -+
  6216. -+ if (!ieee80211_amsdu_realloc_pad(local, skb, sizeof(amsdu_hdr),
  6217. -+ &subframe_len))
  6218. -+ return false;
  6219. -+
  6220. -+ amsdu_hdr.h_proto = cpu_to_be16(subframe_len);
  6221. -+ memcpy(amsdu_hdr.h_source, skb->data + fast_tx->sa_offs, ETH_ALEN);
  6222. -+ memcpy(amsdu_hdr.h_dest, skb->data + fast_tx->da_offs, ETH_ALEN);
  6223. -+
  6224. -+ data = skb_push(skb, sizeof(amsdu_hdr));
  6225. -+ memmove(data, data + sizeof(amsdu_hdr), hdr_len);
  6226. -+ memcpy(data + hdr_len, &amsdu_hdr, sizeof(amsdu_hdr));
  6227. -+
  6228. -+ hdr = data;
  6229. -+ qc = ieee80211_get_qos_ctl(hdr);
  6230. -+ *qc |= IEEE80211_QOS_CTL_A_MSDU_PRESENT;
  6231. -+
  6232. -+ info->control.flags |= IEEE80211_TX_CTRL_AMSDU;
  6233. -+
  6234. -+ return true;
  6235. -+}
  6236. -+
  6237. -+static bool ieee80211_amsdu_aggregate(struct ieee80211_sub_if_data *sdata,
  6238. -+ struct sta_info *sta,
  6239. -+ struct ieee80211_fast_tx *fast_tx,
  6240. -+ struct sk_buff *skb)
  6241. -+{
  6242. -+ struct ieee80211_local *local = sdata->local;
  6243. -+ u8 tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK;
  6244. -+ struct ieee80211_txq *txq = sta->sta.txq[tid];
  6245. -+ struct txq_info *txqi;
  6246. -+ struct sk_buff **frag_tail, *head;
  6247. -+ int subframe_len = skb->len - ETH_ALEN;
  6248. -+ u8 max_subframes = sta->sta.max_amsdu_subframes;
  6249. -+ int max_frags = local->hw.max_tx_fragments;
  6250. -+ int max_amsdu_len = sta->sta.max_amsdu_len;
  6251. -+ __be16 len;
  6252. -+ void *data;
  6253. -+ bool ret = false;
  6254. -+ int n = 1, nfrags;
  6255. -+
  6256. -+ if (!ieee80211_hw_check(&local->hw, TX_AMSDU))
  6257. -+ return false;
  6258. -+
  6259. -+ if (!txq)
  6260. -+ return false;
  6261. -+
  6262. -+ txqi = to_txq_info(txq);
  6263. -+ if (test_bit(IEEE80211_TXQ_NO_AMSDU, &txqi->flags))
  6264. -+ return false;
  6265. -+
  6266. -+ if (sta->sta.max_rc_amsdu_len)
  6267. -+ max_amsdu_len = min_t(int, max_amsdu_len,
  6268. -+ sta->sta.max_rc_amsdu_len);
  6269. -+
  6270. -+ spin_lock_bh(&txqi->queue.lock);
  6271. -+
  6272. -+ head = skb_peek_tail(&txqi->queue);
  6273. -+ if (!head)
  6274. -+ goto out;
  6275. -+
  6276. -+ if (skb->len + head->len > max_amsdu_len)
  6277. -+ goto out;
  6278. -+
  6279. -+ /*
  6280. -+ * HT A-MPDU limits maximum MPDU size to 4095 bytes. Since aggregation
  6281. -+ * sessions are started/stopped without txq flush, use the limit here
  6282. -+ * to avoid having to de-aggregate later.
  6283. -+ */
  6284. -+ if (skb->len + head->len > 4095 &&
  6285. -+ !sta->sta.vht_cap.vht_supported)
  6286. -+ goto out;
  6287. -+
  6288. -+ if (!ieee80211_amsdu_prepare_head(sdata, fast_tx, head))
  6289. -+ goto out;
  6290. -+
  6291. -+ nfrags = 1 + skb_shinfo(skb)->nr_frags;
  6292. -+ nfrags += 1 + skb_shinfo(head)->nr_frags;
  6293. -+ frag_tail = &skb_shinfo(head)->frag_list;
  6294. -+ while (*frag_tail) {
  6295. -+ nfrags += 1 + skb_shinfo(*frag_tail)->nr_frags;
  6296. -+ frag_tail = &(*frag_tail)->next;
  6297. -+ n++;
  6298. -+ }
  6299. -+
  6300. -+ if (max_subframes && n > max_subframes)
  6301. -+ goto out;
  6302. -+
  6303. -+ if (max_frags && nfrags > max_frags)
  6304. -+ goto out;
  6305. -+
  6306. -+ if (!ieee80211_amsdu_realloc_pad(local, skb, sizeof(rfc1042_header) + 2,
  6307. -+ &subframe_len))
  6308. -+ return false;
  6309. -+
  6310. -+ ret = true;
  6311. -+ data = skb_push(skb, ETH_ALEN + 2);
  6312. -+ memmove(data, data + ETH_ALEN + 2, 2 * ETH_ALEN);
  6313. -+
  6314. -+ data += 2 * ETH_ALEN;
  6315. -+ len = cpu_to_be16(subframe_len);
  6316. -+ memcpy(data, &len, 2);
  6317. -+ memcpy(data + 2, rfc1042_header, sizeof(rfc1042_header));
  6318. -+
  6319. -+ head->len += skb->len;
  6320. -+ head->data_len += skb->len;
  6321. -+ *frag_tail = skb;
  6322. -+
  6323. -+out:
  6324. -+ spin_unlock_bh(&txqi->queue.lock);
  6325. -+
  6326. -+ return ret;
  6327. -+}
  6328. -+
  6329. - static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata,
  6330. - struct net_device *dev, struct sta_info *sta,
  6331. - struct ieee80211_fast_tx *fast_tx,
  6332. -@@ -2811,6 +2972,10 @@ static bool ieee80211_xmit_fast(struct i
  6333. -
  6334. - ieee80211_tx_stats(dev, skb->len + extra_head);
  6335. -
  6336. -+ if ((hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) &&
  6337. -+ ieee80211_amsdu_aggregate(sdata, sta, fast_tx, skb))
  6338. -+ return true;
  6339. -+
  6340. - /* will not be crypto-handled beyond what we do here, so use false
  6341. - * as the may-encrypt argument for the resize to not account for
  6342. - * more room than we already have in 'extra_head'
  6343. diff --git a/package/kernel/mac80211/patches/323-0000-brcmfmac-fix-setting-primary-channel-for-80-MHz-widt.patch b/package/kernel/mac80211/patches/323-0000-brcmfmac-fix-setting-primary-channel-for-80-MHz-widt.patch
  6344. deleted file mode 100644
  6345. index 9277b2c..0000000
  6346. --- a/package/kernel/mac80211/patches/323-0000-brcmfmac-fix-setting-primary-channel-for-80-MHz-widt.patch
  6347. +++ /dev/null
  6348. @@ -1,64 +0,0 @@
  6349. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  6350. -Date: Wed, 20 Jan 2016 16:46:04 +0100
  6351. -Subject: [PATCH] brcmfmac: fix setting primary channel for 80 MHz width
  6352. -MIME-Version: 1.0
  6353. -Content-Type: text/plain; charset=UTF-8
  6354. -Content-Transfer-Encoding: 8bit
  6355. -
  6356. -First of all it changes the way we calculate primary channel offset. If
  6357. -we use e.g. 80 MHz channel with primary frequency 5180 MHz (which means
  6358. -center frequency is 5210 MHz) it makes sense to calculate primary offset
  6359. -as -30 MHz.
  6360. -Then it fixes values we compare primary_offset with. We were comparing
  6361. -offset in MHz against -2 or 2 which was resulting in picking a wrong
  6362. -primary channel.
  6363. -
  6364. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  6365. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6366. ----
  6367. -
  6368. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  6369. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  6370. -@@ -247,7 +247,7 @@ static u16 chandef_to_chanspec(struct br
  6371. - brcmf_dbg(TRACE, "chandef: control %d center %d width %d\n",
  6372. - ch->chan->center_freq, ch->center_freq1, ch->width);
  6373. - ch_inf.chnum = ieee80211_frequency_to_channel(ch->center_freq1);
  6374. -- primary_offset = ch->center_freq1 - ch->chan->center_freq;
  6375. -+ primary_offset = ch->chan->center_freq - ch->center_freq1;
  6376. - switch (ch->width) {
  6377. - case NL80211_CHAN_WIDTH_20:
  6378. - case NL80211_CHAN_WIDTH_20_NOHT:
  6379. -@@ -256,24 +256,21 @@ static u16 chandef_to_chanspec(struct br
  6380. - break;
  6381. - case NL80211_CHAN_WIDTH_40:
  6382. - ch_inf.bw = BRCMU_CHAN_BW_40;
  6383. -- if (primary_offset < 0)
  6384. -+ if (primary_offset > 0)
  6385. - ch_inf.sb = BRCMU_CHAN_SB_U;
  6386. - else
  6387. - ch_inf.sb = BRCMU_CHAN_SB_L;
  6388. - break;
  6389. - case NL80211_CHAN_WIDTH_80:
  6390. - ch_inf.bw = BRCMU_CHAN_BW_80;
  6391. -- if (primary_offset < 0) {
  6392. -- if (primary_offset < -CH_10MHZ_APART)
  6393. -- ch_inf.sb = BRCMU_CHAN_SB_UU;
  6394. -- else
  6395. -- ch_inf.sb = BRCMU_CHAN_SB_UL;
  6396. -- } else {
  6397. -- if (primary_offset > CH_10MHZ_APART)
  6398. -- ch_inf.sb = BRCMU_CHAN_SB_LL;
  6399. -- else
  6400. -- ch_inf.sb = BRCMU_CHAN_SB_LU;
  6401. -- }
  6402. -+ if (primary_offset == -30)
  6403. -+ ch_inf.sb = BRCMU_CHAN_SB_LL;
  6404. -+ else if (primary_offset == -10)
  6405. -+ ch_inf.sb = BRCMU_CHAN_SB_LU;
  6406. -+ else if (primary_offset == 10)
  6407. -+ ch_inf.sb = BRCMU_CHAN_SB_UL;
  6408. -+ else
  6409. -+ ch_inf.sb = BRCMU_CHAN_SB_UU;
  6410. - break;
  6411. - case NL80211_CHAN_WIDTH_80P80:
  6412. - case NL80211_CHAN_WIDTH_160:
  6413. diff --git a/package/kernel/mac80211/patches/323-0001-brcmfmac-analyze-descriptors-of-current-component-on.patch b/package/kernel/mac80211/patches/323-0001-brcmfmac-analyze-descriptors-of-current-component-on.patch
  6414. deleted file mode 100644
  6415. index d7018da..0000000
  6416. --- a/package/kernel/mac80211/patches/323-0001-brcmfmac-analyze-descriptors-of-current-component-on.patch
  6417. +++ /dev/null
  6418. @@ -1,51 +0,0 @@
  6419. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  6420. -Date: Tue, 26 Jan 2016 17:57:01 +0100
  6421. -Subject: [PATCH] brcmfmac: analyze descriptors of current component only
  6422. -MIME-Version: 1.0
  6423. -Content-Type: text/plain; charset=UTF-8
  6424. -Content-Transfer-Encoding: 8bit
  6425. -
  6426. -So far we were looking for address descriptors without a check for
  6427. -crossing current component border. In case of dealing with unsupported
  6428. -descriptor or descriptor missing at all the code would incorrectly get
  6429. -data from another component.
  6430. -
  6431. -Consider this binary-described component from BCM4366 EROM:
  6432. -4bf83b01 TAG==CI CID==0x83b
  6433. -20080201 TAG==CI PORTS==0+1 WRAPPERS==0+1
  6434. -18400035 TAG==ADDR SZ_SZD TYPE_SLAVE
  6435. -00050000
  6436. -18107085 TAG==ADDR SZ_4K TYPE_SWRAP
  6437. -
  6438. -Driver was assigning invalid base address to this core:
  6439. -brcmfmac: [6 ] core 0x83b:32 base 0x18109000 wrap 0x18107000
  6440. -which came from totally different component defined in EROM:
  6441. -43b36701 TAG==CI CID==0x367
  6442. -00000201 TAG==CI PORTS==0+1 WRAPPERS==0+0
  6443. -18109005 TAG==ADDR SZ_4K TYPE_SLAVE
  6444. -
  6445. -This change will also allow us to support components without wrapper
  6446. -address in the future.
  6447. -
  6448. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  6449. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6450. ----
  6451. -
  6452. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  6453. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  6454. -@@ -803,7 +803,14 @@ static int brcmf_chip_dmp_get_regaddr(st
  6455. - *eromaddr -= 4;
  6456. - return -EFAULT;
  6457. - }
  6458. -- } while (desc != DMP_DESC_ADDRESS);
  6459. -+ } while (desc != DMP_DESC_ADDRESS &&
  6460. -+ desc != DMP_DESC_COMPONENT);
  6461. -+
  6462. -+ /* stop if we crossed current component border */
  6463. -+ if (desc == DMP_DESC_COMPONENT) {
  6464. -+ *eromaddr -= 4;
  6465. -+ return 0;
  6466. -+ }
  6467. -
  6468. - /* skip upper 32-bit address descriptor */
  6469. - if (val & DMP_DESC_ADDRSIZE_GT32)
  6470. diff --git a/package/kernel/mac80211/patches/323-0002-brcmfmac-allow-storing-PMU-core-without-wrapper-addr.patch b/package/kernel/mac80211/patches/323-0002-brcmfmac-allow-storing-PMU-core-without-wrapper-addr.patch
  6471. deleted file mode 100644
  6472. index 045ab49..0000000
  6473. --- a/package/kernel/mac80211/patches/323-0002-brcmfmac-allow-storing-PMU-core-without-wrapper-addr.patch
  6474. +++ /dev/null
  6475. @@ -1,28 +0,0 @@
  6476. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  6477. -Date: Tue, 26 Jan 2016 17:57:02 +0100
  6478. -Subject: [PATCH] brcmfmac: allow storing PMU core without wrapper address
  6479. -MIME-Version: 1.0
  6480. -Content-Type: text/plain; charset=UTF-8
  6481. -Content-Transfer-Encoding: 8bit
  6482. -
  6483. -Separated PMU core can be found in new devices and should be used for
  6484. -accessing PMU registers (which were routed through ChipCommon so far).
  6485. -This core is one of exceptions that doesn't have or need wrapper address
  6486. -to be still safely accessible.
  6487. -
  6488. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  6489. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6490. ----
  6491. -
  6492. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  6493. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  6494. -@@ -883,7 +883,8 @@ int brcmf_chip_dmp_erom_scan(struct brcm
  6495. - rev = (val & DMP_COMP_REVISION) >> DMP_COMP_REVISION_S;
  6496. -
  6497. - /* need core with ports */
  6498. -- if (nmw + nsw == 0)
  6499. -+ if (nmw + nsw == 0 &&
  6500. -+ id != BCMA_CORE_PMU)
  6501. - continue;
  6502. -
  6503. - /* try to obtain register address info */
  6504. diff --git a/package/kernel/mac80211/patches/323-0003-brcmfmac-read-extended-capabilities-of-ChipCommon-co.patch b/package/kernel/mac80211/patches/323-0003-brcmfmac-read-extended-capabilities-of-ChipCommon-co.patch
  6505. deleted file mode 100644
  6506. index 7b7ba4f..0000000
  6507. --- a/package/kernel/mac80211/patches/323-0003-brcmfmac-read-extended-capabilities-of-ChipCommon-co.patch
  6508. +++ /dev/null
  6509. @@ -1,43 +0,0 @@
  6510. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  6511. -Date: Tue, 26 Jan 2016 17:57:03 +0100
  6512. -Subject: [PATCH] brcmfmac: read extended capabilities of ChipCommon core
  6513. -MIME-Version: 1.0
  6514. -Content-Type: text/plain; charset=UTF-8
  6515. -Content-Transfer-Encoding: 8bit
  6516. -
  6517. -This is an extra bitfield with info about some present hardware.
  6518. -
  6519. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  6520. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6521. ----
  6522. -
  6523. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  6524. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  6525. -@@ -1025,6 +1025,9 @@ static int brcmf_chip_setup(struct brcmf
  6526. - /* get chipcommon capabilites */
  6527. - pub->cc_caps = chip->ops->read32(chip->ctx,
  6528. - CORE_CC_REG(base, capabilities));
  6529. -+ pub->cc_caps_ext = chip->ops->read32(chip->ctx,
  6530. -+ CORE_CC_REG(base,
  6531. -+ capabilities_ext));
  6532. -
  6533. - /* get pmu caps & rev */
  6534. - if (pub->cc_caps & CC_CAP_PMU) {
  6535. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
  6536. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
  6537. -@@ -27,6 +27,7 @@
  6538. - * @chip: chip identifier.
  6539. - * @chiprev: chip revision.
  6540. - * @cc_caps: chipcommon core capabilities.
  6541. -+ * @cc_caps_ext: chipcommon core extended capabilities.
  6542. - * @pmucaps: PMU capabilities.
  6543. - * @pmurev: PMU revision.
  6544. - * @rambase: RAM base address (only applicable for ARM CR4 chips).
  6545. -@@ -38,6 +39,7 @@ struct brcmf_chip {
  6546. - u32 chip;
  6547. - u32 chiprev;
  6548. - u32 cc_caps;
  6549. -+ u32 cc_caps_ext;
  6550. - u32 pmucaps;
  6551. - u32 pmurev;
  6552. - u32 rambase;
  6553. diff --git a/package/kernel/mac80211/patches/323-0004-brcmfmac-access-PMU-registers-using-standalone-PMU-c.patch b/package/kernel/mac80211/patches/323-0004-brcmfmac-access-PMU-registers-using-standalone-PMU-c.patch
  6554. deleted file mode 100644
  6555. index 2af6fd9..0000000
  6556. --- a/package/kernel/mac80211/patches/323-0004-brcmfmac-access-PMU-registers-using-standalone-PMU-c.patch
  6557. +++ /dev/null
  6558. @@ -1,148 +0,0 @@
  6559. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  6560. -Date: Tue, 26 Jan 2016 17:57:04 +0100
  6561. -Subject: [PATCH] brcmfmac: access PMU registers using standalone PMU core if
  6562. - available
  6563. -MIME-Version: 1.0
  6564. -Content-Type: text/plain; charset=UTF-8
  6565. -Content-Transfer-Encoding: 8bit
  6566. -
  6567. -On recent Broadcom chipsets PMU is present as separated core and it
  6568. -can't be accessed using ChipCommon anymore as it fails with e.g.:
  6569. -[ 18.198412] Unhandled fault: imprecise external abort (0x1406) at 0xb6da200f
  6570. -
  6571. -Add a new helper function that will return a proper core that should be
  6572. -used for accessing PMU registers.
  6573. -
  6574. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  6575. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6576. ----
  6577. -
  6578. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  6579. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  6580. -@@ -1014,6 +1014,7 @@ static int brcmf_chip_setup(struct brcmf
  6581. - {
  6582. - struct brcmf_chip *pub;
  6583. - struct brcmf_core_priv *cc;
  6584. -+ struct brcmf_core *pmu;
  6585. - u32 base;
  6586. - u32 val;
  6587. - int ret = 0;
  6588. -@@ -1030,9 +1031,10 @@ static int brcmf_chip_setup(struct brcmf
  6589. - capabilities_ext));
  6590. -
  6591. - /* get pmu caps & rev */
  6592. -+ pmu = brcmf_chip_get_pmu(pub); /* after reading cc_caps_ext */
  6593. - if (pub->cc_caps & CC_CAP_PMU) {
  6594. - val = chip->ops->read32(chip->ctx,
  6595. -- CORE_CC_REG(base, pmucapabilities));
  6596. -+ CORE_CC_REG(pmu->base, pmucapabilities));
  6597. - pub->pmurev = val & PCAP_REV_MASK;
  6598. - pub->pmucaps = val;
  6599. - }
  6600. -@@ -1131,6 +1133,23 @@ struct brcmf_core *brcmf_chip_get_chipco
  6601. - return &cc->pub;
  6602. - }
  6603. -
  6604. -+struct brcmf_core *brcmf_chip_get_pmu(struct brcmf_chip *pub)
  6605. -+{
  6606. -+ struct brcmf_core *cc = brcmf_chip_get_chipcommon(pub);
  6607. -+ struct brcmf_core *pmu;
  6608. -+
  6609. -+ /* See if there is separated PMU core available */
  6610. -+ if (cc->rev >= 35 &&
  6611. -+ pub->cc_caps_ext & BCMA_CC_CAP_EXT_AOB_PRESENT) {
  6612. -+ pmu = brcmf_chip_get_core(pub, BCMA_CORE_PMU);
  6613. -+ if (pmu)
  6614. -+ return pmu;
  6615. -+ }
  6616. -+
  6617. -+ /* Fallback to ChipCommon core for older hardware */
  6618. -+ return cc;
  6619. -+}
  6620. -+
  6621. - bool brcmf_chip_iscoreup(struct brcmf_core *pub)
  6622. - {
  6623. - struct brcmf_core_priv *core;
  6624. -@@ -1301,6 +1320,7 @@ bool brcmf_chip_sr_capable(struct brcmf_
  6625. - {
  6626. - u32 base, addr, reg, pmu_cc3_mask = ~0;
  6627. - struct brcmf_chip_priv *chip;
  6628. -+ struct brcmf_core *pmu = brcmf_chip_get_pmu(pub);
  6629. -
  6630. - brcmf_dbg(TRACE, "Enter\n");
  6631. -
  6632. -@@ -1320,9 +1340,9 @@ bool brcmf_chip_sr_capable(struct brcmf_
  6633. - case BRCM_CC_4335_CHIP_ID:
  6634. - case BRCM_CC_4339_CHIP_ID:
  6635. - /* read PMU chipcontrol register 3 */
  6636. -- addr = CORE_CC_REG(base, chipcontrol_addr);
  6637. -+ addr = CORE_CC_REG(pmu->base, chipcontrol_addr);
  6638. - chip->ops->write32(chip->ctx, addr, 3);
  6639. -- addr = CORE_CC_REG(base, chipcontrol_data);
  6640. -+ addr = CORE_CC_REG(pmu->base, chipcontrol_data);
  6641. - reg = chip->ops->read32(chip->ctx, addr);
  6642. - return (reg & pmu_cc3_mask) != 0;
  6643. - case BRCM_CC_43430_CHIP_ID:
  6644. -@@ -1330,12 +1350,12 @@ bool brcmf_chip_sr_capable(struct brcmf_
  6645. - reg = chip->ops->read32(chip->ctx, addr);
  6646. - return reg != 0;
  6647. - default:
  6648. -- addr = CORE_CC_REG(base, pmucapabilities_ext);
  6649. -+ addr = CORE_CC_REG(pmu->base, pmucapabilities_ext);
  6650. - reg = chip->ops->read32(chip->ctx, addr);
  6651. - if ((reg & PCAPEXT_SR_SUPPORTED_MASK) == 0)
  6652. - return false;
  6653. -
  6654. -- addr = CORE_CC_REG(base, retention_ctl);
  6655. -+ addr = CORE_CC_REG(pmu->base, retention_ctl);
  6656. - reg = chip->ops->read32(chip->ctx, addr);
  6657. - return (reg & (PMU_RCTL_MACPHY_DISABLE_MASK |
  6658. - PMU_RCTL_LOGIC_DISABLE_MASK)) == 0;
  6659. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
  6660. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
  6661. -@@ -85,6 +85,7 @@ struct brcmf_chip *brcmf_chip_attach(voi
  6662. - void brcmf_chip_detach(struct brcmf_chip *chip);
  6663. - struct brcmf_core *brcmf_chip_get_core(struct brcmf_chip *chip, u16 coreid);
  6664. - struct brcmf_core *brcmf_chip_get_chipcommon(struct brcmf_chip *chip);
  6665. -+struct brcmf_core *brcmf_chip_get_pmu(struct brcmf_chip *pub);
  6666. - bool brcmf_chip_iscoreup(struct brcmf_core *core);
  6667. - void brcmf_chip_coredisable(struct brcmf_core *core, u32 prereset, u32 reset);
  6668. - void brcmf_chip_resetcore(struct brcmf_core *core, u32 prereset, u32 reset,
  6669. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  6670. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  6671. -@@ -3615,7 +3615,6 @@ brcmf_sdio_drivestrengthinit(struct brcm
  6672. - const struct sdiod_drive_str *str_tab = NULL;
  6673. - u32 str_mask;
  6674. - u32 str_shift;
  6675. -- u32 base;
  6676. - u32 i;
  6677. - u32 drivestrength_sel = 0;
  6678. - u32 cc_data_temp;
  6679. -@@ -3658,14 +3657,15 @@ brcmf_sdio_drivestrengthinit(struct brcm
  6680. - }
  6681. -
  6682. - if (str_tab != NULL) {
  6683. -+ struct brcmf_core *pmu = brcmf_chip_get_pmu(ci);
  6684. -+
  6685. - for (i = 0; str_tab[i].strength != 0; i++) {
  6686. - if (drivestrength >= str_tab[i].strength) {
  6687. - drivestrength_sel = str_tab[i].sel;
  6688. - break;
  6689. - }
  6690. - }
  6691. -- base = brcmf_chip_get_chipcommon(ci)->base;
  6692. -- addr = CORE_CC_REG(base, chipcontrol_addr);
  6693. -+ addr = CORE_CC_REG(pmu->base, chipcontrol_addr);
  6694. - brcmf_sdiod_regwl(sdiodev, addr, 1, NULL);
  6695. - cc_data_temp = brcmf_sdiod_regrl(sdiodev, addr, NULL);
  6696. - cc_data_temp &= ~str_mask;
  6697. -@@ -3835,8 +3835,7 @@ brcmf_sdio_probe_attach(struct brcmf_sdi
  6698. - goto fail;
  6699. -
  6700. - /* set PMUControl so a backplane reset does PMU state reload */
  6701. -- reg_addr = CORE_CC_REG(brcmf_chip_get_chipcommon(bus->ci)->base,
  6702. -- pmucontrol);
  6703. -+ reg_addr = CORE_CC_REG(brcmf_chip_get_pmu(bus->ci)->base, pmucontrol);
  6704. - reg_val = brcmf_sdiod_regrl(bus->sdiodev, reg_addr, &err);
  6705. - if (err)
  6706. - goto fail;
  6707. diff --git a/package/kernel/mac80211/patches/323-0005-brcmfmac-add-support-for-14e4-4365-PCI-ID-with-BCM43.patch b/package/kernel/mac80211/patches/323-0005-brcmfmac-add-support-for-14e4-4365-PCI-ID-with-BCM43.patch
  6708. deleted file mode 100644
  6709. index 35887fc..0000000
  6710. --- a/package/kernel/mac80211/patches/323-0005-brcmfmac-add-support-for-14e4-4365-PCI-ID-with-BCM43.patch
  6711. +++ /dev/null
  6712. @@ -1,38 +0,0 @@
  6713. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  6714. -Date: Tue, 26 Jan 2016 17:57:05 +0100
  6715. -Subject: [PATCH] brcmfmac: add support for 14e4:4365 PCI ID with BCM4366
  6716. - chipset
  6717. -MIME-Version: 1.0
  6718. -Content-Type: text/plain; charset=UTF-8
  6719. -Content-Transfer-Encoding: 8bit
  6720. -
  6721. -On Broadcom ARM routers BCM4366 cards are available with 14e4:4365 ID.
  6722. -Unfortunately this ID was already used by Broadcom for cards with
  6723. -BCM43142, a totally different chipset requiring SoftMAC driver. To avoid
  6724. -a conflict between brcmfmac and bcma use more specific ID entry with
  6725. -subvendor and subdevice specified.
  6726. -
  6727. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  6728. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6729. ----
  6730. -
  6731. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  6732. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  6733. -@@ -1951,6 +1951,9 @@ static const struct dev_pm_ops brcmf_pci
  6734. -
  6735. - #define BRCMF_PCIE_DEVICE(dev_id) { BRCM_PCIE_VENDOR_ID_BROADCOM, dev_id,\
  6736. - PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_NETWORK_OTHER << 8, 0xffff00, 0 }
  6737. -+#define BRCMF_PCIE_DEVICE_SUB(dev_id, subvend, subdev) { \
  6738. -+ BRCM_PCIE_VENDOR_ID_BROADCOM, dev_id,\
  6739. -+ subvend, subdev, PCI_CLASS_NETWORK_OTHER << 8, 0xffff00, 0 }
  6740. -
  6741. - static struct pci_device_id brcmf_pcie_devid_table[] = {
  6742. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4350_DEVICE_ID),
  6743. -@@ -1966,6 +1969,7 @@ static struct pci_device_id brcmf_pcie_d
  6744. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_DEVICE_ID),
  6745. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_2G_DEVICE_ID),
  6746. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_5G_DEVICE_ID),
  6747. -+ BRCMF_PCIE_DEVICE_SUB(0x4365, BRCM_PCIE_VENDOR_ID_BROADCOM, 0x4365),
  6748. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_DEVICE_ID),
  6749. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_2G_DEVICE_ID),
  6750. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_5G_DEVICE_ID),
  6751. diff --git a/package/kernel/mac80211/patches/323-ath9k-Fix-programming-of-minCCA-power-threshold.patch b/package/kernel/mac80211/patches/323-ath9k-Fix-programming-of-minCCA-power-threshold.patch
  6752. new file mode 100644
  6753. index 0000000..59ac29b
  6754. --- /dev/null
  6755. +++ b/package/kernel/mac80211/patches/323-ath9k-Fix-programming-of-minCCA-power-threshold.patch
  6756. @@ -0,0 +1,26 @@
  6757. +From: Sven Eckelmann <sven@narfation.org>
  6758. +Date: Fri, 17 Jun 2016 11:58:20 +0200
  6759. +Subject: [PATCH] ath9k: Fix programming of minCCA power threshold
  6760. +
  6761. +The function ar9003_hw_apply_minccapwr_thresh takes as second parameter not
  6762. +a pointer to the channel but a boolean value describing whether the channel
  6763. +is 2.4GHz or not. This broke (according to the origin commit) the ETSI
  6764. +regulatory compliance on 5GHz channels.
  6765. +
  6766. +Fixes: 3533bf6b15a0 ("ath9k: Fix regulatory compliance")
  6767. +Signed-off-by: Sven Eckelmann <sven@narfation.org>
  6768. +Cc: Simon Wunderlich <sw@simonwunderlich.de>
  6769. +Cc: Sujith Manoharan <c_manoha@qca.qualcomm.com>
  6770. +---
  6771. +
  6772. +--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
  6773. ++++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
  6774. +@@ -4175,7 +4175,7 @@ static void ath9k_hw_ar9300_set_board_va
  6775. + if (!AR_SREV_9330(ah) && !AR_SREV_9340(ah) && !AR_SREV_9531(ah))
  6776. + ar9003_hw_internal_regulator_apply(ah);
  6777. + ar9003_hw_apply_tuning_caps(ah);
  6778. +- ar9003_hw_apply_minccapwr_thresh(ah, chan);
  6779. ++ ar9003_hw_apply_minccapwr_thresh(ah, is2ghz);
  6780. + ar9003_hw_txend_to_xpa_off_apply(ah, is2ghz);
  6781. + ar9003_hw_thermometer_apply(ah);
  6782. + ar9003_hw_thermo_cal_apply(ah);
  6783. diff --git a/package/kernel/mac80211/patches/324-ath9k_hw-fix-spectral-scan-on-AR9285-and-newer.patch b/package/kernel/mac80211/patches/324-ath9k_hw-fix-spectral-scan-on-AR9285-and-newer.patch
  6784. new file mode 100644
  6785. index 0000000..b6f4868
  6786. --- /dev/null
  6787. +++ b/package/kernel/mac80211/patches/324-ath9k_hw-fix-spectral-scan-on-AR9285-and-newer.patch
  6788. @@ -0,0 +1,86 @@
  6789. +From: Felix Fietkau <nbd@nbd.name>
  6790. +Date: Mon, 11 Jul 2016 10:34:37 +0200
  6791. +Subject: [PATCH] ath9k_hw: fix spectral scan on AR9285 and newer
  6792. +
  6793. +The register layout of AR_PHY_SPECTRAL_SCAN has changed, only AR9280
  6794. +uses the old layout
  6795. +
  6796. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  6797. +---
  6798. +
  6799. +--- a/drivers/net/wireless/ath/ath9k/ar9002_phy.c
  6800. ++++ b/drivers/net/wireless/ath/ath9k/ar9002_phy.c
  6801. +@@ -476,6 +476,7 @@ static void ar9002_hw_set_bt_ant_diversi
  6802. + static void ar9002_hw_spectral_scan_config(struct ath_hw *ah,
  6803. + struct ath_spec_scan *param)
  6804. + {
  6805. ++ u32 repeat_bit;
  6806. + u8 count;
  6807. +
  6808. + if (!param->enabled) {
  6809. +@@ -486,12 +487,15 @@ static void ar9002_hw_spectral_scan_conf
  6810. + REG_SET_BIT(ah, AR_PHY_RADAR_0, AR_PHY_RADAR_0_FFT_ENA);
  6811. + REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN, AR_PHY_SPECTRAL_SCAN_ENABLE);
  6812. +
  6813. ++ if (AR_SREV_9280(ah))
  6814. ++ repeat_bit = AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT;
  6815. ++ else
  6816. ++ repeat_bit = AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_KIWI;
  6817. ++
  6818. + if (param->short_repeat)
  6819. +- REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN,
  6820. +- AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT);
  6821. ++ REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN, repeat_bit);
  6822. + else
  6823. +- REG_CLR_BIT(ah, AR_PHY_SPECTRAL_SCAN,
  6824. +- AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT);
  6825. ++ REG_CLR_BIT(ah, AR_PHY_SPECTRAL_SCAN, repeat_bit);
  6826. +
  6827. + /* on AR92xx, the highest bit of count will make the the chip send
  6828. + * spectral samples endlessly. Check if this really was intended,
  6829. +@@ -499,15 +503,25 @@ static void ar9002_hw_spectral_scan_conf
  6830. + */
  6831. + count = param->count;
  6832. + if (param->endless) {
  6833. +- if (AR_SREV_9271(ah))
  6834. +- count = 0;
  6835. +- else
  6836. ++ if (AR_SREV_9280(ah))
  6837. + count = 0x80;
  6838. ++ else
  6839. ++ count = 0;
  6840. + } else if (count & 0x80)
  6841. + count = 0x7f;
  6842. ++ else if (!count)
  6843. ++ count = 1;
  6844. ++
  6845. ++ if (AR_SREV_9280(ah)) {
  6846. ++ REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN,
  6847. ++ AR_PHY_SPECTRAL_SCAN_COUNT, count);
  6848. ++ } else {
  6849. ++ REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN,
  6850. ++ AR_PHY_SPECTRAL_SCAN_COUNT_KIWI, count);
  6851. ++ REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN,
  6852. ++ AR_PHY_SPECTRAL_SCAN_PHYERR_MASK_SELECT);
  6853. ++ }
  6854. +
  6855. +- REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN,
  6856. +- AR_PHY_SPECTRAL_SCAN_COUNT, count);
  6857. + REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN,
  6858. + AR_PHY_SPECTRAL_SCAN_PERIOD, param->period);
  6859. + REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN,
  6860. +--- a/drivers/net/wireless/ath/ath9k/ar9002_phy.h
  6861. ++++ b/drivers/net/wireless/ath/ath9k/ar9002_phy.h
  6862. +@@ -177,8 +177,11 @@
  6863. + #define AR_PHY_SPECTRAL_SCAN_PERIOD_S 8
  6864. + #define AR_PHY_SPECTRAL_SCAN_COUNT 0x00FF0000 /* Number of reports, reg 68, bits 16-23*/
  6865. + #define AR_PHY_SPECTRAL_SCAN_COUNT_S 16
  6866. ++#define AR_PHY_SPECTRAL_SCAN_COUNT_KIWI 0x0FFF0000 /* Number of reports, reg 68, bits 16-27*/
  6867. ++#define AR_PHY_SPECTRAL_SCAN_COUNT_KIWI_S 16
  6868. + #define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT 0x01000000 /* Short repeat, reg 68, bit 24*/
  6869. +-#define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_S 24 /* Short repeat, reg 68, bit 24*/
  6870. ++#define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_KIWI 0x10000000 /* Short repeat, reg 68, bit 28*/
  6871. ++#define AR_PHY_SPECTRAL_SCAN_PHYERR_MASK_SELECT 0x40000000
  6872. +
  6873. + #define AR_PHY_RX_DELAY 0x9914
  6874. + #define AR_PHY_SEARCH_START_DELAY 0x9918
  6875. diff --git a/package/kernel/mac80211/patches/324-brcmfmac-treat-NULL-character-in-NVRAM-as-separator.patch b/package/kernel/mac80211/patches/324-brcmfmac-treat-NULL-character-in-NVRAM-as-separator.patch
  6876. deleted file mode 100644
  6877. index 6ce60f1..0000000
  6878. --- a/package/kernel/mac80211/patches/324-brcmfmac-treat-NULL-character-in-NVRAM-as-separator.patch
  6879. +++ /dev/null
  6880. @@ -1,32 +0,0 @@
  6881. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  6882. -Date: Sun, 31 Jan 2016 12:14:34 +0100
  6883. -Subject: [PATCH] brcmfmac: treat NULL character in NVRAM as separator
  6884. -MIME-Version: 1.0
  6885. -Content-Type: text/plain; charset=UTF-8
  6886. -Content-Transfer-Encoding: 8bit
  6887. -
  6888. -Platform NVRAM (stored on a flash partition) has entries separated by a
  6889. -NULL (\0) char. Our parsing code switches from VALUE state to IDLE
  6890. -whenever it meets a NULL (\0). When that happens our IDLE handler should
  6891. -simply consume it and analyze whatever is placed ahead.
  6892. -
  6893. -This fixes harmless warnings spamming debugging output:
  6894. -[ 155.165624] brcmfmac: brcmf_nvram_handle_idle warning: ln=1:col=20: ignoring invalid character
  6895. -[ 155.180806] brcmfmac: brcmf_nvram_handle_idle warning: ln=1:col=44: ignoring invalid character
  6896. -[ 155.195971] brcmfmac: brcmf_nvram_handle_idle warning: ln=1:col=63: ignoring invalid character
  6897. -
  6898. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  6899. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6900. ----
  6901. -
  6902. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  6903. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  6904. -@@ -93,7 +93,7 @@ static enum nvram_parser_state brcmf_nvr
  6905. - c = nvp->data[nvp->pos];
  6906. - if (c == '\n')
  6907. - return COMMENT;
  6908. -- if (is_whitespace(c))
  6909. -+ if (is_whitespace(c) || c == '\0')
  6910. - goto proceed;
  6911. - if (c == '#')
  6912. - return COMMENT;
  6913. diff --git a/package/kernel/mac80211/patches/325-ath9k_hw-fix-duplicate-and-partially-wrong-definitio.patch b/package/kernel/mac80211/patches/325-ath9k_hw-fix-duplicate-and-partially-wrong-definitio.patch
  6914. new file mode 100644
  6915. index 0000000..6685f33
  6916. --- /dev/null
  6917. +++ b/package/kernel/mac80211/patches/325-ath9k_hw-fix-duplicate-and-partially-wrong-definitio.patch
  6918. @@ -0,0 +1,57 @@
  6919. +From: Felix Fietkau <nbd@nbd.name>
  6920. +Date: Mon, 11 Jul 2016 11:31:39 +0200
  6921. +Subject: [PATCH] ath9k_hw: fix duplicate (and partially wrong) definition
  6922. + of AR_CH0_THERM
  6923. +
  6924. +AR_PHY_65NM_CH0_THERM and AR_CH0_THERM were supposed to refer to the
  6925. +same register, however they had different SREV checks.
  6926. +
  6927. +Remove the duplicate and use the checks. Since there were other SREV
  6928. +checks present in the only place that uses this, this will probaby not
  6929. +affect runtime behavior.
  6930. +
  6931. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  6932. +---
  6933. +
  6934. +--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.h
  6935. ++++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.h
  6936. +@@ -689,13 +689,6 @@
  6937. + #define AR_CH0_TOP_XPABIASLVL (AR_SREV_9550(ah) ? 0x3c0 : 0x300)
  6938. + #define AR_CH0_TOP_XPABIASLVL_S (AR_SREV_9550(ah) ? 6 : 8)
  6939. +
  6940. +-#define AR_CH0_THERM (AR_SREV_9300(ah) ? 0x16290 : \
  6941. +- ((AR_SREV_9485(ah) ? 0x1628c : 0x16294)))
  6942. +-#define AR_CH0_THERM_XPABIASLVL_MSB 0x3
  6943. +-#define AR_CH0_THERM_XPABIASLVL_MSB_S 0
  6944. +-#define AR_CH0_THERM_XPASHORT2GND 0x4
  6945. +-#define AR_CH0_THERM_XPASHORT2GND_S 2
  6946. +-
  6947. + #define AR_SWITCH_TABLE_COM_ALL (0xffff)
  6948. + #define AR_SWITCH_TABLE_COM_ALL_S (0)
  6949. + #define AR_SWITCH_TABLE_COM_AR9462_ALL (0xffffff)
  6950. +@@ -712,15 +705,17 @@
  6951. + #define AR_SWITCH_TABLE_ALL (0xfff)
  6952. + #define AR_SWITCH_TABLE_ALL_S (0)
  6953. +
  6954. +-#define AR_PHY_65NM_CH0_THERM (AR_SREV_9300(ah) ? 0x16290 :\
  6955. +- ((AR_SREV_9462(ah) || AR_SREV_9565(ah)) ? 0x16294 : 0x1628c))
  6956. ++#define AR_CH0_THERM (AR_SREV_9300(ah) ? 0x16290 :\
  6957. ++ ((AR_SREV_9462(ah) || AR_SREV_9565(ah)) ? 0x16294 : 0x1628c))
  6958. ++#define AR_CH0_THERM_XPABIASLVL_MSB 0x3
  6959. ++#define AR_CH0_THERM_XPABIASLVL_MSB_S 0
  6960. ++#define AR_CH0_THERM_XPASHORT2GND 0x4
  6961. ++#define AR_CH0_THERM_XPASHORT2GND_S 2
  6962. +
  6963. +-#define AR_PHY_65NM_CH0_THERM_LOCAL 0x80000000
  6964. +-#define AR_PHY_65NM_CH0_THERM_LOCAL_S 31
  6965. +-#define AR_PHY_65NM_CH0_THERM_START 0x20000000
  6966. +-#define AR_PHY_65NM_CH0_THERM_START_S 29
  6967. +-#define AR_PHY_65NM_CH0_THERM_SAR_ADC_OUT 0x0000ff00
  6968. +-#define AR_PHY_65NM_CH0_THERM_SAR_ADC_OUT_S 8
  6969. ++#define AR_CH0_THERM_LOCAL 0x80000000
  6970. ++#define AR_CH0_THERM_START 0x20000000
  6971. ++#define AR_CH0_THERM_SAR_ADC_OUT 0x0000ff00
  6972. ++#define AR_CH0_THERM_SAR_ADC_OUT_S 8
  6973. +
  6974. + #define AR_CH0_TOP2 (AR_SREV_9300(ah) ? 0x1628c : \
  6975. + (AR_SREV_9462(ah) ? 0x16290 : 0x16284))
  6976. diff --git a/package/kernel/mac80211/patches/325-brcmfmac-sdio-Increase-the-default-timeouts-a-bit.patch b/package/kernel/mac80211/patches/325-brcmfmac-sdio-Increase-the-default-timeouts-a-bit.patch
  6977. deleted file mode 100644
  6978. index 012dea1..0000000
  6979. --- a/package/kernel/mac80211/patches/325-brcmfmac-sdio-Increase-the-default-timeouts-a-bit.patch
  6980. +++ /dev/null
  6981. @@ -1,41 +0,0 @@
  6982. -From: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
  6983. -Date: Mon, 25 Jan 2016 11:47:29 +0100
  6984. -Subject: [PATCH] brcmfmac: sdio: Increase the default timeouts a bit
  6985. -
  6986. -On a Radxa Rock2 board with a Ampak AP6335 (Broadcom 4339 core) it seems
  6987. -the card responds very quickly most of the time, unfortunately during
  6988. -initialisation it sometimes seems to take just a bit over 2 seconds to
  6989. -respond.
  6990. -
  6991. -This results intialization failing with message like:
  6992. - brcmf_c_preinit_dcmds: Retreiving cur_etheraddr failed, -52
  6993. - brcmf_bus_start: failed: -52
  6994. - brcmf_sdio_firmware_callback: dongle is not responding
  6995. -
  6996. -Increasing the timeout to allow for a bit more headroom allows the
  6997. -card to initialize reliably.
  6998. -
  6999. -A quick search online after diagnosing/fixing this showed that Google
  7000. -has a similar patch in their ChromeOS tree, so this doesn't seem
  7001. -specific to the board I'm using.
  7002. -
  7003. -Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
  7004. -Reviewed-by: Julian Calaby <julian.calaby@gmail.com>
  7005. -Acked-by: Arend van Spriel <arend@broadcom.com>
  7006. -Reviewed-by: Douglas Anderson <dianders@chromium.org>
  7007. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  7008. ----
  7009. -
  7010. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  7011. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  7012. -@@ -45,8 +45,8 @@
  7013. - #include "chip.h"
  7014. - #include "firmware.h"
  7015. -
  7016. --#define DCMD_RESP_TIMEOUT msecs_to_jiffies(2000)
  7017. --#define CTL_DONE_TIMEOUT msecs_to_jiffies(2000)
  7018. -+#define DCMD_RESP_TIMEOUT msecs_to_jiffies(2500)
  7019. -+#define CTL_DONE_TIMEOUT msecs_to_jiffies(2500)
  7020. -
  7021. - #ifdef DEBUG
  7022. -
  7023. diff --git a/package/kernel/mac80211/patches/326-ath9k-make-NF-load-complete-quickly-and-reliably.patch b/package/kernel/mac80211/patches/326-ath9k-make-NF-load-complete-quickly-and-reliably.patch
  7024. deleted file mode 100644
  7025. index 71f7a40..0000000
  7026. --- a/package/kernel/mac80211/patches/326-ath9k-make-NF-load-complete-quickly-and-reliably.patch
  7027. +++ /dev/null
  7028. @@ -1,87 +0,0 @@
  7029. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  7030. -Date: Fri, 5 Feb 2016 09:45:50 +0800
  7031. -Subject: [PATCH] ath9k: make NF load complete quickly and reliably
  7032. -
  7033. -Make NF load complete quickly and reliably. NF load execution
  7034. -is delayed by HW to end of frame if frame Rx or Tx is ongoing.
  7035. -Increasing timeout to max frame duration. If NF cal is ongoing
  7036. -before NF load, stop it before load, and restart it afterwards.
  7037. -
  7038. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  7039. ----
  7040. -
  7041. ---- a/drivers/net/wireless/ath/ath9k/calib.c
  7042. -+++ b/drivers/net/wireless/ath/ath9k/calib.c
  7043. -@@ -241,6 +241,7 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  7044. - u8 chainmask = (ah->rxchainmask << 3) | ah->rxchainmask;
  7045. - struct ath_common *common = ath9k_hw_common(ah);
  7046. - s16 default_nf = ath9k_hw_get_default_nf(ah, chan);
  7047. -+ u32 bb_agc_ctl = REG_READ(ah, AR_PHY_AGC_CONTROL);
  7048. -
  7049. - if (ah->caldata)
  7050. - h = ah->caldata->nfCalHist;
  7051. -@@ -264,6 +265,16 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  7052. - }
  7053. -
  7054. - /*
  7055. -+ * stop NF cal if ongoing to ensure NF load completes immediately
  7056. -+ * (or after end rx/tx frame if ongoing)
  7057. -+ */
  7058. -+ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_NF) {
  7059. -+ REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF);
  7060. -+ REG_RMW_BUFFER_FLUSH(ah);
  7061. -+ ENABLE_REG_RMW_BUFFER(ah);
  7062. -+ }
  7063. -+
  7064. -+ /*
  7065. - * Load software filtered NF value into baseband internal minCCApwr
  7066. - * variable.
  7067. - */
  7068. -@@ -276,18 +287,33 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  7069. -
  7070. - /*
  7071. - * Wait for load to complete, should be fast, a few 10s of us.
  7072. -- * The max delay was changed from an original 250us to 10000us
  7073. -- * since 250us often results in NF load timeout and causes deaf
  7074. -- * condition during stress testing 12/12/2009
  7075. -+ * The max delay was changed from an original 250us to 22.2 msec.
  7076. -+ * This would increase timeout to the longest possible frame
  7077. -+ * (11n max length 22.1 msec)
  7078. - */
  7079. -- for (j = 0; j < 10000; j++) {
  7080. -+ for (j = 0; j < 22200; j++) {
  7081. - if ((REG_READ(ah, AR_PHY_AGC_CONTROL) &
  7082. -- AR_PHY_AGC_CONTROL_NF) == 0)
  7083. -+ AR_PHY_AGC_CONTROL_NF) == 0)
  7084. - break;
  7085. - udelay(10);
  7086. - }
  7087. -
  7088. - /*
  7089. -+ * Restart NF so it can continue.
  7090. -+ */
  7091. -+ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_NF) {
  7092. -+ ENABLE_REG_RMW_BUFFER(ah);
  7093. -+ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_ENABLE_NF)
  7094. -+ REG_SET_BIT(ah, AR_PHY_AGC_CONTROL,
  7095. -+ AR_PHY_AGC_CONTROL_ENABLE_NF);
  7096. -+ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_NO_UPDATE_NF)
  7097. -+ REG_SET_BIT(ah, AR_PHY_AGC_CONTROL,
  7098. -+ AR_PHY_AGC_CONTROL_NO_UPDATE_NF);
  7099. -+ REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF);
  7100. -+ REG_RMW_BUFFER_FLUSH(ah);
  7101. -+ }
  7102. -+
  7103. -+ /*
  7104. - * We timed out waiting for the noisefloor to load, probably due to an
  7105. - * in-progress rx. Simply return here and allow the load plenty of time
  7106. - * to complete before the next calibration interval. We need to avoid
  7107. -@@ -296,7 +322,7 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  7108. - * here, the baseband nf cal will just be capped by our present
  7109. - * noisefloor until the next calibration timer.
  7110. - */
  7111. -- if (j == 10000) {
  7112. -+ if (j == 22200) {
  7113. - ath_dbg(common, ANY,
  7114. - "Timeout while waiting for nf to load: AR_PHY_AGC_CONTROL=0x%x\n",
  7115. - REG_READ(ah, AR_PHY_AGC_CONTROL));
  7116. diff --git a/package/kernel/mac80211/patches/326-ath9k_hw-simplify-ar9003_hw_per_calibration.patch b/package/kernel/mac80211/patches/326-ath9k_hw-simplify-ar9003_hw_per_calibration.patch
  7117. new file mode 100644
  7118. index 0000000..999d993
  7119. --- /dev/null
  7120. +++ b/package/kernel/mac80211/patches/326-ath9k_hw-simplify-ar9003_hw_per_calibration.patch
  7121. @@ -0,0 +1,88 @@
  7122. +From: Felix Fietkau <nbd@nbd.name>
  7123. +Date: Mon, 11 Jul 2016 11:34:47 +0200
  7124. +Subject: [PATCH] ath9k_hw: simplify ar9003_hw_per_calibration
  7125. +
  7126. +Reduce indentation, use a variable to save a few pointer dereferences
  7127. +
  7128. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  7129. +---
  7130. +
  7131. +--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  7132. ++++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  7133. +@@ -75,50 +75,49 @@ static bool ar9003_hw_per_calibration(st
  7134. + struct ath9k_cal_list *currCal)
  7135. + {
  7136. + struct ath9k_hw_cal_data *caldata = ah->caldata;
  7137. +- /* Cal is assumed not done until explicitly set below */
  7138. +- bool iscaldone = false;
  7139. ++ const struct ath9k_percal_data *cur_caldata = currCal->calData;
  7140. +
  7141. + /* Calibration in progress. */
  7142. + if (currCal->calState == CAL_RUNNING) {
  7143. + /* Check to see if it has finished. */
  7144. +- if (!(REG_READ(ah, AR_PHY_TIMING4) & AR_PHY_TIMING4_DO_CAL)) {
  7145. +- /*
  7146. +- * Accumulate cal measures for active chains
  7147. +- */
  7148. +- currCal->calData->calCollect(ah);
  7149. +- ah->cal_samples++;
  7150. ++ if (REG_READ(ah, AR_PHY_TIMING4) & AR_PHY_TIMING4_DO_CAL)
  7151. ++ return false;
  7152. +
  7153. +- if (ah->cal_samples >=
  7154. +- currCal->calData->calNumSamples) {
  7155. +- unsigned int i, numChains = 0;
  7156. +- for (i = 0; i < AR9300_MAX_CHAINS; i++) {
  7157. +- if (rxchainmask & (1 << i))
  7158. +- numChains++;
  7159. +- }
  7160. ++ /*
  7161. ++ * Accumulate cal measures for active chains
  7162. ++ */
  7163. ++ cur_caldata->calCollect(ah);
  7164. ++ ah->cal_samples++;
  7165. +
  7166. +- /*
  7167. +- * Process accumulated data
  7168. +- */
  7169. +- currCal->calData->calPostProc(ah, numChains);
  7170. ++ if (ah->cal_samples >= cur_caldata->calNumSamples) {
  7171. ++ unsigned int i, numChains = 0;
  7172. ++ for (i = 0; i < AR9300_MAX_CHAINS; i++) {
  7173. ++ if (rxchainmask & (1 << i))
  7174. ++ numChains++;
  7175. ++ }
  7176. +
  7177. +- /* Calibration has finished. */
  7178. +- caldata->CalValid |= currCal->calData->calType;
  7179. +- currCal->calState = CAL_DONE;
  7180. +- iscaldone = true;
  7181. +- } else {
  7182. ++ /*
  7183. ++ * Process accumulated data
  7184. ++ */
  7185. ++ cur_caldata->calPostProc(ah, numChains);
  7186. ++
  7187. ++ /* Calibration has finished. */
  7188. ++ caldata->CalValid |= cur_caldata->calType;
  7189. ++ currCal->calState = CAL_DONE;
  7190. ++ return true;
  7191. ++ } else {
  7192. + /*
  7193. + * Set-up collection of another sub-sample until we
  7194. + * get desired number
  7195. + */
  7196. + ar9003_hw_setup_calibration(ah, currCal);
  7197. +- }
  7198. + }
  7199. +- } else if (!(caldata->CalValid & currCal->calData->calType)) {
  7200. ++ } else if (!(caldata->CalValid & cur_caldata->calType)) {
  7201. + /* If current cal is marked invalid in channel, kick it off */
  7202. + ath9k_hw_reset_calibration(ah, currCal);
  7203. + }
  7204. +
  7205. +- return iscaldone;
  7206. ++ return false;
  7207. + }
  7208. +
  7209. + static int ar9003_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan,
  7210. diff --git a/package/kernel/mac80211/patches/327-ath9k_hw-get-rid-of-some-duplicate-code-in-calibrati.patch b/package/kernel/mac80211/patches/327-ath9k_hw-get-rid-of-some-duplicate-code-in-calibrati.patch
  7211. new file mode 100644
  7212. index 0000000..b7f3823
  7213. --- /dev/null
  7214. +++ b/package/kernel/mac80211/patches/327-ath9k_hw-get-rid-of-some-duplicate-code-in-calibrati.patch
  7215. @@ -0,0 +1,94 @@
  7216. +From: Felix Fietkau <nbd@nbd.name>
  7217. +Date: Mon, 11 Jul 2016 11:35:20 +0200
  7218. +Subject: [PATCH] ath9k_hw: get rid of some duplicate code in calibration
  7219. + init
  7220. +
  7221. +Remove a misleading debug message as well
  7222. +
  7223. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  7224. +---
  7225. +
  7226. +--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  7227. ++++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  7228. +@@ -1373,6 +1373,26 @@ static void ar9003_hw_cl_cal_post_proc(s
  7229. + }
  7230. + }
  7231. +
  7232. ++static void ar9003_hw_init_cal_common(struct ath_hw *ah)
  7233. ++{
  7234. ++ struct ath9k_hw_cal_data *caldata = ah->caldata;
  7235. ++
  7236. ++ /* Initialize list pointers */
  7237. ++ ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL;
  7238. ++
  7239. ++ INIT_CAL(&ah->iq_caldata);
  7240. ++ INSERT_CAL(ah, &ah->iq_caldata);
  7241. ++
  7242. ++ /* Initialize current pointer to first element in list */
  7243. ++ ah->cal_list_curr = ah->cal_list;
  7244. ++
  7245. ++ if (ah->cal_list_curr)
  7246. ++ ath9k_hw_reset_calibration(ah, ah->cal_list_curr);
  7247. ++
  7248. ++ if (caldata)
  7249. ++ caldata->CalValid = 0;
  7250. ++}
  7251. ++
  7252. + static bool ar9003_hw_init_cal_pcoem(struct ath_hw *ah,
  7253. + struct ath9k_channel *chan)
  7254. + {
  7255. +@@ -1532,21 +1552,7 @@ skip_tx_iqcal:
  7256. + /* Revert chainmask to runtime parameters */
  7257. + ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask);
  7258. +
  7259. +- /* Initialize list pointers */
  7260. +- ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL;
  7261. +-
  7262. +- INIT_CAL(&ah->iq_caldata);
  7263. +- INSERT_CAL(ah, &ah->iq_caldata);
  7264. +- ath_dbg(common, CALIBRATE, "enabling IQ Calibration\n");
  7265. +-
  7266. +- /* Initialize current pointer to first element in list */
  7267. +- ah->cal_list_curr = ah->cal_list;
  7268. +-
  7269. +- if (ah->cal_list_curr)
  7270. +- ath9k_hw_reset_calibration(ah, ah->cal_list_curr);
  7271. +-
  7272. +- if (caldata)
  7273. +- caldata->CalValid = 0;
  7274. ++ ar9003_hw_init_cal_common(ah);
  7275. +
  7276. + return true;
  7277. + }
  7278. +@@ -1577,8 +1583,6 @@ static bool do_ar9003_agc_cal(struct ath
  7279. + static bool ar9003_hw_init_cal_soc(struct ath_hw *ah,
  7280. + struct ath9k_channel *chan)
  7281. + {
  7282. +- struct ath_common *common = ath9k_hw_common(ah);
  7283. +- struct ath9k_hw_cal_data *caldata = ah->caldata;
  7284. + bool txiqcal_done = false;
  7285. + bool status = true;
  7286. + bool run_agc_cal = false, sep_iq_cal = false;
  7287. +@@ -1676,21 +1680,7 @@ skip_tx_iqcal:
  7288. + /* Revert chainmask to runtime parameters */
  7289. + ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask);
  7290. +
  7291. +- /* Initialize list pointers */
  7292. +- ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL;
  7293. +-
  7294. +- INIT_CAL(&ah->iq_caldata);
  7295. +- INSERT_CAL(ah, &ah->iq_caldata);
  7296. +- ath_dbg(common, CALIBRATE, "enabling IQ Calibration\n");
  7297. +-
  7298. +- /* Initialize current pointer to first element in list */
  7299. +- ah->cal_list_curr = ah->cal_list;
  7300. +-
  7301. +- if (ah->cal_list_curr)
  7302. +- ath9k_hw_reset_calibration(ah, ah->cal_list_curr);
  7303. +-
  7304. +- if (caldata)
  7305. +- caldata->CalValid = 0;
  7306. ++ ar9003_hw_init_cal_common(ah);
  7307. +
  7308. + return true;
  7309. + }
  7310. diff --git a/package/kernel/mac80211/patches/327-mac80211-Remove-MPP-table-entries-with-MPath.patch b/package/kernel/mac80211/patches/327-mac80211-Remove-MPP-table-entries-with-MPath.patch
  7311. deleted file mode 100644
  7312. index f7f9df9..0000000
  7313. --- a/package/kernel/mac80211/patches/327-mac80211-Remove-MPP-table-entries-with-MPath.patch
  7314. +++ /dev/null
  7315. @@ -1,54 +0,0 @@
  7316. -From: Henning Rogge <hrogge@gmail.com>
  7317. -Date: Wed, 3 Feb 2016 13:58:36 +0100
  7318. -Subject: [PATCH] mac80211: Remove MPP table entries with MPath
  7319. -
  7320. -Make the mesh_path_del() function remove all mpp table entries
  7321. -that are proxied by the removed mesh path.
  7322. -
  7323. -Acked-by: Bob Copeland <me@bobcopeland.com>
  7324. -Signed-off-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
  7325. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  7326. ----
  7327. -
  7328. ---- a/net/mac80211/mesh_pathtbl.c
  7329. -+++ b/net/mac80211/mesh_pathtbl.c
  7330. -@@ -835,6 +835,29 @@ void mesh_path_flush_by_nexthop(struct s
  7331. - rcu_read_unlock();
  7332. - }
  7333. -
  7334. -+static void mpp_flush_by_proxy(struct ieee80211_sub_if_data *sdata,
  7335. -+ const u8 *proxy)
  7336. -+{
  7337. -+ struct mesh_table *tbl;
  7338. -+ struct mesh_path *mpp;
  7339. -+ struct mpath_node *node;
  7340. -+ int i;
  7341. -+
  7342. -+ rcu_read_lock();
  7343. -+ read_lock_bh(&pathtbl_resize_lock);
  7344. -+ tbl = resize_dereference_mpp_paths();
  7345. -+ for_each_mesh_entry(tbl, node, i) {
  7346. -+ mpp = node->mpath;
  7347. -+ if (ether_addr_equal(mpp->mpp, proxy)) {
  7348. -+ spin_lock(&tbl->hashwlock[i]);
  7349. -+ __mesh_path_del(tbl, node);
  7350. -+ spin_unlock(&tbl->hashwlock[i]);
  7351. -+ }
  7352. -+ }
  7353. -+ read_unlock_bh(&pathtbl_resize_lock);
  7354. -+ rcu_read_unlock();
  7355. -+}
  7356. -+
  7357. - static void table_flush_by_iface(struct mesh_table *tbl,
  7358. - struct ieee80211_sub_if_data *sdata)
  7359. - {
  7360. -@@ -892,6 +915,9 @@ int mesh_path_del(struct ieee80211_sub_i
  7361. - int hash_idx;
  7362. - int err = 0;
  7363. -
  7364. -+ /* flush relevant mpp entries first */
  7365. -+ mpp_flush_by_proxy(sdata, addr);
  7366. -+
  7367. - read_lock_bh(&pathtbl_resize_lock);
  7368. - tbl = resize_dereference_mesh_paths();
  7369. - hash_idx = mesh_table_hash(addr, sdata, tbl);
  7370. diff --git a/package/kernel/mac80211/patches/328-mac80211-let-unused-MPP-table-entries-timeout.patch b/package/kernel/mac80211/patches/328-mac80211-let-unused-MPP-table-entries-timeout.patch
  7371. deleted file mode 100644
  7372. index 740993c..0000000
  7373. --- a/package/kernel/mac80211/patches/328-mac80211-let-unused-MPP-table-entries-timeout.patch
  7374. +++ /dev/null
  7375. @@ -1,104 +0,0 @@
  7376. -From: Henning Rogge <hrogge@gmail.com>
  7377. -Date: Wed, 3 Feb 2016 13:58:37 +0100
  7378. -Subject: [PATCH] mac80211: let unused MPP table entries timeout
  7379. -
  7380. -Remember the last time when a mpp table entry is used for
  7381. -rx or tx and remove them after MESH_PATH_EXPIRE time.
  7382. -
  7383. -Acked-by: Bob Copeland <me@bobcopeland.com>
  7384. -Signed-off-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
  7385. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  7386. ----
  7387. -
  7388. ---- a/net/mac80211/mesh_pathtbl.c
  7389. -+++ b/net/mac80211/mesh_pathtbl.c
  7390. -@@ -942,6 +942,46 @@ enddel:
  7391. - }
  7392. -
  7393. - /**
  7394. -+ * mpp_path_del - delete a mesh proxy path from the table
  7395. -+ *
  7396. -+ * @addr: addr address (ETH_ALEN length)
  7397. -+ * @sdata: local subif
  7398. -+ *
  7399. -+ * Returns: 0 if successful
  7400. -+ */
  7401. -+static int mpp_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr)
  7402. -+{
  7403. -+ struct mesh_table *tbl;
  7404. -+ struct mesh_path *mpath;
  7405. -+ struct mpath_node *node;
  7406. -+ struct hlist_head *bucket;
  7407. -+ int hash_idx;
  7408. -+ int err = 0;
  7409. -+
  7410. -+ read_lock_bh(&pathtbl_resize_lock);
  7411. -+ tbl = resize_dereference_mpp_paths();
  7412. -+ hash_idx = mesh_table_hash(addr, sdata, tbl);
  7413. -+ bucket = &tbl->hash_buckets[hash_idx];
  7414. -+
  7415. -+ spin_lock(&tbl->hashwlock[hash_idx]);
  7416. -+ hlist_for_each_entry(node, bucket, list) {
  7417. -+ mpath = node->mpath;
  7418. -+ if (mpath->sdata == sdata &&
  7419. -+ ether_addr_equal(addr, mpath->dst)) {
  7420. -+ __mesh_path_del(tbl, node);
  7421. -+ goto enddel;
  7422. -+ }
  7423. -+ }
  7424. -+
  7425. -+ err = -ENXIO;
  7426. -+enddel:
  7427. -+ mesh_paths_generation++;
  7428. -+ spin_unlock(&tbl->hashwlock[hash_idx]);
  7429. -+ read_unlock_bh(&pathtbl_resize_lock);
  7430. -+ return err;
  7431. -+}
  7432. -+
  7433. -+/**
  7434. - * mesh_path_tx_pending - sends pending frames in a mesh path queue
  7435. - *
  7436. - * @mpath: mesh path to activate
  7437. -@@ -1157,6 +1197,17 @@ void mesh_path_expire(struct ieee80211_s
  7438. - time_after(jiffies, mpath->exp_time + MESH_PATH_EXPIRE))
  7439. - mesh_path_del(mpath->sdata, mpath->dst);
  7440. - }
  7441. -+
  7442. -+ tbl = rcu_dereference(mpp_paths);
  7443. -+ for_each_mesh_entry(tbl, node, i) {
  7444. -+ if (node->mpath->sdata != sdata)
  7445. -+ continue;
  7446. -+ mpath = node->mpath;
  7447. -+ if ((!(mpath->flags & MESH_PATH_FIXED)) &&
  7448. -+ time_after(jiffies, mpath->exp_time + MESH_PATH_EXPIRE))
  7449. -+ mpp_path_del(mpath->sdata, mpath->dst);
  7450. -+ }
  7451. -+
  7452. - rcu_read_unlock();
  7453. - }
  7454. -
  7455. ---- a/net/mac80211/rx.c
  7456. -+++ b/net/mac80211/rx.c
  7457. -@@ -2291,6 +2291,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
  7458. - spin_lock_bh(&mppath->state_lock);
  7459. - if (!ether_addr_equal(mppath->mpp, mpp_addr))
  7460. - memcpy(mppath->mpp, mpp_addr, ETH_ALEN);
  7461. -+ mppath->exp_time = jiffies;
  7462. - spin_unlock_bh(&mppath->state_lock);
  7463. - }
  7464. - rcu_read_unlock();
  7465. ---- a/net/mac80211/tx.c
  7466. -+++ b/net/mac80211/tx.c
  7467. -@@ -2171,8 +2171,11 @@ static struct sk_buff *ieee80211_build_h
  7468. - mpp_lookup = true;
  7469. - }
  7470. -
  7471. -- if (mpp_lookup)
  7472. -+ if (mpp_lookup) {
  7473. - mppath = mpp_path_lookup(sdata, skb->data);
  7474. -+ if (mppath)
  7475. -+ mppath->exp_time = jiffies;
  7476. -+ }
  7477. -
  7478. - if (mppath && mpath)
  7479. - mesh_path_del(mpath->sdata, mpath->dst);
  7480. diff --git a/package/kernel/mac80211/patches/329-mac80211-Unify-mesh-and-mpp-path-removal-function.patch b/package/kernel/mac80211/patches/329-mac80211-Unify-mesh-and-mpp-path-removal-function.patch
  7481. deleted file mode 100644
  7482. index 0c36b1d..0000000
  7483. --- a/package/kernel/mac80211/patches/329-mac80211-Unify-mesh-and-mpp-path-removal-function.patch
  7484. +++ /dev/null
  7485. @@ -1,143 +0,0 @@
  7486. -From: Henning Rogge <hrogge@gmail.com>
  7487. -Date: Wed, 3 Feb 2016 13:58:38 +0100
  7488. -Subject: [PATCH] mac80211: Unify mesh and mpp path removal function
  7489. -
  7490. -mpp_path_del() and mesh_path_del() are mostly the same function.
  7491. -Move common code into a new static function.
  7492. -
  7493. -Acked-by: Bob Copeland <me@bobcopeland.com>
  7494. -Signed-off-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
  7495. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  7496. ----
  7497. -
  7498. ---- a/net/mac80211/mesh_pathtbl.c
  7499. -+++ b/net/mac80211/mesh_pathtbl.c
  7500. -@@ -55,16 +55,21 @@ int mpp_paths_generation;
  7501. - static DEFINE_RWLOCK(pathtbl_resize_lock);
  7502. -
  7503. -
  7504. -+static inline struct mesh_table *resize_dereference_paths(
  7505. -+ struct mesh_table __rcu *table)
  7506. -+{
  7507. -+ return rcu_dereference_protected(table,
  7508. -+ lockdep_is_held(&pathtbl_resize_lock));
  7509. -+}
  7510. -+
  7511. - static inline struct mesh_table *resize_dereference_mesh_paths(void)
  7512. - {
  7513. -- return rcu_dereference_protected(mesh_paths,
  7514. -- lockdep_is_held(&pathtbl_resize_lock));
  7515. -+ return resize_dereference_paths(mesh_paths);
  7516. - }
  7517. -
  7518. - static inline struct mesh_table *resize_dereference_mpp_paths(void)
  7519. - {
  7520. -- return rcu_dereference_protected(mpp_paths,
  7521. -- lockdep_is_held(&pathtbl_resize_lock));
  7522. -+ return resize_dereference_paths(mpp_paths);
  7523. - }
  7524. -
  7525. - /*
  7526. -@@ -899,14 +904,17 @@ void mesh_path_flush_by_iface(struct iee
  7527. - }
  7528. -
  7529. - /**
  7530. -- * mesh_path_del - delete a mesh path from the table
  7531. -+ * table_path_del - delete a path from the mesh or mpp table
  7532. - *
  7533. -- * @addr: dst address (ETH_ALEN length)
  7534. -+ * @tbl: mesh or mpp path table
  7535. - * @sdata: local subif
  7536. -+ * @addr: dst address (ETH_ALEN length)
  7537. - *
  7538. - * Returns: 0 if successful
  7539. - */
  7540. --int mesh_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr)
  7541. -+static int table_path_del(struct mesh_table __rcu *rcu_tbl,
  7542. -+ struct ieee80211_sub_if_data *sdata,
  7543. -+ const u8 *addr)
  7544. - {
  7545. - struct mesh_table *tbl;
  7546. - struct mesh_path *mpath;
  7547. -@@ -915,11 +923,7 @@ int mesh_path_del(struct ieee80211_sub_i
  7548. - int hash_idx;
  7549. - int err = 0;
  7550. -
  7551. -- /* flush relevant mpp entries first */
  7552. -- mpp_flush_by_proxy(sdata, addr);
  7553. --
  7554. -- read_lock_bh(&pathtbl_resize_lock);
  7555. -- tbl = resize_dereference_mesh_paths();
  7556. -+ tbl = resize_dereference_paths(rcu_tbl);
  7557. - hash_idx = mesh_table_hash(addr, sdata, tbl);
  7558. - bucket = &tbl->hash_buckets[hash_idx];
  7559. -
  7560. -@@ -935,9 +939,30 @@ int mesh_path_del(struct ieee80211_sub_i
  7561. -
  7562. - err = -ENXIO;
  7563. - enddel:
  7564. -- mesh_paths_generation++;
  7565. - spin_unlock(&tbl->hashwlock[hash_idx]);
  7566. -+ return err;
  7567. -+}
  7568. -+
  7569. -+/**
  7570. -+ * mesh_path_del - delete a mesh path from the table
  7571. -+ *
  7572. -+ * @addr: dst address (ETH_ALEN length)
  7573. -+ * @sdata: local subif
  7574. -+ *
  7575. -+ * Returns: 0 if successful
  7576. -+ */
  7577. -+int mesh_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr)
  7578. -+{
  7579. -+ int err = 0;
  7580. -+
  7581. -+ /* flush relevant mpp entries first */
  7582. -+ mpp_flush_by_proxy(sdata, addr);
  7583. -+
  7584. -+ read_lock_bh(&pathtbl_resize_lock);
  7585. -+ err = table_path_del(mesh_paths, sdata, addr);
  7586. -+ mesh_paths_generation++;
  7587. - read_unlock_bh(&pathtbl_resize_lock);
  7588. -+
  7589. - return err;
  7590. - }
  7591. -
  7592. -@@ -951,33 +976,13 @@ enddel:
  7593. - */
  7594. - static int mpp_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr)
  7595. - {
  7596. -- struct mesh_table *tbl;
  7597. -- struct mesh_path *mpath;
  7598. -- struct mpath_node *node;
  7599. -- struct hlist_head *bucket;
  7600. -- int hash_idx;
  7601. - int err = 0;
  7602. -
  7603. - read_lock_bh(&pathtbl_resize_lock);
  7604. -- tbl = resize_dereference_mpp_paths();
  7605. -- hash_idx = mesh_table_hash(addr, sdata, tbl);
  7606. -- bucket = &tbl->hash_buckets[hash_idx];
  7607. --
  7608. -- spin_lock(&tbl->hashwlock[hash_idx]);
  7609. -- hlist_for_each_entry(node, bucket, list) {
  7610. -- mpath = node->mpath;
  7611. -- if (mpath->sdata == sdata &&
  7612. -- ether_addr_equal(addr, mpath->dst)) {
  7613. -- __mesh_path_del(tbl, node);
  7614. -- goto enddel;
  7615. -- }
  7616. -- }
  7617. --
  7618. -- err = -ENXIO;
  7619. --enddel:
  7620. -- mesh_paths_generation++;
  7621. -- spin_unlock(&tbl->hashwlock[hash_idx]);
  7622. -+ err = table_path_del(mpp_paths, sdata, addr);
  7623. -+ mpp_paths_generation++;
  7624. - read_unlock_bh(&pathtbl_resize_lock);
  7625. -+
  7626. - return err;
  7627. - }
  7628. -
  7629. diff --git a/package/kernel/mac80211/patches/329-mac80211-fix-check-for-buffered-powersave-frames-wit.patch b/package/kernel/mac80211/patches/329-mac80211-fix-check-for-buffered-powersave-frames-wit.patch
  7630. new file mode 100644
  7631. index 0000000..38e541c
  7632. --- /dev/null
  7633. +++ b/package/kernel/mac80211/patches/329-mac80211-fix-check-for-buffered-powersave-frames-wit.patch
  7634. @@ -0,0 +1,21 @@
  7635. +From: Felix Fietkau <nbd@nbd.name>
  7636. +Date: Mon, 11 Jul 2016 15:07:06 +0200
  7637. +Subject: [PATCH] mac80211: fix check for buffered powersave frames with txq
  7638. +
  7639. +The logic was inverted here, set the bit if frames are pending.
  7640. +
  7641. +Fixes: ba8c3d6f16a1 ("mac80211: add an intermediate software queue implementation")
  7642. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  7643. +---
  7644. +
  7645. +--- a/net/mac80211/rx.c
  7646. ++++ b/net/mac80211/rx.c
  7647. +@@ -1268,7 +1268,7 @@ static void sta_ps_start(struct sta_info
  7648. + for (tid = 0; tid < ARRAY_SIZE(sta->sta.txq); tid++) {
  7649. + struct txq_info *txqi = to_txq_info(sta->sta.txq[tid]);
  7650. +
  7651. +- if (!txqi->tin.backlog_packets)
  7652. ++ if (txqi->tin.backlog_packets)
  7653. + set_bit(tid, &sta->txq_buffered_tids);
  7654. + else
  7655. + clear_bit(tid, &sta->txq_buffered_tids);
  7656. diff --git a/package/kernel/mac80211/patches/330-ath10k-fix-rx-status-reporting-for-A-MSDU-subframes.patch b/package/kernel/mac80211/patches/330-ath10k-fix-rx-status-reporting-for-A-MSDU-subframes.patch
  7657. new file mode 100644
  7658. index 0000000..a6031b9
  7659. --- /dev/null
  7660. +++ b/package/kernel/mac80211/patches/330-ath10k-fix-rx-status-reporting-for-A-MSDU-subframes.patch
  7661. @@ -0,0 +1,36 @@
  7662. +From: Felix Fietkau <nbd@nbd.name>
  7663. +Date: Sun, 17 Jul 2016 12:49:59 +0200
  7664. +Subject: [PATCH] ath10k: fix rx status reporting for A-MSDU subframes
  7665. +
  7666. +Patch by Nagarajan, Ashok Raj <arnagara@qti.qualcomm.com>
  7667. +
  7668. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  7669. +---
  7670. +
  7671. +--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
  7672. ++++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
  7673. +@@ -1525,7 +1525,7 @@ static void ath10k_htt_rx_h_filter(struc
  7674. + static int ath10k_htt_rx_handle_amsdu(struct ath10k_htt *htt)
  7675. + {
  7676. + struct ath10k *ar = htt->ar;
  7677. +- static struct ieee80211_rx_status rx_status;
  7678. ++ struct ieee80211_rx_status *rx_status = &htt->rx_status;
  7679. + struct sk_buff_head amsdu;
  7680. + int ret;
  7681. +
  7682. +@@ -1549,11 +1549,11 @@ static int ath10k_htt_rx_handle_amsdu(st
  7683. + return ret;
  7684. + }
  7685. +
  7686. +- ath10k_htt_rx_h_ppdu(ar, &amsdu, &rx_status, 0xffff);
  7687. ++ ath10k_htt_rx_h_ppdu(ar, &amsdu, rx_status, 0xffff);
  7688. + ath10k_htt_rx_h_unchain(ar, &amsdu, ret > 0);
  7689. +- ath10k_htt_rx_h_filter(ar, &amsdu, &rx_status);
  7690. +- ath10k_htt_rx_h_mpdu(ar, &amsdu, &rx_status);
  7691. +- ath10k_htt_rx_h_deliver(ar, &amsdu, &rx_status);
  7692. ++ ath10k_htt_rx_h_filter(ar, &amsdu, rx_status);
  7693. ++ ath10k_htt_rx_h_mpdu(ar, &amsdu, rx_status);
  7694. ++ ath10k_htt_rx_h_deliver(ar, &amsdu, rx_status);
  7695. +
  7696. + return 0;
  7697. + }
  7698. diff --git a/package/kernel/mac80211/patches/330-mac80211-minstrel-Change-expected-throughput-unit-ba.patch b/package/kernel/mac80211/patches/330-mac80211-minstrel-Change-expected-throughput-unit-ba.patch
  7699. deleted file mode 100644
  7700. index 4dc6d66..0000000
  7701. --- a/package/kernel/mac80211/patches/330-mac80211-minstrel-Change-expected-throughput-unit-ba.patch
  7702. +++ /dev/null
  7703. @@ -1,51 +0,0 @@
  7704. -From: Sven Eckelmann <sven.eckelmann@open-mesh.com>
  7705. -Date: Tue, 2 Feb 2016 08:12:26 +0100
  7706. -Subject: [PATCH] mac80211: minstrel: Change expected throughput unit back to
  7707. - Kbps
  7708. -
  7709. -The change from cur_tp to the function
  7710. -minstrel_get_tp_avg/minstrel_ht_get_tp_avg changed the unit used for the
  7711. -current throughput. For example in minstrel_ht the correct
  7712. -conversion between them would be:
  7713. -
  7714. - mrs->cur_tp / 10 == minstrel_ht_get_tp_avg(..).
  7715. -
  7716. -This factor 10 must also be included in the calculation of
  7717. -minstrel_get_expected_throughput and minstrel_ht_get_expected_throughput to
  7718. -return values with the unit [Kbps] instead of [10Kbps]. Otherwise routing
  7719. -algorithms like B.A.T.M.A.N. V will make incorrect decision based on these
  7720. -values. Its kernel based implementation expects expected_throughput always
  7721. -to have the unit [Kbps] and not sometimes [10Kbps] and sometimes [Kbps].
  7722. -
  7723. -The same requirement has iw or olsrdv2's nl80211 based statistics module
  7724. -which retrieve the same data via NL80211_STA_INFO_TX_BITRATE.
  7725. -
  7726. -Cc: stable@vger.kernel.org
  7727. -Fixes: 6a27b2c40b48 ("mac80211: restructure per-rate throughput calculation into function")
  7728. -Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
  7729. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  7730. ----
  7731. -
  7732. ---- a/net/mac80211/rc80211_minstrel.c
  7733. -+++ b/net/mac80211/rc80211_minstrel.c
  7734. -@@ -711,7 +711,7 @@ static u32 minstrel_get_expected_through
  7735. - * computing cur_tp
  7736. - */
  7737. - tmp_mrs = &mi->r[idx].stats;
  7738. -- tmp_cur_tp = minstrel_get_tp_avg(&mi->r[idx], tmp_mrs->prob_ewma);
  7739. -+ tmp_cur_tp = minstrel_get_tp_avg(&mi->r[idx], tmp_mrs->prob_ewma) * 10;
  7740. - tmp_cur_tp = tmp_cur_tp * 1200 * 8 / 1024;
  7741. -
  7742. - return tmp_cur_tp;
  7743. ---- a/net/mac80211/rc80211_minstrel_ht.c
  7744. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  7745. -@@ -1335,7 +1335,8 @@ static u32 minstrel_ht_get_expected_thro
  7746. - prob = mi->groups[i].rates[j].prob_ewma;
  7747. -
  7748. - /* convert tp_avg from pkt per second in kbps */
  7749. -- tp_avg = minstrel_ht_get_tp_avg(mi, i, j, prob) * AVG_PKT_SIZE * 8 / 1024;
  7750. -+ tp_avg = minstrel_ht_get_tp_avg(mi, i, j, prob) * 10;
  7751. -+ tp_avg = tp_avg * AVG_PKT_SIZE * 8 / 1024;
  7752. -
  7753. - return tp_avg;
  7754. - }
  7755. diff --git a/package/kernel/mac80211/patches/331-brcmfmac-Increase-nr-of-supported-flowrings.patch b/package/kernel/mac80211/patches/331-brcmfmac-Increase-nr-of-supported-flowrings.patch
  7756. deleted file mode 100644
  7757. index 1fd016f..0000000
  7758. --- a/package/kernel/mac80211/patches/331-brcmfmac-Increase-nr-of-supported-flowrings.patch
  7759. +++ /dev/null
  7760. @@ -1,307 +0,0 @@
  7761. -From: Hante Meuleman <meuleman@broadcom.com>
  7762. -Date: Sun, 7 Feb 2016 18:08:24 +0100
  7763. -Subject: [PATCH] brcmfmac: Increase nr of supported flowrings.
  7764. -MIME-Version: 1.0
  7765. -Content-Type: text/plain; charset=UTF-8
  7766. -Content-Transfer-Encoding: 8bit
  7767. -
  7768. -New generation devices have firmware which has more than 256 flowrings.
  7769. -E.g. following debugging message comes from 14e4:4365 BCM4366:
  7770. -[ 194.606245] brcmfmac: brcmf_pcie_init_ringbuffers Nr of flowrings is 264
  7771. -
  7772. -At various code places (related to flowrings) we were using u8 which
  7773. -could lead to storing wrong number or infinite loops when indexing with
  7774. -this type. This issue was quite easy to spot in brcmf_flowring_detach
  7775. -where it led to infinite loop e.g. on failed initialization.
  7776. -
  7777. -This patch switches code to proper types and increases the maximum
  7778. -number of supported flowrings to 512.
  7779. -
  7780. -Originally this change was sent in September 2015, but back it was
  7781. -causing a regression on BCM43602 resulting in:
  7782. -Unable to handle kernel NULL pointer dereference at virtual address ...
  7783. -
  7784. -The reason for this regression was missing update (s/u8/u16) of struct
  7785. -brcmf_flowring_ring. This problem was handled in 9f64df9 ("brcmfmac: Fix
  7786. -bug in flowring management."). Starting with that it's safe to apply
  7787. -this original patch as it doesn't cause a regression anymore.
  7788. -
  7789. -This patch fixes an infinite loop on BCM4366 which is supported since
  7790. -4.4 so it makes sense to apply it to stable 4.4+.
  7791. -
  7792. -Cc: <stable@vger.kernel.org> # 4.4+
  7793. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  7794. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  7795. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  7796. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  7797. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  7798. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  7799. ----
  7800. -
  7801. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c
  7802. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c
  7803. -@@ -32,7 +32,7 @@
  7804. - #define BRCMF_FLOWRING_LOW (BRCMF_FLOWRING_HIGH - 256)
  7805. - #define BRCMF_FLOWRING_INVALID_IFIDX 0xff
  7806. -
  7807. --#define BRCMF_FLOWRING_HASH_AP(da, fifo, ifidx) (da[5] + fifo + ifidx * 16)
  7808. -+#define BRCMF_FLOWRING_HASH_AP(da, fifo, ifidx) (da[5] * 2 + fifo + ifidx * 16)
  7809. - #define BRCMF_FLOWRING_HASH_STA(fifo, ifidx) (fifo + ifidx * 16)
  7810. -
  7811. - static const u8 brcmf_flowring_prio2fifo[] = {
  7812. -@@ -68,7 +68,7 @@ u32 brcmf_flowring_lookup(struct brcmf_f
  7813. - u8 prio, u8 ifidx)
  7814. - {
  7815. - struct brcmf_flowring_hash *hash;
  7816. -- u8 hash_idx;
  7817. -+ u16 hash_idx;
  7818. - u32 i;
  7819. - bool found;
  7820. - bool sta;
  7821. -@@ -88,6 +88,7 @@ u32 brcmf_flowring_lookup(struct brcmf_f
  7822. - }
  7823. - hash_idx = sta ? BRCMF_FLOWRING_HASH_STA(fifo, ifidx) :
  7824. - BRCMF_FLOWRING_HASH_AP(mac, fifo, ifidx);
  7825. -+ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1);
  7826. - found = false;
  7827. - hash = flow->hash;
  7828. - for (i = 0; i < BRCMF_FLOWRING_HASHSIZE; i++) {
  7829. -@@ -98,6 +99,7 @@ u32 brcmf_flowring_lookup(struct brcmf_f
  7830. - break;
  7831. - }
  7832. - hash_idx++;
  7833. -+ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1);
  7834. - }
  7835. - if (found)
  7836. - return hash[hash_idx].flowid;
  7837. -@@ -111,7 +113,7 @@ u32 brcmf_flowring_create(struct brcmf_f
  7838. - {
  7839. - struct brcmf_flowring_ring *ring;
  7840. - struct brcmf_flowring_hash *hash;
  7841. -- u8 hash_idx;
  7842. -+ u16 hash_idx;
  7843. - u32 i;
  7844. - bool found;
  7845. - u8 fifo;
  7846. -@@ -131,6 +133,7 @@ u32 brcmf_flowring_create(struct brcmf_f
  7847. - }
  7848. - hash_idx = sta ? BRCMF_FLOWRING_HASH_STA(fifo, ifidx) :
  7849. - BRCMF_FLOWRING_HASH_AP(mac, fifo, ifidx);
  7850. -+ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1);
  7851. - found = false;
  7852. - hash = flow->hash;
  7853. - for (i = 0; i < BRCMF_FLOWRING_HASHSIZE; i++) {
  7854. -@@ -140,6 +143,7 @@ u32 brcmf_flowring_create(struct brcmf_f
  7855. - break;
  7856. - }
  7857. - hash_idx++;
  7858. -+ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1);
  7859. - }
  7860. - if (found) {
  7861. - for (i = 0; i < flow->nrofrings; i++) {
  7862. -@@ -169,7 +173,7 @@ u32 brcmf_flowring_create(struct brcmf_f
  7863. - }
  7864. -
  7865. -
  7866. --u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u8 flowid)
  7867. -+u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u16 flowid)
  7868. - {
  7869. - struct brcmf_flowring_ring *ring;
  7870. -
  7871. -@@ -179,7 +183,7 @@ u8 brcmf_flowring_tid(struct brcmf_flowr
  7872. - }
  7873. -
  7874. -
  7875. --static void brcmf_flowring_block(struct brcmf_flowring *flow, u8 flowid,
  7876. -+static void brcmf_flowring_block(struct brcmf_flowring *flow, u16 flowid,
  7877. - bool blocked)
  7878. - {
  7879. - struct brcmf_flowring_ring *ring;
  7880. -@@ -228,10 +232,10 @@ static void brcmf_flowring_block(struct
  7881. - }
  7882. -
  7883. -
  7884. --void brcmf_flowring_delete(struct brcmf_flowring *flow, u8 flowid)
  7885. -+void brcmf_flowring_delete(struct brcmf_flowring *flow, u16 flowid)
  7886. - {
  7887. - struct brcmf_flowring_ring *ring;
  7888. -- u8 hash_idx;
  7889. -+ u16 hash_idx;
  7890. - struct sk_buff *skb;
  7891. -
  7892. - ring = flow->rings[flowid];
  7893. -@@ -253,7 +257,7 @@ void brcmf_flowring_delete(struct brcmf_
  7894. - }
  7895. -
  7896. -
  7897. --u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  7898. -+u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u16 flowid,
  7899. - struct sk_buff *skb)
  7900. - {
  7901. - struct brcmf_flowring_ring *ring;
  7902. -@@ -279,7 +283,7 @@ u32 brcmf_flowring_enqueue(struct brcmf_
  7903. - }
  7904. -
  7905. -
  7906. --struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u8 flowid)
  7907. -+struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u16 flowid)
  7908. - {
  7909. - struct brcmf_flowring_ring *ring;
  7910. - struct sk_buff *skb;
  7911. -@@ -300,7 +304,7 @@ struct sk_buff *brcmf_flowring_dequeue(s
  7912. - }
  7913. -
  7914. -
  7915. --void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u8 flowid,
  7916. -+void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u16 flowid,
  7917. - struct sk_buff *skb)
  7918. - {
  7919. - struct brcmf_flowring_ring *ring;
  7920. -@@ -311,7 +315,7 @@ void brcmf_flowring_reinsert(struct brcm
  7921. - }
  7922. -
  7923. -
  7924. --u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u8 flowid)
  7925. -+u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u16 flowid)
  7926. - {
  7927. - struct brcmf_flowring_ring *ring;
  7928. -
  7929. -@@ -326,7 +330,7 @@ u32 brcmf_flowring_qlen(struct brcmf_flo
  7930. - }
  7931. -
  7932. -
  7933. --void brcmf_flowring_open(struct brcmf_flowring *flow, u8 flowid)
  7934. -+void brcmf_flowring_open(struct brcmf_flowring *flow, u16 flowid)
  7935. - {
  7936. - struct brcmf_flowring_ring *ring;
  7937. -
  7938. -@@ -340,10 +344,10 @@ void brcmf_flowring_open(struct brcmf_fl
  7939. - }
  7940. -
  7941. -
  7942. --u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u8 flowid)
  7943. -+u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u16 flowid)
  7944. - {
  7945. - struct brcmf_flowring_ring *ring;
  7946. -- u8 hash_idx;
  7947. -+ u16 hash_idx;
  7948. -
  7949. - ring = flow->rings[flowid];
  7950. - hash_idx = ring->hash_id;
  7951. -@@ -384,7 +388,7 @@ void brcmf_flowring_detach(struct brcmf_
  7952. - struct brcmf_pub *drvr = bus_if->drvr;
  7953. - struct brcmf_flowring_tdls_entry *search;
  7954. - struct brcmf_flowring_tdls_entry *remove;
  7955. -- u8 flowid;
  7956. -+ u16 flowid;
  7957. -
  7958. - for (flowid = 0; flowid < flow->nrofrings; flowid++) {
  7959. - if (flow->rings[flowid])
  7960. -@@ -408,7 +412,7 @@ void brcmf_flowring_configure_addr_mode(
  7961. - struct brcmf_bus *bus_if = dev_get_drvdata(flow->dev);
  7962. - struct brcmf_pub *drvr = bus_if->drvr;
  7963. - u32 i;
  7964. -- u8 flowid;
  7965. -+ u16 flowid;
  7966. -
  7967. - if (flow->addr_mode[ifidx] != addr_mode) {
  7968. - for (i = 0; i < ARRAY_SIZE(flow->hash); i++) {
  7969. -@@ -434,7 +438,7 @@ void brcmf_flowring_delete_peer(struct b
  7970. - struct brcmf_flowring_tdls_entry *prev;
  7971. - struct brcmf_flowring_tdls_entry *search;
  7972. - u32 i;
  7973. -- u8 flowid;
  7974. -+ u16 flowid;
  7975. - bool sta;
  7976. -
  7977. - sta = (flow->addr_mode[ifidx] == ADDR_INDIRECT);
  7978. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.h
  7979. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.h
  7980. -@@ -16,7 +16,7 @@
  7981. - #define BRCMFMAC_FLOWRING_H
  7982. -
  7983. -
  7984. --#define BRCMF_FLOWRING_HASHSIZE 256
  7985. -+#define BRCMF_FLOWRING_HASHSIZE 512 /* has to be 2^x */
  7986. - #define BRCMF_FLOWRING_INVALID_ID 0xFFFFFFFF
  7987. -
  7988. -
  7989. -@@ -24,7 +24,7 @@ struct brcmf_flowring_hash {
  7990. - u8 mac[ETH_ALEN];
  7991. - u8 fifo;
  7992. - u8 ifidx;
  7993. -- u8 flowid;
  7994. -+ u16 flowid;
  7995. - };
  7996. -
  7997. - enum ring_status {
  7998. -@@ -61,16 +61,16 @@ u32 brcmf_flowring_lookup(struct brcmf_f
  7999. - u8 prio, u8 ifidx);
  8000. - u32 brcmf_flowring_create(struct brcmf_flowring *flow, u8 da[ETH_ALEN],
  8001. - u8 prio, u8 ifidx);
  8002. --void brcmf_flowring_delete(struct brcmf_flowring *flow, u8 flowid);
  8003. --void brcmf_flowring_open(struct brcmf_flowring *flow, u8 flowid);
  8004. --u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u8 flowid);
  8005. --u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  8006. -+void brcmf_flowring_delete(struct brcmf_flowring *flow, u16 flowid);
  8007. -+void brcmf_flowring_open(struct brcmf_flowring *flow, u16 flowid);
  8008. -+u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u16 flowid);
  8009. -+u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u16 flowid,
  8010. - struct sk_buff *skb);
  8011. --struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u8 flowid);
  8012. --void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u8 flowid,
  8013. -+struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u16 flowid);
  8014. -+void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u16 flowid,
  8015. - struct sk_buff *skb);
  8016. --u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u8 flowid);
  8017. --u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u8 flowid);
  8018. -+u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u16 flowid);
  8019. -+u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u16 flowid);
  8020. - struct brcmf_flowring *brcmf_flowring_attach(struct device *dev, u16 nrofrings);
  8021. - void brcmf_flowring_detach(struct brcmf_flowring *flow);
  8022. - void brcmf_flowring_configure_addr_mode(struct brcmf_flowring *flow, int ifidx,
  8023. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  8024. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  8025. -@@ -677,7 +677,7 @@ static u32 brcmf_msgbuf_flowring_create(
  8026. - }
  8027. -
  8028. -
  8029. --static void brcmf_msgbuf_txflow(struct brcmf_msgbuf *msgbuf, u8 flowid)
  8030. -+static void brcmf_msgbuf_txflow(struct brcmf_msgbuf *msgbuf, u16 flowid)
  8031. - {
  8032. - struct brcmf_flowring *flow = msgbuf->flow;
  8033. - struct brcmf_commonring *commonring;
  8034. -@@ -1310,7 +1310,7 @@ int brcmf_proto_msgbuf_rx_trigger(struct
  8035. - }
  8036. -
  8037. -
  8038. --void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u8 flowid)
  8039. -+void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u16 flowid)
  8040. - {
  8041. - struct brcmf_msgbuf *msgbuf = (struct brcmf_msgbuf *)drvr->proto->pd;
  8042. - struct msgbuf_tx_flowring_delete_req *delete;
  8043. -@@ -1415,6 +1415,13 @@ int brcmf_proto_msgbuf_attach(struct brc
  8044. - u32 count;
  8045. -
  8046. - if_msgbuf = drvr->bus_if->msgbuf;
  8047. -+
  8048. -+ if (if_msgbuf->nrof_flowrings >= BRCMF_FLOWRING_HASHSIZE) {
  8049. -+ brcmf_err("driver not configured for this many flowrings %d\n",
  8050. -+ if_msgbuf->nrof_flowrings);
  8051. -+ if_msgbuf->nrof_flowrings = BRCMF_FLOWRING_HASHSIZE - 1;
  8052. -+ }
  8053. -+
  8054. - msgbuf = kzalloc(sizeof(*msgbuf), GFP_KERNEL);
  8055. - if (!msgbuf)
  8056. - goto fail;
  8057. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.h
  8058. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.h
  8059. -@@ -33,7 +33,7 @@
  8060. -
  8061. -
  8062. - int brcmf_proto_msgbuf_rx_trigger(struct device *dev);
  8063. --void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u8 flowid);
  8064. -+void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u16 flowid);
  8065. - int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr);
  8066. - void brcmf_proto_msgbuf_detach(struct brcmf_pub *drvr);
  8067. - #else
  8068. diff --git a/package/kernel/mac80211/patches/331-mac80211-End-the-MPSP-even-if-EOSP-frame-was-not-rec.patch b/package/kernel/mac80211/patches/331-mac80211-End-the-MPSP-even-if-EOSP-frame-was-not-rec.patch
  8069. new file mode 100644
  8070. index 0000000..5d8a8fb
  8071. --- /dev/null
  8072. +++ b/package/kernel/mac80211/patches/331-mac80211-End-the-MPSP-even-if-EOSP-frame-was-not-rec.patch
  8073. @@ -0,0 +1,42 @@
  8074. +From: Masashi Honma <masashi.honma@gmail.com>
  8075. +Date: Wed, 13 Jul 2016 16:04:35 +0900
  8076. +Subject: [PATCH] mac80211: End the MPSP even if EOSP frame was not received
  8077. +
  8078. +The mesh STA sends QoS frame with EOSP (end of service period)
  8079. +subfiled=1 to end the MPSP(mesh peer service period). Previously, if
  8080. +the frame was not acked by peer, the mesh STA did not end the MPSP.
  8081. +This patch ends the MPSP even if the QoS frame was no acked.
  8082. +
  8083. +Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
  8084. +---
  8085. +
  8086. +--- a/net/mac80211/status.c
  8087. ++++ b/net/mac80211/status.c
  8088. +@@ -784,6 +784,13 @@ void ieee80211_tx_status(struct ieee8021
  8089. + clear_sta_flag(sta, WLAN_STA_SP);
  8090. +
  8091. + acked = !!(info->flags & IEEE80211_TX_STAT_ACK);
  8092. ++
  8093. ++ /* mesh Peer Service Period support */
  8094. ++ if (ieee80211_vif_is_mesh(&sta->sdata->vif) &&
  8095. ++ ieee80211_is_data_qos(fc))
  8096. ++ ieee80211_mpsp_trigger_process(
  8097. ++ ieee80211_get_qos_ctl(hdr), sta, true, acked);
  8098. ++
  8099. + if (!acked && test_sta_flag(sta, WLAN_STA_PS_STA)) {
  8100. + /*
  8101. + * The STA is in power save mode, so assume
  8102. +@@ -794,13 +801,6 @@ void ieee80211_tx_status(struct ieee8021
  8103. + return;
  8104. + }
  8105. +
  8106. +- /* mesh Peer Service Period support */
  8107. +- if (ieee80211_vif_is_mesh(&sta->sdata->vif) &&
  8108. +- ieee80211_is_data_qos(fc))
  8109. +- ieee80211_mpsp_trigger_process(
  8110. +- ieee80211_get_qos_ctl(hdr),
  8111. +- sta, true, acked);
  8112. +-
  8113. + if (ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL) &&
  8114. + (ieee80211_is_data(hdr->frame_control)) &&
  8115. + (rates_idx != -1))
  8116. diff --git a/package/kernel/mac80211/patches/332-ath10k-implement-NAPI-support.patch b/package/kernel/mac80211/patches/332-ath10k-implement-NAPI-support.patch
  8117. new file mode 100644
  8118. index 0000000..c6cc145
  8119. --- /dev/null
  8120. +++ b/package/kernel/mac80211/patches/332-ath10k-implement-NAPI-support.patch
  8121. @@ -0,0 +1,642 @@
  8122. +From: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
  8123. +Date: Thu, 21 Jul 2016 11:50:00 +0530
  8124. +Subject: [PATCH] ath10k: implement NAPI support
  8125. +
  8126. +Add NAPI support for rx and tx completion. NAPI poll is scheduled
  8127. +from interrupt handler. The design is as below
  8128. +
  8129. + - on interrupt
  8130. + - schedule napi and mask interrupts
  8131. + - on poll
  8132. + - process all pipes (no actual Tx/Rx)
  8133. + - process Rx within budget
  8134. + - if quota exceeds budget reschedule napi poll by returning budget
  8135. + - process Tx completions and update budget if necessary
  8136. + - process Tx fetch indications (pull-push)
  8137. + - push any other pending Tx (if possible)
  8138. + - before resched or napi completion replenish htt rx ring buffer
  8139. + - if work done < budget, complete napi poll and unmask interrupts
  8140. +
  8141. +This change also get rid of two tasklets (intr_tq and txrx_compl_task).
  8142. +
  8143. +Measured peak throughput with NAPI on IPQ4019 platform in controlled
  8144. +environment. No noticeable reduction in throughput is seen and also
  8145. +observed improvements in CPU usage. Approx. 15% CPU usage got reduced
  8146. +in UDP uplink case.
  8147. +
  8148. +DL: AP DUT Tx
  8149. +UL: AP DUT Rx
  8150. +
  8151. +IPQ4019 (avg. cpu usage %)
  8152. +========
  8153. + TOT +NAPI
  8154. + =========== =============
  8155. +TCP DL 644 Mbps (42%) 645 Mbps (36%)
  8156. +TCP UL 673 Mbps (30%) 675 Mbps (26%)
  8157. +UDP DL 682 Mbps (49%) 680 Mbps (49%)
  8158. +UDP UL 720 Mbps (28%) 717 Mbps (11%)
  8159. +
  8160. +Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
  8161. +---
  8162. +
  8163. +--- a/drivers/net/wireless/ath/ath10k/ahb.c
  8164. ++++ b/drivers/net/wireless/ath/ath10k/ahb.c
  8165. +@@ -462,13 +462,13 @@ static void ath10k_ahb_halt_chip(struct
  8166. + static irqreturn_t ath10k_ahb_interrupt_handler(int irq, void *arg)
  8167. + {
  8168. + struct ath10k *ar = arg;
  8169. +- struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
  8170. +
  8171. + if (!ath10k_pci_irq_pending(ar))
  8172. + return IRQ_NONE;
  8173. +
  8174. + ath10k_pci_disable_and_clear_legacy_irq(ar);
  8175. +- tasklet_schedule(&ar_pci->intr_tq);
  8176. ++ ath10k_pci_irq_msi_fw_mask(ar);
  8177. ++ napi_schedule(&ar->napi);
  8178. +
  8179. + return IRQ_HANDLED;
  8180. + }
  8181. +@@ -831,7 +831,7 @@ static int ath10k_ahb_probe(struct platf
  8182. + goto err_resource_deinit;
  8183. + }
  8184. +
  8185. +- ath10k_pci_init_irq_tasklets(ar);
  8186. ++ ath10k_pci_init_napi(ar);
  8187. +
  8188. + ret = ath10k_ahb_request_irq_legacy(ar);
  8189. + if (ret)
  8190. +--- a/drivers/net/wireless/ath/ath10k/core.c
  8191. ++++ b/drivers/net/wireless/ath/ath10k/core.c
  8192. +@@ -2226,6 +2226,8 @@ struct ath10k *ath10k_core_create(size_t
  8193. + INIT_WORK(&ar->register_work, ath10k_core_register_work);
  8194. + INIT_WORK(&ar->restart_work, ath10k_core_restart);
  8195. +
  8196. ++ init_dummy_netdev(&ar->napi_dev);
  8197. ++
  8198. + ret = ath10k_debug_create(ar);
  8199. + if (ret)
  8200. + goto err_free_aux_wq;
  8201. +--- a/drivers/net/wireless/ath/ath10k/core.h
  8202. ++++ b/drivers/net/wireless/ath/ath10k/core.h
  8203. +@@ -65,6 +65,10 @@
  8204. + #define ATH10K_KEEPALIVE_MAX_IDLE 3895
  8205. + #define ATH10K_KEEPALIVE_MAX_UNRESPONSIVE 3900
  8206. +
  8207. ++/* NAPI poll budget */
  8208. ++#define ATH10K_NAPI_BUDGET 64
  8209. ++#define ATH10K_NAPI_QUOTA_LIMIT 60
  8210. ++
  8211. + struct ath10k;
  8212. +
  8213. + enum ath10k_bus {
  8214. +@@ -933,6 +937,10 @@ struct ath10k {
  8215. + struct ath10k_thermal thermal;
  8216. + struct ath10k_wow wow;
  8217. +
  8218. ++ /* NAPI */
  8219. ++ struct net_device napi_dev;
  8220. ++ struct napi_struct napi;
  8221. ++
  8222. + /* must be last */
  8223. + u8 drv_priv[0] __aligned(sizeof(void *));
  8224. + };
  8225. +--- a/drivers/net/wireless/ath/ath10k/htt.h
  8226. ++++ b/drivers/net/wireless/ath/ath10k/htt.h
  8227. +@@ -1666,7 +1666,6 @@ struct ath10k_htt {
  8228. +
  8229. + /* This is used to group tx/rx completions separately and process them
  8230. + * in batches to reduce cache stalls */
  8231. +- struct tasklet_struct txrx_compl_task;
  8232. + struct sk_buff_head rx_compl_q;
  8233. + struct sk_buff_head rx_in_ord_compl_q;
  8234. + struct sk_buff_head tx_fetch_ind_q;
  8235. +@@ -1799,5 +1798,6 @@ int ath10k_htt_tx(struct ath10k_htt *htt
  8236. + struct sk_buff *msdu);
  8237. + void ath10k_htt_rx_pktlog_completion_handler(struct ath10k *ar,
  8238. + struct sk_buff *skb);
  8239. ++int ath10k_htt_txrx_compl_task(struct ath10k *ar, int budget);
  8240. +
  8241. + #endif
  8242. +--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
  8243. ++++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
  8244. +@@ -34,7 +34,6 @@
  8245. + #define HTT_RX_RING_REFILL_RESCHED_MS 5
  8246. +
  8247. + static int ath10k_htt_rx_get_csum_state(struct sk_buff *skb);
  8248. +-static void ath10k_htt_txrx_compl_task(unsigned long ptr);
  8249. +
  8250. + static struct sk_buff *
  8251. + ath10k_htt_rx_find_skb_paddr(struct ath10k *ar, u32 paddr)
  8252. +@@ -226,7 +225,6 @@ int ath10k_htt_rx_ring_refill(struct ath
  8253. + void ath10k_htt_rx_free(struct ath10k_htt *htt)
  8254. + {
  8255. + del_timer_sync(&htt->rx_ring.refill_retry_timer);
  8256. +- tasklet_kill(&htt->txrx_compl_task);
  8257. +
  8258. + skb_queue_purge(&htt->rx_compl_q);
  8259. + skb_queue_purge(&htt->rx_in_ord_compl_q);
  8260. +@@ -520,9 +518,6 @@ int ath10k_htt_rx_alloc(struct ath10k_ht
  8261. + skb_queue_head_init(&htt->tx_fetch_ind_q);
  8262. + atomic_set(&htt->num_mpdus_ready, 0);
  8263. +
  8264. +- tasklet_init(&htt->txrx_compl_task, ath10k_htt_txrx_compl_task,
  8265. +- (unsigned long)htt);
  8266. +-
  8267. + ath10k_dbg(ar, ATH10K_DBG_BOOT, "htt rx ring size %d fill_level %d\n",
  8268. + htt->rx_ring.size, htt->rx_ring.fill_level);
  8269. + return 0;
  8270. +@@ -958,7 +953,7 @@ static void ath10k_process_rx(struct ath
  8271. + trace_ath10k_rx_hdr(ar, skb->data, skb->len);
  8272. + trace_ath10k_rx_payload(ar, skb->data, skb->len);
  8273. +
  8274. +- ieee80211_rx(ar->hw, skb);
  8275. ++ ieee80211_rx_napi(ar->hw, NULL, skb, &ar->napi);
  8276. + }
  8277. +
  8278. + static int ath10k_htt_rx_nwifi_hdrlen(struct ath10k *ar,
  8279. +@@ -1527,7 +1522,7 @@ static int ath10k_htt_rx_handle_amsdu(st
  8280. + struct ath10k *ar = htt->ar;
  8281. + struct ieee80211_rx_status *rx_status = &htt->rx_status;
  8282. + struct sk_buff_head amsdu;
  8283. +- int ret;
  8284. ++ int ret, num_msdus;
  8285. +
  8286. + __skb_queue_head_init(&amsdu);
  8287. +
  8288. +@@ -1549,13 +1544,14 @@ static int ath10k_htt_rx_handle_amsdu(st
  8289. + return ret;
  8290. + }
  8291. +
  8292. ++ num_msdus = skb_queue_len(&amsdu);
  8293. + ath10k_htt_rx_h_ppdu(ar, &amsdu, rx_status, 0xffff);
  8294. + ath10k_htt_rx_h_unchain(ar, &amsdu, ret > 0);
  8295. + ath10k_htt_rx_h_filter(ar, &amsdu, rx_status);
  8296. + ath10k_htt_rx_h_mpdu(ar, &amsdu, rx_status);
  8297. + ath10k_htt_rx_h_deliver(ar, &amsdu, rx_status);
  8298. +
  8299. +- return 0;
  8300. ++ return num_msdus;
  8301. + }
  8302. +
  8303. + static void ath10k_htt_rx_proc_rx_ind(struct ath10k_htt *htt,
  8304. +@@ -1579,15 +1575,6 @@ static void ath10k_htt_rx_proc_rx_ind(st
  8305. + mpdu_count += mpdu_ranges[i].mpdu_count;
  8306. +
  8307. + atomic_add(mpdu_count, &htt->num_mpdus_ready);
  8308. +-
  8309. +- tasklet_schedule(&htt->txrx_compl_task);
  8310. +-}
  8311. +-
  8312. +-static void ath10k_htt_rx_frag_handler(struct ath10k_htt *htt)
  8313. +-{
  8314. +- atomic_inc(&htt->num_mpdus_ready);
  8315. +-
  8316. +- tasklet_schedule(&htt->txrx_compl_task);
  8317. + }
  8318. +
  8319. + static void ath10k_htt_rx_tx_compl_ind(struct ath10k *ar,
  8320. +@@ -1772,14 +1759,15 @@ static void ath10k_htt_rx_h_rx_offload_p
  8321. + RX_FLAG_MMIC_STRIPPED;
  8322. + }
  8323. +
  8324. +-static void ath10k_htt_rx_h_rx_offload(struct ath10k *ar,
  8325. +- struct sk_buff_head *list)
  8326. ++static int ath10k_htt_rx_h_rx_offload(struct ath10k *ar,
  8327. ++ struct sk_buff_head *list)
  8328. + {
  8329. + struct ath10k_htt *htt = &ar->htt;
  8330. + struct ieee80211_rx_status *status = &htt->rx_status;
  8331. + struct htt_rx_offload_msdu *rx;
  8332. + struct sk_buff *msdu;
  8333. + size_t offset;
  8334. ++ int num_msdu = 0;
  8335. +
  8336. + while ((msdu = __skb_dequeue(list))) {
  8337. + /* Offloaded frames don't have Rx descriptor. Instead they have
  8338. +@@ -1819,10 +1807,12 @@ static void ath10k_htt_rx_h_rx_offload(s
  8339. + ath10k_htt_rx_h_rx_offload_prot(status, msdu);
  8340. + ath10k_htt_rx_h_channel(ar, status, NULL, rx->vdev_id);
  8341. + ath10k_process_rx(ar, status, msdu);
  8342. ++ num_msdu++;
  8343. + }
  8344. ++ return num_msdu;
  8345. + }
  8346. +
  8347. +-static void ath10k_htt_rx_in_ord_ind(struct ath10k *ar, struct sk_buff *skb)
  8348. ++static int ath10k_htt_rx_in_ord_ind(struct ath10k *ar, struct sk_buff *skb)
  8349. + {
  8350. + struct ath10k_htt *htt = &ar->htt;
  8351. + struct htt_resp *resp = (void *)skb->data;
  8352. +@@ -1835,12 +1825,12 @@ static void ath10k_htt_rx_in_ord_ind(str
  8353. + u8 tid;
  8354. + bool offload;
  8355. + bool frag;
  8356. +- int ret;
  8357. ++ int ret, num_msdus = 0;
  8358. +
  8359. + lockdep_assert_held(&htt->rx_ring.lock);
  8360. +
  8361. + if (htt->rx_confused)
  8362. +- return;
  8363. ++ return -EIO;
  8364. +
  8365. + skb_pull(skb, sizeof(resp->hdr));
  8366. + skb_pull(skb, sizeof(resp->rx_in_ord_ind));
  8367. +@@ -1859,7 +1849,7 @@ static void ath10k_htt_rx_in_ord_ind(str
  8368. +
  8369. + if (skb->len < msdu_count * sizeof(*resp->rx_in_ord_ind.msdu_descs)) {
  8370. + ath10k_warn(ar, "dropping invalid in order rx indication\n");
  8371. +- return;
  8372. ++ return -EINVAL;
  8373. + }
  8374. +
  8375. + /* The event can deliver more than 1 A-MSDU. Each A-MSDU is later
  8376. +@@ -1870,14 +1860,14 @@ static void ath10k_htt_rx_in_ord_ind(str
  8377. + if (ret < 0) {
  8378. + ath10k_warn(ar, "failed to pop paddr list: %d\n", ret);
  8379. + htt->rx_confused = true;
  8380. +- return;
  8381. ++ return -EIO;
  8382. + }
  8383. +
  8384. + /* Offloaded frames are very different and need to be handled
  8385. + * separately.
  8386. + */
  8387. + if (offload)
  8388. +- ath10k_htt_rx_h_rx_offload(ar, &list);
  8389. ++ num_msdus = ath10k_htt_rx_h_rx_offload(ar, &list);
  8390. +
  8391. + while (!skb_queue_empty(&list)) {
  8392. + __skb_queue_head_init(&amsdu);
  8393. +@@ -1890,6 +1880,7 @@ static void ath10k_htt_rx_in_ord_ind(str
  8394. + * better to report something than nothing though. This
  8395. + * should still give an idea about rx rate to the user.
  8396. + */
  8397. ++ num_msdus += skb_queue_len(&amsdu);
  8398. + ath10k_htt_rx_h_ppdu(ar, &amsdu, status, vdev_id);
  8399. + ath10k_htt_rx_h_filter(ar, &amsdu, status);
  8400. + ath10k_htt_rx_h_mpdu(ar, &amsdu, status);
  8401. +@@ -1902,9 +1893,10 @@ static void ath10k_htt_rx_in_ord_ind(str
  8402. + ath10k_warn(ar, "failed to extract amsdu: %d\n", ret);
  8403. + htt->rx_confused = true;
  8404. + __skb_queue_purge(&list);
  8405. +- return;
  8406. ++ return -EIO;
  8407. + }
  8408. + }
  8409. ++ return num_msdus;
  8410. + }
  8411. +
  8412. + static void ath10k_htt_rx_tx_fetch_resp_id_confirm(struct ath10k *ar,
  8413. +@@ -2267,7 +2259,6 @@ bool ath10k_htt_t2h_msg_handler(struct a
  8414. + }
  8415. + case HTT_T2H_MSG_TYPE_TX_COMPL_IND:
  8416. + ath10k_htt_rx_tx_compl_ind(htt->ar, skb);
  8417. +- tasklet_schedule(&htt->txrx_compl_task);
  8418. + break;
  8419. + case HTT_T2H_MSG_TYPE_SEC_IND: {
  8420. + struct ath10k *ar = htt->ar;
  8421. +@@ -2284,7 +2275,7 @@ bool ath10k_htt_t2h_msg_handler(struct a
  8422. + case HTT_T2H_MSG_TYPE_RX_FRAG_IND: {
  8423. + ath10k_dbg_dump(ar, ATH10K_DBG_HTT_DUMP, NULL, "htt event: ",
  8424. + skb->data, skb->len);
  8425. +- ath10k_htt_rx_frag_handler(htt);
  8426. ++ atomic_inc(&htt->num_mpdus_ready);
  8427. + break;
  8428. + }
  8429. + case HTT_T2H_MSG_TYPE_TEST:
  8430. +@@ -2322,8 +2313,7 @@ bool ath10k_htt_t2h_msg_handler(struct a
  8431. + break;
  8432. + }
  8433. + case HTT_T2H_MSG_TYPE_RX_IN_ORD_PADDR_IND: {
  8434. +- skb_queue_tail(&htt->rx_in_ord_compl_q, skb);
  8435. +- tasklet_schedule(&htt->txrx_compl_task);
  8436. ++ __skb_queue_tail(&htt->rx_in_ord_compl_q, skb);
  8437. + return false;
  8438. + }
  8439. + case HTT_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND:
  8440. +@@ -2349,7 +2339,6 @@ bool ath10k_htt_t2h_msg_handler(struct a
  8441. + break;
  8442. + }
  8443. + skb_queue_tail(&htt->tx_fetch_ind_q, tx_fetch_ind);
  8444. +- tasklet_schedule(&htt->txrx_compl_task);
  8445. + break;
  8446. + }
  8447. + case HTT_T2H_MSG_TYPE_TX_FETCH_CONFIRM:
  8448. +@@ -2378,27 +2367,77 @@ void ath10k_htt_rx_pktlog_completion_han
  8449. + }
  8450. + EXPORT_SYMBOL(ath10k_htt_rx_pktlog_completion_handler);
  8451. +
  8452. +-static void ath10k_htt_txrx_compl_task(unsigned long ptr)
  8453. ++int ath10k_htt_txrx_compl_task(struct ath10k *ar, int budget)
  8454. + {
  8455. +- struct ath10k_htt *htt = (struct ath10k_htt *)ptr;
  8456. +- struct ath10k *ar = htt->ar;
  8457. ++ struct ath10k_htt *htt = &ar->htt;
  8458. + struct htt_tx_done tx_done = {};
  8459. +- struct sk_buff_head rx_ind_q;
  8460. + struct sk_buff_head tx_ind_q;
  8461. + struct sk_buff *skb;
  8462. + unsigned long flags;
  8463. +- int num_mpdus;
  8464. ++ int quota = 0, done, num_rx_msdus;
  8465. ++ bool resched_napi = false;
  8466. +
  8467. +- __skb_queue_head_init(&rx_ind_q);
  8468. + __skb_queue_head_init(&tx_ind_q);
  8469. +
  8470. +- spin_lock_irqsave(&htt->rx_in_ord_compl_q.lock, flags);
  8471. +- skb_queue_splice_init(&htt->rx_in_ord_compl_q, &rx_ind_q);
  8472. +- spin_unlock_irqrestore(&htt->rx_in_ord_compl_q.lock, flags);
  8473. ++ /* Since in-ord-ind can deliver more than 1 A-MSDU in single event,
  8474. ++ * process it first to utilize full available quota.
  8475. ++ */
  8476. ++ while (quota < budget) {
  8477. ++ if (skb_queue_empty(&htt->rx_in_ord_compl_q))
  8478. ++ break;
  8479. +
  8480. +- spin_lock_irqsave(&htt->tx_fetch_ind_q.lock, flags);
  8481. +- skb_queue_splice_init(&htt->tx_fetch_ind_q, &tx_ind_q);
  8482. +- spin_unlock_irqrestore(&htt->tx_fetch_ind_q.lock, flags);
  8483. ++ skb = __skb_dequeue(&htt->rx_in_ord_compl_q);
  8484. ++ if (!skb) {
  8485. ++ resched_napi = true;
  8486. ++ goto exit;
  8487. ++ }
  8488. ++
  8489. ++ spin_lock_bh(&htt->rx_ring.lock);
  8490. ++ num_rx_msdus = ath10k_htt_rx_in_ord_ind(ar, skb);
  8491. ++ spin_unlock_bh(&htt->rx_ring.lock);
  8492. ++ if (num_rx_msdus < 0) {
  8493. ++ resched_napi = true;
  8494. ++ goto exit;
  8495. ++ }
  8496. ++
  8497. ++ dev_kfree_skb_any(skb);
  8498. ++ if (num_rx_msdus > 0)
  8499. ++ quota += num_rx_msdus;
  8500. ++
  8501. ++ if ((quota > ATH10K_NAPI_QUOTA_LIMIT) &&
  8502. ++ !skb_queue_empty(&htt->rx_in_ord_compl_q)) {
  8503. ++ resched_napi = true;
  8504. ++ goto exit;
  8505. ++ }
  8506. ++ }
  8507. ++
  8508. ++ while (quota < budget) {
  8509. ++ /* no more data to receive */
  8510. ++ if (!atomic_read(&htt->num_mpdus_ready))
  8511. ++ break;
  8512. ++
  8513. ++ num_rx_msdus = ath10k_htt_rx_handle_amsdu(htt);
  8514. ++ if (num_rx_msdus < 0) {
  8515. ++ resched_napi = true;
  8516. ++ goto exit;
  8517. ++ }
  8518. ++
  8519. ++ quota += num_rx_msdus;
  8520. ++ atomic_dec(&htt->num_mpdus_ready);
  8521. ++ if ((quota > ATH10K_NAPI_QUOTA_LIMIT) &&
  8522. ++ atomic_read(&htt->num_mpdus_ready)) {
  8523. ++ resched_napi = true;
  8524. ++ goto exit;
  8525. ++ }
  8526. ++ }
  8527. ++
  8528. ++ /* From NAPI documentation:
  8529. ++ * The napi poll() function may also process TX completions, in which
  8530. ++ * case if it processes the entire TX ring then it should count that
  8531. ++ * work as the rest of the budget.
  8532. ++ */
  8533. ++ if ((quota < budget) && !kfifo_is_empty(&htt->txdone_fifo))
  8534. ++ quota = budget;
  8535. +
  8536. + /* kfifo_get: called only within txrx_tasklet so it's neatly serialized.
  8537. + * From kfifo_get() documentation:
  8538. +@@ -2408,27 +2447,22 @@ static void ath10k_htt_txrx_compl_task(u
  8539. + while (kfifo_get(&htt->txdone_fifo, &tx_done))
  8540. + ath10k_txrx_tx_unref(htt, &tx_done);
  8541. +
  8542. ++ spin_lock_irqsave(&htt->tx_fetch_ind_q.lock, flags);
  8543. ++ skb_queue_splice_init(&htt->tx_fetch_ind_q, &tx_ind_q);
  8544. ++ spin_unlock_irqrestore(&htt->tx_fetch_ind_q.lock, flags);
  8545. ++
  8546. + while ((skb = __skb_dequeue(&tx_ind_q))) {
  8547. + ath10k_htt_rx_tx_fetch_ind(ar, skb);
  8548. + dev_kfree_skb_any(skb);
  8549. + }
  8550. +
  8551. +- num_mpdus = atomic_read(&htt->num_mpdus_ready);
  8552. +-
  8553. +- while (num_mpdus) {
  8554. +- if (ath10k_htt_rx_handle_amsdu(htt))
  8555. +- break;
  8556. +-
  8557. +- num_mpdus--;
  8558. +- atomic_dec(&htt->num_mpdus_ready);
  8559. +- }
  8560. +-
  8561. +- while ((skb = __skb_dequeue(&rx_ind_q))) {
  8562. +- spin_lock_bh(&htt->rx_ring.lock);
  8563. +- ath10k_htt_rx_in_ord_ind(ar, skb);
  8564. +- spin_unlock_bh(&htt->rx_ring.lock);
  8565. +- dev_kfree_skb_any(skb);
  8566. +- }
  8567. +-
  8568. ++exit:
  8569. + ath10k_htt_rx_msdu_buff_replenish(htt);
  8570. ++ /* In case of rx failure or more data to read, report budget
  8571. ++ * to reschedule NAPI poll
  8572. ++ */
  8573. ++ done = resched_napi ? budget : quota;
  8574. ++
  8575. ++ return done;
  8576. + }
  8577. ++EXPORT_SYMBOL(ath10k_htt_txrx_compl_task);
  8578. +--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
  8579. ++++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
  8580. +@@ -388,8 +388,6 @@ void ath10k_htt_tx_free(struct ath10k_ht
  8581. + {
  8582. + int size;
  8583. +
  8584. +- tasklet_kill(&htt->txrx_compl_task);
  8585. +-
  8586. + idr_for_each(&htt->pending_tx, ath10k_htt_tx_clean_up_pending, htt->ar);
  8587. + idr_destroy(&htt->pending_tx);
  8588. +
  8589. +--- a/drivers/net/wireless/ath/ath10k/pci.c
  8590. ++++ b/drivers/net/wireless/ath/ath10k/pci.c
  8591. +@@ -1502,12 +1502,10 @@ void ath10k_pci_hif_send_complete_check(
  8592. + ath10k_ce_per_engine_service(ar, pipe);
  8593. + }
  8594. +
  8595. +-void ath10k_pci_kill_tasklet(struct ath10k *ar)
  8596. ++static void ath10k_pci_rx_retry_sync(struct ath10k *ar)
  8597. + {
  8598. + struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
  8599. +
  8600. +- tasklet_kill(&ar_pci->intr_tq);
  8601. +-
  8602. + del_timer_sync(&ar_pci->rx_post_retry);
  8603. + }
  8604. +
  8605. +@@ -1566,7 +1564,7 @@ void ath10k_pci_hif_get_default_pipe(str
  8606. + ul_pipe, dl_pipe);
  8607. + }
  8608. +
  8609. +-static void ath10k_pci_irq_msi_fw_mask(struct ath10k *ar)
  8610. ++void ath10k_pci_irq_msi_fw_mask(struct ath10k *ar)
  8611. + {
  8612. + u32 val;
  8613. +
  8614. +@@ -1747,7 +1745,7 @@ void ath10k_pci_ce_deinit(struct ath10k
  8615. +
  8616. + void ath10k_pci_flush(struct ath10k *ar)
  8617. + {
  8618. +- ath10k_pci_kill_tasklet(ar);
  8619. ++ ath10k_pci_rx_retry_sync(ar);
  8620. + ath10k_pci_buffer_cleanup(ar);
  8621. + }
  8622. +
  8623. +@@ -2754,35 +2752,53 @@ static irqreturn_t ath10k_pci_interrupt_
  8624. + return IRQ_NONE;
  8625. + }
  8626. +
  8627. +- if (ar_pci->oper_irq_mode == ATH10K_PCI_IRQ_LEGACY) {
  8628. +- if (!ath10k_pci_irq_pending(ar))
  8629. +- return IRQ_NONE;
  8630. +-
  8631. +- ath10k_pci_disable_and_clear_legacy_irq(ar);
  8632. +- }
  8633. ++ if ((ar_pci->oper_irq_mode == ATH10K_PCI_IRQ_LEGACY) &&
  8634. ++ !ath10k_pci_irq_pending(ar))
  8635. ++ return IRQ_NONE;
  8636. +
  8637. +- tasklet_schedule(&ar_pci->intr_tq);
  8638. ++ ath10k_pci_disable_and_clear_legacy_irq(ar);
  8639. ++ ath10k_pci_irq_msi_fw_mask(ar);
  8640. ++ napi_schedule(&ar->napi);
  8641. +
  8642. + return IRQ_HANDLED;
  8643. + }
  8644. +
  8645. +-static void ath10k_pci_tasklet(unsigned long data)
  8646. ++static int ath10k_pci_napi_poll(struct napi_struct *ctx, int budget)
  8647. + {
  8648. +- struct ath10k *ar = (struct ath10k *)data;
  8649. +- struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
  8650. ++ struct ath10k *ar = container_of(ctx, struct ath10k, napi);
  8651. ++ int done = 0;
  8652. +
  8653. + if (ath10k_pci_has_fw_crashed(ar)) {
  8654. +- ath10k_pci_irq_disable(ar);
  8655. + ath10k_pci_fw_crashed_clear(ar);
  8656. + ath10k_pci_fw_crashed_dump(ar);
  8657. +- return;
  8658. ++ napi_complete(ctx);
  8659. ++ return done;
  8660. + }
  8661. +
  8662. + ath10k_ce_per_engine_service_any(ar);
  8663. +
  8664. +- /* Re-enable legacy irq that was disabled in the irq handler */
  8665. +- if (ar_pci->oper_irq_mode == ATH10K_PCI_IRQ_LEGACY)
  8666. ++ done = ath10k_htt_txrx_compl_task(ar, budget);
  8667. ++
  8668. ++ if (done < budget) {
  8669. ++ napi_complete(ctx);
  8670. ++ /* In case of MSI, it is possible that interrupts are received
  8671. ++ * while NAPI poll is inprogress. So pending interrupts that are
  8672. ++ * received after processing all copy engine pipes by NAPI poll
  8673. ++ * will not be handled again. This is causing failure to
  8674. ++ * complete boot sequence in x86 platform. So before enabling
  8675. ++ * interrupts safer to check for pending interrupts for
  8676. ++ * immediate servicing.
  8677. ++ */
  8678. ++ if (CE_INTERRUPT_SUMMARY(ar)) {
  8679. ++ napi_reschedule(&ar->napi);
  8680. ++ goto out;
  8681. ++ }
  8682. + ath10k_pci_enable_legacy_irq(ar);
  8683. ++ ath10k_pci_irq_msi_fw_unmask(ar);
  8684. ++ }
  8685. ++
  8686. ++out:
  8687. ++ return done;
  8688. + }
  8689. +
  8690. + static int ath10k_pci_request_irq_msi(struct ath10k *ar)
  8691. +@@ -2840,11 +2856,11 @@ static void ath10k_pci_free_irq(struct a
  8692. + free_irq(ar_pci->pdev->irq, ar);
  8693. + }
  8694. +
  8695. +-void ath10k_pci_init_irq_tasklets(struct ath10k *ar)
  8696. ++void ath10k_pci_init_napi(struct ath10k *ar)
  8697. + {
  8698. +- struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
  8699. +-
  8700. +- tasklet_init(&ar_pci->intr_tq, ath10k_pci_tasklet, (unsigned long)ar);
  8701. ++ netif_napi_add(&ar->napi_dev, &ar->napi, ath10k_pci_napi_poll,
  8702. ++ ATH10K_NAPI_BUDGET);
  8703. ++ napi_enable(&ar->napi);
  8704. + }
  8705. +
  8706. + static int ath10k_pci_init_irq(struct ath10k *ar)
  8707. +@@ -2852,7 +2868,7 @@ static int ath10k_pci_init_irq(struct at
  8708. + struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
  8709. + int ret;
  8710. +
  8711. +- ath10k_pci_init_irq_tasklets(ar);
  8712. ++ ath10k_pci_init_napi(ar);
  8713. +
  8714. + if (ath10k_pci_irq_mode != ATH10K_PCI_IRQ_AUTO)
  8715. + ath10k_info(ar, "limiting irq mode to: %d\n",
  8716. +@@ -3113,7 +3129,8 @@ int ath10k_pci_setup_resource(struct ath
  8717. +
  8718. + void ath10k_pci_release_resource(struct ath10k *ar)
  8719. + {
  8720. +- ath10k_pci_kill_tasklet(ar);
  8721. ++ ath10k_pci_rx_retry_sync(ar);
  8722. ++ netif_napi_del(&ar->napi);
  8723. + ath10k_pci_ce_deinit(ar);
  8724. + ath10k_pci_free_pipes(ar);
  8725. + }
  8726. +@@ -3274,7 +3291,7 @@ static int ath10k_pci_probe(struct pci_d
  8727. +
  8728. + err_free_irq:
  8729. + ath10k_pci_free_irq(ar);
  8730. +- ath10k_pci_kill_tasklet(ar);
  8731. ++ ath10k_pci_rx_retry_sync(ar);
  8732. +
  8733. + err_deinit_irq:
  8734. + ath10k_pci_deinit_irq(ar);
  8735. +--- a/drivers/net/wireless/ath/ath10k/pci.h
  8736. ++++ b/drivers/net/wireless/ath/ath10k/pci.h
  8737. +@@ -177,8 +177,6 @@ struct ath10k_pci {
  8738. + /* Operating interrupt mode */
  8739. + enum ath10k_pci_irq_mode oper_irq_mode;
  8740. +
  8741. +- struct tasklet_struct intr_tq;
  8742. +-
  8743. + struct ath10k_pci_pipe pipe_info[CE_COUNT_MAX];
  8744. +
  8745. + /* Copy Engine used for Diagnostic Accesses */
  8746. +@@ -294,8 +292,7 @@ void ath10k_pci_free_pipes(struct ath10k
  8747. + void ath10k_pci_free_pipes(struct ath10k *ar);
  8748. + void ath10k_pci_rx_replenish_retry(unsigned long ptr);
  8749. + void ath10k_pci_ce_deinit(struct ath10k *ar);
  8750. +-void ath10k_pci_init_irq_tasklets(struct ath10k *ar);
  8751. +-void ath10k_pci_kill_tasklet(struct ath10k *ar);
  8752. ++void ath10k_pci_init_napi(struct ath10k *ar);
  8753. + int ath10k_pci_init_pipes(struct ath10k *ar);
  8754. + int ath10k_pci_init_config(struct ath10k *ar);
  8755. + void ath10k_pci_rx_post(struct ath10k *ar);
  8756. +@@ -303,6 +300,7 @@ void ath10k_pci_flush(struct ath10k *ar)
  8757. + void ath10k_pci_enable_legacy_irq(struct ath10k *ar);
  8758. + bool ath10k_pci_irq_pending(struct ath10k *ar);
  8759. + void ath10k_pci_disable_and_clear_legacy_irq(struct ath10k *ar);
  8760. ++void ath10k_pci_irq_msi_fw_mask(struct ath10k *ar);
  8761. + int ath10k_pci_wait_for_target_init(struct ath10k *ar);
  8762. + int ath10k_pci_setup_resource(struct ath10k *ar);
  8763. + void ath10k_pci_release_resource(struct ath10k *ar);
  8764. diff --git a/package/kernel/mac80211/patches/332-cfg80211-fix-faulty-variable-initialization-in-ieee8.patch b/package/kernel/mac80211/patches/332-cfg80211-fix-faulty-variable-initialization-in-ieee8.patch
  8765. deleted file mode 100644
  8766. index e414f23..0000000
  8767. --- a/package/kernel/mac80211/patches/332-cfg80211-fix-faulty-variable-initialization-in-ieee8.patch
  8768. +++ /dev/null
  8769. @@ -1,22 +0,0 @@
  8770. -From: Felix Fietkau <nbd@openwrt.org>
  8771. -Date: Mon, 8 Feb 2016 14:24:36 +0100
  8772. -Subject: [PATCH] cfg80211: fix faulty variable initialization in
  8773. - ieee80211_amsdu_to_8023s
  8774. -
  8775. -reuse_skb is set to true if the code decides to use the last segment.
  8776. -Fixes a memory leak
  8777. -
  8778. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  8779. ----
  8780. -
  8781. ---- a/net/wireless/util.c
  8782. -+++ b/net/wireless/util.c
  8783. -@@ -676,7 +676,7 @@ void ieee80211_amsdu_to_8023s(struct sk_
  8784. - u8 *payload;
  8785. - int offset = 0, remaining, err;
  8786. - struct ethhdr eth;
  8787. -- bool reuse_skb = true;
  8788. -+ bool reuse_skb = false;
  8789. - bool last = false;
  8790. -
  8791. - if (has_80211_header) {
  8792. diff --git a/package/kernel/mac80211/patches/333-ath9k-fix-client-mode-beacon-configuration.patch b/package/kernel/mac80211/patches/333-ath9k-fix-client-mode-beacon-configuration.patch
  8793. new file mode 100644
  8794. index 0000000..d008ceb
  8795. --- /dev/null
  8796. +++ b/package/kernel/mac80211/patches/333-ath9k-fix-client-mode-beacon-configuration.patch
  8797. @@ -0,0 +1,69 @@
  8798. +From: Felix Fietkau <nbd@nbd.name>
  8799. +Date: Tue, 26 Jul 2016 08:05:10 +0200
  8800. +Subject: [PATCH] ath9k: fix client mode beacon configuration
  8801. +
  8802. +For pure station mode, iter_data.primary_beacon_vif was used and passed
  8803. +to ath_beacon_config, but not set to the station vif.
  8804. +This was causing the following warning:
  8805. +
  8806. +[ 100.310919] ------------[ cut here ]------------
  8807. +[ 100.315683] WARNING: CPU: 0 PID: 7 at compat-wireless-2016-06-20/drivers/net/wireless/ath/ath9k/beacon.c:642 ath9k_calculate_summary_state+0x250/0x60c [ath9k]()
  8808. +[ 100.402028] CPU: 0 PID: 7 Comm: kworker/u2:1 Tainted: G W 4.4.15 #5
  8809. +[ 100.409676] Workqueue: phy0 ieee80211_ibss_leave [mac80211]
  8810. +[ 100.415351] Stack : 8736e98c 870b4b20 87a25b54 800a6800 8782a080 80400d63 8039b96c 00000007
  8811. +[ 100.415351] 803c5edc 87875914 80400000 800a47cc 87a25b54 800a6800 803a0fd8 80400000
  8812. +[ 100.415351] 00000003 87875914 80400000 80094ae0 87a25b54 8787594c 00000000 801ef308
  8813. +[ 100.415351] 803ffe70 801ef300 87193d58 87b3a400 87b3ad00 70687930 00000000 00000000
  8814. +[ 100.415351] 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  8815. +[ 100.415351] ...
  8816. +[ 100.451703] Call Trace:
  8817. +[ 100.454235] [<800a6800>] vprintk_default+0x24/0x30
  8818. +[ 100.459110] [<800a47cc>] printk+0x2c/0x38
  8819. +[ 100.463190] [<800a6800>] vprintk_default+0x24/0x30
  8820. +[ 100.468072] [<80094ae0>] print_worker_info+0x148/0x174
  8821. +[ 100.473378] [<801ef308>] serial8250_console_putchar+0x0/0x44
  8822. +[ 100.479122] [<801ef300>] wait_for_xmitr+0xc4/0xcc
  8823. +[ 100.484014] [<87193d58>] ieee80211_ibss_leave+0xb90/0x1900 [mac80211]
  8824. +[ 100.490590] [<80081604>] warn_slowpath_common+0xa0/0xd0
  8825. +[ 100.495922] [<801a359c>] dump_stack+0x14/0x28
  8826. +[ 100.500350] [<80071a00>] show_stack+0x50/0x84
  8827. +[ 100.504784] [<80081604>] warn_slowpath_common+0xa0/0xd0
  8828. +[ 100.510106] [<87024c60>] ath9k_calculate_summary_state+0x250/0x60c [ath9k]
  8829. +[ 100.517105] [<800816b8>] warn_slowpath_null+0x18/0x24
  8830. +[ 100.522256] [<87024c60>] ath9k_calculate_summary_state+0x250/0x60c [ath9k]
  8831. +[ 100.529273] [<87025418>] ath9k_set_txpower+0x148/0x498 [ath9k]
  8832. +[ 100.535302] [<871d2c64>] cleanup_module+0xa74/0xd4c [mac80211]
  8833. +[ 100.541237] [<801ef308>] serial8250_console_putchar+0x0/0x44
  8834. +[ 100.547042] [<800a5d18>] wake_up_klogd+0x54/0x68
  8835. +[ 100.551730] [<800a6650>] vprintk_emit+0x404/0x43c
  8836. +[ 100.556623] [<871b9db8>] ieee80211_sta_rx_notify+0x258/0x32c [mac80211]
  8837. +[ 100.563475] [<871ba6a4>] ieee80211_sta_rx_queued_mgmt+0x63c/0x734 [mac80211]
  8838. +[ 100.570693] [<871aa49c>] ieee80211_tx_prepare_skb+0x210/0x230 [mac80211]
  8839. +[ 100.577609] [<800af5d4>] mod_timer+0x15c/0x190
  8840. +[ 100.582220] [<871ba8b8>] ieee80211_sta_work+0xfc/0xe1c [mac80211]
  8841. +[ 100.588539] [<871940b4>] ieee80211_ibss_leave+0xeec/0x1900 [mac80211]
  8842. +[ 100.595122] [<8009ec84>] dequeue_task_fair+0x44/0x130
  8843. +[ 100.600281] [<80092a34>] process_one_work+0x1f8/0x334
  8844. +[ 100.605454] [<80093830>] worker_thread+0x2b4/0x408
  8845. +[ 100.610317] [<8009357c>] worker_thread+0x0/0x408
  8846. +[ 100.615019] [<8009357c>] worker_thread+0x0/0x408
  8847. +[ 100.619705] [<80097b68>] kthread+0xdc/0xe8
  8848. +[ 100.623886] [<80097a8c>] kthread+0x0/0xe8
  8849. +[ 100.627961] [<80060878>] ret_from_kernel_thread+0x14/0x1c
  8850. +[ 100.633448]
  8851. +[ 100.634956] ---[ end trace aafbe57e9ae6862f ]---
  8852. +
  8853. +Fixes: cfda2d8e2314 ("ath9k: Fix beacon configuration for addition/removal of interfaces")
  8854. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  8855. +---
  8856. +
  8857. +--- a/drivers/net/wireless/ath/ath9k/main.c
  8858. ++++ b/drivers/net/wireless/ath/ath9k/main.c
  8859. +@@ -1154,6 +1154,7 @@ void ath9k_calculate_summary_state(struc
  8860. + bool changed = (iter_data.primary_sta != ctx->primary_sta);
  8861. +
  8862. + if (iter_data.primary_sta) {
  8863. ++ iter_data.primary_beacon_vif = iter_data.primary_sta;
  8864. + iter_data.beacons = true;
  8865. + ath9k_set_assoc_state(sc, iter_data.primary_sta,
  8866. + changed);
  8867. diff --git a/package/kernel/mac80211/patches/333-cfg80211-reuse-existing-page-fragments-in-A-MSDU-rx.patch b/package/kernel/mac80211/patches/333-cfg80211-reuse-existing-page-fragments-in-A-MSDU-rx.patch
  8868. deleted file mode 100644
  8869. index 6e2d0cf..0000000
  8870. --- a/package/kernel/mac80211/patches/333-cfg80211-reuse-existing-page-fragments-in-A-MSDU-rx.patch
  8871. +++ /dev/null
  8872. @@ -1,132 +0,0 @@
  8873. -From: Felix Fietkau <nbd@openwrt.org>
  8874. -Date: Mon, 8 Feb 2016 14:33:19 +0100
  8875. -Subject: [PATCH] cfg80211: reuse existing page fragments in A-MSDU rx
  8876. -
  8877. -This massively reduces data copying and thus improves rx performance
  8878. -
  8879. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  8880. ----
  8881. -
  8882. ---- a/net/wireless/util.c
  8883. -+++ b/net/wireless/util.c
  8884. -@@ -644,23 +644,93 @@ int ieee80211_data_from_8023(struct sk_b
  8885. - }
  8886. - EXPORT_SYMBOL(ieee80211_data_from_8023);
  8887. -
  8888. -+static void
  8889. -+__frame_add_frag(struct sk_buff *skb, struct page *page,
  8890. -+ void *ptr, int len, int size)
  8891. -+{
  8892. -+ struct skb_shared_info *sh = skb_shinfo(skb);
  8893. -+ int page_offset;
  8894. -+
  8895. -+ atomic_inc(&page->_count);
  8896. -+ page_offset = ptr - page_address(page);
  8897. -+ skb_add_rx_frag(skb, sh->nr_frags, page, page_offset, len, size);
  8898. -+}
  8899. -+
  8900. -+static void
  8901. -+__ieee80211_amsdu_copy_frag(struct sk_buff *skb, struct sk_buff *frame,
  8902. -+ int offset, int len)
  8903. -+{
  8904. -+ struct skb_shared_info *sh = skb_shinfo(skb);
  8905. -+ const skb_frag_t *frag = &sh->frags[-1];
  8906. -+ struct page *frag_page;
  8907. -+ void *frag_ptr;
  8908. -+ int frag_len, frag_size;
  8909. -+ int head_size = skb->len - skb->data_len;
  8910. -+ int cur_len;
  8911. -+
  8912. -+ frag_page = virt_to_head_page(skb->head);
  8913. -+ frag_ptr = skb->data;
  8914. -+ frag_size = head_size;
  8915. -+
  8916. -+ while (offset >= frag_size) {
  8917. -+ offset -= frag_size;
  8918. -+ frag++;
  8919. -+ frag_page = skb_frag_page(frag);
  8920. -+ frag_ptr = skb_frag_address(frag);
  8921. -+ frag_size = skb_frag_size(frag);
  8922. -+ }
  8923. -+
  8924. -+ frag_ptr += offset;
  8925. -+ frag_len = frag_size - offset;
  8926. -+
  8927. -+ cur_len = min(len, frag_len);
  8928. -+
  8929. -+ __frame_add_frag(frame, frag_page, frag_ptr, cur_len, frag_size);
  8930. -+ len -= cur_len;
  8931. -+
  8932. -+ while (len > 0) {
  8933. -+ frag++;
  8934. -+ frag_len = skb_frag_size(frag);
  8935. -+ cur_len = min(len, frag_len);
  8936. -+ __frame_add_frag(frame, skb_frag_page(frag),
  8937. -+ skb_frag_address(frag), cur_len, frag_len);
  8938. -+ len -= cur_len;
  8939. -+ }
  8940. -+}
  8941. -+
  8942. - static struct sk_buff *
  8943. - __ieee80211_amsdu_copy(struct sk_buff *skb, unsigned int hlen,
  8944. -- int offset, int len)
  8945. -+ int offset, int len, bool reuse_frag)
  8946. - {
  8947. - struct sk_buff *frame;
  8948. -+ int cur_len = len;
  8949. -
  8950. - if (skb->len - offset < len)
  8951. - return NULL;
  8952. -
  8953. - /*
  8954. -+ * When reusing framents, copy some data to the head to simplify
  8955. -+ * ethernet header handling and speed up protocol header processing
  8956. -+ * in the stack later.
  8957. -+ */
  8958. -+ if (reuse_frag)
  8959. -+ cur_len = min_t(int, len, 32);
  8960. -+
  8961. -+ /*
  8962. - * Allocate and reserve two bytes more for payload
  8963. - * alignment since sizeof(struct ethhdr) is 14.
  8964. - */
  8965. -- frame = dev_alloc_skb(hlen + sizeof(struct ethhdr) + 2 + len);
  8966. -+ frame = dev_alloc_skb(hlen + sizeof(struct ethhdr) + 2 + cur_len);
  8967. -
  8968. - skb_reserve(frame, hlen + sizeof(struct ethhdr) + 2);
  8969. -- skb_copy_bits(skb, offset, skb_put(frame, len), len);
  8970. -+ skb_copy_bits(skb, offset, skb_put(frame, cur_len), cur_len);
  8971. -+
  8972. -+ len -= cur_len;
  8973. -+ if (!len)
  8974. -+ return frame;
  8975. -+
  8976. -+ offset += cur_len;
  8977. -+ __ieee80211_amsdu_copy_frag(skb, frame, offset, len);
  8978. -
  8979. - return frame;
  8980. - }
  8981. -@@ -676,6 +746,7 @@ void ieee80211_amsdu_to_8023s(struct sk_
  8982. - u8 *payload;
  8983. - int offset = 0, remaining, err;
  8984. - struct ethhdr eth;
  8985. -+ bool reuse_frag = skb->head_frag && !skb_has_frag_list(skb);
  8986. - bool reuse_skb = false;
  8987. - bool last = false;
  8988. -
  8989. -@@ -703,12 +774,13 @@ void ieee80211_amsdu_to_8023s(struct sk_
  8990. - offset += sizeof(struct ethhdr);
  8991. - /* reuse skb for the last subframe */
  8992. - last = remaining <= subframe_len + padding;
  8993. -- if (!skb_is_nonlinear(skb) && last) {
  8994. -+ if (!skb_is_nonlinear(skb) && !reuse_frag && last) {
  8995. - skb_pull(skb, offset);
  8996. - frame = skb;
  8997. - reuse_skb = true;
  8998. - } else {
  8999. -- frame = __ieee80211_amsdu_copy(skb, hlen, offset, len);
  9000. -+ frame = __ieee80211_amsdu_copy(skb, hlen, offset, len,
  9001. -+ reuse_frag);
  9002. - if (!frame)
  9003. - goto purge;
  9004. -
  9005. diff --git a/package/kernel/mac80211/patches/334-mac80211-fix-purging-multicast-PS-buffer-queue.patch b/package/kernel/mac80211/patches/334-mac80211-fix-purging-multicast-PS-buffer-queue.patch
  9006. new file mode 100644
  9007. index 0000000..dfcc6e4
  9008. --- /dev/null
  9009. +++ b/package/kernel/mac80211/patches/334-mac80211-fix-purging-multicast-PS-buffer-queue.patch
  9010. @@ -0,0 +1,54 @@
  9011. +From: Felix Fietkau <nbd@nbd.name>
  9012. +Date: Tue, 2 Aug 2016 11:11:13 +0200
  9013. +Subject: [PATCH] mac80211: fix purging multicast PS buffer queue
  9014. +
  9015. +The code currently assumes that buffered multicast PS frames don't have
  9016. +a pending ACK frame for tx status reporting.
  9017. +However, hostapd sends a broadcast deauth frame on teardown for which tx
  9018. +status is requested. This can lead to the "Have pending ack frames"
  9019. +warning on module reload.
  9020. +Fix this by using ieee80211_free_txskb/ieee80211_purge_tx_queue.
  9021. +
  9022. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  9023. +---
  9024. +
  9025. +--- a/net/mac80211/cfg.c
  9026. ++++ b/net/mac80211/cfg.c
  9027. +@@ -868,7 +868,7 @@ static int ieee80211_stop_ap(struct wiph
  9028. +
  9029. + /* free all potentially still buffered bcast frames */
  9030. + local->total_ps_buffered -= skb_queue_len(&sdata->u.ap.ps.bc_buf);
  9031. +- skb_queue_purge(&sdata->u.ap.ps.bc_buf);
  9032. ++ ieee80211_purge_tx_queue(&local->hw, &sdata->u.ap.ps.bc_buf);
  9033. +
  9034. + mutex_lock(&local->mtx);
  9035. + ieee80211_vif_copy_chanctx_to_vlans(sdata, true);
  9036. +--- a/net/mac80211/tx.c
  9037. ++++ b/net/mac80211/tx.c
  9038. +@@ -368,7 +368,7 @@ static void purge_old_ps_buffers(struct
  9039. + skb = skb_dequeue(&ps->bc_buf);
  9040. + if (skb) {
  9041. + purged++;
  9042. +- dev_kfree_skb(skb);
  9043. ++ ieee80211_free_txskb(&local->hw, skb);
  9044. + }
  9045. + total += skb_queue_len(&ps->bc_buf);
  9046. + }
  9047. +@@ -451,7 +451,7 @@ ieee80211_tx_h_multicast_ps_buf(struct i
  9048. + if (skb_queue_len(&ps->bc_buf) >= AP_MAX_BC_BUFFER) {
  9049. + ps_dbg(tx->sdata,
  9050. + "BC TX buffer full - dropping the oldest frame\n");
  9051. +- dev_kfree_skb(skb_dequeue(&ps->bc_buf));
  9052. ++ ieee80211_free_txskb(&tx->local->hw, skb_dequeue(&ps->bc_buf));
  9053. + } else
  9054. + tx->local->total_ps_buffered++;
  9055. +
  9056. +@@ -4276,7 +4276,7 @@ ieee80211_get_buffered_bc(struct ieee802
  9057. + sdata = IEEE80211_DEV_TO_SUB_IF(skb->dev);
  9058. + if (!ieee80211_tx_prepare(sdata, &tx, NULL, skb))
  9059. + break;
  9060. +- dev_kfree_skb_any(skb);
  9061. ++ ieee80211_free_txskb(hw, skb);
  9062. + }
  9063. +
  9064. + info = IEEE80211_SKB_CB(skb);
  9065. diff --git a/package/kernel/mac80211/patches/334-mac80211-fix-wiphy-supported_band-access.patch b/package/kernel/mac80211/patches/334-mac80211-fix-wiphy-supported_band-access.patch
  9066. deleted file mode 100644
  9067. index f8f4f09..0000000
  9068. --- a/package/kernel/mac80211/patches/334-mac80211-fix-wiphy-supported_band-access.patch
  9069. +++ /dev/null
  9070. @@ -1,36 +0,0 @@
  9071. -From: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  9072. -Date: Wed, 10 Feb 2016 16:08:17 +0100
  9073. -Subject: [PATCH] mac80211: fix wiphy supported_band access
  9074. -
  9075. -Fix wiphy supported_band access in tx radiotap parsing. In particular,
  9076. -info->band is always set to 0 (IEEE80211_BAND_2GHZ) since it has not
  9077. -assigned yet. This cause a kernel crash on 5GHz only devices.
  9078. -Move ieee80211_parse_tx_radiotap() after info->band assignment
  9079. -
  9080. -Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  9081. ----
  9082. -
  9083. ---- a/net/mac80211/tx.c
  9084. -+++ b/net/mac80211/tx.c
  9085. -@@ -1890,10 +1890,6 @@ netdev_tx_t ieee80211_monitor_start_xmit
  9086. - info->flags = IEEE80211_TX_CTL_REQ_TX_STATUS |
  9087. - IEEE80211_TX_CTL_INJECTED;
  9088. -
  9089. -- /* process and remove the injection radiotap header */
  9090. -- if (!ieee80211_parse_tx_radiotap(local, skb))
  9091. -- goto fail;
  9092. --
  9093. - rcu_read_lock();
  9094. -
  9095. - /*
  9096. -@@ -1955,6 +1951,10 @@ netdev_tx_t ieee80211_monitor_start_xmit
  9097. - goto fail_rcu;
  9098. -
  9099. - info->band = chandef->chan->band;
  9100. -+ /* process and remove the injection radiotap header */
  9101. -+ if (!ieee80211_parse_tx_radiotap(local, skb))
  9102. -+ goto fail_rcu;
  9103. -+
  9104. - ieee80211_xmit(sdata, NULL, skb);
  9105. - rcu_read_unlock();
  9106. -
  9107. diff --git a/package/kernel/mac80211/patches/335-ath9k-use-ieee80211_tx_status_noskb-where-possible.patch b/package/kernel/mac80211/patches/335-ath9k-use-ieee80211_tx_status_noskb-where-possible.patch
  9108. new file mode 100644
  9109. index 0000000..dbb5b90
  9110. --- /dev/null
  9111. +++ b/package/kernel/mac80211/patches/335-ath9k-use-ieee80211_tx_status_noskb-where-possible.patch
  9112. @@ -0,0 +1,305 @@
  9113. +From: Felix Fietkau <nbd@nbd.name>
  9114. +Date: Tue, 2 Aug 2016 12:12:18 +0200
  9115. +Subject: [PATCH] ath9k: use ieee80211_tx_status_noskb where possible
  9116. +
  9117. +It removes the need for undoing the padding changes to skb->data and it
  9118. +improves performance by eliminating one tx status lookup per MPDU in the
  9119. +status path. It is also useful for preparing a follow-up fix to better
  9120. +handle powersave filtering.
  9121. +
  9122. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  9123. +---
  9124. +
  9125. +--- a/drivers/net/wireless/ath/ath9k/xmit.c
  9126. ++++ b/drivers/net/wireless/ath/ath9k/xmit.c
  9127. +@@ -50,9 +50,11 @@ static u16 bits_per_symbol[][2] = {
  9128. + static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq,
  9129. + struct ath_atx_tid *tid, struct sk_buff *skb);
  9130. + static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb,
  9131. +- int tx_flags, struct ath_txq *txq);
  9132. ++ int tx_flags, struct ath_txq *txq,
  9133. ++ struct ieee80211_sta *sta);
  9134. + static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf,
  9135. + struct ath_txq *txq, struct list_head *bf_q,
  9136. ++ struct ieee80211_sta *sta,
  9137. + struct ath_tx_status *ts, int txok);
  9138. + static void ath_tx_txqaddbuf(struct ath_softc *sc, struct ath_txq *txq,
  9139. + struct list_head *head, bool internal);
  9140. +@@ -77,6 +79,22 @@ enum {
  9141. + /* Aggregation logic */
  9142. + /*********************/
  9143. +
  9144. ++static void ath_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
  9145. ++{
  9146. ++ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  9147. ++ struct ieee80211_sta *sta = info->status.status_driver_data[0];
  9148. ++
  9149. ++ if (info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS) {
  9150. ++ ieee80211_tx_status(hw, skb);
  9151. ++ return;
  9152. ++ }
  9153. ++
  9154. ++ if (sta)
  9155. ++ ieee80211_tx_status_noskb(hw, sta, info);
  9156. ++
  9157. ++ dev_kfree_skb(skb);
  9158. ++}
  9159. ++
  9160. + void ath_txq_lock(struct ath_softc *sc, struct ath_txq *txq)
  9161. + __acquires(&txq->axq_lock)
  9162. + {
  9163. +@@ -92,6 +110,7 @@ void ath_txq_unlock(struct ath_softc *sc
  9164. + void ath_txq_unlock_complete(struct ath_softc *sc, struct ath_txq *txq)
  9165. + __releases(&txq->axq_lock)
  9166. + {
  9167. ++ struct ieee80211_hw *hw = sc->hw;
  9168. + struct sk_buff_head q;
  9169. + struct sk_buff *skb;
  9170. +
  9171. +@@ -100,7 +119,7 @@ void ath_txq_unlock_complete(struct ath_
  9172. + spin_unlock_bh(&txq->axq_lock);
  9173. +
  9174. + while ((skb = __skb_dequeue(&q)))
  9175. +- ieee80211_tx_status(sc->hw, skb);
  9176. ++ ath_tx_status(hw, skb);
  9177. + }
  9178. +
  9179. + static void ath_tx_queue_tid(struct ath_softc *sc, struct ath_txq *txq,
  9180. +@@ -268,7 +287,7 @@ static void ath_tx_flush_tid(struct ath_
  9181. + }
  9182. +
  9183. + list_add_tail(&bf->list, &bf_head);
  9184. +- ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0);
  9185. ++ ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, &ts, 0);
  9186. + }
  9187. +
  9188. + if (sendbar) {
  9189. +@@ -333,12 +352,12 @@ static void ath_tid_drain(struct ath_sof
  9190. + bf = fi->bf;
  9191. +
  9192. + if (!bf) {
  9193. +- ath_tx_complete(sc, skb, ATH_TX_ERROR, txq);
  9194. ++ ath_tx_complete(sc, skb, ATH_TX_ERROR, txq, NULL);
  9195. + continue;
  9196. + }
  9197. +
  9198. + list_add_tail(&bf->list, &bf_head);
  9199. +- ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0);
  9200. ++ ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, &ts, 0);
  9201. + }
  9202. + }
  9203. +
  9204. +@@ -441,12 +460,11 @@ static void ath_tx_count_frames(struct a
  9205. +
  9206. + static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
  9207. + struct ath_buf *bf, struct list_head *bf_q,
  9208. ++ struct ieee80211_sta *sta,
  9209. + struct ath_tx_status *ts, int txok)
  9210. + {
  9211. + struct ath_node *an = NULL;
  9212. + struct sk_buff *skb;
  9213. +- struct ieee80211_sta *sta;
  9214. +- struct ieee80211_hw *hw = sc->hw;
  9215. + struct ieee80211_hdr *hdr;
  9216. + struct ieee80211_tx_info *tx_info;
  9217. + struct ath_atx_tid *tid = NULL;
  9218. +@@ -475,12 +493,7 @@ static void ath_tx_complete_aggr(struct
  9219. + for (i = 0; i < ts->ts_rateindex; i++)
  9220. + retries += rates[i].count;
  9221. +
  9222. +- rcu_read_lock();
  9223. +-
  9224. +- sta = ieee80211_find_sta_by_ifaddr(hw, hdr->addr1, hdr->addr2);
  9225. + if (!sta) {
  9226. +- rcu_read_unlock();
  9227. +-
  9228. + INIT_LIST_HEAD(&bf_head);
  9229. + while (bf) {
  9230. + bf_next = bf->bf_next;
  9231. +@@ -488,7 +501,7 @@ static void ath_tx_complete_aggr(struct
  9232. + if (!bf->bf_state.stale || bf_next != NULL)
  9233. + list_move_tail(&bf->list, &bf_head);
  9234. +
  9235. +- ath_tx_complete_buf(sc, bf, txq, &bf_head, ts, 0);
  9236. ++ ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, ts, 0);
  9237. +
  9238. + bf = bf_next;
  9239. + }
  9240. +@@ -598,7 +611,7 @@ static void ath_tx_complete_aggr(struct
  9241. + ts);
  9242. + }
  9243. +
  9244. +- ath_tx_complete_buf(sc, bf, txq, &bf_head, ts,
  9245. ++ ath_tx_complete_buf(sc, bf, txq, &bf_head, sta, ts,
  9246. + !txfail);
  9247. + } else {
  9248. + if (tx_info->flags & IEEE80211_TX_STATUS_EOSP) {
  9249. +@@ -619,7 +632,8 @@ static void ath_tx_complete_aggr(struct
  9250. + ath_tx_update_baw(sc, tid, seqno);
  9251. +
  9252. + ath_tx_complete_buf(sc, bf, txq,
  9253. +- &bf_head, ts, 0);
  9254. ++ &bf_head, NULL, ts,
  9255. ++ 0);
  9256. + bar_index = max_t(int, bar_index,
  9257. + ATH_BA_INDEX(seq_first, seqno));
  9258. + break;
  9259. +@@ -663,8 +677,6 @@ static void ath_tx_complete_aggr(struct
  9260. + ath_txq_lock(sc, txq);
  9261. + }
  9262. +
  9263. +- rcu_read_unlock();
  9264. +-
  9265. + if (needreset)
  9266. + ath9k_queue_reset(sc, RESET_TYPE_TX_ERROR);
  9267. + }
  9268. +@@ -679,7 +691,10 @@ static void ath_tx_process_buffer(struct
  9269. + struct ath_tx_status *ts, struct ath_buf *bf,
  9270. + struct list_head *bf_head)
  9271. + {
  9272. ++ struct ieee80211_hw *hw = sc->hw;
  9273. + struct ieee80211_tx_info *info;
  9274. ++ struct ieee80211_sta *sta;
  9275. ++ struct ieee80211_hdr *hdr;
  9276. + bool txok, flush;
  9277. +
  9278. + txok = !(ts->ts_status & ATH9K_TXERR_MASK);
  9279. +@@ -692,6 +707,10 @@ static void ath_tx_process_buffer(struct
  9280. +
  9281. + ts->duration = ath9k_hw_get_duration(sc->sc_ah, bf->bf_desc,
  9282. + ts->ts_rateindex);
  9283. ++
  9284. ++ hdr = (struct ieee80211_hdr *) bf->bf_mpdu->data;
  9285. ++ sta = ieee80211_find_sta_by_ifaddr(hw, hdr->addr1, hdr->addr2);
  9286. ++
  9287. + if (!bf_isampdu(bf)) {
  9288. + if (!flush) {
  9289. + info = IEEE80211_SKB_CB(bf->bf_mpdu);
  9290. +@@ -700,9 +719,9 @@ static void ath_tx_process_buffer(struct
  9291. + ath_tx_rc_status(sc, bf, ts, 1, txok ? 0 : 1, txok);
  9292. + ath_dynack_sample_tx_ts(sc->sc_ah, bf->bf_mpdu, ts);
  9293. + }
  9294. +- ath_tx_complete_buf(sc, bf, txq, bf_head, ts, txok);
  9295. ++ ath_tx_complete_buf(sc, bf, txq, bf_head, sta, ts, txok);
  9296. + } else
  9297. +- ath_tx_complete_aggr(sc, txq, bf, bf_head, ts, txok);
  9298. ++ ath_tx_complete_aggr(sc, txq, bf, bf_head, sta, ts, txok);
  9299. +
  9300. + if (!flush)
  9301. + ath_txq_schedule(sc, txq);
  9302. +@@ -938,7 +957,7 @@ ath_tx_get_tid_subframe(struct ath_softc
  9303. + list_add(&bf->list, &bf_head);
  9304. + __skb_unlink(skb, *q);
  9305. + ath_tx_update_baw(sc, tid, seqno);
  9306. +- ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0);
  9307. ++ ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, &ts, 0);
  9308. + continue;
  9309. + }
  9310. +
  9311. +@@ -1847,6 +1866,7 @@ static void ath_drain_txq_list(struct at
  9312. + */
  9313. + void ath_draintxq(struct ath_softc *sc, struct ath_txq *txq)
  9314. + {
  9315. ++ rcu_read_lock();
  9316. + ath_txq_lock(sc, txq);
  9317. +
  9318. + if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) {
  9319. +@@ -1865,6 +1885,7 @@ void ath_draintxq(struct ath_softc *sc,
  9320. + ath_drain_txq_list(sc, txq, &txq->axq_q);
  9321. +
  9322. + ath_txq_unlock_complete(sc, txq);
  9323. ++ rcu_read_unlock();
  9324. + }
  9325. +
  9326. + bool ath_drain_all_txq(struct ath_softc *sc)
  9327. +@@ -2487,7 +2508,8 @@ void ath_tx_cabq(struct ieee80211_hw *hw
  9328. + /*****************/
  9329. +
  9330. + static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb,
  9331. +- int tx_flags, struct ath_txq *txq)
  9332. ++ int tx_flags, struct ath_txq *txq,
  9333. ++ struct ieee80211_sta *sta)
  9334. + {
  9335. + struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
  9336. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  9337. +@@ -2507,15 +2529,17 @@ static void ath_tx_complete(struct ath_s
  9338. + tx_info->flags |= IEEE80211_TX_STAT_ACK;
  9339. + }
  9340. +
  9341. +- padpos = ieee80211_hdrlen(hdr->frame_control);
  9342. +- padsize = padpos & 3;
  9343. +- if (padsize && skb->len>padpos+padsize) {
  9344. +- /*
  9345. +- * Remove MAC header padding before giving the frame back to
  9346. +- * mac80211.
  9347. +- */
  9348. +- memmove(skb->data + padsize, skb->data, padpos);
  9349. +- skb_pull(skb, padsize);
  9350. ++ if (tx_info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS) {
  9351. ++ padpos = ieee80211_hdrlen(hdr->frame_control);
  9352. ++ padsize = padpos & 3;
  9353. ++ if (padsize && skb->len>padpos+padsize) {
  9354. ++ /*
  9355. ++ * Remove MAC header padding before giving the frame back to
  9356. ++ * mac80211.
  9357. ++ */
  9358. ++ memmove(skb->data + padsize, skb->data, padpos);
  9359. ++ skb_pull(skb, padsize);
  9360. ++ }
  9361. + }
  9362. +
  9363. + spin_lock_irqsave(&sc->sc_pm_lock, flags);
  9364. +@@ -2530,12 +2554,14 @@ static void ath_tx_complete(struct ath_s
  9365. + }
  9366. + spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
  9367. +
  9368. +- __skb_queue_tail(&txq->complete_q, skb);
  9369. + ath_txq_skb_done(sc, txq, skb);
  9370. ++ tx_info->status.status_driver_data[0] = sta;
  9371. ++ __skb_queue_tail(&txq->complete_q, skb);
  9372. + }
  9373. +
  9374. + static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf,
  9375. + struct ath_txq *txq, struct list_head *bf_q,
  9376. ++ struct ieee80211_sta *sta,
  9377. + struct ath_tx_status *ts, int txok)
  9378. + {
  9379. + struct sk_buff *skb = bf->bf_mpdu;
  9380. +@@ -2563,7 +2589,7 @@ static void ath_tx_complete_buf(struct a
  9381. + complete(&sc->paprd_complete);
  9382. + } else {
  9383. + ath_debug_stat_tx(sc, bf, ts, txq, tx_flags);
  9384. +- ath_tx_complete(sc, skb, tx_flags, txq);
  9385. ++ ath_tx_complete(sc, skb, tx_flags, txq, sta);
  9386. + }
  9387. + skip_tx_complete:
  9388. + /* At this point, skb (bf->bf_mpdu) is consumed...make sure we don't
  9389. +@@ -2715,10 +2741,12 @@ void ath_tx_tasklet(struct ath_softc *sc
  9390. + u32 qcumask = ((1 << ATH9K_NUM_TX_QUEUES) - 1) & ah->intr_txqs;
  9391. + int i;
  9392. +
  9393. ++ rcu_read_lock();
  9394. + for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) {
  9395. + if (ATH_TXQ_SETUP(sc, i) && (qcumask & (1 << i)))
  9396. + ath_tx_processq(sc, &sc->tx.txq[i]);
  9397. + }
  9398. ++ rcu_read_unlock();
  9399. + }
  9400. +
  9401. + void ath_tx_edma_tasklet(struct ath_softc *sc)
  9402. +@@ -2732,6 +2760,7 @@ void ath_tx_edma_tasklet(struct ath_soft
  9403. + struct list_head *fifo_list;
  9404. + int status;
  9405. +
  9406. ++ rcu_read_lock();
  9407. + for (;;) {
  9408. + if (test_bit(ATH_OP_HW_RESET, &common->op_flags))
  9409. + break;
  9410. +@@ -2802,6 +2831,7 @@ void ath_tx_edma_tasklet(struct ath_soft
  9411. + ath_tx_process_buffer(sc, txq, &ts, bf, &bf_head);
  9412. + ath_txq_unlock_complete(sc, txq);
  9413. + }
  9414. ++ rcu_read_unlock();
  9415. + }
  9416. +
  9417. + /*****************/
  9418. diff --git a/package/kernel/mac80211/patches/335-mac80211-minstrel_ht-set-A-MSDU-tx-limits-based-on-s.patch b/package/kernel/mac80211/patches/335-mac80211-minstrel_ht-set-A-MSDU-tx-limits-based-on-s.patch
  9419. deleted file mode 100644
  9420. index acaacf7..0000000
  9421. --- a/package/kernel/mac80211/patches/335-mac80211-minstrel_ht-set-A-MSDU-tx-limits-based-on-s.patch
  9422. +++ /dev/null
  9423. @@ -1,61 +0,0 @@
  9424. -From: Felix Fietkau <nbd@openwrt.org>
  9425. -Date: Thu, 18 Feb 2016 19:30:05 +0100
  9426. -Subject: [PATCH] mac80211: minstrel_ht: set A-MSDU tx limits based on selected
  9427. - max_prob_rate
  9428. -
  9429. -Prevents excessive A-MSDU aggregation at low data rates or bad
  9430. -conditions.
  9431. -
  9432. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  9433. ----
  9434. -
  9435. ---- a/net/mac80211/rc80211_minstrel_ht.c
  9436. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  9437. -@@ -883,6 +883,39 @@ minstrel_ht_set_rate(struct minstrel_pri
  9438. - ratetbl->rate[offset].flags = flags;
  9439. - }
  9440. -
  9441. -+static int
  9442. -+minstrel_ht_get_max_amsdu_len(struct minstrel_ht_sta *mi)
  9443. -+{
  9444. -+ int group = mi->max_prob_rate / MCS_GROUP_RATES;
  9445. -+ const struct mcs_group *g = &minstrel_mcs_groups[group];
  9446. -+ int rate = mi->max_prob_rate % MCS_GROUP_RATES;
  9447. -+
  9448. -+ /* Disable A-MSDU if max_prob_rate is bad */
  9449. -+ if (mi->groups[group].rates[rate].prob_ewma < MINSTREL_FRAC(50, 100))
  9450. -+ return 1;
  9451. -+
  9452. -+ /* If the rate is slower than single-stream MCS1, make A-MSDU limit small */
  9453. -+ if (g->duration[rate] > MCS_DURATION(1, 0, 52))
  9454. -+ return 500;
  9455. -+
  9456. -+ /*
  9457. -+ * If the rate is slower than single-stream MCS4, limit A-MSDU to usual
  9458. -+ * data packet size
  9459. -+ */
  9460. -+ if (g->duration[rate] > MCS_DURATION(1, 0, 104))
  9461. -+ return 1500;
  9462. -+
  9463. -+ /*
  9464. -+ * If the rate is slower than single-stream MCS7, limit A-MSDU to twice
  9465. -+ * the usual data packet size
  9466. -+ */
  9467. -+ if (g->duration[rate] > MCS_DURATION(1, 0, 260))
  9468. -+ return 3000;
  9469. -+
  9470. -+ /* unlimited */
  9471. -+ return 0;
  9472. -+}
  9473. -+
  9474. - static void
  9475. - minstrel_ht_update_rates(struct minstrel_priv *mp, struct minstrel_ht_sta *mi)
  9476. - {
  9477. -@@ -907,6 +940,7 @@ minstrel_ht_update_rates(struct minstrel
  9478. - minstrel_ht_set_rate(mp, mi, rates, i++, mi->max_prob_rate);
  9479. - }
  9480. -
  9481. -+ mi->sta->max_rc_amsdu_len = minstrel_ht_get_max_amsdu_len(mi);
  9482. - rates->rate[i].idx = -1;
  9483. - rate_control_set_rates(mp->hw, mi->sta, rates);
  9484. - }
  9485. diff --git a/package/kernel/mac80211/patches/336-ath9k-improve-powersave-filter-handling.patch b/package/kernel/mac80211/patches/336-ath9k-improve-powersave-filter-handling.patch
  9486. new file mode 100644
  9487. index 0000000..67a6c63
  9488. --- /dev/null
  9489. +++ b/package/kernel/mac80211/patches/336-ath9k-improve-powersave-filter-handling.patch
  9490. @@ -0,0 +1,70 @@
  9491. +From: Felix Fietkau <nbd@nbd.name>
  9492. +Date: Tue, 2 Aug 2016 12:13:35 +0200
  9493. +Subject: [PATCH] ath9k: improve powersave filter handling
  9494. +
  9495. +For non-aggregated frames, ath9k was leaving handling of powersave
  9496. +filtered packets to mac80211. This can be too slow if the intermediate
  9497. +queue is already filled with packets and mac80211 does not immediately
  9498. +send a new packet via drv_tx().
  9499. +
  9500. +Improve response time with filtered frames by triggering clearing the
  9501. +powersave filter internally.
  9502. +
  9503. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  9504. +---
  9505. +
  9506. +--- a/drivers/net/wireless/ath/ath9k/xmit.c
  9507. ++++ b/drivers/net/wireless/ath/ath9k/xmit.c
  9508. +@@ -461,13 +461,13 @@ static void ath_tx_count_frames(struct a
  9509. + static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
  9510. + struct ath_buf *bf, struct list_head *bf_q,
  9511. + struct ieee80211_sta *sta,
  9512. ++ struct ath_atx_tid *tid,
  9513. + struct ath_tx_status *ts, int txok)
  9514. + {
  9515. + struct ath_node *an = NULL;
  9516. + struct sk_buff *skb;
  9517. + struct ieee80211_hdr *hdr;
  9518. + struct ieee80211_tx_info *tx_info;
  9519. +- struct ath_atx_tid *tid = NULL;
  9520. + struct ath_buf *bf_next, *bf_last = bf->bf_lastbf;
  9521. + struct list_head bf_head;
  9522. + struct sk_buff_head bf_pending;
  9523. +@@ -509,7 +509,6 @@ static void ath_tx_complete_aggr(struct
  9524. + }
  9525. +
  9526. + an = (struct ath_node *)sta->drv_priv;
  9527. +- tid = ath_get_skb_tid(sc, an, skb);
  9528. + seq_first = tid->seq_start;
  9529. + isba = ts->ts_flags & ATH9K_TX_BA;
  9530. +
  9531. +@@ -695,6 +694,7 @@ static void ath_tx_process_buffer(struct
  9532. + struct ieee80211_tx_info *info;
  9533. + struct ieee80211_sta *sta;
  9534. + struct ieee80211_hdr *hdr;
  9535. ++ struct ath_atx_tid *tid = NULL;
  9536. + bool txok, flush;
  9537. +
  9538. + txok = !(ts->ts_status & ATH9K_TXERR_MASK);
  9539. +@@ -710,6 +710,12 @@ static void ath_tx_process_buffer(struct
  9540. +
  9541. + hdr = (struct ieee80211_hdr *) bf->bf_mpdu->data;
  9542. + sta = ieee80211_find_sta_by_ifaddr(hw, hdr->addr1, hdr->addr2);
  9543. ++ if (sta) {
  9544. ++ struct ath_node *an = (struct ath_node *)sta->drv_priv;
  9545. ++ tid = ath_get_skb_tid(sc, an, bf->bf_mpdu);
  9546. ++ if (ts->ts_status & (ATH9K_TXERR_FILT | ATH9K_TXERR_XRETRY))
  9547. ++ tid->clear_ps_filter = true;
  9548. ++ }
  9549. +
  9550. + if (!bf_isampdu(bf)) {
  9551. + if (!flush) {
  9552. +@@ -721,7 +727,7 @@ static void ath_tx_process_buffer(struct
  9553. + }
  9554. + ath_tx_complete_buf(sc, bf, txq, bf_head, sta, ts, txok);
  9555. + } else
  9556. +- ath_tx_complete_aggr(sc, txq, bf, bf_head, sta, ts, txok);
  9557. ++ ath_tx_complete_aggr(sc, txq, bf, bf_head, sta, tid, ts, txok);
  9558. +
  9559. + if (!flush)
  9560. + ath_txq_schedule(sc, txq);
  9561. diff --git a/package/kernel/mac80211/patches/336-mac80211-minstrel_ht-set-default-tx-aggregation-time.patch b/package/kernel/mac80211/patches/336-mac80211-minstrel_ht-set-default-tx-aggregation-time.patch
  9562. deleted file mode 100644
  9563. index 32a2ad6..0000000
  9564. --- a/package/kernel/mac80211/patches/336-mac80211-minstrel_ht-set-default-tx-aggregation-time.patch
  9565. +++ /dev/null
  9566. @@ -1,31 +0,0 @@
  9567. -From: Felix Fietkau <nbd@openwrt.org>
  9568. -Date: Thu, 18 Feb 2016 19:45:33 +0100
  9569. -Subject: [PATCH] mac80211: minstrel_ht: set default tx aggregation timeout to
  9570. - 0
  9571. -
  9572. -The value 5000 was put here with the addition of the timeout field to
  9573. -ieee80211_start_tx_ba_session. It was originally added in mac80211 to
  9574. -save resources for drivers like iwlwifi, which only supports a limited
  9575. -number of concurrent aggregation sessions.
  9576. -
  9577. -Since iwlwifi does not use minstrel_ht and other drivers don't need
  9578. -this, 0 is a better default - especially since there have been
  9579. -recent reports of aggregation setup related issues reproduced with
  9580. -ath9k. This should improve stability without causing any adverse
  9581. -effects.
  9582. -
  9583. -Cc: stable@vger.kernel.org
  9584. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  9585. ----
  9586. -
  9587. ---- a/net/mac80211/rc80211_minstrel_ht.c
  9588. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  9589. -@@ -692,7 +692,7 @@ minstrel_aggr_check(struct ieee80211_sta
  9590. - if (likely(sta->ampdu_mlme.tid_tx[tid]))
  9591. - return;
  9592. -
  9593. -- ieee80211_start_tx_ba_session(pubsta, tid, 5000);
  9594. -+ ieee80211_start_tx_ba_session(pubsta, tid, 0);
  9595. - }
  9596. -
  9597. - static void
  9598. diff --git a/package/kernel/mac80211/patches/337-ath9k-Switch-to-using-mac80211-intermediate-software.patch b/package/kernel/mac80211/patches/337-ath9k-Switch-to-using-mac80211-intermediate-software.patch
  9599. new file mode 100644
  9600. index 0000000..adfd6df
  9601. --- /dev/null
  9602. +++ b/package/kernel/mac80211/patches/337-ath9k-Switch-to-using-mac80211-intermediate-software.patch
  9603. @@ -0,0 +1,951 @@
  9604. +From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= <toke@toke.dk>
  9605. +Date: Wed, 6 Jul 2016 21:34:17 +0200
  9606. +Subject: [PATCH] ath9k: Switch to using mac80211 intermediate software queues.
  9607. +MIME-Version: 1.0
  9608. +Content-Type: text/plain; charset=UTF-8
  9609. +Content-Transfer-Encoding: 8bit
  9610. +
  9611. +This switches ath9k over to using the mac80211 intermediate software
  9612. +queueing mechanism for data packets. It removes the queueing inside the
  9613. +driver, except for the retry queue, and instead pulls from mac80211 when
  9614. +a packet is needed. The retry queue is used to store a packet that was
  9615. +pulled but can't be sent immediately.
  9616. +
  9617. +The old code path in ath_tx_start that would queue packets has been
  9618. +removed completely, as has the qlen limit tunables (since there's no
  9619. +longer a queue in the driver to limit).
  9620. +
  9621. +Based on Tim's original patch set, but reworked quite thoroughly.
  9622. +
  9623. +Cc: Tim Shepard <shep@alum.mit.edu>
  9624. +Cc: Felix Fietkau <nbd@nbd.name>
  9625. +Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
  9626. +---
  9627. +
  9628. +--- a/drivers/net/wireless/ath/ath9k/ath9k.h
  9629. ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  9630. +@@ -91,7 +91,6 @@ int ath_descdma_setup(struct ath_softc *
  9631. + #define ATH_RXBUF 512
  9632. + #define ATH_TXBUF 512
  9633. + #define ATH_TXBUF_RESERVE 5
  9634. +-#define ATH_MAX_QDEPTH (ATH_TXBUF / 4 - ATH_TXBUF_RESERVE)
  9635. + #define ATH_TXMAXTRY 13
  9636. + #define ATH_MAX_SW_RETRIES 30
  9637. +
  9638. +@@ -145,7 +144,7 @@ int ath_descdma_setup(struct ath_softc *
  9639. + #define BAW_WITHIN(_start, _bawsz, _seqno) \
  9640. + ((((_seqno) - (_start)) & 4095) < (_bawsz))
  9641. +
  9642. +-#define ATH_AN_2_TID(_an, _tidno) (&(_an)->tid[(_tidno)])
  9643. ++#define ATH_AN_2_TID(_an, _tidno) ath_node_to_tid(_an, _tidno)
  9644. +
  9645. + #define IS_HT_RATE(rate) (rate & 0x80)
  9646. + #define IS_CCK_RATE(rate) ((rate >= 0x18) && (rate <= 0x1e))
  9647. +@@ -164,7 +163,6 @@ struct ath_txq {
  9648. + spinlock_t axq_lock;
  9649. + u32 axq_depth;
  9650. + u32 axq_ampdu_depth;
  9651. +- bool stopped;
  9652. + bool axq_tx_inprogress;
  9653. + struct list_head txq_fifo[ATH_TXFIFO_DEPTH];
  9654. + u8 txq_headidx;
  9655. +@@ -232,7 +230,6 @@ struct ath_buf {
  9656. +
  9657. + struct ath_atx_tid {
  9658. + struct list_head list;
  9659. +- struct sk_buff_head buf_q;
  9660. + struct sk_buff_head retry_q;
  9661. + struct ath_node *an;
  9662. + struct ath_txq *txq;
  9663. +@@ -247,13 +244,13 @@ struct ath_atx_tid {
  9664. + s8 bar_index;
  9665. + bool active;
  9666. + bool clear_ps_filter;
  9667. ++ bool has_queued;
  9668. + };
  9669. +
  9670. + struct ath_node {
  9671. + struct ath_softc *sc;
  9672. + struct ieee80211_sta *sta; /* station struct we're part of */
  9673. + struct ieee80211_vif *vif; /* interface with which we're associated */
  9674. +- struct ath_atx_tid tid[IEEE80211_NUM_TIDS];
  9675. +
  9676. + u16 maxampdu;
  9677. + u8 mpdudensity;
  9678. +@@ -276,7 +273,6 @@ struct ath_tx_control {
  9679. + struct ath_node *an;
  9680. + struct ieee80211_sta *sta;
  9681. + u8 paprd;
  9682. +- bool force_channel;
  9683. + };
  9684. +
  9685. +
  9686. +@@ -293,7 +289,6 @@ struct ath_tx {
  9687. + struct ath_descdma txdma;
  9688. + struct ath_txq *txq_map[IEEE80211_NUM_ACS];
  9689. + struct ath_txq *uapsdq;
  9690. +- u32 txq_max_pending[IEEE80211_NUM_ACS];
  9691. + u16 max_aggr_framelen[IEEE80211_NUM_ACS][4][32];
  9692. + };
  9693. +
  9694. +@@ -421,6 +416,22 @@ struct ath_offchannel {
  9695. + int duration;
  9696. + };
  9697. +
  9698. ++static inline struct ath_atx_tid *
  9699. ++ath_node_to_tid(struct ath_node *an, u8 tidno)
  9700. ++{
  9701. ++ struct ieee80211_sta *sta = an->sta;
  9702. ++ struct ieee80211_vif *vif = an->vif;
  9703. ++ struct ieee80211_txq *txq;
  9704. ++
  9705. ++ BUG_ON(!vif);
  9706. ++ if (sta)
  9707. ++ txq = sta->txq[tidno % ARRAY_SIZE(sta->txq)];
  9708. ++ else
  9709. ++ txq = vif->txq;
  9710. ++
  9711. ++ return (struct ath_atx_tid *) txq->drv_priv;
  9712. ++}
  9713. ++
  9714. + #define case_rtn_string(val) case val: return #val
  9715. +
  9716. + #define ath_for_each_chanctx(_sc, _ctx) \
  9717. +@@ -575,7 +586,6 @@ void ath_tx_edma_tasklet(struct ath_soft
  9718. + int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta,
  9719. + u16 tid, u16 *ssn);
  9720. + void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid);
  9721. +-void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid);
  9722. +
  9723. + void ath_tx_aggr_wakeup(struct ath_softc *sc, struct ath_node *an);
  9724. + void ath_tx_aggr_sleep(struct ieee80211_sta *sta, struct ath_softc *sc,
  9725. +@@ -585,6 +595,7 @@ void ath9k_release_buffered_frames(struc
  9726. + u16 tids, int nframes,
  9727. + enum ieee80211_frame_release_type reason,
  9728. + bool more_data);
  9729. ++void ath9k_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *queue);
  9730. +
  9731. + /********/
  9732. + /* VIFs */
  9733. +--- a/drivers/net/wireless/ath/ath9k/channel.c
  9734. ++++ b/drivers/net/wireless/ath/ath9k/channel.c
  9735. +@@ -1007,7 +1007,6 @@ static void ath_scan_send_probe(struct a
  9736. + goto error;
  9737. +
  9738. + txctl.txq = sc->tx.txq_map[IEEE80211_AC_VO];
  9739. +- txctl.force_channel = true;
  9740. + if (ath_tx_start(sc->hw, skb, &txctl))
  9741. + goto error;
  9742. +
  9743. +@@ -1130,7 +1129,6 @@ ath_chanctx_send_vif_ps_frame(struct ath
  9744. + memset(&txctl, 0, sizeof(txctl));
  9745. + txctl.txq = sc->tx.txq_map[IEEE80211_AC_VO];
  9746. + txctl.sta = sta;
  9747. +- txctl.force_channel = true;
  9748. + if (ath_tx_start(sc->hw, skb, &txctl)) {
  9749. + ieee80211_free_txskb(sc->hw, skb);
  9750. + return false;
  9751. +--- a/drivers/net/wireless/ath/ath9k/debug.c
  9752. ++++ b/drivers/net/wireless/ath/ath9k/debug.c
  9753. +@@ -600,7 +600,6 @@ static int read_file_xmit(struct seq_fil
  9754. + PR("MPDUs XRetried: ", xretries);
  9755. + PR("Aggregates: ", a_aggr);
  9756. + PR("AMPDUs Queued HW:", a_queued_hw);
  9757. +- PR("AMPDUs Queued SW:", a_queued_sw);
  9758. + PR("AMPDUs Completed:", a_completed);
  9759. + PR("AMPDUs Retried: ", a_retries);
  9760. + PR("AMPDUs XRetried: ", a_xretries);
  9761. +@@ -629,8 +628,7 @@ static void print_queue(struct ath_softc
  9762. + seq_printf(file, "%s: %d ", "qnum", txq->axq_qnum);
  9763. + seq_printf(file, "%s: %2d ", "qdepth", txq->axq_depth);
  9764. + seq_printf(file, "%s: %2d ", "ampdu-depth", txq->axq_ampdu_depth);
  9765. +- seq_printf(file, "%s: %3d ", "pending", txq->pending_frames);
  9766. +- seq_printf(file, "%s: %d\n", "stopped", txq->stopped);
  9767. ++ seq_printf(file, "%s: %3d\n", "pending", txq->pending_frames);
  9768. +
  9769. + ath_txq_unlock(sc, txq);
  9770. + }
  9771. +@@ -1208,7 +1206,6 @@ static const char ath9k_gstrings_stats[]
  9772. + AMKSTR(d_tx_mpdu_xretries),
  9773. + AMKSTR(d_tx_aggregates),
  9774. + AMKSTR(d_tx_ampdus_queued_hw),
  9775. +- AMKSTR(d_tx_ampdus_queued_sw),
  9776. + AMKSTR(d_tx_ampdus_completed),
  9777. + AMKSTR(d_tx_ampdu_retries),
  9778. + AMKSTR(d_tx_ampdu_xretries),
  9779. +@@ -1288,7 +1285,6 @@ void ath9k_get_et_stats(struct ieee80211
  9780. + AWDATA(xretries);
  9781. + AWDATA(a_aggr);
  9782. + AWDATA(a_queued_hw);
  9783. +- AWDATA(a_queued_sw);
  9784. + AWDATA(a_completed);
  9785. + AWDATA(a_retries);
  9786. + AWDATA(a_xretries);
  9787. +@@ -1346,14 +1342,6 @@ int ath9k_init_debug(struct ath_hw *ah)
  9788. + read_file_xmit);
  9789. + debugfs_create_devm_seqfile(sc->dev, "queues", sc->debug.debugfs_phy,
  9790. + read_file_queues);
  9791. +- debugfs_create_u32("qlen_bk", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
  9792. +- &sc->tx.txq_max_pending[IEEE80211_AC_BK]);
  9793. +- debugfs_create_u32("qlen_be", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
  9794. +- &sc->tx.txq_max_pending[IEEE80211_AC_BE]);
  9795. +- debugfs_create_u32("qlen_vi", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
  9796. +- &sc->tx.txq_max_pending[IEEE80211_AC_VI]);
  9797. +- debugfs_create_u32("qlen_vo", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
  9798. +- &sc->tx.txq_max_pending[IEEE80211_AC_VO]);
  9799. + debugfs_create_devm_seqfile(sc->dev, "misc", sc->debug.debugfs_phy,
  9800. + read_file_misc);
  9801. + debugfs_create_devm_seqfile(sc->dev, "reset", sc->debug.debugfs_phy,
  9802. +--- a/drivers/net/wireless/ath/ath9k/debug.h
  9803. ++++ b/drivers/net/wireless/ath/ath9k/debug.h
  9804. +@@ -147,7 +147,6 @@ struct ath_interrupt_stats {
  9805. + * @completed: Total MPDUs (non-aggr) completed
  9806. + * @a_aggr: Total no. of aggregates queued
  9807. + * @a_queued_hw: Total AMPDUs queued to hardware
  9808. +- * @a_queued_sw: Total AMPDUs queued to software queues
  9809. + * @a_completed: Total AMPDUs completed
  9810. + * @a_retries: No. of AMPDUs retried (SW)
  9811. + * @a_xretries: No. of AMPDUs dropped due to xretries
  9812. +@@ -174,7 +173,6 @@ struct ath_tx_stats {
  9813. + u32 xretries;
  9814. + u32 a_aggr;
  9815. + u32 a_queued_hw;
  9816. +- u32 a_queued_sw;
  9817. + u32 a_completed;
  9818. + u32 a_retries;
  9819. + u32 a_xretries;
  9820. +--- a/drivers/net/wireless/ath/ath9k/debug_sta.c
  9821. ++++ b/drivers/net/wireless/ath/ath9k/debug_sta.c
  9822. +@@ -52,8 +52,8 @@ static ssize_t read_file_node_aggr(struc
  9823. + "TID", "SEQ_START", "SEQ_NEXT", "BAW_SIZE",
  9824. + "BAW_HEAD", "BAW_TAIL", "BAR_IDX", "SCHED", "PAUSED");
  9825. +
  9826. +- for (tidno = 0, tid = &an->tid[tidno];
  9827. +- tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
  9828. ++ for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) {
  9829. ++ tid = ath_node_to_tid(an, tidno);
  9830. + txq = tid->txq;
  9831. + ath_txq_lock(sc, txq);
  9832. + if (tid->active) {
  9833. +--- a/drivers/net/wireless/ath/ath9k/init.c
  9834. ++++ b/drivers/net/wireless/ath/ath9k/init.c
  9835. +@@ -358,7 +358,6 @@ static int ath9k_init_queues(struct ath_
  9836. + for (i = 0; i < IEEE80211_NUM_ACS; i++) {
  9837. + sc->tx.txq_map[i] = ath_txq_setup(sc, ATH9K_TX_QUEUE_DATA, i);
  9838. + sc->tx.txq_map[i]->mac80211_qnum = i;
  9839. +- sc->tx.txq_max_pending[i] = ATH_MAX_QDEPTH;
  9840. + }
  9841. + return 0;
  9842. + }
  9843. +@@ -873,6 +872,7 @@ static void ath9k_set_hw_capab(struct at
  9844. + hw->max_rate_tries = 10;
  9845. + hw->sta_data_size = sizeof(struct ath_node);
  9846. + hw->vif_data_size = sizeof(struct ath_vif);
  9847. ++ hw->txq_data_size = sizeof(struct ath_atx_tid);
  9848. + hw->extra_tx_headroom = 4;
  9849. +
  9850. + hw->wiphy->available_antennas_rx = BIT(ah->caps.max_rxchains) - 1;
  9851. +--- a/drivers/net/wireless/ath/ath9k/main.c
  9852. ++++ b/drivers/net/wireless/ath/ath9k/main.c
  9853. +@@ -1897,9 +1897,11 @@ static int ath9k_ampdu_action(struct iee
  9854. + bool flush = false;
  9855. + int ret = 0;
  9856. + struct ieee80211_sta *sta = params->sta;
  9857. ++ struct ath_node *an = (struct ath_node *)sta->drv_priv;
  9858. + enum ieee80211_ampdu_mlme_action action = params->action;
  9859. + u16 tid = params->tid;
  9860. + u16 *ssn = &params->ssn;
  9861. ++ struct ath_atx_tid *atid;
  9862. +
  9863. + mutex_lock(&sc->mutex);
  9864. +
  9865. +@@ -1932,9 +1934,9 @@ static int ath9k_ampdu_action(struct iee
  9866. + ath9k_ps_restore(sc);
  9867. + break;
  9868. + case IEEE80211_AMPDU_TX_OPERATIONAL:
  9869. +- ath9k_ps_wakeup(sc);
  9870. +- ath_tx_aggr_resume(sc, sta, tid);
  9871. +- ath9k_ps_restore(sc);
  9872. ++ atid = ath_node_to_tid(an, tid);
  9873. ++ atid->baw_size = IEEE80211_MIN_AMPDU_BUF <<
  9874. ++ sta->ht_cap.ampdu_factor;
  9875. + break;
  9876. + default:
  9877. + ath_err(ath9k_hw_common(sc->sc_ah), "Unknown AMPDU action\n");
  9878. +@@ -2696,4 +2698,5 @@ struct ieee80211_ops ath9k_ops = {
  9879. + .sw_scan_start = ath9k_sw_scan_start,
  9880. + .sw_scan_complete = ath9k_sw_scan_complete,
  9881. + .get_txpower = ath9k_get_txpower,
  9882. ++ .wake_tx_queue = ath9k_wake_tx_queue,
  9883. + };
  9884. +--- a/drivers/net/wireless/ath/ath9k/xmit.c
  9885. ++++ b/drivers/net/wireless/ath/ath9k/xmit.c
  9886. +@@ -67,6 +67,8 @@ static struct ath_buf *ath_tx_setup_buff
  9887. + struct ath_txq *txq,
  9888. + struct ath_atx_tid *tid,
  9889. + struct sk_buff *skb);
  9890. ++static int ath_tx_prepare(struct ieee80211_hw *hw, struct sk_buff *skb,
  9891. ++ struct ath_tx_control *txctl);
  9892. +
  9893. + enum {
  9894. + MCS_HT20,
  9895. +@@ -137,6 +139,26 @@ static void ath_tx_queue_tid(struct ath_
  9896. + list_add_tail(&tid->list, list);
  9897. + }
  9898. +
  9899. ++void ath9k_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *queue)
  9900. ++{
  9901. ++ struct ath_softc *sc = hw->priv;
  9902. ++ struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  9903. ++ struct ath_atx_tid *tid = (struct ath_atx_tid *) queue->drv_priv;
  9904. ++ struct ath_txq *txq = tid->txq;
  9905. ++
  9906. ++ ath_dbg(common, QUEUE, "Waking TX queue: %pM (%d)\n",
  9907. ++ queue->sta ? queue->sta->addr : queue->vif->addr,
  9908. ++ tid->tidno);
  9909. ++
  9910. ++ ath_txq_lock(sc, txq);
  9911. ++
  9912. ++ tid->has_queued = true;
  9913. ++ ath_tx_queue_tid(sc, txq, tid);
  9914. ++ ath_txq_schedule(sc, txq);
  9915. ++
  9916. ++ ath_txq_unlock(sc, txq);
  9917. ++}
  9918. ++
  9919. + static struct ath_frame_info *get_frame_info(struct sk_buff *skb)
  9920. + {
  9921. + struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
  9922. +@@ -179,7 +201,6 @@ static void ath_set_rates(struct ieee802
  9923. + static void ath_txq_skb_done(struct ath_softc *sc, struct ath_txq *txq,
  9924. + struct sk_buff *skb)
  9925. + {
  9926. +- struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  9927. + struct ath_frame_info *fi = get_frame_info(skb);
  9928. + int q = fi->txq;
  9929. +
  9930. +@@ -190,14 +211,6 @@ static void ath_txq_skb_done(struct ath_
  9931. + if (WARN_ON(--txq->pending_frames < 0))
  9932. + txq->pending_frames = 0;
  9933. +
  9934. +- if (txq->stopped &&
  9935. +- txq->pending_frames < sc->tx.txq_max_pending[q]) {
  9936. +- if (ath9k_is_chanctx_enabled())
  9937. +- ieee80211_wake_queue(sc->hw, info->hw_queue);
  9938. +- else
  9939. +- ieee80211_wake_queue(sc->hw, q);
  9940. +- txq->stopped = false;
  9941. +- }
  9942. + }
  9943. +
  9944. + static struct ath_atx_tid *
  9945. +@@ -207,9 +220,48 @@ ath_get_skb_tid(struct ath_softc *sc, st
  9946. + return ATH_AN_2_TID(an, tidno);
  9947. + }
  9948. +
  9949. ++static struct sk_buff *
  9950. ++ath_tid_pull(struct ath_atx_tid *tid)
  9951. ++{
  9952. ++ struct ieee80211_txq *txq = container_of((void*)tid, struct ieee80211_txq, drv_priv);
  9953. ++ struct ath_softc *sc = tid->an->sc;
  9954. ++ struct ieee80211_hw *hw = sc->hw;
  9955. ++ struct ath_tx_control txctl = {
  9956. ++ .txq = tid->txq,
  9957. ++ .sta = tid->an->sta,
  9958. ++ };
  9959. ++ struct sk_buff *skb;
  9960. ++ struct ath_frame_info *fi;
  9961. ++ int q;
  9962. ++
  9963. ++ if (!tid->has_queued)
  9964. ++ return NULL;
  9965. ++
  9966. ++ skb = ieee80211_tx_dequeue(hw, txq);
  9967. ++ if (!skb) {
  9968. ++ tid->has_queued = false;
  9969. ++ return NULL;
  9970. ++ }
  9971. ++
  9972. ++ if (ath_tx_prepare(hw, skb, &txctl)) {
  9973. ++ ieee80211_free_txskb(hw, skb);
  9974. ++ return NULL;
  9975. ++ }
  9976. ++
  9977. ++ q = skb_get_queue_mapping(skb);
  9978. ++ if (tid->txq == sc->tx.txq_map[q]) {
  9979. ++ fi = get_frame_info(skb);
  9980. ++ fi->txq = q;
  9981. ++ ++tid->txq->pending_frames;
  9982. ++ }
  9983. ++
  9984. ++ return skb;
  9985. ++ }
  9986. ++
  9987. ++
  9988. + static bool ath_tid_has_buffered(struct ath_atx_tid *tid)
  9989. + {
  9990. +- return !skb_queue_empty(&tid->buf_q) || !skb_queue_empty(&tid->retry_q);
  9991. ++ return !skb_queue_empty(&tid->retry_q) || tid->has_queued;
  9992. + }
  9993. +
  9994. + static struct sk_buff *ath_tid_dequeue(struct ath_atx_tid *tid)
  9995. +@@ -218,46 +270,11 @@ static struct sk_buff *ath_tid_dequeue(s
  9996. +
  9997. + skb = __skb_dequeue(&tid->retry_q);
  9998. + if (!skb)
  9999. +- skb = __skb_dequeue(&tid->buf_q);
  10000. ++ skb = ath_tid_pull(tid);
  10001. +
  10002. + return skb;
  10003. + }
  10004. +
  10005. +-/*
  10006. +- * ath_tx_tid_change_state:
  10007. +- * - clears a-mpdu flag of previous session
  10008. +- * - force sequence number allocation to fix next BlockAck Window
  10009. +- */
  10010. +-static void
  10011. +-ath_tx_tid_change_state(struct ath_softc *sc, struct ath_atx_tid *tid)
  10012. +-{
  10013. +- struct ath_txq *txq = tid->txq;
  10014. +- struct ieee80211_tx_info *tx_info;
  10015. +- struct sk_buff *skb, *tskb;
  10016. +- struct ath_buf *bf;
  10017. +- struct ath_frame_info *fi;
  10018. +-
  10019. +- skb_queue_walk_safe(&tid->buf_q, skb, tskb) {
  10020. +- fi = get_frame_info(skb);
  10021. +- bf = fi->bf;
  10022. +-
  10023. +- tx_info = IEEE80211_SKB_CB(skb);
  10024. +- tx_info->flags &= ~IEEE80211_TX_CTL_AMPDU;
  10025. +-
  10026. +- if (bf)
  10027. +- continue;
  10028. +-
  10029. +- bf = ath_tx_setup_buffer(sc, txq, tid, skb);
  10030. +- if (!bf) {
  10031. +- __skb_unlink(skb, &tid->buf_q);
  10032. +- ath_txq_skb_done(sc, txq, skb);
  10033. +- ieee80211_free_txskb(sc->hw, skb);
  10034. +- continue;
  10035. +- }
  10036. +- }
  10037. +-
  10038. +-}
  10039. +-
  10040. + static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
  10041. + {
  10042. + struct ath_txq *txq = tid->txq;
  10043. +@@ -898,20 +915,16 @@ static int ath_compute_num_delims(struct
  10044. +
  10045. + static struct ath_buf *
  10046. + ath_tx_get_tid_subframe(struct ath_softc *sc, struct ath_txq *txq,
  10047. +- struct ath_atx_tid *tid, struct sk_buff_head **q)
  10048. ++ struct ath_atx_tid *tid)
  10049. + {
  10050. + struct ieee80211_tx_info *tx_info;
  10051. + struct ath_frame_info *fi;
  10052. +- struct sk_buff *skb;
  10053. ++ struct sk_buff *skb, *first_skb = NULL;
  10054. + struct ath_buf *bf;
  10055. + u16 seqno;
  10056. +
  10057. + while (1) {
  10058. +- *q = &tid->retry_q;
  10059. +- if (skb_queue_empty(*q))
  10060. +- *q = &tid->buf_q;
  10061. +-
  10062. +- skb = skb_peek(*q);
  10063. ++ skb = ath_tid_dequeue(tid);
  10064. + if (!skb)
  10065. + break;
  10066. +
  10067. +@@ -923,7 +936,6 @@ ath_tx_get_tid_subframe(struct ath_softc
  10068. + bf->bf_state.stale = false;
  10069. +
  10070. + if (!bf) {
  10071. +- __skb_unlink(skb, *q);
  10072. + ath_txq_skb_done(sc, txq, skb);
  10073. + ieee80211_free_txskb(sc->hw, skb);
  10074. + continue;
  10075. +@@ -952,8 +964,19 @@ ath_tx_get_tid_subframe(struct ath_softc
  10076. + seqno = bf->bf_state.seqno;
  10077. +
  10078. + /* do not step over block-ack window */
  10079. +- if (!BAW_WITHIN(tid->seq_start, tid->baw_size, seqno))
  10080. ++ if (!BAW_WITHIN(tid->seq_start, tid->baw_size, seqno)) {
  10081. ++ __skb_queue_tail(&tid->retry_q, skb);
  10082. ++
  10083. ++ /* If there are other skbs in the retry q, they are
  10084. ++ * probably within the BAW, so loop immediately to get
  10085. ++ * one of them. Otherwise the queue can get stuck. */
  10086. ++ if (!skb_queue_is_first(&tid->retry_q, skb) && skb != first_skb) {
  10087. ++ if(!first_skb) /* infinite loop prevention */
  10088. ++ first_skb = skb;
  10089. ++ continue;
  10090. ++ }
  10091. + break;
  10092. ++ }
  10093. +
  10094. + if (tid->bar_index > ATH_BA_INDEX(tid->seq_start, seqno)) {
  10095. + struct ath_tx_status ts = {};
  10096. +@@ -961,7 +984,6 @@ ath_tx_get_tid_subframe(struct ath_softc
  10097. +
  10098. + INIT_LIST_HEAD(&bf_head);
  10099. + list_add(&bf->list, &bf_head);
  10100. +- __skb_unlink(skb, *q);
  10101. + ath_tx_update_baw(sc, tid, seqno);
  10102. + ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, &ts, 0);
  10103. + continue;
  10104. +@@ -973,11 +995,10 @@ ath_tx_get_tid_subframe(struct ath_softc
  10105. + return NULL;
  10106. + }
  10107. +
  10108. +-static bool
  10109. ++static int
  10110. + ath_tx_form_aggr(struct ath_softc *sc, struct ath_txq *txq,
  10111. + struct ath_atx_tid *tid, struct list_head *bf_q,
  10112. +- struct ath_buf *bf_first, struct sk_buff_head *tid_q,
  10113. +- int *aggr_len)
  10114. ++ struct ath_buf *bf_first)
  10115. + {
  10116. + #define PADBYTES(_len) ((4 - ((_len) % 4)) % 4)
  10117. + struct ath_buf *bf = bf_first, *bf_prev = NULL;
  10118. +@@ -987,12 +1008,13 @@ ath_tx_form_aggr(struct ath_softc *sc, s
  10119. + struct ieee80211_tx_info *tx_info;
  10120. + struct ath_frame_info *fi;
  10121. + struct sk_buff *skb;
  10122. +- bool closed = false;
  10123. ++
  10124. +
  10125. + bf = bf_first;
  10126. + aggr_limit = ath_lookup_rate(sc, bf, tid);
  10127. +
  10128. +- do {
  10129. ++ while (bf)
  10130. ++ {
  10131. + skb = bf->bf_mpdu;
  10132. + fi = get_frame_info(skb);
  10133. +
  10134. +@@ -1001,12 +1023,12 @@ ath_tx_form_aggr(struct ath_softc *sc, s
  10135. + if (nframes) {
  10136. + if (aggr_limit < al + bpad + al_delta ||
  10137. + ath_lookup_legacy(bf) || nframes >= h_baw)
  10138. +- break;
  10139. ++ goto stop;
  10140. +
  10141. + tx_info = IEEE80211_SKB_CB(bf->bf_mpdu);
  10142. + if ((tx_info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE) ||
  10143. + !(tx_info->flags & IEEE80211_TX_CTL_AMPDU))
  10144. +- break;
  10145. ++ goto stop;
  10146. + }
  10147. +
  10148. + /* add padding for previous frame to aggregation length */
  10149. +@@ -1028,20 +1050,18 @@ ath_tx_form_aggr(struct ath_softc *sc, s
  10150. + ath_tx_addto_baw(sc, tid, bf);
  10151. + bf->bf_state.ndelim = ndelim;
  10152. +
  10153. +- __skb_unlink(skb, tid_q);
  10154. + list_add_tail(&bf->list, bf_q);
  10155. + if (bf_prev)
  10156. + bf_prev->bf_next = bf;
  10157. +
  10158. + bf_prev = bf;
  10159. +
  10160. +- bf = ath_tx_get_tid_subframe(sc, txq, tid, &tid_q);
  10161. +- if (!bf) {
  10162. +- closed = true;
  10163. +- break;
  10164. +- }
  10165. +- } while (ath_tid_has_buffered(tid));
  10166. +-
  10167. ++ bf = ath_tx_get_tid_subframe(sc, txq, tid);
  10168. ++ }
  10169. ++ goto finish;
  10170. ++stop:
  10171. ++ __skb_queue_tail(&tid->retry_q, bf->bf_mpdu);
  10172. ++finish:
  10173. + bf = bf_first;
  10174. + bf->bf_lastbf = bf_prev;
  10175. +
  10176. +@@ -1052,9 +1072,7 @@ ath_tx_form_aggr(struct ath_softc *sc, s
  10177. + TX_STAT_INC(txq->axq_qnum, a_aggr);
  10178. + }
  10179. +
  10180. +- *aggr_len = al;
  10181. +-
  10182. +- return closed;
  10183. ++ return al;
  10184. + #undef PADBYTES
  10185. + }
  10186. +
  10187. +@@ -1431,18 +1449,15 @@ static void ath_tx_fill_desc(struct ath_
  10188. + static void
  10189. + ath_tx_form_burst(struct ath_softc *sc, struct ath_txq *txq,
  10190. + struct ath_atx_tid *tid, struct list_head *bf_q,
  10191. +- struct ath_buf *bf_first, struct sk_buff_head *tid_q)
  10192. ++ struct ath_buf *bf_first)
  10193. + {
  10194. + struct ath_buf *bf = bf_first, *bf_prev = NULL;
  10195. +- struct sk_buff *skb;
  10196. + int nframes = 0;
  10197. +
  10198. + do {
  10199. + struct ieee80211_tx_info *tx_info;
  10200. +- skb = bf->bf_mpdu;
  10201. +
  10202. + nframes++;
  10203. +- __skb_unlink(skb, tid_q);
  10204. + list_add_tail(&bf->list, bf_q);
  10205. + if (bf_prev)
  10206. + bf_prev->bf_next = bf;
  10207. +@@ -1451,13 +1466,15 @@ ath_tx_form_burst(struct ath_softc *sc,
  10208. + if (nframes >= 2)
  10209. + break;
  10210. +
  10211. +- bf = ath_tx_get_tid_subframe(sc, txq, tid, &tid_q);
  10212. ++ bf = ath_tx_get_tid_subframe(sc, txq, tid);
  10213. + if (!bf)
  10214. + break;
  10215. +
  10216. + tx_info = IEEE80211_SKB_CB(bf->bf_mpdu);
  10217. +- if (tx_info->flags & IEEE80211_TX_CTL_AMPDU)
  10218. ++ if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) {
  10219. ++ __skb_queue_tail(&tid->retry_q, bf->bf_mpdu);
  10220. + break;
  10221. ++ }
  10222. +
  10223. + ath_set_rates(tid->an->vif, tid->an->sta, bf, false);
  10224. + } while (1);
  10225. +@@ -1468,34 +1485,33 @@ static bool ath_tx_sched_aggr(struct ath
  10226. + {
  10227. + struct ath_buf *bf;
  10228. + struct ieee80211_tx_info *tx_info;
  10229. +- struct sk_buff_head *tid_q;
  10230. + struct list_head bf_q;
  10231. + int aggr_len = 0;
  10232. +- bool aggr, last = true;
  10233. ++ bool aggr;
  10234. +
  10235. + if (!ath_tid_has_buffered(tid))
  10236. + return false;
  10237. +
  10238. + INIT_LIST_HEAD(&bf_q);
  10239. +
  10240. +- bf = ath_tx_get_tid_subframe(sc, txq, tid, &tid_q);
  10241. ++ bf = ath_tx_get_tid_subframe(sc, txq, tid);
  10242. + if (!bf)
  10243. + return false;
  10244. +
  10245. + tx_info = IEEE80211_SKB_CB(bf->bf_mpdu);
  10246. + aggr = !!(tx_info->flags & IEEE80211_TX_CTL_AMPDU);
  10247. + if ((aggr && txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH) ||
  10248. +- (!aggr && txq->axq_depth >= ATH_NON_AGGR_MIN_QDEPTH)) {
  10249. ++ (!aggr && txq->axq_depth >= ATH_NON_AGGR_MIN_QDEPTH)) {
  10250. ++ __skb_queue_tail(&tid->retry_q, bf->bf_mpdu);
  10251. + *stop = true;
  10252. + return false;
  10253. + }
  10254. +
  10255. + ath_set_rates(tid->an->vif, tid->an->sta, bf, false);
  10256. + if (aggr)
  10257. +- last = ath_tx_form_aggr(sc, txq, tid, &bf_q, bf,
  10258. +- tid_q, &aggr_len);
  10259. ++ aggr_len = ath_tx_form_aggr(sc, txq, tid, &bf_q, bf);
  10260. + else
  10261. +- ath_tx_form_burst(sc, txq, tid, &bf_q, bf, tid_q);
  10262. ++ ath_tx_form_burst(sc, txq, tid, &bf_q, bf);
  10263. +
  10264. + if (list_empty(&bf_q))
  10265. + return false;
  10266. +@@ -1538,9 +1554,6 @@ int ath_tx_aggr_start(struct ath_softc *
  10267. + an->mpdudensity = density;
  10268. + }
  10269. +
  10270. +- /* force sequence number allocation for pending frames */
  10271. +- ath_tx_tid_change_state(sc, txtid);
  10272. +-
  10273. + txtid->active = true;
  10274. + *ssn = txtid->seq_start = txtid->seq_next;
  10275. + txtid->bar_index = -1;
  10276. +@@ -1565,7 +1578,6 @@ void ath_tx_aggr_stop(struct ath_softc *
  10277. + ath_txq_lock(sc, txq);
  10278. + txtid->active = false;
  10279. + ath_tx_flush_tid(sc, txtid);
  10280. +- ath_tx_tid_change_state(sc, txtid);
  10281. + ath_txq_unlock_complete(sc, txq);
  10282. + }
  10283. +
  10284. +@@ -1575,14 +1587,12 @@ void ath_tx_aggr_sleep(struct ieee80211_
  10285. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  10286. + struct ath_atx_tid *tid;
  10287. + struct ath_txq *txq;
  10288. +- bool buffered;
  10289. + int tidno;
  10290. +
  10291. + ath_dbg(common, XMIT, "%s called\n", __func__);
  10292. +
  10293. +- for (tidno = 0, tid = &an->tid[tidno];
  10294. +- tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
  10295. +-
  10296. ++ for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) {
  10297. ++ tid = ath_node_to_tid(an, tidno);
  10298. + txq = tid->txq;
  10299. +
  10300. + ath_txq_lock(sc, txq);
  10301. +@@ -1592,13 +1602,12 @@ void ath_tx_aggr_sleep(struct ieee80211_
  10302. + continue;
  10303. + }
  10304. +
  10305. +- buffered = ath_tid_has_buffered(tid);
  10306. ++ if (!skb_queue_empty(&tid->retry_q))
  10307. ++ ieee80211_sta_set_buffered(sta, tid->tidno, true);
  10308. +
  10309. + list_del_init(&tid->list);
  10310. +
  10311. + ath_txq_unlock(sc, txq);
  10312. +-
  10313. +- ieee80211_sta_set_buffered(sta, tidno, buffered);
  10314. + }
  10315. + }
  10316. +
  10317. +@@ -1611,49 +1620,20 @@ void ath_tx_aggr_wakeup(struct ath_softc
  10318. +
  10319. + ath_dbg(common, XMIT, "%s called\n", __func__);
  10320. +
  10321. +- for (tidno = 0, tid = &an->tid[tidno];
  10322. +- tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
  10323. +-
  10324. ++ for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) {
  10325. ++ tid = ath_node_to_tid(an, tidno);
  10326. + txq = tid->txq;
  10327. +
  10328. + ath_txq_lock(sc, txq);
  10329. + tid->clear_ps_filter = true;
  10330. +-
  10331. + if (ath_tid_has_buffered(tid)) {
  10332. + ath_tx_queue_tid(sc, txq, tid);
  10333. + ath_txq_schedule(sc, txq);
  10334. + }
  10335. +-
  10336. + ath_txq_unlock_complete(sc, txq);
  10337. + }
  10338. + }
  10339. +
  10340. +-void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta,
  10341. +- u16 tidno)
  10342. +-{
  10343. +- struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  10344. +- struct ath_atx_tid *tid;
  10345. +- struct ath_node *an;
  10346. +- struct ath_txq *txq;
  10347. +-
  10348. +- ath_dbg(common, XMIT, "%s called\n", __func__);
  10349. +-
  10350. +- an = (struct ath_node *)sta->drv_priv;
  10351. +- tid = ATH_AN_2_TID(an, tidno);
  10352. +- txq = tid->txq;
  10353. +-
  10354. +- ath_txq_lock(sc, txq);
  10355. +-
  10356. +- tid->baw_size = IEEE80211_MIN_AMPDU_BUF << sta->ht_cap.ampdu_factor;
  10357. +-
  10358. +- if (ath_tid_has_buffered(tid)) {
  10359. +- ath_tx_queue_tid(sc, txq, tid);
  10360. +- ath_txq_schedule(sc, txq);
  10361. +- }
  10362. +-
  10363. +- ath_txq_unlock_complete(sc, txq);
  10364. +-}
  10365. +-
  10366. + void ath9k_release_buffered_frames(struct ieee80211_hw *hw,
  10367. + struct ieee80211_sta *sta,
  10368. + u16 tids, int nframes,
  10369. +@@ -1666,7 +1646,6 @@ void ath9k_release_buffered_frames(struc
  10370. + struct ieee80211_tx_info *info;
  10371. + struct list_head bf_q;
  10372. + struct ath_buf *bf_tail = NULL, *bf;
  10373. +- struct sk_buff_head *tid_q;
  10374. + int sent = 0;
  10375. + int i;
  10376. +
  10377. +@@ -1681,11 +1660,10 @@ void ath9k_release_buffered_frames(struc
  10378. +
  10379. + ath_txq_lock(sc, tid->txq);
  10380. + while (nframes > 0) {
  10381. +- bf = ath_tx_get_tid_subframe(sc, sc->tx.uapsdq, tid, &tid_q);
  10382. ++ bf = ath_tx_get_tid_subframe(sc, sc->tx.uapsdq, tid);
  10383. + if (!bf)
  10384. + break;
  10385. +
  10386. +- __skb_unlink(bf->bf_mpdu, tid_q);
  10387. + list_add_tail(&bf->list, &bf_q);
  10388. + ath_set_rates(tid->an->vif, tid->an->sta, bf, true);
  10389. + if (bf_isampdu(bf)) {
  10390. +@@ -1700,7 +1678,7 @@ void ath9k_release_buffered_frames(struc
  10391. + sent++;
  10392. + TX_STAT_INC(txq->axq_qnum, a_queued_hw);
  10393. +
  10394. +- if (an->sta && !ath_tid_has_buffered(tid))
  10395. ++ if (an->sta && skb_queue_empty(&tid->retry_q))
  10396. + ieee80211_sta_set_buffered(an->sta, i, false);
  10397. + }
  10398. + ath_txq_unlock_complete(sc, tid->txq);
  10399. +@@ -1929,13 +1907,7 @@ bool ath_drain_all_txq(struct ath_softc
  10400. + if (!ATH_TXQ_SETUP(sc, i))
  10401. + continue;
  10402. +
  10403. +- /*
  10404. +- * The caller will resume queues with ieee80211_wake_queues.
  10405. +- * Mark the queue as not stopped to prevent ath_tx_complete
  10406. +- * from waking the queue too early.
  10407. +- */
  10408. + txq = &sc->tx.txq[i];
  10409. +- txq->stopped = false;
  10410. + ath_draintxq(sc, txq);
  10411. + }
  10412. +
  10413. +@@ -2334,16 +2306,14 @@ int ath_tx_start(struct ieee80211_hw *hw
  10414. + struct ath_softc *sc = hw->priv;
  10415. + struct ath_txq *txq = txctl->txq;
  10416. + struct ath_atx_tid *tid = NULL;
  10417. ++ struct ath_node *an = NULL;
  10418. + struct ath_buf *bf;
  10419. +- bool queue, ps_resp;
  10420. ++ bool ps_resp;
  10421. + int q, ret;
  10422. +
  10423. + if (vif)
  10424. + avp = (void *)vif->drv_priv;
  10425. +
  10426. +- if (info->flags & IEEE80211_TX_CTL_TX_OFFCHAN)
  10427. +- txctl->force_channel = true;
  10428. +-
  10429. + ps_resp = !!(info->control.flags & IEEE80211_TX_CTRL_PS_RESPONSE);
  10430. +
  10431. + ret = ath_tx_prepare(hw, skb, txctl);
  10432. +@@ -2358,63 +2328,18 @@ int ath_tx_start(struct ieee80211_hw *hw
  10433. +
  10434. + q = skb_get_queue_mapping(skb);
  10435. +
  10436. +- ath_txq_lock(sc, txq);
  10437. +- if (txq == sc->tx.txq_map[q]) {
  10438. +- fi->txq = q;
  10439. +- if (++txq->pending_frames > sc->tx.txq_max_pending[q] &&
  10440. +- !txq->stopped) {
  10441. +- if (ath9k_is_chanctx_enabled())
  10442. +- ieee80211_stop_queue(sc->hw, info->hw_queue);
  10443. +- else
  10444. +- ieee80211_stop_queue(sc->hw, q);
  10445. +- txq->stopped = true;
  10446. +- }
  10447. +- }
  10448. +-
  10449. +- queue = ieee80211_is_data_present(hdr->frame_control);
  10450. +-
  10451. +- /* If chanctx, queue all null frames while NOA could be there */
  10452. +- if (ath9k_is_chanctx_enabled() &&
  10453. +- ieee80211_is_nullfunc(hdr->frame_control) &&
  10454. +- !txctl->force_channel)
  10455. +- queue = true;
  10456. +-
  10457. +- /* Force queueing of all frames that belong to a virtual interface on
  10458. +- * a different channel context, to ensure that they are sent on the
  10459. +- * correct channel.
  10460. +- */
  10461. +- if (((avp && avp->chanctx != sc->cur_chan) ||
  10462. +- sc->cur_chan->stopped) && !txctl->force_channel) {
  10463. +- if (!txctl->an)
  10464. +- txctl->an = &avp->mcast_node;
  10465. +- queue = true;
  10466. +- ps_resp = false;
  10467. +- }
  10468. +-
  10469. +- if (txctl->an && queue)
  10470. +- tid = ath_get_skb_tid(sc, txctl->an, skb);
  10471. +-
  10472. +- if (ps_resp) {
  10473. +- ath_txq_unlock(sc, txq);
  10474. ++ if (ps_resp)
  10475. + txq = sc->tx.uapsdq;
  10476. +- ath_txq_lock(sc, txq);
  10477. +- } else if (txctl->an && queue) {
  10478. +- WARN_ON(tid->txq != txctl->txq);
  10479. +-
  10480. +- if (info->flags & IEEE80211_TX_CTL_CLEAR_PS_FILT)
  10481. +- tid->clear_ps_filter = true;
  10482. +
  10483. +- /*
  10484. +- * Add this frame to software queue for scheduling later
  10485. +- * for aggregation.
  10486. +- */
  10487. +- TX_STAT_INC(txq->axq_qnum, a_queued_sw);
  10488. +- __skb_queue_tail(&tid->buf_q, skb);
  10489. +- if (!txctl->an->sleeping)
  10490. +- ath_tx_queue_tid(sc, txq, tid);
  10491. ++ if (txctl->sta) {
  10492. ++ an = (struct ath_node *) sta->drv_priv;
  10493. ++ tid = ath_get_skb_tid(sc, an, skb);
  10494. ++ }
  10495. +
  10496. +- ath_txq_schedule(sc, txq);
  10497. +- goto out;
  10498. ++ ath_txq_lock(sc, txq);
  10499. ++ if (txq == sc->tx.txq_map[q]) {
  10500. ++ fi->txq = q;
  10501. ++ ++txq->pending_frames;
  10502. + }
  10503. +
  10504. + bf = ath_tx_setup_buffer(sc, txq, tid, skb);
  10505. +@@ -2907,9 +2832,8 @@ void ath_tx_node_init(struct ath_softc *
  10506. + struct ath_atx_tid *tid;
  10507. + int tidno, acno;
  10508. +
  10509. +- for (tidno = 0, tid = &an->tid[tidno];
  10510. +- tidno < IEEE80211_NUM_TIDS;
  10511. +- tidno++, tid++) {
  10512. ++ for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) {
  10513. ++ tid = ath_node_to_tid(an, tidno);
  10514. + tid->an = an;
  10515. + tid->tidno = tidno;
  10516. + tid->seq_start = tid->seq_next = 0;
  10517. +@@ -2917,11 +2841,14 @@ void ath_tx_node_init(struct ath_softc *
  10518. + tid->baw_head = tid->baw_tail = 0;
  10519. + tid->active = false;
  10520. + tid->clear_ps_filter = true;
  10521. +- __skb_queue_head_init(&tid->buf_q);
  10522. ++ tid->has_queued = false;
  10523. + __skb_queue_head_init(&tid->retry_q);
  10524. + INIT_LIST_HEAD(&tid->list);
  10525. + acno = TID_TO_WME_AC(tidno);
  10526. + tid->txq = sc->tx.txq_map[acno];
  10527. ++
  10528. ++ if (!an->sta)
  10529. ++ break; /* just one multicast ath_atx_tid */
  10530. + }
  10531. + }
  10532. +
  10533. +@@ -2931,9 +2858,8 @@ void ath_tx_node_cleanup(struct ath_soft
  10534. + struct ath_txq *txq;
  10535. + int tidno;
  10536. +
  10537. +- for (tidno = 0, tid = &an->tid[tidno];
  10538. +- tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
  10539. +-
  10540. ++ for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) {
  10541. ++ tid = ath_node_to_tid(an, tidno);
  10542. + txq = tid->txq;
  10543. +
  10544. + ath_txq_lock(sc, txq);
  10545. +@@ -2945,6 +2871,9 @@ void ath_tx_node_cleanup(struct ath_soft
  10546. + tid->active = false;
  10547. +
  10548. + ath_txq_unlock(sc, txq);
  10549. ++
  10550. ++ if (!an->sta)
  10551. ++ break; /* just one multicast ath_atx_tid */
  10552. + }
  10553. + }
  10554. +
  10555. diff --git a/package/kernel/mac80211/patches/337-mac80211-minstrel_ht-fix-a-logic-error-in-RTS-CTS-ha.patch b/package/kernel/mac80211/patches/337-mac80211-minstrel_ht-fix-a-logic-error-in-RTS-CTS-ha.patch
  10556. deleted file mode 100644
  10557. index 229351b..0000000
  10558. --- a/package/kernel/mac80211/patches/337-mac80211-minstrel_ht-fix-a-logic-error-in-RTS-CTS-ha.patch
  10559. +++ /dev/null
  10560. @@ -1,26 +0,0 @@
  10561. -From: Felix Fietkau <nbd@openwrt.org>
  10562. -Date: Wed, 24 Feb 2016 12:03:13 +0100
  10563. -Subject: [PATCH] mac80211: minstrel_ht: fix a logic error in RTS/CTS handling
  10564. -MIME-Version: 1.0
  10565. -Content-Type: text/plain; charset=UTF-8
  10566. -Content-Transfer-Encoding: 8bit
  10567. -
  10568. -RTS/CTS needs to be enabled if the rate is a fallback rate *or* if it's
  10569. -a dual-stream rate and the sta is in dynamic SMPS mode.
  10570. -
  10571. -Fixes: a3ebb4e1b763 ("mac80211: minstrel_ht: handle peers in dynamic SMPS")
  10572. -Reported-by: Matías Richart <mrichart@fing.edu.uy>
  10573. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  10574. ----
  10575. -
  10576. ---- a/net/mac80211/rc80211_minstrel_ht.c
  10577. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  10578. -@@ -872,7 +872,7 @@ minstrel_ht_set_rate(struct minstrel_pri
  10579. - * - if station is in dynamic SMPS (and streams > 1)
  10580. - * - for fallback rates, to increase chances of getting through
  10581. - */
  10582. -- if (offset > 0 &&
  10583. -+ if (offset > 0 ||
  10584. - (mi->sta->smps_mode == IEEE80211_SMPS_DYNAMIC &&
  10585. - group->streams > 1)) {
  10586. - ratetbl->rate[offset].count = ratetbl->rate[offset].count_rts;
  10587. diff --git a/package/kernel/mac80211/patches/338-mac80211-Fix-Public-Action-frame-RX-in-AP-mode.patch b/package/kernel/mac80211/patches/338-mac80211-Fix-Public-Action-frame-RX-in-AP-mode.patch
  10588. deleted file mode 100644
  10589. index 56cd94a..0000000
  10590. --- a/package/kernel/mac80211/patches/338-mac80211-Fix-Public-Action-frame-RX-in-AP-mode.patch
  10591. +++ /dev/null
  10592. @@ -1,35 +0,0 @@
  10593. -From: Jouni Malinen <jouni@qca.qualcomm.com>
  10594. -Date: Tue, 1 Mar 2016 00:29:00 +0200
  10595. -Subject: [PATCH] mac80211: Fix Public Action frame RX in AP mode
  10596. -
  10597. -Public Action frames use special rules for how the BSSID field (Address
  10598. -3) is set. A wildcard BSSID is used in cases where the transmitter and
  10599. -recipient are not members of the same BSS. As such, we need to accept
  10600. -Public Action frames with wildcard BSSID.
  10601. -
  10602. -Commit db8e17324553 ("mac80211: ignore frames between TDLS peers when
  10603. -operating as AP") added a rule that drops Action frames to TDLS-peers
  10604. -based on an Action frame having different DA (Address 1) and BSSID
  10605. -(Address 3) values. This is not correct since it misses the possibility
  10606. -of BSSID being a wildcard BSSID in which case the Address 1 would not
  10607. -necessarily match.
  10608. -
  10609. -Fix this by allowing mac80211 to accept wildcard BSSID in an Action
  10610. -frame when in AP mode.
  10611. -
  10612. -Fixes: db8e17324553 ("mac80211: ignore frames between TDLS peers when operating as AP")
  10613. -Cc: stable@vger.kernel.org
  10614. -Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
  10615. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  10616. ----
  10617. -
  10618. ---- a/net/mac80211/rx.c
  10619. -+++ b/net/mac80211/rx.c
  10620. -@@ -3374,6 +3374,7 @@ static bool ieee80211_accept_frame(struc
  10621. - return false;
  10622. - /* ignore action frames to TDLS-peers */
  10623. - if (ieee80211_is_action(hdr->frame_control) &&
  10624. -+ !is_broadcast_ether_addr(bssid) &&
  10625. - !ether_addr_equal(bssid, hdr->addr1))
  10626. - return false;
  10627. - }
  10628. diff --git a/package/kernel/mac80211/patches/338-mac80211-fix-tim-recalculation-after-PS-response.patch b/package/kernel/mac80211/patches/338-mac80211-fix-tim-recalculation-after-PS-response.patch
  10629. new file mode 100644
  10630. index 0000000..6c0852e
  10631. --- /dev/null
  10632. +++ b/package/kernel/mac80211/patches/338-mac80211-fix-tim-recalculation-after-PS-response.patch
  10633. @@ -0,0 +1,31 @@
  10634. +From: Felix Fietkau <nbd@nbd.name>
  10635. +Date: Fri, 26 Aug 2016 21:57:16 +0200
  10636. +Subject: [PATCH] mac80211: fix tim recalculation after PS response
  10637. +
  10638. +Handle the case where the mac80211 intermediate queues are empty and the
  10639. +driver has buffered frames
  10640. +
  10641. +Fixes: ba8c3d6f16a1 ("mac80211: add an intermediate software queue implementation")
  10642. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  10643. +---
  10644. +
  10645. +--- a/net/mac80211/sta_info.c
  10646. ++++ b/net/mac80211/sta_info.c
  10647. +@@ -1616,7 +1616,6 @@ ieee80211_sta_ps_deliver_response(struct
  10648. +
  10649. + sta_info_recalc_tim(sta);
  10650. + } else {
  10651. +- unsigned long tids = sta->txq_buffered_tids & driver_release_tids;
  10652. + int tid;
  10653. +
  10654. + /*
  10655. +@@ -1648,7 +1647,8 @@ ieee80211_sta_ps_deliver_response(struct
  10656. + for (tid = 0; tid < ARRAY_SIZE(sta->sta.txq); tid++) {
  10657. + struct txq_info *txqi = to_txq_info(sta->sta.txq[tid]);
  10658. +
  10659. +- if (!(tids & BIT(tid)) || txqi->tin.backlog_packets)
  10660. ++ if (!(driver_release_tids & BIT(tid)) ||
  10661. ++ txqi->tin.backlog_packets)
  10662. + continue;
  10663. +
  10664. + sta_info_recalc_tim(sta);
  10665. diff --git a/package/kernel/mac80211/patches/339-ath9k-fix-moredata-bit-in-PS-buffered-frame-release.patch b/package/kernel/mac80211/patches/339-ath9k-fix-moredata-bit-in-PS-buffered-frame-release.patch
  10666. new file mode 100644
  10667. index 0000000..49b37e4
  10668. --- /dev/null
  10669. +++ b/package/kernel/mac80211/patches/339-ath9k-fix-moredata-bit-in-PS-buffered-frame-release.patch
  10670. @@ -0,0 +1,49 @@
  10671. +From: Felix Fietkau <nbd@nbd.name>
  10672. +Date: Sun, 28 Aug 2016 13:13:01 +0200
  10673. +Subject: [PATCH] ath9k: fix moredata bit in PS buffered frame release
  10674. +
  10675. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  10676. +---
  10677. +
  10678. +--- a/drivers/net/wireless/ath/ath9k/xmit.c
  10679. ++++ b/drivers/net/wireless/ath/ath9k/xmit.c
  10680. +@@ -1634,6 +1634,21 @@ void ath_tx_aggr_wakeup(struct ath_softc
  10681. + }
  10682. + }
  10683. +
  10684. ++static void
  10685. ++ath9k_set_moredata(struct ath_softc *sc, struct ath_buf *bf, bool val)
  10686. ++{
  10687. ++ struct ieee80211_hdr *hdr;
  10688. ++ u16 mask = cpu_to_le16(IEEE80211_FCTL_MOREDATA);
  10689. ++ u16 mask_val = mask * val;
  10690. ++
  10691. ++ hdr = (struct ieee80211_hdr *) bf->bf_mpdu->data;
  10692. ++ if ((hdr->frame_control & mask) != mask_val) {
  10693. ++ hdr->frame_control = (hdr->frame_control & ~mask) | mask_val;
  10694. ++ dma_sync_single_for_device(sc->dev, bf->bf_buf_addr,
  10695. ++ sizeof(*hdr), DMA_TO_DEVICE);
  10696. ++ }
  10697. ++}
  10698. ++
  10699. + void ath9k_release_buffered_frames(struct ieee80211_hw *hw,
  10700. + struct ieee80211_sta *sta,
  10701. + u16 tids, int nframes,
  10702. +@@ -1664,6 +1679,7 @@ void ath9k_release_buffered_frames(struc
  10703. + if (!bf)
  10704. + break;
  10705. +
  10706. ++ ath9k_set_moredata(sc, bf, true);
  10707. + list_add_tail(&bf->list, &bf_q);
  10708. + ath_set_rates(tid->an->vif, tid->an->sta, bf, true);
  10709. + if (bf_isampdu(bf)) {
  10710. +@@ -1687,6 +1703,9 @@ void ath9k_release_buffered_frames(struc
  10711. + if (list_empty(&bf_q))
  10712. + return;
  10713. +
  10714. ++ if (!more_data)
  10715. ++ ath9k_set_moredata(sc, bf_tail, false);
  10716. ++
  10717. + info = IEEE80211_SKB_CB(bf_tail->bf_mpdu);
  10718. + info->flags |= IEEE80211_TX_STATUS_EOSP;
  10719. +
  10720. diff --git a/package/kernel/mac80211/patches/339-cfg80211-add-radiotap-VHT-info-to-rtap_namespace_siz.patch b/package/kernel/mac80211/patches/339-cfg80211-add-radiotap-VHT-info-to-rtap_namespace_siz.patch
  10721. deleted file mode 100644
  10722. index 15d6cd0..0000000
  10723. --- a/package/kernel/mac80211/patches/339-cfg80211-add-radiotap-VHT-info-to-rtap_namespace_siz.patch
  10724. +++ /dev/null
  10725. @@ -1,21 +0,0 @@
  10726. -From: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  10727. -Date: Fri, 19 Feb 2016 11:43:04 +0100
  10728. -Subject: [PATCH] cfg80211: add radiotap VHT info to rtap_namespace_sizes
  10729. -
  10730. -Add IEEE80211_RADIOTAP_VHT entry to rtap_namespace_sizes array in order to
  10731. -define alignment and size of VHT info in tx radiotap
  10732. -
  10733. -Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  10734. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  10735. ----
  10736. -
  10737. ---- a/net/wireless/radiotap.c
  10738. -+++ b/net/wireless/radiotap.c
  10739. -@@ -43,6 +43,7 @@ static const struct radiotap_align_size
  10740. - [IEEE80211_RADIOTAP_DATA_RETRIES] = { .align = 1, .size = 1, },
  10741. - [IEEE80211_RADIOTAP_MCS] = { .align = 1, .size = 3, },
  10742. - [IEEE80211_RADIOTAP_AMPDU_STATUS] = { .align = 4, .size = 8, },
  10743. -+ [IEEE80211_RADIOTAP_VHT] = { .align = 2, .size = 12, },
  10744. - /*
  10745. - * add more here as they are defined in radiotap.h
  10746. - */
  10747. diff --git a/package/kernel/mac80211/patches/340-ath9k-clear-potentially-stale-EOSP-status-bit-in-int.patch b/package/kernel/mac80211/patches/340-ath9k-clear-potentially-stale-EOSP-status-bit-in-int.patch
  10748. new file mode 100644
  10749. index 0000000..929da25
  10750. --- /dev/null
  10751. +++ b/package/kernel/mac80211/patches/340-ath9k-clear-potentially-stale-EOSP-status-bit-in-int.patch
  10752. @@ -0,0 +1,22 @@
  10753. +From: Felix Fietkau <nbd@nbd.name>
  10754. +Date: Sun, 28 Aug 2016 13:13:42 +0200
  10755. +Subject: [PATCH] ath9k: clear potentially stale EOSP status bit in
  10756. + intermediate queues
  10757. +
  10758. +Prevents spurious ieee80211_sta_eosp calls.
  10759. +
  10760. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  10761. +---
  10762. +
  10763. +--- a/drivers/net/wireless/ath/ath9k/xmit.c
  10764. ++++ b/drivers/net/wireless/ath/ath9k/xmit.c
  10765. +@@ -945,7 +945,8 @@ ath_tx_get_tid_subframe(struct ath_softc
  10766. + bf->bf_lastbf = bf;
  10767. +
  10768. + tx_info = IEEE80211_SKB_CB(skb);
  10769. +- tx_info->flags &= ~IEEE80211_TX_CTL_CLEAR_PS_FILT;
  10770. ++ tx_info->flags &= ~(IEEE80211_TX_CTL_CLEAR_PS_FILT |
  10771. ++ IEEE80211_TX_STATUS_EOSP);
  10772. +
  10773. + /*
  10774. + * No aggregation session is running, but there may be frames
  10775. diff --git a/package/kernel/mac80211/patches/340-mac80211-fix-parsing-of-40Mhz-in-injected-radiotap-h.patch b/package/kernel/mac80211/patches/340-mac80211-fix-parsing-of-40Mhz-in-injected-radiotap-h.patch
  10776. deleted file mode 100644
  10777. index de1b386..0000000
  10778. --- a/package/kernel/mac80211/patches/340-mac80211-fix-parsing-of-40Mhz-in-injected-radiotap-h.patch
  10779. +++ /dev/null
  10780. @@ -1,36 +0,0 @@
  10781. -From: Sven Eckelmann <sven@narfation.org>
  10782. -Date: Wed, 24 Feb 2016 16:25:49 +0100
  10783. -Subject: [PATCH] mac80211: fix parsing of 40Mhz in injected radiotap
  10784. - header
  10785. -
  10786. -The MCS bandwidth part of the radiotap header is 2 bits wide. The full 2
  10787. -bit have to compared against IEEE80211_RADIOTAP_MCS_BW_40 and not only if
  10788. -the first bit is set. Otherwise IEEE80211_RADIOTAP_MCS_BW_40 can be
  10789. -confused with IEEE80211_RADIOTAP_MCS_BW_20U.
  10790. -
  10791. -Fixes: 5ec3aed9ba4c ("mac80211: Parse legacy and HT rate in injected frames")
  10792. -Signed-off-by: Sven Eckelmann <sven@narfation.org>
  10793. ----
  10794. -
  10795. ---- a/net/mac80211/tx.c
  10796. -+++ b/net/mac80211/tx.c
  10797. -@@ -1689,7 +1689,7 @@ static bool ieee80211_parse_tx_radiotap(
  10798. - bool rate_found = false;
  10799. - u8 rate_retries = 0;
  10800. - u16 rate_flags = 0;
  10801. -- u8 mcs_known, mcs_flags;
  10802. -+ u8 mcs_known, mcs_flags, mcs_bw;
  10803. - int i;
  10804. -
  10805. - info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT |
  10806. -@@ -1765,8 +1765,9 @@ static bool ieee80211_parse_tx_radiotap(
  10807. - mcs_flags & IEEE80211_RADIOTAP_MCS_SGI)
  10808. - rate_flags |= IEEE80211_TX_RC_SHORT_GI;
  10809. -
  10810. -+ mcs_bw = mcs_flags & IEEE80211_RADIOTAP_MCS_BW_MASK;
  10811. - if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_BW &&
  10812. -- mcs_flags & IEEE80211_RADIOTAP_MCS_BW_40)
  10813. -+ mcs_bw == IEEE80211_RADIOTAP_MCS_BW_40)
  10814. - rate_flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
  10815. - break;
  10816. -
  10817. diff --git a/package/kernel/mac80211/patches/341-ath9k-release-PS-buffered-frames-as-A-MPDU-if-enable.patch b/package/kernel/mac80211/patches/341-ath9k-release-PS-buffered-frames-as-A-MPDU-if-enable.patch
  10818. new file mode 100644
  10819. index 0000000..1cc1667
  10820. --- /dev/null
  10821. +++ b/package/kernel/mac80211/patches/341-ath9k-release-PS-buffered-frames-as-A-MPDU-if-enable.patch
  10822. @@ -0,0 +1,40 @@
  10823. +From: Felix Fietkau <nbd@nbd.name>
  10824. +Date: Sun, 28 Aug 2016 13:15:10 +0200
  10825. +Subject: [PATCH] ath9k: release PS buffered frames as A-MPDU if enabled
  10826. +
  10827. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  10828. +---
  10829. +
  10830. +--- a/drivers/net/wireless/ath/ath9k/xmit.c
  10831. ++++ b/drivers/net/wireless/ath/ath9k/xmit.c
  10832. +@@ -1660,10 +1660,11 @@ void ath9k_release_buffered_frames(struc
  10833. + struct ath_node *an = (struct ath_node *)sta->drv_priv;
  10834. + struct ath_txq *txq = sc->tx.uapsdq;
  10835. + struct ieee80211_tx_info *info;
  10836. ++ struct ath_frame_info *fi;
  10837. + struct list_head bf_q;
  10838. + struct ath_buf *bf_tail = NULL, *bf;
  10839. + int sent = 0;
  10840. +- int i;
  10841. ++ int n, i;
  10842. +
  10843. + INIT_LIST_HEAD(&bf_q);
  10844. + for (i = 0; tids && nframes; i++, tids >>= 1) {
  10845. +@@ -1683,10 +1684,15 @@ void ath9k_release_buffered_frames(struc
  10846. + ath9k_set_moredata(sc, bf, true);
  10847. + list_add_tail(&bf->list, &bf_q);
  10848. + ath_set_rates(tid->an->vif, tid->an->sta, bf, true);
  10849. +- if (bf_isampdu(bf)) {
  10850. ++ if (bf_isampdu(bf))
  10851. + ath_tx_addto_baw(sc, tid, bf);
  10852. +- bf->bf_state.bf_type &= ~BUF_AGGR;
  10853. ++ if (bf_isaggr(bf)) {
  10854. ++ fi = get_frame_info(bf->bf_mpdu);
  10855. ++ n = ath_compute_num_delims(sc, tid, bf,
  10856. ++ fi->framelen, true);
  10857. ++ bf->bf_state.ndelim = n;
  10858. + }
  10859. ++
  10860. + if (bf_tail)
  10861. + bf_tail->bf_next = bf;
  10862. +
  10863. diff --git a/package/kernel/mac80211/patches/341-mac80211-parse-VHT-info-in-injected-frames.patch b/package/kernel/mac80211/patches/341-mac80211-parse-VHT-info-in-injected-frames.patch
  10864. deleted file mode 100644
  10865. index ac1f251..0000000
  10866. --- a/package/kernel/mac80211/patches/341-mac80211-parse-VHT-info-in-injected-frames.patch
  10867. +++ /dev/null
  10868. @@ -1,65 +0,0 @@
  10869. -From: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  10870. -Date: Tue, 23 Feb 2016 15:43:35 +0100
  10871. -Subject: [PATCH] mac80211: parse VHT info in injected frames
  10872. -
  10873. -Add VHT radiotap parsing support to ieee80211_parse_tx_radiotap().
  10874. -That capability has been tested using a d-link dir-860l rev b1 running
  10875. -OpenWrt trunk and mt76 driver
  10876. -
  10877. -Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  10878. ----
  10879. -
  10880. ---- a/net/mac80211/tx.c
  10881. -+++ b/net/mac80211/tx.c
  10882. -@@ -1690,6 +1690,8 @@ static bool ieee80211_parse_tx_radiotap(
  10883. - u8 rate_retries = 0;
  10884. - u16 rate_flags = 0;
  10885. - u8 mcs_known, mcs_flags, mcs_bw;
  10886. -+ u16 vht_known;
  10887. -+ u8 vht_mcs = 0, vht_nss = 0;
  10888. - int i;
  10889. -
  10890. - info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT |
  10891. -@@ -1771,6 +1773,32 @@ static bool ieee80211_parse_tx_radiotap(
  10892. - rate_flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
  10893. - break;
  10894. -
  10895. -+ case IEEE80211_RADIOTAP_VHT:
  10896. -+ vht_known = get_unaligned_le16(iterator.this_arg);
  10897. -+ rate_found = true;
  10898. -+
  10899. -+ rate_flags = IEEE80211_TX_RC_VHT_MCS;
  10900. -+ if ((vht_known & IEEE80211_RADIOTAP_VHT_KNOWN_GI) &&
  10901. -+ (iterator.this_arg[2] &
  10902. -+ IEEE80211_RADIOTAP_VHT_FLAG_SGI))
  10903. -+ rate_flags |= IEEE80211_TX_RC_SHORT_GI;
  10904. -+ if (vht_known &
  10905. -+ IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH) {
  10906. -+ if (iterator.this_arg[3] == 1)
  10907. -+ rate_flags |=
  10908. -+ IEEE80211_TX_RC_40_MHZ_WIDTH;
  10909. -+ else if (iterator.this_arg[3] == 4)
  10910. -+ rate_flags |=
  10911. -+ IEEE80211_TX_RC_80_MHZ_WIDTH;
  10912. -+ else if (iterator.this_arg[3] == 11)
  10913. -+ rate_flags |=
  10914. -+ IEEE80211_TX_RC_160_MHZ_WIDTH;
  10915. -+ }
  10916. -+
  10917. -+ vht_mcs = iterator.this_arg[4] >> 4;
  10918. -+ vht_nss = iterator.this_arg[4] & 0xF;
  10919. -+ break;
  10920. -+
  10921. - /*
  10922. - * Please update the file
  10923. - * Documentation/networking/mac80211-injection.txt
  10924. -@@ -1796,6 +1824,9 @@ static bool ieee80211_parse_tx_radiotap(
  10925. -
  10926. - if (rate_flags & IEEE80211_TX_RC_MCS) {
  10927. - info->control.rates[0].idx = rate;
  10928. -+ } else if (rate_flags & IEEE80211_TX_RC_VHT_MCS) {
  10929. -+ ieee80211_rate_set_vht(info->control.rates, vht_mcs,
  10930. -+ vht_nss);
  10931. - } else {
  10932. - for (i = 0; i < sband->n_bitrates; i++) {
  10933. - if (rate * 5 != sband->bitrates[i].bitrate)
  10934. diff --git a/package/kernel/mac80211/patches/342-ath9k-report-tx-status-on-EOSP.patch b/package/kernel/mac80211/patches/342-ath9k-report-tx-status-on-EOSP.patch
  10935. new file mode 100644
  10936. index 0000000..80a3074
  10937. --- /dev/null
  10938. +++ b/package/kernel/mac80211/patches/342-ath9k-report-tx-status-on-EOSP.patch
  10939. @@ -0,0 +1,19 @@
  10940. +From: Felix Fietkau <nbd@nbd.name>
  10941. +Date: Sun, 28 Aug 2016 13:23:27 +0200
  10942. +Subject: [PATCH] ath9k: report tx status on EOSP
  10943. +
  10944. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  10945. +---
  10946. +
  10947. +--- a/drivers/net/wireless/ath/ath9k/xmit.c
  10948. ++++ b/drivers/net/wireless/ath/ath9k/xmit.c
  10949. +@@ -86,7 +86,8 @@ static void ath_tx_status(struct ieee802
  10950. + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  10951. + struct ieee80211_sta *sta = info->status.status_driver_data[0];
  10952. +
  10953. +- if (info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS) {
  10954. ++ if (info->flags & (IEEE80211_TX_CTL_REQ_TX_STATUS |
  10955. ++ IEEE80211_TX_STATUS_EOSP)) {
  10956. + ieee80211_tx_status(hw, skb);
  10957. + return;
  10958. + }
  10959. diff --git a/package/kernel/mac80211/patches/342-mac80211-do-not-pass-injected-frames-without-a-valid.patch b/package/kernel/mac80211/patches/342-mac80211-do-not-pass-injected-frames-without-a-valid.patch
  10960. deleted file mode 100644
  10961. index d7452c2..0000000
  10962. --- a/package/kernel/mac80211/patches/342-mac80211-do-not-pass-injected-frames-without-a-valid.patch
  10963. +++ /dev/null
  10964. @@ -1,23 +0,0 @@
  10965. -From: Felix Fietkau <nbd@openwrt.org>
  10966. -Date: Wed, 2 Mar 2016 15:51:40 +0100
  10967. -Subject: [PATCH] mac80211: do not pass injected frames without a valid rate to
  10968. - the driver
  10969. -
  10970. -Fall back to rate control if the requested bitrate was not found.
  10971. -
  10972. -Fixes: dfdfc2beb0dd ("mac80211: Parse legacy and HT rate in injected frames")
  10973. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  10974. ----
  10975. -
  10976. ---- a/net/mac80211/tx.c
  10977. -+++ b/net/mac80211/tx.c
  10978. -@@ -1837,6 +1837,9 @@ static bool ieee80211_parse_tx_radiotap(
  10979. - }
  10980. - }
  10981. -
  10982. -+ if (info->control.rates[0].idx < 0)
  10983. -+ info->control.flags &= ~IEEE80211_TX_CTRL_RATE_INJECT;
  10984. -+
  10985. - info->control.rates[0].flags = rate_flags;
  10986. - info->control.rates[0].count = min_t(u8, rate_retries + 1,
  10987. - local->hw.max_rate_tries);
  10988. diff --git a/package/kernel/mac80211/patches/343-ath9k-fix-block-ack-window-tracking-issues.patch b/package/kernel/mac80211/patches/343-ath9k-fix-block-ack-window-tracking-issues.patch
  10989. new file mode 100644
  10990. index 0000000..007a8d7d
  10991. --- /dev/null
  10992. +++ b/package/kernel/mac80211/patches/343-ath9k-fix-block-ack-window-tracking-issues.patch
  10993. @@ -0,0 +1,111 @@
  10994. +From: Felix Fietkau <nbd@nbd.name>
  10995. +Date: Tue, 30 Aug 2016 12:44:08 +0200
  10996. +Subject: [PATCH] ath9k: fix block-ack window tracking issues
  10997. +
  10998. +Ensure that a buffer gets tracked as part of the block-ack window as
  10999. +soon as it's dequeued from the tid for the first time. Ensure that
  11000. +double calls to ath_tx_addto_baw (e.g. on retransmission) don't cause
  11001. +any issues.
  11002. +
  11003. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  11004. +---
  11005. +
  11006. +--- a/drivers/net/wireless/ath/ath9k/xmit.c
  11007. ++++ b/drivers/net/wireless/ath/ath9k/xmit.c
  11008. +@@ -62,7 +62,7 @@ static void ath_tx_rc_status(struct ath_
  11009. + struct ath_tx_status *ts, int nframes, int nbad,
  11010. + int txok);
  11011. + static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid,
  11012. +- int seqno);
  11013. ++ struct ath_buf *bf);
  11014. + static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc,
  11015. + struct ath_txq *txq,
  11016. + struct ath_atx_tid *tid,
  11017. +@@ -300,7 +300,7 @@ static void ath_tx_flush_tid(struct ath_
  11018. + }
  11019. +
  11020. + if (fi->baw_tracked) {
  11021. +- ath_tx_update_baw(sc, tid, bf->bf_state.seqno);
  11022. ++ ath_tx_update_baw(sc, tid, bf);
  11023. + sendbar = true;
  11024. + }
  11025. +
  11026. +@@ -316,10 +316,15 @@ static void ath_tx_flush_tid(struct ath_
  11027. + }
  11028. +
  11029. + static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid,
  11030. +- int seqno)
  11031. ++ struct ath_buf *bf)
  11032. + {
  11033. ++ struct ath_frame_info *fi = get_frame_info(bf->bf_mpdu);
  11034. ++ u16 seqno = bf->bf_state.seqno;
  11035. + int index, cindex;
  11036. +
  11037. ++ if (!fi->baw_tracked)
  11038. ++ return;
  11039. ++
  11040. + index = ATH_BA_INDEX(tid->seq_start, seqno);
  11041. + cindex = (tid->baw_head + index) & (ATH_TID_MAX_BUFS - 1);
  11042. +
  11043. +@@ -340,6 +345,9 @@ static void ath_tx_addto_baw(struct ath_
  11044. + u16 seqno = bf->bf_state.seqno;
  11045. + int index, cindex;
  11046. +
  11047. ++ if (fi->baw_tracked)
  11048. ++ return;
  11049. ++
  11050. + index = ATH_BA_INDEX(tid->seq_start, seqno);
  11051. + cindex = (tid->baw_head + index) & (ATH_TID_MAX_BUFS - 1);
  11052. + __set_bit(cindex, tid->tx_buf);
  11053. +@@ -616,7 +624,7 @@ static void ath_tx_complete_aggr(struct
  11054. + * complete the acked-ones/xretried ones; update
  11055. + * block-ack window
  11056. + */
  11057. +- ath_tx_update_baw(sc, tid, seqno);
  11058. ++ ath_tx_update_baw(sc, tid, bf);
  11059. +
  11060. + if (rc_update && (acked_cnt == 1 || txfail_cnt == 1)) {
  11061. + memcpy(tx_info->control.rates, rates, sizeof(rates));
  11062. +@@ -646,7 +654,7 @@ static void ath_tx_complete_aggr(struct
  11063. + * run out of tx buf.
  11064. + */
  11065. + if (!tbf) {
  11066. +- ath_tx_update_baw(sc, tid, seqno);
  11067. ++ ath_tx_update_baw(sc, tid, bf);
  11068. +
  11069. + ath_tx_complete_buf(sc, bf, txq,
  11070. + &bf_head, NULL, ts,
  11071. +@@ -986,11 +994,14 @@ ath_tx_get_tid_subframe(struct ath_softc
  11072. +
  11073. + INIT_LIST_HEAD(&bf_head);
  11074. + list_add(&bf->list, &bf_head);
  11075. +- ath_tx_update_baw(sc, tid, seqno);
  11076. ++ ath_tx_update_baw(sc, tid, bf);
  11077. + ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, &ts, 0);
  11078. + continue;
  11079. + }
  11080. +
  11081. ++ if (bf_isampdu(bf))
  11082. ++ ath_tx_addto_baw(sc, tid, bf);
  11083. ++
  11084. + return bf;
  11085. + }
  11086. +
  11087. +@@ -1048,8 +1059,6 @@ ath_tx_form_aggr(struct ath_softc *sc, s
  11088. + bf->bf_next = NULL;
  11089. +
  11090. + /* link buffers of this frame to the aggregate */
  11091. +- if (!fi->baw_tracked)
  11092. +- ath_tx_addto_baw(sc, tid, bf);
  11093. + bf->bf_state.ndelim = ndelim;
  11094. +
  11095. + list_add_tail(&bf->list, bf_q);
  11096. +@@ -1685,8 +1694,6 @@ void ath9k_release_buffered_frames(struc
  11097. + ath9k_set_moredata(sc, bf, true);
  11098. + list_add_tail(&bf->list, &bf_q);
  11099. + ath_set_rates(tid->an->vif, tid->an->sta, bf, true);
  11100. +- if (bf_isampdu(bf))
  11101. +- ath_tx_addto_baw(sc, tid, bf);
  11102. + if (bf_isaggr(bf)) {
  11103. + fi = get_frame_info(bf->bf_mpdu);
  11104. + n = ath_compute_num_delims(sc, tid, bf,
  11105. diff --git a/package/kernel/mac80211/patches/343-mac80211-minstrel_ht-improve-sample-rate-skip-logic.patch b/package/kernel/mac80211/patches/343-mac80211-minstrel_ht-improve-sample-rate-skip-logic.patch
  11106. deleted file mode 100644
  11107. index 55ff817..0000000
  11108. --- a/package/kernel/mac80211/patches/343-mac80211-minstrel_ht-improve-sample-rate-skip-logic.patch
  11109. +++ /dev/null
  11110. @@ -1,77 +0,0 @@
  11111. -From: Felix Fietkau <nbd@openwrt.org>
  11112. -Date: Thu, 3 Mar 2016 23:20:06 +0100
  11113. -Subject: [PATCH] mac80211: minstrel_ht: improve sample rate skip logic
  11114. -
  11115. -There were a few issues that were slowing down the process of finding
  11116. -the optimal rate, especially on devices with multi-rate retry
  11117. -limitations:
  11118. -
  11119. -When max_tp_rate[0] was slower than max_tp_rate[1], the code did not
  11120. -sample max_tp_rate[1], which would often allow it to switch places with
  11121. -max_tp_rate[0] (e.g. if only the first sampling attempts were bad, but the
  11122. -rate is otherwise good).
  11123. -
  11124. -Also, sample attempts of rates between max_tp_rate[0] and [1] were being
  11125. -ignored in this case, because the code only checked if the rate was
  11126. -slower than [1].
  11127. -
  11128. -Fix this by checking against the fastest / second fastest max_tp_rate
  11129. -instead of assuming a specific order between the two.
  11130. -
  11131. -In my tests this patch significantly reduces the time until minstrel_ht
  11132. -finds the optimal rate right after assoc
  11133. -
  11134. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  11135. ----
  11136. -
  11137. ---- a/net/mac80211/rc80211_minstrel_ht.c
  11138. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  11139. -@@ -958,6 +958,7 @@ minstrel_get_sample_rate(struct minstrel
  11140. - struct minstrel_rate_stats *mrs;
  11141. - struct minstrel_mcs_group_data *mg;
  11142. - unsigned int sample_dur, sample_group, cur_max_tp_streams;
  11143. -+ int tp_rate1, tp_rate2;
  11144. - int sample_idx = 0;
  11145. -
  11146. - if (mi->sample_wait > 0) {
  11147. -@@ -979,14 +980,22 @@ minstrel_get_sample_rate(struct minstrel
  11148. - mrs = &mg->rates[sample_idx];
  11149. - sample_idx += sample_group * MCS_GROUP_RATES;
  11150. -
  11151. -+ /* Set tp_rate1, tp_rate2 to the highest / second highest max_tp_rate */
  11152. -+ if (minstrel_get_duration(mi->max_tp_rate[0]) >
  11153. -+ minstrel_get_duration(mi->max_tp_rate[1])) {
  11154. -+ tp_rate1 = mi->max_tp_rate[1];
  11155. -+ tp_rate2 = mi->max_tp_rate[0];
  11156. -+ } else {
  11157. -+ tp_rate1 = mi->max_tp_rate[0];
  11158. -+ tp_rate2 = mi->max_tp_rate[1];
  11159. -+ }
  11160. -+
  11161. - /*
  11162. - * Sampling might add some overhead (RTS, no aggregation)
  11163. -- * to the frame. Hence, don't use sampling for the currently
  11164. -- * used rates.
  11165. -+ * to the frame. Hence, don't use sampling for the highest currently
  11166. -+ * used highest throughput or probability rate.
  11167. - */
  11168. -- if (sample_idx == mi->max_tp_rate[0] ||
  11169. -- sample_idx == mi->max_tp_rate[1] ||
  11170. -- sample_idx == mi->max_prob_rate)
  11171. -+ if (sample_idx == mi->max_tp_rate[0] || sample_idx == mi->max_prob_rate)
  11172. - return -1;
  11173. -
  11174. - /*
  11175. -@@ -1001,10 +1010,10 @@ minstrel_get_sample_rate(struct minstrel
  11176. - * if the link is working perfectly.
  11177. - */
  11178. -
  11179. -- cur_max_tp_streams = minstrel_mcs_groups[mi->max_tp_rate[0] /
  11180. -+ cur_max_tp_streams = minstrel_mcs_groups[tp_rate1 /
  11181. - MCS_GROUP_RATES].streams;
  11182. - sample_dur = minstrel_get_duration(sample_idx);
  11183. -- if (sample_dur >= minstrel_get_duration(mi->max_tp_rate[1]) &&
  11184. -+ if (sample_dur >= minstrel_get_duration(tp_rate2) &&
  11185. - (cur_max_tp_streams - 1 <
  11186. - minstrel_mcs_groups[sample_group].streams ||
  11187. - sample_dur >= minstrel_get_duration(mi->max_prob_rate))) {
  11188. diff --git a/package/kernel/mac80211/patches/344-0001-brcmfmac-change-function-name-for-brcmf_cfg80211_wai.patch b/package/kernel/mac80211/patches/344-0001-brcmfmac-change-function-name-for-brcmf_cfg80211_wai.patch
  11189. deleted file mode 100644
  11190. index e3427de..0000000
  11191. --- a/package/kernel/mac80211/patches/344-0001-brcmfmac-change-function-name-for-brcmf_cfg80211_wai.patch
  11192. +++ /dev/null
  11193. @@ -1,99 +0,0 @@
  11194. -From: Arend van Spriel <arend@broadcom.com>
  11195. -Date: Wed, 17 Feb 2016 11:26:50 +0100
  11196. -Subject: [PATCH] brcmfmac: change function name for
  11197. - brcmf_cfg80211_wait_vif_event_timeout()
  11198. -
  11199. -Dropping the '_timeout' from the function name as the fact that a timeout
  11200. -value is passed makes it obvious a timeout is used. Also helps to keep code
  11201. -lines a bit shorter and easier to stick to 80 char boundary.
  11202. -
  11203. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  11204. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11205. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11206. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11207. ----
  11208. -
  11209. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  11210. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  11211. -@@ -564,8 +564,8 @@ struct wireless_dev *brcmf_ap_add_vif(st
  11212. - }
  11213. -
  11214. - /* wait for firmware event */
  11215. -- err = brcmf_cfg80211_wait_vif_event_timeout(cfg, BRCMF_E_IF_ADD,
  11216. -- BRCMF_VIF_EVENT_TIMEOUT);
  11217. -+ err = brcmf_cfg80211_wait_vif_event(cfg, BRCMF_E_IF_ADD,
  11218. -+ BRCMF_VIF_EVENT_TIMEOUT);
  11219. - brcmf_cfg80211_arm_vif_event(cfg, NULL);
  11220. - if (!err) {
  11221. - brcmf_err("timeout occurred\n");
  11222. -@@ -6395,8 +6395,9 @@ bool brcmf_cfg80211_vif_event_armed(stru
  11223. -
  11224. - return armed;
  11225. - }
  11226. --int brcmf_cfg80211_wait_vif_event_timeout(struct brcmf_cfg80211_info *cfg,
  11227. -- u8 action, ulong timeout)
  11228. -+
  11229. -+int brcmf_cfg80211_wait_vif_event(struct brcmf_cfg80211_info *cfg,
  11230. -+ u8 action, ulong timeout)
  11231. - {
  11232. - struct brcmf_cfg80211_vif_event *event = &cfg->vif_event;
  11233. -
  11234. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  11235. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  11236. -@@ -402,8 +402,8 @@ bool brcmf_get_vif_state_any(struct brcm
  11237. - void brcmf_cfg80211_arm_vif_event(struct brcmf_cfg80211_info *cfg,
  11238. - struct brcmf_cfg80211_vif *vif);
  11239. - bool brcmf_cfg80211_vif_event_armed(struct brcmf_cfg80211_info *cfg);
  11240. --int brcmf_cfg80211_wait_vif_event_timeout(struct brcmf_cfg80211_info *cfg,
  11241. -- u8 action, ulong timeout);
  11242. -+int brcmf_cfg80211_wait_vif_event(struct brcmf_cfg80211_info *cfg,
  11243. -+ u8 action, ulong timeout);
  11244. - s32 brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg,
  11245. - struct brcmf_if *ifp, bool aborted,
  11246. - bool fw_abort);
  11247. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  11248. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  11249. -@@ -1988,8 +1988,8 @@ int brcmf_p2p_ifchange(struct brcmf_cfg8
  11250. - brcmf_cfg80211_arm_vif_event(cfg, NULL);
  11251. - return err;
  11252. - }
  11253. -- err = brcmf_cfg80211_wait_vif_event_timeout(cfg, BRCMF_E_IF_CHANGE,
  11254. -- BRCMF_VIF_EVENT_TIMEOUT);
  11255. -+ err = brcmf_cfg80211_wait_vif_event(cfg, BRCMF_E_IF_CHANGE,
  11256. -+ BRCMF_VIF_EVENT_TIMEOUT);
  11257. - brcmf_cfg80211_arm_vif_event(cfg, NULL);
  11258. - if (!err) {
  11259. - brcmf_err("No BRCMF_E_IF_CHANGE event received\n");
  11260. -@@ -2090,8 +2090,8 @@ static struct wireless_dev *brcmf_p2p_cr
  11261. - }
  11262. -
  11263. - /* wait for firmware event */
  11264. -- err = brcmf_cfg80211_wait_vif_event_timeout(p2p->cfg, BRCMF_E_IF_ADD,
  11265. -- BRCMF_VIF_EVENT_TIMEOUT);
  11266. -+ err = brcmf_cfg80211_wait_vif_event(p2p->cfg, BRCMF_E_IF_ADD,
  11267. -+ BRCMF_VIF_EVENT_TIMEOUT);
  11268. - brcmf_cfg80211_arm_vif_event(p2p->cfg, NULL);
  11269. - brcmf_fweh_p2pdev_setup(pri_ifp, false);
  11270. - if (!err) {
  11271. -@@ -2180,8 +2180,8 @@ struct wireless_dev *brcmf_p2p_add_vif(s
  11272. - }
  11273. -
  11274. - /* wait for firmware event */
  11275. -- err = brcmf_cfg80211_wait_vif_event_timeout(cfg, BRCMF_E_IF_ADD,
  11276. -- BRCMF_VIF_EVENT_TIMEOUT);
  11277. -+ err = brcmf_cfg80211_wait_vif_event(cfg, BRCMF_E_IF_ADD,
  11278. -+ BRCMF_VIF_EVENT_TIMEOUT);
  11279. - brcmf_cfg80211_arm_vif_event(cfg, NULL);
  11280. - if (!err) {
  11281. - brcmf_err("timeout occurred\n");
  11282. -@@ -2274,8 +2274,8 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  11283. - }
  11284. - if (!err) {
  11285. - /* wait for firmware event */
  11286. -- err = brcmf_cfg80211_wait_vif_event_timeout(cfg, BRCMF_E_IF_DEL,
  11287. -- BRCMF_VIF_EVENT_TIMEOUT);
  11288. -+ err = brcmf_cfg80211_wait_vif_event(cfg, BRCMF_E_IF_DEL,
  11289. -+ BRCMF_VIF_EVENT_TIMEOUT);
  11290. - if (!err)
  11291. - err = -EIO;
  11292. - else
  11293. diff --git a/package/kernel/mac80211/patches/344-0002-brcmfmac-Limit-memory-allocs-to-64K.patch b/package/kernel/mac80211/patches/344-0002-brcmfmac-Limit-memory-allocs-to-64K.patch
  11294. deleted file mode 100644
  11295. index 9c336f7..0000000
  11296. --- a/package/kernel/mac80211/patches/344-0002-brcmfmac-Limit-memory-allocs-to-64K.patch
  11297. +++ /dev/null
  11298. @@ -1,127 +0,0 @@
  11299. -From: Hante Meuleman <meuleman@broadcom.com>
  11300. -Date: Wed, 17 Feb 2016 11:26:51 +0100
  11301. -Subject: [PATCH] brcmfmac: Limit memory allocs to <64K
  11302. -
  11303. -Some systems have problems with allocating memory allocation larger
  11304. -then 64K. Often on unload/load or suspend/resume a failure is
  11305. -reported: Could not allocate wiphy device. This patch makes the
  11306. -escan intermediate storage buf dynamically allocated, and smaller
  11307. -than 64K.
  11308. -
  11309. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  11310. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  11311. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11312. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  11313. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11314. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11315. ----
  11316. -
  11317. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  11318. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  11319. -@@ -1125,7 +1125,7 @@ brcmf_cfg80211_escan(struct wiphy *wiphy
  11320. -
  11321. - /* Arm scan timeout timer */
  11322. - mod_timer(&cfg->escan_timeout, jiffies +
  11323. -- WL_ESCAN_TIMER_INTERVAL_MS * HZ / 1000);
  11324. -+ BRCMF_ESCAN_TIMER_INTERVAL_MS * HZ / 1000);
  11325. -
  11326. - return 0;
  11327. -
  11328. -@@ -3020,7 +3020,7 @@ brcmf_cfg80211_escan_handler(struct brcm
  11329. -
  11330. - list = (struct brcmf_scan_results *)
  11331. - cfg->escan_info.escan_buf;
  11332. -- if (bi_length > WL_ESCAN_BUF_SIZE - list->buflen) {
  11333. -+ if (bi_length > BRCMF_ESCAN_BUF_SIZE - list->buflen) {
  11334. - brcmf_err("Buffer is too small: ignoring\n");
  11335. - goto exit;
  11336. - }
  11337. -@@ -3033,8 +3033,8 @@ brcmf_cfg80211_escan_handler(struct brcm
  11338. - bss_info_le))
  11339. - goto exit;
  11340. - }
  11341. -- memcpy(&(cfg->escan_info.escan_buf[list->buflen]),
  11342. -- bss_info_le, bi_length);
  11343. -+ memcpy(&cfg->escan_info.escan_buf[list->buflen], bss_info_le,
  11344. -+ bi_length);
  11345. - list->version = le32_to_cpu(bss_info_le->version);
  11346. - list->buflen += bi_length;
  11347. - list->count++;
  11348. -@@ -5402,14 +5402,14 @@ static void brcmf_deinit_priv_mem(struct
  11349. - {
  11350. - kfree(cfg->conf);
  11351. - cfg->conf = NULL;
  11352. -- kfree(cfg->escan_ioctl_buf);
  11353. -- cfg->escan_ioctl_buf = NULL;
  11354. - kfree(cfg->extra_buf);
  11355. - cfg->extra_buf = NULL;
  11356. - kfree(cfg->wowl.nd);
  11357. - cfg->wowl.nd = NULL;
  11358. - kfree(cfg->wowl.nd_info);
  11359. - cfg->wowl.nd_info = NULL;
  11360. -+ kfree(cfg->escan_info.escan_buf);
  11361. -+ cfg->escan_info.escan_buf = NULL;
  11362. - }
  11363. -
  11364. - static s32 brcmf_init_priv_mem(struct brcmf_cfg80211_info *cfg)
  11365. -@@ -5417,9 +5417,6 @@ static s32 brcmf_init_priv_mem(struct br
  11366. - cfg->conf = kzalloc(sizeof(*cfg->conf), GFP_KERNEL);
  11367. - if (!cfg->conf)
  11368. - goto init_priv_mem_out;
  11369. -- cfg->escan_ioctl_buf = kzalloc(BRCMF_DCMD_MEDLEN, GFP_KERNEL);
  11370. -- if (!cfg->escan_ioctl_buf)
  11371. -- goto init_priv_mem_out;
  11372. - cfg->extra_buf = kzalloc(WL_EXTRA_BUF_MAX, GFP_KERNEL);
  11373. - if (!cfg->extra_buf)
  11374. - goto init_priv_mem_out;
  11375. -@@ -5431,6 +5428,9 @@ static s32 brcmf_init_priv_mem(struct br
  11376. - GFP_KERNEL);
  11377. - if (!cfg->wowl.nd_info)
  11378. - goto init_priv_mem_out;
  11379. -+ cfg->escan_info.escan_buf = kzalloc(BRCMF_ESCAN_BUF_SIZE, GFP_KERNEL);
  11380. -+ if (!cfg->escan_info.escan_buf)
  11381. -+ goto init_priv_mem_out;
  11382. -
  11383. - return 0;
  11384. -
  11385. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  11386. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  11387. -@@ -28,8 +28,11 @@
  11388. - #define WL_ROAM_TRIGGER_LEVEL -75
  11389. - #define WL_ROAM_DELTA 20
  11390. -
  11391. --#define WL_ESCAN_BUF_SIZE (1024 * 64)
  11392. --#define WL_ESCAN_TIMER_INTERVAL_MS 10000 /* E-Scan timeout */
  11393. -+/* Keep BRCMF_ESCAN_BUF_SIZE below 64K (65536). Allocing over 64K can be
  11394. -+ * problematic on some systems and should be avoided.
  11395. -+ */
  11396. -+#define BRCMF_ESCAN_BUF_SIZE 65000
  11397. -+#define BRCMF_ESCAN_TIMER_INTERVAL_MS 10000 /* E-Scan timeout */
  11398. -
  11399. - #define WL_ESCAN_ACTION_START 1
  11400. - #define WL_ESCAN_ACTION_CONTINUE 2
  11401. -@@ -205,7 +208,7 @@ enum wl_escan_state {
  11402. -
  11403. - struct escan_info {
  11404. - u32 escan_state;
  11405. -- u8 escan_buf[WL_ESCAN_BUF_SIZE];
  11406. -+ u8 *escan_buf;
  11407. - struct wiphy *wiphy;
  11408. - struct brcmf_if *ifp;
  11409. - s32 (*run)(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp,
  11410. -@@ -278,7 +281,6 @@ struct brcmf_cfg80211_wowl {
  11411. - * @escan_info: escan information.
  11412. - * @escan_timeout: Timer for catch scan timeout.
  11413. - * @escan_timeout_work: scan timeout worker.
  11414. -- * @escan_ioctl_buf: dongle command buffer for escan commands.
  11415. - * @vif_list: linked list of vif instances.
  11416. - * @vif_cnt: number of vif instances.
  11417. - * @vif_event: vif event signalling.
  11418. -@@ -309,7 +311,6 @@ struct brcmf_cfg80211_info {
  11419. - struct escan_info escan_info;
  11420. - struct timer_list escan_timeout;
  11421. - struct work_struct escan_timeout_work;
  11422. -- u8 *escan_ioctl_buf;
  11423. - struct list_head vif_list;
  11424. - struct brcmf_cfg80211_vif_event vif_event;
  11425. - struct completion vif_disabled;
  11426. diff --git a/package/kernel/mac80211/patches/344-0003-brcmfmac-check-for-wowl-support-before-enumerating-f.patch b/package/kernel/mac80211/patches/344-0003-brcmfmac-check-for-wowl-support-before-enumerating-f.patch
  11427. deleted file mode 100644
  11428. index ee3d9f3..0000000
  11429. --- a/package/kernel/mac80211/patches/344-0003-brcmfmac-check-for-wowl-support-before-enumerating-f.patch
  11430. +++ /dev/null
  11431. @@ -1,29 +0,0 @@
  11432. -From: Franky Lin <frankyl@broadcom.com>
  11433. -Date: Wed, 17 Feb 2016 11:26:52 +0100
  11434. -Subject: [PATCH] brcmfmac: check for wowl support before enumerating feature
  11435. - flag
  11436. -
  11437. -In some cases wiphy->wowlan could be NULL if firmware doesn't have the
  11438. -support. Driver should check for support before walking down the feature
  11439. -flags.
  11440. -
  11441. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  11442. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11443. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  11444. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  11445. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11446. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11447. ----
  11448. -
  11449. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  11450. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  11451. -@@ -6594,7 +6594,8 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  11452. - if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_SCAN_RANDOM_MAC)) {
  11453. - wiphy->features |= NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR;
  11454. - #ifdef CONFIG_PM
  11455. -- if (wiphy->wowlan->flags & WIPHY_WOWLAN_NET_DETECT)
  11456. -+ if (wiphy->wowlan &&
  11457. -+ wiphy->wowlan->flags & WIPHY_WOWLAN_NET_DETECT)
  11458. - wiphy->features |= NL80211_FEATURE_ND_RANDOM_MAC_ADDR;
  11459. - #endif
  11460. - }
  11461. diff --git a/package/kernel/mac80211/patches/344-0004-brcmfmac-Configure-country-code-using-device-specifi.patch b/package/kernel/mac80211/patches/344-0004-brcmfmac-Configure-country-code-using-device-specifi.patch
  11462. deleted file mode 100644
  11463. index c52cac8..0000000
  11464. --- a/package/kernel/mac80211/patches/344-0004-brcmfmac-Configure-country-code-using-device-specifi.patch
  11465. +++ /dev/null
  11466. @@ -1,214 +0,0 @@
  11467. -From: Hante Meuleman <meuleman@broadcom.com>
  11468. -Date: Wed, 17 Feb 2016 11:26:53 +0100
  11469. -Subject: [PATCH] brcmfmac: Configure country code using device specific
  11470. - settings
  11471. -
  11472. -Country code configuration in a device is a device specific
  11473. -operation. For this the country code as specified by reg notifier
  11474. -(iso3166 alpha2) needs to be translated to a device specific
  11475. -country locale and revision number. This patch adds this
  11476. -translation and puts a placeholder in the device specific settings
  11477. -where the translation table can be stored. Additional patches will
  11478. -be needed to read these tables from for example device platform
  11479. -data.
  11480. -
  11481. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  11482. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  11483. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11484. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  11485. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11486. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11487. ----
  11488. -
  11489. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  11490. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  11491. -@@ -6405,28 +6405,85 @@ int brcmf_cfg80211_wait_vif_event(struct
  11492. - vif_event_equals(event, action), timeout);
  11493. - }
  11494. -
  11495. -+static s32 brcmf_translate_country_code(struct brcmf_pub *drvr, char alpha2[2],
  11496. -+ struct brcmf_fil_country_le *ccreq)
  11497. -+{
  11498. -+ struct cc_translate *country_codes;
  11499. -+ struct cc_entry *cc;
  11500. -+ s32 found_index;
  11501. -+ int i;
  11502. -+
  11503. -+ country_codes = drvr->settings->country_codes;
  11504. -+ if (!country_codes) {
  11505. -+ brcmf_dbg(TRACE, "No country codes configured for device\n");
  11506. -+ return -EINVAL;
  11507. -+ }
  11508. -+
  11509. -+ if ((alpha2[0] == ccreq->country_abbrev[0]) &&
  11510. -+ (alpha2[1] == ccreq->country_abbrev[1])) {
  11511. -+ brcmf_dbg(TRACE, "Country code already set\n");
  11512. -+ return -EAGAIN;
  11513. -+ }
  11514. -+
  11515. -+ found_index = -1;
  11516. -+ for (i = 0; i < country_codes->table_size; i++) {
  11517. -+ cc = &country_codes->table[i];
  11518. -+ if ((cc->iso3166[0] == '\0') && (found_index == -1))
  11519. -+ found_index = i;
  11520. -+ if ((cc->iso3166[0] == alpha2[0]) &&
  11521. -+ (cc->iso3166[1] == alpha2[1])) {
  11522. -+ found_index = i;
  11523. -+ break;
  11524. -+ }
  11525. -+ }
  11526. -+ if (found_index == -1) {
  11527. -+ brcmf_dbg(TRACE, "No country code match found\n");
  11528. -+ return -EINVAL;
  11529. -+ }
  11530. -+ memset(ccreq, 0, sizeof(*ccreq));
  11531. -+ ccreq->rev = cpu_to_le32(country_codes->table[found_index].rev);
  11532. -+ memcpy(ccreq->ccode, country_codes->table[found_index].cc,
  11533. -+ BRCMF_COUNTRY_BUF_SZ);
  11534. -+ ccreq->country_abbrev[0] = alpha2[0];
  11535. -+ ccreq->country_abbrev[1] = alpha2[1];
  11536. -+ ccreq->country_abbrev[2] = 0;
  11537. -+
  11538. -+ return 0;
  11539. -+}
  11540. -+
  11541. - static void brcmf_cfg80211_reg_notifier(struct wiphy *wiphy,
  11542. - struct regulatory_request *req)
  11543. - {
  11544. - struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy);
  11545. - struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg));
  11546. - struct brcmf_fil_country_le ccreq;
  11547. -+ s32 err;
  11548. - int i;
  11549. -
  11550. -- brcmf_dbg(TRACE, "enter: initiator=%d, alpha=%c%c\n", req->initiator,
  11551. -- req->alpha2[0], req->alpha2[1]);
  11552. --
  11553. - /* ignore non-ISO3166 country codes */
  11554. - for (i = 0; i < sizeof(req->alpha2); i++)
  11555. - if (req->alpha2[i] < 'A' || req->alpha2[i] > 'Z') {
  11556. -- brcmf_err("not a ISO3166 code\n");
  11557. -+ brcmf_err("not a ISO3166 code (0x%02x 0x%02x)\n",
  11558. -+ req->alpha2[0], req->alpha2[1]);
  11559. - return;
  11560. - }
  11561. -- memset(&ccreq, 0, sizeof(ccreq));
  11562. -- ccreq.rev = cpu_to_le32(-1);
  11563. -- memcpy(ccreq.ccode, req->alpha2, sizeof(req->alpha2));
  11564. -- if (brcmf_fil_iovar_data_set(ifp, "country", &ccreq, sizeof(ccreq))) {
  11565. -- brcmf_err("firmware rejected country setting\n");
  11566. -+
  11567. -+ brcmf_dbg(TRACE, "Enter: initiator=%d, alpha=%c%c\n", req->initiator,
  11568. -+ req->alpha2[0], req->alpha2[1]);
  11569. -+
  11570. -+ err = brcmf_fil_iovar_data_get(ifp, "country", &ccreq, sizeof(ccreq));
  11571. -+ if (err) {
  11572. -+ brcmf_err("Country code iovar returned err = %d\n", err);
  11573. -+ return;
  11574. -+ }
  11575. -+
  11576. -+ err = brcmf_translate_country_code(ifp->drvr, req->alpha2, &ccreq);
  11577. -+ if (err)
  11578. -+ return;
  11579. -+
  11580. -+ err = brcmf_fil_iovar_data_set(ifp, "country", &ccreq, sizeof(ccreq));
  11581. -+ if (err) {
  11582. -+ brcmf_err("Firmware rejected country setting\n");
  11583. - return;
  11584. - }
  11585. - brcmf_setup_wiphybands(wiphy);
  11586. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  11587. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  11588. -@@ -230,10 +230,8 @@ void brcmf_mp_attach(void)
  11589. - int brcmf_mp_device_attach(struct brcmf_pub *drvr)
  11590. - {
  11591. - drvr->settings = kzalloc(sizeof(*drvr->settings), GFP_ATOMIC);
  11592. -- if (!drvr->settings) {
  11593. -- brcmf_err("Failed to alloca storage space for settings\n");
  11594. -+ if (!drvr->settings)
  11595. - return -ENOMEM;
  11596. -- }
  11597. -
  11598. - drvr->settings->sdiod_txglomsz = brcmf_sdiod_txglomsz;
  11599. - drvr->settings->p2p_enable = !!brcmf_p2p_enable;
  11600. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
  11601. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
  11602. -@@ -15,6 +15,8 @@
  11603. - #ifndef BRCMFMAC_COMMON_H
  11604. - #define BRCMFMAC_COMMON_H
  11605. -
  11606. -+#include "fwil_types.h"
  11607. -+
  11608. - extern const u8 ALLFFMAC[ETH_ALEN];
  11609. -
  11610. - #define BRCMF_FW_ALTPATH_LEN 256
  11611. -@@ -39,6 +41,33 @@ struct brcmf_mp_global_t {
  11612. - extern struct brcmf_mp_global_t brcmf_mp_global;
  11613. -
  11614. - /**
  11615. -+ * struct cc_entry - Struct for translating user space country code (iso3166) to
  11616. -+ * firmware country code and revision.
  11617. -+ *
  11618. -+ * @iso3166: iso3166 alpha 2 country code string.
  11619. -+ * @cc: firmware country code string.
  11620. -+ * @rev: firmware country code revision.
  11621. -+ */
  11622. -+struct cc_entry {
  11623. -+ char iso3166[BRCMF_COUNTRY_BUF_SZ];
  11624. -+ char cc[BRCMF_COUNTRY_BUF_SZ];
  11625. -+ s32 rev;
  11626. -+};
  11627. -+
  11628. -+/**
  11629. -+ * struct cc_translate - Struct for translating country codes as set by user
  11630. -+ * space to a country code and rev which can be used by
  11631. -+ * firmware.
  11632. -+ *
  11633. -+ * @table_size: number of entries in table (> 0)
  11634. -+ * @table: dynamic array of 1 or more elements with translation information.
  11635. -+ */
  11636. -+struct cc_translate {
  11637. -+ int table_size;
  11638. -+ struct cc_entry table[0];
  11639. -+};
  11640. -+
  11641. -+/**
  11642. - * struct brcmf_mp_device - Device module paramaters.
  11643. - *
  11644. - * @sdiod_txglomsz: SDIO txglom size.
  11645. -@@ -47,6 +76,7 @@ extern struct brcmf_mp_global_t brcmf_mp
  11646. - * @feature_disable: Feature_disable bitmask.
  11647. - * @fcmode: FWS flow control.
  11648. - * @roamoff: Firmware roaming off?
  11649. -+ * @country_codes: If available, pointer to struct for translating country codes
  11650. - */
  11651. - struct brcmf_mp_device {
  11652. - int sdiod_txglomsz;
  11653. -@@ -56,6 +86,7 @@ struct brcmf_mp_device {
  11654. - int fcmode;
  11655. - bool roamoff;
  11656. - bool ignore_probe_fail;
  11657. -+ struct cc_translate *country_codes;
  11658. - };
  11659. -
  11660. - void brcmf_mp_attach(void);
  11661. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h
  11662. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h
  11663. -@@ -134,6 +134,8 @@
  11664. - #define BRCMF_PFN_MAC_OUI_ONLY BIT(0)
  11665. - #define BRCMF_PFN_SET_MAC_UNASSOC BIT(1)
  11666. -
  11667. -+#define BRCMF_MCSSET_LEN 16
  11668. -+
  11669. - /* join preference types for join_pref iovar */
  11670. - enum brcmf_join_pref_types {
  11671. - BRCMF_JOIN_PREF_RSSI = 1,
  11672. -@@ -279,7 +281,7 @@ struct brcmf_bss_info_le {
  11673. - __le32 reserved32[1]; /* Reserved for expansion of BSS properties */
  11674. - u8 flags; /* flags */
  11675. - u8 reserved[3]; /* Reserved for expansion of BSS properties */
  11676. -- u8 basic_mcs[MCSSET_LEN]; /* 802.11N BSS required MCS set */
  11677. -+ u8 basic_mcs[BRCMF_MCSSET_LEN]; /* 802.11N BSS required MCS set */
  11678. -
  11679. - __le16 ie_offset; /* offset at which IEs start, from beginning */
  11680. - __le32 ie_length; /* byte length of Information Elements */
  11681. diff --git a/package/kernel/mac80211/patches/344-0005-brcmfmac-Add-length-checks-on-firmware-events.patch b/package/kernel/mac80211/patches/344-0005-brcmfmac-Add-length-checks-on-firmware-events.patch
  11682. deleted file mode 100644
  11683. index 3e2e350..0000000
  11684. --- a/package/kernel/mac80211/patches/344-0005-brcmfmac-Add-length-checks-on-firmware-events.patch
  11685. +++ /dev/null
  11686. @@ -1,283 +0,0 @@
  11687. -From: Hante Meuleman <meuleman@broadcom.com>
  11688. -Date: Wed, 17 Feb 2016 11:26:54 +0100
  11689. -Subject: [PATCH] brcmfmac: Add length checks on firmware events
  11690. -
  11691. -Add additional length checks on firmware events to create more
  11692. -robust code.
  11693. -
  11694. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  11695. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  11696. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11697. -Reviewed-by: Lei Zhang <leizh@broadcom.com>
  11698. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  11699. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11700. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11701. ----
  11702. -
  11703. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  11704. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  11705. -@@ -3092,6 +3092,11 @@ brcmf_notify_sched_scan_results(struct b
  11706. -
  11707. - brcmf_dbg(SCAN, "Enter\n");
  11708. -
  11709. -+ if (e->datalen < (sizeof(*pfn_result) + sizeof(*netinfo))) {
  11710. -+ brcmf_dbg(SCAN, "Event data to small. Ignore\n");
  11711. -+ return 0;
  11712. -+ }
  11713. -+
  11714. - if (e->event_code == BRCMF_E_PFN_NET_LOST) {
  11715. - brcmf_dbg(SCAN, "PFN NET LOST event. Do Nothing\n");
  11716. - return 0;
  11717. -@@ -3415,6 +3420,11 @@ brcmf_wowl_nd_results(struct brcmf_if *i
  11718. -
  11719. - brcmf_dbg(SCAN, "Enter\n");
  11720. -
  11721. -+ if (e->datalen < (sizeof(*pfn_result) + sizeof(*netinfo))) {
  11722. -+ brcmf_dbg(SCAN, "Event data to small. Ignore\n");
  11723. -+ return 0;
  11724. -+ }
  11725. -+
  11726. - pfn_result = (struct brcmf_pno_scanresults_le *)data;
  11727. -
  11728. - if (e->event_code == BRCMF_E_PFN_NET_LOST) {
  11729. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  11730. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  11731. -@@ -26,50 +26,6 @@
  11732. - #include "fwil.h"
  11733. -
  11734. - /**
  11735. -- * struct brcm_ethhdr - broadcom specific ether header.
  11736. -- *
  11737. -- * @subtype: subtype for this packet.
  11738. -- * @length: TODO: length of appended data.
  11739. -- * @version: version indication.
  11740. -- * @oui: OUI of this packet.
  11741. -- * @usr_subtype: subtype for this OUI.
  11742. -- */
  11743. --struct brcm_ethhdr {
  11744. -- __be16 subtype;
  11745. -- __be16 length;
  11746. -- u8 version;
  11747. -- u8 oui[3];
  11748. -- __be16 usr_subtype;
  11749. --} __packed;
  11750. --
  11751. --struct brcmf_event_msg_be {
  11752. -- __be16 version;
  11753. -- __be16 flags;
  11754. -- __be32 event_type;
  11755. -- __be32 status;
  11756. -- __be32 reason;
  11757. -- __be32 auth_type;
  11758. -- __be32 datalen;
  11759. -- u8 addr[ETH_ALEN];
  11760. -- char ifname[IFNAMSIZ];
  11761. -- u8 ifidx;
  11762. -- u8 bsscfgidx;
  11763. --} __packed;
  11764. --
  11765. --/**
  11766. -- * struct brcmf_event - contents of broadcom event packet.
  11767. -- *
  11768. -- * @eth: standard ether header.
  11769. -- * @hdr: broadcom specific ether header.
  11770. -- * @msg: common part of the actual event message.
  11771. -- */
  11772. --struct brcmf_event {
  11773. -- struct ethhdr eth;
  11774. -- struct brcm_ethhdr hdr;
  11775. -- struct brcmf_event_msg_be msg;
  11776. --} __packed;
  11777. --
  11778. --/**
  11779. - * struct brcmf_fweh_queue_item - event item on event queue.
  11780. - *
  11781. - * @q: list element for queuing.
  11782. -@@ -85,6 +41,7 @@ struct brcmf_fweh_queue_item {
  11783. - u8 ifidx;
  11784. - u8 ifaddr[ETH_ALEN];
  11785. - struct brcmf_event_msg_be emsg;
  11786. -+ u32 datalen;
  11787. - u8 data[0];
  11788. - };
  11789. -
  11790. -@@ -294,6 +251,11 @@ static void brcmf_fweh_event_worker(stru
  11791. - brcmf_dbg_hex_dump(BRCMF_EVENT_ON(), event->data,
  11792. - min_t(u32, emsg.datalen, 64),
  11793. - "event payload, len=%d\n", emsg.datalen);
  11794. -+ if (emsg.datalen > event->datalen) {
  11795. -+ brcmf_err("event invalid length header=%d, msg=%d\n",
  11796. -+ event->datalen, emsg.datalen);
  11797. -+ goto event_free;
  11798. -+ }
  11799. -
  11800. - /* special handling of interface event */
  11801. - if (event->code == BRCMF_E_IF) {
  11802. -@@ -439,7 +401,8 @@ int brcmf_fweh_activate_events(struct br
  11803. - * dispatch the event to a registered handler (using worker).
  11804. - */
  11805. - void brcmf_fweh_process_event(struct brcmf_pub *drvr,
  11806. -- struct brcmf_event *event_packet)
  11807. -+ struct brcmf_event *event_packet,
  11808. -+ u32 packet_len)
  11809. - {
  11810. - enum brcmf_fweh_event_code code;
  11811. - struct brcmf_fweh_info *fweh = &drvr->fweh;
  11812. -@@ -459,6 +422,9 @@ void brcmf_fweh_process_event(struct brc
  11813. - if (code != BRCMF_E_IF && !fweh->evt_handler[code])
  11814. - return;
  11815. -
  11816. -+ if (datalen > BRCMF_DCMD_MAXLEN)
  11817. -+ return;
  11818. -+
  11819. - if (in_interrupt())
  11820. - alloc_flag = GFP_ATOMIC;
  11821. -
  11822. -@@ -472,6 +438,7 @@ void brcmf_fweh_process_event(struct brc
  11823. - /* use memcpy to get aligned event message */
  11824. - memcpy(&event->emsg, &event_packet->msg, sizeof(event->emsg));
  11825. - memcpy(event->data, data, datalen);
  11826. -+ event->datalen = datalen;
  11827. - memcpy(event->ifaddr, event_packet->eth.h_dest, ETH_ALEN);
  11828. -
  11829. - brcmf_fweh_queue_event(fweh, event);
  11830. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h
  11831. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h
  11832. -@@ -27,7 +27,6 @@
  11833. - struct brcmf_pub;
  11834. - struct brcmf_if;
  11835. - struct brcmf_cfg80211_info;
  11836. --struct brcmf_event;
  11837. -
  11838. - /* list of firmware events */
  11839. - #define BRCMF_FWEH_EVENT_ENUM_DEFLIST \
  11840. -@@ -180,13 +179,55 @@ enum brcmf_fweh_event_code {
  11841. - /**
  11842. - * definitions for event packet validation.
  11843. - */
  11844. --#define BRCMF_EVENT_OUI_OFFSET 19
  11845. --#define BRCM_OUI "\x00\x10\x18"
  11846. --#define DOT11_OUI_LEN 3
  11847. --#define BCMILCP_BCM_SUBTYPE_EVENT 1
  11848. -+#define BRCM_OUI "\x00\x10\x18"
  11849. -+#define BCMILCP_BCM_SUBTYPE_EVENT 1
  11850. -
  11851. -
  11852. - /**
  11853. -+ * struct brcm_ethhdr - broadcom specific ether header.
  11854. -+ *
  11855. -+ * @subtype: subtype for this packet.
  11856. -+ * @length: TODO: length of appended data.
  11857. -+ * @version: version indication.
  11858. -+ * @oui: OUI of this packet.
  11859. -+ * @usr_subtype: subtype for this OUI.
  11860. -+ */
  11861. -+struct brcm_ethhdr {
  11862. -+ __be16 subtype;
  11863. -+ __be16 length;
  11864. -+ u8 version;
  11865. -+ u8 oui[3];
  11866. -+ __be16 usr_subtype;
  11867. -+} __packed;
  11868. -+
  11869. -+struct brcmf_event_msg_be {
  11870. -+ __be16 version;
  11871. -+ __be16 flags;
  11872. -+ __be32 event_type;
  11873. -+ __be32 status;
  11874. -+ __be32 reason;
  11875. -+ __be32 auth_type;
  11876. -+ __be32 datalen;
  11877. -+ u8 addr[ETH_ALEN];
  11878. -+ char ifname[IFNAMSIZ];
  11879. -+ u8 ifidx;
  11880. -+ u8 bsscfgidx;
  11881. -+} __packed;
  11882. -+
  11883. -+/**
  11884. -+ * struct brcmf_event - contents of broadcom event packet.
  11885. -+ *
  11886. -+ * @eth: standard ether header.
  11887. -+ * @hdr: broadcom specific ether header.
  11888. -+ * @msg: common part of the actual event message.
  11889. -+ */
  11890. -+struct brcmf_event {
  11891. -+ struct ethhdr eth;
  11892. -+ struct brcm_ethhdr hdr;
  11893. -+ struct brcmf_event_msg_be msg;
  11894. -+} __packed;
  11895. -+
  11896. -+/**
  11897. - * struct brcmf_event_msg - firmware event message.
  11898. - *
  11899. - * @version: version information.
  11900. -@@ -256,34 +297,35 @@ void brcmf_fweh_unregister(struct brcmf_
  11901. - enum brcmf_fweh_event_code code);
  11902. - int brcmf_fweh_activate_events(struct brcmf_if *ifp);
  11903. - void brcmf_fweh_process_event(struct brcmf_pub *drvr,
  11904. -- struct brcmf_event *event_packet);
  11905. -+ struct brcmf_event *event_packet,
  11906. -+ u32 packet_len);
  11907. - void brcmf_fweh_p2pdev_setup(struct brcmf_if *ifp, bool ongoing);
  11908. -
  11909. - static inline void brcmf_fweh_process_skb(struct brcmf_pub *drvr,
  11910. - struct sk_buff *skb)
  11911. - {
  11912. - struct brcmf_event *event_packet;
  11913. -- u8 *data;
  11914. - u16 usr_stype;
  11915. -
  11916. - /* only process events when protocol matches */
  11917. - if (skb->protocol != cpu_to_be16(ETH_P_LINK_CTL))
  11918. - return;
  11919. -
  11920. -+ if ((skb->len + ETH_HLEN) < sizeof(*event_packet))
  11921. -+ return;
  11922. -+
  11923. - /* check for BRCM oui match */
  11924. - event_packet = (struct brcmf_event *)skb_mac_header(skb);
  11925. -- data = (u8 *)event_packet;
  11926. -- data += BRCMF_EVENT_OUI_OFFSET;
  11927. -- if (memcmp(BRCM_OUI, data, DOT11_OUI_LEN))
  11928. -+ if (memcmp(BRCM_OUI, &event_packet->hdr.oui[0],
  11929. -+ sizeof(event_packet->hdr.oui)))
  11930. - return;
  11931. -
  11932. - /* final match on usr_subtype */
  11933. -- data += DOT11_OUI_LEN;
  11934. -- usr_stype = get_unaligned_be16(data);
  11935. -+ usr_stype = get_unaligned_be16(&event_packet->hdr.usr_subtype);
  11936. - if (usr_stype != BCMILCP_BCM_SUBTYPE_EVENT)
  11937. - return;
  11938. -
  11939. -- brcmf_fweh_process_event(drvr, event_packet);
  11940. -+ brcmf_fweh_process_event(drvr, event_packet, skb->len + ETH_HLEN);
  11941. - }
  11942. -
  11943. - #endif /* FWEH_H_ */
  11944. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  11945. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  11946. -@@ -1361,6 +1361,11 @@ int brcmf_p2p_notify_action_frame_rx(str
  11947. - u16 mgmt_type;
  11948. - u8 action;
  11949. -
  11950. -+ if (e->datalen < sizeof(*rxframe)) {
  11951. -+ brcmf_dbg(SCAN, "Event data to small. Ignore\n");
  11952. -+ return 0;
  11953. -+ }
  11954. -+
  11955. - ch.chspec = be16_to_cpu(rxframe->chanspec);
  11956. - cfg->d11inf.decchspec(&ch);
  11957. - /* Check if wpa_supplicant has registered for this frame */
  11958. -@@ -1858,6 +1863,11 @@ s32 brcmf_p2p_notify_rx_mgmt_p2p_probere
  11959. - brcmf_dbg(INFO, "Enter: event %d reason %d\n", e->event_code,
  11960. - e->reason);
  11961. -
  11962. -+ if (e->datalen < sizeof(*rxframe)) {
  11963. -+ brcmf_dbg(SCAN, "Event data to small. Ignore\n");
  11964. -+ return 0;
  11965. -+ }
  11966. -+
  11967. - ch.chspec = be16_to_cpu(rxframe->chanspec);
  11968. - cfg->d11inf.decchspec(&ch);
  11969. -
  11970. diff --git a/package/kernel/mac80211/patches/344-0006-brcmfmac-add-neighbor-discovery-offload-ip-address-t.patch b/package/kernel/mac80211/patches/344-0006-brcmfmac-add-neighbor-discovery-offload-ip-address-t.patch
  11971. deleted file mode 100644
  11972. index 888ad5b..0000000
  11973. --- a/package/kernel/mac80211/patches/344-0006-brcmfmac-add-neighbor-discovery-offload-ip-address-t.patch
  11974. +++ /dev/null
  11975. @@ -1,333 +0,0 @@
  11976. -From: Franky Lin <frankyl@broadcom.com>
  11977. -Date: Wed, 17 Feb 2016 11:26:55 +0100
  11978. -Subject: [PATCH] brcmfmac: add neighbor discovery offload ip address table
  11979. - configuration
  11980. -
  11981. -Configure ipv6 address for neighbor discovery offload ip table in
  11982. -firmware obtained through ipv6 address notification callback.
  11983. -
  11984. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  11985. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11986. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  11987. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11988. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11989. ----
  11990. -
  11991. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  11992. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  11993. -@@ -456,7 +456,7 @@ send_key_to_dongle(struct brcmf_if *ifp,
  11994. - }
  11995. -
  11996. - static s32
  11997. --brcmf_configure_arp_offload(struct brcmf_if *ifp, bool enable)
  11998. -+brcmf_configure_arp_nd_offload(struct brcmf_if *ifp, bool enable)
  11999. - {
  12000. - s32 err;
  12001. - u32 mode;
  12002. -@@ -484,6 +484,15 @@ brcmf_configure_arp_offload(struct brcmf
  12003. - enable, mode);
  12004. - }
  12005. -
  12006. -+ err = brcmf_fil_iovar_int_set(ifp, "ndoe", enable);
  12007. -+ if (err) {
  12008. -+ brcmf_dbg(TRACE, "failed to configure (%d) ND offload err = %d\n",
  12009. -+ enable, err);
  12010. -+ err = 0;
  12011. -+ } else
  12012. -+ brcmf_dbg(TRACE, "successfully configured (%d) ND offload to 0x%x\n",
  12013. -+ enable, mode);
  12014. -+
  12015. - return err;
  12016. - }
  12017. -
  12018. -@@ -3543,7 +3552,7 @@ static s32 brcmf_cfg80211_resume(struct
  12019. - brcmf_report_wowl_wakeind(wiphy, ifp);
  12020. - brcmf_fil_iovar_int_set(ifp, "wowl_clear", 0);
  12021. - brcmf_config_wowl_pattern(ifp, "clr", NULL, 0, NULL, 0);
  12022. -- brcmf_configure_arp_offload(ifp, true);
  12023. -+ brcmf_configure_arp_nd_offload(ifp, true);
  12024. - brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM,
  12025. - cfg->wowl.pre_pmmode);
  12026. - cfg->wowl.active = false;
  12027. -@@ -3567,7 +3576,7 @@ static void brcmf_configure_wowl(struct
  12028. -
  12029. - brcmf_dbg(TRACE, "Suspend, wowl config.\n");
  12030. -
  12031. -- brcmf_configure_arp_offload(ifp, false);
  12032. -+ brcmf_configure_arp_nd_offload(ifp, false);
  12033. - brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_PM, &cfg->wowl.pre_pmmode);
  12034. - brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM, PM_MAX);
  12035. -
  12036. -@@ -4336,7 +4345,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  12037. -
  12038. - if (!mbss) {
  12039. - brcmf_set_mpc(ifp, 0);
  12040. -- brcmf_configure_arp_offload(ifp, false);
  12041. -+ brcmf_configure_arp_nd_offload(ifp, false);
  12042. - }
  12043. -
  12044. - /* find the RSN_IE */
  12045. -@@ -4482,7 +4491,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  12046. - exit:
  12047. - if ((err) && (!mbss)) {
  12048. - brcmf_set_mpc(ifp, 1);
  12049. -- brcmf_configure_arp_offload(ifp, true);
  12050. -+ brcmf_configure_arp_nd_offload(ifp, true);
  12051. - }
  12052. - return err;
  12053. - }
  12054. -@@ -4540,7 +4549,7 @@ static int brcmf_cfg80211_stop_ap(struct
  12055. - brcmf_err("bss_enable config failed %d\n", err);
  12056. - }
  12057. - brcmf_set_mpc(ifp, 1);
  12058. -- brcmf_configure_arp_offload(ifp, true);
  12059. -+ brcmf_configure_arp_nd_offload(ifp, true);
  12060. - clear_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state);
  12061. - brcmf_net_setcarrier(ifp, false);
  12062. -
  12063. -@@ -6287,7 +6296,7 @@ static s32 brcmf_config_dongle(struct br
  12064. - if (err)
  12065. - goto default_conf_out;
  12066. -
  12067. -- brcmf_configure_arp_offload(ifp, true);
  12068. -+ brcmf_configure_arp_nd_offload(ifp, true);
  12069. -
  12070. - cfg->dongle_up = true;
  12071. - default_conf_out:
  12072. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  12073. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  12074. -@@ -20,6 +20,8 @@
  12075. - #include <linux/inetdevice.h>
  12076. - #include <net/cfg80211.h>
  12077. - #include <net/rtnetlink.h>
  12078. -+#include <net/addrconf.h>
  12079. -+#include <net/ipv6.h>
  12080. - #include <brcmu_utils.h>
  12081. - #include <brcmu_wifi.h>
  12082. -
  12083. -@@ -172,6 +174,35 @@ _brcmf_set_mac_address(struct work_struc
  12084. - }
  12085. - }
  12086. -
  12087. -+#if IS_ENABLED(CONFIG_IPV6)
  12088. -+static void _brcmf_update_ndtable(struct work_struct *work)
  12089. -+{
  12090. -+ struct brcmf_if *ifp;
  12091. -+ int i, ret;
  12092. -+
  12093. -+ ifp = container_of(work, struct brcmf_if, ndoffload_work);
  12094. -+
  12095. -+ /* clear the table in firmware */
  12096. -+ ret = brcmf_fil_iovar_data_set(ifp, "nd_hostip_clear", NULL, 0);
  12097. -+ if (ret) {
  12098. -+ brcmf_dbg(TRACE, "fail to clear nd ip table err:%d\n", ret);
  12099. -+ return;
  12100. -+ }
  12101. -+
  12102. -+ for (i = 0; i < ifp->ipv6addr_idx; i++) {
  12103. -+ ret = brcmf_fil_iovar_data_set(ifp, "nd_hostip",
  12104. -+ &ifp->ipv6_addr_tbl[i],
  12105. -+ sizeof(struct in6_addr));
  12106. -+ if (ret)
  12107. -+ brcmf_err("add nd ip err %d\n", ret);
  12108. -+ }
  12109. -+}
  12110. -+#else
  12111. -+static void _brcmf_update_ndtable(struct work_struct *work)
  12112. -+{
  12113. -+}
  12114. -+#endif
  12115. -+
  12116. - static int brcmf_netdev_set_mac_address(struct net_device *ndev, void *addr)
  12117. - {
  12118. - struct brcmf_if *ifp = netdev_priv(ndev);
  12119. -@@ -685,6 +716,7 @@ int brcmf_net_attach(struct brcmf_if *if
  12120. -
  12121. - INIT_WORK(&ifp->setmacaddr_work, _brcmf_set_mac_address);
  12122. - INIT_WORK(&ifp->multicast_work, _brcmf_set_multicast_list);
  12123. -+ INIT_WORK(&ifp->ndoffload_work, _brcmf_update_ndtable);
  12124. -
  12125. - if (rtnl_locked)
  12126. - err = register_netdevice(ndev);
  12127. -@@ -884,6 +916,7 @@ static void brcmf_del_if(struct brcmf_pu
  12128. - if (ifp->ndev->netdev_ops == &brcmf_netdev_ops_pri) {
  12129. - cancel_work_sync(&ifp->setmacaddr_work);
  12130. - cancel_work_sync(&ifp->multicast_work);
  12131. -+ cancel_work_sync(&ifp->ndoffload_work);
  12132. - }
  12133. - brcmf_net_detach(ifp->ndev);
  12134. - } else {
  12135. -@@ -1025,6 +1058,56 @@ static int brcmf_inetaddr_changed(struct
  12136. - }
  12137. - #endif
  12138. -
  12139. -+#if IS_ENABLED(CONFIG_IPV6)
  12140. -+static int brcmf_inet6addr_changed(struct notifier_block *nb,
  12141. -+ unsigned long action, void *data)
  12142. -+{
  12143. -+ struct brcmf_pub *drvr = container_of(nb, struct brcmf_pub,
  12144. -+ inet6addr_notifier);
  12145. -+ struct inet6_ifaddr *ifa = data;
  12146. -+ struct brcmf_if *ifp;
  12147. -+ int i;
  12148. -+ struct in6_addr *table;
  12149. -+
  12150. -+ /* Only handle primary interface */
  12151. -+ ifp = drvr->iflist[0];
  12152. -+ if (!ifp)
  12153. -+ return NOTIFY_DONE;
  12154. -+ if (ifp->ndev != ifa->idev->dev)
  12155. -+ return NOTIFY_DONE;
  12156. -+
  12157. -+ table = ifp->ipv6_addr_tbl;
  12158. -+ for (i = 0; i < NDOL_MAX_ENTRIES; i++)
  12159. -+ if (ipv6_addr_equal(&ifa->addr, &table[i]))
  12160. -+ break;
  12161. -+
  12162. -+ switch (action) {
  12163. -+ case NETDEV_UP:
  12164. -+ if (i == NDOL_MAX_ENTRIES) {
  12165. -+ if (ifp->ipv6addr_idx < NDOL_MAX_ENTRIES) {
  12166. -+ table[ifp->ipv6addr_idx++] = ifa->addr;
  12167. -+ } else {
  12168. -+ for (i = 0; i < NDOL_MAX_ENTRIES - 1; i++)
  12169. -+ table[i] = table[i + 1];
  12170. -+ table[NDOL_MAX_ENTRIES - 1] = ifa->addr;
  12171. -+ }
  12172. -+ }
  12173. -+ break;
  12174. -+ case NETDEV_DOWN:
  12175. -+ if (i < NDOL_MAX_ENTRIES)
  12176. -+ for (; i < ifp->ipv6addr_idx; i++)
  12177. -+ table[i] = table[i + 1];
  12178. -+ break;
  12179. -+ default:
  12180. -+ break;
  12181. -+ }
  12182. -+
  12183. -+ schedule_work(&ifp->ndoffload_work);
  12184. -+
  12185. -+ return NOTIFY_OK;
  12186. -+}
  12187. -+#endif
  12188. -+
  12189. - int brcmf_attach(struct device *dev)
  12190. - {
  12191. - struct brcmf_pub *drvr = NULL;
  12192. -@@ -1164,30 +1247,41 @@ int brcmf_bus_start(struct device *dev)
  12193. - #ifdef CONFIG_INET
  12194. - drvr->inetaddr_notifier.notifier_call = brcmf_inetaddr_changed;
  12195. - ret = register_inetaddr_notifier(&drvr->inetaddr_notifier);
  12196. -+ if (ret)
  12197. -+ goto fail;
  12198. -+
  12199. -+#if IS_ENABLED(CONFIG_IPV6)
  12200. -+ drvr->inet6addr_notifier.notifier_call = brcmf_inet6addr_changed;
  12201. -+ ret = register_inet6addr_notifier(&drvr->inet6addr_notifier);
  12202. -+ if (ret) {
  12203. -+ unregister_inetaddr_notifier(&drvr->inetaddr_notifier);
  12204. -+ goto fail;
  12205. -+ }
  12206. - #endif
  12207. -+#endif /* CONFIG_INET */
  12208. -+
  12209. -+ return 0;
  12210. -
  12211. - fail:
  12212. -- if (ret < 0) {
  12213. -- brcmf_err("failed: %d\n", ret);
  12214. -- if (drvr->config) {
  12215. -- brcmf_cfg80211_detach(drvr->config);
  12216. -- drvr->config = NULL;
  12217. -- }
  12218. -- if (drvr->fws) {
  12219. -- brcmf_fws_del_interface(ifp);
  12220. -- brcmf_fws_deinit(drvr);
  12221. -- }
  12222. -- if (ifp)
  12223. -- brcmf_net_detach(ifp->ndev);
  12224. -- if (p2p_ifp)
  12225. -- brcmf_net_detach(p2p_ifp->ndev);
  12226. -- drvr->iflist[0] = NULL;
  12227. -- drvr->iflist[1] = NULL;
  12228. -- if (brcmf_ignoring_probe_fail(drvr))
  12229. -- ret = 0;
  12230. -- return ret;
  12231. -+ brcmf_err("failed: %d\n", ret);
  12232. -+ if (drvr->config) {
  12233. -+ brcmf_cfg80211_detach(drvr->config);
  12234. -+ drvr->config = NULL;
  12235. -+ }
  12236. -+ if (drvr->fws) {
  12237. -+ brcmf_fws_del_interface(ifp);
  12238. -+ brcmf_fws_deinit(drvr);
  12239. - }
  12240. -- return 0;
  12241. -+ if (ifp)
  12242. -+ brcmf_net_detach(ifp->ndev);
  12243. -+ if (p2p_ifp)
  12244. -+ brcmf_net_detach(p2p_ifp->ndev);
  12245. -+ drvr->iflist[0] = NULL;
  12246. -+ drvr->iflist[1] = NULL;
  12247. -+ if (brcmf_ignoring_probe_fail(drvr))
  12248. -+ ret = 0;
  12249. -+
  12250. -+ return ret;
  12251. - }
  12252. -
  12253. - void brcmf_bus_add_txhdrlen(struct device *dev, uint len)
  12254. -@@ -1237,6 +1331,10 @@ void brcmf_detach(struct device *dev)
  12255. - unregister_inetaddr_notifier(&drvr->inetaddr_notifier);
  12256. - #endif
  12257. -
  12258. -+#if IS_ENABLED(CONFIG_IPV6)
  12259. -+ unregister_inet6addr_notifier(&drvr->inet6addr_notifier);
  12260. -+#endif
  12261. -+
  12262. - /* stop firmware event handling */
  12263. - brcmf_fweh_detach(drvr);
  12264. - if (drvr->config)
  12265. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  12266. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  12267. -@@ -48,6 +48,8 @@
  12268. - */
  12269. - #define BRCMF_DRIVER_FIRMWARE_VERSION_LEN 32
  12270. -
  12271. -+#define NDOL_MAX_ENTRIES 8
  12272. -+
  12273. - /**
  12274. - * struct brcmf_ampdu_rx_reorder - AMPDU receive reorder info
  12275. - *
  12276. -@@ -143,6 +145,7 @@ struct brcmf_pub {
  12277. - #endif
  12278. -
  12279. - struct notifier_block inetaddr_notifier;
  12280. -+ struct notifier_block inet6addr_notifier;
  12281. - struct brcmf_mp_device *settings;
  12282. - };
  12283. -
  12284. -@@ -175,6 +178,7 @@ enum brcmf_netif_stop_reason {
  12285. - * @stats: interface specific network statistics.
  12286. - * @setmacaddr_work: worker object for setting mac address.
  12287. - * @multicast_work: worker object for multicast provisioning.
  12288. -+ * @ndoffload_work: worker object for neighbor discovery offload configuration.
  12289. - * @fws_desc: interface specific firmware-signalling descriptor.
  12290. - * @ifidx: interface index in device firmware.
  12291. - * @bsscfgidx: index of bss associated with this interface.
  12292. -@@ -191,6 +195,7 @@ struct brcmf_if {
  12293. - struct net_device_stats stats;
  12294. - struct work_struct setmacaddr_work;
  12295. - struct work_struct multicast_work;
  12296. -+ struct work_struct ndoffload_work;
  12297. - struct brcmf_fws_mac_descriptor *fws_desc;
  12298. - int ifidx;
  12299. - s32 bsscfgidx;
  12300. -@@ -199,6 +204,8 @@ struct brcmf_if {
  12301. - spinlock_t netif_stop_lock;
  12302. - atomic_t pend_8021x_cnt;
  12303. - wait_queue_head_t pend_8021x_wait;
  12304. -+ struct in6_addr ipv6_addr_tbl[NDOL_MAX_ENTRIES];
  12305. -+ u8 ipv6addr_idx;
  12306. - };
  12307. -
  12308. - struct brcmf_skb_reorder_data {
  12309. diff --git a/package/kernel/mac80211/patches/344-0007-brcmfmac-check-return-for-ARP-ip-setting-iovar.patch b/package/kernel/mac80211/patches/344-0007-brcmfmac-check-return-for-ARP-ip-setting-iovar.patch
  12310. deleted file mode 100644
  12311. index 68de8ed..0000000
  12312. --- a/package/kernel/mac80211/patches/344-0007-brcmfmac-check-return-for-ARP-ip-setting-iovar.patch
  12313. +++ /dev/null
  12314. @@ -1,38 +0,0 @@
  12315. -From: Franky Lin <frankyl@broadcom.com>
  12316. -Date: Wed, 17 Feb 2016 11:26:56 +0100
  12317. -Subject: [PATCH] brcmfmac: check return for ARP ip setting iovar
  12318. -
  12319. -The return value of iovar set function should be saved and checked.
  12320. -
  12321. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  12322. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  12323. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  12324. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  12325. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12326. ----
  12327. -
  12328. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  12329. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  12330. -@@ -1039,14 +1039,14 @@ static int brcmf_inetaddr_changed(struct
  12331. - return NOTIFY_OK;
  12332. - }
  12333. - for (i = 0; i < ARPOL_MAX_ENTRIES; i++) {
  12334. -- if (addr_table[i] != 0) {
  12335. -- brcmf_fil_iovar_data_set(ifp,
  12336. -- "arp_hostip", &addr_table[i],
  12337. -- sizeof(addr_table[i]));
  12338. -- if (ret)
  12339. -- brcmf_err("add arp ip err %d\n",
  12340. -- ret);
  12341. -- }
  12342. -+ if (addr_table[i] == 0)
  12343. -+ continue;
  12344. -+ ret = brcmf_fil_iovar_data_set(ifp, "arp_hostip",
  12345. -+ &addr_table[i],
  12346. -+ sizeof(addr_table[i]));
  12347. -+ if (ret)
  12348. -+ brcmf_err("add arp ip err %d\n",
  12349. -+ ret);
  12350. - }
  12351. - }
  12352. - break;
  12353. 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
  12354. deleted file mode 100644
  12355. index 3de0f64..0000000
  12356. --- a/package/kernel/mac80211/patches/344-0008-brcmfmac-use-device-memsize-config-from-fw-if-define.patch
  12357. +++ /dev/null
  12358. @@ -1,73 +0,0 @@
  12359. -From: Hante Meuleman <meuleman@broadcom.com>
  12360. -Date: Wed, 17 Feb 2016 11:26:57 +0100
  12361. -Subject: [PATCH] brcmfmac: use device memsize config from fw if defined
  12362. -
  12363. -Newer type pcie devices have memory which get shared between fw and
  12364. -hw. The division of this memory is done firmware compile time. As a
  12365. -result the ramsize as used by driver needs to be adjusted for this.
  12366. -This is done by reading the memory size from the firmware.
  12367. -
  12368. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  12369. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  12370. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  12371. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  12372. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  12373. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12374. ----
  12375. -
  12376. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  12377. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  12378. -@@ -207,6 +207,10 @@ static struct brcmf_firmware_mapping brc
  12379. - #define BRCMF_PCIE_CFGREG_REG_BAR3_CONFIG 0x4F4
  12380. - #define BRCMF_PCIE_LINK_STATUS_CTRL_ASPM_ENAB 3
  12381. -
  12382. -+/* Magic number at a magic location to find RAM size */
  12383. -+#define BRCMF_RAMSIZE_MAGIC 0x534d4152 /* SMAR */
  12384. -+#define BRCMF_RAMSIZE_OFFSET 0x6c
  12385. -+
  12386. -
  12387. - struct brcmf_pcie_console {
  12388. - u32 base_addr;
  12389. -@@ -1412,6 +1416,28 @@ static const struct brcmf_bus_ops brcmf_
  12390. - };
  12391. -
  12392. -
  12393. -+static void
  12394. -+brcmf_pcie_adjust_ramsize(struct brcmf_pciedev_info *devinfo, u8 *data,
  12395. -+ u32 data_len)
  12396. -+{
  12397. -+ __le32 *field;
  12398. -+ u32 newsize;
  12399. -+
  12400. -+ if (data_len < BRCMF_RAMSIZE_OFFSET + 8)
  12401. -+ return;
  12402. -+
  12403. -+ field = (__le32 *)&data[BRCMF_RAMSIZE_OFFSET];
  12404. -+ if (le32_to_cpup(field) != BRCMF_RAMSIZE_MAGIC)
  12405. -+ return;
  12406. -+ field++;
  12407. -+ newsize = le32_to_cpup(field);
  12408. -+
  12409. -+ brcmf_dbg(PCIE, "Found ramsize info in FW, adjusting to 0x%x\n",
  12410. -+ newsize);
  12411. -+ devinfo->ci->ramsize = newsize;
  12412. -+}
  12413. -+
  12414. -+
  12415. - static int
  12416. - brcmf_pcie_init_share_ram_info(struct brcmf_pciedev_info *devinfo,
  12417. - u32 sharedram_addr)
  12418. -@@ -1694,6 +1720,13 @@ static void brcmf_pcie_setup(struct devi
  12419. -
  12420. - brcmf_pcie_attach(devinfo);
  12421. -
  12422. -+ /* Some of the firmwares have the size of the memory of the device
  12423. -+ * defined inside the firmware. This is because part of the memory in
  12424. -+ * the device is shared and the devision is determined by FW. Parse
  12425. -+ * the firmware and adjust the chip memory size now.
  12426. -+ */
  12427. -+ brcmf_pcie_adjust_ramsize(devinfo, (u8 *)fw->data, fw->size);
  12428. -+
  12429. - ret = brcmf_pcie_download_fw_nvram(devinfo, fw, nvram, nvram_len);
  12430. - if (ret)
  12431. - goto fail;
  12432. 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
  12433. deleted file mode 100644
  12434. index ca03ffe..0000000
  12435. --- a/package/kernel/mac80211/patches/344-0009-brcmfmac-use-bar1-window-size-as-provided-by-pci-sub.patch
  12436. +++ /dev/null
  12437. @@ -1,58 +0,0 @@
  12438. -From: Hante Meuleman <meuleman@broadcom.com>
  12439. -Date: Wed, 17 Feb 2016 11:26:58 +0100
  12440. -Subject: [PATCH] brcmfmac: use bar1 window size as provided by pci subsystem
  12441. -
  12442. -The PCIE bar1 window size is specified by chip. Currently the
  12443. -ioremap of bar1 was using a define which always matched the size
  12444. -of bar1, but newer chips can have a different bar1 sizes. With
  12445. -this patch the ioremap will be called with the by chip provided
  12446. -window size.
  12447. -
  12448. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  12449. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  12450. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  12451. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  12452. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  12453. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12454. ----
  12455. -
  12456. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  12457. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  12458. -@@ -72,7 +72,6 @@ static struct brcmf_firmware_mapping brc
  12459. -
  12460. - #define BRCMF_PCIE_FW_UP_TIMEOUT 2000 /* msec */
  12461. -
  12462. --#define BRCMF_PCIE_TCM_MAP_SIZE (4096 * 1024)
  12463. - #define BRCMF_PCIE_REG_MAP_SIZE (32 * 1024)
  12464. -
  12465. - /* backplane addres space accessed by BAR0 */
  12466. -@@ -252,7 +251,6 @@ struct brcmf_pciedev_info {
  12467. - char nvram_name[BRCMF_FW_NAME_LEN];
  12468. - void __iomem *regs;
  12469. - void __iomem *tcm;
  12470. -- u32 tcm_size;
  12471. - u32 ram_base;
  12472. - u32 ram_size;
  12473. - struct brcmf_chip *ci;
  12474. -@@ -1592,8 +1590,7 @@ static int brcmf_pcie_get_resource(struc
  12475. - }
  12476. -
  12477. - devinfo->regs = ioremap_nocache(bar0_addr, BRCMF_PCIE_REG_MAP_SIZE);
  12478. -- devinfo->tcm = ioremap_nocache(bar1_addr, BRCMF_PCIE_TCM_MAP_SIZE);
  12479. -- devinfo->tcm_size = BRCMF_PCIE_TCM_MAP_SIZE;
  12480. -+ devinfo->tcm = ioremap_nocache(bar1_addr, bar1_size);
  12481. -
  12482. - if (!devinfo->regs || !devinfo->tcm) {
  12483. - brcmf_err("ioremap() failed (%p,%p)\n", devinfo->regs,
  12484. -@@ -1602,8 +1599,9 @@ static int brcmf_pcie_get_resource(struc
  12485. - }
  12486. - brcmf_dbg(PCIE, "Phys addr : reg space = %p base addr %#016llx\n",
  12487. - devinfo->regs, (unsigned long long)bar0_addr);
  12488. -- brcmf_dbg(PCIE, "Phys addr : mem space = %p base addr %#016llx\n",
  12489. -- devinfo->tcm, (unsigned long long)bar1_addr);
  12490. -+ brcmf_dbg(PCIE, "Phys addr : mem space = %p base addr %#016llx size 0x%x\n",
  12491. -+ devinfo->tcm, (unsigned long long)bar1_addr,
  12492. -+ (unsigned int)bar1_size);
  12493. -
  12494. - return 0;
  12495. - }
  12496. 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
  12497. deleted file mode 100644
  12498. index e4a8f30..0000000
  12499. --- a/package/kernel/mac80211/patches/344-0010-brcmfmac-add-support-for-the-PCIE-4366c0-chip.patch
  12500. +++ /dev/null
  12501. @@ -1,34 +0,0 @@
  12502. -From: Hante Meuleman <meuleman@broadcom.com>
  12503. -Date: Wed, 17 Feb 2016 11:26:59 +0100
  12504. -Subject: [PATCH] brcmfmac: add support for the PCIE 4366c0 chip
  12505. -
  12506. -A newer version of the 4366 PCIE chip has been released. Add
  12507. -support for this version of the chip.
  12508. -
  12509. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  12510. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  12511. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  12512. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  12513. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12514. ----
  12515. -
  12516. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  12517. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  12518. -@@ -53,6 +53,7 @@ BRCMF_FW_NVRAM_DEF(4358, "brcmfmac4358-p
  12519. - BRCMF_FW_NVRAM_DEF(4359, "brcmfmac4359-pcie.bin", "brcmfmac4359-pcie.txt");
  12520. - BRCMF_FW_NVRAM_DEF(4365B, "brcmfmac4365b-pcie.bin", "brcmfmac4365b-pcie.txt");
  12521. - BRCMF_FW_NVRAM_DEF(4366B, "brcmfmac4366b-pcie.bin", "brcmfmac4366b-pcie.txt");
  12522. -+BRCMF_FW_NVRAM_DEF(4366C, "brcmfmac4366c-pcie.bin", "brcmfmac4366c-pcie.txt");
  12523. - BRCMF_FW_NVRAM_DEF(4371, "brcmfmac4371-pcie.bin", "brcmfmac4371-pcie.txt");
  12524. -
  12525. - static struct brcmf_firmware_mapping brcmf_pcie_fwnames[] = {
  12526. -@@ -66,7 +67,8 @@ static struct brcmf_firmware_mapping brc
  12527. - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4358_CHIP_ID, 0xFFFFFFFF, 4358),
  12528. - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4359_CHIP_ID, 0xFFFFFFFF, 4359),
  12529. - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4365_CHIP_ID, 0xFFFFFFFF, 4365B),
  12530. -- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4366_CHIP_ID, 0xFFFFFFFF, 4366B),
  12531. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4366_CHIP_ID, 0x0000000F, 4366B),
  12532. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4366_CHIP_ID, 0xFFFFFFF0, 4366C),
  12533. - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4371_CHIP_ID, 0xFFFFFFFF, 4371),
  12534. - };
  12535. -
  12536. diff --git a/package/kernel/mac80211/patches/344-0011-brcmfmac-remove-pcie-gen1-support.patch b/package/kernel/mac80211/patches/344-0011-brcmfmac-remove-pcie-gen1-support.patch
  12537. deleted file mode 100644
  12538. index f99f6db..0000000
  12539. --- a/package/kernel/mac80211/patches/344-0011-brcmfmac-remove-pcie-gen1-support.patch
  12540. +++ /dev/null
  12541. @@ -1,221 +0,0 @@
  12542. -From: Hante Meuleman <meuleman@broadcom.com>
  12543. -Date: Wed, 17 Feb 2016 11:27:00 +0100
  12544. -Subject: [PATCH] brcmfmac: remove pcie gen1 support
  12545. -
  12546. -The PCIE bus driver supports older gen1 (v1) chips, but there is no
  12547. -actual device which is using this older pcie core which is supported
  12548. -by brcmfmac. Remove all gen1 related code.
  12549. -
  12550. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  12551. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  12552. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  12553. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  12554. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  12555. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12556. ----
  12557. -
  12558. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  12559. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  12560. -@@ -100,9 +100,6 @@ static struct brcmf_firmware_mapping brc
  12561. - #define BRCMF_PCIE_PCIE2REG_CONFIGDATA 0x124
  12562. - #define BRCMF_PCIE_PCIE2REG_H2D_MAILBOX 0x140
  12563. -
  12564. --#define BRCMF_PCIE_GENREV1 1
  12565. --#define BRCMF_PCIE_GENREV2 2
  12566. --
  12567. - #define BRCMF_PCIE2_INTA 0x01
  12568. - #define BRCMF_PCIE2_INTB 0x02
  12569. -
  12570. -@@ -257,9 +254,7 @@ struct brcmf_pciedev_info {
  12571. - u32 ram_size;
  12572. - struct brcmf_chip *ci;
  12573. - u32 coreid;
  12574. -- u32 generic_corerev;
  12575. - struct brcmf_pcie_shared_info shared;
  12576. -- void (*ringbell)(struct brcmf_pciedev_info *devinfo);
  12577. - wait_queue_head_t mbdata_resp_wait;
  12578. - bool mbdata_completed;
  12579. - bool irq_allocated;
  12580. -@@ -746,68 +741,22 @@ static void brcmf_pcie_bus_console_read(
  12581. - }
  12582. -
  12583. -
  12584. --static __used void brcmf_pcie_ringbell_v1(struct brcmf_pciedev_info *devinfo)
  12585. --{
  12586. -- u32 reg_value;
  12587. --
  12588. -- brcmf_dbg(PCIE, "RING !\n");
  12589. -- reg_value = brcmf_pcie_read_reg32(devinfo,
  12590. -- BRCMF_PCIE_PCIE2REG_MAILBOXINT);
  12591. -- reg_value |= BRCMF_PCIE2_INTB;
  12592. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT,
  12593. -- reg_value);
  12594. --}
  12595. --
  12596. --
  12597. --static void brcmf_pcie_ringbell_v2(struct brcmf_pciedev_info *devinfo)
  12598. --{
  12599. -- brcmf_dbg(PCIE, "RING !\n");
  12600. -- /* Any arbitrary value will do, lets use 1 */
  12601. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_H2D_MAILBOX, 1);
  12602. --}
  12603. --
  12604. --
  12605. - static void brcmf_pcie_intr_disable(struct brcmf_pciedev_info *devinfo)
  12606. - {
  12607. -- if (devinfo->generic_corerev == BRCMF_PCIE_GENREV1)
  12608. -- pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_INTMASK,
  12609. -- 0);
  12610. -- else
  12611. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXMASK,
  12612. -- 0);
  12613. -+ brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXMASK, 0);
  12614. - }
  12615. -
  12616. -
  12617. - static void brcmf_pcie_intr_enable(struct brcmf_pciedev_info *devinfo)
  12618. - {
  12619. -- if (devinfo->generic_corerev == BRCMF_PCIE_GENREV1)
  12620. -- pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_INTMASK,
  12621. -- BRCMF_PCIE_INT_DEF);
  12622. -- else
  12623. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXMASK,
  12624. -- BRCMF_PCIE_MB_INT_D2H_DB |
  12625. -- BRCMF_PCIE_MB_INT_FN0_0 |
  12626. -- BRCMF_PCIE_MB_INT_FN0_1);
  12627. -+ brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXMASK,
  12628. -+ BRCMF_PCIE_MB_INT_D2H_DB |
  12629. -+ BRCMF_PCIE_MB_INT_FN0_0 |
  12630. -+ BRCMF_PCIE_MB_INT_FN0_1);
  12631. - }
  12632. -
  12633. -
  12634. --static irqreturn_t brcmf_pcie_quick_check_isr_v1(int irq, void *arg)
  12635. --{
  12636. -- struct brcmf_pciedev_info *devinfo = (struct brcmf_pciedev_info *)arg;
  12637. -- u32 status;
  12638. --
  12639. -- status = 0;
  12640. -- pci_read_config_dword(devinfo->pdev, BRCMF_PCIE_REG_INTSTATUS, &status);
  12641. -- if (status) {
  12642. -- brcmf_pcie_intr_disable(devinfo);
  12643. -- brcmf_dbg(PCIE, "Enter\n");
  12644. -- return IRQ_WAKE_THREAD;
  12645. -- }
  12646. -- return IRQ_NONE;
  12647. --}
  12648. --
  12649. --
  12650. --static irqreturn_t brcmf_pcie_quick_check_isr_v2(int irq, void *arg)
  12651. -+static irqreturn_t brcmf_pcie_quick_check_isr(int irq, void *arg)
  12652. - {
  12653. - struct brcmf_pciedev_info *devinfo = (struct brcmf_pciedev_info *)arg;
  12654. -
  12655. -@@ -820,29 +769,7 @@ static irqreturn_t brcmf_pcie_quick_chec
  12656. - }
  12657. -
  12658. -
  12659. --static irqreturn_t brcmf_pcie_isr_thread_v1(int irq, void *arg)
  12660. --{
  12661. -- struct brcmf_pciedev_info *devinfo = (struct brcmf_pciedev_info *)arg;
  12662. -- const struct pci_dev *pdev = devinfo->pdev;
  12663. -- u32 status;
  12664. --
  12665. -- devinfo->in_irq = true;
  12666. -- status = 0;
  12667. -- pci_read_config_dword(pdev, BRCMF_PCIE_REG_INTSTATUS, &status);
  12668. -- brcmf_dbg(PCIE, "Enter %x\n", status);
  12669. -- if (status) {
  12670. -- pci_write_config_dword(pdev, BRCMF_PCIE_REG_INTSTATUS, status);
  12671. -- if (devinfo->state == BRCMFMAC_PCIE_STATE_UP)
  12672. -- brcmf_proto_msgbuf_rx_trigger(&devinfo->pdev->dev);
  12673. -- }
  12674. -- if (devinfo->state == BRCMFMAC_PCIE_STATE_UP)
  12675. -- brcmf_pcie_intr_enable(devinfo);
  12676. -- devinfo->in_irq = false;
  12677. -- return IRQ_HANDLED;
  12678. --}
  12679. --
  12680. --
  12681. --static irqreturn_t brcmf_pcie_isr_thread_v2(int irq, void *arg)
  12682. -+static irqreturn_t brcmf_pcie_isr_thread(int irq, void *arg)
  12683. - {
  12684. - struct brcmf_pciedev_info *devinfo = (struct brcmf_pciedev_info *)arg;
  12685. - u32 status;
  12686. -@@ -879,28 +806,14 @@ static int brcmf_pcie_request_irq(struct
  12687. - brcmf_pcie_intr_disable(devinfo);
  12688. -
  12689. - brcmf_dbg(PCIE, "Enter\n");
  12690. -- /* is it a v1 or v2 implementation */
  12691. -+
  12692. - pci_enable_msi(pdev);
  12693. -- if (devinfo->generic_corerev == BRCMF_PCIE_GENREV1) {
  12694. -- if (request_threaded_irq(pdev->irq,
  12695. -- brcmf_pcie_quick_check_isr_v1,
  12696. -- brcmf_pcie_isr_thread_v1,
  12697. -- IRQF_SHARED, "brcmf_pcie_intr",
  12698. -- devinfo)) {
  12699. -- pci_disable_msi(pdev);
  12700. -- brcmf_err("Failed to request IRQ %d\n", pdev->irq);
  12701. -- return -EIO;
  12702. -- }
  12703. -- } else {
  12704. -- if (request_threaded_irq(pdev->irq,
  12705. -- brcmf_pcie_quick_check_isr_v2,
  12706. -- brcmf_pcie_isr_thread_v2,
  12707. -- IRQF_SHARED, "brcmf_pcie_intr",
  12708. -- devinfo)) {
  12709. -- pci_disable_msi(pdev);
  12710. -- brcmf_err("Failed to request IRQ %d\n", pdev->irq);
  12711. -- return -EIO;
  12712. -- }
  12713. -+ if (request_threaded_irq(pdev->irq, brcmf_pcie_quick_check_isr,
  12714. -+ brcmf_pcie_isr_thread, IRQF_SHARED,
  12715. -+ "brcmf_pcie_intr", devinfo)) {
  12716. -+ pci_disable_msi(pdev);
  12717. -+ brcmf_err("Failed to request IRQ %d\n", pdev->irq);
  12718. -+ return -EIO;
  12719. - }
  12720. - devinfo->irq_allocated = true;
  12721. - return 0;
  12722. -@@ -931,16 +844,9 @@ static void brcmf_pcie_release_irq(struc
  12723. - if (devinfo->in_irq)
  12724. - brcmf_err("Still in IRQ (processing) !!!\n");
  12725. -
  12726. -- if (devinfo->generic_corerev == BRCMF_PCIE_GENREV1) {
  12727. -- status = 0;
  12728. -- pci_read_config_dword(pdev, BRCMF_PCIE_REG_INTSTATUS, &status);
  12729. -- pci_write_config_dword(pdev, BRCMF_PCIE_REG_INTSTATUS, status);
  12730. -- } else {
  12731. -- status = brcmf_pcie_read_reg32(devinfo,
  12732. -- BRCMF_PCIE_PCIE2REG_MAILBOXINT);
  12733. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT,
  12734. -- status);
  12735. -- }
  12736. -+ status = brcmf_pcie_read_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT);
  12737. -+ brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT, status);
  12738. -+
  12739. - devinfo->irq_allocated = false;
  12740. - }
  12741. -
  12742. -@@ -989,7 +895,9 @@ static int brcmf_pcie_ring_mb_ring_bell(
  12743. - if (devinfo->state != BRCMFMAC_PCIE_STATE_UP)
  12744. - return -EIO;
  12745. -
  12746. -- devinfo->ringbell(devinfo);
  12747. -+ brcmf_dbg(PCIE, "RING !\n");
  12748. -+ /* Any arbitrary value will do, lets use 1 */
  12749. -+ brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_H2D_MAILBOX, 1);
  12750. -
  12751. - return 0;
  12752. - }
  12753. -@@ -1503,9 +1411,6 @@ static int brcmf_pcie_download_fw_nvram(
  12754. - u32 address;
  12755. - u32 resetintr;
  12756. -
  12757. -- devinfo->ringbell = brcmf_pcie_ringbell_v2;
  12758. -- devinfo->generic_corerev = BRCMF_PCIE_GENREV2;
  12759. --
  12760. - brcmf_dbg(PCIE, "Halt ARM.\n");
  12761. - err = brcmf_pcie_enter_download_state(devinfo);
  12762. - if (err)
  12763. 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
  12764. deleted file mode 100644
  12765. index 4adfc2d..0000000
  12766. --- a/package/kernel/mac80211/patches/344-0012-brcmfmac-increase-timeout-for-tx-eapol.patch
  12767. +++ /dev/null
  12768. @@ -1,30 +0,0 @@
  12769. -From: Hante Meuleman <meuleman@broadcom.com>
  12770. -Date: Wed, 17 Feb 2016 11:27:01 +0100
  12771. -Subject: [PATCH] brcmfmac: increase timeout for tx eapol
  12772. -
  12773. -When keys get set and updated this has to happen after eapol got
  12774. -transmitted (without key or old key) before the key can be updated.
  12775. -To make sure the order of sending eapol and configuring key is done
  12776. -correctly a timeout for tx of eapol is applied. This timeout is set
  12777. -to 50 msec, which is not always enough. Especially in AP mode and
  12778. -key updates the timeout may need to be much longer because client(s)
  12779. -can be in powersave. Increase the timeout from 50 to 950 msec.
  12780. -
  12781. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  12782. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  12783. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  12784. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  12785. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12786. ----
  12787. -
  12788. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  12789. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  12790. -@@ -42,7 +42,7 @@ MODULE_AUTHOR("Broadcom Corporation");
  12791. - MODULE_DESCRIPTION("Broadcom 802.11 wireless LAN fullmac driver.");
  12792. - MODULE_LICENSE("Dual BSD/GPL");
  12793. -
  12794. --#define MAX_WAIT_FOR_8021X_TX msecs_to_jiffies(50)
  12795. -+#define MAX_WAIT_FOR_8021X_TX msecs_to_jiffies(950)
  12796. -
  12797. - /* AMPDU rx reordering definitions */
  12798. - #define BRCMF_RXREORDER_FLOWID_OFFSET 0
  12799. diff --git a/package/kernel/mac80211/patches/344-0013-brcmfmac-move-module-init-and-exit-to-common.patch b/package/kernel/mac80211/patches/344-0013-brcmfmac-move-module-init-and-exit-to-common.patch
  12800. deleted file mode 100644
  12801. index bd62781..0000000
  12802. --- a/package/kernel/mac80211/patches/344-0013-brcmfmac-move-module-init-and-exit-to-common.patch
  12803. +++ /dev/null
  12804. @@ -1,135 +0,0 @@
  12805. -From: Hante Meuleman <meuleman@broadcom.com>
  12806. -Date: Wed, 17 Feb 2016 11:27:02 +0100
  12807. -Subject: [PATCH] brcmfmac: move module init and exit to common
  12808. -
  12809. -In preparation of module parameters for all devices the module init
  12810. -and exit routines are moved to the common file.
  12811. -
  12812. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  12813. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  12814. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  12815. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  12816. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  12817. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12818. ----
  12819. -
  12820. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  12821. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  12822. -@@ -28,6 +28,10 @@
  12823. - #include "tracepoint.h"
  12824. - #include "common.h"
  12825. -
  12826. -+MODULE_AUTHOR("Broadcom Corporation");
  12827. -+MODULE_DESCRIPTION("Broadcom 802.11 wireless LAN fullmac driver.");
  12828. -+MODULE_LICENSE("Dual BSD/GPL");
  12829. -+
  12830. - const u8 ALLFFMAC[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
  12831. -
  12832. - #define BRCMF_DEFAULT_SCAN_CHANNEL_TIME 40
  12833. -@@ -221,7 +225,7 @@ void __brcmf_dbg(u32 level, const char *
  12834. - }
  12835. - #endif
  12836. -
  12837. --void brcmf_mp_attach(void)
  12838. -+static void brcmf_mp_attach(void)
  12839. - {
  12840. - strlcpy(brcmf_mp_global.firmware_path, brcmf_firmware_path,
  12841. - BRCMF_FW_ALTPATH_LEN);
  12842. -@@ -249,3 +253,33 @@ void brcmf_mp_device_detach(struct brcmf
  12843. - kfree(drvr->settings);
  12844. - }
  12845. -
  12846. -+static int __init brcmfmac_module_init(void)
  12847. -+{
  12848. -+ int err;
  12849. -+
  12850. -+ /* Initialize debug system first */
  12851. -+ brcmf_debugfs_init();
  12852. -+
  12853. -+#ifdef CPTCFG_BRCMFMAC_SDIO
  12854. -+ brcmf_sdio_init();
  12855. -+#endif
  12856. -+ /* Initialize global module paramaters */
  12857. -+ brcmf_mp_attach();
  12858. -+
  12859. -+ /* Continue the initialization by registering the different busses */
  12860. -+ err = brcmf_core_init();
  12861. -+ if (err)
  12862. -+ brcmf_debugfs_exit();
  12863. -+
  12864. -+ return err;
  12865. -+}
  12866. -+
  12867. -+static void __exit brcmfmac_module_exit(void)
  12868. -+{
  12869. -+ brcmf_core_exit();
  12870. -+ brcmf_debugfs_exit();
  12871. -+}
  12872. -+
  12873. -+module_init(brcmfmac_module_init);
  12874. -+module_exit(brcmfmac_module_exit);
  12875. -+
  12876. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
  12877. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
  12878. -@@ -89,7 +89,6 @@ struct brcmf_mp_device {
  12879. - struct cc_translate *country_codes;
  12880. - };
  12881. -
  12882. --void brcmf_mp_attach(void);
  12883. - int brcmf_mp_device_attach(struct brcmf_pub *drvr);
  12884. - void brcmf_mp_device_detach(struct brcmf_pub *drvr);
  12885. - #ifdef DEBUG
  12886. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  12887. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  12888. -@@ -38,10 +38,6 @@
  12889. - #include "pcie.h"
  12890. - #include "common.h"
  12891. -
  12892. --MODULE_AUTHOR("Broadcom Corporation");
  12893. --MODULE_DESCRIPTION("Broadcom 802.11 wireless LAN fullmac driver.");
  12894. --MODULE_LICENSE("Dual BSD/GPL");
  12895. --
  12896. - #define MAX_WAIT_FOR_8021X_TX msecs_to_jiffies(950)
  12897. -
  12898. - /* AMPDU rx reordering definitions */
  12899. -@@ -1422,19 +1418,15 @@ static void brcmf_driver_register(struct
  12900. - }
  12901. - static DECLARE_WORK(brcmf_driver_work, brcmf_driver_register);
  12902. -
  12903. --static int __init brcmfmac_module_init(void)
  12904. -+int __init brcmf_core_init(void)
  12905. - {
  12906. -- brcmf_debugfs_init();
  12907. --#ifdef CPTCFG_BRCMFMAC_SDIO
  12908. -- brcmf_sdio_init();
  12909. --#endif
  12910. - if (!schedule_work(&brcmf_driver_work))
  12911. - return -EBUSY;
  12912. -
  12913. - return 0;
  12914. - }
  12915. -
  12916. --static void __exit brcmfmac_module_exit(void)
  12917. -+void __exit brcmf_core_exit(void)
  12918. - {
  12919. - cancel_work_sync(&brcmf_driver_work);
  12920. -
  12921. -@@ -1447,8 +1439,5 @@ static void __exit brcmfmac_module_exit(
  12922. - #ifdef CPTCFG_BRCMFMAC_PCIE
  12923. - brcmf_pcie_exit();
  12924. - #endif
  12925. -- brcmf_debugfs_exit();
  12926. - }
  12927. -
  12928. --module_init(brcmfmac_module_init);
  12929. --module_exit(brcmfmac_module_exit);
  12930. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  12931. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  12932. -@@ -227,5 +227,7 @@ void brcmf_txflowblock_if(struct brcmf_i
  12933. - void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
  12934. - void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb);
  12935. - void brcmf_net_setcarrier(struct brcmf_if *ifp, bool on);
  12936. -+int __init brcmf_core_init(void);
  12937. -+void __exit brcmf_core_exit(void);
  12938. -
  12939. - #endif /* BRCMFMAC_CORE_H */
  12940. diff --git a/package/kernel/mac80211/patches/344-0014-brcmfmac-add-wowl-gtk-rekeying-offload-support.patch b/package/kernel/mac80211/patches/344-0014-brcmfmac-add-wowl-gtk-rekeying-offload-support.patch
  12941. deleted file mode 100644
  12942. index 577ca8e..0000000
  12943. --- a/package/kernel/mac80211/patches/344-0014-brcmfmac-add-wowl-gtk-rekeying-offload-support.patch
  12944. +++ /dev/null
  12945. @@ -1,260 +0,0 @@
  12946. -From: Hante Meuleman <meuleman@broadcom.com>
  12947. -Date: Wed, 17 Feb 2016 11:27:03 +0100
  12948. -Subject: [PATCH] brcmfmac: add wowl gtk rekeying offload support
  12949. -
  12950. -This patch adds support for gtk rekeying offload and for gtk
  12951. -rekeying failure during wowl mode.
  12952. -
  12953. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  12954. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  12955. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  12956. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  12957. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  12958. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12959. ----
  12960. -
  12961. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  12962. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  12963. -@@ -3526,6 +3526,10 @@ static void brcmf_report_wowl_wakeind(st
  12964. - else
  12965. - wakeup_data.net_detect = cfg->wowl.nd_info;
  12966. - }
  12967. -+ if (wakeind & BRCMF_WOWL_GTK_FAILURE) {
  12968. -+ brcmf_dbg(INFO, "WOWL Wake indicator: BRCMF_WOWL_GTK_FAILURE\n");
  12969. -+ wakeup_data.gtk_rekey_failure = true;
  12970. -+ }
  12971. - } else {
  12972. - wakeup = NULL;
  12973. - }
  12974. -@@ -3607,6 +3611,8 @@ static void brcmf_configure_wowl(struct
  12975. - brcmf_fweh_register(cfg->pub, BRCMF_E_PFN_NET_FOUND,
  12976. - brcmf_wowl_nd_results);
  12977. - }
  12978. -+ if (wowl->gtk_rekey_failure)
  12979. -+ wowl_config |= BRCMF_WOWL_GTK_FAILURE;
  12980. - if (!test_bit(BRCMF_VIF_STATUS_CONNECTED, &ifp->vif->sme_state))
  12981. - wowl_config |= BRCMF_WOWL_UNASSOC;
  12982. -
  12983. -@@ -4874,7 +4880,32 @@ static int brcmf_cfg80211_tdls_oper(stru
  12984. - return ret;
  12985. - }
  12986. -
  12987. --static struct cfg80211_ops wl_cfg80211_ops = {
  12988. -+#ifdef CONFIG_PM
  12989. -+static int
  12990. -+brcmf_cfg80211_set_rekey_data(struct wiphy *wiphy, struct net_device *ndev,
  12991. -+ struct cfg80211_gtk_rekey_data *gtk)
  12992. -+{
  12993. -+ struct brcmf_if *ifp = netdev_priv(ndev);
  12994. -+ struct brcmf_gtk_keyinfo_le gtk_le;
  12995. -+ int ret;
  12996. -+
  12997. -+ brcmf_dbg(TRACE, "Enter, bssidx=%d\n", ifp->bsscfgidx);
  12998. -+
  12999. -+ memcpy(gtk_le.kck, gtk->kck, sizeof(gtk_le.kck));
  13000. -+ memcpy(gtk_le.kek, gtk->kek, sizeof(gtk_le.kek));
  13001. -+ memcpy(gtk_le.replay_counter, gtk->replay_ctr,
  13002. -+ sizeof(gtk_le.replay_counter));
  13003. -+
  13004. -+ ret = brcmf_fil_iovar_data_set(ifp, "gtk_key_info", &gtk_le,
  13005. -+ sizeof(gtk_le));
  13006. -+ if (ret < 0)
  13007. -+ brcmf_err("gtk_key_info iovar failed: ret=%d\n", ret);
  13008. -+
  13009. -+ return ret;
  13010. -+}
  13011. -+#endif
  13012. -+
  13013. -+static struct cfg80211_ops brcmf_cfg80211_ops = {
  13014. - .add_virtual_intf = brcmf_cfg80211_add_iface,
  13015. - .del_virtual_intf = brcmf_cfg80211_del_iface,
  13016. - .change_virtual_intf = brcmf_cfg80211_change_iface,
  13017. -@@ -6139,19 +6170,18 @@ static void brcmf_wiphy_wowl_params(stru
  13018. - {
  13019. - #ifdef CONFIG_PM
  13020. - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
  13021. -- s32 err;
  13022. -- u32 wowl_cap;
  13023. -
  13024. - if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_PNO)) {
  13025. -- err = brcmf_fil_iovar_int_get(ifp, "wowl_cap", &wowl_cap);
  13026. -- if (!err) {
  13027. -- if (wowl_cap & BRCMF_WOWL_PFN_FOUND) {
  13028. -- brcmf_wowlan_support.flags |=
  13029. -- WIPHY_WOWLAN_NET_DETECT;
  13030. -- init_waitqueue_head(&cfg->wowl.nd_data_wait);
  13031. -- }
  13032. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL_ND)) {
  13033. -+ brcmf_wowlan_support.flags |= WIPHY_WOWLAN_NET_DETECT;
  13034. -+ init_waitqueue_head(&cfg->wowl.nd_data_wait);
  13035. - }
  13036. - }
  13037. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL_GTK)) {
  13038. -+ brcmf_wowlan_support.flags |= WIPHY_WOWLAN_SUPPORTS_GTK_REKEY;
  13039. -+ brcmf_wowlan_support.flags |= WIPHY_WOWLAN_GTK_REKEY_FAILURE;
  13040. -+ }
  13041. -+
  13042. - wiphy->wowlan = &brcmf_wowlan_support;
  13043. - #endif
  13044. - }
  13045. -@@ -6538,6 +6568,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  13046. - struct net_device *ndev = brcmf_get_ifp(drvr, 0)->ndev;
  13047. - struct brcmf_cfg80211_info *cfg;
  13048. - struct wiphy *wiphy;
  13049. -+ struct cfg80211_ops *ops;
  13050. - struct brcmf_cfg80211_vif *vif;
  13051. - struct brcmf_if *ifp;
  13052. - s32 err = 0;
  13053. -@@ -6549,8 +6580,17 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  13054. - return NULL;
  13055. - }
  13056. -
  13057. -+ ops = kzalloc(sizeof(*ops), GFP_KERNEL);
  13058. -+ if (!ops)
  13059. -+ return NULL;
  13060. -+
  13061. -+ memcpy(ops, &brcmf_cfg80211_ops, sizeof(*ops));
  13062. - ifp = netdev_priv(ndev);
  13063. -- wiphy = wiphy_new(&wl_cfg80211_ops, sizeof(struct brcmf_cfg80211_info));
  13064. -+#ifdef CONFIG_PM
  13065. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL_GTK))
  13066. -+ ops->set_rekey_data = brcmf_cfg80211_set_rekey_data;
  13067. -+#endif
  13068. -+ wiphy = wiphy_new(ops, sizeof(struct brcmf_cfg80211_info));
  13069. - if (!wiphy) {
  13070. - brcmf_err("Could not allocate wiphy device\n");
  13071. - return NULL;
  13072. -@@ -6560,6 +6600,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  13073. -
  13074. - cfg = wiphy_priv(wiphy);
  13075. - cfg->wiphy = wiphy;
  13076. -+ cfg->ops = ops;
  13077. - cfg->pub = drvr;
  13078. - init_vif_event(&cfg->vif_event);
  13079. - INIT_LIST_HEAD(&cfg->vif_list);
  13080. -@@ -6686,6 +6727,7 @@ priv_out:
  13081. - ifp->vif = NULL;
  13082. - wiphy_out:
  13083. - brcmf_free_wiphy(wiphy);
  13084. -+ kfree(ops);
  13085. - return NULL;
  13086. - }
  13087. -
  13088. -@@ -6696,6 +6738,7 @@ void brcmf_cfg80211_detach(struct brcmf_
  13089. -
  13090. - brcmf_btcoex_detach(cfg);
  13091. - wiphy_unregister(cfg->wiphy);
  13092. -+ kfree(cfg->ops);
  13093. - wl_deinit_priv(cfg);
  13094. - brcmf_free_wiphy(cfg->wiphy);
  13095. - }
  13096. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  13097. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  13098. -@@ -256,6 +256,7 @@ struct brcmf_cfg80211_wowl {
  13099. - * struct brcmf_cfg80211_info - dongle private data of cfg80211 interface
  13100. - *
  13101. - * @wiphy: wiphy object for cfg80211 interface.
  13102. -+ * @ops: pointer to copy of ops as registered with wiphy object.
  13103. - * @conf: dongle configuration.
  13104. - * @p2p: peer-to-peer specific information.
  13105. - * @btcoex: Bluetooth coexistence information.
  13106. -@@ -288,6 +289,7 @@ struct brcmf_cfg80211_wowl {
  13107. - */
  13108. - struct brcmf_cfg80211_info {
  13109. - struct wiphy *wiphy;
  13110. -+ struct cfg80211_ops *ops;
  13111. - struct brcmf_cfg80211_conf *conf;
  13112. - struct brcmf_p2p_info p2p;
  13113. - struct brcmf_btcoex_info *btcoex;
  13114. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
  13115. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
  13116. -@@ -136,6 +136,7 @@ void brcmf_feat_attach(struct brcmf_pub
  13117. - {
  13118. - struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
  13119. - struct brcmf_pno_macaddr_le pfn_mac;
  13120. -+ u32 wowl_cap;
  13121. - s32 err;
  13122. -
  13123. - brcmf_feat_firmware_capabilities(ifp);
  13124. -@@ -143,6 +144,17 @@ void brcmf_feat_attach(struct brcmf_pub
  13125. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_PNO, "pfn");
  13126. - if (drvr->bus_if->wowl_supported)
  13127. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_WOWL, "wowl");
  13128. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL)) {
  13129. -+ err = brcmf_fil_iovar_int_get(ifp, "wowl_cap", &wowl_cap);
  13130. -+ if (!err) {
  13131. -+ if (wowl_cap & BRCMF_WOWL_PFN_FOUND)
  13132. -+ ifp->drvr->feat_flags |=
  13133. -+ BIT(BRCMF_FEAT_WOWL_ND);
  13134. -+ if (wowl_cap & BRCMF_WOWL_GTK_FAILURE)
  13135. -+ ifp->drvr->feat_flags |=
  13136. -+ BIT(BRCMF_FEAT_WOWL_GTK);
  13137. -+ }
  13138. -+ }
  13139. - /* MBSS does not work for 43362 */
  13140. - if (drvr->bus_if->chip == BRCM_CC_43362_CHIP_ID)
  13141. - ifp->drvr->feat_flags &= ~BIT(BRCMF_FEAT_MBSS);
  13142. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h
  13143. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h
  13144. -@@ -27,6 +27,8 @@
  13145. - * RSDB: Real Simultaneous Dual Band
  13146. - * TDLS: Tunneled Direct Link Setup
  13147. - * SCAN_RANDOM_MAC: Random MAC during (net detect) scheduled scan.
  13148. -+ * WOWL_ND: WOWL net detect (PNO)
  13149. -+ * WOWL_GTK: (WOWL) GTK rekeying offload
  13150. - */
  13151. - #define BRCMF_FEAT_LIST \
  13152. - BRCMF_FEAT_DEF(MBSS) \
  13153. -@@ -36,7 +38,9 @@
  13154. - BRCMF_FEAT_DEF(P2P) \
  13155. - BRCMF_FEAT_DEF(RSDB) \
  13156. - BRCMF_FEAT_DEF(TDLS) \
  13157. -- BRCMF_FEAT_DEF(SCAN_RANDOM_MAC)
  13158. -+ BRCMF_FEAT_DEF(SCAN_RANDOM_MAC) \
  13159. -+ BRCMF_FEAT_DEF(WOWL_ND) \
  13160. -+ BRCMF_FEAT_DEF(WOWL_GTK)
  13161. -
  13162. - /*
  13163. - * Quirks:
  13164. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h
  13165. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h
  13166. -@@ -111,7 +111,9 @@
  13167. - /* Wakeup if received matched secured pattern: */
  13168. - #define BRCMF_WOWL_SECURE (1 << 25)
  13169. - /* Wakeup on finding preferred network */
  13170. --#define BRCMF_WOWL_PFN_FOUND (1 << 26)
  13171. -+#define BRCMF_WOWL_PFN_FOUND (1 << 27)
  13172. -+/* Wakeup on receiving pairwise key EAP packets: */
  13173. -+#define WIPHY_WOWL_EAP_PK (1 << 28)
  13174. - /* Link Down indication in WoWL mode: */
  13175. - #define BRCMF_WOWL_LINKDOWN (1 << 31)
  13176. -
  13177. -@@ -136,6 +138,10 @@
  13178. -
  13179. - #define BRCMF_MCSSET_LEN 16
  13180. -
  13181. -+#define BRCMF_RSN_KCK_LENGTH 16
  13182. -+#define BRCMF_RSN_KEK_LENGTH 16
  13183. -+#define BRCMF_RSN_REPLAY_LEN 8
  13184. -+
  13185. - /* join preference types for join_pref iovar */
  13186. - enum brcmf_join_pref_types {
  13187. - BRCMF_JOIN_PREF_RSSI = 1,
  13188. -@@ -789,4 +795,17 @@ struct brcmf_pktcnt_le {
  13189. - __le32 rx_ocast_good_pkt;
  13190. - };
  13191. -
  13192. -+/**
  13193. -+ * struct brcmf_gtk_keyinfo_le - GTP rekey data
  13194. -+ *
  13195. -+ * @kck: key confirmation key.
  13196. -+ * @kek: key encryption key.
  13197. -+ * @replay_counter: replay counter.
  13198. -+ */
  13199. -+struct brcmf_gtk_keyinfo_le {
  13200. -+ u8 kck[BRCMF_RSN_KCK_LENGTH];
  13201. -+ u8 kek[BRCMF_RSN_KEK_LENGTH];
  13202. -+ u8 replay_counter[BRCMF_RSN_REPLAY_LEN];
  13203. -+};
  13204. -+
  13205. - #endif /* FWIL_TYPES_H_ */
  13206. diff --git a/package/kernel/mac80211/patches/344-0015-brcmfmac-move-platform-data-retrieval-code-to-common.patch b/package/kernel/mac80211/patches/344-0015-brcmfmac-move-platform-data-retrieval-code-to-common.patch
  13207. deleted file mode 100644
  13208. index 2685238..0000000
  13209. --- a/package/kernel/mac80211/patches/344-0015-brcmfmac-move-platform-data-retrieval-code-to-common.patch
  13210. +++ /dev/null
  13211. @@ -1,385 +0,0 @@
  13212. -From: Hante Meuleman <meuleman@broadcom.com>
  13213. -Date: Wed, 17 Feb 2016 11:27:04 +0100
  13214. -Subject: [PATCH] brcmfmac: move platform data retrieval code to common
  13215. -
  13216. -In preparation of module parameters for all devices the module
  13217. -platform data retrieval is moved from sdio to common. It is still
  13218. -only used for sdio devices.
  13219. -
  13220. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  13221. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  13222. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  13223. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  13224. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  13225. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13226. ----
  13227. -
  13228. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  13229. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  13230. -@@ -27,8 +27,6 @@
  13231. - #include <linux/mmc/sdio_func.h>
  13232. - #include <linux/mmc/card.h>
  13233. - #include <linux/mmc/host.h>
  13234. --#include <linux/platform_device.h>
  13235. --#include <linux/platform_data/brcmfmac-sdio.h>
  13236. - #include <linux/pm_runtime.h>
  13237. - #include <linux/suspend.h>
  13238. - #include <linux/errno.h>
  13239. -@@ -46,7 +44,6 @@
  13240. - #include "bus.h"
  13241. - #include "debug.h"
  13242. - #include "sdio.h"
  13243. --#include "of.h"
  13244. - #include "core.h"
  13245. - #include "common.h"
  13246. -
  13247. -@@ -106,18 +103,18 @@ static void brcmf_sdiod_dummy_irqhandler
  13248. -
  13249. - int brcmf_sdiod_intr_register(struct brcmf_sdio_dev *sdiodev)
  13250. - {
  13251. -+ struct brcmfmac_sdio_platform_data *pdata;
  13252. - int ret = 0;
  13253. - u8 data;
  13254. - u32 addr, gpiocontrol;
  13255. - unsigned long flags;
  13256. -
  13257. -- if ((sdiodev->pdata) && (sdiodev->pdata->oob_irq_supported)) {
  13258. -+ pdata = sdiodev->pdata;
  13259. -+ if ((pdata) && (pdata->oob_irq_supported)) {
  13260. - brcmf_dbg(SDIO, "Enter, register OOB IRQ %d\n",
  13261. -- sdiodev->pdata->oob_irq_nr);
  13262. -- ret = request_irq(sdiodev->pdata->oob_irq_nr,
  13263. -- brcmf_sdiod_oob_irqhandler,
  13264. -- sdiodev->pdata->oob_irq_flags,
  13265. -- "brcmf_oob_intr",
  13266. -+ pdata->oob_irq_nr);
  13267. -+ ret = request_irq(pdata->oob_irq_nr, brcmf_sdiod_oob_irqhandler,
  13268. -+ pdata->oob_irq_flags, "brcmf_oob_intr",
  13269. - &sdiodev->func[1]->dev);
  13270. - if (ret != 0) {
  13271. - brcmf_err("request_irq failed %d\n", ret);
  13272. -@@ -129,7 +126,7 @@ int brcmf_sdiod_intr_register(struct brc
  13273. - sdiodev->irq_en = true;
  13274. - spin_unlock_irqrestore(&sdiodev->irq_en_lock, flags);
  13275. -
  13276. -- ret = enable_irq_wake(sdiodev->pdata->oob_irq_nr);
  13277. -+ ret = enable_irq_wake(pdata->oob_irq_nr);
  13278. - if (ret != 0) {
  13279. - brcmf_err("enable_irq_wake failed %d\n", ret);
  13280. - return ret;
  13281. -@@ -158,7 +155,7 @@ int brcmf_sdiod_intr_register(struct brc
  13282. -
  13283. - /* redirect, configure and enable io for interrupt signal */
  13284. - data = SDIO_SEPINT_MASK | SDIO_SEPINT_OE;
  13285. -- if (sdiodev->pdata->oob_irq_flags & IRQF_TRIGGER_HIGH)
  13286. -+ if (pdata->oob_irq_flags & IRQF_TRIGGER_HIGH)
  13287. - data |= SDIO_SEPINT_ACT_HI;
  13288. - brcmf_sdiod_regwb(sdiodev, SDIO_CCCR_BRCM_SEPINT, data, &ret);
  13289. -
  13290. -@@ -176,9 +173,12 @@ int brcmf_sdiod_intr_register(struct brc
  13291. -
  13292. - int brcmf_sdiod_intr_unregister(struct brcmf_sdio_dev *sdiodev)
  13293. - {
  13294. -+ struct brcmfmac_sdio_platform_data *pdata;
  13295. -+
  13296. - brcmf_dbg(SDIO, "Entering\n");
  13297. -
  13298. -- if ((sdiodev->pdata) && (sdiodev->pdata->oob_irq_supported)) {
  13299. -+ pdata = sdiodev->pdata;
  13300. -+ if ((pdata) && (pdata->oob_irq_supported)) {
  13301. - sdio_claim_host(sdiodev->func[1]);
  13302. - brcmf_sdiod_regwb(sdiodev, SDIO_CCCR_BRCM_SEPINT, 0, NULL);
  13303. - brcmf_sdiod_regwb(sdiodev, SDIO_CCCR_IENx, 0, NULL);
  13304. -@@ -187,11 +187,10 @@ int brcmf_sdiod_intr_unregister(struct b
  13305. - if (sdiodev->oob_irq_requested) {
  13306. - sdiodev->oob_irq_requested = false;
  13307. - if (sdiodev->irq_wake) {
  13308. -- disable_irq_wake(sdiodev->pdata->oob_irq_nr);
  13309. -+ disable_irq_wake(pdata->oob_irq_nr);
  13310. - sdiodev->irq_wake = false;
  13311. - }
  13312. -- free_irq(sdiodev->pdata->oob_irq_nr,
  13313. -- &sdiodev->func[1]->dev);
  13314. -+ free_irq(pdata->oob_irq_nr, &sdiodev->func[1]->dev);
  13315. - sdiodev->irq_en = false;
  13316. - }
  13317. - } else {
  13318. -@@ -1103,8 +1102,6 @@ static const struct sdio_device_id brcmf
  13319. - };
  13320. - MODULE_DEVICE_TABLE(sdio, brcmf_sdmmc_ids);
  13321. -
  13322. --static struct brcmfmac_sdio_platform_data *brcmfmac_sdio_pdata;
  13323. --
  13324. -
  13325. - static void brcmf_sdiod_acpi_set_power_manageable(struct device *dev,
  13326. - int val)
  13327. -@@ -1167,10 +1164,7 @@ static int brcmf_ops_sdio_probe(struct s
  13328. - dev_set_drvdata(&func->dev, bus_if);
  13329. - dev_set_drvdata(&sdiodev->func[1]->dev, bus_if);
  13330. - sdiodev->dev = &sdiodev->func[1]->dev;
  13331. -- sdiodev->pdata = brcmfmac_sdio_pdata;
  13332. --
  13333. -- if (!sdiodev->pdata)
  13334. -- brcmf_of_probe(sdiodev);
  13335. -+ sdiodev->pdata = brcmf_get_module_param(sdiodev->dev);
  13336. -
  13337. - #ifdef CONFIG_PM_SLEEP
  13338. - /* wowl can be supported when KEEP_POWER is true and (WAKE_SDIO_IRQ
  13339. -@@ -1296,7 +1290,7 @@ static const struct dev_pm_ops brcmf_sdi
  13340. - static struct sdio_driver brcmf_sdmmc_driver = {
  13341. - .probe = brcmf_ops_sdio_probe,
  13342. - .remove = brcmf_ops_sdio_remove,
  13343. -- .name = BRCMFMAC_SDIO_PDATA_NAME,
  13344. -+ .name = KBUILD_MODNAME,
  13345. - .id_table = brcmf_sdmmc_ids,
  13346. - .drv = {
  13347. - .owner = THIS_MODULE,
  13348. -@@ -1306,37 +1300,6 @@ static struct sdio_driver brcmf_sdmmc_dr
  13349. - },
  13350. - };
  13351. -
  13352. --static int __init brcmf_sdio_pd_probe(struct platform_device *pdev)
  13353. --{
  13354. -- brcmf_dbg(SDIO, "Enter\n");
  13355. --
  13356. -- brcmfmac_sdio_pdata = dev_get_platdata(&pdev->dev);
  13357. --
  13358. -- if (brcmfmac_sdio_pdata->power_on)
  13359. -- brcmfmac_sdio_pdata->power_on();
  13360. --
  13361. -- return 0;
  13362. --}
  13363. --
  13364. --static int brcmf_sdio_pd_remove(struct platform_device *pdev)
  13365. --{
  13366. -- brcmf_dbg(SDIO, "Enter\n");
  13367. --
  13368. -- if (brcmfmac_sdio_pdata->power_off)
  13369. -- brcmfmac_sdio_pdata->power_off();
  13370. --
  13371. -- sdio_unregister_driver(&brcmf_sdmmc_driver);
  13372. --
  13373. -- return 0;
  13374. --}
  13375. --
  13376. --static struct platform_driver brcmf_sdio_pd = {
  13377. -- .remove = brcmf_sdio_pd_remove,
  13378. -- .driver = {
  13379. -- .name = BRCMFMAC_SDIO_PDATA_NAME,
  13380. -- }
  13381. --};
  13382. --
  13383. - void brcmf_sdio_register(void)
  13384. - {
  13385. - int ret;
  13386. -@@ -1350,19 +1313,6 @@ void brcmf_sdio_exit(void)
  13387. - {
  13388. - brcmf_dbg(SDIO, "Enter\n");
  13389. -
  13390. -- if (brcmfmac_sdio_pdata)
  13391. -- platform_driver_unregister(&brcmf_sdio_pd);
  13392. -- else
  13393. -- sdio_unregister_driver(&brcmf_sdmmc_driver);
  13394. -+ sdio_unregister_driver(&brcmf_sdmmc_driver);
  13395. - }
  13396. -
  13397. --void __init brcmf_sdio_init(void)
  13398. --{
  13399. -- int ret;
  13400. --
  13401. -- brcmf_dbg(SDIO, "Enter\n");
  13402. --
  13403. -- ret = platform_driver_probe(&brcmf_sdio_pd, brcmf_sdio_pd_probe);
  13404. -- if (ret == -ENODEV)
  13405. -- brcmf_dbg(SDIO, "No platform data available.\n");
  13406. --}
  13407. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  13408. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  13409. -@@ -27,6 +27,7 @@
  13410. - #include "fwil_types.h"
  13411. - #include "tracepoint.h"
  13412. - #include "common.h"
  13413. -+#include "of.h"
  13414. -
  13415. - MODULE_AUTHOR("Broadcom Corporation");
  13416. - MODULE_DESCRIPTION("Broadcom 802.11 wireless LAN fullmac driver.");
  13417. -@@ -79,6 +80,7 @@ module_param_named(ignore_probe_fail, br
  13418. - MODULE_PARM_DESC(ignore_probe_fail, "always succeed probe for debugging");
  13419. - #endif
  13420. -
  13421. -+static struct brcmfmac_sdio_platform_data *brcmfmac_pdata;
  13422. - struct brcmf_mp_global_t brcmf_mp_global;
  13423. -
  13424. - int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
  13425. -@@ -231,6 +233,13 @@ static void brcmf_mp_attach(void)
  13426. - BRCMF_FW_ALTPATH_LEN);
  13427. - }
  13428. -
  13429. -+struct brcmfmac_sdio_platform_data *brcmf_get_module_param(struct device *dev)
  13430. -+{
  13431. -+ if (!brcmfmac_pdata)
  13432. -+ brcmf_of_probe(dev, &brcmfmac_pdata);
  13433. -+ return brcmfmac_pdata;
  13434. -+}
  13435. -+
  13436. - int brcmf_mp_device_attach(struct brcmf_pub *drvr)
  13437. - {
  13438. - drvr->settings = kzalloc(sizeof(*drvr->settings), GFP_ATOMIC);
  13439. -@@ -253,6 +262,35 @@ void brcmf_mp_device_detach(struct brcmf
  13440. - kfree(drvr->settings);
  13441. - }
  13442. -
  13443. -+static int __init brcmf_common_pd_probe(struct platform_device *pdev)
  13444. -+{
  13445. -+ brcmf_dbg(INFO, "Enter\n");
  13446. -+
  13447. -+ brcmfmac_pdata = dev_get_platdata(&pdev->dev);
  13448. -+
  13449. -+ if (brcmfmac_pdata->power_on)
  13450. -+ brcmfmac_pdata->power_on();
  13451. -+
  13452. -+ return 0;
  13453. -+}
  13454. -+
  13455. -+static int brcmf_common_pd_remove(struct platform_device *pdev)
  13456. -+{
  13457. -+ brcmf_dbg(INFO, "Enter\n");
  13458. -+
  13459. -+ if (brcmfmac_pdata->power_off)
  13460. -+ brcmfmac_pdata->power_off();
  13461. -+
  13462. -+ return 0;
  13463. -+}
  13464. -+
  13465. -+static struct platform_driver brcmf_pd = {
  13466. -+ .remove = brcmf_common_pd_remove,
  13467. -+ .driver = {
  13468. -+ .name = BRCMFMAC_SDIO_PDATA_NAME,
  13469. -+ }
  13470. -+};
  13471. -+
  13472. - static int __init brcmfmac_module_init(void)
  13473. - {
  13474. - int err;
  13475. -@@ -260,16 +298,21 @@ static int __init brcmfmac_module_init(v
  13476. - /* Initialize debug system first */
  13477. - brcmf_debugfs_init();
  13478. -
  13479. --#ifdef CPTCFG_BRCMFMAC_SDIO
  13480. -- brcmf_sdio_init();
  13481. --#endif
  13482. -+ /* Get the platform data (if available) for our devices */
  13483. -+ err = platform_driver_probe(&brcmf_pd, brcmf_common_pd_probe);
  13484. -+ if (err == -ENODEV)
  13485. -+ brcmf_dbg(INFO, "No platform data available.\n");
  13486. -+
  13487. - /* Initialize global module paramaters */
  13488. - brcmf_mp_attach();
  13489. -
  13490. - /* Continue the initialization by registering the different busses */
  13491. - err = brcmf_core_init();
  13492. -- if (err)
  13493. -+ if (err) {
  13494. - brcmf_debugfs_exit();
  13495. -+ if (brcmfmac_pdata)
  13496. -+ platform_driver_unregister(&brcmf_pd);
  13497. -+ }
  13498. -
  13499. - return err;
  13500. - }
  13501. -@@ -277,6 +320,8 @@ static int __init brcmfmac_module_init(v
  13502. - static void __exit brcmfmac_module_exit(void)
  13503. - {
  13504. - brcmf_core_exit();
  13505. -+ if (brcmfmac_pdata)
  13506. -+ platform_driver_unregister(&brcmf_pd);
  13507. - brcmf_debugfs_exit();
  13508. - }
  13509. -
  13510. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
  13511. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
  13512. -@@ -15,6 +15,8 @@
  13513. - #ifndef BRCMFMAC_COMMON_H
  13514. - #define BRCMFMAC_COMMON_H
  13515. -
  13516. -+#include <linux/platform_device.h>
  13517. -+#include <linux/platform_data/brcmfmac-sdio.h>
  13518. - #include "fwil_types.h"
  13519. -
  13520. - extern const u8 ALLFFMAC[ETH_ALEN];
  13521. -@@ -89,6 +91,7 @@ struct brcmf_mp_device {
  13522. - struct cc_translate *country_codes;
  13523. - };
  13524. -
  13525. -+struct brcmfmac_sdio_platform_data *brcmf_get_module_param(struct device *dev);
  13526. - int brcmf_mp_device_attach(struct brcmf_pub *drvr);
  13527. - void brcmf_mp_device_detach(struct brcmf_pub *drvr);
  13528. - #ifdef DEBUG
  13529. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
  13530. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
  13531. -@@ -16,17 +16,16 @@
  13532. - #include <linux/init.h>
  13533. - #include <linux/of.h>
  13534. - #include <linux/of_irq.h>
  13535. --#include <linux/mmc/card.h>
  13536. --#include <linux/platform_data/brcmfmac-sdio.h>
  13537. --#include <linux/mmc/sdio_func.h>
  13538. -
  13539. - #include <defs.h>
  13540. - #include "debug.h"
  13541. --#include "sdio.h"
  13542. -+#include "core.h"
  13543. -+#include "common.h"
  13544. -+#include "of.h"
  13545. -
  13546. --void brcmf_of_probe(struct brcmf_sdio_dev *sdiodev)
  13547. -+void
  13548. -+brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_platform_data **sdio)
  13549. - {
  13550. -- struct device *dev = sdiodev->dev;
  13551. - struct device_node *np = dev->of_node;
  13552. - int irq;
  13553. - u32 irqf;
  13554. -@@ -35,12 +34,12 @@ void brcmf_of_probe(struct brcmf_sdio_de
  13555. - if (!np || !of_device_is_compatible(np, "brcm,bcm4329-fmac"))
  13556. - return;
  13557. -
  13558. -- sdiodev->pdata = devm_kzalloc(dev, sizeof(*sdiodev->pdata), GFP_KERNEL);
  13559. -- if (!sdiodev->pdata)
  13560. -+ *sdio = devm_kzalloc(dev, sizeof(*sdio), GFP_KERNEL);
  13561. -+ if (!(*sdio))
  13562. - return;
  13563. -
  13564. - if (of_property_read_u32(np, "brcm,drive-strength", &val) == 0)
  13565. -- sdiodev->pdata->drive_strength = val;
  13566. -+ (*sdio)->drive_strength = val;
  13567. -
  13568. - /* make sure there are interrupts defined in the node */
  13569. - if (!of_find_property(np, "interrupts", NULL))
  13570. -@@ -53,7 +52,7 @@ void brcmf_of_probe(struct brcmf_sdio_de
  13571. - }
  13572. - irqf = irqd_get_trigger_type(irq_get_irq_data(irq));
  13573. -
  13574. -- sdiodev->pdata->oob_irq_supported = true;
  13575. -- sdiodev->pdata->oob_irq_nr = irq;
  13576. -- sdiodev->pdata->oob_irq_flags = irqf;
  13577. -+ (*sdio)->oob_irq_supported = true;
  13578. -+ (*sdio)->oob_irq_nr = irq;
  13579. -+ (*sdio)->oob_irq_flags = irqf;
  13580. - }
  13581. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.h
  13582. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.h
  13583. -@@ -14,9 +14,11 @@
  13584. - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  13585. - */
  13586. - #ifdef CONFIG_OF
  13587. --void brcmf_of_probe(struct brcmf_sdio_dev *sdiodev);
  13588. -+void
  13589. -+brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_platform_data **sdio);
  13590. - #else
  13591. --static void brcmf_of_probe(struct brcmf_sdio_dev *sdiodev)
  13592. -+static void brcmf_of_probe(struct device *dev,
  13593. -+ struct brcmfmac_sdio_platform_data **sdio)
  13594. - {
  13595. - }
  13596. - #endif /* CONFIG_OF */
  13597. diff --git a/package/kernel/mac80211/patches/344-0016-brcmfmac-keep-ARP-and-ND-offload-enabled-during-WOWL.patch b/package/kernel/mac80211/patches/344-0016-brcmfmac-keep-ARP-and-ND-offload-enabled-during-WOWL.patch
  13598. deleted file mode 100644
  13599. index 4e789cf..0000000
  13600. --- a/package/kernel/mac80211/patches/344-0016-brcmfmac-keep-ARP-and-ND-offload-enabled-during-WOWL.patch
  13601. +++ /dev/null
  13602. @@ -1,69 +0,0 @@
  13603. -From: Hante Meuleman <meuleman@broadcom.com>
  13604. -Date: Wed, 17 Feb 2016 11:27:05 +0100
  13605. -Subject: [PATCH] brcmfmac: keep ARP and ND offload enabled during WOWL
  13606. -
  13607. -Currently ARP and ND (IPv6 Neigbor Discovery) offload get disabled
  13608. -on entering suspend. However when firmwares support the wowl_cap
  13609. -iovar then these offload routines can be kept enabled as they
  13610. -will work during WOWL as well.
  13611. -
  13612. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  13613. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  13614. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  13615. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  13616. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  13617. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13618. ----
  13619. -
  13620. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  13621. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  13622. -@@ -3556,7 +3556,8 @@ static s32 brcmf_cfg80211_resume(struct
  13623. - brcmf_report_wowl_wakeind(wiphy, ifp);
  13624. - brcmf_fil_iovar_int_set(ifp, "wowl_clear", 0);
  13625. - brcmf_config_wowl_pattern(ifp, "clr", NULL, 0, NULL, 0);
  13626. -- brcmf_configure_arp_nd_offload(ifp, true);
  13627. -+ if (!brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL_ARP_ND))
  13628. -+ brcmf_configure_arp_nd_offload(ifp, true);
  13629. - brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM,
  13630. - cfg->wowl.pre_pmmode);
  13631. - cfg->wowl.active = false;
  13632. -@@ -3580,7 +3581,8 @@ static void brcmf_configure_wowl(struct
  13633. -
  13634. - brcmf_dbg(TRACE, "Suspend, wowl config.\n");
  13635. -
  13636. -- brcmf_configure_arp_nd_offload(ifp, false);
  13637. -+ if (!brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL_ARP_ND))
  13638. -+ brcmf_configure_arp_nd_offload(ifp, false);
  13639. - brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_PM, &cfg->wowl.pre_pmmode);
  13640. - brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM, PM_MAX);
  13641. -
  13642. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
  13643. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
  13644. -@@ -147,6 +147,7 @@ void brcmf_feat_attach(struct brcmf_pub
  13645. - if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL)) {
  13646. - err = brcmf_fil_iovar_int_get(ifp, "wowl_cap", &wowl_cap);
  13647. - if (!err) {
  13648. -+ ifp->drvr->feat_flags |= BIT(BRCMF_FEAT_WOWL_ARP_ND);
  13649. - if (wowl_cap & BRCMF_WOWL_PFN_FOUND)
  13650. - ifp->drvr->feat_flags |=
  13651. - BIT(BRCMF_FEAT_WOWL_ND);
  13652. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h
  13653. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h
  13654. -@@ -29,6 +29,7 @@
  13655. - * SCAN_RANDOM_MAC: Random MAC during (net detect) scheduled scan.
  13656. - * WOWL_ND: WOWL net detect (PNO)
  13657. - * WOWL_GTK: (WOWL) GTK rekeying offload
  13658. -+ * WOWL_ARP_ND: ARP and Neighbor Discovery offload support during WOWL.
  13659. - */
  13660. - #define BRCMF_FEAT_LIST \
  13661. - BRCMF_FEAT_DEF(MBSS) \
  13662. -@@ -40,7 +41,8 @@
  13663. - BRCMF_FEAT_DEF(TDLS) \
  13664. - BRCMF_FEAT_DEF(SCAN_RANDOM_MAC) \
  13665. - BRCMF_FEAT_DEF(WOWL_ND) \
  13666. -- BRCMF_FEAT_DEF(WOWL_GTK)
  13667. -+ BRCMF_FEAT_DEF(WOWL_GTK) \
  13668. -+ BRCMF_FEAT_DEF(WOWL_ARP_ND)
  13669. -
  13670. - /*
  13671. - * Quirks:
  13672. diff --git a/package/kernel/mac80211/patches/344-0017-brcmfmac-switch-to-new-platform-data.patch b/package/kernel/mac80211/patches/344-0017-brcmfmac-switch-to-new-platform-data.patch
  13673. deleted file mode 100644
  13674. index 37b6855..0000000
  13675. --- a/package/kernel/mac80211/patches/344-0017-brcmfmac-switch-to-new-platform-data.patch
  13676. +++ /dev/null
  13677. @@ -1,734 +0,0 @@
  13678. -From: Hante Meuleman <meuleman@broadcom.com>
  13679. -Date: Wed, 17 Feb 2016 11:27:07 +0100
  13680. -Subject: [PATCH] brcmfmac: switch to new platform data
  13681. -
  13682. -Platform data is only available for sdio. With this patch a new
  13683. -platform data structure is being used which allows for platform
  13684. -data for any device and configurable per device. This patch only
  13685. -switches to the new structure and adds support for SDIO devices.
  13686. -
  13687. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  13688. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  13689. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  13690. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  13691. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  13692. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13693. ----
  13694. -
  13695. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  13696. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  13697. -@@ -103,7 +103,7 @@ static void brcmf_sdiod_dummy_irqhandler
  13698. -
  13699. - int brcmf_sdiod_intr_register(struct brcmf_sdio_dev *sdiodev)
  13700. - {
  13701. -- struct brcmfmac_sdio_platform_data *pdata;
  13702. -+ struct brcmfmac_sdio_pd *pdata;
  13703. - int ret = 0;
  13704. - u8 data;
  13705. - u32 addr, gpiocontrol;
  13706. -@@ -173,7 +173,7 @@ int brcmf_sdiod_intr_register(struct brc
  13707. -
  13708. - int brcmf_sdiod_intr_unregister(struct brcmf_sdio_dev *sdiodev)
  13709. - {
  13710. -- struct brcmfmac_sdio_platform_data *pdata;
  13711. -+ struct brcmfmac_sdio_pd *pdata;
  13712. -
  13713. - brcmf_dbg(SDIO, "Entering\n");
  13714. -
  13715. -@@ -1164,17 +1164,6 @@ static int brcmf_ops_sdio_probe(struct s
  13716. - dev_set_drvdata(&func->dev, bus_if);
  13717. - dev_set_drvdata(&sdiodev->func[1]->dev, bus_if);
  13718. - sdiodev->dev = &sdiodev->func[1]->dev;
  13719. -- sdiodev->pdata = brcmf_get_module_param(sdiodev->dev);
  13720. --
  13721. --#ifdef CONFIG_PM_SLEEP
  13722. -- /* wowl can be supported when KEEP_POWER is true and (WAKE_SDIO_IRQ
  13723. -- * is true or when platform data OOB irq is true).
  13724. -- */
  13725. -- if ((sdio_get_host_pm_caps(sdiodev->func[1]) & MMC_PM_KEEP_POWER) &&
  13726. -- ((sdio_get_host_pm_caps(sdiodev->func[1]) & MMC_PM_WAKE_SDIO_IRQ) ||
  13727. -- (sdiodev->pdata && sdiodev->pdata->oob_irq_supported)))
  13728. -- bus_if->wowl_supported = true;
  13729. --#endif
  13730. -
  13731. - brcmf_sdiod_change_state(sdiodev, BRCMF_SDIOD_DOWN);
  13732. -
  13733. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  13734. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  13735. -@@ -6459,8 +6459,8 @@ int brcmf_cfg80211_wait_vif_event(struct
  13736. - static s32 brcmf_translate_country_code(struct brcmf_pub *drvr, char alpha2[2],
  13737. - struct brcmf_fil_country_le *ccreq)
  13738. - {
  13739. -- struct cc_translate *country_codes;
  13740. -- struct cc_entry *cc;
  13741. -+ struct brcmfmac_pd_cc *country_codes;
  13742. -+ struct brcmfmac_pd_cc_entry *cc;
  13743. - s32 found_index;
  13744. - int i;
  13745. -
  13746. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  13747. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  13748. -@@ -80,7 +80,7 @@ module_param_named(ignore_probe_fail, br
  13749. - MODULE_PARM_DESC(ignore_probe_fail, "always succeed probe for debugging");
  13750. - #endif
  13751. -
  13752. --static struct brcmfmac_sdio_platform_data *brcmfmac_pdata;
  13753. -+static struct brcmfmac_platform_data *brcmfmac_pdata;
  13754. - struct brcmf_mp_global_t brcmf_mp_global;
  13755. -
  13756. - int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
  13757. -@@ -229,15 +229,46 @@ void __brcmf_dbg(u32 level, const char *
  13758. -
  13759. - static void brcmf_mp_attach(void)
  13760. - {
  13761. -+ /* If module param firmware path is set then this will always be used,
  13762. -+ * if not set then if available use the platform data version. To make
  13763. -+ * sure it gets initialized at all, always copy the module param version
  13764. -+ */
  13765. - strlcpy(brcmf_mp_global.firmware_path, brcmf_firmware_path,
  13766. - BRCMF_FW_ALTPATH_LEN);
  13767. -+ if ((brcmfmac_pdata) && (brcmfmac_pdata->fw_alternative_path) &&
  13768. -+ (brcmf_mp_global.firmware_path[0] == '\0')) {
  13769. -+ strlcpy(brcmf_mp_global.firmware_path,
  13770. -+ brcmfmac_pdata->fw_alternative_path,
  13771. -+ BRCMF_FW_ALTPATH_LEN);
  13772. -+ }
  13773. - }
  13774. -
  13775. --struct brcmfmac_sdio_platform_data *brcmf_get_module_param(struct device *dev)
  13776. --{
  13777. -- if (!brcmfmac_pdata)
  13778. -- brcmf_of_probe(dev, &brcmfmac_pdata);
  13779. -- return brcmfmac_pdata;
  13780. -+struct brcmfmac_sdio_pd *brcmf_get_module_param(struct device *dev,
  13781. -+ enum brcmf_bus_type bus_type,
  13782. -+ u32 chip, u32 chiprev)
  13783. -+{
  13784. -+ struct brcmfmac_sdio_pd *pdata;
  13785. -+ struct brcmfmac_pd_device *device_pd;
  13786. -+ int i;
  13787. -+
  13788. -+ if (brcmfmac_pdata) {
  13789. -+ for (i = 0; i < brcmfmac_pdata->device_count; i++) {
  13790. -+ device_pd = &brcmfmac_pdata->devices[i];
  13791. -+ if ((device_pd->bus_type == bus_type) &&
  13792. -+ (device_pd->id == chip) &&
  13793. -+ ((device_pd->rev == chiprev) ||
  13794. -+ (device_pd->rev == -1))) {
  13795. -+ brcmf_dbg(INFO, "Platform data for device found\n");
  13796. -+ if (device_pd->bus_type == BRCMF_BUSTYPE_SDIO)
  13797. -+ return &device_pd->bus.sdio;
  13798. -+ break;
  13799. -+ }
  13800. -+ }
  13801. -+ }
  13802. -+ pdata = NULL;
  13803. -+ brcmf_of_probe(dev, &pdata);
  13804. -+
  13805. -+ return pdata;
  13806. - }
  13807. -
  13808. - int brcmf_mp_device_attach(struct brcmf_pub *drvr)
  13809. -@@ -287,7 +318,7 @@ static int brcmf_common_pd_remove(struct
  13810. - static struct platform_driver brcmf_pd = {
  13811. - .remove = brcmf_common_pd_remove,
  13812. - .driver = {
  13813. -- .name = BRCMFMAC_SDIO_PDATA_NAME,
  13814. -+ .name = BRCMFMAC_PDATA_NAME,
  13815. - }
  13816. - };
  13817. -
  13818. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
  13819. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
  13820. -@@ -16,7 +16,7 @@
  13821. - #define BRCMFMAC_COMMON_H
  13822. -
  13823. - #include <linux/platform_device.h>
  13824. --#include <linux/platform_data/brcmfmac-sdio.h>
  13825. -+#include <linux/platform_data/brcmfmac.h>
  13826. - #include "fwil_types.h"
  13827. -
  13828. - extern const u8 ALLFFMAC[ETH_ALEN];
  13829. -@@ -43,33 +43,6 @@ struct brcmf_mp_global_t {
  13830. - extern struct brcmf_mp_global_t brcmf_mp_global;
  13831. -
  13832. - /**
  13833. -- * struct cc_entry - Struct for translating user space country code (iso3166) to
  13834. -- * firmware country code and revision.
  13835. -- *
  13836. -- * @iso3166: iso3166 alpha 2 country code string.
  13837. -- * @cc: firmware country code string.
  13838. -- * @rev: firmware country code revision.
  13839. -- */
  13840. --struct cc_entry {
  13841. -- char iso3166[BRCMF_COUNTRY_BUF_SZ];
  13842. -- char cc[BRCMF_COUNTRY_BUF_SZ];
  13843. -- s32 rev;
  13844. --};
  13845. --
  13846. --/**
  13847. -- * struct cc_translate - Struct for translating country codes as set by user
  13848. -- * space to a country code and rev which can be used by
  13849. -- * firmware.
  13850. -- *
  13851. -- * @table_size: number of entries in table (> 0)
  13852. -- * @table: dynamic array of 1 or more elements with translation information.
  13853. -- */
  13854. --struct cc_translate {
  13855. -- int table_size;
  13856. -- struct cc_entry table[0];
  13857. --};
  13858. --
  13859. --/**
  13860. - * struct brcmf_mp_device - Device module paramaters.
  13861. - *
  13862. - * @sdiod_txglomsz: SDIO txglom size.
  13863. -@@ -88,10 +61,12 @@ struct brcmf_mp_device {
  13864. - int fcmode;
  13865. - bool roamoff;
  13866. - bool ignore_probe_fail;
  13867. -- struct cc_translate *country_codes;
  13868. -+ struct brcmfmac_pd_cc *country_codes;
  13869. - };
  13870. -
  13871. --struct brcmfmac_sdio_platform_data *brcmf_get_module_param(struct device *dev);
  13872. -+struct brcmfmac_sdio_pd *brcmf_get_module_param(struct device *dev,
  13873. -+ enum brcmf_bus_type bus_type,
  13874. -+ u32 chip, u32 chiprev);
  13875. - int brcmf_mp_device_attach(struct brcmf_pub *drvr);
  13876. - void brcmf_mp_device_detach(struct brcmf_pub *drvr);
  13877. - #ifdef DEBUG
  13878. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
  13879. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
  13880. -@@ -23,8 +23,7 @@
  13881. - #include "common.h"
  13882. - #include "of.h"
  13883. -
  13884. --void
  13885. --brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_platform_data **sdio)
  13886. -+void brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_pd **sdio)
  13887. - {
  13888. - struct device_node *np = dev->of_node;
  13889. - int irq;
  13890. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.h
  13891. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.h
  13892. -@@ -15,10 +15,9 @@
  13893. - */
  13894. - #ifdef CONFIG_OF
  13895. - void
  13896. --brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_platform_data **sdio);
  13897. -+brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_pd **sdio);
  13898. - #else
  13899. --static void brcmf_of_probe(struct device *dev,
  13900. -- struct brcmfmac_sdio_platform_data **sdio)
  13901. -+static void brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_pd **sdio)
  13902. - {
  13903. - }
  13904. - #endif /* CONFIG_OF */
  13905. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  13906. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  13907. -@@ -33,8 +33,6 @@
  13908. - #include <linux/bcma/bcma.h>
  13909. - #include <linux/debugfs.h>
  13910. - #include <linux/vmalloc.h>
  13911. --#include <linux/platform_data/brcmfmac-sdio.h>
  13912. --#include <linux/moduleparam.h>
  13913. - #include <asm/unaligned.h>
  13914. - #include <defs.h>
  13915. - #include <brcmu_wifi.h>
  13916. -@@ -44,6 +42,8 @@
  13917. - #include "sdio.h"
  13918. - #include "chip.h"
  13919. - #include "firmware.h"
  13920. -+#include "core.h"
  13921. -+#include "common.h"
  13922. -
  13923. - #define DCMD_RESP_TIMEOUT msecs_to_jiffies(2500)
  13924. - #define CTL_DONE_TIMEOUT msecs_to_jiffies(2500)
  13925. -@@ -3775,26 +3775,28 @@ static const struct brcmf_buscore_ops br
  13926. - static bool
  13927. - brcmf_sdio_probe_attach(struct brcmf_sdio *bus)
  13928. - {
  13929. -+ struct brcmf_sdio_dev *sdiodev;
  13930. - u8 clkctl = 0;
  13931. - int err = 0;
  13932. - int reg_addr;
  13933. - u32 reg_val;
  13934. - u32 drivestrength;
  13935. -
  13936. -- sdio_claim_host(bus->sdiodev->func[1]);
  13937. -+ sdiodev = bus->sdiodev;
  13938. -+ sdio_claim_host(sdiodev->func[1]);
  13939. -
  13940. - pr_debug("F1 signature read @0x18000000=0x%4x\n",
  13941. -- brcmf_sdiod_regrl(bus->sdiodev, SI_ENUM_BASE, NULL));
  13942. -+ brcmf_sdiod_regrl(sdiodev, SI_ENUM_BASE, NULL));
  13943. -
  13944. - /*
  13945. - * Force PLL off until brcmf_chip_attach()
  13946. - * programs PLL control regs
  13947. - */
  13948. -
  13949. -- brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR,
  13950. -+ brcmf_sdiod_regwb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR,
  13951. - BRCMF_INIT_CLKCTL1, &err);
  13952. - if (!err)
  13953. -- clkctl = brcmf_sdiod_regrb(bus->sdiodev,
  13954. -+ clkctl = brcmf_sdiod_regrb(sdiodev,
  13955. - SBSDIO_FUNC1_CHIPCLKCSR, &err);
  13956. -
  13957. - if (err || ((clkctl & ~SBSDIO_AVBITS) != BRCMF_INIT_CLKCTL1)) {
  13958. -@@ -3803,50 +3805,77 @@ brcmf_sdio_probe_attach(struct brcmf_sdi
  13959. - goto fail;
  13960. - }
  13961. -
  13962. -- bus->ci = brcmf_chip_attach(bus->sdiodev, &brcmf_sdio_buscore_ops);
  13963. -+ bus->ci = brcmf_chip_attach(sdiodev, &brcmf_sdio_buscore_ops);
  13964. - if (IS_ERR(bus->ci)) {
  13965. - brcmf_err("brcmf_chip_attach failed!\n");
  13966. - bus->ci = NULL;
  13967. - goto fail;
  13968. - }
  13969. -+ sdiodev->pdata = brcmf_get_module_param(sdiodev->dev,
  13970. -+ BRCMF_BUSTYPE_SDIO,
  13971. -+ bus->ci->chip,
  13972. -+ bus->ci->chiprev);
  13973. -+ /* platform specific configuration:
  13974. -+ * alignments must be at least 4 bytes for ADMA
  13975. -+ */
  13976. -+ bus->head_align = ALIGNMENT;
  13977. -+ bus->sgentry_align = ALIGNMENT;
  13978. -+ if (sdiodev->pdata) {
  13979. -+ if (sdiodev->pdata->sd_head_align > ALIGNMENT)
  13980. -+ bus->head_align = sdiodev->pdata->sd_head_align;
  13981. -+ if (sdiodev->pdata->sd_sgentry_align > ALIGNMENT)
  13982. -+ bus->sgentry_align = sdiodev->pdata->sd_sgentry_align;
  13983. -+ }
  13984. -+ /* allocate scatter-gather table. sg support
  13985. -+ * will be disabled upon allocation failure.
  13986. -+ */
  13987. -+ brcmf_sdiod_sgtable_alloc(sdiodev);
  13988. -+
  13989. -+#ifdef CONFIG_PM_SLEEP
  13990. -+ /* wowl can be supported when KEEP_POWER is true and (WAKE_SDIO_IRQ
  13991. -+ * is true or when platform data OOB irq is true).
  13992. -+ */
  13993. -+ if ((sdio_get_host_pm_caps(sdiodev->func[1]) & MMC_PM_KEEP_POWER) &&
  13994. -+ ((sdio_get_host_pm_caps(sdiodev->func[1]) & MMC_PM_WAKE_SDIO_IRQ) ||
  13995. -+ (sdiodev->pdata && sdiodev->pdata->oob_irq_supported)))
  13996. -+ sdiodev->bus_if->wowl_supported = true;
  13997. -+#endif
  13998. -
  13999. - if (brcmf_sdio_kso_init(bus)) {
  14000. - brcmf_err("error enabling KSO\n");
  14001. - goto fail;
  14002. - }
  14003. -
  14004. -- if ((bus->sdiodev->pdata) && (bus->sdiodev->pdata->drive_strength))
  14005. -- drivestrength = bus->sdiodev->pdata->drive_strength;
  14006. -+ if ((sdiodev->pdata) && (sdiodev->pdata->drive_strength))
  14007. -+ drivestrength = sdiodev->pdata->drive_strength;
  14008. - else
  14009. - drivestrength = DEFAULT_SDIO_DRIVE_STRENGTH;
  14010. -- brcmf_sdio_drivestrengthinit(bus->sdiodev, bus->ci, drivestrength);
  14011. -+ brcmf_sdio_drivestrengthinit(sdiodev, bus->ci, drivestrength);
  14012. -
  14013. - /* Set card control so an SDIO card reset does a WLAN backplane reset */
  14014. -- reg_val = brcmf_sdiod_regrb(bus->sdiodev,
  14015. -- SDIO_CCCR_BRCM_CARDCTRL, &err);
  14016. -+ reg_val = brcmf_sdiod_regrb(sdiodev, SDIO_CCCR_BRCM_CARDCTRL, &err);
  14017. - if (err)
  14018. - goto fail;
  14019. -
  14020. - reg_val |= SDIO_CCCR_BRCM_CARDCTRL_WLANRESET;
  14021. -
  14022. -- brcmf_sdiod_regwb(bus->sdiodev,
  14023. -- SDIO_CCCR_BRCM_CARDCTRL, reg_val, &err);
  14024. -+ brcmf_sdiod_regwb(sdiodev, SDIO_CCCR_BRCM_CARDCTRL, reg_val, &err);
  14025. - if (err)
  14026. - goto fail;
  14027. -
  14028. - /* set PMUControl so a backplane reset does PMU state reload */
  14029. - reg_addr = CORE_CC_REG(brcmf_chip_get_pmu(bus->ci)->base, pmucontrol);
  14030. -- reg_val = brcmf_sdiod_regrl(bus->sdiodev, reg_addr, &err);
  14031. -+ reg_val = brcmf_sdiod_regrl(sdiodev, reg_addr, &err);
  14032. - if (err)
  14033. - goto fail;
  14034. -
  14035. - reg_val |= (BCMA_CC_PMU_CTL_RES_RELOAD << BCMA_CC_PMU_CTL_RES_SHIFT);
  14036. -
  14037. -- brcmf_sdiod_regwl(bus->sdiodev, reg_addr, reg_val, &err);
  14038. -+ brcmf_sdiod_regwl(sdiodev, reg_addr, reg_val, &err);
  14039. - if (err)
  14040. - goto fail;
  14041. -
  14042. -- sdio_release_host(bus->sdiodev->func[1]);
  14043. -+ sdio_release_host(sdiodev->func[1]);
  14044. -
  14045. - brcmu_pktq_init(&bus->txq, (PRIOMASK + 1), TXQLEN);
  14046. -
  14047. -@@ -3867,7 +3896,7 @@ brcmf_sdio_probe_attach(struct brcmf_sdi
  14048. - return true;
  14049. -
  14050. - fail:
  14051. -- sdio_release_host(bus->sdiodev->func[1]);
  14052. -+ sdio_release_host(sdiodev->func[1]);
  14053. - return false;
  14054. - }
  14055. -
  14056. -@@ -4045,18 +4074,6 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
  14057. - bus->txminmax = BRCMF_TXMINMAX;
  14058. - bus->tx_seq = SDPCM_SEQ_WRAP - 1;
  14059. -
  14060. -- /* platform specific configuration:
  14061. -- * alignments must be at least 4 bytes for ADMA
  14062. -- */
  14063. -- bus->head_align = ALIGNMENT;
  14064. -- bus->sgentry_align = ALIGNMENT;
  14065. -- if (sdiodev->pdata) {
  14066. -- if (sdiodev->pdata->sd_head_align > ALIGNMENT)
  14067. -- bus->head_align = sdiodev->pdata->sd_head_align;
  14068. -- if (sdiodev->pdata->sd_sgentry_align > ALIGNMENT)
  14069. -- bus->sgentry_align = sdiodev->pdata->sd_sgentry_align;
  14070. -- }
  14071. --
  14072. - /* single-threaded workqueue */
  14073. - wq = alloc_ordered_workqueue("brcmf_wq/%s", WQ_MEM_RECLAIM,
  14074. - dev_name(&sdiodev->func[1]->dev));
  14075. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
  14076. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
  14077. -@@ -184,7 +184,7 @@ struct brcmf_sdio_dev {
  14078. - struct brcmf_sdio *bus;
  14079. - struct device *dev;
  14080. - struct brcmf_bus *bus_if;
  14081. -- struct brcmfmac_sdio_platform_data *pdata;
  14082. -+ struct brcmfmac_sdio_pd *pdata;
  14083. - bool oob_irq_requested;
  14084. - bool irq_en; /* irq enable flags */
  14085. - spinlock_t irq_en_lock;
  14086. ---- a/include/linux/platform_data/brcmfmac-sdio.h
  14087. -+++ /dev/null
  14088. -@@ -1,135 +0,0 @@
  14089. --/*
  14090. -- * Copyright (c) 2013 Broadcom Corporation
  14091. -- *
  14092. -- * Permission to use, copy, modify, and/or distribute this software for any
  14093. -- * purpose with or without fee is hereby granted, provided that the above
  14094. -- * copyright notice and this permission notice appear in all copies.
  14095. -- *
  14096. -- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  14097. -- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  14098. -- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
  14099. -- * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  14100. -- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  14101. -- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  14102. -- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  14103. -- */
  14104. --
  14105. --#ifndef _LINUX_BRCMFMAC_PLATFORM_H
  14106. --#define _LINUX_BRCMFMAC_PLATFORM_H
  14107. --
  14108. --/*
  14109. -- * Platform specific driver functions and data. Through the platform specific
  14110. -- * device data functions can be provided to help the brcmfmac driver to
  14111. -- * operate with the device in combination with the used platform.
  14112. -- *
  14113. -- * Use the platform data in the following (similar) way:
  14114. -- *
  14115. -- *
  14116. --#include <brcmfmac_platform.h>
  14117. --
  14118. --
  14119. --static void brcmfmac_power_on(void)
  14120. --{
  14121. --}
  14122. --
  14123. --static void brcmfmac_power_off(void)
  14124. --{
  14125. --}
  14126. --
  14127. --static void brcmfmac_reset(void)
  14128. --{
  14129. --}
  14130. --
  14131. --static struct brcmfmac_sdio_platform_data brcmfmac_sdio_pdata = {
  14132. -- .power_on = brcmfmac_power_on,
  14133. -- .power_off = brcmfmac_power_off,
  14134. -- .reset = brcmfmac_reset
  14135. --};
  14136. --
  14137. --static struct platform_device brcmfmac_device = {
  14138. -- .name = BRCMFMAC_SDIO_PDATA_NAME,
  14139. -- .id = PLATFORM_DEVID_NONE,
  14140. -- .dev.platform_data = &brcmfmac_sdio_pdata
  14141. --};
  14142. --
  14143. --void __init brcmfmac_init_pdata(void)
  14144. --{
  14145. -- brcmfmac_sdio_pdata.oob_irq_supported = true;
  14146. -- brcmfmac_sdio_pdata.oob_irq_nr = gpio_to_irq(GPIO_BRCMF_SDIO_OOB);
  14147. -- brcmfmac_sdio_pdata.oob_irq_flags = IORESOURCE_IRQ |
  14148. -- IORESOURCE_IRQ_HIGHLEVEL;
  14149. -- platform_device_register(&brcmfmac_device);
  14150. --}
  14151. -- *
  14152. -- *
  14153. -- * Note: the brcmfmac can be loaded as module or be statically built-in into
  14154. -- * the kernel. If built-in then do note that it uses module_init (and
  14155. -- * module_exit) routines which equal device_initcall. So if you intend to
  14156. -- * create a module with the platform specific data for the brcmfmac and have
  14157. -- * it built-in to the kernel then use a higher initcall then device_initcall
  14158. -- * (see init.h). If this is not done then brcmfmac will load without problems
  14159. -- * but will not pickup the platform data.
  14160. -- *
  14161. -- * When the driver does not "detect" platform driver data then it will continue
  14162. -- * without reporting anything and just assume there is no data needed. Which is
  14163. -- * probably true for most platforms.
  14164. -- *
  14165. -- * Explanation of the platform_data fields:
  14166. -- *
  14167. -- * drive_strength: is the preferred drive_strength to be used for the SDIO
  14168. -- * pins. If 0 then a default value will be used. This is the target drive
  14169. -- * strength, the exact drive strength which will be used depends on the
  14170. -- * capabilities of the device.
  14171. -- *
  14172. -- * oob_irq_supported: does the board have support for OOB interrupts. SDIO
  14173. -- * in-band interrupts are relatively slow and for having less overhead on
  14174. -- * interrupt processing an out of band interrupt can be used. If the HW
  14175. -- * supports this then enable this by setting this field to true and configure
  14176. -- * the oob related fields.
  14177. -- *
  14178. -- * oob_irq_nr, oob_irq_flags: the OOB interrupt information. The values are
  14179. -- * used for registering the irq using request_irq function.
  14180. -- *
  14181. -- * broken_sg_support: flag for broken sg list support of SDIO host controller.
  14182. -- * Set this to true if the SDIO host controller has higher align requirement
  14183. -- * than 32 bytes for each scatterlist item.
  14184. -- *
  14185. -- * sd_head_align: alignment requirement for start of data buffer
  14186. -- *
  14187. -- * sd_sgentry_align: length alignment requirement for each sg entry
  14188. -- *
  14189. -- * power_on: This function is called by the brcmfmac when the module gets
  14190. -- * loaded. This can be particularly useful for low power devices. The platform
  14191. -- * spcific routine may for example decide to power up the complete device.
  14192. -- * If there is no use-case for this function then provide NULL.
  14193. -- *
  14194. -- * power_off: This function is called by the brcmfmac when the module gets
  14195. -- * unloaded. At this point the device can be powered down or otherwise be reset.
  14196. -- * So if an actual power_off is not supported but reset is then reset the device
  14197. -- * when this function gets called. This can be particularly useful for low power
  14198. -- * devices. If there is no use-case for this function (either power-down or
  14199. -- * reset) then provide NULL.
  14200. -- *
  14201. -- * reset: This function can get called if the device communication broke down.
  14202. -- * This functionality is particularly useful in case of SDIO type devices. It is
  14203. -- * possible to reset a dongle via sdio data interface, but it requires that
  14204. -- * this is fully functional. This function is chip/module specific and this
  14205. -- * function should return only after the complete reset has completed.
  14206. -- */
  14207. --
  14208. --#define BRCMFMAC_SDIO_PDATA_NAME "brcmfmac_sdio"
  14209. --
  14210. --struct brcmfmac_sdio_platform_data {
  14211. -- unsigned int drive_strength;
  14212. -- bool oob_irq_supported;
  14213. -- unsigned int oob_irq_nr;
  14214. -- unsigned long oob_irq_flags;
  14215. -- bool broken_sg_support;
  14216. -- unsigned short sd_head_align;
  14217. -- unsigned short sd_sgentry_align;
  14218. -- void (*power_on)(void);
  14219. -- void (*power_off)(void);
  14220. -- void (*reset)(void);
  14221. --};
  14222. --
  14223. --#endif /* _LINUX_BRCMFMAC_PLATFORM_H */
  14224. ---- /dev/null
  14225. -+++ b/include/linux/platform_data/brcmfmac.h
  14226. -@@ -0,0 +1,185 @@
  14227. -+/*
  14228. -+ * Copyright (c) 201 Broadcom Corporation
  14229. -+ *
  14230. -+ * Permission to use, copy, modify, and/or distribute this software for any
  14231. -+ * purpose with or without fee is hereby granted, provided that the above
  14232. -+ * copyright notice and this permission notice appear in all copies.
  14233. -+ *
  14234. -+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  14235. -+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  14236. -+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
  14237. -+ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  14238. -+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  14239. -+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  14240. -+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  14241. -+ */
  14242. -+
  14243. -+#ifndef _LINUX_BRCMFMAC_PLATFORM_H
  14244. -+#define _LINUX_BRCMFMAC_PLATFORM_H
  14245. -+
  14246. -+
  14247. -+#define BRCMFMAC_PDATA_NAME "brcmfmac"
  14248. -+
  14249. -+#define BRCMFMAC_COUNTRY_BUF_SZ 4
  14250. -+
  14251. -+
  14252. -+/*
  14253. -+ * Platform specific driver functions and data. Through the platform specific
  14254. -+ * device data functions and data can be provided to help the brcmfmac driver to
  14255. -+ * operate with the device in combination with the used platform.
  14256. -+ */
  14257. -+
  14258. -+
  14259. -+/**
  14260. -+ * Note: the brcmfmac can be loaded as module or be statically built-in into
  14261. -+ * the kernel. If built-in then do note that it uses module_init (and
  14262. -+ * module_exit) routines which equal device_initcall. So if you intend to
  14263. -+ * create a module with the platform specific data for the brcmfmac and have
  14264. -+ * it built-in to the kernel then use a higher initcall then device_initcall
  14265. -+ * (see init.h). If this is not done then brcmfmac will load without problems
  14266. -+ * but will not pickup the platform data.
  14267. -+ *
  14268. -+ * When the driver does not "detect" platform driver data then it will continue
  14269. -+ * without reporting anything and just assume there is no data needed. Which is
  14270. -+ * probably true for most platforms.
  14271. -+ */
  14272. -+
  14273. -+/**
  14274. -+ * enum brcmf_bus_type - Bus type identifier. Currently SDIO, USB and PCIE are
  14275. -+ * supported.
  14276. -+ */
  14277. -+enum brcmf_bus_type {
  14278. -+ BRCMF_BUSTYPE_SDIO,
  14279. -+ BRCMF_BUSTYPE_USB,
  14280. -+ BRCMF_BUSTYPE_PCIE
  14281. -+};
  14282. -+
  14283. -+
  14284. -+/**
  14285. -+ * struct brcmfmac_sdio_pd - SDIO Device specific platform data.
  14286. -+ *
  14287. -+ * @txglomsz: SDIO txglom size. Use 0 if default of driver is to be
  14288. -+ * used.
  14289. -+ * @drive_strength: is the preferred drive_strength to be used for the SDIO
  14290. -+ * pins. If 0 then a default value will be used. This is
  14291. -+ * the target drive strength, the exact drive strength
  14292. -+ * which will be used depends on the capabilities of the
  14293. -+ * device.
  14294. -+ * @oob_irq_supported: does the board have support for OOB interrupts. SDIO
  14295. -+ * in-band interrupts are relatively slow and for having
  14296. -+ * less overhead on interrupt processing an out of band
  14297. -+ * interrupt can be used. If the HW supports this then
  14298. -+ * enable this by setting this field to true and configure
  14299. -+ * the oob related fields.
  14300. -+ * @oob_irq_nr,
  14301. -+ * @oob_irq_flags: the OOB interrupt information. The values are used for
  14302. -+ * registering the irq using request_irq function.
  14303. -+ * @broken_sg_support: flag for broken sg list support of SDIO host controller.
  14304. -+ * Set this to true if the SDIO host controller has higher
  14305. -+ * align requirement than 32 bytes for each scatterlist
  14306. -+ * item.
  14307. -+ * @sd_head_align: alignment requirement for start of data buffer.
  14308. -+ * @sd_sgentry_align: length alignment requirement for each sg entry.
  14309. -+ * @reset: This function can get called if the device communication
  14310. -+ * broke down. This functionality is particularly useful in
  14311. -+ * case of SDIO type devices. It is possible to reset a
  14312. -+ * dongle via sdio data interface, but it requires that
  14313. -+ * this is fully functional. This function is chip/module
  14314. -+ * specific and this function should return only after the
  14315. -+ * complete reset has completed.
  14316. -+ */
  14317. -+struct brcmfmac_sdio_pd {
  14318. -+ int txglomsz;
  14319. -+ unsigned int drive_strength;
  14320. -+ bool oob_irq_supported;
  14321. -+ unsigned int oob_irq_nr;
  14322. -+ unsigned long oob_irq_flags;
  14323. -+ bool broken_sg_support;
  14324. -+ unsigned short sd_head_align;
  14325. -+ unsigned short sd_sgentry_align;
  14326. -+ void (*reset)(void);
  14327. -+};
  14328. -+
  14329. -+/**
  14330. -+ * struct brcmfmac_pd_cc_entry - Struct for translating user space country code
  14331. -+ * (iso3166) to firmware country code and
  14332. -+ * revision.
  14333. -+ *
  14334. -+ * @iso3166: iso3166 alpha 2 country code string.
  14335. -+ * @cc: firmware country code string.
  14336. -+ * @rev: firmware country code revision.
  14337. -+ */
  14338. -+struct brcmfmac_pd_cc_entry {
  14339. -+ char iso3166[BRCMFMAC_COUNTRY_BUF_SZ];
  14340. -+ char cc[BRCMFMAC_COUNTRY_BUF_SZ];
  14341. -+ s32 rev;
  14342. -+};
  14343. -+
  14344. -+/**
  14345. -+ * struct brcmfmac_pd_cc - Struct for translating country codes as set by user
  14346. -+ * space to a country code and rev which can be used by
  14347. -+ * firmware.
  14348. -+ *
  14349. -+ * @table_size: number of entries in table (> 0)
  14350. -+ * @table: array of 1 or more elements with translation information.
  14351. -+ */
  14352. -+struct brcmfmac_pd_cc {
  14353. -+ int table_size;
  14354. -+ struct brcmfmac_pd_cc_entry table[0];
  14355. -+};
  14356. -+
  14357. -+/**
  14358. -+ * struct brcmfmac_pd_device - Device specific platform data. (id/rev/bus_type)
  14359. -+ * is the unique identifier of the device.
  14360. -+ *
  14361. -+ * @id: ID of the device for which this data is. In case of SDIO
  14362. -+ * or PCIE this is the chipid as identified by chip.c In
  14363. -+ * case of USB this is the chipid as identified by the
  14364. -+ * device query.
  14365. -+ * @rev: chip revision, see id.
  14366. -+ * @bus_type: The type of bus. Some chipid/rev exist for different bus
  14367. -+ * types. Each bus type has its own set of settings.
  14368. -+ * @feature_disable: Bitmask of features to disable (override), See feature.c
  14369. -+ * in brcmfmac for details.
  14370. -+ * @country_codes: If available, pointer to struct for translating country
  14371. -+ * codes.
  14372. -+ * @bus: Bus specific (union) device settings. Currently only
  14373. -+ * SDIO.
  14374. -+ */
  14375. -+struct brcmfmac_pd_device {
  14376. -+ unsigned int id;
  14377. -+ unsigned int rev;
  14378. -+ enum brcmf_bus_type bus_type;
  14379. -+ unsigned int feature_disable;
  14380. -+ struct brcmfmac_pd_cc *country_codes;
  14381. -+ union {
  14382. -+ struct brcmfmac_sdio_pd sdio;
  14383. -+ } bus;
  14384. -+};
  14385. -+
  14386. -+/**
  14387. -+ * struct brcmfmac_platform_data - BRCMFMAC specific platform data.
  14388. -+ *
  14389. -+ * @power_on: This function is called by the brcmfmac driver when the module
  14390. -+ * gets loaded. This can be particularly useful for low power
  14391. -+ * devices. The platform spcific routine may for example decide to
  14392. -+ * power up the complete device. If there is no use-case for this
  14393. -+ * function then provide NULL.
  14394. -+ * @power_off: This function is called by the brcmfmac when the module gets
  14395. -+ * unloaded. At this point the devices can be powered down or
  14396. -+ * otherwise be reset. So if an actual power_off is not supported
  14397. -+ * but reset is supported by the devices then reset the devices
  14398. -+ * when this function gets called. This can be particularly useful
  14399. -+ * for low power devices. If there is no use-case for this
  14400. -+ * function then provide NULL.
  14401. -+ */
  14402. -+struct brcmfmac_platform_data {
  14403. -+ void (*power_on)(void);
  14404. -+ void (*power_off)(void);
  14405. -+ char *fw_alternative_path;
  14406. -+ int device_count;
  14407. -+ struct brcmfmac_pd_device devices[0];
  14408. -+};
  14409. -+
  14410. -+
  14411. -+#endif /* _LINUX_BRCMFMAC_PLATFORM_H */
  14412. diff --git a/package/kernel/mac80211/patches/344-0018-brcmfmac-merge-platform-data-and-module-paramaters.patch b/package/kernel/mac80211/patches/344-0018-brcmfmac-merge-platform-data-and-module-paramaters.patch
  14413. deleted file mode 100644
  14414. index 34341d7..0000000
  14415. --- a/package/kernel/mac80211/patches/344-0018-brcmfmac-merge-platform-data-and-module-paramaters.patch
  14416. +++ /dev/null
  14417. @@ -1,607 +0,0 @@
  14418. -From: Hante Meuleman <meuleman@broadcom.com>
  14419. -Date: Wed, 17 Feb 2016 11:27:08 +0100
  14420. -Subject: [PATCH] brcmfmac: merge platform data and module paramaters
  14421. -
  14422. -Merge module parameters and platform data in one struct. This is the
  14423. -last step to move to the new platform data per device. Now parameters
  14424. -of platform data will be merged with module parameters per device.
  14425. -
  14426. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  14427. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  14428. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14429. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  14430. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14431. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14432. ----
  14433. -
  14434. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  14435. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  14436. -@@ -109,8 +109,8 @@ int brcmf_sdiod_intr_register(struct brc
  14437. - u32 addr, gpiocontrol;
  14438. - unsigned long flags;
  14439. -
  14440. -- pdata = sdiodev->pdata;
  14441. -- if ((pdata) && (pdata->oob_irq_supported)) {
  14442. -+ pdata = &sdiodev->settings->bus.sdio;
  14443. -+ if (pdata->oob_irq_supported) {
  14444. - brcmf_dbg(SDIO, "Enter, register OOB IRQ %d\n",
  14445. - pdata->oob_irq_nr);
  14446. - ret = request_irq(pdata->oob_irq_nr, brcmf_sdiod_oob_irqhandler,
  14447. -@@ -177,8 +177,8 @@ int brcmf_sdiod_intr_unregister(struct b
  14448. -
  14449. - brcmf_dbg(SDIO, "Entering\n");
  14450. -
  14451. -- pdata = sdiodev->pdata;
  14452. -- if ((pdata) && (pdata->oob_irq_supported)) {
  14453. -+ pdata = &sdiodev->settings->bus.sdio;
  14454. -+ if (pdata->oob_irq_supported) {
  14455. - sdio_claim_host(sdiodev->func[1]);
  14456. - brcmf_sdiod_regwb(sdiodev, SDIO_CCCR_BRCM_SEPINT, 0, NULL);
  14457. - brcmf_sdiod_regwb(sdiodev, SDIO_CCCR_IENx, 0, NULL);
  14458. -@@ -522,7 +522,7 @@ static int brcmf_sdiod_sglist_rw(struct
  14459. - target_list = pktlist;
  14460. - /* for host with broken sg support, prepare a page aligned list */
  14461. - __skb_queue_head_init(&local_list);
  14462. -- if (sdiodev->pdata && sdiodev->pdata->broken_sg_support && !write) {
  14463. -+ if (!write && sdiodev->settings->bus.sdio.broken_sg_support) {
  14464. - req_sz = 0;
  14465. - skb_queue_walk(pktlist, pkt_next)
  14466. - req_sz += pkt_next->len;
  14467. -@@ -629,7 +629,7 @@ static int brcmf_sdiod_sglist_rw(struct
  14468. - }
  14469. - }
  14470. -
  14471. -- if (sdiodev->pdata && sdiodev->pdata->broken_sg_support && !write) {
  14472. -+ if (!write && sdiodev->settings->bus.sdio.broken_sg_support) {
  14473. - local_pkt_next = local_list.next;
  14474. - orig_offset = 0;
  14475. - skb_queue_walk(pktlist, pkt_next) {
  14476. -@@ -900,7 +900,7 @@ void brcmf_sdiod_sgtable_alloc(struct br
  14477. - return;
  14478. -
  14479. - nents = max_t(uint, BRCMF_DEFAULT_RXGLOM_SIZE,
  14480. -- sdiodev->bus_if->drvr->settings->sdiod_txglomsz);
  14481. -+ sdiodev->settings->bus.sdio.txglomsz);
  14482. - nents += (nents >> 4) + 1;
  14483. -
  14484. - WARN_ON(nents > sdiodev->max_segment_count);
  14485. -@@ -912,7 +912,7 @@ void brcmf_sdiod_sgtable_alloc(struct br
  14486. - sdiodev->sg_support = false;
  14487. - }
  14488. -
  14489. -- sdiodev->txglomsz = sdiodev->bus_if->drvr->settings->sdiod_txglomsz;
  14490. -+ sdiodev->txglomsz = sdiodev->settings->bus.sdio.txglomsz;
  14491. - }
  14492. -
  14493. - #ifdef CONFIG_PM_SLEEP
  14494. -@@ -1246,8 +1246,8 @@ static int brcmf_ops_sdio_suspend(struct
  14495. -
  14496. - sdio_flags = MMC_PM_KEEP_POWER;
  14497. - if (sdiodev->wowl_enabled) {
  14498. -- if (sdiodev->pdata->oob_irq_supported)
  14499. -- enable_irq_wake(sdiodev->pdata->oob_irq_nr);
  14500. -+ if (sdiodev->settings->bus.sdio.oob_irq_supported)
  14501. -+ enable_irq_wake(sdiodev->settings->bus.sdio.oob_irq_nr);
  14502. - else
  14503. - sdio_flags |= MMC_PM_WAKE_SDIO_IRQ;
  14504. - }
  14505. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
  14506. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
  14507. -@@ -43,6 +43,8 @@ enum brcmf_bus_protocol_type {
  14508. - BRCMF_PROTO_MSGBUF
  14509. - };
  14510. -
  14511. -+struct brcmf_mp_device;
  14512. -+
  14513. - struct brcmf_bus_dcmd {
  14514. - char *name;
  14515. - char *param;
  14516. -@@ -217,7 +219,7 @@ bool brcmf_c_prec_enq(struct device *dev
  14517. - void brcmf_rx_frame(struct device *dev, struct sk_buff *rxp);
  14518. -
  14519. - /* Indication from bus module regarding presence/insertion of dongle. */
  14520. --int brcmf_attach(struct device *dev);
  14521. -+int brcmf_attach(struct device *dev, struct brcmf_mp_device *settings);
  14522. - /* Indication from bus module regarding removal/absence of dongle */
  14523. - void brcmf_detach(struct device *dev);
  14524. - /* Indication from bus module that dongle should be reset */
  14525. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  14526. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  14527. -@@ -243,14 +243,35 @@ static void brcmf_mp_attach(void)
  14528. - }
  14529. - }
  14530. -
  14531. --struct brcmfmac_sdio_pd *brcmf_get_module_param(struct device *dev,
  14532. -- enum brcmf_bus_type bus_type,
  14533. -- u32 chip, u32 chiprev)
  14534. -+struct brcmf_mp_device *brcmf_get_module_param(struct device *dev,
  14535. -+ enum brcmf_bus_type bus_type,
  14536. -+ u32 chip, u32 chiprev)
  14537. - {
  14538. -- struct brcmfmac_sdio_pd *pdata;
  14539. -+ struct brcmf_mp_device *settings;
  14540. - struct brcmfmac_pd_device *device_pd;
  14541. -+ bool found;
  14542. - int i;
  14543. -
  14544. -+ brcmf_dbg(INFO, "Enter, bus=%d, chip=%d, rev=%d\n", bus_type, chip,
  14545. -+ chiprev);
  14546. -+ settings = kzalloc(sizeof(*settings), GFP_ATOMIC);
  14547. -+ if (!settings)
  14548. -+ return NULL;
  14549. -+
  14550. -+ /* start by using the module paramaters */
  14551. -+ settings->p2p_enable = !!brcmf_p2p_enable;
  14552. -+ settings->feature_disable = brcmf_feature_disable;
  14553. -+ settings->fcmode = brcmf_fcmode;
  14554. -+ settings->roamoff = !!brcmf_roamoff;
  14555. -+#ifdef DEBUG
  14556. -+ settings->ignore_probe_fail = !!brcmf_ignore_probe_fail;
  14557. -+#endif
  14558. -+
  14559. -+ if (bus_type == BRCMF_BUSTYPE_SDIO)
  14560. -+ settings->bus.sdio.txglomsz = brcmf_sdiod_txglomsz;
  14561. -+
  14562. -+ /* See if there is any device specific platform data configured */
  14563. -+ found = false;
  14564. - if (brcmfmac_pdata) {
  14565. - for (i = 0; i < brcmfmac_pdata->device_count; i++) {
  14566. - device_pd = &brcmfmac_pdata->devices[i];
  14567. -@@ -259,38 +280,29 @@ struct brcmfmac_sdio_pd *brcmf_get_modul
  14568. - ((device_pd->rev == chiprev) ||
  14569. - (device_pd->rev == -1))) {
  14570. - brcmf_dbg(INFO, "Platform data for device found\n");
  14571. -+ settings->country_codes =
  14572. -+ device_pd->country_codes;
  14573. - if (device_pd->bus_type == BRCMF_BUSTYPE_SDIO)
  14574. -- return &device_pd->bus.sdio;
  14575. -+ memcpy(&settings->bus.sdio,
  14576. -+ &device_pd->bus.sdio,
  14577. -+ sizeof(settings->bus.sdio));
  14578. -+ found = true;
  14579. - break;
  14580. - }
  14581. - }
  14582. - }
  14583. -- pdata = NULL;
  14584. -- brcmf_of_probe(dev, &pdata);
  14585. --
  14586. -- return pdata;
  14587. --}
  14588. --
  14589. --int brcmf_mp_device_attach(struct brcmf_pub *drvr)
  14590. --{
  14591. -- drvr->settings = kzalloc(sizeof(*drvr->settings), GFP_ATOMIC);
  14592. -- if (!drvr->settings)
  14593. -- return -ENOMEM;
  14594. --
  14595. -- drvr->settings->sdiod_txglomsz = brcmf_sdiod_txglomsz;
  14596. -- drvr->settings->p2p_enable = !!brcmf_p2p_enable;
  14597. -- drvr->settings->feature_disable = brcmf_feature_disable;
  14598. -- drvr->settings->fcmode = brcmf_fcmode;
  14599. -- drvr->settings->roamoff = !!brcmf_roamoff;
  14600. --#ifdef DEBUG
  14601. -- drvr->settings->ignore_probe_fail = !!brcmf_ignore_probe_fail;
  14602. --#endif
  14603. -- return 0;
  14604. -+ if ((bus_type == BRCMF_BUSTYPE_SDIO) && (!found)) {
  14605. -+ /* No platform data for this device. In case of SDIO try OF
  14606. -+ * (Open Firwmare) Device Tree.
  14607. -+ */
  14608. -+ brcmf_of_probe(dev, &settings->bus.sdio);
  14609. -+ }
  14610. -+ return settings;
  14611. - }
  14612. -
  14613. --void brcmf_mp_device_detach(struct brcmf_pub *drvr)
  14614. -+void brcmf_release_module_param(struct brcmf_mp_device *module_param)
  14615. - {
  14616. -- kfree(drvr->settings);
  14617. -+ kfree(module_param);
  14618. - }
  14619. -
  14620. - static int __init brcmf_common_pd_probe(struct platform_device *pdev)
  14621. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
  14622. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
  14623. -@@ -45,41 +45,30 @@ extern struct brcmf_mp_global_t brcmf_mp
  14624. - /**
  14625. - * struct brcmf_mp_device - Device module paramaters.
  14626. - *
  14627. -- * @sdiod_txglomsz: SDIO txglom size.
  14628. -- * @joinboost_5g_rssi: 5g rssi booost for preferred join selection.
  14629. - * @p2p_enable: Legacy P2P0 enable (old wpa_supplicant).
  14630. - * @feature_disable: Feature_disable bitmask.
  14631. - * @fcmode: FWS flow control.
  14632. - * @roamoff: Firmware roaming off?
  14633. -+ * @ignore_probe_fail: Ignore probe failure.
  14634. - * @country_codes: If available, pointer to struct for translating country codes
  14635. -+ * @bus: Bus specific platform data. Only SDIO at the mmoment.
  14636. - */
  14637. - struct brcmf_mp_device {
  14638. -- int sdiod_txglomsz;
  14639. -- int joinboost_5g_rssi;
  14640. -- bool p2p_enable;
  14641. -- int feature_disable;
  14642. -- int fcmode;
  14643. -- bool roamoff;
  14644. -- bool ignore_probe_fail;
  14645. -+ bool p2p_enable;
  14646. -+ unsigned int feature_disable;
  14647. -+ int fcmode;
  14648. -+ bool roamoff;
  14649. -+ bool ignore_probe_fail;
  14650. - struct brcmfmac_pd_cc *country_codes;
  14651. -+ union {
  14652. -+ struct brcmfmac_sdio_pd sdio;
  14653. -+ } bus;
  14654. - };
  14655. -
  14656. --struct brcmfmac_sdio_pd *brcmf_get_module_param(struct device *dev,
  14657. -- enum brcmf_bus_type bus_type,
  14658. -- u32 chip, u32 chiprev);
  14659. --int brcmf_mp_device_attach(struct brcmf_pub *drvr);
  14660. --void brcmf_mp_device_detach(struct brcmf_pub *drvr);
  14661. --#ifdef DEBUG
  14662. --static inline bool brcmf_ignoring_probe_fail(struct brcmf_pub *drvr)
  14663. --{
  14664. -- return drvr->settings->ignore_probe_fail;
  14665. --}
  14666. --#else
  14667. --static inline bool brcmf_ignoring_probe_fail(struct brcmf_pub *drvr)
  14668. --{
  14669. -- return false;
  14670. --}
  14671. --#endif
  14672. -+struct brcmf_mp_device *brcmf_get_module_param(struct device *dev,
  14673. -+ enum brcmf_bus_type bus_type,
  14674. -+ u32 chip, u32 chiprev);
  14675. -+void brcmf_release_module_param(struct brcmf_mp_device *module_param);
  14676. -
  14677. - /* Sets dongle media info (drv_version, mac address). */
  14678. - int brcmf_c_preinit_dcmds(struct brcmf_if *ifp);
  14679. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  14680. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  14681. -@@ -1104,7 +1104,7 @@ static int brcmf_inet6addr_changed(struc
  14682. - }
  14683. - #endif
  14684. -
  14685. --int brcmf_attach(struct device *dev)
  14686. -+int brcmf_attach(struct device *dev, struct brcmf_mp_device *settings)
  14687. - {
  14688. - struct brcmf_pub *drvr = NULL;
  14689. - int ret = 0;
  14690. -@@ -1126,10 +1126,7 @@ int brcmf_attach(struct device *dev)
  14691. - drvr->hdrlen = 0;
  14692. - drvr->bus_if = dev_get_drvdata(dev);
  14693. - drvr->bus_if->drvr = drvr;
  14694. --
  14695. -- /* Initialize device specific settings */
  14696. -- if (brcmf_mp_device_attach(drvr))
  14697. -- goto fail;
  14698. -+ drvr->settings = settings;
  14699. -
  14700. - /* attach debug facilities */
  14701. - brcmf_debug_attach(drvr);
  14702. -@@ -1274,7 +1271,7 @@ fail:
  14703. - brcmf_net_detach(p2p_ifp->ndev);
  14704. - drvr->iflist[0] = NULL;
  14705. - drvr->iflist[1] = NULL;
  14706. -- if (brcmf_ignoring_probe_fail(drvr))
  14707. -+ if (drvr->settings->ignore_probe_fail)
  14708. - ret = 0;
  14709. -
  14710. - return ret;
  14711. -@@ -1350,8 +1347,6 @@ void brcmf_detach(struct device *dev)
  14712. -
  14713. - brcmf_proto_detach(drvr);
  14714. -
  14715. -- brcmf_mp_device_detach(drvr);
  14716. --
  14717. - brcmf_debug_detach(drvr);
  14718. - bus_if->drvr = NULL;
  14719. - kfree(drvr);
  14720. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
  14721. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
  14722. -@@ -23,7 +23,7 @@
  14723. - #include "common.h"
  14724. - #include "of.h"
  14725. -
  14726. --void brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_pd **sdio)
  14727. -+void brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_pd *sdio)
  14728. - {
  14729. - struct device_node *np = dev->of_node;
  14730. - int irq;
  14731. -@@ -33,12 +33,8 @@ void brcmf_of_probe(struct device *dev,
  14732. - if (!np || !of_device_is_compatible(np, "brcm,bcm4329-fmac"))
  14733. - return;
  14734. -
  14735. -- *sdio = devm_kzalloc(dev, sizeof(*sdio), GFP_KERNEL);
  14736. -- if (!(*sdio))
  14737. -- return;
  14738. --
  14739. - if (of_property_read_u32(np, "brcm,drive-strength", &val) == 0)
  14740. -- (*sdio)->drive_strength = val;
  14741. -+ sdio->drive_strength = val;
  14742. -
  14743. - /* make sure there are interrupts defined in the node */
  14744. - if (!of_find_property(np, "interrupts", NULL))
  14745. -@@ -51,7 +47,7 @@ void brcmf_of_probe(struct device *dev,
  14746. - }
  14747. - irqf = irqd_get_trigger_type(irq_get_irq_data(irq));
  14748. -
  14749. -- (*sdio)->oob_irq_supported = true;
  14750. -- (*sdio)->oob_irq_nr = irq;
  14751. -- (*sdio)->oob_irq_flags = irqf;
  14752. -+ sdio->oob_irq_supported = true;
  14753. -+ sdio->oob_irq_nr = irq;
  14754. -+ sdio->oob_irq_flags = irqf;
  14755. - }
  14756. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.h
  14757. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.h
  14758. -@@ -14,10 +14,9 @@
  14759. - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  14760. - */
  14761. - #ifdef CONFIG_OF
  14762. --void
  14763. --brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_pd **sdio);
  14764. -+void brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_pd *sdio);
  14765. - #else
  14766. --static void brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_pd **sdio)
  14767. -+static void brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_pd *sdio)
  14768. - {
  14769. - }
  14770. - #endif /* CONFIG_OF */
  14771. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  14772. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  14773. -@@ -37,6 +37,8 @@
  14774. - #include "pcie.h"
  14775. - #include "firmware.h"
  14776. - #include "chip.h"
  14777. -+#include "core.h"
  14778. -+#include "common.h"
  14779. -
  14780. -
  14781. - enum brcmf_pcie_state {
  14782. -@@ -266,6 +268,7 @@ struct brcmf_pciedev_info {
  14783. - u16 (*read_ptr)(struct brcmf_pciedev_info *devinfo, u32 mem_offset);
  14784. - void (*write_ptr)(struct brcmf_pciedev_info *devinfo, u32 mem_offset,
  14785. - u16 value);
  14786. -+ struct brcmf_mp_device *settings;
  14787. - };
  14788. -
  14789. - struct brcmf_pcie_ringbuf {
  14790. -@@ -1525,16 +1528,16 @@ static void brcmf_pcie_release_resource(
  14791. - }
  14792. -
  14793. -
  14794. --static int brcmf_pcie_attach_bus(struct device *dev)
  14795. -+static int brcmf_pcie_attach_bus(struct brcmf_pciedev_info *devinfo)
  14796. - {
  14797. - int ret;
  14798. -
  14799. - /* Attach to the common driver interface */
  14800. -- ret = brcmf_attach(dev);
  14801. -+ ret = brcmf_attach(&devinfo->pdev->dev, devinfo->settings);
  14802. - if (ret) {
  14803. - brcmf_err("brcmf_attach failed\n");
  14804. - } else {
  14805. -- ret = brcmf_bus_start(dev);
  14806. -+ ret = brcmf_bus_start(&devinfo->pdev->dev);
  14807. - if (ret)
  14808. - brcmf_err("dongle is not responding\n");
  14809. - }
  14810. -@@ -1672,7 +1675,7 @@ static void brcmf_pcie_setup(struct devi
  14811. - init_waitqueue_head(&devinfo->mbdata_resp_wait);
  14812. -
  14813. - brcmf_pcie_intr_enable(devinfo);
  14814. -- if (brcmf_pcie_attach_bus(bus->dev) == 0)
  14815. -+ if (brcmf_pcie_attach_bus(devinfo) == 0)
  14816. - return;
  14817. -
  14818. - brcmf_pcie_bus_console_read(devinfo);
  14819. -@@ -1716,6 +1719,15 @@ brcmf_pcie_probe(struct pci_dev *pdev, c
  14820. - goto fail;
  14821. - }
  14822. -
  14823. -+ devinfo->settings = brcmf_get_module_param(&devinfo->pdev->dev,
  14824. -+ BRCMF_BUSTYPE_PCIE,
  14825. -+ devinfo->ci->chip,
  14826. -+ devinfo->ci->chiprev);
  14827. -+ if (!devinfo->settings) {
  14828. -+ ret = -ENOMEM;
  14829. -+ goto fail;
  14830. -+ }
  14831. -+
  14832. - bus = kzalloc(sizeof(*bus), GFP_KERNEL);
  14833. - if (!bus) {
  14834. - ret = -ENOMEM;
  14835. -@@ -1760,6 +1772,8 @@ fail:
  14836. - brcmf_pcie_release_resource(devinfo);
  14837. - if (devinfo->ci)
  14838. - brcmf_chip_detach(devinfo->ci);
  14839. -+ if (devinfo->settings)
  14840. -+ brcmf_release_module_param(devinfo->settings);
  14841. - kfree(pcie_bus_dev);
  14842. - kfree(devinfo);
  14843. - return ret;
  14844. -@@ -1799,6 +1813,8 @@ brcmf_pcie_remove(struct pci_dev *pdev)
  14845. -
  14846. - if (devinfo->ci)
  14847. - brcmf_chip_detach(devinfo->ci);
  14848. -+ if (devinfo->settings)
  14849. -+ brcmf_release_module_param(devinfo->settings);
  14850. -
  14851. - kfree(devinfo);
  14852. - dev_set_drvdata(&pdev->dev, NULL);
  14853. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  14854. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  14855. -@@ -2442,15 +2442,17 @@ static void brcmf_sdio_bus_stop(struct d
  14856. -
  14857. - static inline void brcmf_sdio_clrintr(struct brcmf_sdio *bus)
  14858. - {
  14859. -+ struct brcmf_sdio_dev *sdiodev;
  14860. - unsigned long flags;
  14861. -
  14862. -- if (bus->sdiodev->oob_irq_requested) {
  14863. -- spin_lock_irqsave(&bus->sdiodev->irq_en_lock, flags);
  14864. -- if (!bus->sdiodev->irq_en && !atomic_read(&bus->ipend)) {
  14865. -- enable_irq(bus->sdiodev->pdata->oob_irq_nr);
  14866. -- bus->sdiodev->irq_en = true;
  14867. -+ sdiodev = bus->sdiodev;
  14868. -+ if (sdiodev->oob_irq_requested) {
  14869. -+ spin_lock_irqsave(&sdiodev->irq_en_lock, flags);
  14870. -+ if (!sdiodev->irq_en && !atomic_read(&bus->ipend)) {
  14871. -+ enable_irq(sdiodev->settings->bus.sdio.oob_irq_nr);
  14872. -+ sdiodev->irq_en = true;
  14873. - }
  14874. -- spin_unlock_irqrestore(&bus->sdiodev->irq_en_lock, flags);
  14875. -+ spin_unlock_irqrestore(&sdiodev->irq_en_lock, flags);
  14876. - }
  14877. - }
  14878. -
  14879. -@@ -3394,9 +3396,7 @@ static int brcmf_sdio_bus_preinit(struct
  14880. - sizeof(u32));
  14881. - } else {
  14882. - /* otherwise, set txglomalign */
  14883. -- value = 4;
  14884. -- if (sdiodev->pdata)
  14885. -- value = sdiodev->pdata->sd_sgentry_align;
  14886. -+ value = sdiodev->settings->bus.sdio.sd_sgentry_align;
  14887. - /* SDIO ADMA requires at least 32 bit alignment */
  14888. - value = max_t(u32, value, 4);
  14889. - err = brcmf_iovar_data_set(dev, "bus:txglomalign", &value,
  14890. -@@ -3811,21 +3811,25 @@ brcmf_sdio_probe_attach(struct brcmf_sdi
  14891. - bus->ci = NULL;
  14892. - goto fail;
  14893. - }
  14894. -- sdiodev->pdata = brcmf_get_module_param(sdiodev->dev,
  14895. -+ sdiodev->settings = brcmf_get_module_param(sdiodev->dev,
  14896. - BRCMF_BUSTYPE_SDIO,
  14897. - bus->ci->chip,
  14898. - bus->ci->chiprev);
  14899. -+ if (!sdiodev->settings) {
  14900. -+ brcmf_err("Failed to get device parameters\n");
  14901. -+ goto fail;
  14902. -+ }
  14903. - /* platform specific configuration:
  14904. - * alignments must be at least 4 bytes for ADMA
  14905. - */
  14906. - bus->head_align = ALIGNMENT;
  14907. - bus->sgentry_align = ALIGNMENT;
  14908. -- if (sdiodev->pdata) {
  14909. -- if (sdiodev->pdata->sd_head_align > ALIGNMENT)
  14910. -- bus->head_align = sdiodev->pdata->sd_head_align;
  14911. -- if (sdiodev->pdata->sd_sgentry_align > ALIGNMENT)
  14912. -- bus->sgentry_align = sdiodev->pdata->sd_sgentry_align;
  14913. -- }
  14914. -+ if (sdiodev->settings->bus.sdio.sd_head_align > ALIGNMENT)
  14915. -+ bus->head_align = sdiodev->settings->bus.sdio.sd_head_align;
  14916. -+ if (sdiodev->settings->bus.sdio.sd_sgentry_align > ALIGNMENT)
  14917. -+ bus->sgentry_align =
  14918. -+ sdiodev->settings->bus.sdio.sd_sgentry_align;
  14919. -+
  14920. - /* allocate scatter-gather table. sg support
  14921. - * will be disabled upon allocation failure.
  14922. - */
  14923. -@@ -3837,7 +3841,7 @@ brcmf_sdio_probe_attach(struct brcmf_sdi
  14924. - */
  14925. - if ((sdio_get_host_pm_caps(sdiodev->func[1]) & MMC_PM_KEEP_POWER) &&
  14926. - ((sdio_get_host_pm_caps(sdiodev->func[1]) & MMC_PM_WAKE_SDIO_IRQ) ||
  14927. -- (sdiodev->pdata && sdiodev->pdata->oob_irq_supported)))
  14928. -+ (sdiodev->settings->bus.sdio.oob_irq_supported)))
  14929. - sdiodev->bus_if->wowl_supported = true;
  14930. - #endif
  14931. -
  14932. -@@ -3846,8 +3850,8 @@ brcmf_sdio_probe_attach(struct brcmf_sdi
  14933. - goto fail;
  14934. - }
  14935. -
  14936. -- if ((sdiodev->pdata) && (sdiodev->pdata->drive_strength))
  14937. -- drivestrength = sdiodev->pdata->drive_strength;
  14938. -+ if (sdiodev->settings->bus.sdio.drive_strength)
  14939. -+ drivestrength = sdiodev->settings->bus.sdio.drive_strength;
  14940. - else
  14941. - drivestrength = DEFAULT_SDIO_DRIVE_STRENGTH;
  14942. - brcmf_sdio_drivestrengthinit(sdiodev, bus->ci, drivestrength);
  14943. -@@ -4124,7 +4128,7 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
  14944. - bus->tx_hdrlen = SDPCM_HWHDR_LEN + SDPCM_SWHDR_LEN;
  14945. -
  14946. - /* Attach to the common layer, reserve hdr space */
  14947. -- ret = brcmf_attach(bus->sdiodev->dev);
  14948. -+ ret = brcmf_attach(bus->sdiodev->dev, bus->sdiodev->settings);
  14949. - if (ret != 0) {
  14950. - brcmf_err("brcmf_attach failed\n");
  14951. - goto fail;
  14952. -@@ -4228,6 +4232,8 @@ void brcmf_sdio_remove(struct brcmf_sdio
  14953. - }
  14954. - brcmf_chip_detach(bus->ci);
  14955. - }
  14956. -+ if (bus->sdiodev->settings)
  14957. -+ brcmf_release_module_param(bus->sdiodev->settings);
  14958. -
  14959. - kfree(bus->rxbuf);
  14960. - kfree(bus->hdrbuf);
  14961. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
  14962. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
  14963. -@@ -184,7 +184,7 @@ struct brcmf_sdio_dev {
  14964. - struct brcmf_sdio *bus;
  14965. - struct device *dev;
  14966. - struct brcmf_bus *bus_if;
  14967. -- struct brcmfmac_sdio_pd *pdata;
  14968. -+ struct brcmf_mp_device *settings;
  14969. - bool oob_irq_requested;
  14970. - bool irq_en; /* irq enable flags */
  14971. - spinlock_t irq_en_lock;
  14972. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
  14973. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
  14974. -@@ -27,6 +27,8 @@
  14975. - #include "debug.h"
  14976. - #include "firmware.h"
  14977. - #include "usb.h"
  14978. -+#include "core.h"
  14979. -+#include "common.h"
  14980. -
  14981. -
  14982. - #define IOCTL_RESP_TIMEOUT msecs_to_jiffies(2000)
  14983. -@@ -171,6 +173,7 @@ struct brcmf_usbdev_info {
  14984. - struct urb *bulk_urb; /* used for FW download */
  14985. -
  14986. - bool wowl_enabled;
  14987. -+ struct brcmf_mp_device *settings;
  14988. - };
  14989. -
  14990. - static void brcmf_usb_rx_refill(struct brcmf_usbdev_info *devinfo,
  14991. -@@ -1027,6 +1030,9 @@ static void brcmf_usb_detach(struct brcm
  14992. -
  14993. - kfree(devinfo->tx_reqs);
  14994. - kfree(devinfo->rx_reqs);
  14995. -+
  14996. -+ if (devinfo->settings)
  14997. -+ brcmf_release_module_param(devinfo->settings);
  14998. - }
  14999. -
  15000. -
  15001. -@@ -1136,7 +1142,7 @@ static int brcmf_usb_bus_setup(struct br
  15002. - int ret;
  15003. -
  15004. - /* Attach to the common driver interface */
  15005. -- ret = brcmf_attach(devinfo->dev);
  15006. -+ ret = brcmf_attach(devinfo->dev, devinfo->settings);
  15007. - if (ret) {
  15008. - brcmf_err("brcmf_attach failed\n");
  15009. - return ret;
  15010. -@@ -1223,6 +1229,14 @@ static int brcmf_usb_probe_cb(struct brc
  15011. - bus->wowl_supported = true;
  15012. - #endif
  15013. -
  15014. -+ devinfo->settings = brcmf_get_module_param(bus->dev, BRCMF_BUSTYPE_USB,
  15015. -+ bus_pub->devid,
  15016. -+ bus_pub->chiprev);
  15017. -+ if (!devinfo->settings) {
  15018. -+ ret = -ENOMEM;
  15019. -+ goto fail;
  15020. -+ }
  15021. -+
  15022. - if (!brcmf_usb_dlneeded(devinfo)) {
  15023. - ret = brcmf_usb_bus_setup(devinfo);
  15024. - if (ret)
  15025. diff --git a/package/kernel/mac80211/patches/344-0019-brcmfmac-integrate-add_keyext-in-add_key.patch b/package/kernel/mac80211/patches/344-0019-brcmfmac-integrate-add_keyext-in-add_key.patch
  15026. deleted file mode 100644
  15027. index eb680fc..0000000
  15028. --- a/package/kernel/mac80211/patches/344-0019-brcmfmac-integrate-add_keyext-in-add_key.patch
  15029. +++ /dev/null
  15030. @@ -1,227 +0,0 @@
  15031. -From: Hante Meuleman <hante.meuleman@broadcom.com>
  15032. -Date: Wed, 17 Feb 2016 11:27:09 +0100
  15033. -Subject: [PATCH] brcmfmac: integrate add_keyext in add_key
  15034. -
  15035. -brcmf_add_keyext is called when a key is configured for a specific
  15036. -mac address. This function is very similar to the calling function
  15037. -brcmf_add_key. Integrate this function and also use existing del_key
  15038. -function in case key is to be cleared.
  15039. -
  15040. -Reviewed-by: Arend Van Spriel <arend.van@broadcom.com>
  15041. -Reviewed-by: Franky (Zhenhui) Lin <franky.lin@broadcom.com>
  15042. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  15043. -Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
  15044. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15045. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15046. ----
  15047. -
  15048. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  15049. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  15050. -@@ -2073,84 +2073,34 @@ done:
  15051. - }
  15052. -
  15053. - static s32
  15054. --brcmf_add_keyext(struct wiphy *wiphy, struct net_device *ndev,
  15055. -- u8 key_idx, const u8 *mac_addr, struct key_params *params)
  15056. -+brcmf_cfg80211_del_key(struct wiphy *wiphy, struct net_device *ndev,
  15057. -+ u8 key_idx, bool pairwise, const u8 *mac_addr)
  15058. - {
  15059. - struct brcmf_if *ifp = netdev_priv(ndev);
  15060. - struct brcmf_wsec_key key;
  15061. - s32 err = 0;
  15062. -- u8 keybuf[8];
  15063. -+
  15064. -+ brcmf_dbg(TRACE, "Enter\n");
  15065. -+ if (!check_vif_up(ifp->vif))
  15066. -+ return -EIO;
  15067. -+
  15068. -+ if (key_idx >= BRCMF_MAX_DEFAULT_KEYS) {
  15069. -+ /* we ignore this key index in this case */
  15070. -+ return -EINVAL;
  15071. -+ }
  15072. -
  15073. - memset(&key, 0, sizeof(key));
  15074. -- key.index = (u32) key_idx;
  15075. -- /* Instead of bcast for ea address for default wep keys,
  15076. -- driver needs it to be Null */
  15077. -- if (!is_multicast_ether_addr(mac_addr))
  15078. -- memcpy((char *)&key.ea, (void *)mac_addr, ETH_ALEN);
  15079. -- key.len = (u32) params->key_len;
  15080. -- /* check for key index change */
  15081. -- if (key.len == 0) {
  15082. -- /* key delete */
  15083. -- err = send_key_to_dongle(ifp, &key);
  15084. -- if (err)
  15085. -- brcmf_err("key delete error (%d)\n", err);
  15086. -- } else {
  15087. -- if (key.len > sizeof(key.data)) {
  15088. -- brcmf_err("Invalid key length (%d)\n", key.len);
  15089. -- return -EINVAL;
  15090. -- }
  15091. -
  15092. -- brcmf_dbg(CONN, "Setting the key index %d\n", key.index);
  15093. -- memcpy(key.data, params->key, key.len);
  15094. -+ key.index = (u32)key_idx;
  15095. -+ key.flags = BRCMF_PRIMARY_KEY;
  15096. -+ key.algo = CRYPTO_ALGO_OFF;
  15097. -
  15098. -- if (!brcmf_is_apmode(ifp->vif) &&
  15099. -- (params->cipher == WLAN_CIPHER_SUITE_TKIP)) {
  15100. -- brcmf_dbg(CONN, "Swapping RX/TX MIC key\n");
  15101. -- memcpy(keybuf, &key.data[24], sizeof(keybuf));
  15102. -- memcpy(&key.data[24], &key.data[16], sizeof(keybuf));
  15103. -- memcpy(&key.data[16], keybuf, sizeof(keybuf));
  15104. -- }
  15105. -+ brcmf_dbg(CONN, "key index (%d)\n", key_idx);
  15106. -
  15107. -- /* if IW_ENCODE_EXT_RX_SEQ_VALID set */
  15108. -- if (params->seq && params->seq_len == 6) {
  15109. -- /* rx iv */
  15110. -- u8 *ivptr;
  15111. -- ivptr = (u8 *) params->seq;
  15112. -- key.rxiv.hi = (ivptr[5] << 24) | (ivptr[4] << 16) |
  15113. -- (ivptr[3] << 8) | ivptr[2];
  15114. -- key.rxiv.lo = (ivptr[1] << 8) | ivptr[0];
  15115. -- key.iv_initialized = true;
  15116. -- }
  15117. -+ /* Set the new key/index */
  15118. -+ err = send_key_to_dongle(ifp, &key);
  15119. -
  15120. -- switch (params->cipher) {
  15121. -- case WLAN_CIPHER_SUITE_WEP40:
  15122. -- key.algo = CRYPTO_ALGO_WEP1;
  15123. -- brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_WEP40\n");
  15124. -- break;
  15125. -- case WLAN_CIPHER_SUITE_WEP104:
  15126. -- key.algo = CRYPTO_ALGO_WEP128;
  15127. -- brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_WEP104\n");
  15128. -- break;
  15129. -- case WLAN_CIPHER_SUITE_TKIP:
  15130. -- key.algo = CRYPTO_ALGO_TKIP;
  15131. -- brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_TKIP\n");
  15132. -- break;
  15133. -- case WLAN_CIPHER_SUITE_AES_CMAC:
  15134. -- key.algo = CRYPTO_ALGO_AES_CCM;
  15135. -- brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_AES_CMAC\n");
  15136. -- break;
  15137. -- case WLAN_CIPHER_SUITE_CCMP:
  15138. -- key.algo = CRYPTO_ALGO_AES_CCM;
  15139. -- brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_CCMP\n");
  15140. -- break;
  15141. -- default:
  15142. -- brcmf_err("Invalid cipher (0x%x)\n", params->cipher);
  15143. -- return -EINVAL;
  15144. -- }
  15145. -- err = send_key_to_dongle(ifp, &key);
  15146. -- if (err)
  15147. -- brcmf_err("wsec_key error (%d)\n", err);
  15148. -- }
  15149. -+ brcmf_dbg(TRACE, "Exit\n");
  15150. - return err;
  15151. - }
  15152. -
  15153. -@@ -2163,8 +2113,9 @@ brcmf_cfg80211_add_key(struct wiphy *wip
  15154. - struct brcmf_wsec_key *key;
  15155. - s32 val;
  15156. - s32 wsec;
  15157. -- s32 err = 0;
  15158. -+ s32 err;
  15159. - u8 keybuf[8];
  15160. -+ bool ext_key;
  15161. -
  15162. - brcmf_dbg(TRACE, "Enter\n");
  15163. - brcmf_dbg(CONN, "key index (%d)\n", key_idx);
  15164. -@@ -2177,27 +2128,32 @@ brcmf_cfg80211_add_key(struct wiphy *wip
  15165. - return -EINVAL;
  15166. - }
  15167. -
  15168. -- if (mac_addr &&
  15169. -- (params->cipher != WLAN_CIPHER_SUITE_WEP40) &&
  15170. -- (params->cipher != WLAN_CIPHER_SUITE_WEP104)) {
  15171. -- brcmf_dbg(TRACE, "Exit");
  15172. -- return brcmf_add_keyext(wiphy, ndev, key_idx, mac_addr, params);
  15173. -- }
  15174. --
  15175. -- key = &ifp->vif->profile.key[key_idx];
  15176. -- memset(key, 0, sizeof(*key));
  15177. -+ if (params->key_len == 0)
  15178. -+ return brcmf_cfg80211_del_key(wiphy, ndev, key_idx, pairwise,
  15179. -+ mac_addr);
  15180. -
  15181. - if (params->key_len > sizeof(key->data)) {
  15182. - brcmf_err("Too long key length (%u)\n", params->key_len);
  15183. -- err = -EINVAL;
  15184. -- goto done;
  15185. -+ return -EINVAL;
  15186. -+ }
  15187. -+
  15188. -+ ext_key = false;
  15189. -+ if (mac_addr && (params->cipher != WLAN_CIPHER_SUITE_WEP40) &&
  15190. -+ (params->cipher != WLAN_CIPHER_SUITE_WEP104)) {
  15191. -+ brcmf_dbg(TRACE, "Ext key, mac %pM", mac_addr);
  15192. -+ ext_key = true;
  15193. - }
  15194. -+
  15195. -+ key = &ifp->vif->profile.key[key_idx];
  15196. -+ memset(key, 0, sizeof(*key));
  15197. -+ if ((ext_key) && (!is_multicast_ether_addr(mac_addr)))
  15198. -+ memcpy((char *)&key->ea, (void *)mac_addr, ETH_ALEN);
  15199. - key->len = params->key_len;
  15200. - key->index = key_idx;
  15201. --
  15202. - memcpy(key->data, params->key, key->len);
  15203. -+ if (!ext_key)
  15204. -+ key->flags = BRCMF_PRIMARY_KEY;
  15205. -
  15206. -- key->flags = BRCMF_PRIMARY_KEY;
  15207. - switch (params->cipher) {
  15208. - case WLAN_CIPHER_SUITE_WEP40:
  15209. - key->algo = CRYPTO_ALGO_WEP1;
  15210. -@@ -2237,7 +2193,7 @@ brcmf_cfg80211_add_key(struct wiphy *wip
  15211. - }
  15212. -
  15213. - err = send_key_to_dongle(ifp, key);
  15214. -- if (err)
  15215. -+ if (ext_key || err)
  15216. - goto done;
  15217. -
  15218. - err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
  15219. -@@ -2256,38 +2212,6 @@ done:
  15220. - brcmf_dbg(TRACE, "Exit\n");
  15221. - return err;
  15222. - }
  15223. --
  15224. --static s32
  15225. --brcmf_cfg80211_del_key(struct wiphy *wiphy, struct net_device *ndev,
  15226. -- u8 key_idx, bool pairwise, const u8 *mac_addr)
  15227. --{
  15228. -- struct brcmf_if *ifp = netdev_priv(ndev);
  15229. -- struct brcmf_wsec_key key;
  15230. -- s32 err = 0;
  15231. --
  15232. -- brcmf_dbg(TRACE, "Enter\n");
  15233. -- if (!check_vif_up(ifp->vif))
  15234. -- return -EIO;
  15235. --
  15236. -- if (key_idx >= BRCMF_MAX_DEFAULT_KEYS) {
  15237. -- /* we ignore this key index in this case */
  15238. -- return -EINVAL;
  15239. -- }
  15240. --
  15241. -- memset(&key, 0, sizeof(key));
  15242. --
  15243. -- key.index = (u32) key_idx;
  15244. -- key.flags = BRCMF_PRIMARY_KEY;
  15245. -- key.algo = CRYPTO_ALGO_OFF;
  15246. --
  15247. -- brcmf_dbg(CONN, "key index (%d)\n", key_idx);
  15248. --
  15249. -- /* Set the new key/index */
  15250. -- err = send_key_to_dongle(ifp, &key);
  15251. --
  15252. -- brcmf_dbg(TRACE, "Exit\n");
  15253. -- return err;
  15254. --}
  15255. -
  15256. - static s32
  15257. - brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev,
  15258. diff --git a/package/kernel/mac80211/patches/344-0020-brcmfmac-add-802.11w-management-frame-protection-sup.patch b/package/kernel/mac80211/patches/344-0020-brcmfmac-add-802.11w-management-frame-protection-sup.patch
  15259. deleted file mode 100644
  15260. index c20d40c..0000000
  15261. --- a/package/kernel/mac80211/patches/344-0020-brcmfmac-add-802.11w-management-frame-protection-sup.patch
  15262. +++ /dev/null
  15263. @@ -1,509 +0,0 @@
  15264. -From: Hante Meuleman <hante.meuleman@broadcom.com>
  15265. -Date: Wed, 17 Feb 2016 11:27:10 +0100
  15266. -Subject: [PATCH] brcmfmac: add 802.11w management frame protection support
  15267. -
  15268. -Add full support for both AP and STA for management frame protection.
  15269. -
  15270. -Reviewed-by: Arend Van Spriel <arend.van@broadcom.com>
  15271. -Reviewed-by: Franky (Zhenhui) Lin <franky.lin@broadcom.com>
  15272. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  15273. -Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
  15274. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15275. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15276. ----
  15277. -
  15278. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  15279. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  15280. -@@ -72,8 +72,13 @@
  15281. - #define RSN_AKM_NONE 0 /* None (IBSS) */
  15282. - #define RSN_AKM_UNSPECIFIED 1 /* Over 802.1x */
  15283. - #define RSN_AKM_PSK 2 /* Pre-shared Key */
  15284. -+#define RSN_AKM_SHA256_1X 5 /* SHA256, 802.1X */
  15285. -+#define RSN_AKM_SHA256_PSK 6 /* SHA256, Pre-shared Key */
  15286. - #define RSN_CAP_LEN 2 /* Length of RSN capabilities */
  15287. --#define RSN_CAP_PTK_REPLAY_CNTR_MASK 0x000C
  15288. -+#define RSN_CAP_PTK_REPLAY_CNTR_MASK (BIT(2) | BIT(3))
  15289. -+#define RSN_CAP_MFPR_MASK BIT(6)
  15290. -+#define RSN_CAP_MFPC_MASK BIT(7)
  15291. -+#define RSN_PMKID_COUNT_LEN 2
  15292. -
  15293. - #define VNDR_IE_CMD_LEN 4 /* length of the set command
  15294. - * string :"add", "del" (+ NUL)
  15295. -@@ -211,12 +216,19 @@ static const struct ieee80211_regdomain
  15296. - REG_RULE(5470-10, 5850+10, 80, 6, 20, 0), }
  15297. - };
  15298. -
  15299. --static const u32 __wl_cipher_suites[] = {
  15300. -+/* Note: brcmf_cipher_suites is an array of int defining which cipher suites
  15301. -+ * are supported. A pointer to this array and the number of entries is passed
  15302. -+ * on to upper layers. AES_CMAC defines whether or not the driver supports MFP.
  15303. -+ * So the cipher suite AES_CMAC has to be the last one in the array, and when
  15304. -+ * device does not support MFP then the number of suites will be decreased by 1
  15305. -+ */
  15306. -+static const u32 brcmf_cipher_suites[] = {
  15307. - WLAN_CIPHER_SUITE_WEP40,
  15308. - WLAN_CIPHER_SUITE_WEP104,
  15309. - WLAN_CIPHER_SUITE_TKIP,
  15310. - WLAN_CIPHER_SUITE_CCMP,
  15311. -- WLAN_CIPHER_SUITE_AES_CMAC,
  15312. -+ /* Keep as last entry: */
  15313. -+ WLAN_CIPHER_SUITE_AES_CMAC
  15314. - };
  15315. -
  15316. - /* Vendor specific ie. id = 221, oui and type defines exact ie */
  15317. -@@ -1533,7 +1545,7 @@ static s32 brcmf_set_auth_type(struct ne
  15318. -
  15319. - static s32
  15320. - brcmf_set_wsec_mode(struct net_device *ndev,
  15321. -- struct cfg80211_connect_params *sme, bool mfp)
  15322. -+ struct cfg80211_connect_params *sme)
  15323. - {
  15324. - struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
  15325. - struct brcmf_cfg80211_security *sec;
  15326. -@@ -1592,10 +1604,7 @@ brcmf_set_wsec_mode(struct net_device *n
  15327. - sme->privacy)
  15328. - pval = AES_ENABLED;
  15329. -
  15330. -- if (mfp)
  15331. -- wsec = pval | gval | MFP_CAPABLE;
  15332. -- else
  15333. -- wsec = pval | gval;
  15334. -+ wsec = pval | gval;
  15335. - err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "wsec", wsec);
  15336. - if (err) {
  15337. - brcmf_err("error (%d)\n", err);
  15338. -@@ -1612,56 +1621,100 @@ brcmf_set_wsec_mode(struct net_device *n
  15339. - static s32
  15340. - brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme)
  15341. - {
  15342. -- struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
  15343. -- struct brcmf_cfg80211_security *sec;
  15344. -- s32 val = 0;
  15345. -- s32 err = 0;
  15346. -+ struct brcmf_if *ifp = netdev_priv(ndev);
  15347. -+ s32 val;
  15348. -+ s32 err;
  15349. -+ const struct brcmf_tlv *rsn_ie;
  15350. -+ const u8 *ie;
  15351. -+ u32 ie_len;
  15352. -+ u32 offset;
  15353. -+ u16 rsn_cap;
  15354. -+ u32 mfp;
  15355. -+ u16 count;
  15356. -
  15357. -- if (sme->crypto.n_akm_suites) {
  15358. -- err = brcmf_fil_bsscfg_int_get(netdev_priv(ndev),
  15359. -- "wpa_auth", &val);
  15360. -- if (err) {
  15361. -- brcmf_err("could not get wpa_auth (%d)\n", err);
  15362. -- return err;
  15363. -+ if (!sme->crypto.n_akm_suites)
  15364. -+ return 0;
  15365. -+
  15366. -+ err = brcmf_fil_bsscfg_int_get(netdev_priv(ndev), "wpa_auth", &val);
  15367. -+ if (err) {
  15368. -+ brcmf_err("could not get wpa_auth (%d)\n", err);
  15369. -+ return err;
  15370. -+ }
  15371. -+ if (val & (WPA_AUTH_PSK | WPA_AUTH_UNSPECIFIED)) {
  15372. -+ switch (sme->crypto.akm_suites[0]) {
  15373. -+ case WLAN_AKM_SUITE_8021X:
  15374. -+ val = WPA_AUTH_UNSPECIFIED;
  15375. -+ break;
  15376. -+ case WLAN_AKM_SUITE_PSK:
  15377. -+ val = WPA_AUTH_PSK;
  15378. -+ break;
  15379. -+ default:
  15380. -+ brcmf_err("invalid cipher group (%d)\n",
  15381. -+ sme->crypto.cipher_group);
  15382. -+ return -EINVAL;
  15383. - }
  15384. -- if (val & (WPA_AUTH_PSK | WPA_AUTH_UNSPECIFIED)) {
  15385. -- switch (sme->crypto.akm_suites[0]) {
  15386. -- case WLAN_AKM_SUITE_8021X:
  15387. -- val = WPA_AUTH_UNSPECIFIED;
  15388. -- break;
  15389. -- case WLAN_AKM_SUITE_PSK:
  15390. -- val = WPA_AUTH_PSK;
  15391. -- break;
  15392. -- default:
  15393. -- brcmf_err("invalid cipher group (%d)\n",
  15394. -- sme->crypto.cipher_group);
  15395. -- return -EINVAL;
  15396. -- }
  15397. -- } else if (val & (WPA2_AUTH_PSK | WPA2_AUTH_UNSPECIFIED)) {
  15398. -- switch (sme->crypto.akm_suites[0]) {
  15399. -- case WLAN_AKM_SUITE_8021X:
  15400. -- val = WPA2_AUTH_UNSPECIFIED;
  15401. -- break;
  15402. -- case WLAN_AKM_SUITE_PSK:
  15403. -- val = WPA2_AUTH_PSK;
  15404. -- break;
  15405. -- default:
  15406. -- brcmf_err("invalid cipher group (%d)\n",
  15407. -- sme->crypto.cipher_group);
  15408. -- return -EINVAL;
  15409. -- }
  15410. -+ } else if (val & (WPA2_AUTH_PSK | WPA2_AUTH_UNSPECIFIED)) {
  15411. -+ switch (sme->crypto.akm_suites[0]) {
  15412. -+ case WLAN_AKM_SUITE_8021X:
  15413. -+ val = WPA2_AUTH_UNSPECIFIED;
  15414. -+ break;
  15415. -+ case WLAN_AKM_SUITE_8021X_SHA256:
  15416. -+ val = WPA2_AUTH_1X_SHA256;
  15417. -+ break;
  15418. -+ case WLAN_AKM_SUITE_PSK_SHA256:
  15419. -+ val = WPA2_AUTH_PSK_SHA256;
  15420. -+ break;
  15421. -+ case WLAN_AKM_SUITE_PSK:
  15422. -+ val = WPA2_AUTH_PSK;
  15423. -+ break;
  15424. -+ default:
  15425. -+ brcmf_err("invalid cipher group (%d)\n",
  15426. -+ sme->crypto.cipher_group);
  15427. -+ return -EINVAL;
  15428. - }
  15429. -+ }
  15430. -
  15431. -- brcmf_dbg(CONN, "setting wpa_auth to %d\n", val);
  15432. -- err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev),
  15433. -- "wpa_auth", val);
  15434. -- if (err) {
  15435. -- brcmf_err("could not set wpa_auth (%d)\n", err);
  15436. -- return err;
  15437. -- }
  15438. -+ if (!brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MFP))
  15439. -+ goto skip_mfp_config;
  15440. -+ /* The MFP mode (1 or 2) needs to be determined, parse IEs. The
  15441. -+ * IE will not be verified, just a quick search for MFP config
  15442. -+ */
  15443. -+ rsn_ie = brcmf_parse_tlvs((const u8 *)sme->ie, sme->ie_len,
  15444. -+ WLAN_EID_RSN);
  15445. -+ if (!rsn_ie)
  15446. -+ goto skip_mfp_config;
  15447. -+ ie = (const u8 *)rsn_ie;
  15448. -+ ie_len = rsn_ie->len + TLV_HDR_LEN;
  15449. -+ /* Skip unicast suite */
  15450. -+ offset = TLV_HDR_LEN + WPA_IE_VERSION_LEN + WPA_IE_MIN_OUI_LEN;
  15451. -+ if (offset + WPA_IE_SUITE_COUNT_LEN >= ie_len)
  15452. -+ goto skip_mfp_config;
  15453. -+ /* Skip multicast suite */
  15454. -+ count = ie[offset] + (ie[offset + 1] << 8);
  15455. -+ offset += WPA_IE_SUITE_COUNT_LEN + (count * WPA_IE_MIN_OUI_LEN);
  15456. -+ if (offset + WPA_IE_SUITE_COUNT_LEN >= ie_len)
  15457. -+ goto skip_mfp_config;
  15458. -+ /* Skip auth key management suite(s) */
  15459. -+ count = ie[offset] + (ie[offset + 1] << 8);
  15460. -+ offset += WPA_IE_SUITE_COUNT_LEN + (count * WPA_IE_MIN_OUI_LEN);
  15461. -+ if (offset + WPA_IE_SUITE_COUNT_LEN > ie_len)
  15462. -+ goto skip_mfp_config;
  15463. -+ /* Ready to read capabilities */
  15464. -+ mfp = BRCMF_MFP_NONE;
  15465. -+ rsn_cap = ie[offset] + (ie[offset + 1] << 8);
  15466. -+ if (rsn_cap & RSN_CAP_MFPR_MASK)
  15467. -+ mfp = BRCMF_MFP_REQUIRED;
  15468. -+ else if (rsn_cap & RSN_CAP_MFPC_MASK)
  15469. -+ mfp = BRCMF_MFP_CAPABLE;
  15470. -+ brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "mfp", mfp);
  15471. -+
  15472. -+skip_mfp_config:
  15473. -+ brcmf_dbg(CONN, "setting wpa_auth to %d\n", val);
  15474. -+ err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "wpa_auth", val);
  15475. -+ if (err) {
  15476. -+ brcmf_err("could not set wpa_auth (%d)\n", err);
  15477. -+ return err;
  15478. - }
  15479. -- sec = &profile->sec;
  15480. -- sec->wpa_auth = sme->crypto.akm_suites[0];
  15481. -
  15482. - return err;
  15483. - }
  15484. -@@ -1827,7 +1880,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
  15485. - goto done;
  15486. - }
  15487. -
  15488. -- err = brcmf_set_wsec_mode(ndev, sme, sme->mfp == NL80211_MFP_REQUIRED);
  15489. -+ err = brcmf_set_wsec_mode(ndev, sme);
  15490. - if (err) {
  15491. - brcmf_err("wl_set_set_cipher failed (%d)\n", err);
  15492. - goto done;
  15493. -@@ -2077,10 +2130,12 @@ brcmf_cfg80211_del_key(struct wiphy *wip
  15494. - u8 key_idx, bool pairwise, const u8 *mac_addr)
  15495. - {
  15496. - struct brcmf_if *ifp = netdev_priv(ndev);
  15497. -- struct brcmf_wsec_key key;
  15498. -- s32 err = 0;
  15499. -+ struct brcmf_wsec_key *key;
  15500. -+ s32 err;
  15501. -
  15502. - brcmf_dbg(TRACE, "Enter\n");
  15503. -+ brcmf_dbg(CONN, "key index (%d)\n", key_idx);
  15504. -+
  15505. - if (!check_vif_up(ifp->vif))
  15506. - return -EIO;
  15507. -
  15508. -@@ -2089,16 +2144,19 @@ brcmf_cfg80211_del_key(struct wiphy *wip
  15509. - return -EINVAL;
  15510. - }
  15511. -
  15512. -- memset(&key, 0, sizeof(key));
  15513. -+ key = &ifp->vif->profile.key[key_idx];
  15514. -
  15515. -- key.index = (u32)key_idx;
  15516. -- key.flags = BRCMF_PRIMARY_KEY;
  15517. -- key.algo = CRYPTO_ALGO_OFF;
  15518. -+ if (key->algo == CRYPTO_ALGO_OFF) {
  15519. -+ brcmf_dbg(CONN, "Ignore clearing of (never configured) key\n");
  15520. -+ return -EINVAL;
  15521. -+ }
  15522. -
  15523. -- brcmf_dbg(CONN, "key index (%d)\n", key_idx);
  15524. -+ memset(key, 0, sizeof(*key));
  15525. -+ key->index = (u32)key_idx;
  15526. -+ key->flags = BRCMF_PRIMARY_KEY;
  15527. -
  15528. -- /* Set the new key/index */
  15529. -- err = send_key_to_dongle(ifp, &key);
  15530. -+ /* Clear the key/index */
  15531. -+ err = send_key_to_dongle(ifp, key);
  15532. -
  15533. - brcmf_dbg(TRACE, "Exit\n");
  15534. - return err;
  15535. -@@ -2106,8 +2164,8 @@ brcmf_cfg80211_del_key(struct wiphy *wip
  15536. -
  15537. - static s32
  15538. - brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,
  15539. -- u8 key_idx, bool pairwise, const u8 *mac_addr,
  15540. -- struct key_params *params)
  15541. -+ u8 key_idx, bool pairwise, const u8 *mac_addr,
  15542. -+ struct key_params *params)
  15543. - {
  15544. - struct brcmf_if *ifp = netdev_priv(ndev);
  15545. - struct brcmf_wsec_key *key;
  15546. -@@ -2214,9 +2272,10 @@ done:
  15547. - }
  15548. -
  15549. - static s32
  15550. --brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev,
  15551. -- u8 key_idx, bool pairwise, const u8 *mac_addr, void *cookie,
  15552. -- void (*callback) (void *cookie, struct key_params * params))
  15553. -+brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev, u8 key_idx,
  15554. -+ bool pairwise, const u8 *mac_addr, void *cookie,
  15555. -+ void (*callback)(void *cookie,
  15556. -+ struct key_params *params))
  15557. - {
  15558. - struct key_params params;
  15559. - struct brcmf_if *ifp = netdev_priv(ndev);
  15560. -@@ -2268,8 +2327,15 @@ done:
  15561. -
  15562. - static s32
  15563. - brcmf_cfg80211_config_default_mgmt_key(struct wiphy *wiphy,
  15564. -- struct net_device *ndev, u8 key_idx)
  15565. -+ struct net_device *ndev, u8 key_idx)
  15566. - {
  15567. -+ struct brcmf_if *ifp = netdev_priv(ndev);
  15568. -+
  15569. -+ brcmf_dbg(TRACE, "Enter key_idx %d\n", key_idx);
  15570. -+
  15571. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MFP))
  15572. -+ return 0;
  15573. -+
  15574. - brcmf_dbg(INFO, "Not supported\n");
  15575. -
  15576. - return -EOPNOTSUPP;
  15577. -@@ -3769,7 +3835,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
  15578. - u32 auth = 0; /* d11 open authentication */
  15579. - u16 count;
  15580. - s32 err = 0;
  15581. -- s32 len = 0;
  15582. -+ s32 len;
  15583. - u32 i;
  15584. - u32 wsec;
  15585. - u32 pval = 0;
  15586. -@@ -3779,6 +3845,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
  15587. - u8 *data;
  15588. - u16 rsn_cap;
  15589. - u32 wme_bss_disable;
  15590. -+ u32 mfp;
  15591. -
  15592. - brcmf_dbg(TRACE, "Enter\n");
  15593. - if (wpa_ie == NULL)
  15594. -@@ -3893,19 +3960,53 @@ brcmf_configure_wpaie(struct brcmf_if *i
  15595. - is_rsn_ie ? (wpa_auth |= WPA2_AUTH_PSK) :
  15596. - (wpa_auth |= WPA_AUTH_PSK);
  15597. - break;
  15598. -+ case RSN_AKM_SHA256_PSK:
  15599. -+ brcmf_dbg(TRACE, "RSN_AKM_MFP_PSK\n");
  15600. -+ wpa_auth |= WPA2_AUTH_PSK_SHA256;
  15601. -+ break;
  15602. -+ case RSN_AKM_SHA256_1X:
  15603. -+ brcmf_dbg(TRACE, "RSN_AKM_MFP_1X\n");
  15604. -+ wpa_auth |= WPA2_AUTH_1X_SHA256;
  15605. -+ break;
  15606. - default:
  15607. - brcmf_err("Ivalid key mgmt info\n");
  15608. - }
  15609. - offset++;
  15610. - }
  15611. -
  15612. -+ mfp = BRCMF_MFP_NONE;
  15613. - if (is_rsn_ie) {
  15614. - wme_bss_disable = 1;
  15615. - if ((offset + RSN_CAP_LEN) <= len) {
  15616. - rsn_cap = data[offset] + (data[offset + 1] << 8);
  15617. - if (rsn_cap & RSN_CAP_PTK_REPLAY_CNTR_MASK)
  15618. - wme_bss_disable = 0;
  15619. -+ if (rsn_cap & RSN_CAP_MFPR_MASK) {
  15620. -+ brcmf_dbg(TRACE, "MFP Required\n");
  15621. -+ mfp = BRCMF_MFP_REQUIRED;
  15622. -+ /* Firmware only supports mfp required in
  15623. -+ * combination with WPA2_AUTH_PSK_SHA256 or
  15624. -+ * WPA2_AUTH_1X_SHA256.
  15625. -+ */
  15626. -+ if (!(wpa_auth & (WPA2_AUTH_PSK_SHA256 |
  15627. -+ WPA2_AUTH_1X_SHA256))) {
  15628. -+ err = -EINVAL;
  15629. -+ goto exit;
  15630. -+ }
  15631. -+ /* Firmware has requirement that WPA2_AUTH_PSK/
  15632. -+ * WPA2_AUTH_UNSPECIFIED be set, if SHA256 OUI
  15633. -+ * is to be included in the rsn ie.
  15634. -+ */
  15635. -+ if (wpa_auth & WPA2_AUTH_PSK_SHA256)
  15636. -+ wpa_auth |= WPA2_AUTH_PSK;
  15637. -+ else if (wpa_auth & WPA2_AUTH_1X_SHA256)
  15638. -+ wpa_auth |= WPA2_AUTH_UNSPECIFIED;
  15639. -+ } else if (rsn_cap & RSN_CAP_MFPC_MASK) {
  15640. -+ brcmf_dbg(TRACE, "MFP Capable\n");
  15641. -+ mfp = BRCMF_MFP_CAPABLE;
  15642. -+ }
  15643. - }
  15644. -+ offset += RSN_CAP_LEN;
  15645. - /* set wme_bss_disable to sync RSN Capabilities */
  15646. - err = brcmf_fil_bsscfg_int_set(ifp, "wme_bss_disable",
  15647. - wme_bss_disable);
  15648. -@@ -3913,6 +4014,21 @@ brcmf_configure_wpaie(struct brcmf_if *i
  15649. - brcmf_err("wme_bss_disable error %d\n", err);
  15650. - goto exit;
  15651. - }
  15652. -+
  15653. -+ /* Skip PMKID cnt as it is know to be 0 for AP. */
  15654. -+ offset += RSN_PMKID_COUNT_LEN;
  15655. -+
  15656. -+ /* See if there is BIP wpa suite left for MFP */
  15657. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MFP) &&
  15658. -+ ((offset + WPA_IE_MIN_OUI_LEN) <= len)) {
  15659. -+ err = brcmf_fil_bsscfg_data_set(ifp, "bip",
  15660. -+ &data[offset],
  15661. -+ WPA_IE_MIN_OUI_LEN);
  15662. -+ if (err < 0) {
  15663. -+ brcmf_err("bip error %d\n", err);
  15664. -+ goto exit;
  15665. -+ }
  15666. -+ }
  15667. - }
  15668. - /* FOR WPS , set SES_OW_ENABLED */
  15669. - wsec = (pval | gval | SES_OW_ENABLED);
  15670. -@@ -3929,6 +4045,16 @@ brcmf_configure_wpaie(struct brcmf_if *i
  15671. - brcmf_err("wsec error %d\n", err);
  15672. - goto exit;
  15673. - }
  15674. -+ /* Configure MFP, this needs to go after wsec otherwise the wsec command
  15675. -+ * will overwrite the values set by MFP
  15676. -+ */
  15677. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MFP)) {
  15678. -+ err = brcmf_fil_bsscfg_int_set(ifp, "mfp", mfp);
  15679. -+ if (err < 0) {
  15680. -+ brcmf_err("mfp error %d\n", err);
  15681. -+ goto exit;
  15682. -+ }
  15683. -+ }
  15684. - /* set upper-layer auth */
  15685. - err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", wpa_auth);
  15686. - if (err < 0) {
  15687. -@@ -6149,8 +6275,10 @@ static int brcmf_setup_wiphy(struct wiph
  15688. - wiphy->n_addresses = i;
  15689. -
  15690. - wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
  15691. -- wiphy->cipher_suites = __wl_cipher_suites;
  15692. -- wiphy->n_cipher_suites = ARRAY_SIZE(__wl_cipher_suites);
  15693. -+ wiphy->cipher_suites = brcmf_cipher_suites;
  15694. -+ wiphy->n_cipher_suites = ARRAY_SIZE(brcmf_cipher_suites);
  15695. -+ if (!brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MFP))
  15696. -+ wiphy->n_cipher_suites--;
  15697. - wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT |
  15698. - WIPHY_FLAG_OFFCHAN_TX |
  15699. - WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
  15700. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  15701. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  15702. -@@ -72,7 +72,7 @@
  15703. -
  15704. - #define BRCMF_VNDR_IE_P2PAF_SHIFT 12
  15705. -
  15706. --#define BRCMF_MAX_DEFAULT_KEYS 4
  15707. -+#define BRCMF_MAX_DEFAULT_KEYS 6
  15708. -
  15709. - /* beacon loss timeout defaults */
  15710. - #define BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_ON 2
  15711. -@@ -107,7 +107,6 @@ struct brcmf_cfg80211_security {
  15712. - u32 auth_type;
  15713. - u32 cipher_pairwise;
  15714. - u32 cipher_group;
  15715. -- u32 wpa_auth;
  15716. - };
  15717. -
  15718. - /**
  15719. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
  15720. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
  15721. -@@ -161,6 +161,7 @@ void brcmf_feat_attach(struct brcmf_pub
  15722. - ifp->drvr->feat_flags &= ~BIT(BRCMF_FEAT_MBSS);
  15723. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_RSDB, "rsdb_mode");
  15724. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_TDLS, "tdls_enable");
  15725. -+ brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_MFP, "mfp");
  15726. -
  15727. - pfn_mac.version = BRCMF_PFN_MACADDR_CFG_VER;
  15728. - err = brcmf_fil_iovar_data_get(ifp, "pfn_macaddr", &pfn_mac,
  15729. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h
  15730. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h
  15731. -@@ -30,6 +30,7 @@
  15732. - * WOWL_ND: WOWL net detect (PNO)
  15733. - * WOWL_GTK: (WOWL) GTK rekeying offload
  15734. - * WOWL_ARP_ND: ARP and Neighbor Discovery offload support during WOWL.
  15735. -+ * MFP: 802.11w Management Frame Protection.
  15736. - */
  15737. - #define BRCMF_FEAT_LIST \
  15738. - BRCMF_FEAT_DEF(MBSS) \
  15739. -@@ -42,7 +43,8 @@
  15740. - BRCMF_FEAT_DEF(SCAN_RANDOM_MAC) \
  15741. - BRCMF_FEAT_DEF(WOWL_ND) \
  15742. - BRCMF_FEAT_DEF(WOWL_GTK) \
  15743. -- BRCMF_FEAT_DEF(WOWL_ARP_ND)
  15744. -+ BRCMF_FEAT_DEF(WOWL_ARP_ND) \
  15745. -+ BRCMF_FEAT_DEF(MFP)
  15746. -
  15747. - /*
  15748. - * Quirks:
  15749. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h
  15750. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h
  15751. -@@ -142,6 +142,10 @@
  15752. - #define BRCMF_RSN_KEK_LENGTH 16
  15753. - #define BRCMF_RSN_REPLAY_LEN 8
  15754. -
  15755. -+#define BRCMF_MFP_NONE 0
  15756. -+#define BRCMF_MFP_CAPABLE 1
  15757. -+#define BRCMF_MFP_REQUIRED 2
  15758. -+
  15759. - /* join preference types for join_pref iovar */
  15760. - enum brcmf_join_pref_types {
  15761. - BRCMF_JOIN_PREF_RSSI = 1,
  15762. ---- a/drivers/net/wireless/broadcom/brcm80211/include/brcmu_wifi.h
  15763. -+++ b/drivers/net/wireless/broadcom/brcm80211/include/brcmu_wifi.h
  15764. -@@ -236,6 +236,8 @@ static inline bool ac_bitmap_tst(u8 bitm
  15765. - #define WPA2_AUTH_RESERVED3 0x0200
  15766. - #define WPA2_AUTH_RESERVED4 0x0400
  15767. - #define WPA2_AUTH_RESERVED5 0x0800
  15768. -+#define WPA2_AUTH_1X_SHA256 0x1000 /* 1X with SHA256 key derivation */
  15769. -+#define WPA2_AUTH_PSK_SHA256 0x8000 /* PSK with SHA256 key derivation */
  15770. -
  15771. - #define DOT11_DEFAULT_RTS_LEN 2347
  15772. - #define DOT11_DEFAULT_FRAG_LEN 2346
  15773. diff --git a/package/kernel/mac80211/patches/344-mac80211-send-delBA-on-unexpected-BlockAck-data-fram.patch b/package/kernel/mac80211/patches/344-mac80211-send-delBA-on-unexpected-BlockAck-data-fram.patch
  15774. new file mode 100644
  15775. index 0000000..3bbca22
  15776. --- /dev/null
  15777. +++ b/package/kernel/mac80211/patches/344-mac80211-send-delBA-on-unexpected-BlockAck-data-fram.patch
  15778. @@ -0,0 +1,64 @@
  15779. +From: Johannes Berg <johannes.berg@intel.com>
  15780. +Date: Mon, 29 Aug 2016 23:25:18 +0300
  15781. +Subject: [PATCH] mac80211: send delBA on unexpected BlockAck data frames
  15782. +
  15783. +When we receive data frames with ACK policy BlockAck, send
  15784. +delBA as requested by the 802.11 spec. Since this would be
  15785. +happening for every frame inside an A-MPDU if it's really
  15786. +received outside a session, limit it to a single attempt.
  15787. +
  15788. +Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  15789. +---
  15790. +
  15791. +--- a/net/mac80211/agg-rx.c
  15792. ++++ b/net/mac80211/agg-rx.c
  15793. +@@ -388,8 +388,10 @@ void __ieee80211_start_rx_ba_session(str
  15794. + }
  15795. +
  15796. + end:
  15797. +- if (status == WLAN_STATUS_SUCCESS)
  15798. ++ if (status == WLAN_STATUS_SUCCESS) {
  15799. + __set_bit(tid, sta->ampdu_mlme.agg_session_valid);
  15800. ++ __clear_bit(tid, sta->ampdu_mlme.unexpected_agg);
  15801. ++ }
  15802. + mutex_unlock(&sta->ampdu_mlme.mtx);
  15803. +
  15804. + end_no_lock:
  15805. +--- a/net/mac80211/rx.c
  15806. ++++ b/net/mac80211/rx.c
  15807. +@@ -1072,8 +1072,15 @@ static void ieee80211_rx_reorder_ampdu(s
  15808. + tid = *ieee80211_get_qos_ctl(hdr) & IEEE80211_QOS_CTL_TID_MASK;
  15809. +
  15810. + tid_agg_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[tid]);
  15811. +- if (!tid_agg_rx)
  15812. ++ if (!tid_agg_rx) {
  15813. ++ if (ack_policy == IEEE80211_QOS_CTL_ACK_POLICY_BLOCKACK &&
  15814. ++ !test_bit(tid, rx->sta->ampdu_mlme.agg_session_valid) &&
  15815. ++ !test_and_set_bit(tid, rx->sta->ampdu_mlme.unexpected_agg))
  15816. ++ ieee80211_send_delba(rx->sdata, rx->sta->sta.addr, tid,
  15817. ++ WLAN_BACK_RECIPIENT,
  15818. ++ WLAN_REASON_QSTA_REQUIRE_SETUP);
  15819. + goto dont_reorder;
  15820. ++ }
  15821. +
  15822. + /* qos null data frames are excluded */
  15823. + if (unlikely(hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_NULLFUNC)))
  15824. +--- a/net/mac80211/sta_info.h
  15825. ++++ b/net/mac80211/sta_info.h
  15826. +@@ -230,6 +230,8 @@ struct tid_ampdu_rx {
  15827. + * @tid_rx_stop_requested: bitmap indicating which BA sessions per TID the
  15828. + * driver requested to close until the work for it runs
  15829. + * @agg_session_valid: bitmap indicating which TID has a rx BA session open on
  15830. ++ * @unexpected_agg: bitmap indicating which TID already sent a delBA due to
  15831. ++ * unexpected aggregation related frames outside a session
  15832. + * @work: work struct for starting/stopping aggregation
  15833. + * @tid_tx: aggregation info for Tx per TID
  15834. + * @tid_start_tx: sessions where start was requested
  15835. +@@ -244,6 +246,7 @@ struct sta_ampdu_mlme {
  15836. + unsigned long tid_rx_timer_expired[BITS_TO_LONGS(IEEE80211_NUM_TIDS)];
  15837. + unsigned long tid_rx_stop_requested[BITS_TO_LONGS(IEEE80211_NUM_TIDS)];
  15838. + unsigned long agg_session_valid[BITS_TO_LONGS(IEEE80211_NUM_TIDS)];
  15839. ++ unsigned long unexpected_agg[BITS_TO_LONGS(IEEE80211_NUM_TIDS)];
  15840. + /* tx */
  15841. + struct work_struct work;
  15842. + struct tid_ampdu_tx __rcu *tid_tx[IEEE80211_NUM_TIDS];
  15843. diff --git a/package/kernel/mac80211/patches/345-brcmfmac-Remove-waitqueue_active-check.patch b/package/kernel/mac80211/patches/345-brcmfmac-Remove-waitqueue_active-check.patch
  15844. deleted file mode 100644
  15845. index 39f4383..0000000
  15846. --- a/package/kernel/mac80211/patches/345-brcmfmac-Remove-waitqueue_active-check.patch
  15847. +++ /dev/null
  15848. @@ -1,54 +0,0 @@
  15849. -From: Hui Wang <hui.wang@canonical.com>
  15850. -Date: Wed, 9 Mar 2016 15:25:26 +0800
  15851. -Subject: [PATCH] brcmfmac: Remove waitqueue_active check
  15852. -
  15853. -We met a problem of pm_suspend when repeated closing/opening the lid
  15854. -on a Lenovo laptop (1/20 reproduce rate), below is the log:
  15855. -
  15856. -[ 199.735876] PM: Entering mem sleep
  15857. -[ 199.750516] e1000e: EEE TX LPI TIMER: 00000011
  15858. -[ 199.856638] Trying to free nonexistent resource <000000000000d000-000000000000d0ff>
  15859. -[ 201.753566] brcmfmac: brcmf_pcie_suspend: Timeout on response for entering D3 substate
  15860. -[ 201.753581] pci_legacy_suspend(): brcmf_pcie_suspend+0x0/0x1f0 [brcmfmac] returns -5
  15861. -[ 201.753585] dpm_run_callback(): pci_pm_suspend+0x0/0x160 returns -5
  15862. -[ 201.753589] PM: Device 0000:04:00.0 failed to suspend async: error -5
  15863. -
  15864. -Through debugging, we found when problem happens, it is not the device
  15865. -fails to enter D3, but the signal D3_ACK comes too early to pass the
  15866. -waitqueue_active() check.
  15867. -
  15868. -Just like this:
  15869. -brcmf_pcie_send_mb_data(devinfo, BRCMF_H2D_HOST_D3_INFORM);
  15870. -// signal is triggered here
  15871. -wait_event_timeout(devinfo->mbdata_resp_wait, devinfo->mbdata_completed,
  15872. - BRCMF_PCIE_MBDATA_TIMEOUT);
  15873. -
  15874. -So far I think it is safe to remove waitqueue_active check since there
  15875. -is only one place to trigger this signal (sending
  15876. -BRCMF_H2D_HOST_D3_INFORM). And it is not a problem calling wake_up
  15877. -event earlier than calling wait_event.
  15878. -
  15879. -Cc: Brett Rudley <brudley@broadcom.com>
  15880. -Cc: Hante Meuleman <meuleman@broadcom.com>
  15881. -Cc: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  15882. -Cc: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15883. -Cc: Arend van Spriel <arend@broadcom.com>
  15884. -Signed-off-by: Hui Wang <hui.wang@canonical.com>
  15885. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15886. ----
  15887. -
  15888. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  15889. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  15890. -@@ -677,10 +677,8 @@ static void brcmf_pcie_handle_mb_data(st
  15891. - brcmf_dbg(PCIE, "D2H_MB_DATA: DEEP SLEEP EXIT\n");
  15892. - if (dtoh_mb_data & BRCMF_D2H_DEV_D3_ACK) {
  15893. - brcmf_dbg(PCIE, "D2H_MB_DATA: D3 ACK\n");
  15894. -- if (waitqueue_active(&devinfo->mbdata_resp_wait)) {
  15895. -- devinfo->mbdata_completed = true;
  15896. -- wake_up(&devinfo->mbdata_resp_wait);
  15897. -- }
  15898. -+ devinfo->mbdata_completed = true;
  15899. -+ wake_up(&devinfo->mbdata_resp_wait);
  15900. - }
  15901. - }
  15902. -
  15903. diff --git a/package/kernel/mac80211/patches/345-mac80211-send-delBA-on-unexpected-BlockAck-Request.patch b/package/kernel/mac80211/patches/345-mac80211-send-delBA-on-unexpected-BlockAck-Request.patch
  15904. new file mode 100644
  15905. index 0000000..c3d3118
  15906. --- /dev/null
  15907. +++ b/package/kernel/mac80211/patches/345-mac80211-send-delBA-on-unexpected-BlockAck-Request.patch
  15908. @@ -0,0 +1,26 @@
  15909. +From: Johannes Berg <johannes.berg@intel.com>
  15910. +Date: Mon, 29 Aug 2016 23:25:19 +0300
  15911. +Subject: [PATCH] mac80211: send delBA on unexpected BlockAck Request
  15912. +
  15913. +If we don't have a BA session, send delBA, as requested by the
  15914. +IEEE 802.11 spec. Apply the same limit of sending such a delBA
  15915. +only once as in the previous patch.
  15916. +
  15917. +Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  15918. +---
  15919. +
  15920. +--- a/net/mac80211/rx.c
  15921. ++++ b/net/mac80211/rx.c
  15922. +@@ -2537,6 +2537,12 @@ ieee80211_rx_h_ctrl(struct ieee80211_rx_
  15923. +
  15924. + tid = le16_to_cpu(bar_data.control) >> 12;
  15925. +
  15926. ++ if (!test_bit(tid, rx->sta->ampdu_mlme.agg_session_valid) &&
  15927. ++ !test_and_set_bit(tid, rx->sta->ampdu_mlme.unexpected_agg))
  15928. ++ ieee80211_send_delba(rx->sdata, rx->sta->sta.addr, tid,
  15929. ++ WLAN_BACK_RECIPIENT,
  15930. ++ WLAN_REASON_QSTA_REQUIRE_SETUP);
  15931. ++
  15932. + tid_agg_rx = rcu_dereference(rx->sta->ampdu_mlme.tid_rx[tid]);
  15933. + if (!tid_agg_rx)
  15934. + return RX_DROP_MONITOR;
  15935. diff --git a/package/kernel/mac80211/patches/346-brcmfmac-uninitialized-ret-variable.patch b/package/kernel/mac80211/patches/346-brcmfmac-uninitialized-ret-variable.patch
  15936. deleted file mode 100644
  15937. index 3c9ed42..0000000
  15938. --- a/package/kernel/mac80211/patches/346-brcmfmac-uninitialized-ret-variable.patch
  15939. +++ /dev/null
  15940. @@ -1,21 +0,0 @@
  15941. -From: Dan Carpenter <dan.carpenter@oracle.com>
  15942. -Date: Tue, 15 Mar 2016 10:06:10 +0300
  15943. -Subject: [PATCH] brcmfmac: uninitialized "ret" variable
  15944. -
  15945. -There is an error path where "ret" isn't initialized.
  15946. -
  15947. -Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
  15948. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15949. ----
  15950. -
  15951. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  15952. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  15953. -@@ -250,7 +250,7 @@ static int brcmf_sdiod_request_data(stru
  15954. - u32 addr, u8 regsz, void *data, bool write)
  15955. - {
  15956. - struct sdio_func *func;
  15957. -- int ret;
  15958. -+ int ret = -EINVAL;
  15959. -
  15960. - brcmf_dbg(SDIO, "rw=%d, func=%d, addr=0x%05x, nbytes=%d\n",
  15961. - write, fn, addr, regsz);
  15962. diff --git a/package/kernel/mac80211/patches/346-mac80211-fix-sequence-number-assignment-for-PS-respo.patch b/package/kernel/mac80211/patches/346-mac80211-fix-sequence-number-assignment-for-PS-respo.patch
  15963. new file mode 100644
  15964. index 0000000..a82d12f
  15965. --- /dev/null
  15966. +++ b/package/kernel/mac80211/patches/346-mac80211-fix-sequence-number-assignment-for-PS-respo.patch
  15967. @@ -0,0 +1,107 @@
  15968. +From: Felix Fietkau <nbd@nbd.name>
  15969. +Date: Sun, 4 Sep 2016 17:46:24 +0200
  15970. +Subject: [PATCH] mac80211: fix sequence number assignment for PS response
  15971. + frames
  15972. +
  15973. +When using intermediate queues, sequence number allocation is deferred
  15974. +until dequeue. This doesn't work for PS response frames, which bypass
  15975. +those queues.
  15976. +
  15977. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  15978. +---
  15979. +
  15980. +--- a/net/mac80211/tx.c
  15981. ++++ b/net/mac80211/tx.c
  15982. +@@ -792,6 +792,36 @@ static __le16 ieee80211_tx_next_seq(stru
  15983. + return ret;
  15984. + }
  15985. +
  15986. ++static struct txq_info *ieee80211_get_txq(struct ieee80211_local *local,
  15987. ++ struct ieee80211_vif *vif,
  15988. ++ struct ieee80211_sta *pubsta,
  15989. ++ struct sk_buff *skb)
  15990. ++{
  15991. ++ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
  15992. ++ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  15993. ++ struct ieee80211_txq *txq = NULL;
  15994. ++
  15995. ++ if ((info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) ||
  15996. ++ (info->control.flags & IEEE80211_TX_CTRL_PS_RESPONSE))
  15997. ++ return NULL;
  15998. ++
  15999. ++ if (!ieee80211_is_data(hdr->frame_control))
  16000. ++ return NULL;
  16001. ++
  16002. ++ if (pubsta) {
  16003. ++ u8 tid = skb->priority & IEEE80211_QOS_CTL_TID_MASK;
  16004. ++
  16005. ++ txq = pubsta->txq[tid];
  16006. ++ } else if (vif) {
  16007. ++ txq = vif->txq;
  16008. ++ }
  16009. ++
  16010. ++ if (!txq)
  16011. ++ return NULL;
  16012. ++
  16013. ++ return to_txq_info(txq);
  16014. ++}
  16015. ++
  16016. + static ieee80211_tx_result debug_noinline
  16017. + ieee80211_tx_h_sequence(struct ieee80211_tx_data *tx)
  16018. + {
  16019. +@@ -849,7 +879,8 @@ ieee80211_tx_h_sequence(struct ieee80211
  16020. + tid = *qc & IEEE80211_QOS_CTL_TID_MASK;
  16021. + tx->sta->tx_stats.msdu[tid]++;
  16022. +
  16023. +- if (!tx->sta->sta.txq[0])
  16024. ++ if (!ieee80211_get_txq(tx->local, info->control.vif, &tx->sta->sta,
  16025. ++ tx->skb))
  16026. + hdr->seq_ctrl = ieee80211_tx_next_seq(tx->sta, tid);
  16027. +
  16028. + return TX_CONTINUE;
  16029. +@@ -1238,36 +1269,6 @@ ieee80211_tx_prepare(struct ieee80211_su
  16030. + return TX_CONTINUE;
  16031. + }
  16032. +
  16033. +-static struct txq_info *ieee80211_get_txq(struct ieee80211_local *local,
  16034. +- struct ieee80211_vif *vif,
  16035. +- struct ieee80211_sta *pubsta,
  16036. +- struct sk_buff *skb)
  16037. +-{
  16038. +- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
  16039. +- struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  16040. +- struct ieee80211_txq *txq = NULL;
  16041. +-
  16042. +- if ((info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) ||
  16043. +- (info->control.flags & IEEE80211_TX_CTRL_PS_RESPONSE))
  16044. +- return NULL;
  16045. +-
  16046. +- if (!ieee80211_is_data(hdr->frame_control))
  16047. +- return NULL;
  16048. +-
  16049. +- if (pubsta) {
  16050. +- u8 tid = skb->priority & IEEE80211_QOS_CTL_TID_MASK;
  16051. +-
  16052. +- txq = pubsta->txq[tid];
  16053. +- } else if (vif) {
  16054. +- txq = vif->txq;
  16055. +- }
  16056. +-
  16057. +- if (!txq)
  16058. +- return NULL;
  16059. +-
  16060. +- return to_txq_info(txq);
  16061. +-}
  16062. +-
  16063. + static void ieee80211_set_skb_enqueue_time(struct sk_buff *skb)
  16064. + {
  16065. + IEEE80211_SKB_CB(skb)->control.enqueue_time = codel_get_time();
  16066. +@@ -3265,7 +3266,7 @@ static bool ieee80211_xmit_fast(struct i
  16067. +
  16068. + if (hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) {
  16069. + *ieee80211_get_qos_ctl(hdr) = tid;
  16070. +- if (!sta->sta.txq[0])
  16071. ++ if (!ieee80211_get_txq(local, &sdata->vif, &sta->sta, skb))
  16072. + hdr->seq_ctrl = ieee80211_tx_next_seq(sta, tid);
  16073. + } else {
  16074. + info->flags |= IEEE80211_TX_CTL_ASSIGN_SEQ;
  16075. diff --git a/package/kernel/mac80211/patches/347-brcmfmac-sdio-remove-unused-variable-retry_limit.patch b/package/kernel/mac80211/patches/347-brcmfmac-sdio-remove-unused-variable-retry_limit.patch
  16076. deleted file mode 100644
  16077. index d1deb6e..0000000
  16078. --- a/package/kernel/mac80211/patches/347-brcmfmac-sdio-remove-unused-variable-retry_limit.patch
  16079. +++ /dev/null
  16080. @@ -1,24 +0,0 @@
  16081. -From: Colin Ian King <colin.king@canonical.com>
  16082. -Date: Sun, 20 Mar 2016 17:34:52 +0000
  16083. -Subject: [PATCH] brcmfmac: sdio: remove unused variable retry_limit
  16084. -
  16085. -retry_limit has never been used during the life of this driver, so
  16086. -we may as well remove it as it is redundant.
  16087. -
  16088. -Signed-off-by: Colin Ian King <colin.king@canonical.com>
  16089. -Reviewed-by: Julian Calaby <julian.calaby@gmail.com>
  16090. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16091. ----
  16092. -
  16093. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  16094. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  16095. -@@ -535,9 +535,6 @@ static int qcount[NUMPRIO];
  16096. -
  16097. - #define RETRYCHAN(chan) ((chan) == SDPCM_EVENT_CHANNEL)
  16098. -
  16099. --/* Retry count for register access failures */
  16100. --static const uint retry_limit = 2;
  16101. --
  16102. - /* Limit on rounding up frames */
  16103. - static const uint max_roundup = 512;
  16104. -
  16105. diff --git a/package/kernel/mac80211/patches/348-brcmfmac-Delete-unnecessary-variable-initialisation.patch b/package/kernel/mac80211/patches/348-brcmfmac-Delete-unnecessary-variable-initialisation.patch
  16106. deleted file mode 100644
  16107. index d399b26..0000000
  16108. --- a/package/kernel/mac80211/patches/348-brcmfmac-Delete-unnecessary-variable-initialisation.patch
  16109. +++ /dev/null
  16110. @@ -1,26 +0,0 @@
  16111. -From: Markus Elfring <elfring@users.sourceforge.net>
  16112. -Date: Fri, 18 Mar 2016 13:23:24 +1100
  16113. -Subject: [PATCH] brcmfmac: Delete unnecessary variable initialisation
  16114. -
  16115. -In brcmf_sdio_download_firmware(), bcmerror is set by the call to
  16116. -brcmf_sdio_download_code_file(), before it's checked in the following
  16117. -line.
  16118. -
  16119. -Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
  16120. -Acked-by: Arend van Spriel <arend@broadcom.com>
  16121. -[Rewrote commit message]
  16122. -Signed-off-by: Julian Calaby <julian.calaby@gmail.com>
  16123. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16124. ----
  16125. -
  16126. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  16127. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  16128. -@@ -3258,7 +3258,7 @@ static int brcmf_sdio_download_firmware(
  16129. - const struct firmware *fw,
  16130. - void *nvram, u32 nvlen)
  16131. - {
  16132. -- int bcmerror = -EFAULT;
  16133. -+ int bcmerror;
  16134. - u32 rstvec;
  16135. -
  16136. - sdio_claim_host(bus->sdiodev->func[1]);
  16137. diff --git a/package/kernel/mac80211/patches/349-0001-brcmfmac-clear-eventmask-array-before-using-it.patch b/package/kernel/mac80211/patches/349-0001-brcmfmac-clear-eventmask-array-before-using-it.patch
  16138. deleted file mode 100644
  16139. index 0acb4fa..0000000
  16140. --- a/package/kernel/mac80211/patches/349-0001-brcmfmac-clear-eventmask-array-before-using-it.patch
  16141. +++ /dev/null
  16142. @@ -1,27 +0,0 @@
  16143. -From: Hante Meuleman <hante.meuleman@broadcom.com>
  16144. -Date: Mon, 11 Apr 2016 11:35:21 +0200
  16145. -Subject: [PATCH] brcmfmac: clear eventmask array before using it
  16146. -
  16147. -When the event_msgs iovar is set an array is used to configure the
  16148. -enabled events. This arrays needs to nulled before configuring
  16149. -otherwise unhandled events will be enabled. This solves a problem
  16150. -where in case of wowl the host got woken by an incorrectly enabled
  16151. -event.
  16152. -
  16153. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  16154. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  16155. -Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
  16156. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16157. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16158. ----
  16159. -
  16160. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  16161. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  16162. -@@ -371,6 +371,7 @@ int brcmf_fweh_activate_events(struct br
  16163. - int i, err;
  16164. - s8 eventmask[BRCMF_EVENTING_MASK_LEN];
  16165. -
  16166. -+ memset(eventmask, 0, sizeof(eventmask));
  16167. - for (i = 0; i < BRCMF_E_LAST; i++) {
  16168. - if (ifp->drvr->fweh.evt_handler[i]) {
  16169. - brcmf_dbg(EVENT, "enable event %s\n",
  16170. diff --git a/package/kernel/mac80211/patches/349-0002-brcmfmac-fix-clearing-wowl-wake-indicators.patch b/package/kernel/mac80211/patches/349-0002-brcmfmac-fix-clearing-wowl-wake-indicators.patch
  16171. deleted file mode 100644
  16172. index 8d30678..0000000
  16173. --- a/package/kernel/mac80211/patches/349-0002-brcmfmac-fix-clearing-wowl-wake-indicators.patch
  16174. +++ /dev/null
  16175. @@ -1,27 +0,0 @@
  16176. -From: Hante Meuleman <hante.meuleman@broadcom.com>
  16177. -Date: Mon, 11 Apr 2016 11:35:22 +0200
  16178. -Subject: [PATCH] brcmfmac: fix clearing wowl wake indicators
  16179. -
  16180. -Newer firmwares require the usage of the wowl wakeind struct as size
  16181. -for the iovar to clear the wake indicators. Older firmwares do not
  16182. -care, so change the used size.
  16183. -
  16184. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  16185. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  16186. -Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
  16187. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16188. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16189. ----
  16190. -
  16191. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  16192. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  16193. -@@ -3608,7 +3608,8 @@ static void brcmf_configure_wowl(struct
  16194. - if (!test_bit(BRCMF_VIF_STATUS_CONNECTED, &ifp->vif->sme_state))
  16195. - wowl_config |= BRCMF_WOWL_UNASSOC;
  16196. -
  16197. -- brcmf_fil_iovar_data_set(ifp, "wowl_wakeind", "clear", strlen("clear"));
  16198. -+ brcmf_fil_iovar_data_set(ifp, "wowl_wakeind", "clear",
  16199. -+ sizeof(struct brcmf_wowl_wakeind_le));
  16200. - brcmf_fil_iovar_int_set(ifp, "wowl", wowl_config);
  16201. - brcmf_fil_iovar_int_set(ifp, "wowl_activate", 1);
  16202. - brcmf_bus_wowl_config(cfg->pub->bus_if, true);
  16203. diff --git a/package/kernel/mac80211/patches/349-0003-brcmfmac-insert-default-boardrev-in-nvram-data-if-mi.patch b/package/kernel/mac80211/patches/349-0003-brcmfmac-insert-default-boardrev-in-nvram-data-if-mi.patch
  16204. deleted file mode 100644
  16205. index f293401..0000000
  16206. --- a/package/kernel/mac80211/patches/349-0003-brcmfmac-insert-default-boardrev-in-nvram-data-if-mi.patch
  16207. +++ /dev/null
  16208. @@ -1,114 +0,0 @@
  16209. -From: Hante Meuleman <hante.meuleman@broadcom.com>
  16210. -Date: Mon, 11 Apr 2016 11:35:23 +0200
  16211. -Subject: [PATCH] brcmfmac: insert default boardrev in nvram data if
  16212. - missing
  16213. -
  16214. -Some nvram files/stores come without the boardrev information,
  16215. -but firmware requires this to be set. When not found in nvram then
  16216. -add a default boardrev string to the nvram data.
  16217. -
  16218. -Reported-by: Rafal Milecki <zajec5@gmail.com>
  16219. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  16220. -Reviewed-by: Franky (Zhenhui) Lin <franky.lin@broadcom.com>
  16221. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  16222. -Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
  16223. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16224. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16225. ----
  16226. -
  16227. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  16228. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  16229. -@@ -29,6 +29,7 @@
  16230. - #define BRCMF_FW_MAX_NVRAM_SIZE 64000
  16231. - #define BRCMF_FW_NVRAM_DEVPATH_LEN 19 /* devpath0=pcie/1/4/ */
  16232. - #define BRCMF_FW_NVRAM_PCIEDEV_LEN 10 /* pcie/1/4/ + \0 */
  16233. -+#define BRCMF_FW_DEFAULT_BOARDREV "boardrev=0xff"
  16234. -
  16235. - enum nvram_parser_state {
  16236. - IDLE,
  16237. -@@ -51,6 +52,7 @@ enum nvram_parser_state {
  16238. - * @entry: start position of key,value entry.
  16239. - * @multi_dev_v1: detect pcie multi device v1 (compressed).
  16240. - * @multi_dev_v2: detect pcie multi device v2.
  16241. -+ * @boardrev_found: nvram contains boardrev information.
  16242. - */
  16243. - struct nvram_parser {
  16244. - enum nvram_parser_state state;
  16245. -@@ -63,6 +65,7 @@ struct nvram_parser {
  16246. - u32 entry;
  16247. - bool multi_dev_v1;
  16248. - bool multi_dev_v2;
  16249. -+ bool boardrev_found;
  16250. - };
  16251. -
  16252. - /**
  16253. -@@ -125,6 +128,8 @@ static enum nvram_parser_state brcmf_nvr
  16254. - nvp->multi_dev_v1 = true;
  16255. - if (strncmp(&nvp->data[nvp->entry], "pcie/", 5) == 0)
  16256. - nvp->multi_dev_v2 = true;
  16257. -+ if (strncmp(&nvp->data[nvp->entry], "boardrev", 8) == 0)
  16258. -+ nvp->boardrev_found = true;
  16259. - } else if (!is_nvram_char(c) || c == ' ') {
  16260. - brcmf_dbg(INFO, "warning: ln=%d:col=%d: '=' expected, skip invalid key entry\n",
  16261. - nvp->line, nvp->column);
  16262. -@@ -284,6 +289,8 @@ static void brcmf_fw_strip_multi_v1(stru
  16263. - while (i < nvp->nvram_len) {
  16264. - if ((nvp->nvram[i] - '0' == id) && (nvp->nvram[i + 1] == ':')) {
  16265. - i += 2;
  16266. -+ if (strncmp(&nvp->nvram[i], "boardrev", 8) == 0)
  16267. -+ nvp->boardrev_found = true;
  16268. - while (nvp->nvram[i] != 0) {
  16269. - nvram[j] = nvp->nvram[i];
  16270. - i++;
  16271. -@@ -335,6 +342,8 @@ static void brcmf_fw_strip_multi_v2(stru
  16272. - while (i < nvp->nvram_len - len) {
  16273. - if (strncmp(&nvp->nvram[i], prefix, len) == 0) {
  16274. - i += len;
  16275. -+ if (strncmp(&nvp->nvram[i], "boardrev", 8) == 0)
  16276. -+ nvp->boardrev_found = true;
  16277. - while (nvp->nvram[i] != 0) {
  16278. - nvram[j] = nvp->nvram[i];
  16279. - i++;
  16280. -@@ -356,6 +365,18 @@ fail:
  16281. - nvp->nvram_len = 0;
  16282. - }
  16283. -
  16284. -+static void brcmf_fw_add_defaults(struct nvram_parser *nvp)
  16285. -+{
  16286. -+ if (nvp->boardrev_found)
  16287. -+ return;
  16288. -+
  16289. -+ memcpy(&nvp->nvram[nvp->nvram_len], &BRCMF_FW_DEFAULT_BOARDREV,
  16290. -+ strlen(BRCMF_FW_DEFAULT_BOARDREV));
  16291. -+ nvp->nvram_len += strlen(BRCMF_FW_DEFAULT_BOARDREV);
  16292. -+ nvp->nvram[nvp->nvram_len] = '\0';
  16293. -+ nvp->nvram_len++;
  16294. -+}
  16295. -+
  16296. - /* brcmf_nvram_strip :Takes a buffer of "<var>=<value>\n" lines read from a fil
  16297. - * and ending in a NUL. Removes carriage returns, empty lines, comment lines,
  16298. - * and converts newlines to NULs. Shortens buffer as needed and pads with NULs.
  16299. -@@ -377,16 +398,21 @@ static void *brcmf_fw_nvram_strip(const
  16300. - if (nvp.state == END)
  16301. - break;
  16302. - }
  16303. -- if (nvp.multi_dev_v1)
  16304. -+ if (nvp.multi_dev_v1) {
  16305. -+ nvp.boardrev_found = false;
  16306. - brcmf_fw_strip_multi_v1(&nvp, domain_nr, bus_nr);
  16307. -- else if (nvp.multi_dev_v2)
  16308. -+ } else if (nvp.multi_dev_v2) {
  16309. -+ nvp.boardrev_found = false;
  16310. - brcmf_fw_strip_multi_v2(&nvp, domain_nr, bus_nr);
  16311. -+ }
  16312. -
  16313. - if (nvp.nvram_len == 0) {
  16314. - kfree(nvp.nvram);
  16315. - return NULL;
  16316. - }
  16317. -
  16318. -+ brcmf_fw_add_defaults(&nvp);
  16319. -+
  16320. - pad = nvp.nvram_len;
  16321. - *new_length = roundup(nvp.nvram_len + 1, 4);
  16322. - while (pad != *new_length) {
  16323. diff --git a/package/kernel/mac80211/patches/349-0004-brcmfmac-fix-p2p-scan-abort-null-pointer-exception.patch b/package/kernel/mac80211/patches/349-0004-brcmfmac-fix-p2p-scan-abort-null-pointer-exception.patch
  16324. deleted file mode 100644
  16325. index ed0c83f..0000000
  16326. --- a/package/kernel/mac80211/patches/349-0004-brcmfmac-fix-p2p-scan-abort-null-pointer-exception.patch
  16327. +++ /dev/null
  16328. @@ -1,29 +0,0 @@
  16329. -From: Hante Meuleman <hante.meuleman@broadcom.com>
  16330. -Date: Mon, 11 Apr 2016 11:35:24 +0200
  16331. -Subject: [PATCH] brcmfmac: fix p2p scan abort null pointer exception
  16332. -
  16333. -When p2p connection setup is performed without having ever done an
  16334. -escan a null pointer exception can occur. This is because the ifp
  16335. -to abort scanning is taken from escan struct while it was never
  16336. -initialized. Fix this by using the primary ifp for scan abort. The
  16337. -abort should still be performed and all scan related commands are
  16338. -performed on primary ifp.
  16339. -
  16340. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  16341. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  16342. -Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
  16343. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16344. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16345. ----
  16346. -
  16347. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  16348. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  16349. -@@ -1266,7 +1266,7 @@ static void
  16350. - brcmf_p2p_stop_wait_next_action_frame(struct brcmf_cfg80211_info *cfg)
  16351. - {
  16352. - struct brcmf_p2p_info *p2p = &cfg->p2p;
  16353. -- struct brcmf_if *ifp = cfg->escan_info.ifp;
  16354. -+ struct brcmf_if *ifp = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif->ifp;
  16355. -
  16356. - if (test_bit(BRCMF_P2P_STATUS_SENDING_ACT_FRAME, &p2p->status) &&
  16357. - (test_bit(BRCMF_P2P_STATUS_ACTION_TX_COMPLETED, &p2p->status) ||
  16358. diff --git a/package/kernel/mac80211/patches/349-0005-brcmfmac-screening-firmware-event-packet.patch b/package/kernel/mac80211/patches/349-0005-brcmfmac-screening-firmware-event-packet.patch
  16359. deleted file mode 100644
  16360. index 4d26404..0000000
  16361. --- a/package/kernel/mac80211/patches/349-0005-brcmfmac-screening-firmware-event-packet.patch
  16362. +++ /dev/null
  16363. @@ -1,297 +0,0 @@
  16364. -From: Franky Lin <franky.lin@broadcom.com>
  16365. -Date: Mon, 11 Apr 2016 11:35:25 +0200
  16366. -Subject: [PATCH] brcmfmac: screening firmware event packet
  16367. -
  16368. -Firmware uses asynchronized events as a communication method to the
  16369. -host. The event packets are marked as ETH_P_LINK_CTL protocol type. For
  16370. -SDIO and PCIe bus, this kind of packets are delivered through virtual
  16371. -event channel not data channel. This patch adds a screening logic to
  16372. -make sure the event handler only processes the events coming from the
  16373. -correct channel.
  16374. -
  16375. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  16376. -Signed-off-by: Franky Lin <franky.lin@broadcom.com>
  16377. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16378. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16379. ----
  16380. -
  16381. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
  16382. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
  16383. -@@ -216,7 +216,9 @@ bool brcmf_c_prec_enq(struct device *dev
  16384. - int prec);
  16385. -
  16386. - /* Receive frame for delivery to OS. Callee disposes of rxp. */
  16387. --void brcmf_rx_frame(struct device *dev, struct sk_buff *rxp);
  16388. -+void brcmf_rx_frame(struct device *dev, struct sk_buff *rxp, bool handle_evnt);
  16389. -+/* Receive async event packet from firmware. Callee disposes of rxp. */
  16390. -+void brcmf_rx_event(struct device *dev, struct sk_buff *rxp);
  16391. -
  16392. - /* Indication from bus module regarding presence/insertion of dongle. */
  16393. - int brcmf_attach(struct device *dev, struct brcmf_mp_device *settings);
  16394. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  16395. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  16396. -@@ -311,16 +311,17 @@ void brcmf_txflowblock(struct device *de
  16397. - brcmf_fws_bus_blocked(drvr, state);
  16398. - }
  16399. -
  16400. --void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb)
  16401. -+void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb,
  16402. -+ bool handle_event)
  16403. - {
  16404. -- skb->dev = ifp->ndev;
  16405. -- skb->protocol = eth_type_trans(skb, skb->dev);
  16406. -+ skb->protocol = eth_type_trans(skb, ifp->ndev);
  16407. -
  16408. - if (skb->pkt_type == PACKET_MULTICAST)
  16409. - ifp->stats.multicast++;
  16410. -
  16411. - /* Process special event packets */
  16412. -- brcmf_fweh_process_skb(ifp->drvr, skb);
  16413. -+ if (handle_event)
  16414. -+ brcmf_fweh_process_skb(ifp->drvr, skb);
  16415. -
  16416. - if (!(ifp->ndev->flags & IFF_UP)) {
  16417. - brcmu_pkt_buf_free_skb(skb);
  16418. -@@ -381,7 +382,7 @@ static void brcmf_rxreorder_process_info
  16419. - /* validate flags and flow id */
  16420. - if (flags == 0xFF) {
  16421. - brcmf_err("invalid flags...so ignore this packet\n");
  16422. -- brcmf_netif_rx(ifp, pkt);
  16423. -+ brcmf_netif_rx(ifp, pkt, false);
  16424. - return;
  16425. - }
  16426. -
  16427. -@@ -393,7 +394,7 @@ static void brcmf_rxreorder_process_info
  16428. - if (rfi == NULL) {
  16429. - brcmf_dbg(INFO, "received flags to cleanup, but no flow (%d) yet\n",
  16430. - flow_id);
  16431. -- brcmf_netif_rx(ifp, pkt);
  16432. -+ brcmf_netif_rx(ifp, pkt, false);
  16433. - return;
  16434. - }
  16435. -
  16436. -@@ -418,7 +419,7 @@ static void brcmf_rxreorder_process_info
  16437. - rfi = kzalloc(buf_size, GFP_ATOMIC);
  16438. - if (rfi == NULL) {
  16439. - brcmf_err("failed to alloc buffer\n");
  16440. -- brcmf_netif_rx(ifp, pkt);
  16441. -+ brcmf_netif_rx(ifp, pkt, false);
  16442. - return;
  16443. - }
  16444. -
  16445. -@@ -532,11 +533,11 @@ static void brcmf_rxreorder_process_info
  16446. - netif_rx:
  16447. - skb_queue_walk_safe(&reorder_list, pkt, pnext) {
  16448. - __skb_unlink(pkt, &reorder_list);
  16449. -- brcmf_netif_rx(ifp, pkt);
  16450. -+ brcmf_netif_rx(ifp, pkt, false);
  16451. - }
  16452. - }
  16453. -
  16454. --void brcmf_rx_frame(struct device *dev, struct sk_buff *skb)
  16455. -+void brcmf_rx_frame(struct device *dev, struct sk_buff *skb, bool handle_evnt)
  16456. - {
  16457. - struct brcmf_if *ifp;
  16458. - struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  16459. -@@ -560,7 +561,32 @@ void brcmf_rx_frame(struct device *dev,
  16460. - if (rd->reorder)
  16461. - brcmf_rxreorder_process_info(ifp, rd->reorder, skb);
  16462. - else
  16463. -- brcmf_netif_rx(ifp, skb);
  16464. -+ brcmf_netif_rx(ifp, skb, handle_evnt);
  16465. -+}
  16466. -+
  16467. -+void brcmf_rx_event(struct device *dev, struct sk_buff *skb)
  16468. -+{
  16469. -+ struct brcmf_if *ifp;
  16470. -+ struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  16471. -+ struct brcmf_pub *drvr = bus_if->drvr;
  16472. -+ int ret;
  16473. -+
  16474. -+ brcmf_dbg(EVENT, "Enter: %s: rxp=%p\n", dev_name(dev), skb);
  16475. -+
  16476. -+ /* process and remove protocol-specific header */
  16477. -+ ret = brcmf_proto_hdrpull(drvr, true, skb, &ifp);
  16478. -+
  16479. -+ if (ret || !ifp || !ifp->ndev) {
  16480. -+ if (ret != -ENODATA && ifp)
  16481. -+ ifp->stats.rx_errors++;
  16482. -+ brcmu_pkt_buf_free_skb(skb);
  16483. -+ return;
  16484. -+ }
  16485. -+
  16486. -+ skb->protocol = eth_type_trans(skb, ifp->ndev);
  16487. -+
  16488. -+ brcmf_fweh_process_skb(ifp->drvr, skb);
  16489. -+ brcmu_pkt_buf_free_skb(skb);
  16490. - }
  16491. -
  16492. - void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success)
  16493. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  16494. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  16495. -@@ -225,7 +225,8 @@ int brcmf_get_next_free_bsscfgidx(struct
  16496. - void brcmf_txflowblock_if(struct brcmf_if *ifp,
  16497. - enum brcmf_netif_stop_reason reason, bool state);
  16498. - void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
  16499. --void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb);
  16500. -+void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb,
  16501. -+ bool handle_event);
  16502. - void brcmf_net_setcarrier(struct brcmf_if *ifp, bool on);
  16503. - int __init brcmf_core_init(void);
  16504. - void __exit brcmf_core_exit(void);
  16505. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  16506. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  16507. -@@ -20,6 +20,7 @@
  16508. -
  16509. - #include <linux/types.h>
  16510. - #include <linux/netdevice.h>
  16511. -+#include <linux/etherdevice.h>
  16512. -
  16513. - #include <brcmu_utils.h>
  16514. - #include <brcmu_wifi.h>
  16515. -@@ -1075,28 +1076,13 @@ static void brcmf_msgbuf_rxbuf_event_pos
  16516. - }
  16517. -
  16518. -
  16519. --static void
  16520. --brcmf_msgbuf_rx_skb(struct brcmf_msgbuf *msgbuf, struct sk_buff *skb,
  16521. -- u8 ifidx)
  16522. --{
  16523. -- struct brcmf_if *ifp;
  16524. --
  16525. -- ifp = brcmf_get_ifp(msgbuf->drvr, ifidx);
  16526. -- if (!ifp || !ifp->ndev) {
  16527. -- brcmf_err("Received pkt for invalid ifidx %d\n", ifidx);
  16528. -- brcmu_pkt_buf_free_skb(skb);
  16529. -- return;
  16530. -- }
  16531. -- brcmf_netif_rx(ifp, skb);
  16532. --}
  16533. --
  16534. --
  16535. - static void brcmf_msgbuf_process_event(struct brcmf_msgbuf *msgbuf, void *buf)
  16536. - {
  16537. - struct msgbuf_rx_event *event;
  16538. - u32 idx;
  16539. - u16 buflen;
  16540. - struct sk_buff *skb;
  16541. -+ struct brcmf_if *ifp;
  16542. -
  16543. - event = (struct msgbuf_rx_event *)buf;
  16544. - idx = le32_to_cpu(event->msg.request_id);
  16545. -@@ -1116,7 +1102,19 @@ static void brcmf_msgbuf_process_event(s
  16546. -
  16547. - skb_trim(skb, buflen);
  16548. -
  16549. -- brcmf_msgbuf_rx_skb(msgbuf, skb, event->msg.ifidx);
  16550. -+ ifp = brcmf_get_ifp(msgbuf->drvr, event->msg.ifidx);
  16551. -+ if (!ifp || !ifp->ndev) {
  16552. -+ brcmf_err("Received pkt for invalid ifidx %d\n",
  16553. -+ event->msg.ifidx);
  16554. -+ goto exit;
  16555. -+ }
  16556. -+
  16557. -+ skb->protocol = eth_type_trans(skb, ifp->ndev);
  16558. -+
  16559. -+ brcmf_fweh_process_skb(ifp->drvr, skb);
  16560. -+
  16561. -+exit:
  16562. -+ brcmu_pkt_buf_free_skb(skb);
  16563. - }
  16564. -
  16565. -
  16566. -@@ -1128,6 +1126,7 @@ brcmf_msgbuf_process_rx_complete(struct
  16567. - u16 data_offset;
  16568. - u16 buflen;
  16569. - u32 idx;
  16570. -+ struct brcmf_if *ifp;
  16571. -
  16572. - brcmf_msgbuf_update_rxbufpost_count(msgbuf, 1);
  16573. -
  16574. -@@ -1148,7 +1147,14 @@ brcmf_msgbuf_process_rx_complete(struct
  16575. -
  16576. - skb_trim(skb, buflen);
  16577. -
  16578. -- brcmf_msgbuf_rx_skb(msgbuf, skb, rx_complete->msg.ifidx);
  16579. -+ ifp = brcmf_get_ifp(msgbuf->drvr, rx_complete->msg.ifidx);
  16580. -+ if (!ifp || !ifp->ndev) {
  16581. -+ brcmf_err("Received pkt for invalid ifidx %d\n",
  16582. -+ rx_complete->msg.ifidx);
  16583. -+ brcmu_pkt_buf_free_skb(skb);
  16584. -+ return;
  16585. -+ }
  16586. -+ brcmf_netif_rx(ifp, skb, false);
  16587. - }
  16588. -
  16589. -
  16590. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  16591. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  16592. -@@ -1294,6 +1294,17 @@ static inline u8 brcmf_sdio_getdatoffset
  16593. - return (u8)((hdrvalue & SDPCM_DOFFSET_MASK) >> SDPCM_DOFFSET_SHIFT);
  16594. - }
  16595. -
  16596. -+static inline bool brcmf_sdio_fromevntchan(u8 *swheader)
  16597. -+{
  16598. -+ u32 hdrvalue;
  16599. -+ u8 ret;
  16600. -+
  16601. -+ hdrvalue = *(u32 *)swheader;
  16602. -+ ret = (u8)((hdrvalue & SDPCM_CHANNEL_MASK) >> SDPCM_CHANNEL_SHIFT);
  16603. -+
  16604. -+ return (ret == SDPCM_EVENT_CHANNEL);
  16605. -+}
  16606. -+
  16607. - static int brcmf_sdio_hdparse(struct brcmf_sdio *bus, u8 *header,
  16608. - struct brcmf_sdio_hdrinfo *rd,
  16609. - enum brcmf_sdio_frmtype type)
  16610. -@@ -1641,7 +1652,11 @@ static u8 brcmf_sdio_rxglom(struct brcmf
  16611. - pfirst->len, pfirst->next,
  16612. - pfirst->prev);
  16613. - skb_unlink(pfirst, &bus->glom);
  16614. -- brcmf_rx_frame(bus->sdiodev->dev, pfirst);
  16615. -+ if (brcmf_sdio_fromevntchan(pfirst->data))
  16616. -+ brcmf_rx_event(bus->sdiodev->dev, pfirst);
  16617. -+ else
  16618. -+ brcmf_rx_frame(bus->sdiodev->dev, pfirst,
  16619. -+ false);
  16620. - bus->sdcnt.rxglompkts++;
  16621. - }
  16622. -
  16623. -@@ -1967,18 +1982,19 @@ static uint brcmf_sdio_readframes(struct
  16624. - __skb_trim(pkt, rd->len);
  16625. - skb_pull(pkt, rd->dat_offset);
  16626. -
  16627. -+ if (pkt->len == 0)
  16628. -+ brcmu_pkt_buf_free_skb(pkt);
  16629. -+ else if (rd->channel == SDPCM_EVENT_CHANNEL)
  16630. -+ brcmf_rx_event(bus->sdiodev->dev, pkt);
  16631. -+ else
  16632. -+ brcmf_rx_frame(bus->sdiodev->dev, pkt,
  16633. -+ false);
  16634. -+
  16635. - /* prepare the descriptor for the next read */
  16636. - rd->len = rd->len_nxtfrm << 4;
  16637. - rd->len_nxtfrm = 0;
  16638. - /* treat all packet as event if we don't know */
  16639. - rd->channel = SDPCM_EVENT_CHANNEL;
  16640. --
  16641. -- if (pkt->len == 0) {
  16642. -- brcmu_pkt_buf_free_skb(pkt);
  16643. -- continue;
  16644. -- }
  16645. --
  16646. -- brcmf_rx_frame(bus->sdiodev->dev, pkt);
  16647. - }
  16648. -
  16649. - rxcount = maxframes - rxleft;
  16650. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
  16651. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
  16652. -@@ -514,7 +514,7 @@ static void brcmf_usb_rx_complete(struct
  16653. -
  16654. - if (devinfo->bus_pub.state == BRCMFMAC_USB_STATE_UP) {
  16655. - skb_put(skb, urb->actual_length);
  16656. -- brcmf_rx_frame(devinfo->dev, skb);
  16657. -+ brcmf_rx_frame(devinfo->dev, skb, true);
  16658. - brcmf_usb_rx_refill(devinfo, req);
  16659. - } else {
  16660. - brcmu_pkt_buf_free_skb(skb);
  16661. diff --git a/package/kernel/mac80211/patches/349-0006-brcmfmac-cleanup-ampdu-rx-host-reorder-code.patch b/package/kernel/mac80211/patches/349-0006-brcmfmac-cleanup-ampdu-rx-host-reorder-code.patch
  16662. deleted file mode 100644
  16663. index 33b263d..0000000
  16664. --- a/package/kernel/mac80211/patches/349-0006-brcmfmac-cleanup-ampdu-rx-host-reorder-code.patch
  16665. +++ /dev/null
  16666. @@ -1,585 +0,0 @@
  16667. -From: Arend van Spriel <arend@broadcom.com>
  16668. -Date: Mon, 11 Apr 2016 11:35:26 +0200
  16669. -Subject: [PATCH] brcmfmac: cleanup ampdu-rx host reorder code
  16670. -
  16671. -The code for ampdu-rx host reorder is related to the firmware signalling
  16672. -supported in BCDC protocol. This change moves the code to fwsignal module.
  16673. -
  16674. -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  16675. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  16676. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  16677. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16678. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16679. ----
  16680. -
  16681. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
  16682. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
  16683. -@@ -351,6 +351,12 @@ brcmf_proto_bcdc_add_tdls_peer(struct br
  16684. - {
  16685. - }
  16686. -
  16687. -+static void brcmf_proto_bcdc_rxreorder(struct brcmf_if *ifp,
  16688. -+ struct sk_buff *skb)
  16689. -+{
  16690. -+ brcmf_fws_rxreorder(ifp, skb);
  16691. -+}
  16692. -+
  16693. - int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr)
  16694. - {
  16695. - struct brcmf_bcdc *bcdc;
  16696. -@@ -372,6 +378,7 @@ int brcmf_proto_bcdc_attach(struct brcmf
  16697. - drvr->proto->configure_addr_mode = brcmf_proto_bcdc_configure_addr_mode;
  16698. - drvr->proto->delete_peer = brcmf_proto_bcdc_delete_peer;
  16699. - drvr->proto->add_tdls_peer = brcmf_proto_bcdc_add_tdls_peer;
  16700. -+ drvr->proto->rxreorder = brcmf_proto_bcdc_rxreorder;
  16701. - drvr->proto->pd = bcdc;
  16702. -
  16703. - drvr->hdrlen += BCDC_HEADER_LEN + BRCMF_PROT_FW_SIGNAL_MAX_TXBYTES;
  16704. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  16705. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  16706. -@@ -40,19 +40,6 @@
  16707. -
  16708. - #define MAX_WAIT_FOR_8021X_TX msecs_to_jiffies(950)
  16709. -
  16710. --/* AMPDU rx reordering definitions */
  16711. --#define BRCMF_RXREORDER_FLOWID_OFFSET 0
  16712. --#define BRCMF_RXREORDER_MAXIDX_OFFSET 2
  16713. --#define BRCMF_RXREORDER_FLAGS_OFFSET 4
  16714. --#define BRCMF_RXREORDER_CURIDX_OFFSET 6
  16715. --#define BRCMF_RXREORDER_EXPIDX_OFFSET 8
  16716. --
  16717. --#define BRCMF_RXREORDER_DEL_FLOW 0x01
  16718. --#define BRCMF_RXREORDER_FLUSH_ALL 0x02
  16719. --#define BRCMF_RXREORDER_CURIDX_VALID 0x04
  16720. --#define BRCMF_RXREORDER_EXPIDX_VALID 0x08
  16721. --#define BRCMF_RXREORDER_NEW_HOLE 0x10
  16722. --
  16723. - #define BRCMF_BSSIDX_INVALID -1
  16724. -
  16725. - char *brcmf_ifname(struct brcmf_if *ifp)
  16726. -@@ -342,207 +329,11 @@ void brcmf_netif_rx(struct brcmf_if *ifp
  16727. - netif_rx_ni(skb);
  16728. - }
  16729. -
  16730. --static void brcmf_rxreorder_get_skb_list(struct brcmf_ampdu_rx_reorder *rfi,
  16731. -- u8 start, u8 end,
  16732. -- struct sk_buff_head *skb_list)
  16733. --{
  16734. -- /* initialize return list */
  16735. -- __skb_queue_head_init(skb_list);
  16736. --
  16737. -- if (rfi->pend_pkts == 0) {
  16738. -- brcmf_dbg(INFO, "no packets in reorder queue\n");
  16739. -- return;
  16740. -- }
  16741. --
  16742. -- do {
  16743. -- if (rfi->pktslots[start]) {
  16744. -- __skb_queue_tail(skb_list, rfi->pktslots[start]);
  16745. -- rfi->pktslots[start] = NULL;
  16746. -- }
  16747. -- start++;
  16748. -- if (start > rfi->max_idx)
  16749. -- start = 0;
  16750. -- } while (start != end);
  16751. -- rfi->pend_pkts -= skb_queue_len(skb_list);
  16752. --}
  16753. --
  16754. --static void brcmf_rxreorder_process_info(struct brcmf_if *ifp, u8 *reorder_data,
  16755. -- struct sk_buff *pkt)
  16756. --{
  16757. -- u8 flow_id, max_idx, cur_idx, exp_idx, end_idx;
  16758. -- struct brcmf_ampdu_rx_reorder *rfi;
  16759. -- struct sk_buff_head reorder_list;
  16760. -- struct sk_buff *pnext;
  16761. -- u8 flags;
  16762. -- u32 buf_size;
  16763. --
  16764. -- flow_id = reorder_data[BRCMF_RXREORDER_FLOWID_OFFSET];
  16765. -- flags = reorder_data[BRCMF_RXREORDER_FLAGS_OFFSET];
  16766. --
  16767. -- /* validate flags and flow id */
  16768. -- if (flags == 0xFF) {
  16769. -- brcmf_err("invalid flags...so ignore this packet\n");
  16770. -- brcmf_netif_rx(ifp, pkt, false);
  16771. -- return;
  16772. -- }
  16773. --
  16774. -- rfi = ifp->drvr->reorder_flows[flow_id];
  16775. -- if (flags & BRCMF_RXREORDER_DEL_FLOW) {
  16776. -- brcmf_dbg(INFO, "flow-%d: delete\n",
  16777. -- flow_id);
  16778. --
  16779. -- if (rfi == NULL) {
  16780. -- brcmf_dbg(INFO, "received flags to cleanup, but no flow (%d) yet\n",
  16781. -- flow_id);
  16782. -- brcmf_netif_rx(ifp, pkt, false);
  16783. -- return;
  16784. -- }
  16785. --
  16786. -- brcmf_rxreorder_get_skb_list(rfi, rfi->exp_idx, rfi->exp_idx,
  16787. -- &reorder_list);
  16788. -- /* add the last packet */
  16789. -- __skb_queue_tail(&reorder_list, pkt);
  16790. -- kfree(rfi);
  16791. -- ifp->drvr->reorder_flows[flow_id] = NULL;
  16792. -- goto netif_rx;
  16793. -- }
  16794. -- /* from here on we need a flow reorder instance */
  16795. -- if (rfi == NULL) {
  16796. -- buf_size = sizeof(*rfi);
  16797. -- max_idx = reorder_data[BRCMF_RXREORDER_MAXIDX_OFFSET];
  16798. --
  16799. -- buf_size += (max_idx + 1) * sizeof(pkt);
  16800. --
  16801. -- /* allocate space for flow reorder info */
  16802. -- brcmf_dbg(INFO, "flow-%d: start, maxidx %d\n",
  16803. -- flow_id, max_idx);
  16804. -- rfi = kzalloc(buf_size, GFP_ATOMIC);
  16805. -- if (rfi == NULL) {
  16806. -- brcmf_err("failed to alloc buffer\n");
  16807. -- brcmf_netif_rx(ifp, pkt, false);
  16808. -- return;
  16809. -- }
  16810. --
  16811. -- ifp->drvr->reorder_flows[flow_id] = rfi;
  16812. -- rfi->pktslots = (struct sk_buff **)(rfi+1);
  16813. -- rfi->max_idx = max_idx;
  16814. -- }
  16815. -- if (flags & BRCMF_RXREORDER_NEW_HOLE) {
  16816. -- if (rfi->pend_pkts) {
  16817. -- brcmf_rxreorder_get_skb_list(rfi, rfi->exp_idx,
  16818. -- rfi->exp_idx,
  16819. -- &reorder_list);
  16820. -- WARN_ON(rfi->pend_pkts);
  16821. -- } else {
  16822. -- __skb_queue_head_init(&reorder_list);
  16823. -- }
  16824. -- rfi->cur_idx = reorder_data[BRCMF_RXREORDER_CURIDX_OFFSET];
  16825. -- rfi->exp_idx = reorder_data[BRCMF_RXREORDER_EXPIDX_OFFSET];
  16826. -- rfi->max_idx = reorder_data[BRCMF_RXREORDER_MAXIDX_OFFSET];
  16827. -- rfi->pktslots[rfi->cur_idx] = pkt;
  16828. -- rfi->pend_pkts++;
  16829. -- brcmf_dbg(DATA, "flow-%d: new hole %d (%d), pending %d\n",
  16830. -- flow_id, rfi->cur_idx, rfi->exp_idx, rfi->pend_pkts);
  16831. -- } else if (flags & BRCMF_RXREORDER_CURIDX_VALID) {
  16832. -- cur_idx = reorder_data[BRCMF_RXREORDER_CURIDX_OFFSET];
  16833. -- exp_idx = reorder_data[BRCMF_RXREORDER_EXPIDX_OFFSET];
  16834. --
  16835. -- if ((exp_idx == rfi->exp_idx) && (cur_idx != rfi->exp_idx)) {
  16836. -- /* still in the current hole */
  16837. -- /* enqueue the current on the buffer chain */
  16838. -- if (rfi->pktslots[cur_idx] != NULL) {
  16839. -- brcmf_dbg(INFO, "HOLE: ERROR buffer pending..free it\n");
  16840. -- brcmu_pkt_buf_free_skb(rfi->pktslots[cur_idx]);
  16841. -- rfi->pktslots[cur_idx] = NULL;
  16842. -- }
  16843. -- rfi->pktslots[cur_idx] = pkt;
  16844. -- rfi->pend_pkts++;
  16845. -- rfi->cur_idx = cur_idx;
  16846. -- brcmf_dbg(DATA, "flow-%d: store pkt %d (%d), pending %d\n",
  16847. -- flow_id, cur_idx, exp_idx, rfi->pend_pkts);
  16848. --
  16849. -- /* can return now as there is no reorder
  16850. -- * list to process.
  16851. -- */
  16852. -- return;
  16853. -- }
  16854. -- if (rfi->exp_idx == cur_idx) {
  16855. -- if (rfi->pktslots[cur_idx] != NULL) {
  16856. -- brcmf_dbg(INFO, "error buffer pending..free it\n");
  16857. -- brcmu_pkt_buf_free_skb(rfi->pktslots[cur_idx]);
  16858. -- rfi->pktslots[cur_idx] = NULL;
  16859. -- }
  16860. -- rfi->pktslots[cur_idx] = pkt;
  16861. -- rfi->pend_pkts++;
  16862. --
  16863. -- /* got the expected one. flush from current to expected
  16864. -- * and update expected
  16865. -- */
  16866. -- brcmf_dbg(DATA, "flow-%d: expected %d (%d), pending %d\n",
  16867. -- flow_id, cur_idx, exp_idx, rfi->pend_pkts);
  16868. --
  16869. -- rfi->cur_idx = cur_idx;
  16870. -- rfi->exp_idx = exp_idx;
  16871. --
  16872. -- brcmf_rxreorder_get_skb_list(rfi, cur_idx, exp_idx,
  16873. -- &reorder_list);
  16874. -- brcmf_dbg(DATA, "flow-%d: freeing buffers %d, pending %d\n",
  16875. -- flow_id, skb_queue_len(&reorder_list),
  16876. -- rfi->pend_pkts);
  16877. -- } else {
  16878. -- u8 end_idx;
  16879. --
  16880. -- brcmf_dbg(DATA, "flow-%d (0x%x): both moved, old %d/%d, new %d/%d\n",
  16881. -- flow_id, flags, rfi->cur_idx, rfi->exp_idx,
  16882. -- cur_idx, exp_idx);
  16883. -- if (flags & BRCMF_RXREORDER_FLUSH_ALL)
  16884. -- end_idx = rfi->exp_idx;
  16885. -- else
  16886. -- end_idx = exp_idx;
  16887. --
  16888. -- /* flush pkts first */
  16889. -- brcmf_rxreorder_get_skb_list(rfi, rfi->exp_idx, end_idx,
  16890. -- &reorder_list);
  16891. --
  16892. -- if (exp_idx == ((cur_idx + 1) % (rfi->max_idx + 1))) {
  16893. -- __skb_queue_tail(&reorder_list, pkt);
  16894. -- } else {
  16895. -- rfi->pktslots[cur_idx] = pkt;
  16896. -- rfi->pend_pkts++;
  16897. -- }
  16898. -- rfi->exp_idx = exp_idx;
  16899. -- rfi->cur_idx = cur_idx;
  16900. -- }
  16901. -- } else {
  16902. -- /* explicity window move updating the expected index */
  16903. -- exp_idx = reorder_data[BRCMF_RXREORDER_EXPIDX_OFFSET];
  16904. --
  16905. -- brcmf_dbg(DATA, "flow-%d (0x%x): change expected: %d -> %d\n",
  16906. -- flow_id, flags, rfi->exp_idx, exp_idx);
  16907. -- if (flags & BRCMF_RXREORDER_FLUSH_ALL)
  16908. -- end_idx = rfi->exp_idx;
  16909. -- else
  16910. -- end_idx = exp_idx;
  16911. --
  16912. -- brcmf_rxreorder_get_skb_list(rfi, rfi->exp_idx, end_idx,
  16913. -- &reorder_list);
  16914. -- __skb_queue_tail(&reorder_list, pkt);
  16915. -- /* set the new expected idx */
  16916. -- rfi->exp_idx = exp_idx;
  16917. -- }
  16918. --netif_rx:
  16919. -- skb_queue_walk_safe(&reorder_list, pkt, pnext) {
  16920. -- __skb_unlink(pkt, &reorder_list);
  16921. -- brcmf_netif_rx(ifp, pkt, false);
  16922. -- }
  16923. --}
  16924. --
  16925. - void brcmf_rx_frame(struct device *dev, struct sk_buff *skb, bool handle_evnt)
  16926. - {
  16927. - struct brcmf_if *ifp;
  16928. - struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  16929. - struct brcmf_pub *drvr = bus_if->drvr;
  16930. -- struct brcmf_skb_reorder_data *rd;
  16931. - int ret;
  16932. -
  16933. - brcmf_dbg(DATA, "Enter: %s: rxp=%p\n", dev_name(dev), skb);
  16934. -@@ -557,9 +348,8 @@ void brcmf_rx_frame(struct device *dev,
  16935. - return;
  16936. - }
  16937. -
  16938. -- rd = (struct brcmf_skb_reorder_data *)skb->cb;
  16939. -- if (rd->reorder)
  16940. -- brcmf_rxreorder_process_info(ifp, rd->reorder, skb);
  16941. -+ if (brcmf_proto_is_reorder_skb(skb))
  16942. -+ brcmf_proto_rxreorder(ifp, skb);
  16943. - else
  16944. - brcmf_netif_rx(ifp, skb, handle_evnt);
  16945. - }
  16946. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  16947. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  16948. -@@ -208,10 +208,6 @@ struct brcmf_if {
  16949. - u8 ipv6addr_idx;
  16950. - };
  16951. -
  16952. --struct brcmf_skb_reorder_data {
  16953. -- u8 *reorder;
  16954. --};
  16955. --
  16956. - int brcmf_netdev_wait_pend8021x(struct brcmf_if *ifp);
  16957. -
  16958. - /* Return pointer to interface name */
  16959. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
  16960. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
  16961. -@@ -92,6 +92,19 @@ enum brcmf_fws_tlv_len {
  16962. - };
  16963. - #undef BRCMF_FWS_TLV_DEF
  16964. -
  16965. -+/* AMPDU rx reordering definitions */
  16966. -+#define BRCMF_RXREORDER_FLOWID_OFFSET 0
  16967. -+#define BRCMF_RXREORDER_MAXIDX_OFFSET 2
  16968. -+#define BRCMF_RXREORDER_FLAGS_OFFSET 4
  16969. -+#define BRCMF_RXREORDER_CURIDX_OFFSET 6
  16970. -+#define BRCMF_RXREORDER_EXPIDX_OFFSET 8
  16971. -+
  16972. -+#define BRCMF_RXREORDER_DEL_FLOW 0x01
  16973. -+#define BRCMF_RXREORDER_FLUSH_ALL 0x02
  16974. -+#define BRCMF_RXREORDER_CURIDX_VALID 0x04
  16975. -+#define BRCMF_RXREORDER_EXPIDX_VALID 0x08
  16976. -+#define BRCMF_RXREORDER_NEW_HOLE 0x10
  16977. -+
  16978. - #ifdef DEBUG
  16979. - /*
  16980. - * brcmf_fws_tlv_names - array of tlv names.
  16981. -@@ -1614,6 +1627,202 @@ static int brcmf_fws_notify_bcmc_credit_
  16982. - return 0;
  16983. - }
  16984. -
  16985. -+static void brcmf_rxreorder_get_skb_list(struct brcmf_ampdu_rx_reorder *rfi,
  16986. -+ u8 start, u8 end,
  16987. -+ struct sk_buff_head *skb_list)
  16988. -+{
  16989. -+ /* initialize return list */
  16990. -+ __skb_queue_head_init(skb_list);
  16991. -+
  16992. -+ if (rfi->pend_pkts == 0) {
  16993. -+ brcmf_dbg(INFO, "no packets in reorder queue\n");
  16994. -+ return;
  16995. -+ }
  16996. -+
  16997. -+ do {
  16998. -+ if (rfi->pktslots[start]) {
  16999. -+ __skb_queue_tail(skb_list, rfi->pktslots[start]);
  17000. -+ rfi->pktslots[start] = NULL;
  17001. -+ }
  17002. -+ start++;
  17003. -+ if (start > rfi->max_idx)
  17004. -+ start = 0;
  17005. -+ } while (start != end);
  17006. -+ rfi->pend_pkts -= skb_queue_len(skb_list);
  17007. -+}
  17008. -+
  17009. -+void brcmf_fws_rxreorder(struct brcmf_if *ifp, struct sk_buff *pkt)
  17010. -+{
  17011. -+ u8 *reorder_data;
  17012. -+ u8 flow_id, max_idx, cur_idx, exp_idx, end_idx;
  17013. -+ struct brcmf_ampdu_rx_reorder *rfi;
  17014. -+ struct sk_buff_head reorder_list;
  17015. -+ struct sk_buff *pnext;
  17016. -+ u8 flags;
  17017. -+ u32 buf_size;
  17018. -+
  17019. -+ reorder_data = ((struct brcmf_skb_reorder_data *)pkt->cb)->reorder;
  17020. -+ flow_id = reorder_data[BRCMF_RXREORDER_FLOWID_OFFSET];
  17021. -+ flags = reorder_data[BRCMF_RXREORDER_FLAGS_OFFSET];
  17022. -+
  17023. -+ /* validate flags and flow id */
  17024. -+ if (flags == 0xFF) {
  17025. -+ brcmf_err("invalid flags...so ignore this packet\n");
  17026. -+ brcmf_netif_rx(ifp, pkt, false);
  17027. -+ return;
  17028. -+ }
  17029. -+
  17030. -+ rfi = ifp->drvr->reorder_flows[flow_id];
  17031. -+ if (flags & BRCMF_RXREORDER_DEL_FLOW) {
  17032. -+ brcmf_dbg(INFO, "flow-%d: delete\n",
  17033. -+ flow_id);
  17034. -+
  17035. -+ if (rfi == NULL) {
  17036. -+ brcmf_dbg(INFO, "received flags to cleanup, but no flow (%d) yet\n",
  17037. -+ flow_id);
  17038. -+ brcmf_netif_rx(ifp, pkt, false);
  17039. -+ return;
  17040. -+ }
  17041. -+
  17042. -+ brcmf_rxreorder_get_skb_list(rfi, rfi->exp_idx, rfi->exp_idx,
  17043. -+ &reorder_list);
  17044. -+ /* add the last packet */
  17045. -+ __skb_queue_tail(&reorder_list, pkt);
  17046. -+ kfree(rfi);
  17047. -+ ifp->drvr->reorder_flows[flow_id] = NULL;
  17048. -+ goto netif_rx;
  17049. -+ }
  17050. -+ /* from here on we need a flow reorder instance */
  17051. -+ if (rfi == NULL) {
  17052. -+ buf_size = sizeof(*rfi);
  17053. -+ max_idx = reorder_data[BRCMF_RXREORDER_MAXIDX_OFFSET];
  17054. -+
  17055. -+ buf_size += (max_idx + 1) * sizeof(pkt);
  17056. -+
  17057. -+ /* allocate space for flow reorder info */
  17058. -+ brcmf_dbg(INFO, "flow-%d: start, maxidx %d\n",
  17059. -+ flow_id, max_idx);
  17060. -+ rfi = kzalloc(buf_size, GFP_ATOMIC);
  17061. -+ if (rfi == NULL) {
  17062. -+ brcmf_err("failed to alloc buffer\n");
  17063. -+ brcmf_netif_rx(ifp, pkt, false);
  17064. -+ return;
  17065. -+ }
  17066. -+
  17067. -+ ifp->drvr->reorder_flows[flow_id] = rfi;
  17068. -+ rfi->pktslots = (struct sk_buff **)(rfi + 1);
  17069. -+ rfi->max_idx = max_idx;
  17070. -+ }
  17071. -+ if (flags & BRCMF_RXREORDER_NEW_HOLE) {
  17072. -+ if (rfi->pend_pkts) {
  17073. -+ brcmf_rxreorder_get_skb_list(rfi, rfi->exp_idx,
  17074. -+ rfi->exp_idx,
  17075. -+ &reorder_list);
  17076. -+ WARN_ON(rfi->pend_pkts);
  17077. -+ } else {
  17078. -+ __skb_queue_head_init(&reorder_list);
  17079. -+ }
  17080. -+ rfi->cur_idx = reorder_data[BRCMF_RXREORDER_CURIDX_OFFSET];
  17081. -+ rfi->exp_idx = reorder_data[BRCMF_RXREORDER_EXPIDX_OFFSET];
  17082. -+ rfi->max_idx = reorder_data[BRCMF_RXREORDER_MAXIDX_OFFSET];
  17083. -+ rfi->pktslots[rfi->cur_idx] = pkt;
  17084. -+ rfi->pend_pkts++;
  17085. -+ brcmf_dbg(DATA, "flow-%d: new hole %d (%d), pending %d\n",
  17086. -+ flow_id, rfi->cur_idx, rfi->exp_idx, rfi->pend_pkts);
  17087. -+ } else if (flags & BRCMF_RXREORDER_CURIDX_VALID) {
  17088. -+ cur_idx = reorder_data[BRCMF_RXREORDER_CURIDX_OFFSET];
  17089. -+ exp_idx = reorder_data[BRCMF_RXREORDER_EXPIDX_OFFSET];
  17090. -+
  17091. -+ if ((exp_idx == rfi->exp_idx) && (cur_idx != rfi->exp_idx)) {
  17092. -+ /* still in the current hole */
  17093. -+ /* enqueue the current on the buffer chain */
  17094. -+ if (rfi->pktslots[cur_idx] != NULL) {
  17095. -+ brcmf_dbg(INFO, "HOLE: ERROR buffer pending..free it\n");
  17096. -+ brcmu_pkt_buf_free_skb(rfi->pktslots[cur_idx]);
  17097. -+ rfi->pktslots[cur_idx] = NULL;
  17098. -+ }
  17099. -+ rfi->pktslots[cur_idx] = pkt;
  17100. -+ rfi->pend_pkts++;
  17101. -+ rfi->cur_idx = cur_idx;
  17102. -+ brcmf_dbg(DATA, "flow-%d: store pkt %d (%d), pending %d\n",
  17103. -+ flow_id, cur_idx, exp_idx, rfi->pend_pkts);
  17104. -+
  17105. -+ /* can return now as there is no reorder
  17106. -+ * list to process.
  17107. -+ */
  17108. -+ return;
  17109. -+ }
  17110. -+ if (rfi->exp_idx == cur_idx) {
  17111. -+ if (rfi->pktslots[cur_idx] != NULL) {
  17112. -+ brcmf_dbg(INFO, "error buffer pending..free it\n");
  17113. -+ brcmu_pkt_buf_free_skb(rfi->pktslots[cur_idx]);
  17114. -+ rfi->pktslots[cur_idx] = NULL;
  17115. -+ }
  17116. -+ rfi->pktslots[cur_idx] = pkt;
  17117. -+ rfi->pend_pkts++;
  17118. -+
  17119. -+ /* got the expected one. flush from current to expected
  17120. -+ * and update expected
  17121. -+ */
  17122. -+ brcmf_dbg(DATA, "flow-%d: expected %d (%d), pending %d\n",
  17123. -+ flow_id, cur_idx, exp_idx, rfi->pend_pkts);
  17124. -+
  17125. -+ rfi->cur_idx = cur_idx;
  17126. -+ rfi->exp_idx = exp_idx;
  17127. -+
  17128. -+ brcmf_rxreorder_get_skb_list(rfi, cur_idx, exp_idx,
  17129. -+ &reorder_list);
  17130. -+ brcmf_dbg(DATA, "flow-%d: freeing buffers %d, pending %d\n",
  17131. -+ flow_id, skb_queue_len(&reorder_list),
  17132. -+ rfi->pend_pkts);
  17133. -+ } else {
  17134. -+ u8 end_idx;
  17135. -+
  17136. -+ brcmf_dbg(DATA, "flow-%d (0x%x): both moved, old %d/%d, new %d/%d\n",
  17137. -+ flow_id, flags, rfi->cur_idx, rfi->exp_idx,
  17138. -+ cur_idx, exp_idx);
  17139. -+ if (flags & BRCMF_RXREORDER_FLUSH_ALL)
  17140. -+ end_idx = rfi->exp_idx;
  17141. -+ else
  17142. -+ end_idx = exp_idx;
  17143. -+
  17144. -+ /* flush pkts first */
  17145. -+ brcmf_rxreorder_get_skb_list(rfi, rfi->exp_idx, end_idx,
  17146. -+ &reorder_list);
  17147. -+
  17148. -+ if (exp_idx == ((cur_idx + 1) % (rfi->max_idx + 1))) {
  17149. -+ __skb_queue_tail(&reorder_list, pkt);
  17150. -+ } else {
  17151. -+ rfi->pktslots[cur_idx] = pkt;
  17152. -+ rfi->pend_pkts++;
  17153. -+ }
  17154. -+ rfi->exp_idx = exp_idx;
  17155. -+ rfi->cur_idx = cur_idx;
  17156. -+ }
  17157. -+ } else {
  17158. -+ /* explicity window move updating the expected index */
  17159. -+ exp_idx = reorder_data[BRCMF_RXREORDER_EXPIDX_OFFSET];
  17160. -+
  17161. -+ brcmf_dbg(DATA, "flow-%d (0x%x): change expected: %d -> %d\n",
  17162. -+ flow_id, flags, rfi->exp_idx, exp_idx);
  17163. -+ if (flags & BRCMF_RXREORDER_FLUSH_ALL)
  17164. -+ end_idx = rfi->exp_idx;
  17165. -+ else
  17166. -+ end_idx = exp_idx;
  17167. -+
  17168. -+ brcmf_rxreorder_get_skb_list(rfi, rfi->exp_idx, end_idx,
  17169. -+ &reorder_list);
  17170. -+ __skb_queue_tail(&reorder_list, pkt);
  17171. -+ /* set the new expected idx */
  17172. -+ rfi->exp_idx = exp_idx;
  17173. -+ }
  17174. -+netif_rx:
  17175. -+ skb_queue_walk_safe(&reorder_list, pkt, pnext) {
  17176. -+ __skb_unlink(pkt, &reorder_list);
  17177. -+ brcmf_netif_rx(ifp, pkt, false);
  17178. -+ }
  17179. -+}
  17180. -+
  17181. - void brcmf_fws_hdrpull(struct brcmf_if *ifp, s16 siglen, struct sk_buff *skb)
  17182. - {
  17183. - struct brcmf_skb_reorder_data *rd;
  17184. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.h
  17185. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.h
  17186. -@@ -29,5 +29,6 @@ void brcmf_fws_add_interface(struct brcm
  17187. - void brcmf_fws_del_interface(struct brcmf_if *ifp);
  17188. - void brcmf_fws_bustxfail(struct brcmf_fws_info *fws, struct sk_buff *skb);
  17189. - void brcmf_fws_bus_blocked(struct brcmf_pub *drvr, bool flow_blocked);
  17190. -+void brcmf_fws_rxreorder(struct brcmf_if *ifp, struct sk_buff *skb);
  17191. -
  17192. - #endif /* FWSIGNAL_H_ */
  17193. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  17194. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  17195. -@@ -527,6 +527,9 @@ static int brcmf_msgbuf_hdrpull(struct b
  17196. - return -ENODEV;
  17197. - }
  17198. -
  17199. -+static void brcmf_msgbuf_rxreorder(struct brcmf_if *ifp, struct sk_buff *skb)
  17200. -+{
  17201. -+}
  17202. -
  17203. - static void
  17204. - brcmf_msgbuf_remove_flowring(struct brcmf_msgbuf *msgbuf, u16 flowid)
  17205. -@@ -1466,6 +1469,7 @@ int brcmf_proto_msgbuf_attach(struct brc
  17206. - drvr->proto->configure_addr_mode = brcmf_msgbuf_configure_addr_mode;
  17207. - drvr->proto->delete_peer = brcmf_msgbuf_delete_peer;
  17208. - drvr->proto->add_tdls_peer = brcmf_msgbuf_add_tdls_peer;
  17209. -+ drvr->proto->rxreorder = brcmf_msgbuf_rxreorder;
  17210. - drvr->proto->pd = msgbuf;
  17211. -
  17212. - init_waitqueue_head(&msgbuf->ioctl_resp_wait);
  17213. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h
  17214. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h
  17215. -@@ -22,6 +22,9 @@ enum proto_addr_mode {
  17216. - ADDR_DIRECT
  17217. - };
  17218. -
  17219. -+struct brcmf_skb_reorder_data {
  17220. -+ u8 *reorder;
  17221. -+};
  17222. -
  17223. - struct brcmf_proto {
  17224. - int (*hdrpull)(struct brcmf_pub *drvr, bool do_fws,
  17225. -@@ -38,6 +41,7 @@ struct brcmf_proto {
  17226. - u8 peer[ETH_ALEN]);
  17227. - void (*add_tdls_peer)(struct brcmf_pub *drvr, int ifidx,
  17228. - u8 peer[ETH_ALEN]);
  17229. -+ void (*rxreorder)(struct brcmf_if *ifp, struct sk_buff *skb);
  17230. - void *pd;
  17231. - };
  17232. -
  17233. -@@ -91,6 +95,18 @@ brcmf_proto_add_tdls_peer(struct brcmf_p
  17234. - {
  17235. - drvr->proto->add_tdls_peer(drvr, ifidx, peer);
  17236. - }
  17237. -+static inline bool brcmf_proto_is_reorder_skb(struct sk_buff *skb)
  17238. -+{
  17239. -+ struct brcmf_skb_reorder_data *rd;
  17240. -+
  17241. -+ rd = (struct brcmf_skb_reorder_data *)skb->cb;
  17242. -+ return !!rd->reorder;
  17243. -+}
  17244. -
  17245. -+static inline void
  17246. -+brcmf_proto_rxreorder(struct brcmf_if *ifp, struct sk_buff *skb)
  17247. -+{
  17248. -+ ifp->drvr->proto->rxreorder(ifp, skb);
  17249. -+}
  17250. -
  17251. - #endif /* BRCMFMAC_PROTO_H */
  17252. diff --git a/package/kernel/mac80211/patches/349-0007-brcmfmac-revise-handling-events-in-receive-path.patch b/package/kernel/mac80211/patches/349-0007-brcmfmac-revise-handling-events-in-receive-path.patch
  17253. deleted file mode 100644
  17254. index a43feff..0000000
  17255. --- a/package/kernel/mac80211/patches/349-0007-brcmfmac-revise-handling-events-in-receive-path.patch
  17256. +++ /dev/null
  17257. @@ -1,139 +0,0 @@
  17258. -From: Arend van Spriel <arend@broadcom.com>
  17259. -Date: Mon, 11 Apr 2016 11:35:27 +0200
  17260. -Subject: [PATCH] brcmfmac: revise handling events in receive path
  17261. -
  17262. -Move event handling out of brcmf_netif_rx() avoiding the need
  17263. -to pass a flag. This flag is only ever true for USB hosts as
  17264. -other interface use separate brcmf_rx_event() function.
  17265. -
  17266. -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  17267. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  17268. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  17269. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  17270. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17271. ----
  17272. -
  17273. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
  17274. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
  17275. -@@ -216,7 +216,7 @@ bool brcmf_c_prec_enq(struct device *dev
  17276. - int prec);
  17277. -
  17278. - /* Receive frame for delivery to OS. Callee disposes of rxp. */
  17279. --void brcmf_rx_frame(struct device *dev, struct sk_buff *rxp, bool handle_evnt);
  17280. -+void brcmf_rx_frame(struct device *dev, struct sk_buff *rxp, bool handle_event);
  17281. - /* Receive async event packet from firmware. Callee disposes of rxp. */
  17282. - void brcmf_rx_event(struct device *dev, struct sk_buff *rxp);
  17283. -
  17284. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  17285. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  17286. -@@ -298,18 +298,11 @@ void brcmf_txflowblock(struct device *de
  17287. - brcmf_fws_bus_blocked(drvr, state);
  17288. - }
  17289. -
  17290. --void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb,
  17291. -- bool handle_event)
  17292. -+void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb)
  17293. - {
  17294. -- skb->protocol = eth_type_trans(skb, ifp->ndev);
  17295. --
  17296. - if (skb->pkt_type == PACKET_MULTICAST)
  17297. - ifp->stats.multicast++;
  17298. -
  17299. -- /* Process special event packets */
  17300. -- if (handle_event)
  17301. -- brcmf_fweh_process_skb(ifp->drvr, skb);
  17302. --
  17303. - if (!(ifp->ndev->flags & IFF_UP)) {
  17304. - brcmu_pkt_buf_free_skb(skb);
  17305. - return;
  17306. -@@ -329,7 +322,7 @@ void brcmf_netif_rx(struct brcmf_if *ifp
  17307. - netif_rx_ni(skb);
  17308. - }
  17309. -
  17310. --void brcmf_rx_frame(struct device *dev, struct sk_buff *skb, bool handle_evnt)
  17311. -+void brcmf_rx_frame(struct device *dev, struct sk_buff *skb, bool handle_event)
  17312. - {
  17313. - struct brcmf_if *ifp;
  17314. - struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  17315. -@@ -348,10 +341,17 @@ void brcmf_rx_frame(struct device *dev,
  17316. - return;
  17317. - }
  17318. -
  17319. -- if (brcmf_proto_is_reorder_skb(skb))
  17320. -+ skb->protocol = eth_type_trans(skb, ifp->ndev);
  17321. -+
  17322. -+ if (brcmf_proto_is_reorder_skb(skb)) {
  17323. - brcmf_proto_rxreorder(ifp, skb);
  17324. -- else
  17325. -- brcmf_netif_rx(ifp, skb, handle_evnt);
  17326. -+ } else {
  17327. -+ /* Process special event packets */
  17328. -+ if (handle_event)
  17329. -+ brcmf_fweh_process_skb(ifp->drvr, skb);
  17330. -+
  17331. -+ brcmf_netif_rx(ifp, skb);
  17332. -+ }
  17333. - }
  17334. -
  17335. - void brcmf_rx_event(struct device *dev, struct sk_buff *skb)
  17336. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  17337. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  17338. -@@ -221,8 +221,7 @@ int brcmf_get_next_free_bsscfgidx(struct
  17339. - void brcmf_txflowblock_if(struct brcmf_if *ifp,
  17340. - enum brcmf_netif_stop_reason reason, bool state);
  17341. - void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
  17342. --void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb,
  17343. -- bool handle_event);
  17344. -+void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb);
  17345. - void brcmf_net_setcarrier(struct brcmf_if *ifp, bool on);
  17346. - int __init brcmf_core_init(void);
  17347. - void __exit brcmf_core_exit(void);
  17348. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
  17349. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
  17350. -@@ -1668,7 +1668,7 @@ void brcmf_fws_rxreorder(struct brcmf_if
  17351. - /* validate flags and flow id */
  17352. - if (flags == 0xFF) {
  17353. - brcmf_err("invalid flags...so ignore this packet\n");
  17354. -- brcmf_netif_rx(ifp, pkt, false);
  17355. -+ brcmf_netif_rx(ifp, pkt);
  17356. - return;
  17357. - }
  17358. -
  17359. -@@ -1680,7 +1680,7 @@ void brcmf_fws_rxreorder(struct brcmf_if
  17360. - if (rfi == NULL) {
  17361. - brcmf_dbg(INFO, "received flags to cleanup, but no flow (%d) yet\n",
  17362. - flow_id);
  17363. -- brcmf_netif_rx(ifp, pkt, false);
  17364. -+ brcmf_netif_rx(ifp, pkt);
  17365. - return;
  17366. - }
  17367. -
  17368. -@@ -1705,7 +1705,7 @@ void brcmf_fws_rxreorder(struct brcmf_if
  17369. - rfi = kzalloc(buf_size, GFP_ATOMIC);
  17370. - if (rfi == NULL) {
  17371. - brcmf_err("failed to alloc buffer\n");
  17372. -- brcmf_netif_rx(ifp, pkt, false);
  17373. -+ brcmf_netif_rx(ifp, pkt);
  17374. - return;
  17375. - }
  17376. -
  17377. -@@ -1819,7 +1819,7 @@ void brcmf_fws_rxreorder(struct brcmf_if
  17378. - netif_rx:
  17379. - skb_queue_walk_safe(&reorder_list, pkt, pnext) {
  17380. - __skb_unlink(pkt, &reorder_list);
  17381. -- brcmf_netif_rx(ifp, pkt, false);
  17382. -+ brcmf_netif_rx(ifp, pkt);
  17383. - }
  17384. - }
  17385. -
  17386. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  17387. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  17388. -@@ -1157,7 +1157,7 @@ brcmf_msgbuf_process_rx_complete(struct
  17389. - brcmu_pkt_buf_free_skb(skb);
  17390. - return;
  17391. - }
  17392. -- brcmf_netif_rx(ifp, skb, false);
  17393. -+ brcmf_netif_rx(ifp, skb);
  17394. - }
  17395. -
  17396. -
  17397. diff --git a/package/kernel/mac80211/patches/349-0008-brcmfmac-create-common-function-for-handling-brcmf_p.patch b/package/kernel/mac80211/patches/349-0008-brcmfmac-create-common-function-for-handling-brcmf_p.patch
  17398. deleted file mode 100644
  17399. index 08ea235..0000000
  17400. --- a/package/kernel/mac80211/patches/349-0008-brcmfmac-create-common-function-for-handling-brcmf_p.patch
  17401. +++ /dev/null
  17402. @@ -1,88 +0,0 @@
  17403. -From: Arend van Spriel <arend@broadcom.com>
  17404. -Date: Mon, 11 Apr 2016 11:35:28 +0200
  17405. -Subject: [PATCH] brcmfmac: create common function for handling
  17406. - brcmf_proto_hdrpull()
  17407. -
  17408. -In receive path brcmf_proto_hdrpull() needs to be called and handled
  17409. -similar in brcmf_rx_frame() and brcmf_rx_event(). Move that duplicated
  17410. -code in separate function.
  17411. -
  17412. -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  17413. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  17414. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  17415. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  17416. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17417. ----
  17418. -
  17419. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  17420. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  17421. -@@ -322,26 +322,35 @@ void brcmf_netif_rx(struct brcmf_if *ifp
  17422. - netif_rx_ni(skb);
  17423. - }
  17424. -
  17425. --void brcmf_rx_frame(struct device *dev, struct sk_buff *skb, bool handle_event)
  17426. -+static int brcmf_rx_hdrpull(struct brcmf_pub *drvr, struct sk_buff *skb,
  17427. -+ struct brcmf_if **ifp)
  17428. - {
  17429. -- struct brcmf_if *ifp;
  17430. -- struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  17431. -- struct brcmf_pub *drvr = bus_if->drvr;
  17432. - int ret;
  17433. -
  17434. -- brcmf_dbg(DATA, "Enter: %s: rxp=%p\n", dev_name(dev), skb);
  17435. --
  17436. - /* process and remove protocol-specific header */
  17437. -- ret = brcmf_proto_hdrpull(drvr, true, skb, &ifp);
  17438. -+ ret = brcmf_proto_hdrpull(drvr, true, skb, ifp);
  17439. -
  17440. -- if (ret || !ifp || !ifp->ndev) {
  17441. -+ if (ret || !(*ifp) || !(*ifp)->ndev) {
  17442. - if (ret != -ENODATA && ifp)
  17443. -- ifp->stats.rx_errors++;
  17444. -+ (*ifp)->stats.rx_errors++;
  17445. - brcmu_pkt_buf_free_skb(skb);
  17446. -- return;
  17447. -+ return -ENODATA;
  17448. - }
  17449. -
  17450. -- skb->protocol = eth_type_trans(skb, ifp->ndev);
  17451. -+ skb->protocol = eth_type_trans(skb, (*ifp)->ndev);
  17452. -+ return 0;
  17453. -+}
  17454. -+
  17455. -+void brcmf_rx_frame(struct device *dev, struct sk_buff *skb, bool handle_event)
  17456. -+{
  17457. -+ struct brcmf_if *ifp;
  17458. -+ struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  17459. -+ struct brcmf_pub *drvr = bus_if->drvr;
  17460. -+
  17461. -+ brcmf_dbg(DATA, "Enter: %s: rxp=%p\n", dev_name(dev), skb);
  17462. -+
  17463. -+ if (brcmf_rx_hdrpull(drvr, skb, &ifp))
  17464. -+ return;
  17465. -
  17466. - if (brcmf_proto_is_reorder_skb(skb)) {
  17467. - brcmf_proto_rxreorder(ifp, skb);
  17468. -@@ -359,21 +368,11 @@ void brcmf_rx_event(struct device *dev,
  17469. - struct brcmf_if *ifp;
  17470. - struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  17471. - struct brcmf_pub *drvr = bus_if->drvr;
  17472. -- int ret;
  17473. -
  17474. - brcmf_dbg(EVENT, "Enter: %s: rxp=%p\n", dev_name(dev), skb);
  17475. -
  17476. -- /* process and remove protocol-specific header */
  17477. -- ret = brcmf_proto_hdrpull(drvr, true, skb, &ifp);
  17478. --
  17479. -- if (ret || !ifp || !ifp->ndev) {
  17480. -- if (ret != -ENODATA && ifp)
  17481. -- ifp->stats.rx_errors++;
  17482. -- brcmu_pkt_buf_free_skb(skb);
  17483. -+ if (brcmf_rx_hdrpull(drvr, skb, &ifp))
  17484. - return;
  17485. -- }
  17486. --
  17487. -- skb->protocol = eth_type_trans(skb, ifp->ndev);
  17488. -
  17489. - brcmf_fweh_process_skb(ifp->drvr, skb);
  17490. - brcmu_pkt_buf_free_skb(skb);
  17491. diff --git a/package/kernel/mac80211/patches/351-0005-brcmfmac-rework-function-picking-free-BSS-index.patch b/package/kernel/mac80211/patches/351-0005-brcmfmac-rework-function-picking-free-BSS-index.patch
  17492. deleted file mode 100644
  17493. index c602f22..0000000
  17494. --- a/package/kernel/mac80211/patches/351-0005-brcmfmac-rework-function-picking-free-BSS-index.patch
  17495. +++ /dev/null
  17496. @@ -1,119 +0,0 @@
  17497. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  17498. -Date: Thu, 26 May 2016 01:44:27 +0200
  17499. -Subject: [PATCH] brcmfmac: rework function picking free BSS index
  17500. -MIME-Version: 1.0
  17501. -Content-Type: text/plain; charset=UTF-8
  17502. -Content-Transfer-Encoding: 8bit
  17503. -
  17504. -The old implementation was overcomplicated and slightly bugged in some
  17505. -corner cases.
  17506. -
  17507. -Consider following state of BSS-es (limited to 6 for simplification):
  17508. -drvr->iflist[0]: { bsscfgidx:0, ndev->name:wlan1, }
  17509. -drvr->iflist[1]: (null)
  17510. -drvr->iflist[2]: { bsscfgidx:2, ndev->name:wlan1-1, }
  17511. -drvr->iflist[3]: { bsscfgidx:3, ndev->name:wlan1-2, }
  17512. -drvr->iflist[4]: (null)
  17513. -drvr->iflist[5]: (null)
  17514. -In such case the next AP interface should bsscfgidx 4 (we don't use 1 as
  17515. -it's reserved for P2P).
  17516. -
  17517. -With old code the loop iterations were following:
  17518. -[ifidx = 0] [bsscfgidx = 2] [highest = 2]
  17519. -[ifidx = 1] [bsscfgidx = 2] [highest = 2] available = true
  17520. -[ifidx = 2] [bsscfgidx = 2] [highest = 2] bsscfgidx = highest + 1
  17521. -[ifidx = 3] [bsscfgidx = 3] [highest = 2] bsscfgidx = highest + 1
  17522. -[ifidx = 4] [bsscfgidx = 3] [highest = 2] available = true
  17523. -[ifidx = 5] [bsscfgidx = 3] [highest = 2] available = true
  17524. -There were 2 obvious problems:
  17525. -1) Having empty BSS at index 1 was resulting in available being always
  17526. - set to true, even if we would run out of BSS-es.
  17527. -2) Calculated bsscfgidx was invalid (3 instead of 4) resulting in driver
  17528. - not being able to create the 4th AP interface.
  17529. -
  17530. -New code is simpler, placed in file where it's really used, handles
  17531. -running out of free BSS-es and allows using 4 interfaces at the same
  17532. -time. It also looks for the first free BSS instead of one after the last
  17533. -in use. It works well with current driver (which doesn't allow deleting
  17534. -interfaces) and should be future proof (if we ever allow deleting).
  17535. -
  17536. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  17537. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17538. ----
  17539. -
  17540. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  17541. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  17542. -@@ -527,6 +527,21 @@ brcmf_cfg80211_update_proto_addr_mode(st
  17543. - ADDR_INDIRECT);
  17544. - }
  17545. -
  17546. -+static int brcmf_get_first_free_bsscfgidx(struct brcmf_pub *drvr)
  17547. -+{
  17548. -+ int bsscfgidx;
  17549. -+
  17550. -+ for (bsscfgidx = 0; bsscfgidx < BRCMF_MAX_IFS; bsscfgidx++) {
  17551. -+ /* bsscfgidx 1 is reserved for legacy P2P */
  17552. -+ if (bsscfgidx == 1)
  17553. -+ continue;
  17554. -+ if (!drvr->iflist[bsscfgidx])
  17555. -+ return bsscfgidx;
  17556. -+ }
  17557. -+
  17558. -+ return -ENOMEM;
  17559. -+}
  17560. -+
  17561. - static int brcmf_cfg80211_request_ap_if(struct brcmf_if *ifp)
  17562. - {
  17563. - struct brcmf_mbss_ssid_le mbss_ssid_le;
  17564. -@@ -534,7 +549,7 @@ static int brcmf_cfg80211_request_ap_if(
  17565. - int err;
  17566. -
  17567. - memset(&mbss_ssid_le, 0, sizeof(mbss_ssid_le));
  17568. -- bsscfgidx = brcmf_get_next_free_bsscfgidx(ifp->drvr);
  17569. -+ bsscfgidx = brcmf_get_first_free_bsscfgidx(ifp->drvr);
  17570. - if (bsscfgidx < 0)
  17571. - return bsscfgidx;
  17572. -
  17573. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  17574. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  17575. -@@ -753,30 +753,6 @@ void brcmf_remove_interface(struct brcmf
  17576. - brcmf_del_if(ifp->drvr, ifp->bsscfgidx);
  17577. - }
  17578. -
  17579. --int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr)
  17580. --{
  17581. -- int ifidx;
  17582. -- int bsscfgidx;
  17583. -- bool available;
  17584. -- int highest;
  17585. --
  17586. -- available = false;
  17587. -- bsscfgidx = 2;
  17588. -- highest = 2;
  17589. -- for (ifidx = 0; ifidx < BRCMF_MAX_IFS; ifidx++) {
  17590. -- if (drvr->iflist[ifidx]) {
  17591. -- if (drvr->iflist[ifidx]->bsscfgidx == bsscfgidx)
  17592. -- bsscfgidx = highest + 1;
  17593. -- else if (drvr->iflist[ifidx]->bsscfgidx > highest)
  17594. -- highest = drvr->iflist[ifidx]->bsscfgidx;
  17595. -- } else {
  17596. -- available = true;
  17597. -- }
  17598. -- }
  17599. --
  17600. -- return available ? bsscfgidx : -ENOMEM;
  17601. --}
  17602. --
  17603. - #ifdef CONFIG_INET
  17604. - #define ARPOL_MAX_ENTRIES 8
  17605. - static int brcmf_inetaddr_changed(struct notifier_block *nb,
  17606. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  17607. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  17608. -@@ -217,7 +217,6 @@ int brcmf_net_attach(struct brcmf_if *if
  17609. - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
  17610. - bool is_p2pdev, char *name, u8 *mac_addr);
  17611. - void brcmf_remove_interface(struct brcmf_if *ifp);
  17612. --int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr);
  17613. - void brcmf_txflowblock_if(struct brcmf_if *ifp,
  17614. - enum brcmf_netif_stop_reason reason, bool state);
  17615. - void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
  17616. diff --git a/package/kernel/mac80211/patches/351-0007-brcmutil-add-field-storing-control-channel-to-the-st.patch b/package/kernel/mac80211/patches/351-0007-brcmutil-add-field-storing-control-channel-to-the-st.patch
  17617. deleted file mode 100644
  17618. index a79c9a2..0000000
  17619. --- a/package/kernel/mac80211/patches/351-0007-brcmutil-add-field-storing-control-channel-to-the-st.patch
  17620. +++ /dev/null
  17621. @@ -1,244 +0,0 @@
  17622. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  17623. -Date: Fri, 20 May 2016 13:38:57 +0200
  17624. -Subject: [PATCH] brcmutil: add field storing control channel to the struct
  17625. - brcmu_chan
  17626. -MIME-Version: 1.0
  17627. -Content-Type: text/plain; charset=UTF-8
  17628. -Content-Transfer-Encoding: 8bit
  17629. -
  17630. -Our d11 code supports encoding/decoding channel info into/from chanspec
  17631. -format used by firmware. Current implementation is quite misleading
  17632. -because of the way "chnum" field is used.
  17633. -When encoding channel info, "chnum" has to be filled by a caller with
  17634. -*center* channel number. However when decoding chanspec the same field
  17635. -is filled with a *control* channel number.
  17636. -
  17637. -1) This can be confusing. It's expected for information to be the same
  17638. - after encoding and decoding.
  17639. -2) It doesn't allow accessing all info when decoding. Some functions may
  17640. - need to know both channel numbers, e.g. cfg80211 callback getting
  17641. - current channel.
  17642. -Solve this by adding a separated field for control channel.
  17643. -
  17644. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  17645. -Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  17646. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17647. ----
  17648. -
  17649. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  17650. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  17651. -@@ -2689,7 +2689,7 @@ static s32 brcmf_inform_single_bss(struc
  17652. - if (!bi->ctl_ch) {
  17653. - ch.chspec = le16_to_cpu(bi->chanspec);
  17654. - cfg->d11inf.decchspec(&ch);
  17655. -- bi->ctl_ch = ch.chnum;
  17656. -+ bi->ctl_ch = ch.control_ch_num;
  17657. - }
  17658. - channel = bi->ctl_ch;
  17659. -
  17660. -@@ -2807,7 +2807,7 @@ static s32 brcmf_inform_ibss(struct brcm
  17661. - else
  17662. - band = wiphy->bands[IEEE80211_BAND_5GHZ];
  17663. -
  17664. -- freq = ieee80211_channel_to_frequency(ch.chnum, band->band);
  17665. -+ freq = ieee80211_channel_to_frequency(ch.control_ch_num, band->band);
  17666. - cfg->channel = freq;
  17667. - notify_channel = ieee80211_get_channel(wiphy, freq);
  17668. -
  17669. -@@ -2817,7 +2817,7 @@ static s32 brcmf_inform_ibss(struct brcm
  17670. - notify_ielen = le32_to_cpu(bi->ie_length);
  17671. - notify_signal = (s16)le16_to_cpu(bi->RSSI) * 100;
  17672. -
  17673. -- brcmf_dbg(CONN, "channel: %d(%d)\n", ch.chnum, freq);
  17674. -+ brcmf_dbg(CONN, "channel: %d(%d)\n", ch.control_ch_num, freq);
  17675. - brcmf_dbg(CONN, "capability: %X\n", notify_capability);
  17676. - brcmf_dbg(CONN, "beacon interval: %d\n", notify_interval);
  17677. - brcmf_dbg(CONN, "signal: %d\n", notify_signal);
  17678. -@@ -5235,7 +5235,7 @@ brcmf_bss_roaming_done(struct brcmf_cfg8
  17679. - else
  17680. - band = wiphy->bands[IEEE80211_BAND_5GHZ];
  17681. -
  17682. -- freq = ieee80211_channel_to_frequency(ch.chnum, band->band);
  17683. -+ freq = ieee80211_channel_to_frequency(ch.control_ch_num, band->band);
  17684. - notify_channel = ieee80211_get_channel(wiphy, freq);
  17685. -
  17686. - done:
  17687. -@@ -5757,14 +5757,15 @@ static int brcmf_construct_chaninfo(stru
  17688. - channel = band->channels;
  17689. - index = band->n_channels;
  17690. - for (j = 0; j < band->n_channels; j++) {
  17691. -- if (channel[j].hw_value == ch.chnum) {
  17692. -+ if (channel[j].hw_value == ch.control_ch_num) {
  17693. - index = j;
  17694. - break;
  17695. - }
  17696. - }
  17697. - channel[index].center_freq =
  17698. -- ieee80211_channel_to_frequency(ch.chnum, band->band);
  17699. -- channel[index].hw_value = ch.chnum;
  17700. -+ ieee80211_channel_to_frequency(ch.control_ch_num,
  17701. -+ band->band);
  17702. -+ channel[index].hw_value = ch.control_ch_num;
  17703. -
  17704. - /* assuming the chanspecs order is HT20,
  17705. - * HT40 upper, HT40 lower, and VHT80.
  17706. -@@ -5866,7 +5867,7 @@ static int brcmf_enable_bw40_2g(struct b
  17707. - if (WARN_ON(ch.bw != BRCMU_CHAN_BW_40))
  17708. - continue;
  17709. - for (j = 0; j < band->n_channels; j++) {
  17710. -- if (band->channels[j].hw_value == ch.chnum)
  17711. -+ if (band->channels[j].hw_value == ch.control_ch_num)
  17712. - break;
  17713. - }
  17714. - if (WARN_ON(j == band->n_channels))
  17715. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  17716. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  17717. -@@ -1246,7 +1246,7 @@ bool brcmf_p2p_scan_finding_common_chann
  17718. - if (!bi->ctl_ch) {
  17719. - ch.chspec = le16_to_cpu(bi->chanspec);
  17720. - cfg->d11inf.decchspec(&ch);
  17721. -- bi->ctl_ch = ch.chnum;
  17722. -+ bi->ctl_ch = ch.control_ch_num;
  17723. - }
  17724. - afx_hdl->peer_chan = bi->ctl_ch;
  17725. - brcmf_dbg(TRACE, "ACTION FRAME SCAN : Peer %pM found, channel : %d\n",
  17726. -@@ -1385,7 +1385,7 @@ int brcmf_p2p_notify_action_frame_rx(str
  17727. - if (test_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL,
  17728. - &p2p->status) &&
  17729. - (ether_addr_equal(afx_hdl->tx_dst_addr, e->addr))) {
  17730. -- afx_hdl->peer_chan = ch.chnum;
  17731. -+ afx_hdl->peer_chan = ch.control_ch_num;
  17732. - brcmf_dbg(INFO, "GON request: Peer found, channel=%d\n",
  17733. - afx_hdl->peer_chan);
  17734. - complete(&afx_hdl->act_frm_scan);
  17735. -@@ -1428,7 +1428,7 @@ int brcmf_p2p_notify_action_frame_rx(str
  17736. - memcpy(&mgmt_frame->u, frame, mgmt_frame_len);
  17737. - mgmt_frame_len += offsetof(struct ieee80211_mgmt, u);
  17738. -
  17739. -- freq = ieee80211_channel_to_frequency(ch.chnum,
  17740. -+ freq = ieee80211_channel_to_frequency(ch.control_ch_num,
  17741. - ch.band == BRCMU_CHAN_BAND_2G ?
  17742. - IEEE80211_BAND_2GHZ :
  17743. - IEEE80211_BAND_5GHZ);
  17744. -@@ -1873,7 +1873,7 @@ s32 brcmf_p2p_notify_rx_mgmt_p2p_probere
  17745. -
  17746. - if (test_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL, &p2p->status) &&
  17747. - (ether_addr_equal(afx_hdl->tx_dst_addr, e->addr))) {
  17748. -- afx_hdl->peer_chan = ch.chnum;
  17749. -+ afx_hdl->peer_chan = ch.control_ch_num;
  17750. - brcmf_dbg(INFO, "PROBE REQUEST: Peer found, channel=%d\n",
  17751. - afx_hdl->peer_chan);
  17752. - complete(&afx_hdl->act_frm_scan);
  17753. -@@ -1898,7 +1898,7 @@ s32 brcmf_p2p_notify_rx_mgmt_p2p_probere
  17754. -
  17755. - mgmt_frame = (u8 *)(rxframe + 1);
  17756. - mgmt_frame_len = e->datalen - sizeof(*rxframe);
  17757. -- freq = ieee80211_channel_to_frequency(ch.chnum,
  17758. -+ freq = ieee80211_channel_to_frequency(ch.control_ch_num,
  17759. - ch.band == BRCMU_CHAN_BAND_2G ?
  17760. - IEEE80211_BAND_2GHZ :
  17761. - IEEE80211_BAND_5GHZ);
  17762. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmutil/d11.c
  17763. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmutil/d11.c
  17764. -@@ -107,6 +107,7 @@ static void brcmu_d11n_decchspec(struct
  17765. - u16 val;
  17766. -
  17767. - ch->chnum = (u8)(ch->chspec & BRCMU_CHSPEC_CH_MASK);
  17768. -+ ch->control_ch_num = ch->chnum;
  17769. -
  17770. - switch (ch->chspec & BRCMU_CHSPEC_D11N_BW_MASK) {
  17771. - case BRCMU_CHSPEC_D11N_BW_20:
  17772. -@@ -118,10 +119,10 @@ static void brcmu_d11n_decchspec(struct
  17773. - val = ch->chspec & BRCMU_CHSPEC_D11N_SB_MASK;
  17774. - if (val == BRCMU_CHSPEC_D11N_SB_L) {
  17775. - ch->sb = BRCMU_CHAN_SB_L;
  17776. -- ch->chnum -= CH_10MHZ_APART;
  17777. -+ ch->control_ch_num -= CH_10MHZ_APART;
  17778. - } else {
  17779. - ch->sb = BRCMU_CHAN_SB_U;
  17780. -- ch->chnum += CH_10MHZ_APART;
  17781. -+ ch->control_ch_num += CH_10MHZ_APART;
  17782. - }
  17783. - break;
  17784. - default:
  17785. -@@ -147,6 +148,7 @@ static void brcmu_d11ac_decchspec(struct
  17786. - u16 val;
  17787. -
  17788. - ch->chnum = (u8)(ch->chspec & BRCMU_CHSPEC_CH_MASK);
  17789. -+ ch->control_ch_num = ch->chnum;
  17790. -
  17791. - switch (ch->chspec & BRCMU_CHSPEC_D11AC_BW_MASK) {
  17792. - case BRCMU_CHSPEC_D11AC_BW_20:
  17793. -@@ -158,10 +160,10 @@ static void brcmu_d11ac_decchspec(struct
  17794. - val = ch->chspec & BRCMU_CHSPEC_D11AC_SB_MASK;
  17795. - if (val == BRCMU_CHSPEC_D11AC_SB_L) {
  17796. - ch->sb = BRCMU_CHAN_SB_L;
  17797. -- ch->chnum -= CH_10MHZ_APART;
  17798. -+ ch->control_ch_num -= CH_10MHZ_APART;
  17799. - } else if (val == BRCMU_CHSPEC_D11AC_SB_U) {
  17800. - ch->sb = BRCMU_CHAN_SB_U;
  17801. -- ch->chnum += CH_10MHZ_APART;
  17802. -+ ch->control_ch_num += CH_10MHZ_APART;
  17803. - } else {
  17804. - WARN_ON_ONCE(1);
  17805. - }
  17806. -@@ -172,16 +174,16 @@ static void brcmu_d11ac_decchspec(struct
  17807. - BRCMU_CHSPEC_D11AC_SB_SHIFT);
  17808. - switch (ch->sb) {
  17809. - case BRCMU_CHAN_SB_LL:
  17810. -- ch->chnum -= CH_30MHZ_APART;
  17811. -+ ch->control_ch_num -= CH_30MHZ_APART;
  17812. - break;
  17813. - case BRCMU_CHAN_SB_LU:
  17814. -- ch->chnum -= CH_10MHZ_APART;
  17815. -+ ch->control_ch_num -= CH_10MHZ_APART;
  17816. - break;
  17817. - case BRCMU_CHAN_SB_UL:
  17818. -- ch->chnum += CH_10MHZ_APART;
  17819. -+ ch->control_ch_num += CH_10MHZ_APART;
  17820. - break;
  17821. - case BRCMU_CHAN_SB_UU:
  17822. -- ch->chnum += CH_30MHZ_APART;
  17823. -+ ch->control_ch_num += CH_30MHZ_APART;
  17824. - break;
  17825. - default:
  17826. - WARN_ON_ONCE(1);
  17827. ---- a/drivers/net/wireless/broadcom/brcm80211/include/brcmu_d11.h
  17828. -+++ b/drivers/net/wireless/broadcom/brcm80211/include/brcmu_d11.h
  17829. -@@ -125,14 +125,36 @@ enum brcmu_chan_sb {
  17830. - BRCMU_CHAN_SB_UU = BRCMU_CHAN_SB_LUU,
  17831. - };
  17832. -
  17833. -+/**
  17834. -+ * struct brcmu_chan - stores channel formats
  17835. -+ *
  17836. -+ * This structure can be used with functions translating chanspec into generic
  17837. -+ * channel info and the other way.
  17838. -+ *
  17839. -+ * @chspec: firmware specific format
  17840. -+ * @chnum: center channel number
  17841. -+ * @control_ch_num: control channel number
  17842. -+ * @band: frequency band
  17843. -+ * @bw: channel width
  17844. -+ * @sb: control sideband (location of control channel against the center one)
  17845. -+ */
  17846. - struct brcmu_chan {
  17847. - u16 chspec;
  17848. - u8 chnum;
  17849. -+ u8 control_ch_num;
  17850. - u8 band;
  17851. - enum brcmu_chan_bw bw;
  17852. - enum brcmu_chan_sb sb;
  17853. - };
  17854. -
  17855. -+/**
  17856. -+ * struct brcmu_d11inf - provides functions translating channel format
  17857. -+ *
  17858. -+ * @io_type: determines version of channel format used by firmware
  17859. -+ * @encchspec: encodes channel info into a chanspec, requires center channel
  17860. -+ * number, ignores control one
  17861. -+ * @decchspec: decodes chanspec into generic info
  17862. -+ */
  17863. - struct brcmu_d11inf {
  17864. - u8 io_type;
  17865. -
  17866. diff --git a/package/kernel/mac80211/patches/351-0008-brcmfmac-support-get_channel-cfg80211-callback.patch b/package/kernel/mac80211/patches/351-0008-brcmfmac-support-get_channel-cfg80211-callback.patch
  17867. deleted file mode 100644
  17868. index 2c536d1..0000000
  17869. --- a/package/kernel/mac80211/patches/351-0008-brcmfmac-support-get_channel-cfg80211-callback.patch
  17870. +++ /dev/null
  17871. @@ -1,94 +0,0 @@
  17872. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  17873. -Date: Fri, 20 May 2016 13:38:58 +0200
  17874. -Subject: [PATCH] brcmfmac: support get_channel cfg80211 callback
  17875. -MIME-Version: 1.0
  17876. -Content-Type: text/plain; charset=UTF-8
  17877. -Content-Transfer-Encoding: 8bit
  17878. -
  17879. -This is important for brcmfmac as some of released firmwares (e.g.
  17880. -brcmfmac4366b-pcie.bin) may pick different channel than requested. This
  17881. -has been tested with BCM4366B1 in D-Link DIR-885L.
  17882. -
  17883. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  17884. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17885. ----
  17886. -
  17887. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  17888. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  17889. -@@ -4847,6 +4847,68 @@ exit:
  17890. - return err;
  17891. - }
  17892. -
  17893. -+static int brcmf_cfg80211_get_channel(struct wiphy *wiphy,
  17894. -+ struct wireless_dev *wdev,
  17895. -+ struct cfg80211_chan_def *chandef)
  17896. -+{
  17897. -+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
  17898. -+ struct net_device *ndev = wdev->netdev;
  17899. -+ struct brcmf_if *ifp;
  17900. -+ struct brcmu_chan ch;
  17901. -+ enum nl80211_band band = 0;
  17902. -+ enum nl80211_chan_width width = 0;
  17903. -+ u32 chanspec;
  17904. -+ int freq, err;
  17905. -+
  17906. -+ if (!ndev)
  17907. -+ return -ENODEV;
  17908. -+ ifp = netdev_priv(ndev);
  17909. -+
  17910. -+ err = brcmf_fil_iovar_int_get(ifp, "chanspec", &chanspec);
  17911. -+ if (err) {
  17912. -+ brcmf_err("chanspec failed (%d)\n", err);
  17913. -+ return err;
  17914. -+ }
  17915. -+
  17916. -+ ch.chspec = chanspec;
  17917. -+ cfg->d11inf.decchspec(&ch);
  17918. -+
  17919. -+ switch (ch.band) {
  17920. -+ case BRCMU_CHAN_BAND_2G:
  17921. -+ band = NL80211_BAND_2GHZ;
  17922. -+ break;
  17923. -+ case BRCMU_CHAN_BAND_5G:
  17924. -+ band = NL80211_BAND_5GHZ;
  17925. -+ break;
  17926. -+ }
  17927. -+
  17928. -+ switch (ch.bw) {
  17929. -+ case BRCMU_CHAN_BW_80:
  17930. -+ width = NL80211_CHAN_WIDTH_80;
  17931. -+ break;
  17932. -+ case BRCMU_CHAN_BW_40:
  17933. -+ width = NL80211_CHAN_WIDTH_40;
  17934. -+ break;
  17935. -+ case BRCMU_CHAN_BW_20:
  17936. -+ width = NL80211_CHAN_WIDTH_20;
  17937. -+ break;
  17938. -+ case BRCMU_CHAN_BW_80P80:
  17939. -+ width = NL80211_CHAN_WIDTH_80P80;
  17940. -+ break;
  17941. -+ case BRCMU_CHAN_BW_160:
  17942. -+ width = NL80211_CHAN_WIDTH_160;
  17943. -+ break;
  17944. -+ }
  17945. -+
  17946. -+ freq = ieee80211_channel_to_frequency(ch.control_ch_num, band);
  17947. -+ chandef->chan = ieee80211_get_channel(wiphy, freq);
  17948. -+ chandef->width = width;
  17949. -+ chandef->center_freq1 = ieee80211_channel_to_frequency(ch.chnum, band);
  17950. -+ chandef->center_freq2 = 0;
  17951. -+
  17952. -+ return 0;
  17953. -+}
  17954. -+
  17955. - static int brcmf_cfg80211_crit_proto_start(struct wiphy *wiphy,
  17956. - struct wireless_dev *wdev,
  17957. - enum nl80211_crit_proto_id proto,
  17958. -@@ -5009,6 +5071,7 @@ static struct cfg80211_ops brcmf_cfg8021
  17959. - .mgmt_tx = brcmf_cfg80211_mgmt_tx,
  17960. - .remain_on_channel = brcmf_p2p_remain_on_channel,
  17961. - .cancel_remain_on_channel = brcmf_cfg80211_cancel_remain_on_channel,
  17962. -+ .get_channel = brcmf_cfg80211_get_channel,
  17963. - .start_p2p_device = brcmf_p2p_start_device,
  17964. - .stop_p2p_device = brcmf_p2p_stop_device,
  17965. - .crit_proto_start = brcmf_cfg80211_crit_proto_start,
  17966. diff --git a/package/kernel/mac80211/patches/351-0009-brcmfmac-print-errors-if-creating-interface-fails.patch b/package/kernel/mac80211/patches/351-0009-brcmfmac-print-errors-if-creating-interface-fails.patch
  17967. deleted file mode 100644
  17968. index 1b119b2..0000000
  17969. --- a/package/kernel/mac80211/patches/351-0009-brcmfmac-print-errors-if-creating-interface-fails.patch
  17970. +++ /dev/null
  17971. @@ -1,59 +0,0 @@
  17972. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  17973. -Date: Fri, 27 May 2016 10:54:28 +0200
  17974. -Subject: [PATCH] brcmfmac: print errors if creating interface fails
  17975. -
  17976. -This is helpful for debugging. Without this all I was getting from "iw"
  17977. -command on failed creating of P2P interface was:
  17978. -> command failed: Too many open files in system (-23)
  17979. -
  17980. -Signed-off-by: Rafal Milecki <zajec5@gmail.com>
  17981. -[arend@broadcom.com: reduce error prints upon iface creation]
  17982. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  17983. -Reviewed-by: Julian Calaby <julian.calaby@gmail.com>
  17984. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17985. ----
  17986. -
  17987. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  17988. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  17989. -@@ -670,20 +670,24 @@ static struct wireless_dev *brcmf_cfg802
  17990. - return ERR_PTR(-EOPNOTSUPP);
  17991. - case NL80211_IFTYPE_AP:
  17992. - wdev = brcmf_ap_add_vif(wiphy, name, flags, params);
  17993. -- if (!IS_ERR(wdev))
  17994. -- brcmf_cfg80211_update_proto_addr_mode(wdev);
  17995. -- return wdev;
  17996. -+ break;
  17997. - case NL80211_IFTYPE_P2P_CLIENT:
  17998. - case NL80211_IFTYPE_P2P_GO:
  17999. - case NL80211_IFTYPE_P2P_DEVICE:
  18000. - wdev = brcmf_p2p_add_vif(wiphy, name, name_assign_type, type, flags, params);
  18001. -- if (!IS_ERR(wdev))
  18002. -- brcmf_cfg80211_update_proto_addr_mode(wdev);
  18003. -- return wdev;
  18004. -+ break;
  18005. - case NL80211_IFTYPE_UNSPECIFIED:
  18006. - default:
  18007. - return ERR_PTR(-EINVAL);
  18008. - }
  18009. -+
  18010. -+ if (IS_ERR(wdev))
  18011. -+ brcmf_err("add iface %s type %d failed: err=%d\n",
  18012. -+ name, type, (int)PTR_ERR(wdev));
  18013. -+ else
  18014. -+ brcmf_cfg80211_update_proto_addr_mode(wdev);
  18015. -+
  18016. -+ return wdev;
  18017. - }
  18018. -
  18019. - static void brcmf_scan_config_mpc(struct brcmf_if *ifp, int mpc)
  18020. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  18021. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  18022. -@@ -2030,8 +2030,6 @@ static int brcmf_p2p_request_p2p_if(stru
  18023. -
  18024. - err = brcmf_fil_iovar_data_set(ifp, "p2p_ifadd", &if_request,
  18025. - sizeof(if_request));
  18026. -- if (err)
  18027. -- return err;
  18028. -
  18029. - return err;
  18030. - }
  18031. diff --git a/package/kernel/mac80211/patches/351-0010-brcmfmac-fix-setting-AP-channel-with-new-firmwares.patch b/package/kernel/mac80211/patches/351-0010-brcmfmac-fix-setting-AP-channel-with-new-firmwares.patch
  18032. deleted file mode 100644
  18033. index a2e18a5..0000000
  18034. --- a/package/kernel/mac80211/patches/351-0010-brcmfmac-fix-setting-AP-channel-with-new-firmwares.patch
  18035. +++ /dev/null
  18036. @@ -1,114 +0,0 @@
  18037. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  18038. -Date: Fri, 27 May 2016 21:07:19 +0200
  18039. -Subject: [PATCH] brcmfmac: fix setting AP channel with new firmwares
  18040. -MIME-Version: 1.0
  18041. -Content-Type: text/plain; charset=UTF-8
  18042. -Content-Transfer-Encoding: 8bit
  18043. -
  18044. -Firmware for new chipsets is based on a new major version of code
  18045. -internally maintained at Broadcom. E.g. brcmfmac4366b-pcie.bin (used for
  18046. -BCM4366B1) is based on 10.10.69.3309 while brcmfmac43602-pcie.ap.bin was
  18047. -based on 7.35.177.56.
  18048. -
  18049. -Currently setting AP 5 GHz channel doesn't work reliably with BCM4366B1.
  18050. -When setting e.g. 36 control channel with VHT80 (center channel 42)
  18051. -firmware may randomly pick one of:
  18052. -1) 52 control channel with 58 as center one
  18053. -2) 100 control channel with 106 as center one
  18054. -3) 116 control channel with 122 as center one
  18055. -4) 149 control channel with 155 as center one
  18056. -
  18057. -It seems new firmwares require setting AP mode (BRCMF_C_SET_AP) before
  18058. -specifying a channel. Changing an order of firmware calls fixes the
  18059. -problem. This requirement resulted in two separated "chanspec" calls,
  18060. -one in AP code path and one in P2P path.
  18061. -
  18062. -This fix was verified with BCM4366B1 and tested for regressions on
  18063. -BCM43602.
  18064. -
  18065. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  18066. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18067. ----
  18068. -
  18069. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  18070. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  18071. -@@ -4382,7 +4382,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  18072. - struct brcmf_join_params join_params;
  18073. - enum nl80211_iftype dev_role;
  18074. - struct brcmf_fil_bss_enable_le bss_enable;
  18075. -- u16 chanspec;
  18076. -+ u16 chanspec = chandef_to_chanspec(&cfg->d11inf, &settings->chandef);
  18077. - bool mbss;
  18078. - int is_11d;
  18079. -
  18080. -@@ -4458,16 +4458,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  18081. -
  18082. - brcmf_config_ap_mgmt_ie(ifp->vif, &settings->beacon);
  18083. -
  18084. -+ /* Parameters shared by all radio interfaces */
  18085. - if (!mbss) {
  18086. -- chanspec = chandef_to_chanspec(&cfg->d11inf,
  18087. -- &settings->chandef);
  18088. -- err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec);
  18089. -- if (err < 0) {
  18090. -- brcmf_err("Set Channel failed: chspec=%d, %d\n",
  18091. -- chanspec, err);
  18092. -- goto exit;
  18093. -- }
  18094. --
  18095. - if (is_11d != ifp->vif->is_11d) {
  18096. - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY,
  18097. - is_11d);
  18098. -@@ -4515,6 +4507,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  18099. - err = -EINVAL;
  18100. - goto exit;
  18101. - }
  18102. -+
  18103. -+ /* Interface specific setup */
  18104. - if (dev_role == NL80211_IFTYPE_AP) {
  18105. - if ((brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) && (!mbss))
  18106. - brcmf_fil_iovar_int_set(ifp, "mbss", 1);
  18107. -@@ -4524,6 +4518,17 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  18108. - brcmf_err("setting AP mode failed %d\n", err);
  18109. - goto exit;
  18110. - }
  18111. -+ if (!mbss) {
  18112. -+ /* Firmware 10.x requires setting channel after enabling
  18113. -+ * AP and before bringing interface up.
  18114. -+ */
  18115. -+ err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec);
  18116. -+ if (err < 0) {
  18117. -+ brcmf_err("Set Channel failed: chspec=%d, %d\n",
  18118. -+ chanspec, err);
  18119. -+ goto exit;
  18120. -+ }
  18121. -+ }
  18122. - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1);
  18123. - if (err < 0) {
  18124. - brcmf_err("BRCMF_C_UP error (%d)\n", err);
  18125. -@@ -4545,7 +4550,13 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  18126. - goto exit;
  18127. - }
  18128. - brcmf_dbg(TRACE, "AP mode configuration complete\n");
  18129. -- } else {
  18130. -+ } else if (dev_role == NL80211_IFTYPE_P2P_GO) {
  18131. -+ err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec);
  18132. -+ if (err < 0) {
  18133. -+ brcmf_err("Set Channel failed: chspec=%d, %d\n",
  18134. -+ chanspec, err);
  18135. -+ goto exit;
  18136. -+ }
  18137. - err = brcmf_fil_bsscfg_data_set(ifp, "ssid", &ssid_le,
  18138. - sizeof(ssid_le));
  18139. - if (err < 0) {
  18140. -@@ -4562,7 +4573,10 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  18141. - }
  18142. -
  18143. - brcmf_dbg(TRACE, "GO mode configuration complete\n");
  18144. -+ } else {
  18145. -+ WARN_ON(1);
  18146. - }
  18147. -+
  18148. - set_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state);
  18149. - brcmf_net_setcarrier(ifp, true);
  18150. -
  18151. diff --git a/package/kernel/mac80211/patches/351-0011-brcmfmac-don-t-remove-interface-on-link-down-firmwar.patch b/package/kernel/mac80211/patches/351-0011-brcmfmac-don-t-remove-interface-on-link-down-firmwar.patch
  18152. deleted file mode 100644
  18153. index 167e434..0000000
  18154. --- a/package/kernel/mac80211/patches/351-0011-brcmfmac-don-t-remove-interface-on-link-down-firmwar.patch
  18155. +++ /dev/null
  18156. @@ -1,60 +0,0 @@
  18157. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  18158. -Date: Mon, 30 May 2016 06:40:54 +0200
  18159. -Subject: [PATCH] brcmfmac: don't remove interface on link down firmware event
  18160. -MIME-Version: 1.0
  18161. -Content-Type: text/plain; charset=UTF-8
  18162. -Content-Transfer-Encoding: 8bit
  18163. -
  18164. -There are two firmware events we handle similarly in brcmfmac:
  18165. -BRCMF_E_LINK and BRCMF_E_IF. The difference from firmware point of view
  18166. -is that the first one means BSS remains present in the firmware. Trying
  18167. -to (re)create it (e.g. when adding new virtual interface) will result in
  18168. -an error.
  18169. -
  18170. -Current code treats both events in a similar way. It removes Linux
  18171. -interface for each of them. It works OK with e.g. BCM43602. Its firmware
  18172. -generates both events for each interface. It means we get BRCMF_E_LINK
  18173. -and remove interface. That is soon followed by BRCMF_E_IF which means
  18174. -BSS was also removed in a firmware. The only downside of this is a
  18175. -harmless error like:
  18176. -[ 208.643180] brcmfmac: brcmf_fweh_call_event_handler: no interface object
  18177. -
  18178. -Unfortunately BCM4366 firmware doesn't automatically remove BSS and so
  18179. -it doesn't generate BRCMF_E_IF. In such case we incorrectly remove Linux
  18180. -interface on BRCMF_E_LINK as BSS is still present in the firmware. It
  18181. -results in an error when trying to re-create virtual interface, e.g.:
  18182. -> iw phy phy1 interface add wlan1-1 type __ap
  18183. -[ 3602.929199] brcmfmac: brcmf_ap_add_vif: timeout occurred
  18184. -command failed: I/O error (-5)
  18185. -
  18186. -With this patch we don't remove Linux interface while firmware keeps
  18187. -BSS. Thanks to this we keep a consistent states of host driver and
  18188. -device firmware.
  18189. -
  18190. -Further improvement should be to mark BSS as disabled and remove
  18191. -interface on BRCMF_E_LINK. Then we should add support for reusing
  18192. -BSS-es.
  18193. -
  18194. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  18195. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18196. ----
  18197. -
  18198. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  18199. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  18200. -@@ -5372,7 +5372,6 @@ brcmf_notify_connect_status_ap(struct br
  18201. - struct net_device *ndev,
  18202. - const struct brcmf_event_msg *e, void *data)
  18203. - {
  18204. -- struct brcmf_if *ifp = netdev_priv(ndev);
  18205. - static int generation;
  18206. - u32 event = e->event_code;
  18207. - u32 reason = e->reason;
  18208. -@@ -5383,8 +5382,6 @@ brcmf_notify_connect_status_ap(struct br
  18209. - ndev != cfg_to_ndev(cfg)) {
  18210. - brcmf_dbg(CONN, "AP mode link down\n");
  18211. - complete(&cfg->vif_disabled);
  18212. -- if (ifp->vif->mbss)
  18213. -- brcmf_remove_interface(ifp);
  18214. - return 0;
  18215. - }
  18216. -
  18217. diff --git a/package/kernel/mac80211/patches/351-0017-brcmfmac-drop-unused-pm_block-vif-attribute.patch b/package/kernel/mac80211/patches/351-0017-brcmfmac-drop-unused-pm_block-vif-attribute.patch
  18218. deleted file mode 100644
  18219. index 28ef3a6..0000000
  18220. --- a/package/kernel/mac80211/patches/351-0017-brcmfmac-drop-unused-pm_block-vif-attribute.patch
  18221. +++ /dev/null
  18222. @@ -1,103 +0,0 @@
  18223. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  18224. -Date: Mon, 6 Jun 2016 23:03:55 +0200
  18225. -Subject: [PATCH] brcmfmac: drop unused pm_block vif attribute
  18226. -MIME-Version: 1.0
  18227. -Content-Type: text/plain; charset=UTF-8
  18228. -Content-Transfer-Encoding: 8bit
  18229. -
  18230. -This attribute was added 3 years ago by
  18231. -commit 3eacf866559c ("brcmfmac: introduce brcmf_cfg80211_vif structure")
  18232. -but it remains unused since then. It seems we can safely drop it.
  18233. -
  18234. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  18235. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18236. ----
  18237. -
  18238. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  18239. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  18240. -@@ -587,7 +587,7 @@ struct wireless_dev *brcmf_ap_add_vif(st
  18241. -
  18242. - brcmf_dbg(INFO, "Adding vif \"%s\"\n", name);
  18243. -
  18244. -- vif = brcmf_alloc_vif(cfg, NL80211_IFTYPE_AP, false);
  18245. -+ vif = brcmf_alloc_vif(cfg, NL80211_IFTYPE_AP);
  18246. - if (IS_ERR(vif))
  18247. - return (struct wireless_dev *)vif;
  18248. -
  18249. -@@ -5098,8 +5098,7 @@ static struct cfg80211_ops brcmf_cfg8021
  18250. - };
  18251. -
  18252. - struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg,
  18253. -- enum nl80211_iftype type,
  18254. -- bool pm_block)
  18255. -+ enum nl80211_iftype type)
  18256. - {
  18257. - struct brcmf_cfg80211_vif *vif_walk;
  18258. - struct brcmf_cfg80211_vif *vif;
  18259. -@@ -5114,8 +5113,6 @@ struct brcmf_cfg80211_vif *brcmf_alloc_v
  18260. - vif->wdev.wiphy = cfg->wiphy;
  18261. - vif->wdev.iftype = type;
  18262. -
  18263. -- vif->pm_block = pm_block;
  18264. --
  18265. - brcmf_init_prof(&vif->profile);
  18266. -
  18267. - if (type == NL80211_IFTYPE_AP) {
  18268. -@@ -6754,7 +6751,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  18269. - init_vif_event(&cfg->vif_event);
  18270. - INIT_LIST_HEAD(&cfg->vif_list);
  18271. -
  18272. -- vif = brcmf_alloc_vif(cfg, NL80211_IFTYPE_STATION, false);
  18273. -+ vif = brcmf_alloc_vif(cfg, NL80211_IFTYPE_STATION);
  18274. - if (IS_ERR(vif))
  18275. - goto wiphy_out;
  18276. -
  18277. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  18278. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  18279. -@@ -167,7 +167,6 @@ struct vif_saved_ie {
  18280. - * @wdev: wireless device.
  18281. - * @profile: profile information.
  18282. - * @sme_state: SME state using enum brcmf_vif_status bits.
  18283. -- * @pm_block: power-management blocked.
  18284. - * @list: linked list.
  18285. - * @mgmt_rx_reg: registered rx mgmt frame types.
  18286. - * @mbss: Multiple BSS type, set if not first AP (not relevant for P2P).
  18287. -@@ -177,7 +176,6 @@ struct brcmf_cfg80211_vif {
  18288. - struct wireless_dev wdev;
  18289. - struct brcmf_cfg80211_profile profile;
  18290. - unsigned long sme_state;
  18291. -- bool pm_block;
  18292. - struct vif_saved_ie saved_ie;
  18293. - struct list_head list;
  18294. - u16 mgmt_rx_reg;
  18295. -@@ -388,8 +386,7 @@ s32 brcmf_cfg80211_down(struct net_devic
  18296. - enum nl80211_iftype brcmf_cfg80211_get_iftype(struct brcmf_if *ifp);
  18297. -
  18298. - struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg,
  18299. -- enum nl80211_iftype type,
  18300. -- bool pm_block);
  18301. -+ enum nl80211_iftype type);
  18302. - void brcmf_free_vif(struct brcmf_cfg80211_vif *vif);
  18303. -
  18304. - s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag,
  18305. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  18306. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  18307. -@@ -2074,8 +2074,7 @@ static struct wireless_dev *brcmf_p2p_cr
  18308. - if (p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif)
  18309. - return ERR_PTR(-ENOSPC);
  18310. -
  18311. -- p2p_vif = brcmf_alloc_vif(p2p->cfg, NL80211_IFTYPE_P2P_DEVICE,
  18312. -- false);
  18313. -+ p2p_vif = brcmf_alloc_vif(p2p->cfg, NL80211_IFTYPE_P2P_DEVICE);
  18314. - if (IS_ERR(p2p_vif)) {
  18315. - brcmf_err("could not create discovery vif\n");
  18316. - return (struct wireless_dev *)p2p_vif;
  18317. -@@ -2175,7 +2174,7 @@ struct wireless_dev *brcmf_p2p_add_vif(s
  18318. - return ERR_PTR(-EOPNOTSUPP);
  18319. - }
  18320. -
  18321. -- vif = brcmf_alloc_vif(cfg, type, false);
  18322. -+ vif = brcmf_alloc_vif(cfg, type);
  18323. - if (IS_ERR(vif))
  18324. - return (struct wireless_dev *)vif;
  18325. - brcmf_cfg80211_arm_vif_event(cfg, vif);
  18326. diff --git a/package/kernel/mac80211/patches/351-0018-brcmfmac-include-required-headers-in-cfg80211.h.patch b/package/kernel/mac80211/patches/351-0018-brcmfmac-include-required-headers-in-cfg80211.h.patch
  18327. deleted file mode 100644
  18328. index 09547d8..0000000
  18329. --- a/package/kernel/mac80211/patches/351-0018-brcmfmac-include-required-headers-in-cfg80211.h.patch
  18330. +++ /dev/null
  18331. @@ -1,37 +0,0 @@
  18332. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  18333. -Date: Tue, 7 Jun 2016 08:20:21 +0200
  18334. -Subject: [PATCH] brcmfmac: include required headers in cfg80211.h
  18335. -MIME-Version: 1.0
  18336. -Content-Type: text/plain; charset=UTF-8
  18337. -Content-Transfer-Encoding: 8bit
  18338. -
  18339. -Without this including cfg80211.h in a wrong order could result in:
  18340. -
  18341. -drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h:122:24: error: array type has incomplete element type
  18342. - struct brcmf_wsec_key key[BRCMF_MAX_DEFAULT_KEYS];
  18343. - ^
  18344. -drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h:291:24: error: field ‘p2p’ has incomplete type
  18345. - struct brcmf_p2p_info p2p;
  18346. - ^
  18347. -drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h:297:27: error: field ‘pmk_list’ has incomplete type
  18348. - struct brcmf_pmk_list_le pmk_list;
  18349. - ^
  18350. -drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h:317:28: error: field ‘assoclist’ has incomplete type
  18351. - struct brcmf_assoclist_le assoclist;
  18352. -
  18353. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  18354. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18355. ----
  18356. -
  18357. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  18358. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  18359. -@@ -20,6 +20,9 @@
  18360. - /* for brcmu_d11inf */
  18361. - #include <brcmu_d11.h>
  18362. -
  18363. -+#include "fwil_types.h"
  18364. -+#include "p2p.h"
  18365. -+
  18366. - #define WL_NUM_SCAN_MAX 10
  18367. - #define WL_TLV_INFO_MAX 1024
  18368. - #define WL_BSS_INFO_MAX 2048
  18369. diff --git a/package/kernel/mac80211/patches/351-0019-brcmfmac-slightly-simplify-building-interface-combin.patch b/package/kernel/mac80211/patches/351-0019-brcmfmac-slightly-simplify-building-interface-combin.patch
  18370. deleted file mode 100644
  18371. index 461e3db..0000000
  18372. --- a/package/kernel/mac80211/patches/351-0019-brcmfmac-slightly-simplify-building-interface-combin.patch
  18373. +++ /dev/null
  18374. @@ -1,108 +0,0 @@
  18375. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  18376. -Date: Tue, 7 Jun 2016 21:10:18 +0200
  18377. -Subject: [PATCH] brcmfmac: slightly simplify building interface combinations
  18378. -MIME-Version: 1.0
  18379. -Content-Type: text/plain; charset=UTF-8
  18380. -Content-Transfer-Encoding: 8bit
  18381. -
  18382. -This change reorders some operations in brcmf_setup_ifmodes in hope to
  18383. -make it simpler:
  18384. -1) It allocates arrays right before filling them. This way it's easier
  18385. - to follow requested array length as it's immediately followed by
  18386. - code filling it. It's easier to check e.g. why we need 4 entries for
  18387. - P2P. Other than that it deduplicates some checks (e.g. for P2P).
  18388. -2) It reorders code to first prepare limits and then define a new combo.
  18389. - Previously this was mixed (e.g. we were setting num of channels
  18390. - before preparing limits).
  18391. -3) It modifies mbss code to use i variable just like other combos do.
  18392. -
  18393. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  18394. -Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  18395. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18396. ----
  18397. -
  18398. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  18399. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  18400. -@@ -6208,29 +6208,15 @@ static int brcmf_setup_ifmodes(struct wi
  18401. - if (!combo)
  18402. - goto err;
  18403. -
  18404. -- c0_limits = kcalloc(p2p ? 3 : 2, sizeof(*c0_limits), GFP_KERNEL);
  18405. -- if (!c0_limits)
  18406. -- goto err;
  18407. --
  18408. -- if (p2p) {
  18409. -- p2p_limits = kcalloc(4, sizeof(*p2p_limits), GFP_KERNEL);
  18410. -- if (!p2p_limits)
  18411. -- goto err;
  18412. -- }
  18413. --
  18414. -- if (mbss) {
  18415. -- mbss_limits = kcalloc(1, sizeof(*mbss_limits), GFP_KERNEL);
  18416. -- if (!mbss_limits)
  18417. -- goto err;
  18418. -- }
  18419. --
  18420. - wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
  18421. - BIT(NL80211_IFTYPE_ADHOC) |
  18422. - BIT(NL80211_IFTYPE_AP);
  18423. -
  18424. - c = 0;
  18425. - i = 0;
  18426. -- combo[c].num_different_channels = 1;
  18427. -+ c0_limits = kcalloc(p2p ? 3 : 2, sizeof(*c0_limits), GFP_KERNEL);
  18428. -+ if (!c0_limits)
  18429. -+ goto err;
  18430. - c0_limits[i].max = 1;
  18431. - c0_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  18432. - if (p2p) {
  18433. -@@ -6248,6 +6234,7 @@ static int brcmf_setup_ifmodes(struct wi
  18434. - c0_limits[i].max = 1;
  18435. - c0_limits[i++].types = BIT(NL80211_IFTYPE_AP);
  18436. - }
  18437. -+ combo[c].num_different_channels = 1;
  18438. - combo[c].max_interfaces = i;
  18439. - combo[c].n_limits = i;
  18440. - combo[c].limits = c0_limits;
  18441. -@@ -6255,7 +6242,9 @@ static int brcmf_setup_ifmodes(struct wi
  18442. - if (p2p) {
  18443. - c++;
  18444. - i = 0;
  18445. -- combo[c].num_different_channels = 1;
  18446. -+ p2p_limits = kcalloc(4, sizeof(*p2p_limits), GFP_KERNEL);
  18447. -+ if (!p2p_limits)
  18448. -+ goto err;
  18449. - p2p_limits[i].max = 1;
  18450. - p2p_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  18451. - p2p_limits[i].max = 1;
  18452. -@@ -6264,6 +6253,7 @@ static int brcmf_setup_ifmodes(struct wi
  18453. - p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT);
  18454. - p2p_limits[i].max = 1;
  18455. - p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  18456. -+ combo[c].num_different_channels = 1;
  18457. - combo[c].max_interfaces = i;
  18458. - combo[c].n_limits = i;
  18459. - combo[c].limits = p2p_limits;
  18460. -@@ -6271,14 +6261,19 @@ static int brcmf_setup_ifmodes(struct wi
  18461. -
  18462. - if (mbss) {
  18463. - c++;
  18464. -+ i = 0;
  18465. -+ mbss_limits = kcalloc(1, sizeof(*mbss_limits), GFP_KERNEL);
  18466. -+ if (!mbss_limits)
  18467. -+ goto err;
  18468. -+ mbss_limits[i].max = 4;
  18469. -+ mbss_limits[i++].types = BIT(NL80211_IFTYPE_AP);
  18470. - combo[c].beacon_int_infra_match = true;
  18471. - combo[c].num_different_channels = 1;
  18472. -- mbss_limits[0].max = 4;
  18473. -- mbss_limits[0].types = BIT(NL80211_IFTYPE_AP);
  18474. - combo[c].max_interfaces = 4;
  18475. -- combo[c].n_limits = 1;
  18476. -+ combo[c].n_limits = i;
  18477. - combo[c].limits = mbss_limits;
  18478. - }
  18479. -+
  18480. - wiphy->n_iface_combinations = n_combos;
  18481. - wiphy->iface_combinations = combo;
  18482. - return 0;
  18483. diff --git a/package/kernel/mac80211/patches/351-0020-brcmfmac-fix-lockup-when-removing-P2P-interface-afte.patch b/package/kernel/mac80211/patches/351-0020-brcmfmac-fix-lockup-when-removing-P2P-interface-afte.patch
  18484. deleted file mode 100644
  18485. index e991f32..0000000
  18486. --- a/package/kernel/mac80211/patches/351-0020-brcmfmac-fix-lockup-when-removing-P2P-interface-afte.patch
  18487. +++ /dev/null
  18488. @@ -1,160 +0,0 @@
  18489. -From b50ddfa8530e9b5f52e873fdd6ff04f327a88799 Mon Sep 17 00:00:00 2001
  18490. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  18491. -Date: Fri, 17 Jun 2016 12:29:21 +0200
  18492. -Subject: [PATCH] brcmfmac: fix lockup when removing P2P interface after event
  18493. - timeout
  18494. -MIME-Version: 1.0
  18495. -Content-Type: text/plain; charset=UTF-8
  18496. -Content-Transfer-Encoding: 8bit
  18497. -
  18498. -Removing P2P interface is handled by sending a proper request to the
  18499. -firmware. On success firmware triggers an event and driver's handler
  18500. -removes a matching interface.
  18501. -
  18502. -However on event timeout we remove interface directly from the cfg80211
  18503. -callback. Current code doesn't handle this case correctly as it always
  18504. -assumes rtnl to be unlocked.
  18505. -
  18506. -Fix it by adding an extra rtnl_locked parameter to functions and calling
  18507. -unregister_netdevice when needed.
  18508. -
  18509. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  18510. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18511. ----
  18512. - .../wireless/broadcom/brcm80211/brcmfmac/core.c | 29 +++++++++++++---------
  18513. - .../wireless/broadcom/brcm80211/brcmfmac/core.h | 2 +-
  18514. - .../wireless/broadcom/brcm80211/brcmfmac/fweh.c | 2 +-
  18515. - .../net/wireless/broadcom/brcm80211/brcmfmac/p2p.c | 4 +--
  18516. - 4 files changed, 21 insertions(+), 16 deletions(-)
  18517. -
  18518. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  18519. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  18520. -@@ -548,12 +548,16 @@ fail:
  18521. - return -EBADE;
  18522. - }
  18523. -
  18524. --static void brcmf_net_detach(struct net_device *ndev)
  18525. -+static void brcmf_net_detach(struct net_device *ndev, bool rtnl_locked)
  18526. - {
  18527. -- if (ndev->reg_state == NETREG_REGISTERED)
  18528. -- unregister_netdev(ndev);
  18529. -- else
  18530. -+ if (ndev->reg_state == NETREG_REGISTERED) {
  18531. -+ if (rtnl_locked)
  18532. -+ unregister_netdevice(ndev);
  18533. -+ else
  18534. -+ unregister_netdev(ndev);
  18535. -+ } else {
  18536. - brcmf_cfg80211_free_netdev(ndev);
  18537. -+ }
  18538. - }
  18539. -
  18540. - void brcmf_net_setcarrier(struct brcmf_if *ifp, bool on)
  18541. -@@ -651,7 +655,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  18542. - brcmf_err("ERROR: netdev:%s already exists\n",
  18543. - ifp->ndev->name);
  18544. - netif_stop_queue(ifp->ndev);
  18545. -- brcmf_net_detach(ifp->ndev);
  18546. -+ brcmf_net_detach(ifp->ndev, false);
  18547. - drvr->iflist[bsscfgidx] = NULL;
  18548. - } else {
  18549. - brcmf_dbg(INFO, "netdev:%s ignore IF event\n",
  18550. -@@ -699,7 +703,8 @@ struct brcmf_if *brcmf_add_if(struct brc
  18551. - return ifp;
  18552. - }
  18553. -
  18554. --static void brcmf_del_if(struct brcmf_pub *drvr, s32 bsscfgidx)
  18555. -+static void brcmf_del_if(struct brcmf_pub *drvr, s32 bsscfgidx,
  18556. -+ bool rtnl_locked)
  18557. - {
  18558. - struct brcmf_if *ifp;
  18559. -
  18560. -@@ -729,7 +734,7 @@ static void brcmf_del_if(struct brcmf_pu
  18561. - cancel_work_sync(&ifp->multicast_work);
  18562. - cancel_work_sync(&ifp->ndoffload_work);
  18563. - }
  18564. -- brcmf_net_detach(ifp->ndev);
  18565. -+ brcmf_net_detach(ifp->ndev, rtnl_locked);
  18566. - } else {
  18567. - /* Only p2p device interfaces which get dynamically created
  18568. - * end up here. In this case the p2p module should be informed
  18569. -@@ -743,14 +748,14 @@ static void brcmf_del_if(struct brcmf_pu
  18570. - }
  18571. - }
  18572. -
  18573. --void brcmf_remove_interface(struct brcmf_if *ifp)
  18574. -+void brcmf_remove_interface(struct brcmf_if *ifp, bool rtnl_locked)
  18575. - {
  18576. - if (!ifp || WARN_ON(ifp->drvr->iflist[ifp->bsscfgidx] != ifp))
  18577. - return;
  18578. - brcmf_dbg(TRACE, "Enter, bsscfgidx=%d, ifidx=%d\n", ifp->bsscfgidx,
  18579. - ifp->ifidx);
  18580. - brcmf_fws_del_interface(ifp);
  18581. -- brcmf_del_if(ifp->drvr, ifp->bsscfgidx);
  18582. -+ brcmf_del_if(ifp->drvr, ifp->bsscfgidx, rtnl_locked);
  18583. - }
  18584. -
  18585. - #ifdef CONFIG_INET
  18586. -@@ -1057,9 +1062,9 @@ fail:
  18587. - brcmf_fws_deinit(drvr);
  18588. - }
  18589. - if (ifp)
  18590. -- brcmf_net_detach(ifp->ndev);
  18591. -+ brcmf_net_detach(ifp->ndev, false);
  18592. - if (p2p_ifp)
  18593. -- brcmf_net_detach(p2p_ifp->ndev);
  18594. -+ brcmf_net_detach(p2p_ifp->ndev, false);
  18595. - drvr->iflist[0] = NULL;
  18596. - drvr->iflist[1] = NULL;
  18597. - if (drvr->settings->ignore_probe_fail)
  18598. -@@ -1128,7 +1133,7 @@ void brcmf_detach(struct device *dev)
  18599. -
  18600. - /* make sure primary interface removed last */
  18601. - for (i = BRCMF_MAX_IFS-1; i > -1; i--)
  18602. -- brcmf_remove_interface(drvr->iflist[i]);
  18603. -+ brcmf_remove_interface(drvr->iflist[i], false);
  18604. -
  18605. - brcmf_cfg80211_detach(drvr->config);
  18606. -
  18607. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  18608. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  18609. -@@ -216,7 +216,7 @@ struct brcmf_if *brcmf_get_ifp(struct br
  18610. - int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  18611. - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
  18612. - bool is_p2pdev, char *name, u8 *mac_addr);
  18613. --void brcmf_remove_interface(struct brcmf_if *ifp);
  18614. -+void brcmf_remove_interface(struct brcmf_if *ifp, bool rtnl_locked);
  18615. - void brcmf_txflowblock_if(struct brcmf_if *ifp,
  18616. - enum brcmf_netif_stop_reason reason, bool state);
  18617. - void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
  18618. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  18619. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  18620. -@@ -183,7 +183,7 @@ static void brcmf_fweh_handle_if_event(s
  18621. - err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data);
  18622. -
  18623. - if (ifp && ifevent->action == BRCMF_E_IF_DEL)
  18624. -- brcmf_remove_interface(ifp);
  18625. -+ brcmf_remove_interface(ifp, false);
  18626. - }
  18627. -
  18628. - /**
  18629. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  18630. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  18631. -@@ -2289,7 +2289,7 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  18632. - err = 0;
  18633. - }
  18634. - if (err)
  18635. -- brcmf_remove_interface(vif->ifp);
  18636. -+ brcmf_remove_interface(vif->ifp, true);
  18637. -
  18638. - brcmf_cfg80211_arm_vif_event(cfg, NULL);
  18639. - if (vif->wdev.iftype != NL80211_IFTYPE_P2P_DEVICE)
  18640. -@@ -2395,7 +2395,7 @@ void brcmf_p2p_detach(struct brcmf_p2p_i
  18641. - if (vif != NULL) {
  18642. - brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  18643. - brcmf_p2p_deinit_discovery(p2p);
  18644. -- brcmf_remove_interface(vif->ifp);
  18645. -+ brcmf_remove_interface(vif->ifp, false);
  18646. - }
  18647. - /* just set it all to zero */
  18648. - memset(p2p, 0, sizeof(*p2p));
  18649. diff --git a/package/kernel/mac80211/patches/351-0021-brcmfmac-use-const-char-for-interface-name-in-brcmf_.patch b/package/kernel/mac80211/patches/351-0021-brcmfmac-use-const-char-for-interface-name-in-brcmf_.patch
  18650. deleted file mode 100644
  18651. index ed65f4d..0000000
  18652. --- a/package/kernel/mac80211/patches/351-0021-brcmfmac-use-const-char-for-interface-name-in-brcmf_.patch
  18653. +++ /dev/null
  18654. @@ -1,39 +0,0 @@
  18655. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  18656. -Date: Fri, 17 Jun 2016 12:48:44 +0200
  18657. -Subject: [PATCH] brcmfmac: use const char * for interface name in brcmf_add_if
  18658. -MIME-Version: 1.0
  18659. -Content-Type: text/plain; charset=UTF-8
  18660. -Content-Transfer-Encoding: 8bit
  18661. -
  18662. -This function can work just fine with const pointer, it only calls
  18663. -alloc_netdev which take const as well. Moreover it makes this function
  18664. -more flexible as some cfg80211 callback may provide const char * as
  18665. -well, e.g. add_virtual_intf. This will be needed for more advanced
  18666. -interface management.
  18667. -
  18668. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  18669. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18670. ----
  18671. -
  18672. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  18673. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  18674. -@@ -638,7 +638,7 @@ fail:
  18675. - }
  18676. -
  18677. - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
  18678. -- bool is_p2pdev, char *name, u8 *mac_addr)
  18679. -+ bool is_p2pdev, const char *name, u8 *mac_addr)
  18680. - {
  18681. - struct brcmf_if *ifp;
  18682. - struct net_device *ndev;
  18683. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  18684. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  18685. -@@ -215,7 +215,7 @@ char *brcmf_ifname(struct brcmf_if *ifp)
  18686. - struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx);
  18687. - int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  18688. - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
  18689. -- bool is_p2pdev, char *name, u8 *mac_addr);
  18690. -+ bool is_p2pdev, const char *name, u8 *mac_addr);
  18691. - void brcmf_remove_interface(struct brcmf_if *ifp, bool rtnl_locked);
  18692. - void brcmf_txflowblock_if(struct brcmf_if *ifp,
  18693. - enum brcmf_netif_stop_reason reason, bool state);
  18694. diff --git a/package/kernel/mac80211/patches/351-0022-brcmfmac-include-also-core.h-header-in-cfg80211.h.patch b/package/kernel/mac80211/patches/351-0022-brcmfmac-include-also-core.h-header-in-cfg80211.h.patch
  18695. deleted file mode 100644
  18696. index ef35fab..0000000
  18697. --- a/package/kernel/mac80211/patches/351-0022-brcmfmac-include-also-core.h-header-in-cfg80211.h.patch
  18698. +++ /dev/null
  18699. @@ -1,33 +0,0 @@
  18700. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  18701. -Date: Sat, 18 Jun 2016 18:49:38 +0200
  18702. -Subject: [PATCH] brcmfmac: include also core.h header in cfg80211.h
  18703. -MIME-Version: 1.0
  18704. -Content-Type: text/plain; charset=UTF-8
  18705. -Content-Transfer-Encoding: 8bit
  18706. -
  18707. -This header provides two inline functions using struct brcmf_if so we
  18708. -need core.h to avoid:
  18709. -
  18710. -drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h: In function ‘ndev_to_prof’:
  18711. -drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h:368:13: error: dereferencing pointer to incomplete type
  18712. - return &ifp->vif->profile;
  18713. - ^
  18714. -drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h: In function ‘ndev_to_vif’:
  18715. -drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h:374:12: error: dereferencing pointer to incomplete type
  18716. - return ifp->vif;
  18717. - ^
  18718. -
  18719. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  18720. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18721. ----
  18722. -
  18723. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  18724. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  18725. -@@ -20,6 +20,7 @@
  18726. - /* for brcmu_d11inf */
  18727. - #include <brcmu_d11.h>
  18728. -
  18729. -+#include "core.h"
  18730. - #include "fwil_types.h"
  18731. - #include "p2p.h"
  18732. -
  18733. diff --git a/package/kernel/mac80211/patches/351-0023-brcmfmac-add-missing-break-when-deleting-P2P_DEVICE.patch b/package/kernel/mac80211/patches/351-0023-brcmfmac-add-missing-break-when-deleting-P2P_DEVICE.patch
  18734. deleted file mode 100644
  18735. index ab9a634..0000000
  18736. --- a/package/kernel/mac80211/patches/351-0023-brcmfmac-add-missing-break-when-deleting-P2P_DEVICE.patch
  18737. +++ /dev/null
  18738. @@ -1,27 +0,0 @@
  18739. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  18740. -Date: Sun, 19 Jun 2016 01:55:57 +0200
  18741. -Subject: [PATCH] brcmfmac: add missing break when deleting P2P_DEVICE
  18742. -MIME-Version: 1.0
  18743. -Content-Type: text/plain; charset=UTF-8
  18744. -Content-Transfer-Encoding: 8bit
  18745. -
  18746. -We obviously don't want to fall through in that switch. With this change
  18747. -1) We wait for event (triggered by p2p_disc) as expected
  18748. -2) We remove interface manually on timeout
  18749. -3) We return 0 on success instead of -ENOTSUPP
  18750. -
  18751. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  18752. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18753. ----
  18754. -
  18755. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  18756. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  18757. -@@ -2263,6 +2263,8 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  18758. - return 0;
  18759. - brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  18760. - brcmf_p2p_deinit_discovery(p2p);
  18761. -+ break;
  18762. -+
  18763. - default:
  18764. - return -ENOTSUPP;
  18765. - }
  18766. diff --git a/package/kernel/mac80211/patches/351-0024-brcmfmac-delete-interface-directly-in-code-that-sent.patch b/package/kernel/mac80211/patches/351-0024-brcmfmac-delete-interface-directly-in-code-that-sent.patch
  18767. deleted file mode 100644
  18768. index 6dd0c03..0000000
  18769. --- a/package/kernel/mac80211/patches/351-0024-brcmfmac-delete-interface-directly-in-code-that-sent.patch
  18770. +++ /dev/null
  18771. @@ -1,75 +0,0 @@
  18772. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  18773. -Date: Wed, 29 Jun 2016 21:54:26 +0200
  18774. -Subject: [PATCH] brcmfmac: delete interface directly in code that sent fw
  18775. - request
  18776. -MIME-Version: 1.0
  18777. -Content-Type: text/plain; charset=UTF-8
  18778. -Content-Transfer-Encoding: 8bit
  18779. -
  18780. -So far when receiving event about in-firmware-interface removal our
  18781. -event worker was notifying listener and afterwards it was removing Linux
  18782. -interface.
  18783. -
  18784. -First of all it was resulting in slightly unexpected order. The listener
  18785. -(del_virtual_intf callback) was (usually) returning with success before
  18786. -we even called unregister_netdev(ice).
  18787. -
  18788. -Please note this couldn't be simply fixed by changing order of calls in
  18789. -brcmf_fweh_handle_if_event as unregistering interface earlier could free
  18790. -struct brcmf_if.
  18791. -
  18792. -Another problem of current implementation are possible lockups. Focus on
  18793. -the time slot between calling event handler and removing Linux
  18794. -interface. During that time original caller may leave (unlocking rtnl
  18795. -semaphore) *and* another call to the same code may be done (locking it
  18796. -again). If that happens our event handler will stuck at removing Linux
  18797. -interface, it won't handle another event and will block process holding
  18798. -rtnl lock.
  18799. -
  18800. -This can be simply solved by unregistering interface in a proper
  18801. -callback, right after receiving confirmation event from firmware. This
  18802. -only required modifying worker to don't unregister on its own if there
  18803. -is someone waiting for the event.
  18804. -
  18805. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  18806. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18807. ----
  18808. -
  18809. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  18810. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  18811. -@@ -18,6 +18,7 @@
  18812. - #include "brcmu_wifi.h"
  18813. - #include "brcmu_utils.h"
  18814. -
  18815. -+#include "cfg80211.h"
  18816. - #include "core.h"
  18817. - #include "debug.h"
  18818. - #include "tracepoint.h"
  18819. -@@ -182,8 +183,13 @@ static void brcmf_fweh_handle_if_event(s
  18820. -
  18821. - err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data);
  18822. -
  18823. -- if (ifp && ifevent->action == BRCMF_E_IF_DEL)
  18824. -- brcmf_remove_interface(ifp, false);
  18825. -+ if (ifp && ifevent->action == BRCMF_E_IF_DEL) {
  18826. -+ bool armed = brcmf_cfg80211_vif_event_armed(drvr->config);
  18827. -+
  18828. -+ /* Default handling in case no-one waits for this event */
  18829. -+ if (!armed)
  18830. -+ brcmf_remove_interface(ifp, false);
  18831. -+ }
  18832. - }
  18833. -
  18834. - /**
  18835. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  18836. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  18837. -@@ -2290,8 +2290,7 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  18838. - else
  18839. - err = 0;
  18840. - }
  18841. -- if (err)
  18842. -- brcmf_remove_interface(vif->ifp, true);
  18843. -+ brcmf_remove_interface(vif->ifp, true);
  18844. -
  18845. - brcmf_cfg80211_arm_vif_event(cfg, NULL);
  18846. - if (vif->wdev.iftype != NL80211_IFTYPE_P2P_DEVICE)
  18847. diff --git a/package/kernel/mac80211/patches/351-0025-brcmfmac-support-removing-AP-interfaces-with-interfa.patch b/package/kernel/mac80211/patches/351-0025-brcmfmac-support-removing-AP-interfaces-with-interfa.patch
  18848. deleted file mode 100644
  18849. index 1929f0b..0000000
  18850. --- a/package/kernel/mac80211/patches/351-0025-brcmfmac-support-removing-AP-interfaces-with-interfa.patch
  18851. +++ /dev/null
  18852. @@ -1,84 +0,0 @@
  18853. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  18854. -Date: Wed, 29 Jun 2016 21:54:27 +0200
  18855. -Subject: [PATCH] brcmfmac: support removing AP interfaces with
  18856. - "interface_remove"
  18857. -MIME-Version: 1.0
  18858. -Content-Type: text/plain; charset=UTF-8
  18859. -Content-Transfer-Encoding: 8bit
  18860. -
  18861. -New firmwares (e.g. 10.10.69.36 for BCM4366) support "interface_remove"
  18862. -for removing interfaces. Try to use this method on cfg80211 request. In
  18863. -case of older firmwares (e.g. 7.35.177.56 for BCM43602 as I tested) this
  18864. -will just result in firmware rejecting command and this won't change any
  18865. -behavior.
  18866. -
  18867. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  18868. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18869. ----
  18870. -
  18871. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  18872. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  18873. -@@ -771,12 +771,48 @@ s32 brcmf_notify_escan_complete(struct b
  18874. - return err;
  18875. - }
  18876. -
  18877. -+static int brcmf_cfg80211_del_ap_iface(struct wiphy *wiphy,
  18878. -+ struct wireless_dev *wdev)
  18879. -+{
  18880. -+ struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy);
  18881. -+ struct net_device *ndev = wdev->netdev;
  18882. -+ struct brcmf_if *ifp = netdev_priv(ndev);
  18883. -+ int ret;
  18884. -+ int err;
  18885. -+
  18886. -+ brcmf_cfg80211_arm_vif_event(cfg, ifp->vif);
  18887. -+
  18888. -+ err = brcmf_fil_bsscfg_data_set(ifp, "interface_remove", NULL, 0);
  18889. -+ if (err) {
  18890. -+ brcmf_err("interface_remove failed %d\n", err);
  18891. -+ goto err_unarm;
  18892. -+ }
  18893. -+
  18894. -+ /* wait for firmware event */
  18895. -+ ret = brcmf_cfg80211_wait_vif_event(cfg, BRCMF_E_IF_DEL,
  18896. -+ BRCMF_VIF_EVENT_TIMEOUT);
  18897. -+ if (!ret) {
  18898. -+ brcmf_err("timeout occurred\n");
  18899. -+ err = -EIO;
  18900. -+ goto err_unarm;
  18901. -+ }
  18902. -+
  18903. -+ brcmf_remove_interface(ifp, true);
  18904. -+
  18905. -+err_unarm:
  18906. -+ brcmf_cfg80211_arm_vif_event(cfg, NULL);
  18907. -+ return err;
  18908. -+}
  18909. -+
  18910. - static
  18911. - int brcmf_cfg80211_del_iface(struct wiphy *wiphy, struct wireless_dev *wdev)
  18912. - {
  18913. - struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy);
  18914. - struct net_device *ndev = wdev->netdev;
  18915. -
  18916. -+ if (ndev && ndev == cfg_to_ndev(cfg))
  18917. -+ return -ENOTSUPP;
  18918. -+
  18919. - /* vif event pending in firmware */
  18920. - if (brcmf_cfg80211_vif_event_armed(cfg))
  18921. - return -EBUSY;
  18922. -@@ -793,12 +829,13 @@ int brcmf_cfg80211_del_iface(struct wiph
  18923. - switch (wdev->iftype) {
  18924. - case NL80211_IFTYPE_ADHOC:
  18925. - case NL80211_IFTYPE_STATION:
  18926. -- case NL80211_IFTYPE_AP:
  18927. - case NL80211_IFTYPE_AP_VLAN:
  18928. - case NL80211_IFTYPE_WDS:
  18929. - case NL80211_IFTYPE_MONITOR:
  18930. - case NL80211_IFTYPE_MESH_POINT:
  18931. - return -EOPNOTSUPP;
  18932. -+ case NL80211_IFTYPE_AP:
  18933. -+ return brcmf_cfg80211_del_ap_iface(wiphy, wdev);
  18934. - case NL80211_IFTYPE_P2P_CLIENT:
  18935. - case NL80211_IFTYPE_P2P_GO:
  18936. - case NL80211_IFTYPE_P2P_DEVICE:
  18937. diff --git a/package/kernel/mac80211/patches/351-0026-brcmfmac-respect-hidden_ssid-for-AP-interfaces.patch b/package/kernel/mac80211/patches/351-0026-brcmfmac-respect-hidden_ssid-for-AP-interfaces.patch
  18938. deleted file mode 100644
  18939. index ae458e7..0000000
  18940. --- a/package/kernel/mac80211/patches/351-0026-brcmfmac-respect-hidden_ssid-for-AP-interfaces.patch
  18941. +++ /dev/null
  18942. @@ -1,43 +0,0 @@
  18943. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  18944. -Date: Wed, 6 Jul 2016 12:22:54 +0200
  18945. -Subject: [PATCH] brcmfmac: respect hidden_ssid for AP interfaces
  18946. -MIME-Version: 1.0
  18947. -Content-Type: text/plain; charset=UTF-8
  18948. -Content-Transfer-Encoding: 8bit
  18949. -
  18950. -This was succesfully tested with 4366B1. A small workaround is needed
  18951. -for the main interface otherwise it would stuck at the hidden state.
  18952. -
  18953. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  18954. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18955. ----
  18956. -
  18957. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  18958. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  18959. -@@ -4586,6 +4586,15 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  18960. - brcmf_err("SET SSID error (%d)\n", err);
  18961. - goto exit;
  18962. - }
  18963. -+
  18964. -+ if (settings->hidden_ssid) {
  18965. -+ err = brcmf_fil_iovar_int_set(ifp, "closednet", 1);
  18966. -+ if (err) {
  18967. -+ brcmf_err("closednet error (%d)\n", err);
  18968. -+ goto exit;
  18969. -+ }
  18970. -+ }
  18971. -+
  18972. - brcmf_dbg(TRACE, "AP mode configuration complete\n");
  18973. - } else if (dev_role == NL80211_IFTYPE_P2P_GO) {
  18974. - err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec);
  18975. -@@ -4644,6 +4653,10 @@ static int brcmf_cfg80211_stop_ap(struct
  18976. - return err;
  18977. - }
  18978. -
  18979. -+ /* First BSS doesn't get a full reset */
  18980. -+ if (ifp->bsscfgidx == 0)
  18981. -+ brcmf_fil_iovar_int_set(ifp, "closednet", 0);
  18982. -+
  18983. - memset(&join_params, 0, sizeof(join_params));
  18984. - err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
  18985. - &join_params, sizeof(join_params));
  18986. diff --git a/package/kernel/mac80211/patches/351-0027-brcmfmac-restore-stopping-netdev-queue-when-bus-clog.patch b/package/kernel/mac80211/patches/351-0027-brcmfmac-restore-stopping-netdev-queue-when-bus-clog.patch
  18987. deleted file mode 100644
  18988. index fcafa79..0000000
  18989. --- a/package/kernel/mac80211/patches/351-0027-brcmfmac-restore-stopping-netdev-queue-when-bus-clog.patch
  18990. +++ /dev/null
  18991. @@ -1,53 +0,0 @@
  18992. -From: Arend Van Spriel <arend.vanspriel@broadcom.com>
  18993. -Date: Fri, 15 Jul 2016 12:16:12 +0200
  18994. -Subject: [PATCH] brcmfmac: restore stopping netdev queue when bus clogs up
  18995. -MIME-Version: 1.0
  18996. -Content-Type: text/plain; charset=UTF-8
  18997. -Content-Transfer-Encoding: 8bit
  18998. -
  18999. -When the host-interface bus has hard time handling transmit packets
  19000. -it informs higher layer about this and it would stop the netdev
  19001. -queue when needed. However, since commit 9cd18359d31e ("brcmfmac:
  19002. -Make FWS queueing configurable.") this was broken. With this patch
  19003. -the behaviour is restored.
  19004. -
  19005. -Cc: stable@vger.kernel.org # v4.5, v4.6, v4.7
  19006. -Fixes: 9cd18359d31e ("brcmfmac: Make FWS queueing configurable.")
  19007. -Tested-by: Per Förlin <per.forlin@gmail.com>
  19008. -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  19009. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  19010. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  19011. -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  19012. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19013. ----
  19014. -
  19015. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
  19016. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
  19017. -@@ -2469,10 +2469,22 @@ void brcmf_fws_bustxfail(struct brcmf_fw
  19018. - void brcmf_fws_bus_blocked(struct brcmf_pub *drvr, bool flow_blocked)
  19019. - {
  19020. - struct brcmf_fws_info *fws = drvr->fws;
  19021. -+ struct brcmf_if *ifp;
  19022. -+ int i;
  19023. -
  19024. -- fws->bus_flow_blocked = flow_blocked;
  19025. -- if (!flow_blocked)
  19026. -- brcmf_fws_schedule_deq(fws);
  19027. -- else
  19028. -- fws->stats.bus_flow_block++;
  19029. -+ if (fws->avoid_queueing) {
  19030. -+ for (i = 0; i < BRCMF_MAX_IFS; i++) {
  19031. -+ ifp = drvr->iflist[i];
  19032. -+ if (!ifp || !ifp->ndev)
  19033. -+ continue;
  19034. -+ brcmf_txflowblock_if(ifp, BRCMF_NETIF_STOP_REASON_FLOW,
  19035. -+ flow_blocked);
  19036. -+ }
  19037. -+ } else {
  19038. -+ fws->bus_flow_blocked = flow_blocked;
  19039. -+ if (!flow_blocked)
  19040. -+ brcmf_fws_schedule_deq(fws);
  19041. -+ else
  19042. -+ fws->stats.bus_flow_block++;
  19043. -+ }
  19044. - }
  19045. diff --git a/package/kernel/mac80211/patches/351-0028-brcmfmac-defer-DPC-processing-during-probe.patch b/package/kernel/mac80211/patches/351-0028-brcmfmac-defer-DPC-processing-during-probe.patch
  19046. deleted file mode 100644
  19047. index a24c07f..0000000
  19048. --- a/package/kernel/mac80211/patches/351-0028-brcmfmac-defer-DPC-processing-during-probe.patch
  19049. +++ /dev/null
  19050. @@ -1,42 +0,0 @@
  19051. -From fd3ed33f51c2a586412d35b4f64803f019ab589f Mon Sep 17 00:00:00 2001
  19052. -From: Arend Van Spriel <arend.vanspriel@broadcom.com>
  19053. -Date: Fri, 15 Jul 2016 12:39:13 +0200
  19054. -Subject: [PATCH] brcmfmac: defer DPC processing during probe
  19055. -
  19056. -The sdio dpc starts processing when in SDIOD_STATE_DATA. This state was
  19057. -entered right after firmware download. This patch moves that transition
  19058. -just before enabling sdio interrupt handling thus avoiding watchdog
  19059. -expiry which would put the bus to sleep while probing.
  19060. -
  19061. -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  19062. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  19063. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  19064. -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  19065. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19066. ----
  19067. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 7 +++----
  19068. - 1 file changed, 3 insertions(+), 4 deletions(-)
  19069. -
  19070. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  19071. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  19072. -@@ -3304,10 +3304,6 @@ static int brcmf_sdio_download_firmware(
  19073. - goto err;
  19074. - }
  19075. -
  19076. -- /* Allow full data communication using DPC from now on. */
  19077. -- brcmf_sdiod_change_state(bus->sdiodev, BRCMF_SDIOD_DATA);
  19078. -- bcmerror = 0;
  19079. --
  19080. - err:
  19081. - brcmf_sdio_clkctl(bus, CLK_SDONLY, false);
  19082. - sdio_release_host(bus->sdiodev->func[1]);
  19083. -@@ -4045,6 +4041,9 @@ static void brcmf_sdio_firmware_callback
  19084. - }
  19085. -
  19086. - if (err == 0) {
  19087. -+ /* Allow full data communication using DPC from now on. */
  19088. -+ brcmf_sdiod_change_state(bus->sdiodev, BRCMF_SDIOD_DATA);
  19089. -+
  19090. - err = brcmf_sdiod_intr_register(sdiodev);
  19091. - if (err != 0)
  19092. - brcmf_err("intr register failed:%d\n", err);
  19093. diff --git a/package/kernel/mac80211/patches/351-0029-brcmfmac-Fix-glob_skb-leak-in-brcmf_sdiod_recv_chain.patch b/package/kernel/mac80211/patches/351-0029-brcmfmac-Fix-glob_skb-leak-in-brcmf_sdiod_recv_chain.patch
  19094. deleted file mode 100644
  19095. index ba9a349..0000000
  19096. --- a/package/kernel/mac80211/patches/351-0029-brcmfmac-Fix-glob_skb-leak-in-brcmf_sdiod_recv_chain.patch
  19097. +++ /dev/null
  19098. @@ -1,32 +0,0 @@
  19099. -From 3bdae810721b33061d2e541bd78a70f86ca42af3 Mon Sep 17 00:00:00 2001
  19100. -From: Florian Fainelli <f.fainelli@gmail.com>
  19101. -Date: Mon, 18 Jul 2016 16:24:34 -0700
  19102. -Subject: [PATCH] brcmfmac: Fix glob_skb leak in brcmf_sdiod_recv_chain
  19103. -
  19104. -In case brcmf_sdiod_recv_chain() cannot complete a succeful call to
  19105. -brcmf_sdiod_buffrw, we would be leaking glom_skb and not free it as we
  19106. -should, fix this.
  19107. -
  19108. -Reported-by: coverity (CID 1164856)
  19109. -Fixes: a413e39a38573 ("brcmfmac: fix brcmf_sdcard_recv_chain() for host without sg support")
  19110. -Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
  19111. -Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  19112. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19113. ----
  19114. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 4 +++-
  19115. - 1 file changed, 3 insertions(+), 1 deletion(-)
  19116. -
  19117. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  19118. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  19119. -@@ -722,8 +722,10 @@ int brcmf_sdiod_recv_chain(struct brcmf_
  19120. - return -ENOMEM;
  19121. - err = brcmf_sdiod_buffrw(sdiodev, SDIO_FUNC_2, false, addr,
  19122. - glom_skb);
  19123. -- if (err)
  19124. -+ if (err) {
  19125. -+ brcmu_pkt_buf_free_skb(glom_skb);
  19126. - goto done;
  19127. -+ }
  19128. -
  19129. - skb_queue_walk(pktq, skb) {
  19130. - memcpy(skb->data, glom_skb->data, skb->len);
  19131. diff --git a/package/kernel/mac80211/patches/351-0030-net-wireless-broadcom-brcm80211-brcmfmac-usb-don-t-p.patch b/package/kernel/mac80211/patches/351-0030-net-wireless-broadcom-brcm80211-brcmfmac-usb-don-t-p.patch
  19132. deleted file mode 100644
  19133. index 540b7f0..0000000
  19134. --- a/package/kernel/mac80211/patches/351-0030-net-wireless-broadcom-brcm80211-brcmfmac-usb-don-t-p.patch
  19135. +++ /dev/null
  19136. @@ -1,34 +0,0 @@
  19137. -From 938f89e50a41c2d56710805fb019ad7618cef84b Mon Sep 17 00:00:00 2001
  19138. -From: Wolfram Sang <wsa-dev@sang-engineering.com>
  19139. -Date: Thu, 11 Aug 2016 23:05:31 +0200
  19140. -Subject: [PATCH] net: wireless: broadcom: brcm80211: brcmfmac: usb: don't
  19141. - print error when allocating urb fails
  19142. -
  19143. -kmalloc will print enough information in case of failure.
  19144. -
  19145. -Signed-off-by: Wolfram Sang <wsa-dev@sang-engineering.com>
  19146. -Signed-off-by: David S. Miller <davem@davemloft.net>
  19147. ----
  19148. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 8 ++------
  19149. - 1 file changed, 2 insertions(+), 6 deletions(-)
  19150. -
  19151. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
  19152. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
  19153. -@@ -1099,15 +1099,11 @@ struct brcmf_usbdev *brcmf_usb_attach(st
  19154. - devinfo->tx_freecount = ntxq;
  19155. -
  19156. - devinfo->ctl_urb = usb_alloc_urb(0, GFP_ATOMIC);
  19157. -- if (!devinfo->ctl_urb) {
  19158. -- brcmf_err("usb_alloc_urb (ctl) failed\n");
  19159. -+ if (!devinfo->ctl_urb)
  19160. - goto error;
  19161. -- }
  19162. - devinfo->bulk_urb = usb_alloc_urb(0, GFP_ATOMIC);
  19163. -- if (!devinfo->bulk_urb) {
  19164. -- brcmf_err("usb_alloc_urb (bulk) failed\n");
  19165. -+ if (!devinfo->bulk_urb)
  19166. - goto error;
  19167. -- }
  19168. -
  19169. - return &devinfo->bus_pub;
  19170. -
  19171. diff --git a/package/kernel/mac80211/patches/351-0031-brcmfmac-Check-rtnl_lock-is-locked-when-removing-int.patch b/package/kernel/mac80211/patches/351-0031-brcmfmac-Check-rtnl_lock-is-locked-when-removing-int.patch
  19172. deleted file mode 100644
  19173. index b98b68a..0000000
  19174. --- a/package/kernel/mac80211/patches/351-0031-brcmfmac-Check-rtnl_lock-is-locked-when-removing-int.patch
  19175. +++ /dev/null
  19176. @@ -1,111 +0,0 @@
  19177. -From 15dacf880e49ce3ecee05eb1a0c6b8e363dbacdc Mon Sep 17 00:00:00 2001
  19178. -From: "mhiramat@kernel.org" <mhiramat@kernel.org>
  19179. -Date: Mon, 15 Aug 2016 18:40:57 +0900
  19180. -Subject: [PATCH] brcmfmac: Check rtnl_lock is locked when removing interface
  19181. -MIME-Version: 1.0
  19182. -Content-Type: text/plain; charset=UTF-8
  19183. -Content-Transfer-Encoding: 8bit
  19184. -
  19185. -Check rtnl_lock is locked in brcmf_p2p_ifp_removed() by passing
  19186. -rtnl_locked flag. Actually the caller brcmf_del_if() checks whether
  19187. -the rtnl_lock is locked, but doesn't pass it to brcmf_p2p_ifp_removed().
  19188. -
  19189. -Without this fix, wpa_supplicant goes softlockup with rtnl_lock
  19190. -holding (this means all other process using netlink are locked up too)
  19191. -
  19192. -e.g.
  19193. -[ 4495.876627] INFO: task wpa_supplicant:7307 blocked for more than 10 seconds.
  19194. -[ 4495.876632] Tainted: G W 4.8.0-rc1+ #8
  19195. -[ 4495.876635] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
  19196. -[ 4495.876638] wpa_supplicant D ffff974c647b39a0 0 7307 1 0x00000000
  19197. -[ 4495.876644] ffff974c647b39a0 0000000000000000 ffff974c00000000 ffff974c7dc59c58
  19198. -[ 4495.876651] ffff974c6b7417c0 ffff974c645017c0 ffff974c647b4000 ffffffff86f16c08
  19199. -[ 4495.876657] ffff974c645017c0 0000000000000246 00000000ffffffff ffff974c647b39b8
  19200. -[ 4495.876664] Call Trace:
  19201. -[ 4495.876671] [<ffffffff868aeccc>] schedule+0x3c/0x90
  19202. -[ 4495.876676] [<ffffffff868af065>] schedule_preempt_disabled+0x15/0x20
  19203. -[ 4495.876682] [<ffffffff868b0996>] mutex_lock_nested+0x176/0x3b0
  19204. -[ 4495.876686] [<ffffffff867a2067>] ? rtnl_lock+0x17/0x20
  19205. -[ 4495.876690] [<ffffffff867a2067>] rtnl_lock+0x17/0x20
  19206. -[ 4495.876720] [<ffffffffc0ae9a5d>] brcmf_p2p_ifp_removed+0x4d/0x70 [brcmfmac]
  19207. -[ 4495.876741] [<ffffffffc0aebde6>] brcmf_remove_interface+0x196/0x1b0 [brcmfmac]
  19208. -[ 4495.876760] [<ffffffffc0ae9901>] brcmf_p2p_del_vif+0x111/0x220 [brcmfmac]
  19209. -[ 4495.876777] [<ffffffffc0adefab>] brcmf_cfg80211_del_iface+0x21b/0x270 [brcmfmac]
  19210. -[ 4495.876820] [<ffffffffc097b39e>] nl80211_del_interface+0xfe/0x3a0 [cfg80211]
  19211. -[ 4495.876825] [<ffffffff867ca335>] genl_family_rcv_msg+0x1b5/0x370
  19212. -[ 4495.876832] [<ffffffff860e5d8d>] ? trace_hardirqs_on+0xd/0x10
  19213. -[ 4495.876836] [<ffffffff867ca56d>] genl_rcv_msg+0x7d/0xb0
  19214. -[ 4495.876839] [<ffffffff867ca4f0>] ? genl_family_rcv_msg+0x370/0x370
  19215. -[ 4495.876846] [<ffffffff867c9a47>] netlink_rcv_skb+0x97/0xb0
  19216. -[ 4495.876849] [<ffffffff867ca168>] genl_rcv+0x28/0x40
  19217. -[ 4495.876854] [<ffffffff867c93c3>] netlink_unicast+0x1d3/0x2f0
  19218. -[ 4495.876860] [<ffffffff867c933b>] ? netlink_unicast+0x14b/0x2f0
  19219. -[ 4495.876866] [<ffffffff867c97cb>] netlink_sendmsg+0x2eb/0x3a0
  19220. -[ 4495.876870] [<ffffffff8676dad8>] sock_sendmsg+0x38/0x50
  19221. -[ 4495.876874] [<ffffffff8676e4df>] ___sys_sendmsg+0x27f/0x290
  19222. -[ 4495.876882] [<ffffffff8628b935>] ? mntput_no_expire+0x5/0x3f0
  19223. -[ 4495.876888] [<ffffffff8628b9be>] ? mntput_no_expire+0x8e/0x3f0
  19224. -[ 4495.876894] [<ffffffff8628b935>] ? mntput_no_expire+0x5/0x3f0
  19225. -[ 4495.876899] [<ffffffff8628bd44>] ? mntput+0x24/0x40
  19226. -[ 4495.876904] [<ffffffff86267830>] ? __fput+0x190/0x200
  19227. -[ 4495.876909] [<ffffffff8676f125>] __sys_sendmsg+0x45/0x80
  19228. -[ 4495.876914] [<ffffffff8676f172>] SyS_sendmsg+0x12/0x20
  19229. -[ 4495.876918] [<ffffffff868b5680>] entry_SYSCALL_64_fastpath+0x23/0xc1
  19230. -[ 4495.876924] [<ffffffff860e2b8f>] ? trace_hardirqs_off_caller+0x1f/0xc0
  19231. -
  19232. -Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
  19233. -Acked-by: Rafał Miłecki <rafal@milecki.pl>
  19234. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19235. ----
  19236. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 2 +-
  19237. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c | 8 +++++---
  19238. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h | 2 +-
  19239. - 3 files changed, 7 insertions(+), 5 deletions(-)
  19240. -
  19241. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  19242. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  19243. -@@ -743,7 +743,7 @@ static void brcmf_del_if(struct brcmf_pu
  19244. - * serious troublesome side effects. The p2p module will clean
  19245. - * up the ifp if needed.
  19246. - */
  19247. -- brcmf_p2p_ifp_removed(ifp);
  19248. -+ brcmf_p2p_ifp_removed(ifp, rtnl_locked);
  19249. - kfree(ifp);
  19250. - }
  19251. - }
  19252. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  19253. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  19254. -@@ -2299,7 +2299,7 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  19255. - return err;
  19256. - }
  19257. -
  19258. --void brcmf_p2p_ifp_removed(struct brcmf_if *ifp)
  19259. -+void brcmf_p2p_ifp_removed(struct brcmf_if *ifp, bool rtnl_locked)
  19260. - {
  19261. - struct brcmf_cfg80211_info *cfg;
  19262. - struct brcmf_cfg80211_vif *vif;
  19263. -@@ -2308,9 +2308,11 @@ void brcmf_p2p_ifp_removed(struct brcmf_
  19264. - vif = ifp->vif;
  19265. - cfg = wdev_to_cfg(&vif->wdev);
  19266. - cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  19267. -- rtnl_lock();
  19268. -+ if (!rtnl_locked)
  19269. -+ rtnl_lock();
  19270. - cfg80211_unregister_wdev(&vif->wdev);
  19271. -- rtnl_unlock();
  19272. -+ if (!rtnl_locked)
  19273. -+ rtnl_unlock();
  19274. - brcmf_free_vif(vif);
  19275. - }
  19276. -
  19277. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h
  19278. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h
  19279. -@@ -155,7 +155,7 @@ struct wireless_dev *brcmf_p2p_add_vif(s
  19280. - int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev);
  19281. - int brcmf_p2p_ifchange(struct brcmf_cfg80211_info *cfg,
  19282. - enum brcmf_fil_p2p_if_types if_type);
  19283. --void brcmf_p2p_ifp_removed(struct brcmf_if *ifp);
  19284. -+void brcmf_p2p_ifp_removed(struct brcmf_if *ifp, bool rtnl_locked);
  19285. - int brcmf_p2p_start_device(struct wiphy *wiphy, struct wireless_dev *wdev);
  19286. - void brcmf_p2p_stop_device(struct wiphy *wiphy, struct wireless_dev *wdev);
  19287. - int brcmf_p2p_scan_prep(struct wiphy *wiphy,
  19288. diff --git a/package/kernel/mac80211/patches/351-0032-brcmfmac-Change-vif_event_lock-to-spinlock.patch b/package/kernel/mac80211/patches/351-0032-brcmfmac-Change-vif_event_lock-to-spinlock.patch
  19289. deleted file mode 100644
  19290. index 30ca258..0000000
  19291. --- a/package/kernel/mac80211/patches/351-0032-brcmfmac-Change-vif_event_lock-to-spinlock.patch
  19292. +++ /dev/null
  19293. @@ -1,175 +0,0 @@
  19294. -From b64abcb7dae6060c67ab0e548da3ef923c49641d Mon Sep 17 00:00:00 2001
  19295. -From: "mhiramat@kernel.org" <mhiramat@kernel.org>
  19296. -Date: Mon, 15 Aug 2016 18:41:12 +0900
  19297. -Subject: [PATCH] brcmfmac: Change vif_event_lock to spinlock
  19298. -
  19299. -Change vif_event_lock to spinlock from mutex, since this lock is
  19300. -used in wait_event_timeout() via vif_event_equals(). This caused
  19301. -a warning report as below.
  19302. -
  19303. -As far as I can see, this lock protects regions where updating
  19304. -structure members, not function calls. Also, since those
  19305. -regions are not called from interrupt handlers (of course, it
  19306. -was a mutex), spin_lock is used instead of spin_lock_irqsave.
  19307. -
  19308. -[ 186.678550] ------------[ cut here ]------------
  19309. -[ 186.678556] WARNING: CPU: 2 PID: 7140 at /home/mhiramat/ksrc/linux/kernel/sched/core.c:7545 __might_sleep+0x7c/0x80
  19310. -[ 186.678560] do not call blocking ops when !TASK_RUNNING; state=2 set at [<ffffffff980d9090>] prepare_to_wait_event+0x60/0x100
  19311. -[ 186.678560] Modules linked in: brcmfmac xt_CHECKSUM rfcomm ipt_MASQUERADE nf_nat_masquerade_ipv4 xt_addrtype br_netfilter xt_tcpudp ip6t_rpfilter ip6t_REJECT nf_reject_ipv6 ipt_REJECT nf_reject_ipv4 xt_conntrack ip_set nfnetlink ebtable_nat ebtable_broute bridge stp llc ebtable_filter ebtables ip6table_raw ip6table_security ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 ip6table_mangle ip6table_filter ip6_tables iptable_raw iptable_security iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack iptable_mangle iptable_filter ip_tables x_tables bnep nls_iso8859_1 i2c_designware_platform i2c_designware_core snd_hda_codec_hdmi snd_hda_codec_realtek dcdbas snd_hda_codec_generic snd_hda_intel snd_hda_codec intel_rapl snd_hda_core x86_pkg_temp_thermal intel_powerclamp coretemp
  19312. -[ 186.678594] snd_pcm crct10dif_pclmul crc32_pclmul aesni_intel aes_x86_64 joydev glue_helper snd_hwdep lrw gf128mul uvcvideo ablk_helper snd_seq_midi cryptd snd_seq_midi_event snd_rawmidi videobuf2_vmalloc videobuf2_memops snd_seq input_leds videobuf2_v4l2 cfg80211 videobuf2_core snd_timer videodev serio_raw btusb snd_seq_device media btrtl rtsx_pci_ms snd mei_me memstick hid_multitouch mei soundcore brcmutil idma64 virt_dma intel_lpss_pci processor_thermal_device intel_soc_dts_iosf hci_uart btbcm btqca btintel bluetooth int3403_thermal dell_smo8800 intel_lpss_acpi intel_lpss int3402_thermal int340x_thermal_zone intel_hid mac_hid int3400_thermal shpchp sparse_keymap acpi_pad acpi_thermal_rel acpi_als kfifo_buf industrialio kvm_intel kvm irqbypass parport_pc ppdev lp parport autofs4 btrfs xor raid6_pq
  19313. -[ 186.678631] usbhid nouveau ttm i915 rtsx_pci_sdmmc mxm_wmi i2c_algo_bit drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops psmouse drm ahci rtsx_pci nvme nvme_core libahci i2c_hid hid pinctrl_sunrisepoint video wmi pinctrl_intel fjes [last unloaded: brcmfmac]
  19314. -[ 186.678646] CPU: 2 PID: 7140 Comm: wpa_supplicant Not tainted 4.8.0-rc1+ #8
  19315. -[ 186.678647] Hardware name: Dell Inc. XPS 15 9550/0N7TVV, BIOS 01.02.00 04/07/2016
  19316. -[ 186.678648] 0000000000000000 ffff9d8c64b5b900 ffffffff98442f23 ffff9d8c64b5b950
  19317. -[ 186.678651] 0000000000000000 ffff9d8c64b5b940 ffffffff9808b22b 00001d790000000d
  19318. -[ 186.678653] ffffffff98c75e78 000000000000026c 0000000000000000 ffff9d8c2706d058
  19319. -[ 186.678655] Call Trace:
  19320. -[ 186.678659] [<ffffffff98442f23>] dump_stack+0x85/0xc2
  19321. -[ 186.678666] [<ffffffff9808b22b>] __warn+0xcb/0xf0
  19322. -[ 186.678668] [<ffffffff9808b29f>] warn_slowpath_fmt+0x4f/0x60
  19323. -[ 186.678671] [<ffffffff980d9090>] ? prepare_to_wait_event+0x60/0x100
  19324. -[ 186.678672] [<ffffffff980d9090>] ? prepare_to_wait_event+0x60/0x100
  19325. -[ 186.678674] [<ffffffff980b922c>] __might_sleep+0x7c/0x80
  19326. -[ 186.678680] [<ffffffff988b0853>] mutex_lock_nested+0x33/0x3b0
  19327. -[ 186.678682] [<ffffffff980e5d8d>] ? trace_hardirqs_on+0xd/0x10
  19328. -[ 186.678689] [<ffffffffc0c57d2d>] brcmf_cfg80211_wait_vif_event+0xcd/0x130 [brcmfmac]
  19329. -[ 186.678691] [<ffffffff980d9190>] ? wake_atomic_t_function+0x60/0x60
  19330. -[ 186.678697] [<ffffffffc0c628e9>] brcmf_p2p_del_vif+0xf9/0x220 [brcmfmac]
  19331. -[ 186.678702] [<ffffffffc0c57fab>] brcmf_cfg80211_del_iface+0x21b/0x270 [brcmfmac]
  19332. -[ 186.678716] [<ffffffffc0b0539e>] nl80211_del_interface+0xfe/0x3a0 [cfg80211]
  19333. -[ 186.678718] [<ffffffff987ca335>] genl_family_rcv_msg+0x1b5/0x370
  19334. -[ 186.678720] [<ffffffff980e5d8d>] ? trace_hardirqs_on+0xd/0x10
  19335. -[ 186.678721] [<ffffffff987ca56d>] genl_rcv_msg+0x7d/0xb0
  19336. -[ 186.678722] [<ffffffff987ca4f0>] ? genl_family_rcv_msg+0x370/0x370
  19337. -[ 186.678724] [<ffffffff987c9a47>] netlink_rcv_skb+0x97/0xb0
  19338. -[ 186.678726] [<ffffffff987ca168>] genl_rcv+0x28/0x40
  19339. -[ 186.678727] [<ffffffff987c93c3>] netlink_unicast+0x1d3/0x2f0
  19340. -[ 186.678729] [<ffffffff987c933b>] ? netlink_unicast+0x14b/0x2f0
  19341. -[ 186.678731] [<ffffffff987c97cb>] netlink_sendmsg+0x2eb/0x3a0
  19342. -[ 186.678733] [<ffffffff9876dad8>] sock_sendmsg+0x38/0x50
  19343. -[ 186.678734] [<ffffffff9876e4df>] ___sys_sendmsg+0x27f/0x290
  19344. -[ 186.678737] [<ffffffff9828b935>] ? mntput_no_expire+0x5/0x3f0
  19345. -[ 186.678739] [<ffffffff9828b9be>] ? mntput_no_expire+0x8e/0x3f0
  19346. -[ 186.678741] [<ffffffff9828b935>] ? mntput_no_expire+0x5/0x3f0
  19347. -[ 186.678743] [<ffffffff9828bd44>] ? mntput+0x24/0x40
  19348. -[ 186.678744] [<ffffffff98267830>] ? __fput+0x190/0x200
  19349. -[ 186.678746] [<ffffffff9876f125>] __sys_sendmsg+0x45/0x80
  19350. -[ 186.678748] [<ffffffff9876f172>] SyS_sendmsg+0x12/0x20
  19351. -[ 186.678749] [<ffffffff988b5680>] entry_SYSCALL_64_fastpath+0x23/0xc1
  19352. -[ 186.678751] [<ffffffff980e2b8f>] ? trace_hardirqs_off_caller+0x1f/0xc0
  19353. -[ 186.678752] ---[ end trace e224d66c5d8408b5 ]---
  19354. -
  19355. -Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
  19356. -Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  19357. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19358. ----
  19359. - .../broadcom/brcm80211/brcmfmac/cfg80211.c | 26 +++++++++++-----------
  19360. - .../broadcom/brcm80211/brcmfmac/cfg80211.h | 2 +-
  19361. - 2 files changed, 14 insertions(+), 14 deletions(-)
  19362. -
  19363. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  19364. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  19365. -@@ -5555,7 +5555,7 @@ static s32 brcmf_notify_vif_event(struct
  19366. - ifevent->action, ifevent->flags, ifevent->ifidx,
  19367. - ifevent->bsscfgidx);
  19368. -
  19369. -- mutex_lock(&event->vif_event_lock);
  19370. -+ spin_lock(&event->vif_event_lock);
  19371. - event->action = ifevent->action;
  19372. - vif = event->vif;
  19373. -
  19374. -@@ -5563,7 +5563,7 @@ static s32 brcmf_notify_vif_event(struct
  19375. - case BRCMF_E_IF_ADD:
  19376. - /* waiting process may have timed out */
  19377. - if (!cfg->vif_event.vif) {
  19378. -- mutex_unlock(&event->vif_event_lock);
  19379. -+ spin_unlock(&event->vif_event_lock);
  19380. - return -EBADF;
  19381. - }
  19382. -
  19383. -@@ -5574,24 +5574,24 @@ static s32 brcmf_notify_vif_event(struct
  19384. - ifp->ndev->ieee80211_ptr = &vif->wdev;
  19385. - SET_NETDEV_DEV(ifp->ndev, wiphy_dev(cfg->wiphy));
  19386. - }
  19387. -- mutex_unlock(&event->vif_event_lock);
  19388. -+ spin_unlock(&event->vif_event_lock);
  19389. - wake_up(&event->vif_wq);
  19390. - return 0;
  19391. -
  19392. - case BRCMF_E_IF_DEL:
  19393. -- mutex_unlock(&event->vif_event_lock);
  19394. -+ spin_unlock(&event->vif_event_lock);
  19395. - /* event may not be upon user request */
  19396. - if (brcmf_cfg80211_vif_event_armed(cfg))
  19397. - wake_up(&event->vif_wq);
  19398. - return 0;
  19399. -
  19400. - case BRCMF_E_IF_CHANGE:
  19401. -- mutex_unlock(&event->vif_event_lock);
  19402. -+ spin_unlock(&event->vif_event_lock);
  19403. - wake_up(&event->vif_wq);
  19404. - return 0;
  19405. -
  19406. - default:
  19407. -- mutex_unlock(&event->vif_event_lock);
  19408. -+ spin_unlock(&event->vif_event_lock);
  19409. - break;
  19410. - }
  19411. - return -EINVAL;
  19412. -@@ -5712,7 +5712,7 @@ static void wl_deinit_priv(struct brcmf_
  19413. - static void init_vif_event(struct brcmf_cfg80211_vif_event *event)
  19414. - {
  19415. - init_waitqueue_head(&event->vif_wq);
  19416. -- mutex_init(&event->vif_event_lock);
  19417. -+ spin_lock_init(&event->vif_event_lock);
  19418. - }
  19419. -
  19420. - static s32 brcmf_dongle_roam(struct brcmf_if *ifp)
  19421. -@@ -6607,9 +6607,9 @@ static inline bool vif_event_equals(stru
  19422. - {
  19423. - u8 evt_action;
  19424. -
  19425. -- mutex_lock(&event->vif_event_lock);
  19426. -+ spin_lock(&event->vif_event_lock);
  19427. - evt_action = event->action;
  19428. -- mutex_unlock(&event->vif_event_lock);
  19429. -+ spin_unlock(&event->vif_event_lock);
  19430. - return evt_action == action;
  19431. - }
  19432. -
  19433. -@@ -6618,10 +6618,10 @@ void brcmf_cfg80211_arm_vif_event(struct
  19434. - {
  19435. - struct brcmf_cfg80211_vif_event *event = &cfg->vif_event;
  19436. -
  19437. -- mutex_lock(&event->vif_event_lock);
  19438. -+ spin_lock(&event->vif_event_lock);
  19439. - event->vif = vif;
  19440. - event->action = 0;
  19441. -- mutex_unlock(&event->vif_event_lock);
  19442. -+ spin_unlock(&event->vif_event_lock);
  19443. - }
  19444. -
  19445. - bool brcmf_cfg80211_vif_event_armed(struct brcmf_cfg80211_info *cfg)
  19446. -@@ -6629,9 +6629,9 @@ bool brcmf_cfg80211_vif_event_armed(stru
  19447. - struct brcmf_cfg80211_vif_event *event = &cfg->vif_event;
  19448. - bool armed;
  19449. -
  19450. -- mutex_lock(&event->vif_event_lock);
  19451. -+ spin_lock(&event->vif_event_lock);
  19452. - armed = event->vif != NULL;
  19453. -- mutex_unlock(&event->vif_event_lock);
  19454. -+ spin_unlock(&event->vif_event_lock);
  19455. -
  19456. - return armed;
  19457. - }
  19458. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  19459. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  19460. -@@ -227,7 +227,7 @@ struct escan_info {
  19461. - */
  19462. - struct brcmf_cfg80211_vif_event {
  19463. - wait_queue_head_t vif_wq;
  19464. -- struct mutex vif_event_lock;
  19465. -+ spinlock_t vif_event_lock;
  19466. - u8 action;
  19467. - struct brcmf_cfg80211_vif *vif;
  19468. - };
  19469. diff --git a/package/kernel/mac80211/patches/351-0033-brcmfmac-add-missing-header-dependencies.patch b/package/kernel/mac80211/patches/351-0033-brcmfmac-add-missing-header-dependencies.patch
  19470. deleted file mode 100644
  19471. index 1a7947b..0000000
  19472. --- a/package/kernel/mac80211/patches/351-0033-brcmfmac-add-missing-header-dependencies.patch
  19473. +++ /dev/null
  19474. @@ -1,29 +0,0 @@
  19475. -From 8af92af3f2d55db143417a5d401696f4b642009a Mon Sep 17 00:00:00 2001
  19476. -From: Baoyou Xie <baoyou.xie@linaro.org>
  19477. -Date: Mon, 29 Aug 2016 20:39:35 +0800
  19478. -Subject: [PATCH] brcmfmac: add missing header dependencies
  19479. -
  19480. -We get 1 warning when building kernel with W=1:
  19481. -
  19482. -drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.c:23:6: warning: no previous prototype for '__brcmf_err' [-Wmissing-prototypes]
  19483. -
  19484. -In fact, this function is declared in brcmfmac/debug.h, so this patch
  19485. -adds missing header dependencies.
  19486. -
  19487. -Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
  19488. -Acked-by: Arnd Bergmann <arnd@arndb.de>
  19489. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19490. ----
  19491. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.c | 1 +
  19492. - 1 file changed, 1 insertion(+)
  19493. -
  19494. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.c
  19495. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.c
  19496. -@@ -19,6 +19,7 @@
  19497. - #ifndef __CHECKER__
  19498. - #define CREATE_TRACE_POINTS
  19499. - #include "tracepoint.h"
  19500. -+#include "debug.h"
  19501. -
  19502. - void __brcmf_err(const char *func, const char *fmt, ...)
  19503. - {
  19504. diff --git a/package/kernel/mac80211/patches/351-0034-brcmfmac-Add-USB-ID-for-Cisco-Linksys-AE1200.patch b/package/kernel/mac80211/patches/351-0034-brcmfmac-Add-USB-ID-for-Cisco-Linksys-AE1200.patch
  19505. deleted file mode 100644
  19506. index 24cd92a..0000000
  19507. --- a/package/kernel/mac80211/patches/351-0034-brcmfmac-Add-USB-ID-for-Cisco-Linksys-AE1200.patch
  19508. +++ /dev/null
  19509. @@ -1,51 +0,0 @@
  19510. -From bccf3ffc8c6d8e0251a15541bb4d12b423c4f729 Mon Sep 17 00:00:00 2001
  19511. -From: Ismael Luceno <ismael@iodev.co.uk>
  19512. -Date: Mon, 22 Aug 2016 19:40:07 -0300
  19513. -Subject: [PATCH] brcmfmac: Add USB ID for Cisco Linksys AE1200
  19514. -
  19515. -The AE1200 comes with different revisions of the BCM43235 chipset,
  19516. -but all have the same USB ID. Only revision 3 can be supported.
  19517. -
  19518. -Signed-off-by: Ismael Luceno <ismael@iodev.co.uk>
  19519. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19520. ----
  19521. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 4 ++++
  19522. - drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h | 2 ++
  19523. - 2 files changed, 6 insertions(+)
  19524. -
  19525. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
  19526. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
  19527. -@@ -1456,11 +1456,15 @@ static int brcmf_usb_reset_resume(struct
  19528. - #define BRCMF_USB_DEVICE(dev_id) \
  19529. - { USB_DEVICE(BRCM_USB_VENDOR_ID_BROADCOM, dev_id) }
  19530. -
  19531. -+#define LINKSYS_USB_DEVICE(dev_id) \
  19532. -+ { USB_DEVICE(BRCM_USB_VENDOR_ID_LINKSYS, dev_id) }
  19533. -+
  19534. - static struct usb_device_id brcmf_usb_devid_table[] = {
  19535. - BRCMF_USB_DEVICE(BRCM_USB_43143_DEVICE_ID),
  19536. - BRCMF_USB_DEVICE(BRCM_USB_43236_DEVICE_ID),
  19537. - BRCMF_USB_DEVICE(BRCM_USB_43242_DEVICE_ID),
  19538. - BRCMF_USB_DEVICE(BRCM_USB_43569_DEVICE_ID),
  19539. -+ LINKSYS_USB_DEVICE(BRCM_USB_43235_LINKSYS_DEVICE_ID),
  19540. - { USB_DEVICE(BRCM_USB_VENDOR_ID_LG, BRCM_USB_43242_LG_DEVICE_ID) },
  19541. - /* special entry for device with firmware loaded and running */
  19542. - BRCMF_USB_DEVICE(BRCM_USB_BCMFW_DEVICE_ID),
  19543. ---- a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h
  19544. -+++ b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h
  19545. -@@ -22,6 +22,7 @@
  19546. -
  19547. - #define BRCM_USB_VENDOR_ID_BROADCOM 0x0a5c
  19548. - #define BRCM_USB_VENDOR_ID_LG 0x043e
  19549. -+#define BRCM_USB_VENDOR_ID_LINKSYS 0x13b1
  19550. - #define BRCM_PCIE_VENDOR_ID_BROADCOM PCI_VENDOR_ID_BROADCOM
  19551. -
  19552. - /* Chipcommon Core Chip IDs */
  19553. -@@ -56,6 +57,7 @@
  19554. -
  19555. - /* USB Device IDs */
  19556. - #define BRCM_USB_43143_DEVICE_ID 0xbd1e
  19557. -+#define BRCM_USB_43235_LINKSYS_DEVICE_ID 0x0039
  19558. - #define BRCM_USB_43236_DEVICE_ID 0xbd17
  19559. - #define BRCM_USB_43242_DEVICE_ID 0xbd1f
  19560. - #define BRCM_USB_43242_LG_DEVICE_ID 0x3101
  19561. diff --git a/package/kernel/mac80211/patches/351-0035-brcmfmac-fix-pmksa-bssid-usage.patch b/package/kernel/mac80211/patches/351-0035-brcmfmac-fix-pmksa-bssid-usage.patch
  19562. deleted file mode 100644
  19563. index b58a266..0000000
  19564. --- a/package/kernel/mac80211/patches/351-0035-brcmfmac-fix-pmksa-bssid-usage.patch
  19565. +++ /dev/null
  19566. @@ -1,51 +0,0 @@
  19567. -From 7703773ef1d85b40433902a8da20167331597e4a Mon Sep 17 00:00:00 2001
  19568. -From: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
  19569. -Date: Tue, 23 Aug 2016 11:37:17 +0200
  19570. -Subject: [PATCH] brcmfmac: fix pmksa->bssid usage
  19571. -
  19572. -The struct cfg80211_pmksa defines its bssid field as:
  19573. -
  19574. - const u8 *bssid;
  19575. -
  19576. -contrary to struct brcmf_pmksa, which uses:
  19577. -
  19578. - u8 bssid[ETH_ALEN];
  19579. -
  19580. -Therefore in brcmf_cfg80211_del_pmksa(), &pmksa->bssid takes the address
  19581. -of this field (of type u8**), not the one of its content (which would be
  19582. -u8*). Remove the & operator to make brcmf_dbg("%pM") and memcmp()
  19583. -behave as expected.
  19584. -
  19585. -This bug have been found using a custom static checker (which checks the
  19586. -usage of %p... attributes at build time). It has been introduced in
  19587. -commit 6c404f34f2bd ("brcmfmac: Cleanup pmksa cache handling code"),
  19588. -which replaced pmksa->bssid by &pmksa->bssid while refactoring the code,
  19589. -without modifying struct cfg80211_pmksa definition.
  19590. -
  19591. -Replace &pmk[i].bssid with pmk[i].bssid too to make the code clearer,
  19592. -this change does not affect the semantic.
  19593. -
  19594. -Fixes: 6c404f34f2bd ("brcmfmac: Cleanup pmksa cache handling code")
  19595. -Cc: stable@vger.kernel.org
  19596. -Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
  19597. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19598. ----
  19599. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 4 ++--
  19600. - 1 file changed, 2 insertions(+), 2 deletions(-)
  19601. -
  19602. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  19603. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  19604. -@@ -3804,11 +3804,11 @@ brcmf_cfg80211_del_pmksa(struct wiphy *w
  19605. - if (!check_vif_up(ifp->vif))
  19606. - return -EIO;
  19607. -
  19608. -- brcmf_dbg(CONN, "del_pmksa - PMK bssid = %pM\n", &pmksa->bssid);
  19609. -+ brcmf_dbg(CONN, "del_pmksa - PMK bssid = %pM\n", pmksa->bssid);
  19610. -
  19611. - npmk = le32_to_cpu(cfg->pmk_list.npmk);
  19612. - for (i = 0; i < npmk; i++)
  19613. -- if (!memcmp(&pmksa->bssid, &pmk[i].bssid, ETH_ALEN))
  19614. -+ if (!memcmp(pmksa->bssid, pmk[i].bssid, ETH_ALEN))
  19615. - break;
  19616. -
  19617. - if ((npmk > 0) && (i < npmk)) {
  19618. diff --git a/package/kernel/mac80211/patches/351-0036-brcmfmac-avoid-potential-stack-overflow-in-brcmf_cfg.patch b/package/kernel/mac80211/patches/351-0036-brcmfmac-avoid-potential-stack-overflow-in-brcmf_cfg.patch
  19619. deleted file mode 100644
  19620. index 760b6da..0000000
  19621. --- a/package/kernel/mac80211/patches/351-0036-brcmfmac-avoid-potential-stack-overflow-in-brcmf_cfg.patch
  19622. +++ /dev/null
  19623. @@ -1,34 +0,0 @@
  19624. -From ded89912156b1a47d940a0c954c43afbabd0c42c Mon Sep 17 00:00:00 2001
  19625. -From: Arend Van Spriel <arend.vanspriel@broadcom.com>
  19626. -Date: Mon, 5 Sep 2016 10:45:47 +0100
  19627. -Subject: [PATCH] brcmfmac: avoid potential stack overflow in
  19628. - brcmf_cfg80211_start_ap()
  19629. -
  19630. -User-space can choose to omit NL80211_ATTR_SSID and only provide raw
  19631. -IE TLV data. When doing so it can provide SSID IE with length exceeding
  19632. -the allowed size. The driver further processes this IE copying it
  19633. -into a local variable without checking the length. Hence stack can be
  19634. -corrupted and used as exploit.
  19635. -
  19636. -Cc: stable@vger.kernel.org # v4.7
  19637. -Reported-by: Daxing Guo <freener.gdx@gmail.com>
  19638. -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  19639. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  19640. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  19641. -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  19642. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19643. ----
  19644. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 2 +-
  19645. - 1 file changed, 1 insertion(+), 1 deletion(-)
  19646. -
  19647. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  19648. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  19649. -@@ -4447,7 +4447,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  19650. - (u8 *)&settings->beacon.head[ie_offset],
  19651. - settings->beacon.head_len - ie_offset,
  19652. - WLAN_EID_SSID);
  19653. -- if (!ssid_ie)
  19654. -+ if (!ssid_ie || ssid_ie->len > IEEE80211_MAX_SSID_LEN)
  19655. - return -EINVAL;
  19656. -
  19657. - memcpy(ssid_le.SSID, ssid_ie->data, ssid_ie->len);
  19658. diff --git a/package/kernel/mac80211/patches/351-0037-brcmfmac-add-support-for-bcm4339-chip-with-modalias-.patch b/package/kernel/mac80211/patches/351-0037-brcmfmac-add-support-for-bcm4339-chip-with-modalias-.patch
  19659. deleted file mode 100644
  19660. index 1285b30..0000000
  19661. --- a/package/kernel/mac80211/patches/351-0037-brcmfmac-add-support-for-bcm4339-chip-with-modalias-.patch
  19662. +++ /dev/null
  19663. @@ -1,55 +0,0 @@
  19664. -From 634faf3686900ccdee87b77e2c56df8b2159912b Mon Sep 17 00:00:00 2001
  19665. -From: Arend Van Spriel <arend.vanspriel@broadcom.com>
  19666. -Date: Mon, 5 Sep 2016 11:42:12 +0100
  19667. -Subject: [PATCH] brcmfmac: add support for bcm4339 chip with modalias
  19668. - sdio:c00v02D0d4339
  19669. -
  19670. -The driver already supports the bcm4339 chipset but only for the variant
  19671. -that shares the same modalias as the bcm4335, ie. sdio:c00v02D0d4335.
  19672. -It turns out that there are also bcm4339 devices out there that have a
  19673. -more distiguishable modalias sdio:c00v02D0d4339.
  19674. -
  19675. -Reported-by: Steve deRosier <derosier@gmail.com>
  19676. -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  19677. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  19678. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  19679. -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  19680. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19681. ----
  19682. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 1 +
  19683. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 3 ++-
  19684. - include/linux/mmc/sdio_ids.h | 1 +
  19685. - 3 files changed, 4 insertions(+), 1 deletion(-)
  19686. -
  19687. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  19688. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  19689. -@@ -1097,6 +1097,7 @@ static const struct sdio_device_id brcmf
  19690. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43341),
  19691. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43362),
  19692. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4335_4339),
  19693. -+ BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4339),
  19694. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43430),
  19695. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4345),
  19696. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4354),
  19697. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  19698. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  19699. -@@ -3756,7 +3756,8 @@ static u32 brcmf_sdio_buscore_read32(voi
  19700. - u32 val, rev;
  19701. -
  19702. - val = brcmf_sdiod_regrl(sdiodev, addr, NULL);
  19703. -- if (sdiodev->func[0]->device == SDIO_DEVICE_ID_BROADCOM_4335_4339 &&
  19704. -+ if ((sdiodev->func[0]->device == SDIO_DEVICE_ID_BROADCOM_4335_4339 ||
  19705. -+ sdiodev->func[0]->device == SDIO_DEVICE_ID_BROADCOM_4339) &&
  19706. - addr == CORE_CC_REG(SI_ENUM_BASE, chipid)) {
  19707. - rev = (val & CID_REV_MASK) >> CID_REV_SHIFT;
  19708. - if (rev >= 2) {
  19709. ---- a/include/linux/mmc/sdio_ids.h
  19710. -+++ b/include/linux/mmc/sdio_ids.h
  19711. -@@ -32,6 +32,7 @@
  19712. - #define SDIO_DEVICE_ID_BROADCOM_43340 0xa94c
  19713. - #define SDIO_DEVICE_ID_BROADCOM_43341 0xa94d
  19714. - #define SDIO_DEVICE_ID_BROADCOM_4335_4339 0x4335
  19715. -+#define SDIO_DEVICE_ID_BROADCOM_4339 0x4339
  19716. - #define SDIO_DEVICE_ID_BROADCOM_43362 0xa962
  19717. - #define SDIO_DEVICE_ID_BROADCOM_43430 0xa9a6
  19718. - #define SDIO_DEVICE_ID_BROADCOM_4345 0x4345
  19719. diff --git a/package/kernel/mac80211/patches/351-0038-brcmfmac-sdio-shorten-retry-loop-in-brcmf_sdio_kso_c.patch b/package/kernel/mac80211/patches/351-0038-brcmfmac-sdio-shorten-retry-loop-in-brcmf_sdio_kso_c.patch
  19720. deleted file mode 100644
  19721. index 1d5667e..0000000
  19722. --- a/package/kernel/mac80211/patches/351-0038-brcmfmac-sdio-shorten-retry-loop-in-brcmf_sdio_kso_c.patch
  19723. +++ /dev/null
  19724. @@ -1,56 +0,0 @@
  19725. -From 5251b6be8bb5c5675bdf12347c7b83937a5c91e5 Mon Sep 17 00:00:00 2001
  19726. -From: Arend Van Spriel <arend.vanspriel@broadcom.com>
  19727. -Date: Mon, 5 Sep 2016 11:42:13 +0100
  19728. -Subject: [PATCH] brcmfmac: sdio: shorten retry loop in
  19729. - brcmf_sdio_kso_control()
  19730. -
  19731. -In brcmf_sdio_kso_control() there is a retry loop as hardware may take
  19732. -time to settle. However, when the call to brcmf_sdiod_regrb() returns
  19733. -an error it is due to SDIO access failure and it makes no sense to wait
  19734. -for hardware to settle. This patch aborts the loop after a number of
  19735. -subsequent access errors.
  19736. -
  19737. -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  19738. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  19739. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  19740. -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  19741. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19742. ----
  19743. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 11 +++++++++--
  19744. - 1 file changed, 9 insertions(+), 2 deletions(-)
  19745. -
  19746. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  19747. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  19748. -@@ -313,6 +313,7 @@ struct rte_console {
  19749. -
  19750. - #define KSO_WAIT_US 50
  19751. - #define MAX_KSO_ATTEMPTS (PMU_MAX_TRANSITION_DLY/KSO_WAIT_US)
  19752. -+#define BRCMF_SDIO_MAX_ACCESS_ERRORS 5
  19753. -
  19754. - /*
  19755. - * Conversion of 802.1D priority to precedence level
  19756. -@@ -675,6 +676,7 @@ brcmf_sdio_kso_control(struct brcmf_sdio
  19757. - {
  19758. - u8 wr_val = 0, rd_val, cmp_val, bmask;
  19759. - int err = 0;
  19760. -+ int err_cnt = 0;
  19761. - int try_cnt = 0;
  19762. -
  19763. - brcmf_dbg(TRACE, "Enter: on=%d\n", on);
  19764. -@@ -710,9 +712,14 @@ brcmf_sdio_kso_control(struct brcmf_sdio
  19765. - */
  19766. - rd_val = brcmf_sdiod_regrb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR,
  19767. - &err);
  19768. -- if (((rd_val & bmask) == cmp_val) && !err)
  19769. -+ if (!err) {
  19770. -+ if ((rd_val & bmask) == cmp_val)
  19771. -+ break;
  19772. -+ err_cnt = 0;
  19773. -+ }
  19774. -+ /* bail out upon subsequent access errors */
  19775. -+ if (err && (err_cnt++ > BRCMF_SDIO_MAX_ACCESS_ERRORS))
  19776. - break;
  19777. --
  19778. - udelay(KSO_WAIT_US);
  19779. - brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR,
  19780. - wr_val, &err);
  19781. diff --git a/package/kernel/mac80211/patches/351-0039-brcmfmac-ignore-11d-configuration-errors.patch b/package/kernel/mac80211/patches/351-0039-brcmfmac-ignore-11d-configuration-errors.patch
  19782. deleted file mode 100644
  19783. index 1620e00..0000000
  19784. --- a/package/kernel/mac80211/patches/351-0039-brcmfmac-ignore-11d-configuration-errors.patch
  19785. +++ /dev/null
  19786. @@ -1,84 +0,0 @@
  19787. -From b3589dfe02123a0d0ea82076a9f8ef84a46852c0 Mon Sep 17 00:00:00 2001
  19788. -From: Hante Meuleman <hante.meuleman@broadcom.com>
  19789. -Date: Mon, 19 Sep 2016 12:09:51 +0100
  19790. -Subject: [PATCH] brcmfmac: ignore 11d configuration errors
  19791. -
  19792. -802.11d is not always supported by firmware anymore. Currently the
  19793. -AP configuration of 11d will cause an abort if the ioctl set is
  19794. -failing. This behavior is not correct and the error should be
  19795. -ignored.
  19796. -
  19797. -Reviewed-by: Arend Van Spriel <arend.vanspriel@broadcom.com>
  19798. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  19799. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  19800. -Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
  19801. -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  19802. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19803. ----
  19804. - .../broadcom/brcm80211/brcmfmac/cfg80211.c | 27 ++++++++++++----------
  19805. - 1 file changed, 15 insertions(+), 12 deletions(-)
  19806. -
  19807. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  19808. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  19809. -@@ -4422,6 +4422,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  19810. - u16 chanspec = chandef_to_chanspec(&cfg->d11inf, &settings->chandef);
  19811. - bool mbss;
  19812. - int is_11d;
  19813. -+ bool supports_11d;
  19814. -
  19815. - brcmf_dbg(TRACE, "ctrlchn=%d, center=%d, bw=%d, beacon_interval=%d, dtim_period=%d,\n",
  19816. - settings->chandef.chan->hw_value,
  19817. -@@ -4434,11 +4435,16 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  19818. - mbss = ifp->vif->mbss;
  19819. -
  19820. - /* store current 11d setting */
  19821. -- brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_REGULATORY, &ifp->vif->is_11d);
  19822. -- country_ie = brcmf_parse_tlvs((u8 *)settings->beacon.tail,
  19823. -- settings->beacon.tail_len,
  19824. -- WLAN_EID_COUNTRY);
  19825. -- is_11d = country_ie ? 1 : 0;
  19826. -+ if (brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_REGULATORY,
  19827. -+ &ifp->vif->is_11d)) {
  19828. -+ supports_11d = false;
  19829. -+ } else {
  19830. -+ country_ie = brcmf_parse_tlvs((u8 *)settings->beacon.tail,
  19831. -+ settings->beacon.tail_len,
  19832. -+ WLAN_EID_COUNTRY);
  19833. -+ is_11d = country_ie ? 1 : 0;
  19834. -+ supports_11d = true;
  19835. -+ }
  19836. -
  19837. - memset(&ssid_le, 0, sizeof(ssid_le));
  19838. - if (settings->ssid == NULL || settings->ssid_len == 0) {
  19839. -@@ -4497,7 +4503,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  19840. -
  19841. - /* Parameters shared by all radio interfaces */
  19842. - if (!mbss) {
  19843. -- if (is_11d != ifp->vif->is_11d) {
  19844. -+ if ((supports_11d) && (is_11d != ifp->vif->is_11d)) {
  19845. - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY,
  19846. - is_11d);
  19847. - if (err < 0) {
  19848. -@@ -4539,7 +4545,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  19849. - brcmf_err("SET INFRA error %d\n", err);
  19850. - goto exit;
  19851. - }
  19852. -- } else if (WARN_ON(is_11d != ifp->vif->is_11d)) {
  19853. -+ } else if (WARN_ON(supports_11d && (is_11d != ifp->vif->is_11d))) {
  19854. - /* Multiple-BSS should use same 11d configuration */
  19855. - err = -EINVAL;
  19856. - goto exit;
  19857. -@@ -4673,11 +4679,8 @@ static int brcmf_cfg80211_stop_ap(struct
  19858. - brcmf_err("setting INFRA mode failed %d\n", err);
  19859. - if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS))
  19860. - brcmf_fil_iovar_int_set(ifp, "mbss", 0);
  19861. -- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY,
  19862. -- ifp->vif->is_11d);
  19863. -- if (err < 0)
  19864. -- brcmf_err("restoring REGULATORY setting failed %d\n",
  19865. -- err);
  19866. -+ brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY,
  19867. -+ ifp->vif->is_11d);
  19868. - /* Bring device back up so it can be used again */
  19869. - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1);
  19870. - if (err < 0)
  19871. diff --git a/package/kernel/mac80211/patches/351-0040-brcmfmac-rework-pointer-trickery-in-brcmf_proto_bcdc.patch b/package/kernel/mac80211/patches/351-0040-brcmfmac-rework-pointer-trickery-in-brcmf_proto_bcdc.patch
  19872. deleted file mode 100644
  19873. index 9461164..0000000
  19874. --- a/package/kernel/mac80211/patches/351-0040-brcmfmac-rework-pointer-trickery-in-brcmf_proto_bcdc.patch
  19875. +++ /dev/null
  19876. @@ -1,32 +0,0 @@
  19877. -From 704d1c6b56f4ee2ad6a5f012a72a278d17c1a223 Mon Sep 17 00:00:00 2001
  19878. -From: Arend Van Spriel <arend.vanspriel@broadcom.com>
  19879. -Date: Mon, 19 Sep 2016 12:09:52 +0100
  19880. -Subject: [PATCH] brcmfmac: rework pointer trickery in
  19881. - brcmf_proto_bcdc_query_dcmd()
  19882. -
  19883. -The variable info is assigned to point to bcdc->msg[1], which is the
  19884. -same as pointing to bcdc->buf. As that is what we want to access
  19885. -make it clear by fixing the assignment. This also avoid out-of-bounds
  19886. -errors from static analyzers are bcdc->msg[1] is not in the structure
  19887. -definition.
  19888. -
  19889. -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  19890. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  19891. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  19892. -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  19893. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19894. ----
  19895. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c | 2 +-
  19896. - 1 file changed, 1 insertion(+), 1 deletion(-)
  19897. -
  19898. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
  19899. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
  19900. -@@ -194,7 +194,7 @@ retry:
  19901. - }
  19902. -
  19903. - /* Check info buffer */
  19904. -- info = (void *)&msg[1];
  19905. -+ info = (void *)&bcdc->buf[0];
  19906. -
  19907. - /* Copy info buffer */
  19908. - if (buf) {
  19909. diff --git a/package/kernel/mac80211/patches/351-0041-brcmfmac-fix-memory-leak-in-brcmf_flowring_add_tdls_.patch b/package/kernel/mac80211/patches/351-0041-brcmfmac-fix-memory-leak-in-brcmf_flowring_add_tdls_.patch
  19910. deleted file mode 100644
  19911. index 2ececdf..0000000
  19912. --- a/package/kernel/mac80211/patches/351-0041-brcmfmac-fix-memory-leak-in-brcmf_flowring_add_tdls_.patch
  19913. +++ /dev/null
  19914. @@ -1,39 +0,0 @@
  19915. -From bc981641360183990de59da17f9f560f9150b801 Mon Sep 17 00:00:00 2001
  19916. -From: Arend Van Spriel <arend.vanspriel@broadcom.com>
  19917. -Date: Mon, 19 Sep 2016 12:09:53 +0100
  19918. -Subject: [PATCH] brcmfmac: fix memory leak in brcmf_flowring_add_tdls_peer()
  19919. -
  19920. -In the error paths in brcmf_flowring_add_tdls_peer() the allocated
  19921. -resource should be freed.
  19922. -
  19923. -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  19924. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  19925. -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  19926. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19927. ----
  19928. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c | 8 ++++++--
  19929. - 1 file changed, 6 insertions(+), 2 deletions(-)
  19930. -
  19931. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c
  19932. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c
  19933. -@@ -495,14 +495,18 @@ void brcmf_flowring_add_tdls_peer(struct
  19934. - } else {
  19935. - search = flow->tdls_entry;
  19936. - if (memcmp(search->mac, peer, ETH_ALEN) == 0)
  19937. -- return;
  19938. -+ goto free_entry;
  19939. - while (search->next) {
  19940. - search = search->next;
  19941. - if (memcmp(search->mac, peer, ETH_ALEN) == 0)
  19942. -- return;
  19943. -+ goto free_entry;
  19944. - }
  19945. - search->next = tdls_entry;
  19946. - }
  19947. -
  19948. - flow->tdls_active = true;
  19949. -+ return;
  19950. -+
  19951. -+free_entry:
  19952. -+ kfree(tdls_entry);
  19953. - }
  19954. diff --git a/package/kernel/mac80211/patches/351-0042-brcmfmac-initialize-variable-in-brcmf_sdiod_regrl.patch b/package/kernel/mac80211/patches/351-0042-brcmfmac-initialize-variable-in-brcmf_sdiod_regrl.patch
  19955. deleted file mode 100644
  19956. index 529cc8d..0000000
  19957. --- a/package/kernel/mac80211/patches/351-0042-brcmfmac-initialize-variable-in-brcmf_sdiod_regrl.patch
  19958. +++ /dev/null
  19959. @@ -1,28 +0,0 @@
  19960. -From 26305d3d7298d1ddf8fd4ce95a382aa90534f0a3 Mon Sep 17 00:00:00 2001
  19961. -From: Arend Van Spriel <arend.vanspriel@broadcom.com>
  19962. -Date: Mon, 19 Sep 2016 12:09:54 +0100
  19963. -Subject: [PATCH] brcmfmac: initialize variable in brcmf_sdiod_regrl()
  19964. -
  19965. -In case of an error the variable returned is uninitialized. The caller
  19966. -will probably check the error code before using it, but better assure
  19967. -it is set to zero.
  19968. -
  19969. -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  19970. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  19971. -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  19972. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19973. ----
  19974. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 2 +-
  19975. - 1 file changed, 1 insertion(+), 1 deletion(-)
  19976. -
  19977. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  19978. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  19979. -@@ -416,7 +416,7 @@ u8 brcmf_sdiod_regrb(struct brcmf_sdio_d
  19980. -
  19981. - u32 brcmf_sdiod_regrl(struct brcmf_sdio_dev *sdiodev, u32 addr, int *ret)
  19982. - {
  19983. -- u32 data;
  19984. -+ u32 data = 0;
  19985. - int retval;
  19986. -
  19987. - brcmf_dbg(SDIO, "addr:0x%08x\n", addr);
  19988. diff --git a/package/kernel/mac80211/patches/351-0043-brcmfmac-remove-worker-from-.ndo_set_mac_address-cal.patch b/package/kernel/mac80211/patches/351-0043-brcmfmac-remove-worker-from-.ndo_set_mac_address-cal.patch
  19989. deleted file mode 100644
  19990. index 67af30e..0000000
  19991. --- a/package/kernel/mac80211/patches/351-0043-brcmfmac-remove-worker-from-.ndo_set_mac_address-cal.patch
  19992. +++ /dev/null
  19993. @@ -1,107 +0,0 @@
  19994. -From 8fa5fdec09cd379c9ecb8972f344f8f308e0ccf3 Mon Sep 17 00:00:00 2001
  19995. -From: Arend Van Spriel <arend.vanspriel@broadcom.com>
  19996. -Date: Mon, 19 Sep 2016 12:09:55 +0100
  19997. -Subject: [PATCH] brcmfmac: remove worker from .ndo_set_mac_address() callback
  19998. -
  19999. -As it turns out there is no need to use a worker for the callback
  20000. -because it is not called from atomic context.
  20001. -
  20002. -Reported-by: Dan Williams <dcbw@redhat.com>
  20003. -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  20004. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  20005. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  20006. -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  20007. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  20008. ----
  20009. - .../wireless/broadcom/brcm80211/brcmfmac/core.c | 39 ++++++++--------------
  20010. - .../wireless/broadcom/brcm80211/brcmfmac/core.h | 2 --
  20011. - 2 files changed, 13 insertions(+), 28 deletions(-)
  20012. -
  20013. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  20014. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  20015. -@@ -136,27 +136,6 @@ static void _brcmf_set_multicast_list(st
  20016. - err);
  20017. - }
  20018. -
  20019. --static void
  20020. --_brcmf_set_mac_address(struct work_struct *work)
  20021. --{
  20022. -- struct brcmf_if *ifp;
  20023. -- s32 err;
  20024. --
  20025. -- ifp = container_of(work, struct brcmf_if, setmacaddr_work);
  20026. --
  20027. -- brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx);
  20028. --
  20029. -- err = brcmf_fil_iovar_data_set(ifp, "cur_etheraddr", ifp->mac_addr,
  20030. -- ETH_ALEN);
  20031. -- if (err < 0) {
  20032. -- brcmf_err("Setting cur_etheraddr failed, %d\n", err);
  20033. -- } else {
  20034. -- brcmf_dbg(TRACE, "MAC address updated to %pM\n",
  20035. -- ifp->mac_addr);
  20036. -- memcpy(ifp->ndev->dev_addr, ifp->mac_addr, ETH_ALEN);
  20037. -- }
  20038. --}
  20039. --
  20040. - #if IS_ENABLED(CONFIG_IPV6)
  20041. - static void _brcmf_update_ndtable(struct work_struct *work)
  20042. - {
  20043. -@@ -190,10 +169,20 @@ static int brcmf_netdev_set_mac_address(
  20044. - {
  20045. - struct brcmf_if *ifp = netdev_priv(ndev);
  20046. - struct sockaddr *sa = (struct sockaddr *)addr;
  20047. -+ int err;
  20048. -
  20049. -- memcpy(&ifp->mac_addr, sa->sa_data, ETH_ALEN);
  20050. -- schedule_work(&ifp->setmacaddr_work);
  20051. -- return 0;
  20052. -+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx);
  20053. -+
  20054. -+ err = brcmf_fil_iovar_data_set(ifp, "cur_etheraddr", sa->sa_data,
  20055. -+ ETH_ALEN);
  20056. -+ if (err < 0) {
  20057. -+ brcmf_err("Setting cur_etheraddr failed, %d\n", err);
  20058. -+ } else {
  20059. -+ brcmf_dbg(TRACE, "updated to %pM\n", sa->sa_data);
  20060. -+ memcpy(ifp->mac_addr, sa->sa_data, ETH_ALEN);
  20061. -+ memcpy(ifp->ndev->dev_addr, ifp->mac_addr, ETH_ALEN);
  20062. -+ }
  20063. -+ return err;
  20064. - }
  20065. -
  20066. - static void brcmf_netdev_set_multicast_list(struct net_device *ndev)
  20067. -@@ -525,7 +514,6 @@ int brcmf_net_attach(struct brcmf_if *if
  20068. - /* set the mac address */
  20069. - memcpy(ndev->dev_addr, ifp->mac_addr, ETH_ALEN);
  20070. -
  20071. -- INIT_WORK(&ifp->setmacaddr_work, _brcmf_set_mac_address);
  20072. - INIT_WORK(&ifp->multicast_work, _brcmf_set_multicast_list);
  20073. - INIT_WORK(&ifp->ndoffload_work, _brcmf_update_ndtable);
  20074. -
  20075. -@@ -730,7 +718,6 @@ static void brcmf_del_if(struct brcmf_pu
  20076. - }
  20077. -
  20078. - if (ifp->ndev->netdev_ops == &brcmf_netdev_ops_pri) {
  20079. -- cancel_work_sync(&ifp->setmacaddr_work);
  20080. - cancel_work_sync(&ifp->multicast_work);
  20081. - cancel_work_sync(&ifp->ndoffload_work);
  20082. - }
  20083. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  20084. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  20085. -@@ -176,7 +176,6 @@ enum brcmf_netif_stop_reason {
  20086. - * @vif: points to cfg80211 specific interface information.
  20087. - * @ndev: associated network device.
  20088. - * @stats: interface specific network statistics.
  20089. -- * @setmacaddr_work: worker object for setting mac address.
  20090. - * @multicast_work: worker object for multicast provisioning.
  20091. - * @ndoffload_work: worker object for neighbor discovery offload configuration.
  20092. - * @fws_desc: interface specific firmware-signalling descriptor.
  20093. -@@ -193,7 +192,6 @@ struct brcmf_if {
  20094. - struct brcmf_cfg80211_vif *vif;
  20095. - struct net_device *ndev;
  20096. - struct net_device_stats stats;
  20097. -- struct work_struct setmacaddr_work;
  20098. - struct work_struct multicast_work;
  20099. - struct work_struct ndoffload_work;
  20100. - struct brcmf_fws_mac_descriptor *fws_desc;
  20101. diff --git a/package/kernel/mac80211/patches/351-0044-brcmfmac-remove-unnecessary-null-pointer-check.patch b/package/kernel/mac80211/patches/351-0044-brcmfmac-remove-unnecessary-null-pointer-check.patch
  20102. deleted file mode 100644
  20103. index 5a08479..0000000
  20104. --- a/package/kernel/mac80211/patches/351-0044-brcmfmac-remove-unnecessary-null-pointer-check.patch
  20105. +++ /dev/null
  20106. @@ -1,31 +0,0 @@
  20107. -From 835680b82f029818c813324aed3073cdcf63241f Mon Sep 17 00:00:00 2001
  20108. -From: Hante Meuleman <hante.meuleman@broadcom.com>
  20109. -Date: Mon, 19 Sep 2016 12:09:56 +0100
  20110. -Subject: [PATCH] brcmfmac: remove unnecessary null pointer check
  20111. -
  20112. -in the function brcmf_bus_start() in the exception handling a
  20113. -check is made to dermine whether ifp is null, though this is not
  20114. -possible. Removing the unnessary check.
  20115. -
  20116. -Reviewed-by: Arend Van Spriel <arend.vanspriel@broadcom.com>
  20117. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  20118. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  20119. -Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
  20120. -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  20121. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  20122. ----
  20123. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 3 +--
  20124. - 1 file changed, 1 insertion(+), 2 deletions(-)
  20125. -
  20126. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  20127. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  20128. -@@ -1048,8 +1048,7 @@ fail:
  20129. - brcmf_fws_del_interface(ifp);
  20130. - brcmf_fws_deinit(drvr);
  20131. - }
  20132. -- if (ifp)
  20133. -- brcmf_net_detach(ifp->ndev, false);
  20134. -+ brcmf_net_detach(ifp->ndev, false);
  20135. - if (p2p_ifp)
  20136. - brcmf_net_detach(p2p_ifp->ndev, false);
  20137. - drvr->iflist[0] = NULL;
  20138. diff --git a/package/kernel/mac80211/patches/351-0045-brcmfmac-fix-clearing-entry-IPv6-address.patch b/package/kernel/mac80211/patches/351-0045-brcmfmac-fix-clearing-entry-IPv6-address.patch
  20139. deleted file mode 100644
  20140. index 0b3a23e..0000000
  20141. --- a/package/kernel/mac80211/patches/351-0045-brcmfmac-fix-clearing-entry-IPv6-address.patch
  20142. +++ /dev/null
  20143. @@ -1,37 +0,0 @@
  20144. -From 2b7425f3629b38c438f890c20c5faeca64b144ff Mon Sep 17 00:00:00 2001
  20145. -From: Hante Meuleman <hante.meuleman@broadcom.com>
  20146. -Date: Mon, 19 Sep 2016 12:09:57 +0100
  20147. -Subject: [PATCH] brcmfmac: fix clearing entry IPv6 address
  20148. -
  20149. -When IPv6 address is to be cleared there is a possible out of
  20150. -bound access. But also the clearing of the last entry and the
  20151. -adjustment of total number of stored IPv6 addresses is not
  20152. -updated. This patch fixes that bug. Bug was found using coverity.
  20153. -
  20154. -Reviewed-by: Arend Van Spriel <arend.vanspriel@broadcom.com>
  20155. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  20156. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  20157. -Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
  20158. -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  20159. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  20160. ----
  20161. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 7 +++++--
  20162. - 1 file changed, 5 insertions(+), 2 deletions(-)
  20163. -
  20164. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  20165. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  20166. -@@ -873,9 +873,12 @@ static int brcmf_inet6addr_changed(struc
  20167. - }
  20168. - break;
  20169. - case NETDEV_DOWN:
  20170. -- if (i < NDOL_MAX_ENTRIES)
  20171. -- for (; i < ifp->ipv6addr_idx; i++)
  20172. -+ if (i < NDOL_MAX_ENTRIES) {
  20173. -+ for (; i < ifp->ipv6addr_idx - 1; i++)
  20174. - table[i] = table[i + 1];
  20175. -+ memset(&table[i], 0, sizeof(table[i]));
  20176. -+ ifp->ipv6addr_idx--;
  20177. -+ }
  20178. - break;
  20179. - default:
  20180. - break;
  20181. diff --git a/package/kernel/mac80211/patches/351-0046-brcmfmac-fix-out-of-bound-access-on-clearing-wowl-wa.patch b/package/kernel/mac80211/patches/351-0046-brcmfmac-fix-out-of-bound-access-on-clearing-wowl-wa.patch
  20182. deleted file mode 100644
  20183. index a47cb32..0000000
  20184. --- a/package/kernel/mac80211/patches/351-0046-brcmfmac-fix-out-of-bound-access-on-clearing-wowl-wa.patch
  20185. +++ /dev/null
  20186. @@ -1,44 +0,0 @@
  20187. -From a7ed7828ecda0c2b5e0d7f55dedd4230afd4b583 Mon Sep 17 00:00:00 2001
  20188. -From: Hante Meuleman <hante.meuleman@broadcom.com>
  20189. -Date: Mon, 19 Sep 2016 12:09:58 +0100
  20190. -Subject: [PATCH] brcmfmac: fix out of bound access on clearing wowl wake
  20191. - indicator
  20192. -
  20193. -Clearing the wowl wakeindicator happens with a rather odd
  20194. -construction where the string "clear" is used to set the iovar
  20195. -wowl_wakeind. This was implemented incorrectly as it caused an
  20196. -out of bound access. Use an intermediate variable of correct
  20197. -length and copy string in that. Problem was found using coverity.
  20198. -
  20199. -Reviewed-by: Arend Van Spriel <arend.vanspriel@broadcom.com>
  20200. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  20201. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  20202. -Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
  20203. -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  20204. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  20205. ----
  20206. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 6 ++++--
  20207. - 1 file changed, 4 insertions(+), 2 deletions(-)
  20208. -
  20209. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  20210. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  20211. -@@ -3623,6 +3623,7 @@ static void brcmf_configure_wowl(struct
  20212. - struct cfg80211_wowlan *wowl)
  20213. - {
  20214. - u32 wowl_config;
  20215. -+ struct brcmf_wowl_wakeind_le wowl_wakeind;
  20216. - u32 i;
  20217. -
  20218. - brcmf_dbg(TRACE, "Suspend, wowl config.\n");
  20219. -@@ -3664,8 +3665,9 @@ static void brcmf_configure_wowl(struct
  20220. - if (!test_bit(BRCMF_VIF_STATUS_CONNECTED, &ifp->vif->sme_state))
  20221. - wowl_config |= BRCMF_WOWL_UNASSOC;
  20222. -
  20223. -- brcmf_fil_iovar_data_set(ifp, "wowl_wakeind", "clear",
  20224. -- sizeof(struct brcmf_wowl_wakeind_le));
  20225. -+ memcpy(&wowl_wakeind, "clear", 6);
  20226. -+ brcmf_fil_iovar_data_set(ifp, "wowl_wakeind", &wowl_wakeind,
  20227. -+ sizeof(wowl_wakeind));
  20228. - brcmf_fil_iovar_int_set(ifp, "wowl", wowl_config);
  20229. - brcmf_fil_iovar_int_set(ifp, "wowl_activate", 1);
  20230. - brcmf_bus_wowl_config(cfg->pub->bus_if, true);
  20231. diff --git a/package/kernel/mac80211/patches/351-0047-brcmfmac-simplify-mapping-of-auth-type.patch b/package/kernel/mac80211/patches/351-0047-brcmfmac-simplify-mapping-of-auth-type.patch
  20232. deleted file mode 100644
  20233. index a652ae6..0000000
  20234. --- a/package/kernel/mac80211/patches/351-0047-brcmfmac-simplify-mapping-of-auth-type.patch
  20235. +++ /dev/null
  20236. @@ -1,39 +0,0 @@
  20237. -From 92c313604711a0976def79dabb9e8da3cc2cc780 Mon Sep 17 00:00:00 2001
  20238. -From: Hante Meuleman <hante.meuleman@broadcom.com>
  20239. -Date: Mon, 19 Sep 2016 12:09:59 +0100
  20240. -Subject: [PATCH] brcmfmac: simplify mapping of auth type
  20241. -
  20242. -The 802.11 standard only has four valid auth type configurations of which
  20243. -our firmware only supports two, ie. Open System and Shared Key. Simplify
  20244. -the mapping falling back to automatic for other types specified by
  20245. -user-space.
  20246. -
  20247. -Reviewed-by: Arend Van Spriel <arend.vanspriel@broadcom.com>
  20248. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  20249. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  20250. -Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
  20251. -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  20252. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  20253. ----
  20254. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 8 +-------
  20255. - 1 file changed, 1 insertion(+), 7 deletions(-)
  20256. -
  20257. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  20258. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  20259. -@@ -1577,15 +1577,9 @@ static s32 brcmf_set_auth_type(struct ne
  20260. - val = 1;
  20261. - brcmf_dbg(CONN, "shared key\n");
  20262. - break;
  20263. -- case NL80211_AUTHTYPE_AUTOMATIC:
  20264. -- val = 2;
  20265. -- brcmf_dbg(CONN, "automatic\n");
  20266. -- break;
  20267. -- case NL80211_AUTHTYPE_NETWORK_EAP:
  20268. -- brcmf_dbg(CONN, "network eap\n");
  20269. - default:
  20270. - val = 2;
  20271. -- brcmf_err("invalid auth type (%d)\n", sme->auth_type);
  20272. -+ brcmf_dbg(CONN, "automatic, auth type (%d)\n", sme->auth_type);
  20273. - break;
  20274. - }
  20275. -
  20276. diff --git a/package/kernel/mac80211/patches/351-0048-brcmfmac-fix-memory-leak-in-brcmf_fill_bss_param.patch b/package/kernel/mac80211/patches/351-0048-brcmfmac-fix-memory-leak-in-brcmf_fill_bss_param.patch
  20277. deleted file mode 100644
  20278. index a6fae37..0000000
  20279. --- a/package/kernel/mac80211/patches/351-0048-brcmfmac-fix-memory-leak-in-brcmf_fill_bss_param.patch
  20280. +++ /dev/null
  20281. @@ -1,41 +0,0 @@
  20282. -From 23e9c128adb2038c27a424a5f91136e7fa3e0dc6 Mon Sep 17 00:00:00 2001
  20283. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
  20284. -Date: Wed, 21 Sep 2016 08:23:24 +0200
  20285. -Subject: [PATCH] brcmfmac: fix memory leak in brcmf_fill_bss_param
  20286. -MIME-Version: 1.0
  20287. -Content-Type: text/plain; charset=UTF-8
  20288. -Content-Transfer-Encoding: 8bit
  20289. -
  20290. -This function is called from get_station callback which means that every
  20291. -time user space was getting/dumping station(s) we were leaking 2 KiB.
  20292. -
  20293. -Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
  20294. -Fixes: 1f0dc59a6de ("brcmfmac: rework .get_station() callback")
  20295. -Cc: stable@vger.kernel.org # 4.2+
  20296. -Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  20297. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  20298. ----
  20299. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 5 ++++-
  20300. - 1 file changed, 4 insertions(+), 1 deletion(-)
  20301. -
  20302. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  20303. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  20304. -@@ -2463,7 +2463,7 @@ static void brcmf_fill_bss_param(struct
  20305. - WL_BSS_INFO_MAX);
  20306. - if (err) {
  20307. - brcmf_err("Failed to get bss info (%d)\n", err);
  20308. -- return;
  20309. -+ goto out_kfree;
  20310. - }
  20311. - si->filled |= BIT(NL80211_STA_INFO_BSS_PARAM);
  20312. - si->bss_param.beacon_interval = le16_to_cpu(buf->bss_le.beacon_period);
  20313. -@@ -2475,6 +2475,9 @@ static void brcmf_fill_bss_param(struct
  20314. - si->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_PREAMBLE;
  20315. - if (capability & WLAN_CAPABILITY_SHORT_SLOT_TIME)
  20316. - si->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_SLOT_TIME;
  20317. -+
  20318. -+out_kfree:
  20319. -+ kfree(buf);
  20320. - }
  20321. -
  20322. - static s32
  20323. diff --git a/package/kernel/mac80211/patches/351-0049-brcmfmac-drop-unused-fields-from-struct-brcmf_pub.patch b/package/kernel/mac80211/patches/351-0049-brcmfmac-drop-unused-fields-from-struct-brcmf_pub.patch
  20324. deleted file mode 100644
  20325. index 47af73a..0000000
  20326. --- a/package/kernel/mac80211/patches/351-0049-brcmfmac-drop-unused-fields-from-struct-brcmf_pub.patch
  20327. +++ /dev/null
  20328. @@ -1,60 +0,0 @@
  20329. -From 2df86ad959c9d1cdbeb2f23a0801857731156692 Mon Sep 17 00:00:00 2001
  20330. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
  20331. -Date: Fri, 23 Sep 2016 15:27:46 +0200
  20332. -Subject: [PATCH] brcmfmac: drop unused fields from struct brcmf_pub
  20333. -MIME-Version: 1.0
  20334. -Content-Type: text/plain; charset=UTF-8
  20335. -Content-Transfer-Encoding: 8bit
  20336. -
  20337. -They seem to be there from the first day. We calculate these values but
  20338. -never use them.
  20339. -
  20340. -Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
  20341. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  20342. ----
  20343. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 3 ---
  20344. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h | 4 ----
  20345. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c | 2 --
  20346. - 3 files changed, 9 deletions(-)
  20347. -
  20348. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  20349. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  20350. -@@ -508,9 +508,6 @@ int brcmf_net_attach(struct brcmf_if *if
  20351. - ndev->hard_header_len += drvr->hdrlen;
  20352. - ndev->ethtool_ops = &brcmf_ethtool_ops;
  20353. -
  20354. -- drvr->rxsz = ndev->mtu + ndev->hard_header_len +
  20355. -- drvr->hdrlen;
  20356. --
  20357. - /* set the mac address */
  20358. - memcpy(ndev->dev_addr, ifp->mac_addr, ETH_ALEN);
  20359. -
  20360. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  20361. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  20362. -@@ -112,15 +112,11 @@ struct brcmf_pub {
  20363. -
  20364. - /* Internal brcmf items */
  20365. - uint hdrlen; /* Total BRCMF header length (proto + bus) */
  20366. -- uint rxsz; /* Rx buffer size bus module should use */
  20367. -
  20368. - /* Dongle media info */
  20369. - char fwver[BRCMF_DRIVER_FIRMWARE_VERSION_LEN];
  20370. - u8 mac[ETH_ALEN]; /* MAC address obtained from dongle */
  20371. -
  20372. -- /* Multicast data packets sent to dongle */
  20373. -- unsigned long tx_multicast;
  20374. --
  20375. - struct mac_address addresses[BRCMF_MAX_IFS];
  20376. -
  20377. - struct brcmf_if *iflist[BRCMF_MAX_IFS];
  20378. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
  20379. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
  20380. -@@ -2104,8 +2104,6 @@ int brcmf_fws_process_skb(struct brcmf_i
  20381. - if (!skb->priority)
  20382. - skb->priority = cfg80211_classify8021d(skb, NULL);
  20383. -
  20384. -- drvr->tx_multicast += !!multicast;
  20385. --
  20386. - if (fws->avoid_queueing) {
  20387. - rc = brcmf_proto_txdata(drvr, ifp->ifidx, 0, skb);
  20388. - if (rc < 0)
  20389. diff --git a/package/kernel/mac80211/patches/351-0050-brcmfmac-replace-WARNING-on-timeout-with-a-simple-er.patch b/package/kernel/mac80211/patches/351-0050-brcmfmac-replace-WARNING-on-timeout-with-a-simple-er.patch
  20390. deleted file mode 100644
  20391. index ca4863a..0000000
  20392. --- a/package/kernel/mac80211/patches/351-0050-brcmfmac-replace-WARNING-on-timeout-with-a-simple-er.patch
  20393. +++ /dev/null
  20394. @@ -1,38 +0,0 @@
  20395. -From 2f0e56fa37cce60a5ac5d451bcadec51cd711436 Mon Sep 17 00:00:00 2001
  20396. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
  20397. -Date: Tue, 27 Sep 2016 12:12:24 +0200
  20398. -Subject: [PATCH] brcmfmac: replace WARNING on timeout with a simple error
  20399. - message
  20400. -MIME-Version: 1.0
  20401. -Content-Type: text/plain; charset=UTF-8
  20402. -Content-Transfer-Encoding: 8bit
  20403. -
  20404. -Even with timeout increased to 950 ms we get WARNINGs from time to time.
  20405. -It mostly happens on A-MPDU stalls (e.g. when station goes out of
  20406. -range). It may take up to 5-10 secods for the firmware to recover and
  20407. -for that time it doesn't process packets.
  20408. -
  20409. -It's still useful to have a message on time out as it may indicate some
  20410. -firmware problem and incorrect key update. Raising a WARNING however
  20411. -wasn't really that necessary, it doesn't point to any driver bug anymore
  20412. -and backtrace wasn't much useful.
  20413. -
  20414. -Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
  20415. -Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  20416. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  20417. ----
  20418. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 3 ++-
  20419. - 1 file changed, 2 insertions(+), 1 deletion(-)
  20420. -
  20421. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  20422. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  20423. -@@ -1155,7 +1155,8 @@ int brcmf_netdev_wait_pend8021x(struct b
  20424. - !brcmf_get_pend_8021x_cnt(ifp),
  20425. - MAX_WAIT_FOR_8021X_TX);
  20426. -
  20427. -- WARN_ON(!err);
  20428. -+ if (!err)
  20429. -+ brcmf_err("Timed out waiting for no pending 802.1x packets\n");
  20430. -
  20431. - return !err;
  20432. - }
  20433. diff --git a/package/kernel/mac80211/patches/351-0051-brcmfmac-use-correct-skb-freeing-helper-when-deletin.patch b/package/kernel/mac80211/patches/351-0051-brcmfmac-use-correct-skb-freeing-helper-when-deletin.patch
  20434. deleted file mode 100644
  20435. index 6976359..0000000
  20436. --- a/package/kernel/mac80211/patches/351-0051-brcmfmac-use-correct-skb-freeing-helper-when-deletin.patch
  20437. +++ /dev/null
  20438. @@ -1,58 +0,0 @@
  20439. -From 7f00ee2bbc630900ba16fc2690473f3e2db0e264 Mon Sep 17 00:00:00 2001
  20440. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
  20441. -Date: Tue, 27 Sep 2016 14:11:04 +0200
  20442. -Subject: [PATCH] brcmfmac: use correct skb freeing helper when deleting
  20443. - flowring
  20444. -MIME-Version: 1.0
  20445. -Content-Type: text/plain; charset=UTF-8
  20446. -Content-Transfer-Encoding: 8bit
  20447. -
  20448. -Flowrings contain skbs waiting for transmission that were passed to us
  20449. -by netif. It means we checked every one of them looking for 802.1x
  20450. -Ethernet type. When deleting flowring we have to use freeing function
  20451. -that will check for 802.1x type as well.
  20452. -
  20453. -Freeing skbs without a proper check was leading to counter not being
  20454. -properly decreased. This was triggering a WARNING every time
  20455. -brcmf_netdev_wait_pend8021x was called.
  20456. -
  20457. -Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
  20458. -Acked-by: Arend van Spriel <arend@broadcom.com>
  20459. -Cc: stable@vger.kernel.org # 4.5+
  20460. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  20461. ----
  20462. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c | 9 ++++++++-
  20463. - 1 file changed, 8 insertions(+), 1 deletion(-)
  20464. -
  20465. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c
  20466. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c
  20467. -@@ -234,13 +234,20 @@ static void brcmf_flowring_block(struct
  20468. -
  20469. - void brcmf_flowring_delete(struct brcmf_flowring *flow, u16 flowid)
  20470. - {
  20471. -+ struct brcmf_bus *bus_if = dev_get_drvdata(flow->dev);
  20472. - struct brcmf_flowring_ring *ring;
  20473. -+ struct brcmf_if *ifp;
  20474. - u16 hash_idx;
  20475. -+ u8 ifidx;
  20476. - struct sk_buff *skb;
  20477. -
  20478. - ring = flow->rings[flowid];
  20479. - if (!ring)
  20480. - return;
  20481. -+
  20482. -+ ifidx = brcmf_flowring_ifidx_get(flow, flowid);
  20483. -+ ifp = brcmf_get_ifp(bus_if->drvr, ifidx);
  20484. -+
  20485. - brcmf_flowring_block(flow, flowid, false);
  20486. - hash_idx = ring->hash_id;
  20487. - flow->hash[hash_idx].ifidx = BRCMF_FLOWRING_INVALID_IFIDX;
  20488. -@@ -249,7 +256,7 @@ void brcmf_flowring_delete(struct brcmf_
  20489. -
  20490. - skb = skb_dequeue(&ring->skblist);
  20491. - while (skb) {
  20492. -- brcmu_pkt_buf_free_skb(skb);
  20493. -+ brcmf_txfinalize(ifp, skb, false);
  20494. - skb = skb_dequeue(&ring->skblist);
  20495. - }
  20496. -
  20497. diff --git a/package/kernel/mac80211/patches/402-ath_regd_optional.patch b/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  20498. index 7351353..4634283 100644
  20499. --- a/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  20500. +++ b/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  20501. @@ -8,7 +8,7 @@
  20502. + return;
  20503. +#endif
  20504. +
  20505. - for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
  20506. + for (band = 0; band < NUM_NL80211_BANDS; band++) {
  20507. if (!wiphy->bands[band])
  20508. continue;
  20509. @@ -374,6 +378,10 @@ ath_reg_apply_ir_flags(struct wiphy *wip
  20510. @@ -19,7 +19,7 @@
  20511. + return;
  20512. +#endif
  20513. +
  20514. - sband = wiphy->bands[IEEE80211_BAND_2GHZ];
  20515. + sband = wiphy->bands[NL80211_BAND_2GHZ];
  20516. if (!sband)
  20517. return;
  20518. @@ -402,6 +410,10 @@ static void ath_reg_apply_radar_flags(st
  20519. @@ -30,7 +30,7 @@
  20520. + return;
  20521. +#endif
  20522. +
  20523. - if (!wiphy->bands[IEEE80211_BAND_5GHZ])
  20524. + if (!wiphy->bands[NL80211_BAND_5GHZ])
  20525. return;
  20526. @@ -633,6 +645,11 @@ ath_regd_init_wiphy(struct ath_regulator
  20527. @@ -59,7 +59,7 @@
  20528. ---help---
  20529. --- a/.local-symbols
  20530. +++ b/.local-symbols
  20531. -@@ -125,6 +125,7 @@ ADM8211=
  20532. +@@ -127,6 +127,7 @@ ADM8211=
  20533. ATH_COMMON=
  20534. WLAN_VENDOR_ATH=
  20535. ATH_DEBUG=
  20536. 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
  20537. index 1a62484..f2f52f9 100644
  20538. --- a/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch
  20539. +++ b/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch
  20540. @@ -1,6 +1,6 @@
  20541. --- a/drivers/net/wireless/ath/ath9k/init.c
  20542. +++ b/drivers/net/wireless/ath/ath9k/init.c
  20543. -@@ -722,6 +722,7 @@ static const struct ieee80211_iface_limi
  20544. +@@ -727,6 +727,7 @@ static const struct ieee80211_iface_limi
  20545. BIT(NL80211_IFTYPE_AP) },
  20546. { .max = 1, .types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  20547. BIT(NL80211_IFTYPE_P2P_GO) },
  20548. diff --git a/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch b/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch
  20549. index a7f9d9f..f21eed1 100644
  20550. --- a/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch
  20551. +++ b/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch
  20552. @@ -1,6 +1,6 @@
  20553. --- a/drivers/net/wireless/ath/ath9k/debug.c
  20554. +++ b/drivers/net/wireless/ath/ath9k/debug.c
  20555. -@@ -1301,6 +1301,53 @@ void ath9k_deinit_debug(struct ath_softc
  20556. +@@ -1315,6 +1315,53 @@ void ath9k_deinit_debug(struct ath_softc
  20557. ath9k_cmn_spectral_deinit_debug(&sc->spec_priv);
  20558. }
  20559. @@ -54,7 +54,7 @@
  20560. int ath9k_init_debug(struct ath_hw *ah)
  20561. {
  20562. struct ath_common *common = ath9k_hw_common(ah);
  20563. -@@ -1320,6 +1367,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  20564. +@@ -1334,6 +1381,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  20565. ath9k_tx99_init_debug(sc);
  20566. ath9k_cmn_spectral_init_debug(&sc->spec_priv, sc->debug.debugfs_phy);
  20567. diff --git a/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch b/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch
  20568. index 5892c3e..1825d77 100644
  20569. --- a/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch
  20570. +++ b/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch
  20571. @@ -1,6 +1,6 @@
  20572. --- a/drivers/net/wireless/ath/ath9k/init.c
  20573. +++ b/drivers/net/wireless/ath/ath9k/init.c
  20574. -@@ -1024,23 +1024,23 @@ static int __init ath9k_init(void)
  20575. +@@ -1030,23 +1030,23 @@ static int __init ath9k_init(void)
  20576. {
  20577. int error;
  20578. diff --git a/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch b/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch
  20579. index 6766111..15b8d7b 100644
  20580. --- a/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch
  20581. +++ b/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch
  20582. @@ -8,4 +8,4 @@
  20583. +#define ATH_RXBUF 256
  20584. #define ATH_TXBUF 512
  20585. #define ATH_TXBUF_RESERVE 5
  20586. - #define ATH_MAX_QDEPTH (ATH_TXBUF / 4 - ATH_TXBUF_RESERVE)
  20587. + #define ATH_TXMAXTRY 13
  20588. diff --git a/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch b/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch
  20589. index 5ecf528..c98072b 100644
  20590. --- a/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch
  20591. +++ b/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch
  20592. @@ -1,6 +1,6 @@
  20593. --- a/drivers/net/wireless/ath/ath9k/debug.c
  20594. +++ b/drivers/net/wireless/ath/ath9k/debug.c
  20595. -@@ -1348,6 +1348,52 @@ static const struct file_operations fops
  20596. +@@ -1362,6 +1362,52 @@ static const struct file_operations fops
  20597. .owner = THIS_MODULE
  20598. };
  20599. @@ -53,7 +53,7 @@
  20600. int ath9k_init_debug(struct ath_hw *ah)
  20601. {
  20602. struct ath_common *common = ath9k_hw_common(ah);
  20603. -@@ -1369,6 +1415,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  20604. +@@ -1383,6 +1429,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  20605. debugfs_create_file("eeprom", S_IRUSR, sc->debug.debugfs_phy, sc,
  20606. &fops_eeprom);
  20607. @@ -90,7 +90,7 @@
  20608. ichan->channel = chan->center_freq;
  20609. ichan->chan = chan;
  20610. @@ -308,7 +310,19 @@ static void ath9k_cmn_update_ichannel(st
  20611. - if (chan->band == IEEE80211_BAND_5GHZ)
  20612. + if (chan->band == NL80211_BAND_5GHZ)
  20613. flags |= CHANNEL_5GHZ;
  20614. - switch (chandef->width) {
  20615. diff --git a/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch b/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
  20616. index c84d1bc..167eeff 100644
  20617. --- a/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
  20618. +++ b/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
  20619. @@ -20,7 +20,7 @@
  20620. #define AR9160_DEVID_PCI 0x0027
  20621. --- a/drivers/net/wireless/ath/ath9k/pci.c
  20622. +++ b/drivers/net/wireless/ath/ath9k/pci.c
  20623. -@@ -751,6 +751,7 @@ static const struct pci_device_id ath_pc
  20624. +@@ -761,6 +761,7 @@ static const struct pci_device_id ath_pc
  20625. .driver_data = ATH9K_PCI_BT_ANT_DIV },
  20626. #endif
  20627. diff --git a/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
  20628. index e151a12..c40598d 100644
  20629. --- a/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
  20630. +++ b/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
  20631. @@ -1,6 +1,6 @@
  20632. --- a/include/net/cfg80211.h
  20633. +++ b/include/net/cfg80211.h
  20634. -@@ -2363,6 +2363,7 @@ struct cfg80211_qos_map {
  20635. +@@ -2410,6 +2410,7 @@ struct cfg80211_qos_map {
  20636. * (as advertised by the nl80211 feature flag.)
  20637. * @get_tx_power: store the current TX power into the dbm variable;
  20638. * return 0 if successful
  20639. @@ -8,7 +8,7 @@
  20640. *
  20641. * @set_wds_peer: set the WDS peer for a WDS interface
  20642. *
  20643. -@@ -2624,6 +2625,7 @@ struct cfg80211_ops {
  20644. +@@ -2671,6 +2672,7 @@ struct cfg80211_ops {
  20645. enum nl80211_tx_power_setting type, int mbm);
  20646. int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
  20647. int *dbm);
  20648. @@ -18,7 +18,7 @@
  20649. const u8 *addr);
  20650. --- a/include/net/mac80211.h
  20651. +++ b/include/net/mac80211.h
  20652. -@@ -1286,6 +1286,7 @@ enum ieee80211_smps_mode {
  20653. +@@ -1317,6 +1317,7 @@ enum ieee80211_smps_mode {
  20654. *
  20655. * @power_level: requested transmit power (in dBm), backward compatibility
  20656. * value only that is set to the minimum of all interfaces
  20657. @@ -26,7 +26,7 @@
  20658. *
  20659. * @chandef: the channel definition to tune to
  20660. * @radar_enabled: whether radar detection is enabled
  20661. -@@ -1306,6 +1307,7 @@ enum ieee80211_smps_mode {
  20662. +@@ -1337,6 +1338,7 @@ enum ieee80211_smps_mode {
  20663. struct ieee80211_conf {
  20664. u32 flags;
  20665. int power_level, dynamic_ps_timeout;
  20666. @@ -36,9 +36,9 @@
  20667. u8 ps_dtim_period;
  20668. --- a/include/uapi/linux/nl80211.h
  20669. +++ b/include/uapi/linux/nl80211.h
  20670. -@@ -1790,6 +1790,9 @@ enum nl80211_commands {
  20671. - * between scans. The scan plans are executed sequentially.
  20672. - * Each scan plan is a nested attribute of &enum nl80211_sched_scan_plan.
  20673. +@@ -1829,6 +1829,9 @@ enum nl80211_commands {
  20674. + * %NL80211_ATTR_EXT_CAPA_MASK, to specify the extended capabilities per
  20675. + * interface type.
  20676. *
  20677. + * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce
  20678. + * transmit power to stay within regulatory limits. u32, dBi.
  20679. @@ -46,9 +46,9 @@
  20680. * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  20681. * @NL80211_ATTR_MAX: highest attribute number currently defined
  20682. * @__NL80211_ATTR_AFTER_LAST: internal use
  20683. -@@ -2164,6 +2167,8 @@ enum nl80211_attrs {
  20684. - NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS,
  20685. - NL80211_ATTR_SCHED_SCAN_PLANS,
  20686. +@@ -2213,6 +2216,8 @@ enum nl80211_attrs {
  20687. +
  20688. + NL80211_ATTR_IFTYPE_EXT_CAPA,
  20689. + NL80211_ATTR_WIPHY_ANTENNA_GAIN,
  20690. +
  20691. @@ -57,7 +57,7 @@
  20692. __NL80211_ATTR_AFTER_LAST,
  20693. --- a/net/mac80211/cfg.c
  20694. +++ b/net/mac80211/cfg.c
  20695. -@@ -2229,6 +2229,19 @@ static int ieee80211_get_tx_power(struct
  20696. +@@ -2238,6 +2238,19 @@ static int ieee80211_get_tx_power(struct
  20697. return 0;
  20698. }
  20699. @@ -77,7 +77,7 @@
  20700. static int ieee80211_set_wds_peer(struct wiphy *wiphy, struct net_device *dev,
  20701. const u8 *addr)
  20702. {
  20703. -@@ -3403,6 +3416,7 @@ const struct cfg80211_ops mac80211_confi
  20704. +@@ -3412,6 +3425,7 @@ const struct cfg80211_ops mac80211_confi
  20705. .set_wiphy_params = ieee80211_set_wiphy_params,
  20706. .set_tx_power = ieee80211_set_tx_power,
  20707. .get_tx_power = ieee80211_get_tx_power,
  20708. @@ -87,7 +87,7 @@
  20709. CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd)
  20710. --- a/net/mac80211/ieee80211_i.h
  20711. +++ b/net/mac80211/ieee80211_i.h
  20712. -@@ -1318,6 +1318,7 @@ struct ieee80211_local {
  20713. +@@ -1338,6 +1338,7 @@ struct ieee80211_local {
  20714. int dynamic_ps_forced_timeout;
  20715. int user_power_level; /* in dBm, for all interfaces */
  20716. @@ -119,7 +119,7 @@
  20717. if (local->hw.conf.power_level != power) {
  20718. changed |= IEEE80211_CONF_CHANGE_POWER;
  20719. local->hw.conf.power_level = power;
  20720. -@@ -586,6 +592,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
  20721. +@@ -588,6 +594,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
  20722. IEEE80211_RADIOTAP_MCS_HAVE_BW;
  20723. local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI |
  20724. IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH;
  20725. @@ -129,15 +129,15 @@
  20726. local->user_power_level = IEEE80211_UNSET_POWER_LEVEL;
  20727. --- a/net/wireless/nl80211.c
  20728. +++ b/net/wireless/nl80211.c
  20729. -@@ -403,6 +403,7 @@ static const struct nla_policy nl80211_p
  20730. - [NL80211_ATTR_NETNS_FD] = { .type = NLA_U32 },
  20731. - [NL80211_ATTR_SCHED_SCAN_DELAY] = { .type = NLA_U32 },
  20732. - [NL80211_ATTR_REG_INDOOR] = { .type = NLA_FLAG },
  20733. +@@ -407,6 +407,7 @@ static const struct nla_policy nl80211_p
  20734. + [NL80211_ATTR_PBSS] = { .type = NLA_FLAG },
  20735. + [NL80211_ATTR_BSS_SELECT] = { .type = NLA_NESTED },
  20736. + [NL80211_ATTR_STA_SUPPORT_P2P_PS] = { .type = NLA_U8 },
  20737. + [NL80211_ATTR_WIPHY_ANTENNA_GAIN] = { .type = NLA_U32 },
  20738. };
  20739. /* policy for the key attributes */
  20740. -@@ -2220,6 +2221,20 @@ static int nl80211_set_wiphy(struct sk_b
  20741. +@@ -2294,6 +2295,20 @@ static int nl80211_set_wiphy(struct sk_b
  20742. if (result)
  20743. return result;
  20744. }
  20745. diff --git a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  20746. index 5a5e464..69147f6 100644
  20747. --- a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  20748. +++ b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  20749. @@ -1,16 +1,16 @@
  20750. --- a/drivers/net/wireless/ath/ath9k/ath9k.h
  20751. +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  20752. -@@ -814,6 +814,9 @@ static inline int ath9k_dump_btcoex(stru
  20753. +@@ -827,6 +827,9 @@ static inline int ath9k_dump_btcoex(stru
  20754. + #ifdef CPTCFG_MAC80211_LEDS
  20755. void ath_init_leds(struct ath_softc *sc);
  20756. void ath_deinit_leds(struct ath_softc *sc);
  20757. - void ath_fill_led_pin(struct ath_softc *sc);
  20758. +int ath_create_gpio_led(struct ath_softc *sc, int gpio, const char *name,
  20759. -+ const char *trigger, bool active_low);
  20760. ++ const char *trigger, bool active_low);
  20761. +
  20762. #else
  20763. static inline void ath_init_leds(struct ath_softc *sc)
  20764. {
  20765. -@@ -953,6 +956,13 @@ void ath_ant_comb_scan(struct ath_softc
  20766. +@@ -963,6 +966,13 @@ void ath_ant_comb_scan(struct ath_softc
  20767. #define ATH9K_NUM_CHANCTX 2 /* supports 2 operating channels */
  20768. @@ -24,7 +24,7 @@
  20769. struct ath_softc {
  20770. struct ieee80211_hw *hw;
  20771. struct device *dev;
  20772. -@@ -1005,9 +1015,8 @@ struct ath_softc {
  20773. +@@ -1015,9 +1025,8 @@ struct ath_softc {
  20774. spinlock_t chan_lock;
  20775. #ifdef CPTCFG_MAC80211_LEDS
  20776. @@ -38,24 +38,33 @@
  20777. #ifdef CPTCFG_ATH9K_DEBUGFS
  20778. --- a/drivers/net/wireless/ath/ath9k/gpio.c
  20779. +++ b/drivers/net/wireless/ath/ath9k/gpio.c
  20780. -@@ -24,45 +24,102 @@
  20781. - static void ath_led_brightness(struct led_classdev *led_cdev,
  20782. - enum led_brightness brightness)
  20783. +@@ -22,7 +22,7 @@
  20784. +
  20785. + #ifdef CPTCFG_MAC80211_LEDS
  20786. +
  20787. +-void ath_fill_led_pin(struct ath_softc *sc)
  20788. ++static void ath_fill_led_pin(struct ath_softc *sc)
  20789. {
  20790. -- struct ath_softc *sc = container_of(led_cdev, struct ath_softc, led_cdev);
  20791. -- u32 val = (brightness == LED_OFF);
  20792. + struct ath_hw *ah = sc->sc_ah;
  20793. +
  20794. +@@ -39,61 +39,111 @@ void ath_fill_led_pin(struct ath_softc *
  20795. + else
  20796. + ah->led_pin = ATH_LED_PIN_DEF;
  20797. + }
  20798. ++}
  20799. ++
  20800. ++static void ath_led_brightness(struct led_classdev *led_cdev,
  20801. ++ enum led_brightness brightness)
  20802. ++{
  20803. + struct ath_led *led = container_of(led_cdev, struct ath_led, cdev);
  20804. + struct ath_softc *sc = led->sc;
  20805. -
  20806. -- if (sc->sc_ah->config.led_active_high)
  20807. -- val = !val;
  20808. ++
  20809. + ath9k_ps_wakeup(sc);
  20810. + ath9k_hw_set_gpio(sc->sc_ah, led->gpio->gpio,
  20811. + (brightness != LED_OFF) ^ led->gpio->active_low);
  20812. + ath9k_ps_restore(sc);
  20813. +}
  20814. -
  20815. -- ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, val);
  20816. ++
  20817. +static int ath_add_led(struct ath_softc *sc, struct ath_led *led)
  20818. +{
  20819. + const struct gpio_led *gpio = led->gpio;
  20820. @@ -71,30 +80,40 @@
  20821. +
  20822. + led->sc = sc;
  20823. + list_add(&led->list, &sc->leds);
  20824. -+
  20825. -+ /* Configure gpio for output */
  20826. -+ ath9k_hw_cfg_output(sc->sc_ah, gpio->gpio,
  20827. -+ AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
  20828. -+
  20829. +
  20830. + /* Configure gpio for output */
  20831. +- ath9k_hw_gpio_request_out(ah, ah->led_pin, "ath9k-led",
  20832. ++ ath9k_hw_gpio_request_out(sc->sc_ah, gpio->gpio, gpio->name,
  20833. + AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
  20834. +
  20835. +- /* LED off, active low */
  20836. +- ath9k_hw_set_gpio(ah, ah->led_pin, ah->config.led_active_high ? 0 : 1);
  20837. + /* LED off */
  20838. + ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low);
  20839. +
  20840. + return 0;
  20841. -+}
  20842. -+
  20843. + }
  20844. +
  20845. +-static void ath_led_brightness(struct led_classdev *led_cdev,
  20846. +- enum led_brightness brightness)
  20847. +int ath_create_gpio_led(struct ath_softc *sc, int gpio_num, const char *name,
  20848. + const char *trigger, bool active_low)
  20849. -+{
  20850. + {
  20851. +- struct ath_softc *sc = container_of(led_cdev, struct ath_softc, led_cdev);
  20852. +- u32 val = (brightness == LED_OFF);
  20853. + struct ath_led *led;
  20854. + struct gpio_led *gpio;
  20855. + char *_name;
  20856. + int ret;
  20857. -+
  20858. +
  20859. +- if (sc->sc_ah->config.led_active_high)
  20860. +- val = !val;
  20861. + led = kzalloc(sizeof(*led) + sizeof(*gpio) + strlen(name) + 1,
  20862. + GFP_KERNEL);
  20863. + if (!led)
  20864. + return -ENOMEM;
  20865. -+
  20866. +
  20867. +- ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, val);
  20868. + led->gpio = gpio = (struct gpio_led *) (led + 1);
  20869. + _name = (char *) (led->gpio + 1);
  20870. +
  20871. @@ -115,15 +134,18 @@
  20872. {
  20873. - if (!sc->led_registered)
  20874. - return;
  20875. -+ struct ath_led *led;
  20876. -
  20877. +-
  20878. - ath_led_brightness(&sc->led_cdev, LED_OFF);
  20879. - led_classdev_unregister(&sc->led_cdev);
  20880. ++ struct ath_led *led;
  20881. +
  20882. +- ath9k_hw_gpio_free(sc->sc_ah, sc->sc_ah->led_pin);
  20883. + while (!list_empty(&sc->leds)) {
  20884. + led = list_first_entry(&sc->leds, struct ath_led, list);
  20885. + list_del(&led->list);
  20886. + ath_led_brightness(&led->cdev, LED_OFF);
  20887. + led_classdev_unregister(&led->cdev);
  20888. ++ ath9k_hw_gpio_free(sc->sc_ah, led->gpio->gpio);
  20889. + kfree(led);
  20890. + }
  20891. }
  20892. @@ -139,6 +161,8 @@
  20893. if (AR_SREV_9100(sc->sc_ah))
  20894. return;
  20895. + ath_fill_led_pin(sc);
  20896. +
  20897. - if (!ath9k_led_blink)
  20898. - sc->led_cdev.default_trigger =
  20899. - ieee80211_get_radio_led_name(sc->hw);
  20900. @@ -159,13 +183,14 @@
  20901. + trigger = ieee80211_get_radio_led_name(sc->hw);
  20902. - sc->led_registered = true;
  20903. -+ ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, !sc->sc_ah->config.led_active_high);
  20904. ++ ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger,
  20905. ++ !sc->sc_ah->config.led_active_high);
  20906. }
  20907. + #endif
  20908. - void ath_fill_led_pin(struct ath_softc *sc)
  20909. --- a/drivers/net/wireless/ath/ath9k/init.c
  20910. +++ b/drivers/net/wireless/ath/ath9k/init.c
  20911. -@@ -936,7 +936,7 @@ int ath9k_init_device(u16 devid, struct
  20912. +@@ -942,7 +942,7 @@ int ath9k_init_device(u16 devid, struct
  20913. #ifdef CPTCFG_MAC80211_LEDS
  20914. /* must be initialized before ieee80211_register_hw */
  20915. @@ -176,7 +201,7 @@
  20916. #endif
  20917. --- a/drivers/net/wireless/ath/ath9k/debug.c
  20918. +++ b/drivers/net/wireless/ath/ath9k/debug.c
  20919. -@@ -1393,6 +1393,61 @@ static const struct file_operations fops
  20920. +@@ -1407,6 +1407,61 @@ static const struct file_operations fops
  20921. .llseek = default_llseek,
  20922. };
  20923. @@ -238,7 +263,7 @@
  20924. int ath9k_init_debug(struct ath_hw *ah)
  20925. {
  20926. -@@ -1417,6 +1472,10 @@ int ath9k_init_debug(struct ath_hw *ah)
  20927. +@@ -1431,6 +1486,10 @@ int ath9k_init_debug(struct ath_hw *ah)
  20928. &fops_eeprom);
  20929. debugfs_create_file("chanbw", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
  20930. sc, &fops_chanbw);
  20931. diff --git a/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch b/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch
  20932. index 7c10ea6..f656697 100644
  20933. --- a/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch
  20934. +++ b/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch
  20935. @@ -1,6 +1,6 @@
  20936. --- a/include/linux/ath9k_platform.h
  20937. +++ b/include/linux/ath9k_platform.h
  20938. -@@ -41,6 +41,9 @@ struct ath9k_platform_data {
  20939. +@@ -45,6 +45,9 @@ struct ath9k_platform_data {
  20940. int (*external_reset)(void);
  20941. bool use_eeprom;
  20942. @@ -20,7 +20,7 @@
  20943. /********************************/
  20944. /* LED functions */
  20945. -@@ -88,6 +89,24 @@ int ath_create_gpio_led(struct ath_softc
  20946. +@@ -108,6 +109,24 @@ int ath_create_gpio_led(struct ath_softc
  20947. return ret;
  20948. }
  20949. @@ -45,7 +45,7 @@
  20950. void ath_deinit_leds(struct ath_softc *sc)
  20951. {
  20952. struct ath_led *led;
  20953. -@@ -103,8 +122,10 @@ void ath_deinit_leds(struct ath_softc *s
  20954. +@@ -124,8 +143,10 @@ void ath_deinit_leds(struct ath_softc *s
  20955. void ath_init_leds(struct ath_softc *sc)
  20956. {
  20957. @@ -56,10 +56,10 @@
  20958. INIT_LIST_HEAD(&sc->leds);
  20959. -@@ -120,6 +141,12 @@ void ath_init_leds(struct ath_softc *sc)
  20960. - trigger = ieee80211_get_radio_led_name(sc->hw);
  20961. +@@ -144,6 +165,12 @@ void ath_init_leds(struct ath_softc *sc)
  20962. - ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, !sc->sc_ah->config.led_active_high);
  20963. + ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger,
  20964. + !sc->sc_ah->config.led_active_high);
  20965. +
  20966. + if (!pdata)
  20967. + return;
  20968. @@ -67,5 +67,5 @@
  20969. + for (i = 0; i < pdata->num_leds; i++)
  20970. + ath_create_platform_led(sc, &pdata->leds[i]);
  20971. }
  20972. + #endif
  20973. - void ath_fill_led_pin(struct ath_softc *sc)
  20974. 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
  20975. index 6d62a2b..50d8a7a 100644
  20976. --- a/package/kernel/mac80211/patches/532-ath9k_get_led_polarity_from_platform_data.patch
  20977. +++ b/package/kernel/mac80211/patches/532-ath9k_get_led_polarity_from_platform_data.patch
  20978. @@ -1,6 +1,6 @@
  20979. --- a/include/linux/ath9k_platform.h
  20980. +++ b/include/linux/ath9k_platform.h
  20981. -@@ -36,6 +36,7 @@ struct ath9k_platform_data {
  20982. +@@ -40,6 +40,7 @@ struct ath9k_platform_data {
  20983. bool tx_gain_buffalo;
  20984. bool disable_2ghz;
  20985. bool disable_5ghz;
  20986. @@ -10,7 +10,7 @@
  20987. int (*external_reset)(void);
  20988. --- a/drivers/net/wireless/ath/ath9k/init.c
  20989. +++ b/drivers/net/wireless/ath/ath9k/init.c
  20990. -@@ -577,6 +577,7 @@ static int ath9k_init_softc(u16 devid, s
  20991. +@@ -580,6 +580,7 @@ static int ath9k_init_softc(u16 devid, s
  20992. ah->external_reset = pdata->external_reset;
  20993. ah->disable_2ghz = pdata->disable_2ghz;
  20994. ah->disable_5ghz = pdata->disable_5ghz;
  20995. 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
  20996. index 3c5e9f5..c2d2781 100644
  20997. --- a/package/kernel/mac80211/patches/541-ath9k_rx_dma_stop_check.patch
  20998. +++ b/package/kernel/mac80211/patches/541-ath9k_rx_dma_stop_check.patch
  20999. @@ -1,6 +1,6 @@
  21000. --- a/drivers/net/wireless/ath/ath9k/mac.c
  21001. +++ b/drivers/net/wireless/ath/ath9k/mac.c
  21002. -@@ -695,7 +695,7 @@ bool ath9k_hw_stopdmarecv(struct ath_hw
  21003. +@@ -698,7 +698,7 @@ bool ath9k_hw_stopdmarecv(struct ath_hw
  21004. {
  21005. #define AH_RX_STOP_DMA_TIMEOUT 10000 /* usec */
  21006. struct ath_common *common = ath9k_hw_common(ah);
  21007. @@ -9,7 +9,7 @@
  21008. int i;
  21009. /* Enable access to the DMA observation bus */
  21010. -@@ -725,6 +725,16 @@ bool ath9k_hw_stopdmarecv(struct ath_hw
  21011. +@@ -728,6 +728,16 @@ bool ath9k_hw_stopdmarecv(struct ath_hw
  21012. }
  21013. if (i == 0) {
  21014. diff --git a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  21015. index e83c6bf..6edef09 100644
  21016. --- a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  21017. +++ b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  21018. @@ -1,6 +1,6 @@
  21019. --- a/drivers/net/wireless/ath/ath9k/debug.c
  21020. +++ b/drivers/net/wireless/ath/ath9k/debug.c
  21021. -@@ -1449,6 +1449,50 @@ static const struct file_operations fops
  21022. +@@ -1463,6 +1463,50 @@ static const struct file_operations fops
  21023. #endif
  21024. @@ -51,7 +51,7 @@
  21025. int ath9k_init_debug(struct ath_hw *ah)
  21026. {
  21027. struct ath_common *common = ath9k_hw_common(ah);
  21028. -@@ -1476,6 +1520,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  21029. +@@ -1490,6 +1534,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  21030. debugfs_create_file("gpio_led", S_IWUSR,
  21031. sc->debug.debugfs_phy, sc, &fops_gpio_led);
  21032. #endif
  21033. @@ -62,7 +62,7 @@
  21034. debugfs_create_devm_seqfile(sc->dev, "interrupt", sc->debug.debugfs_phy,
  21035. --- a/drivers/net/wireless/ath/ath9k/hw.h
  21036. +++ b/drivers/net/wireless/ath/ath9k/hw.h
  21037. -@@ -519,6 +519,12 @@ enum {
  21038. +@@ -520,6 +520,12 @@ enum {
  21039. ATH9K_RESET_COLD,
  21040. };
  21041. @@ -75,7 +75,7 @@
  21042. struct ath9k_hw_version {
  21043. u32 magic;
  21044. u16 devid;
  21045. -@@ -804,6 +810,8 @@ struct ath_hw {
  21046. +@@ -805,6 +811,8 @@ struct ath_hw {
  21047. u32 rfkill_polarity;
  21048. u32 ah_flags;
  21049. @@ -84,7 +84,7 @@
  21050. bool reset_power_on;
  21051. bool htc_reset_init;
  21052. -@@ -1066,6 +1074,7 @@ void ath9k_hw_check_nav(struct ath_hw *a
  21053. +@@ -1067,6 +1075,7 @@ void ath9k_hw_check_nav(struct ath_hw *a
  21054. bool ath9k_hw_check_alive(struct ath_hw *ah);
  21055. bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode);
  21056. @@ -94,7 +94,7 @@
  21057. struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah,
  21058. --- a/drivers/net/wireless/ath/ath9k/hw.c
  21059. +++ b/drivers/net/wireless/ath/ath9k/hw.c
  21060. -@@ -1819,6 +1819,20 @@ u32 ath9k_hw_get_tsf_offset(struct times
  21061. +@@ -1841,6 +1841,20 @@ u32 ath9k_hw_get_tsf_offset(struct times
  21062. }
  21063. EXPORT_SYMBOL(ath9k_hw_get_tsf_offset);
  21064. @@ -115,7 +115,7 @@
  21065. int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
  21066. struct ath9k_hw_cal_data *caldata, bool fastcc)
  21067. {
  21068. -@@ -2027,6 +2041,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  21069. +@@ -2049,6 +2063,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  21070. ar9003_hw_disable_phy_restart(ah);
  21071. ath9k_hw_apply_gpio_override(ah);
  21072. diff --git a/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch b/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  21073. index d7bb5a1..656ed43 100644
  21074. --- a/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  21075. +++ b/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  21076. @@ -1,6 +1,6 @@
  21077. --- a/drivers/net/wireless/ath/ath9k/hw.h
  21078. +++ b/drivers/net/wireless/ath/ath9k/hw.h
  21079. -@@ -720,6 +720,7 @@ struct ath_spec_scan {
  21080. +@@ -721,6 +721,7 @@ struct ath_spec_scan {
  21081. * @config_pci_powersave:
  21082. * @calibrate: periodic calibration for NF, ANI, IQ, ADC gain, ADC-DC
  21083. *
  21084. @@ -8,7 +8,7 @@
  21085. * @spectral_scan_config: set parameters for spectral scan and enable/disable it
  21086. * @spectral_scan_trigger: trigger a spectral scan run
  21087. * @spectral_scan_wait: wait for a spectral scan run to finish
  21088. -@@ -742,6 +743,7 @@ struct ath_hw_ops {
  21089. +@@ -743,6 +744,7 @@ struct ath_hw_ops {
  21090. struct ath_hw_antcomb_conf *antconf);
  21091. void (*antdiv_comb_conf_set)(struct ath_hw *ah,
  21092. struct ath_hw_antcomb_conf *antconf);
  21093. @@ -18,7 +18,7 @@
  21094. void (*spectral_scan_trigger)(struct ath_hw *ah);
  21095. --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  21096. +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  21097. -@@ -1998,6 +1998,26 @@ void ar9003_hw_init_rate_txpower(struct
  21098. +@@ -1945,6 +1945,26 @@ void ar9003_hw_init_rate_txpower(struct
  21099. }
  21100. }
  21101. @@ -45,7 +45,7 @@
  21102. void ar9003_hw_attach_phy_ops(struct ath_hw *ah)
  21103. {
  21104. struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah);
  21105. -@@ -2034,6 +2054,7 @@ void ar9003_hw_attach_phy_ops(struct ath
  21106. +@@ -1981,6 +2001,7 @@ void ar9003_hw_attach_phy_ops(struct ath
  21107. priv_ops->set_radar_params = ar9003_hw_set_radar_params;
  21108. priv_ops->fast_chan_change = ar9003_hw_fast_chan_change;
  21109. @@ -55,9 +55,9 @@
  21110. ops->spectral_scan_config = ar9003_hw_spectral_scan_config;
  21111. --- a/drivers/net/wireless/ath/ath9k/init.c
  21112. +++ b/drivers/net/wireless/ath/ath9k/init.c
  21113. -@@ -711,7 +711,8 @@ static void ath9k_init_txpower_limits(st
  21114. +@@ -716,7 +716,8 @@ static void ath9k_init_txpower_limits(st
  21115. if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)
  21116. - ath9k_init_band_txpower(sc, IEEE80211_BAND_5GHZ);
  21117. + ath9k_init_band_txpower(sc, NL80211_BAND_5GHZ);
  21118. - ah->curchan = curchan;
  21119. + if (curchan)
  21120. @@ -65,7 +65,7 @@
  21121. }
  21122. static const struct ieee80211_iface_limit if_limits[] = {
  21123. -@@ -897,6 +898,18 @@ static void ath9k_set_hw_capab(struct at
  21124. +@@ -903,6 +904,18 @@ static void ath9k_set_hw_capab(struct at
  21125. SET_IEEE80211_PERM_ADDR(hw, common->macaddr);
  21126. }
  21127. @@ -84,7 +84,7 @@
  21128. int ath9k_init_device(u16 devid, struct ath_softc *sc,
  21129. const struct ath_bus_ops *bus_ops)
  21130. {
  21131. -@@ -942,6 +955,8 @@ int ath9k_init_device(u16 devid, struct
  21132. +@@ -948,6 +961,8 @@ int ath9k_init_device(u16 devid, struct
  21133. ARRAY_SIZE(ath9k_tpt_blink));
  21134. #endif
  21135. @@ -110,7 +110,7 @@
  21136. static inline void ath9k_hw_set_bt_ant_diversity(struct ath_hw *ah, bool enable)
  21137. --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  21138. +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  21139. -@@ -1327,9 +1327,30 @@ void ar5008_hw_init_rate_txpower(struct
  21140. +@@ -1325,9 +1325,30 @@ void ar5008_hw_init_rate_txpower(struct
  21141. }
  21142. }
  21143. @@ -141,7 +141,7 @@
  21144. static const u32 ar5416_cca_regs[6] = {
  21145. AR_PHY_CCA,
  21146. AR_PHY_CH1_CCA,
  21147. -@@ -1344,6 +1365,8 @@ int ar5008_hw_attach_phy_ops(struct ath_
  21148. +@@ -1342,6 +1363,8 @@ int ar5008_hw_attach_phy_ops(struct ath_
  21149. if (ret)
  21150. return ret;
  21151. @@ -175,7 +175,7 @@
  21152. #define AR_PHY_TIMING2 0x9810
  21153. #define AR_PHY_TIMING3 0x9814
  21154. #define AR_PHY_TIMING3_DSC_MAN 0xFFFE0000
  21155. -@@ -390,6 +399,8 @@
  21156. +@@ -393,6 +402,8 @@
  21157. #define AR_PHY_RFBUS_GRANT 0x9C20
  21158. #define AR_PHY_RFBUS_GRANT_EN 0x00000001
  21159. 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
  21160. index 8768c5d..b9c962e 100644
  21161. --- a/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch
  21162. +++ b/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch
  21163. @@ -20,9 +20,9 @@
  21164. /******************/
  21165. /* Chip Revisions */
  21166. /******************/
  21167. -@@ -1397,6 +1410,9 @@ static bool ath9k_hw_set_reset(struct at
  21168. - if (AR_SREV_9100(ah))
  21169. +@@ -1417,6 +1430,9 @@ static bool ath9k_hw_set_reset(struct at
  21170. udelay(50);
  21171. + }
  21172. + if (AR_SREV_9330(ah) || AR_SREV_9340(ah))
  21173. + ath9k_hw_disable_pll_lock_detect(ah);
  21174. @@ -30,7 +30,7 @@
  21175. return true;
  21176. }
  21177. -@@ -1496,6 +1512,9 @@ static bool ath9k_hw_chip_reset(struct a
  21178. +@@ -1516,6 +1532,9 @@ static bool ath9k_hw_chip_reset(struct a
  21179. ar9003_hw_internal_regulator_apply(ah);
  21180. ath9k_hw_init_pll(ah, chan);
  21181. @@ -40,7 +40,7 @@
  21182. return true;
  21183. }
  21184. -@@ -1797,8 +1816,14 @@ static int ath9k_hw_do_fastcc(struct ath
  21185. +@@ -1819,8 +1838,14 @@ static int ath9k_hw_do_fastcc(struct ath
  21186. if (AR_SREV_9271(ah))
  21187. ar9002_hw_load_ani_reg(ah, chan);
  21188. @@ -55,7 +55,7 @@
  21189. return -EINVAL;
  21190. }
  21191. -@@ -2052,6 +2077,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  21192. +@@ -2074,6 +2099,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  21193. ath9k_hw_set_radar_params(ah);
  21194. }
  21195. diff --git a/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch b/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
  21196. index 3d24ccd..b639f97 100644
  21197. --- a/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
  21198. +++ b/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
  21199. @@ -1,6 +1,6 @@
  21200. --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  21201. +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  21202. -@@ -956,55 +956,6 @@ static bool ar5008_hw_ani_control_new(st
  21203. +@@ -954,55 +954,6 @@ static bool ar5008_hw_ani_control_new(st
  21204. * on == 0 means more noise imm
  21205. */
  21206. u32 on = param ? 1 : 0;
  21207. @@ -58,7 +58,7 @@
  21208. REG_SET_BIT(ah, AR_PHY_SFCORR_LOW,
  21209. --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  21210. +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  21211. -@@ -41,20 +41,6 @@ static const int cycpwrThr1_table[] =
  21212. +@@ -42,20 +42,6 @@ static const int cycpwrThr1_table[] =
  21213. /* level: 0 1 2 3 4 5 6 7 8 */
  21214. { -6, -4, -2, 0, 2, 4, 6, 8 }; /* lvl 0-7, default 3 */
  21215. @@ -79,7 +79,7 @@
  21216. static const u8 ofdm2pwr[] = {
  21217. ALL_TARGET_LEGACY_6_24,
  21218. ALL_TARGET_LEGACY_6_24,
  21219. -@@ -1089,11 +1075,6 @@ static bool ar9003_hw_ani_control(struct
  21220. +@@ -1095,11 +1081,6 @@ static bool ar9003_hw_ani_control(struct
  21221. struct ath_common *common = ath9k_hw_common(ah);
  21222. struct ath9k_channel *chan = ah->curchan;
  21223. struct ar5416AniState *aniState = &ah->ani;
  21224. @@ -91,7 +91,7 @@
  21225. s32 value, value2;
  21226. switch (cmd & ah->ani_function) {
  21227. -@@ -1107,61 +1088,6 @@ static bool ar9003_hw_ani_control(struct
  21228. +@@ -1113,61 +1094,6 @@ static bool ar9003_hw_ani_control(struct
  21229. */
  21230. u32 on = param ? 1 : 0;
  21231. diff --git a/package/kernel/mac80211/patches/546-ath9k_platform_led_name.patch b/package/kernel/mac80211/patches/546-ath9k_platform_led_name.patch
  21232. new file mode 100644
  21233. index 0000000..ced72c6
  21234. --- /dev/null
  21235. +++ b/package/kernel/mac80211/patches/546-ath9k_platform_led_name.patch
  21236. @@ -0,0 +1,39 @@
  21237. +From: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  21238. +Date: Sun, 31 Jan 2016 20:45:57 +0100
  21239. +Subject: [PATCH v4 1/8] mac80211: ath9k: enable platform WLAN LED name
  21240. +
  21241. +Enable platform-supplied WLAN LED name for ath9k device. It replaces generic
  21242. +'ath9k-phy*' label with string set during platform initialization.
  21243. +
  21244. +Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  21245. +---
  21246. + drivers/net/wireless/ath/ath9k/gpio.c | 10 +++++++---
  21247. + include/linux/ath9k_platform.h | 1 +
  21248. + 2 files changed, 8 insertions(+), 3 deletions(-)
  21249. +
  21250. +--- a/drivers/net/wireless/ath/ath9k/gpio.c
  21251. ++++ b/drivers/net/wireless/ath/ath9k/gpio.c
  21252. +@@ -155,8 +155,11 @@ void ath_init_leds(struct ath_softc *sc)
  21253. +
  21254. + ath_fill_led_pin(sc);
  21255. +
  21256. +- snprintf(led_name, sizeof(led_name), "ath9k-%s",
  21257. +- wiphy_name(sc->hw->wiphy));
  21258. ++ if (pdata && pdata->led_name)
  21259. ++ strncpy(led_name, pdata->led_name, sizeof(led_name));
  21260. ++ else
  21261. ++ snprintf(led_name, sizeof(led_name), "ath9k-%s",
  21262. ++ wiphy_name(sc->hw->wiphy));
  21263. +
  21264. + if (ath9k_led_blink)
  21265. + trigger = sc->led_default_trigger;
  21266. +--- a/include/linux/ath9k_platform.h
  21267. ++++ b/include/linux/ath9k_platform.h
  21268. +@@ -49,6 +49,7 @@ struct ath9k_platform_data {
  21269. +
  21270. + int num_leds;
  21271. + const struct gpio_led *leds;
  21272. ++ const char *led_name;
  21273. + };
  21274. +
  21275. + #endif /* _LINUX_ATH9K_PLATFORM_H */
  21276. diff --git a/package/kernel/mac80211/patches/547-ath9k_led_defstate_fix.patch b/package/kernel/mac80211/patches/547-ath9k_led_defstate_fix.patch
  21277. new file mode 100644
  21278. index 0000000..5d84cf0
  21279. --- /dev/null
  21280. +++ b/package/kernel/mac80211/patches/547-ath9k_led_defstate_fix.patch
  21281. @@ -0,0 +1,29 @@
  21282. +From: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  21283. +Date: Sun, 31 Jan 2016 20:48:49 +0100
  21284. +Subject: [PATCH v4 2/8] mac80211: ath9k: set default state for platform LEDs
  21285. +
  21286. +Support default state for platform LEDs connected to ath9k device.
  21287. +Now LEDs are correctly set on or off at ath9k module initialization.
  21288. +Very useful if power LED is connected to wireless chip.
  21289. +
  21290. +Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  21291. +---
  21292. + gpio.c | 7 +++++--
  21293. + 1 file changed, 5 insertions(+), 2 deletions(-)
  21294. +
  21295. +--- a/drivers/net/wireless/ath/ath9k/gpio.c
  21296. ++++ b/drivers/net/wireless/ath/ath9k/gpio.c
  21297. +@@ -74,8 +74,11 @@ static int ath_add_led(struct ath_softc
  21298. + ath9k_hw_gpio_request_out(sc->sc_ah, gpio->gpio, gpio->name,
  21299. + AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
  21300. +
  21301. +- /* LED off */
  21302. +- ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low);
  21303. ++ /* Set default LED state */
  21304. ++ if (gpio->default_state == LEDS_GPIO_DEFSTATE_ON)
  21305. ++ ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, !gpio->active_low);
  21306. ++ else
  21307. ++ ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low);
  21308. +
  21309. + return 0;
  21310. + }
  21311. diff --git a/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch b/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch
  21312. new file mode 100644
  21313. index 0000000..1330dfe
  21314. --- /dev/null
  21315. +++ b/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch
  21316. @@ -0,0 +1,234 @@
  21317. +From: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  21318. +Date: Sun, 31 Jan 2016 21:01:31 +0100
  21319. +Subject: [PATCH v4 4/8] mac80211: ath9k: enable access to GPIO
  21320. +
  21321. +Enable access to GPIO chip and its pins for Atheros AR92xx
  21322. +wireless devices. For now AR9285 and AR9287 are supported.
  21323. +
  21324. +Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  21325. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  21326. +---
  21327. +--- a/drivers/net/wireless/ath/ath9k/ath9k.h
  21328. ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  21329. +@@ -24,6 +24,7 @@
  21330. + #include <linux/completion.h>
  21331. + #include <linux/time.h>
  21332. + #include <linux/hw_random.h>
  21333. ++#include <linux/gpio/driver.h>
  21334. +
  21335. + #include "common.h"
  21336. + #include "debug.h"
  21337. +@@ -973,6 +974,14 @@ struct ath_led {
  21338. + struct led_classdev cdev;
  21339. + };
  21340. +
  21341. ++#ifdef CONFIG_GPIOLIB
  21342. ++struct ath9k_gpio_chip {
  21343. ++ struct ath_softc *sc;
  21344. ++ char label[32];
  21345. ++ struct gpio_chip gchip;
  21346. ++};
  21347. ++#endif
  21348. ++
  21349. + struct ath_softc {
  21350. + struct ieee80211_hw *hw;
  21351. + struct device *dev;
  21352. +@@ -1027,6 +1036,9 @@ struct ath_softc {
  21353. + #ifdef CPTCFG_MAC80211_LEDS
  21354. + const char *led_default_trigger;
  21355. + struct list_head leds;
  21356. ++#ifdef CONFIG_GPIOLIB
  21357. ++ struct ath9k_gpio_chip *gpiochip;
  21358. ++#endif
  21359. + #endif
  21360. +
  21361. + #ifdef CPTCFG_ATH9K_DEBUGFS
  21362. +--- a/drivers/net/wireless/ath/ath9k/gpio.c
  21363. ++++ b/drivers/net/wireless/ath/ath9k/gpio.c
  21364. +@@ -16,13 +16,135 @@
  21365. +
  21366. + #include "ath9k.h"
  21367. + #include <linux/ath9k_platform.h>
  21368. ++#include <linux/gpio.h>
  21369. ++
  21370. ++#ifdef CPTCFG_MAC80211_LEDS
  21371. ++
  21372. ++#ifdef CONFIG_GPIOLIB
  21373. ++
  21374. ++/***************/
  21375. ++/* GPIO Chip */
  21376. ++/***************/
  21377. ++
  21378. ++/* gpio_chip handler : set GPIO to input */
  21379. ++static int ath9k_gpio_pin_cfg_input(struct gpio_chip *chip, unsigned offset)
  21380. ++{
  21381. ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip,
  21382. ++ gchip);
  21383. ++
  21384. ++ ath9k_hw_gpio_request_in(gc->sc->sc_ah, offset, "ath9k-gpio");
  21385. ++
  21386. ++ return 0;
  21387. ++}
  21388. ++
  21389. ++/* gpio_chip handler : set GPIO to output */
  21390. ++static int ath9k_gpio_pin_cfg_output(struct gpio_chip *chip, unsigned offset,
  21391. ++ int value)
  21392. ++{
  21393. ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip,
  21394. ++ gchip);
  21395. ++
  21396. ++ ath9k_hw_gpio_request_out(gc->sc->sc_ah, offset, "ath9k-gpio",
  21397. ++ AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
  21398. ++ ath9k_hw_set_gpio(gc->sc->sc_ah, offset, value);
  21399. ++
  21400. ++ return 0;
  21401. ++}
  21402. ++
  21403. ++/* gpio_chip handler : query GPIO direction (0=out, 1=in) */
  21404. ++static int ath9k_gpio_pin_get_dir(struct gpio_chip *chip, unsigned offset)
  21405. ++{
  21406. ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip,
  21407. ++ gchip);
  21408. ++ struct ath_hw *ah = gc->sc->sc_ah;
  21409. ++
  21410. ++ return !((REG_READ(ah, AR_GPIO_OE_OUT) >> (offset * 2)) & 3);
  21411. ++}
  21412. ++
  21413. ++/* gpio_chip handler : get GPIO pin value */
  21414. ++static int ath9k_gpio_pin_get(struct gpio_chip *chip, unsigned offset)
  21415. ++{
  21416. ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip,
  21417. ++ gchip);
  21418. ++
  21419. ++ return ath9k_hw_gpio_get(gc->sc->sc_ah, offset);
  21420. ++}
  21421. ++
  21422. ++/* gpio_chip handler : set GPIO pin to value */
  21423. ++static void ath9k_gpio_pin_set(struct gpio_chip *chip, unsigned offset,
  21424. ++ int value)
  21425. ++{
  21426. ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip,
  21427. ++ gchip);
  21428. ++
  21429. ++ ath9k_hw_set_gpio(gc->sc->sc_ah, offset, value);
  21430. ++}
  21431. ++
  21432. ++/* register GPIO chip */
  21433. ++static void ath9k_register_gpio_chip(struct ath_softc *sc)
  21434. ++{
  21435. ++ struct ath9k_gpio_chip *gc;
  21436. ++ struct ath_hw *ah = sc->sc_ah;
  21437. ++
  21438. ++ gc = kzalloc(sizeof(struct ath9k_gpio_chip), GFP_KERNEL);
  21439. ++ if (!gc)
  21440. ++ return;
  21441. ++
  21442. ++ snprintf(gc->label, sizeof(gc->label), "ath9k-%s",
  21443. ++ wiphy_name(sc->hw->wiphy));
  21444. ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0)
  21445. ++ gc->gchip.parent = sc->dev;
  21446. ++#else
  21447. ++ gc->gchip.dev = sc->dev;
  21448. ++#endif
  21449. ++ gc->gchip.label = gc->label;
  21450. ++ gc->gchip.base = -1; /* determine base automatically */
  21451. ++ gc->gchip.ngpio = ah->caps.num_gpio_pins;
  21452. ++ gc->gchip.direction_input = ath9k_gpio_pin_cfg_input;
  21453. ++ gc->gchip.direction_output = ath9k_gpio_pin_cfg_output;
  21454. ++ gc->gchip.get_direction = ath9k_gpio_pin_get_dir;
  21455. ++ gc->gchip.get = ath9k_gpio_pin_get;
  21456. ++ gc->gchip.set = ath9k_gpio_pin_set;
  21457. ++
  21458. ++ if (gpiochip_add(&gc->gchip)) {
  21459. ++ kfree(gc);
  21460. ++ return;
  21461. ++ }
  21462. ++
  21463. ++ gc->gchip.owner = NULL;
  21464. ++ sc->gpiochip = gc;
  21465. ++ gc->sc = sc;
  21466. ++}
  21467. ++
  21468. ++/* remove GPIO chip */
  21469. ++static void ath9k_unregister_gpio_chip(struct ath_softc *sc)
  21470. ++{
  21471. ++ struct ath9k_gpio_chip *gc = sc->gpiochip;
  21472. ++
  21473. ++ if (!gc)
  21474. ++ return;
  21475. ++
  21476. ++ gpiochip_remove(&gc->gchip);
  21477. ++ kfree(gc);
  21478. ++ sc->gpiochip = NULL;
  21479. ++}
  21480. ++
  21481. ++#else /* CONFIG_GPIOLIB */
  21482. ++
  21483. ++static inline void ath9k_register_gpio_chip(struct ath_softc *sc)
  21484. ++{
  21485. ++}
  21486. ++
  21487. ++static inline void ath9k_unregister_gpio_chip(struct ath_softc *sc)
  21488. ++{
  21489. ++}
  21490. ++
  21491. ++#endif /* CONFIG_GPIOLIB */
  21492. +
  21493. + /********************************/
  21494. + /* LED functions */
  21495. + /********************************/
  21496. +
  21497. +-#ifdef CPTCFG_MAC80211_LEDS
  21498. +-
  21499. + static void ath_fill_led_pin(struct ath_softc *sc)
  21500. + {
  21501. + struct ath_hw *ah = sc->sc_ah;
  21502. +@@ -80,6 +202,12 @@ static int ath_add_led(struct ath_softc
  21503. + else
  21504. + ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low);
  21505. +
  21506. ++#ifdef CONFIG_GPIOLIB
  21507. ++ /* If there is GPIO chip configured, reserve LED pin */
  21508. ++ if (sc->gpiochip)
  21509. ++ gpio_request(sc->gpiochip->gchip.base + gpio->gpio, gpio->name);
  21510. ++#endif
  21511. ++
  21512. + return 0;
  21513. + }
  21514. +
  21515. +@@ -136,12 +264,18 @@ void ath_deinit_leds(struct ath_softc *s
  21516. +
  21517. + while (!list_empty(&sc->leds)) {
  21518. + led = list_first_entry(&sc->leds, struct ath_led, list);
  21519. ++#ifdef CONFIG_GPIOLIB
  21520. ++ /* If there is GPIO chip configured, free LED pin */
  21521. ++ if (sc->gpiochip)
  21522. ++ gpio_free(sc->gpiochip->gchip.base + led->gpio->gpio);
  21523. ++#endif
  21524. + list_del(&led->list);
  21525. + ath_led_brightness(&led->cdev, LED_OFF);
  21526. + led_classdev_unregister(&led->cdev);
  21527. + ath9k_hw_gpio_free(sc->sc_ah, led->gpio->gpio);
  21528. + kfree(led);
  21529. + }
  21530. ++ ath9k_unregister_gpio_chip(sc);
  21531. + }
  21532. +
  21533. + void ath_init_leds(struct ath_softc *sc)
  21534. +@@ -158,6 +292,8 @@ void ath_init_leds(struct ath_softc *sc)
  21535. +
  21536. + ath_fill_led_pin(sc);
  21537. +
  21538. ++ ath9k_register_gpio_chip(sc);
  21539. ++
  21540. + if (pdata && pdata->led_name)
  21541. + strncpy(led_name, pdata->led_name, sizeof(led_name));
  21542. + else
  21543. +@@ -178,6 +314,7 @@ void ath_init_leds(struct ath_softc *sc)
  21544. + for (i = 0; i < pdata->num_leds; i++)
  21545. + ath_create_platform_led(sc, &pdata->leds[i]);
  21546. + }
  21547. ++
  21548. + #endif
  21549. +
  21550. + /*******************/
  21551. diff --git a/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch b/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch
  21552. new file mode 100644
  21553. index 0000000..f86b015
  21554. --- /dev/null
  21555. +++ b/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch
  21556. @@ -0,0 +1,149 @@
  21557. +From: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  21558. +Subject: [PATCH v5 5/8] mac80211: ath9k: enable GPIO buttons
  21559. +
  21560. +Enable platform-defined GPIO button support for ath9k device.
  21561. +Key poller is activated for attached platform buttons.
  21562. +Requires ath9k GPIO chip access.
  21563. +
  21564. +Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  21565. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  21566. +---
  21567. +--- a/drivers/net/wireless/ath/ath9k/ath9k.h
  21568. ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  21569. +@@ -1038,6 +1038,7 @@ struct ath_softc {
  21570. + struct list_head leds;
  21571. + #ifdef CONFIG_GPIOLIB
  21572. + struct ath9k_gpio_chip *gpiochip;
  21573. ++ struct platform_device *btnpdev; /* gpio-keys-polled */
  21574. + #endif
  21575. + #endif
  21576. +
  21577. +--- a/drivers/net/wireless/ath/ath9k/gpio.c
  21578. ++++ b/drivers/net/wireless/ath/ath9k/gpio.c
  21579. +@@ -17,6 +17,8 @@
  21580. + #include "ath9k.h"
  21581. + #include <linux/ath9k_platform.h>
  21582. + #include <linux/gpio.h>
  21583. ++#include <linux/platform_device.h>
  21584. ++#include <linux/gpio_keys.h>
  21585. +
  21586. + #ifdef CPTCFG_MAC80211_LEDS
  21587. +
  21588. +@@ -129,6 +131,64 @@ static void ath9k_unregister_gpio_chip(s
  21589. + sc->gpiochip = NULL;
  21590. + }
  21591. +
  21592. ++/******************/
  21593. ++/* GPIO Buttons */
  21594. ++/******************/
  21595. ++
  21596. ++/* add GPIO buttons */
  21597. ++static void ath9k_init_buttons(struct ath_softc *sc)
  21598. ++{
  21599. ++ struct ath9k_platform_data *pdata = sc->dev->platform_data;
  21600. ++ struct platform_device *pdev;
  21601. ++ struct gpio_keys_platform_data gkpdata;
  21602. ++ struct gpio_keys_button *bt;
  21603. ++ int i;
  21604. ++
  21605. ++ if (!sc->gpiochip)
  21606. ++ return;
  21607. ++
  21608. ++ if (!pdata || !pdata->btns || !pdata->num_btns)
  21609. ++ return;
  21610. ++
  21611. ++ bt = devm_kmemdup(sc->dev, pdata->btns,
  21612. ++ pdata->num_btns * sizeof(struct gpio_keys_button),
  21613. ++ GFP_KERNEL);
  21614. ++ if (!bt)
  21615. ++ return;
  21616. ++
  21617. ++ for (i = 0; i < pdata->num_btns; i++) {
  21618. ++ ath9k_hw_gpio_request_in(sc->sc_ah, pdata->btns[i].gpio,
  21619. ++ "ath9k-gpio");
  21620. ++ bt[i].gpio = sc->gpiochip->gchip.base + pdata->btns[i].gpio;
  21621. ++ }
  21622. ++
  21623. ++ memset(&gkpdata, 0, sizeof(struct gpio_keys_platform_data));
  21624. ++ gkpdata.buttons = bt;
  21625. ++ gkpdata.nbuttons = pdata->num_btns;
  21626. ++ gkpdata.poll_interval = pdata->btn_poll_interval;
  21627. ++
  21628. ++ pdev = platform_device_register_data(sc->dev, "gpio-keys-polled",
  21629. ++ PLATFORM_DEVID_AUTO, &gkpdata,
  21630. ++ sizeof(gkpdata));
  21631. ++ if (!IS_ERR_OR_NULL(pdev))
  21632. ++ sc->btnpdev = pdev;
  21633. ++ else {
  21634. ++ sc->btnpdev = NULL;
  21635. ++ devm_kfree(sc->dev, bt);
  21636. ++ }
  21637. ++}
  21638. ++
  21639. ++/* remove GPIO buttons */
  21640. ++static void ath9k_deinit_buttons(struct ath_softc *sc)
  21641. ++{
  21642. ++ if (!sc->gpiochip || !sc->btnpdev)
  21643. ++ return;
  21644. ++
  21645. ++ platform_device_unregister(sc->btnpdev);
  21646. ++
  21647. ++ sc->btnpdev = NULL;
  21648. ++}
  21649. ++
  21650. + #else /* CONFIG_GPIOLIB */
  21651. +
  21652. + static inline void ath9k_register_gpio_chip(struct ath_softc *sc)
  21653. +@@ -139,6 +199,14 @@ static inline void ath9k_unregister_gpio
  21654. + {
  21655. + }
  21656. +
  21657. ++static inline void ath9k_init_buttons(struct ath_softc *sc)
  21658. ++{
  21659. ++}
  21660. ++
  21661. ++static inline void ath9k_deinit_buttons(struct ath_softc *sc)
  21662. ++{
  21663. ++}
  21664. ++
  21665. + #endif /* CONFIG_GPIOLIB */
  21666. +
  21667. + /********************************/
  21668. +@@ -262,6 +330,7 @@ void ath_deinit_leds(struct ath_softc *s
  21669. + {
  21670. + struct ath_led *led;
  21671. +
  21672. ++ ath9k_deinit_buttons(sc);
  21673. + while (!list_empty(&sc->leds)) {
  21674. + led = list_first_entry(&sc->leds, struct ath_led, list);
  21675. + #ifdef CONFIG_GPIOLIB
  21676. +@@ -293,6 +362,7 @@ void ath_init_leds(struct ath_softc *sc)
  21677. + ath_fill_led_pin(sc);
  21678. +
  21679. + ath9k_register_gpio_chip(sc);
  21680. ++ ath9k_init_buttons(sc);
  21681. +
  21682. + if (pdata && pdata->led_name)
  21683. + strncpy(led_name, pdata->led_name, sizeof(led_name));
  21684. +@@ -308,7 +378,7 @@ void ath_init_leds(struct ath_softc *sc)
  21685. + ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger,
  21686. + !sc->sc_ah->config.led_active_high);
  21687. +
  21688. +- if (!pdata)
  21689. ++ if (!pdata || !pdata->leds || !pdata->num_leds)
  21690. + return;
  21691. +
  21692. + for (i = 0; i < pdata->num_leds; i++)
  21693. +--- a/include/linux/ath9k_platform.h
  21694. ++++ b/include/linux/ath9k_platform.h
  21695. +@@ -50,6 +50,10 @@ struct ath9k_platform_data {
  21696. + int num_leds;
  21697. + const struct gpio_led *leds;
  21698. + const char *led_name;
  21699. ++
  21700. ++ unsigned num_btns;
  21701. ++ const struct gpio_keys_button *btns;
  21702. ++ unsigned btn_poll_interval;
  21703. + };
  21704. +
  21705. + #endif /* _LINUX_ATH9K_PLATFORM_H */
  21706. 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
  21707. index 8245909..db70a33 100644
  21708. --- a/package/kernel/mac80211/patches/600-0002-rt2x00-rt2800lib-introduce-RT2800_HAS_HIGH_SHARED_ME.patch
  21709. +++ b/package/kernel/mac80211/patches/600-0002-rt2x00-rt2800lib-introduce-RT2800_HAS_HIGH_SHARED_ME.patch
  21710. @@ -24,7 +24,7 @@ Changes since v1:
  21711. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  21712. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  21713. -@@ -7722,6 +7722,7 @@ static int rt2800_probe_rt(struct rt2x00
  21714. +@@ -7726,6 +7726,7 @@ static int rt2800_probe_rt(struct rt2x00
  21715. int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev)
  21716. {
  21717. @@ -32,7 +32,7 @@ Changes since v1:
  21718. int retval;
  21719. u32 reg;
  21720. -@@ -7729,6 +7730,9 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  21721. +@@ -7733,6 +7734,9 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  21722. if (retval)
  21723. return retval;
  21724. 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
  21725. index 7abfcd1..a3b62bc 100644
  21726. --- a/package/kernel/mac80211/patches/600-0003-rt2x00-rt2800-serialize-shared-memory-access.patch
  21727. +++ b/package/kernel/mac80211/patches/600-0003-rt2x00-rt2800-serialize-shared-memory-access.patch
  21728. @@ -239,7 +239,7 @@ Changes since v1: ---
  21729. msleep(1);
  21730. /*
  21731. -@@ -7726,6 +7774,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  21732. +@@ -7730,6 +7778,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  21733. int retval;
  21734. u32 reg;
  21735. @@ -248,7 +248,7 @@ Changes since v1: ---
  21736. retval = rt2800_probe_rt(rt2x00dev);
  21737. if (retval)
  21738. return retval;
  21739. -@@ -7809,8 +7859,11 @@ void rt2800_get_key_seq(struct ieee80211
  21740. +@@ -7813,8 +7863,11 @@ void rt2800_get_key_seq(struct ieee80211
  21741. return;
  21742. offset = MAC_IVEIV_ENTRY(key->hw_key_idx);
  21743. 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
  21744. index 02b2acf..f41a160 100644
  21745. --- a/package/kernel/mac80211/patches/600-0005-rt2x00-rt2800lib-add-hw_beacon_count-field-to-struct.patch
  21746. +++ b/package/kernel/mac80211/patches/600-0005-rt2x00-rt2800lib-add-hw_beacon_count-field-to-struct.patch
  21747. @@ -41,7 +41,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  21748. rt2800_clear_beacon_register(rt2x00dev, i);
  21749. if (rt2x00_is_usb(rt2x00dev)) {
  21750. -@@ -7827,6 +7828,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  21751. +@@ -7831,6 +7832,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  21752. if (rt2x00_rt(rt2x00dev, RT3593))
  21753. __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  21754. 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
  21755. index e909272..5099c64 100644
  21756. --- a/package/kernel/mac80211/patches/600-0007-rt2x00-rt2800lib-fix-max-supported-beacon-count-for-.patch
  21757. +++ b/package/kernel/mac80211/patches/600-0007-rt2x00-rt2800lib-fix-max-supported-beacon-count-for-.patch
  21758. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  21759. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  21760. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  21761. -@@ -7852,7 +7852,10 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  21762. +@@ -7856,7 +7856,10 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  21763. if (rt2x00_rt(rt2x00dev, RT3593))
  21764. __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  21765. 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
  21766. index 7fe38e0..a2e7015 100644
  21767. --- a/package/kernel/mac80211/patches/600-0009-rt2x00-rt2800lib-enable-support-for-RT3883.patch
  21768. +++ b/package/kernel/mac80211/patches/600-0009-rt2x00-rt2800lib-enable-support-for-RT3883.patch
  21769. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  21770. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  21771. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  21772. -@@ -7822,6 +7822,7 @@ static int rt2800_probe_rt(struct rt2x00
  21773. +@@ -7826,6 +7826,7 @@ static int rt2800_probe_rt(struct rt2x00
  21774. case RT3390:
  21775. case RT3572:
  21776. case RT3593:
  21777. 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
  21778. index 253a0c0..89bd0ac 100644
  21779. --- a/package/kernel/mac80211/patches/600-0010-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch
  21780. +++ b/package/kernel/mac80211/patches/600-0010-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch
  21781. @@ -98,7 +98,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  21782. static const struct rf_channel rf_vals_5592_xtal20[] = {
  21783. /* Channel, N, K, mod, R */
  21784. {1, 482, 4, 10, 3},
  21785. -@@ -7669,6 +7729,11 @@ static int rt2800_probe_hw_mode(struct r
  21786. +@@ -7673,6 +7733,11 @@ static int rt2800_probe_hw_mode(struct r
  21787. spec->channels = rf_vals_3x;
  21788. break;
  21789. 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
  21790. index f15c22b..b7efc9f 100644
  21791. --- a/package/kernel/mac80211/patches/600-0011-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch
  21792. +++ b/package/kernel/mac80211/patches/600-0011-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch
  21793. @@ -18,7 +18,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  21794. case RF5360:
  21795. case RF5362:
  21796. case RF5370:
  21797. -@@ -7848,6 +7849,7 @@ static int rt2800_probe_hw_mode(struct r
  21798. +@@ -7852,6 +7853,7 @@ static int rt2800_probe_hw_mode(struct r
  21799. case RF3053:
  21800. case RF3070:
  21801. case RF3290:
  21802. 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
  21803. index 6ce224a..220e35f 100644
  21804. --- a/package/kernel/mac80211/patches/600-0026-rt2x00-rt2800lib-use-correct-beacon-count-for-RT3883.patch
  21805. +++ b/package/kernel/mac80211/patches/600-0026-rt2x00-rt2800lib-use-correct-beacon-count-for-RT3883.patch
  21806. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  21807. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  21808. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  21809. -@@ -8403,7 +8403,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  21810. +@@ -8407,7 +8407,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  21811. if (rt2x00_rt(rt2x00dev, RT3593))
  21812. __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  21813. 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
  21814. index 25753af..2ffa5a4 100644
  21815. --- a/package/kernel/mac80211/patches/600-0032-rt2x00-rt2800lib-enable-RT2800_HAS_HIGH_SHARED_MEM-f.patch
  21816. +++ b/package/kernel/mac80211/patches/600-0032-rt2x00-rt2800lib-enable-RT2800_HAS_HIGH_SHARED_MEM-f.patch
  21817. @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  21818. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  21819. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  21820. -@@ -8416,7 +8416,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  21821. +@@ -8420,7 +8420,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  21822. if (retval)
  21823. return retval;
  21824. 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
  21825. index 7a183a4..daa5dc6 100644
  21826. --- a/package/kernel/mac80211/patches/602-rt2x00-introduce-rt2x00_platform_h.patch
  21827. +++ b/package/kernel/mac80211/patches/602-rt2x00-introduce-rt2x00_platform_h.patch
  21828. @@ -22,10 +22,10 @@
  21829. +#endif /* _RT2X00_PLATFORM_H */
  21830. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  21831. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  21832. -@@ -38,6 +38,7 @@
  21833. - #include <linux/kfifo.h>
  21834. +@@ -39,6 +39,7 @@
  21835. #include <linux/hrtimer.h>
  21836. #include <linux/average.h>
  21837. + #include <linux/usb.h>
  21838. +#include <linux/rt2x00_platform.h>
  21839. #include <net/mac80211.h>
  21840. diff --git a/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch b/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
  21841. index bc056cd..8ae5da3 100644
  21842. --- a/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
  21843. +++ b/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
  21844. @@ -1,6 +1,6 @@
  21845. --- a/.local-symbols
  21846. +++ b/.local-symbols
  21847. -@@ -329,6 +329,7 @@ RT2X00_LIB_FIRMWARE=
  21848. +@@ -331,6 +331,7 @@ RT2X00_LIB_FIRMWARE=
  21849. RT2X00_LIB_CRYPTO=
  21850. RT2X00_LIB_LEDS=
  21851. RT2X00_LIB_DEBUGFS=
  21852. @@ -105,7 +105,7 @@
  21853. .drv_init_registers = rt2800mmio_init_registers,
  21854. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  21855. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  21856. -@@ -697,6 +697,7 @@ enum rt2x00_capability_flags {
  21857. +@@ -699,6 +699,7 @@ enum rt2x00_capability_flags {
  21858. REQUIRE_HT_TX_DESC,
  21859. REQUIRE_PS_AUTOWAKE,
  21860. REQUIRE_DELAYED_RFKILL,
  21861. @@ -127,7 +127,7 @@
  21862. DECLARE_KFIFO_PTR(txstatus_fifo, u32);
  21863. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  21864. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  21865. -@@ -1335,6 +1335,10 @@ int rt2x00lib_probe_dev(struct rt2x00_de
  21866. +@@ -1334,6 +1334,10 @@ int rt2x00lib_probe_dev(struct rt2x00_de
  21867. INIT_DELAYED_WORK(&rt2x00dev->autowakeup_work, rt2x00lib_autowakeup);
  21868. INIT_WORK(&rt2x00dev->sleep_work, rt2x00lib_sleep);
  21869. @@ -138,7 +138,7 @@
  21870. /*
  21871. * Let the driver probe the device to detect the capabilities.
  21872. */
  21873. -@@ -1475,6 +1479,11 @@ void rt2x00lib_remove_dev(struct rt2x00_
  21874. +@@ -1477,6 +1481,11 @@ void rt2x00lib_remove_dev(struct rt2x00_
  21875. * Free the driver data.
  21876. */
  21877. kfree(rt2x00dev->drv_data);
  21878. 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
  21879. index d923e05..a2e1faf 100644
  21880. --- a/package/kernel/mac80211/patches/607-rt2x00-allow_disabling_bands_through_platform_data.patch
  21881. +++ b/package/kernel/mac80211/patches/607-rt2x00-allow_disabling_bands_through_platform_data.patch
  21882. @@ -37,7 +37,7 @@
  21883. num_rates += 4;
  21884. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  21885. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  21886. -@@ -405,6 +405,7 @@ struct hw_mode_spec {
  21887. +@@ -406,6 +406,7 @@ struct hw_mode_spec {
  21888. unsigned int supported_bands;
  21889. #define SUPPORT_BAND_2GHZ 0x00000001
  21890. #define SUPPORT_BAND_5GHZ 0x00000002
  21891. 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
  21892. index a645ba1..6704ff8 100644
  21893. --- a/package/kernel/mac80211/patches/608-add_platform_data_mac_addr.patch
  21894. +++ b/package/kernel/mac80211/patches/608-add_platform_data_mac_addr.patch
  21895. @@ -31,7 +31,7 @@
  21896. {
  21897. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  21898. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  21899. -@@ -1414,6 +1414,7 @@ static inline void rt2x00debug_dump_fram
  21900. +@@ -1416,6 +1416,7 @@ static inline void rt2x00debug_dump_fram
  21901. */
  21902. u32 rt2x00lib_get_bssidx(struct rt2x00_dev *rt2x00dev,
  21903. struct ieee80211_vif *vif);
  21904. 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
  21905. index c69d330..9f10fe3 100644
  21906. --- a/package/kernel/mac80211/patches/610-rt2x00-fix-rt3352-ext-pa.patch
  21907. +++ b/package/kernel/mac80211/patches/610-rt2x00-fix-rt3352-ext-pa.patch
  21908. @@ -200,7 +200,7 @@
  21909. * EEPROM frequency
  21910. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  21911. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  21912. -@@ -717,6 +717,8 @@ enum rt2x00_capability_flags {
  21913. +@@ -719,6 +719,8 @@ enum rt2x00_capability_flags {
  21914. CAPABILITY_DOUBLE_ANTENNA,
  21915. CAPABILITY_BT_COEXIST,
  21916. CAPABILITY_VCO_RECALIBRATION,
  21917. 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
  21918. index b44fe90..860fdc0 100644
  21919. --- a/package/kernel/mac80211/patches/611-rt2x00-rf_vals-rt3352-xtal20.patch
  21920. +++ b/package/kernel/mac80211/patches/611-rt2x00-rf_vals-rt3352-xtal20.patch
  21921. @@ -28,7 +28,7 @@
  21922. static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
  21923. {
  21924. struct hw_mode_spec *spec = &rt2x00dev->spec;
  21925. -@@ -8272,7 +8293,10 @@ static int rt2800_probe_hw_mode(struct r
  21926. +@@ -8276,7 +8297,10 @@ static int rt2800_probe_hw_mode(struct r
  21927. case RF5390:
  21928. case RF5392:
  21929. spec->num_channels = 14;
  21930. @@ -40,7 +40,7 @@
  21931. break;
  21932. case RF3052:
  21933. -@@ -8456,6 +8480,19 @@ static int rt2800_probe_rt(struct rt2x00
  21934. +@@ -8460,6 +8484,19 @@ static int rt2800_probe_rt(struct rt2x00
  21935. return 0;
  21936. }
  21937. @@ -60,7 +60,7 @@
  21938. int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev)
  21939. {
  21940. struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
  21941. -@@ -8498,6 +8535,15 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  21942. +@@ -8502,6 +8539,15 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  21943. rt2800_register_write(rt2x00dev, GPIO_CTRL, reg);
  21944. /*
  21945. @@ -78,7 +78,7 @@
  21946. retval = rt2800_probe_hw_mode(rt2x00dev);
  21947. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  21948. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  21949. -@@ -400,6 +400,7 @@ static inline struct rt2x00_intf* vif_to
  21950. +@@ -401,6 +401,7 @@ static inline struct rt2x00_intf* vif_to
  21951. * @channels: Device/chipset specific channel values (See &struct rf_channel).
  21952. * @channels_info: Additional information for channels (See &struct channel_info).
  21953. * @ht: Driver HT Capabilities (See &ieee80211_sta_ht_cap).
  21954. @@ -86,7 +86,7 @@
  21955. */
  21956. struct hw_mode_spec {
  21957. unsigned int supported_bands;
  21958. -@@ -416,6 +417,7 @@ struct hw_mode_spec {
  21959. +@@ -417,6 +418,7 @@ struct hw_mode_spec {
  21960. const struct channel_info *channels_info;
  21961. struct ieee80211_sta_ht_cap ht;
  21962. diff --git a/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch b/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
  21963. index 8e3bd2a..e7b2a8c 100644
  21964. --- a/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
  21965. +++ b/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
  21966. @@ -8,7 +8,7 @@
  21967. #include "rt2x00.h"
  21968. #include "rt2800lib.h"
  21969. -@@ -8482,13 +8483,14 @@ static int rt2800_probe_rt(struct rt2x00
  21970. +@@ -8486,13 +8487,14 @@ static int rt2800_probe_rt(struct rt2x00
  21971. int rt2800_probe_clk(struct rt2x00_dev *rt2x00dev)
  21972. {
  21973. diff --git a/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch b/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch
  21974. index faa5879..44bd8a1 100644
  21975. --- a/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch
  21976. +++ b/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch
  21977. @@ -240,7 +240,7 @@
  21978. case RF5360:
  21979. case RF5362:
  21980. case RF5370:
  21981. -@@ -8287,6 +8398,7 @@ static int rt2800_probe_hw_mode(struct r
  21982. +@@ -8291,6 +8402,7 @@ static int rt2800_probe_hw_mode(struct r
  21983. case RF3290:
  21984. case RF3320:
  21985. case RF3322:
  21986. @@ -248,7 +248,7 @@
  21987. case RF5360:
  21988. case RF5362:
  21989. case RF5370:
  21990. -@@ -8426,6 +8538,7 @@ static int rt2800_probe_hw_mode(struct r
  21991. +@@ -8430,6 +8542,7 @@ static int rt2800_probe_hw_mode(struct r
  21992. case RF3070:
  21993. case RF3290:
  21994. case RF3853:
  21995. @@ -256,7 +256,7 @@
  21996. case RF5360:
  21997. case RF5362:
  21998. case RF5370:
  21999. -@@ -8466,6 +8579,7 @@ static int rt2800_probe_rt(struct rt2x00
  22000. +@@ -8470,6 +8583,7 @@ static int rt2800_probe_rt(struct rt2x00
  22001. case RT3572:
  22002. case RT3593:
  22003. case RT3883:
  22004. @@ -266,7 +266,7 @@
  22005. case RT5592:
  22006. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  22007. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  22008. -@@ -169,6 +169,7 @@ struct rt2x00_chip {
  22009. +@@ -170,6 +170,7 @@ struct rt2x00_chip {
  22010. #define RT3572 0x3572
  22011. #define RT3593 0x3593
  22012. #define RT3883 0x3883 /* WSOC */
  22013. 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
  22014. index 55452b9..dba6033 100644
  22015. --- a/package/kernel/mac80211/patches/620-rt2x00-add-AP+STA-support.patch
  22016. +++ b/package/kernel/mac80211/patches/620-rt2x00-add-AP+STA-support.patch
  22017. @@ -1,6 +1,6 @@
  22018. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  22019. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  22020. -@@ -1284,7 +1284,7 @@ static inline void rt2x00lib_set_if_comb
  22021. +@@ -1283,7 +1283,7 @@ static inline void rt2x00lib_set_if_comb
  22022. */
  22023. if_limit = &rt2x00dev->if_limits_ap;
  22024. if_limit->max = rt2x00dev->ops->max_ap_intf;
  22025. diff --git a/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch b/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
  22026. index fd885cc..02f3053 100644
  22027. --- a/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
  22028. +++ b/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
  22029. @@ -1,6 +1,6 @@
  22030. --- a/drivers/net/wireless/marvell/libertas/cfg.c
  22031. +++ b/drivers/net/wireless/marvell/libertas/cfg.c
  22032. -@@ -2084,6 +2084,8 @@ struct wireless_dev *lbs_cfg_alloc(struc
  22033. +@@ -2122,6 +2122,8 @@ struct wireless_dev *lbs_cfg_alloc(struc
  22034. goto err_wiphy_new;
  22035. }
  22036. diff --git a/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch b/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
  22037. index b67a95f..ad30608 100644
  22038. --- a/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
  22039. +++ b/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
  22040. @@ -1,6 +1,6 @@
  22041. --- a/drivers/net/wireless/marvell/libertas/cfg.c
  22042. +++ b/drivers/net/wireless/marvell/libertas/cfg.c
  22043. -@@ -2174,6 +2174,8 @@ int lbs_cfg_register(struct lbs_private
  22044. +@@ -2212,6 +2212,8 @@ int lbs_cfg_register(struct lbs_private
  22045. wdev->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
  22046. wdev->wiphy->reg_notifier = lbs_reg_notifier;
  22047. diff --git a/package/kernel/mac80211/patches/804-b43-sync-with-bcma.patch b/package/kernel/mac80211/patches/804-b43-sync-with-bcma.patch
  22048. deleted file mode 100644
  22049. index 74cd448..0000000
  22050. --- a/package/kernel/mac80211/patches/804-b43-sync-with-bcma.patch
  22051. +++ /dev/null
  22052. @@ -1,17 +0,0 @@
  22053. ---- a/drivers/net/wireless/broadcom/b43/main.c
  22054. -+++ b/drivers/net/wireless/broadcom/b43/main.c
  22055. -@@ -1215,10 +1215,10 @@ void b43_wireless_core_phy_pll_reset(str
  22056. - case B43_BUS_BCMA:
  22057. - bcma_cc = &dev->dev->bdev->bus->drv_cc;
  22058. -
  22059. -- bcma_cc_write32(bcma_cc, BCMA_CC_CHIPCTL_ADDR, 0);
  22060. -- bcma_cc_mask32(bcma_cc, BCMA_CC_CHIPCTL_DATA, ~0x4);
  22061. -- bcma_cc_set32(bcma_cc, BCMA_CC_CHIPCTL_DATA, 0x4);
  22062. -- bcma_cc_mask32(bcma_cc, BCMA_CC_CHIPCTL_DATA, ~0x4);
  22063. -+ bcma_cc_write32(bcma_cc, BCMA_CC_PMU_CHIPCTL_ADDR, 0);
  22064. -+ bcma_cc_mask32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, ~0x4);
  22065. -+ bcma_cc_set32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, 0x4);
  22066. -+ bcma_cc_mask32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, ~0x4);
  22067. - break;
  22068. - #endif
  22069. - #ifdef CPTCFG_B43_SSB
  22070. diff --git a/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch b/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch
  22071. index 06c731f..f8f555f 100644
  22072. --- a/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch
  22073. +++ b/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch
  22074. @@ -9,7 +9,7 @@
  22075. antenna = b43_antenna_to_phyctl(antenna);
  22076. ctl = b43_shm_read16(dev, B43_SHM_SHARED, B43_SHM_SH_BEACPHYCTL);
  22077. /* We can't send beacons with short preamble. Would get PHY errors. */
  22078. -@@ -3300,8 +3300,8 @@ static int b43_chip_init(struct b43_wlde
  22079. +@@ -3297,8 +3297,8 @@ static int b43_chip_init(struct b43_wlde
  22080. /* Select the antennae */
  22081. if (phy->ops->set_rx_antenna)
  22082. @@ -20,7 +20,7 @@
  22083. if (phy->type == B43_PHYTYPE_B) {
  22084. value16 = b43_read16(dev, 0x005E);
  22085. -@@ -4001,7 +4001,6 @@ static int b43_op_config(struct ieee8021
  22086. +@@ -3998,7 +3998,6 @@ static int b43_op_config(struct ieee8021
  22087. struct b43_wldev *dev = wl->current_dev;
  22088. struct b43_phy *phy = &dev->phy;
  22089. struct ieee80211_conf *conf = &hw->conf;
  22090. @@ -28,7 +28,7 @@
  22091. int err = 0;
  22092. mutex_lock(&wl->mutex);
  22093. -@@ -4044,11 +4043,9 @@ static int b43_op_config(struct ieee8021
  22094. +@@ -4041,11 +4040,9 @@ static int b43_op_config(struct ieee8021
  22095. }
  22096. /* Antennas for RX and management frame TX. */
  22097. @@ -42,7 +42,7 @@
  22098. if (wl->radio_enabled != phy->radio_on) {
  22099. if (wl->radio_enabled) {
  22100. -@@ -5209,6 +5206,47 @@ static int b43_op_get_survey(struct ieee
  22101. +@@ -5189,6 +5186,47 @@ static int b43_op_get_survey(struct ieee
  22102. return 0;
  22103. }
  22104. @@ -90,7 +90,7 @@
  22105. static const struct ieee80211_ops b43_hw_ops = {
  22106. .tx = b43_op_tx,
  22107. .conf_tx = b43_op_conf_tx,
  22108. -@@ -5230,6 +5268,8 @@ static const struct ieee80211_ops b43_hw
  22109. +@@ -5210,6 +5248,8 @@ static const struct ieee80211_ops b43_hw
  22110. .sw_scan_complete = b43_op_sw_scan_complete_notifier,
  22111. .get_survey = b43_op_get_survey,
  22112. .rfkill_poll = b43_rfkill_poll,
  22113. @@ -99,7 +99,7 @@
  22114. };
  22115. /* Hard-reset the chip. Do not call this directly.
  22116. -@@ -5538,6 +5578,8 @@ static int b43_one_core_attach(struct b4
  22117. +@@ -5513,6 +5553,8 @@ static int b43_one_core_attach(struct b4
  22118. if (!wldev)
  22119. goto out;
  22120. @@ -108,7 +108,7 @@
  22121. wldev->use_pio = b43_modparam_pio;
  22122. wldev->dev = dev;
  22123. wldev->wl = wl;
  22124. -@@ -5628,6 +5670,9 @@ static struct b43_wl *b43_wireless_init(
  22125. +@@ -5603,6 +5645,9 @@ static struct b43_wl *b43_wireless_init(
  22126. hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
  22127. diff --git a/package/kernel/mac80211/patches/860-brcmfmac-add-missing-eth_type_trans-call.patch b/package/kernel/mac80211/patches/860-brcmfmac-add-missing-eth_type_trans-call.patch
  22128. deleted file mode 100644
  22129. index e265354..0000000
  22130. --- a/package/kernel/mac80211/patches/860-brcmfmac-add-missing-eth_type_trans-call.patch
  22131. +++ /dev/null
  22132. @@ -1,26 +0,0 @@
  22133. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  22134. -Subject: [PATCH] brcmfmac: add missing eth_type_trans call
  22135. -MIME-Version: 1.0
  22136. -Content-Type: text/plain; charset=UTF-8
  22137. -Content-Transfer-Encoding: 8bit
  22138. -
  22139. -There are 2 protocols supported by brcmfmac and msgbuf one was missing a
  22140. -proper skb setup before passing it to the netif. This was triggering
  22141. -"NULL pointer dereference".
  22142. -
  22143. -Fixes: 9c349892ccc9 ("brcmfmac: revise handling events in receive path")
  22144. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  22145. ----
  22146. -
  22147. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  22148. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  22149. -@@ -1157,6 +1157,9 @@ brcmf_msgbuf_process_rx_complete(struct
  22150. - brcmu_pkt_buf_free_skb(skb);
  22151. - return;
  22152. - }
  22153. -+
  22154. -+ skb->protocol = eth_type_trans(skb, ifp->ndev);
  22155. -+
  22156. - brcmf_netif_rx(ifp, skb);
  22157. - }
  22158. -
  22159. 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
  22160. new file mode 100644
  22161. index 0000000..ae571c9
  22162. --- /dev/null
  22163. +++ b/package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch
  22164. @@ -0,0 +1,97 @@
  22165. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  22166. +Date: Mon, 8 Jun 2015 16:11:40 +0200
  22167. +Subject: [PATCH] brcmfmac: register wiphy(s) during module_init
  22168. +MIME-Version: 1.0
  22169. +Content-Type: text/plain; charset=UTF-8
  22170. +Content-Transfer-Encoding: 8bit
  22171. +
  22172. +This is needed by OpenWrt which expects all PHYs to be created after
  22173. +module loads successfully.
  22174. +
  22175. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  22176. +---
  22177. +
  22178. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  22179. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  22180. +@@ -1213,6 +1213,7 @@ int __init brcmf_core_init(void)
  22181. + {
  22182. + if (!schedule_work(&brcmf_driver_work))
  22183. + return -EBUSY;
  22184. ++ flush_work(&brcmf_driver_work);
  22185. +
  22186. + return 0;
  22187. + }
  22188. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  22189. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  22190. +@@ -444,6 +444,7 @@ struct brcmf_fw {
  22191. + u16 bus_nr;
  22192. + void (*done)(struct device *dev, const struct firmware *fw,
  22193. + void *nvram_image, u32 nvram_len);
  22194. ++ struct completion *completion;
  22195. + };
  22196. +
  22197. + static void brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx)
  22198. +@@ -478,6 +479,8 @@ static void brcmf_fw_request_nvram_done(
  22199. + goto fail;
  22200. +
  22201. + fwctx->done(fwctx->dev, fwctx->code, nvram, nvram_length);
  22202. ++ if (fwctx->completion)
  22203. ++ complete(fwctx->completion);
  22204. + kfree(fwctx);
  22205. + return;
  22206. +
  22207. +@@ -485,6 +488,8 @@ fail:
  22208. + brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev));
  22209. + release_firmware(fwctx->code);
  22210. + device_release_driver(fwctx->dev);
  22211. ++ if (fwctx->completion)
  22212. ++ complete(fwctx->completion);
  22213. + kfree(fwctx);
  22214. + }
  22215. +
  22216. +@@ -500,6 +505,8 @@ static void brcmf_fw_request_code_done(c
  22217. + /* only requested code so done here */
  22218. + if (!(fwctx->flags & BRCMF_FW_REQUEST_NVRAM)) {
  22219. + fwctx->done(fwctx->dev, fw, NULL, 0);
  22220. ++ if (fwctx->completion)
  22221. ++ complete(fwctx->completion);
  22222. + kfree(fwctx);
  22223. + return;
  22224. + }
  22225. +@@ -517,6 +524,8 @@ static void brcmf_fw_request_code_done(c
  22226. + fail:
  22227. + brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev));
  22228. + device_release_driver(fwctx->dev);
  22229. ++ if (fwctx->completion)
  22230. ++ complete(fwctx->completion);
  22231. + kfree(fwctx);
  22232. + }
  22233. +
  22234. +@@ -528,6 +537,8 @@ int brcmf_fw_get_firmwares_pcie(struct d
  22235. + u16 domain_nr, u16 bus_nr)
  22236. + {
  22237. + struct brcmf_fw *fwctx;
  22238. ++ struct completion completion;
  22239. ++ int err;
  22240. +
  22241. + brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(dev));
  22242. + if (!fw_cb || !code)
  22243. +@@ -548,9 +559,17 @@ int brcmf_fw_get_firmwares_pcie(struct d
  22244. + fwctx->domain_nr = domain_nr;
  22245. + fwctx->bus_nr = bus_nr;
  22246. +
  22247. +- return request_firmware_nowait(THIS_MODULE, true, code, dev,
  22248. ++ init_completion(&completion);
  22249. ++ fwctx->completion = &completion;
  22250. ++
  22251. ++ err = request_firmware_nowait(THIS_MODULE, true, code, dev,
  22252. + GFP_KERNEL, fwctx,
  22253. + brcmf_fw_request_code_done);
  22254. ++ if (!err)
  22255. ++ wait_for_completion_timeout(fwctx->completion,
  22256. ++ msecs_to_jiffies(5000));
  22257. ++ fwctx->completion = NULL;
  22258. ++ return err;
  22259. + }
  22260. +
  22261. + int brcmf_fw_get_firmwares(struct device *dev, u16 flags,
  22262. 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
  22263. deleted file mode 100644
  22264. index f7f44f5..0000000
  22265. --- a/package/kernel/mac80211/patches/861-brcmfmac-register-wiphy-s-during-module_init.patch
  22266. +++ /dev/null
  22267. @@ -1,97 +0,0 @@
  22268. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  22269. -Date: Mon, 8 Jun 2015 16:11:40 +0200
  22270. -Subject: [PATCH] brcmfmac: register wiphy(s) during module_init
  22271. -MIME-Version: 1.0
  22272. -Content-Type: text/plain; charset=UTF-8
  22273. -Content-Transfer-Encoding: 8bit
  22274. -
  22275. -This is needed by OpenWrt which expects all PHYs to be created after
  22276. -module loads successfully.
  22277. -
  22278. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  22279. ----
  22280. -
  22281. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  22282. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  22283. -@@ -1200,6 +1200,7 @@ int __init brcmf_core_init(void)
  22284. - {
  22285. - if (!schedule_work(&brcmf_driver_work))
  22286. - return -EBUSY;
  22287. -+ flush_work(&brcmf_driver_work);
  22288. -
  22289. - return 0;
  22290. - }
  22291. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  22292. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  22293. -@@ -444,6 +444,7 @@ struct brcmf_fw {
  22294. - u16 bus_nr;
  22295. - void (*done)(struct device *dev, const struct firmware *fw,
  22296. - void *nvram_image, u32 nvram_len);
  22297. -+ struct completion *completion;
  22298. - };
  22299. -
  22300. - static void brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx)
  22301. -@@ -478,6 +479,8 @@ static void brcmf_fw_request_nvram_done(
  22302. - goto fail;
  22303. -
  22304. - fwctx->done(fwctx->dev, fwctx->code, nvram, nvram_length);
  22305. -+ if (fwctx->completion)
  22306. -+ complete(fwctx->completion);
  22307. - kfree(fwctx);
  22308. - return;
  22309. -
  22310. -@@ -485,6 +488,8 @@ fail:
  22311. - brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev));
  22312. - release_firmware(fwctx->code);
  22313. - device_release_driver(fwctx->dev);
  22314. -+ if (fwctx->completion)
  22315. -+ complete(fwctx->completion);
  22316. - kfree(fwctx);
  22317. - }
  22318. -
  22319. -@@ -500,6 +505,8 @@ static void brcmf_fw_request_code_done(c
  22320. - /* only requested code so done here */
  22321. - if (!(fwctx->flags & BRCMF_FW_REQUEST_NVRAM)) {
  22322. - fwctx->done(fwctx->dev, fw, NULL, 0);
  22323. -+ if (fwctx->completion)
  22324. -+ complete(fwctx->completion);
  22325. - kfree(fwctx);
  22326. - return;
  22327. - }
  22328. -@@ -517,6 +524,8 @@ static void brcmf_fw_request_code_done(c
  22329. - fail:
  22330. - brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev));
  22331. - device_release_driver(fwctx->dev);
  22332. -+ if (fwctx->completion)
  22333. -+ complete(fwctx->completion);
  22334. - kfree(fwctx);
  22335. - }
  22336. -
  22337. -@@ -528,6 +537,8 @@ int brcmf_fw_get_firmwares_pcie(struct d
  22338. - u16 domain_nr, u16 bus_nr)
  22339. - {
  22340. - struct brcmf_fw *fwctx;
  22341. -+ struct completion completion;
  22342. -+ int err;
  22343. -
  22344. - brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(dev));
  22345. - if (!fw_cb || !code)
  22346. -@@ -548,9 +559,17 @@ int brcmf_fw_get_firmwares_pcie(struct d
  22347. - fwctx->domain_nr = domain_nr;
  22348. - fwctx->bus_nr = bus_nr;
  22349. -
  22350. -- return request_firmware_nowait(THIS_MODULE, true, code, dev,
  22351. -+ init_completion(&completion);
  22352. -+ fwctx->completion = &completion;
  22353. -+
  22354. -+ err = request_firmware_nowait(THIS_MODULE, true, code, dev,
  22355. - GFP_KERNEL, fwctx,
  22356. - brcmf_fw_request_code_done);
  22357. -+ if (!err)
  22358. -+ wait_for_completion_timeout(fwctx->completion,
  22359. -+ msecs_to_jiffies(5000));
  22360. -+ fwctx->completion = NULL;
  22361. -+ return err;
  22362. - }
  22363. -
  22364. - int brcmf_fw_get_firmwares(struct device *dev, u16 flags,
  22365. 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
  22366. new file mode 100644
  22367. index 0000000..8721155
  22368. --- /dev/null
  22369. +++ b/package/kernel/mac80211/patches/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch
  22370. @@ -0,0 +1,50 @@
  22371. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  22372. +Date: Thu, 9 Jul 2015 00:07:59 +0200
  22373. +Subject: [PATCH] brcmfmac: workaround bug with some inconsistent BSSes state
  22374. +MIME-Version: 1.0
  22375. +Content-Type: text/plain; charset=UTF-8
  22376. +Content-Transfer-Encoding: 8bit
  22377. +
  22378. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  22379. +---
  22380. +
  22381. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  22382. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  22383. +@@ -665,9 +665,37 @@ static struct wireless_dev *brcmf_cfg802
  22384. + u32 *flags,
  22385. + struct vif_params *params)
  22386. + {
  22387. ++ struct net_device *dev;
  22388. + struct wireless_dev *wdev;
  22389. + int err;
  22390. +
  22391. ++ /*
  22392. ++ * There is a bug with in-firmware BSS management. When adding virtual
  22393. ++ * interface brcmfmac first tells firmware to create new BSS and then
  22394. ++ * it creates new struct net_device.
  22395. ++ *
  22396. ++ * If creating/registering netdev(ice) fails, BSS remains in some bugged
  22397. ++ * state. It conflicts with existing BSSes by overtaking their auth
  22398. ++ * requests.
  22399. ++ *
  22400. ++ * It results in one BSS (addresss X) sending beacons and another BSS
  22401. ++ * (address Y) replying to authentication requests. This makes interface
  22402. ++ * unusable as AP.
  22403. ++ *
  22404. ++ * To workaround this bug we may try to guess if register_netdev(ice)
  22405. ++ * will fail. The most obvious case is using interface name that already
  22406. ++ * exists. This is actually quite likely with brcmfmac & some user space
  22407. ++ * scripts as brcmfmac doesn't allow deleting virtual interfaces.
  22408. ++ * So this bug can be triggered even by something trivial like:
  22409. ++ * iw dev wlan0 delete
  22410. ++ * iw phy phy0 interface add wlan0 type __ap
  22411. ++ */
  22412. ++ dev = dev_get_by_name(&init_net, name);
  22413. ++ if (dev) {
  22414. ++ dev_put(dev);
  22415. ++ return ERR_PTR(-ENFILE);
  22416. ++ }
  22417. ++
  22418. + brcmf_dbg(TRACE, "enter: %s type %d\n", name, type);
  22419. + err = brcmf_vif_add_validate(wiphy_to_cfg(wiphy), type);
  22420. + if (err) {
  22421. diff --git a/package/kernel/mac80211/patches/862-brcmfmac-Disable-power-management.patch b/package/kernel/mac80211/patches/862-brcmfmac-Disable-power-management.patch
  22422. new file mode 100644
  22423. index 0000000..f301fe1
  22424. --- /dev/null
  22425. +++ b/package/kernel/mac80211/patches/862-brcmfmac-Disable-power-management.patch
  22426. @@ -0,0 +1,27 @@
  22427. +From 66ae1b1750720a33e29792a177b1e696f4f005fb Mon Sep 17 00:00:00 2001
  22428. +From: Phil Elwell <phil@raspberrypi.org>
  22429. +Date: Wed, 9 Mar 2016 17:25:59 +0000
  22430. +Subject: [PATCH] brcmfmac: Disable power management
  22431. +
  22432. +Disable wireless power saving in the brcmfmac WLAN driver. This is a
  22433. +temporary measure until the connectivity loss resulting from power
  22434. +saving is resolved.
  22435. +
  22436. +Signed-off-by: Phil Elwell <phil@raspberrypi.org>
  22437. +---
  22438. + drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c | 2 ++
  22439. + 1 file changed, 2 insertions(+)
  22440. +
  22441. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  22442. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  22443. +@@ -2783,6 +2783,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip
  22444. + * preference in cfg struct to apply this to
  22445. + * FW later while initializing the dongle
  22446. + */
  22447. ++#if defined(CONFIG_BCM2708) || defined(CONFIG_BCM2709)
  22448. ++ pr_info("power management disabled\n");
  22449. ++ enabled = false;
  22450. ++#endif
  22451. + cfg->pwr_save = enabled;
  22452. + if (!check_vif_up(ifp->vif)) {
  22453. +
  22454. 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
  22455. deleted file mode 100644
  22456. index 1e440c0..0000000
  22457. --- a/package/kernel/mac80211/patches/862-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch
  22458. +++ /dev/null
  22459. @@ -1,50 +0,0 @@
  22460. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  22461. -Date: Thu, 9 Jul 2015 00:07:59 +0200
  22462. -Subject: [PATCH] brcmfmac: workaround bug with some inconsistent BSSes state
  22463. -MIME-Version: 1.0
  22464. -Content-Type: text/plain; charset=UTF-8
  22465. -Content-Transfer-Encoding: 8bit
  22466. -
  22467. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  22468. ----
  22469. -
  22470. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  22471. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  22472. -@@ -651,9 +651,37 @@ static struct wireless_dev *brcmf_cfg802
  22473. - u32 *flags,
  22474. - struct vif_params *params)
  22475. - {
  22476. -+ struct net_device *dev;
  22477. - struct wireless_dev *wdev;
  22478. - int err;
  22479. -
  22480. -+ /*
  22481. -+ * There is a bug with in-firmware BSS management. When adding virtual
  22482. -+ * interface brcmfmac first tells firmware to create new BSS and then
  22483. -+ * it creates new struct net_device.
  22484. -+ *
  22485. -+ * If creating/registering netdev(ice) fails, BSS remains in some bugged
  22486. -+ * state. It conflicts with existing BSSes by overtaking their auth
  22487. -+ * requests.
  22488. -+ *
  22489. -+ * It results in one BSS (addresss X) sending beacons and another BSS
  22490. -+ * (address Y) replying to authentication requests. This makes interface
  22491. -+ * unusable as AP.
  22492. -+ *
  22493. -+ * To workaround this bug we may try to guess if register_netdev(ice)
  22494. -+ * will fail. The most obvious case is using interface name that already
  22495. -+ * exists. This is actually quite likely with brcmfmac & some user space
  22496. -+ * scripts as brcmfmac doesn't allow deleting virtual interfaces.
  22497. -+ * So this bug can be triggered even by something trivial like:
  22498. -+ * iw dev wlan0 delete
  22499. -+ * iw phy phy0 interface add wlan0 type __ap
  22500. -+ */
  22501. -+ dev = dev_get_by_name(&init_net, name);
  22502. -+ if (dev) {
  22503. -+ dev_put(dev);
  22504. -+ return ERR_PTR(-ENFILE);
  22505. -+ }
  22506. -+
  22507. - brcmf_dbg(TRACE, "enter: %s type %d\n", name, type);
  22508. - err = brcmf_vif_add_validate(wiphy_to_cfg(wiphy), type);
  22509. - if (err) {
  22510. 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
  22511. index f2e21ea..be210f2 100644
  22512. --- a/package/kernel/mac80211/patches/910-01-add-support-for-mt7620.patch
  22513. +++ b/package/kernel/mac80211/patches/910-01-add-support-for-mt7620.patch
  22514. @@ -1184,7 +1184,7 @@
  22515. break;
  22516. default:
  22517. rt2x00_err(rt2x00dev, "Invalid RF chipset 0x%04x detected\n",
  22518. -@@ -8423,6 +9363,7 @@ static int rt2800_probe_hw_mode(struct r
  22519. +@@ -8427,6 +9367,7 @@ static int rt2800_probe_hw_mode(struct r
  22520. case RF5372:
  22521. case RF5390:
  22522. case RF5392:
  22523. @@ -1192,7 +1192,7 @@
  22524. spec->num_channels = 14;
  22525. if (spec->clk_is_20mhz)
  22526. spec->channels = rf_vals_xtal20mhz_3x;
  22527. -@@ -8563,6 +9504,7 @@ static int rt2800_probe_hw_mode(struct r
  22528. +@@ -8567,6 +9508,7 @@ static int rt2800_probe_hw_mode(struct r
  22529. case RF5372:
  22530. case RF5390:
  22531. case RF5392:
  22532. diff --git a/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch b/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
  22533. index 8c6d720..e842d61 100644
  22534. --- a/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
  22535. +++ b/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
  22536. @@ -14,7 +14,7 @@ Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
  22537. --- a/drivers/net/wireless/ath/ath10k/core.c
  22538. +++ b/drivers/net/wireless/ath/ath10k/core.c
  22539. -@@ -1914,6 +1914,16 @@ int ath10k_core_register(struct ath10k *
  22540. +@@ -2107,6 +2107,16 @@ int ath10k_core_register(struct ath10k *
  22541. ar->chip_id = chip_id;
  22542. queue_work(ar->workqueue, &ar->register_work);
  22543. 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
  22544. index 281b447..a501b99 100644
  22545. --- a/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch
  22546. +++ b/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch
  22547. @@ -1,6 +1,6 @@
  22548. --- a/drivers/net/wireless/ath/ath10k/mac.c
  22549. +++ b/drivers/net/wireless/ath/ath10k/mac.c
  22550. -@@ -7141,6 +7141,21 @@ struct ath10k_vif *ath10k_get_arvif(stru
  22551. +@@ -7742,6 +7742,21 @@ struct ath10k_vif *ath10k_get_arvif(stru
  22552. return arvif_iter.arvif;
  22553. }
  22554. @@ -22,11 +22,11 @@
  22555. int ath10k_mac_register(struct ath10k *ar)
  22556. {
  22557. static const u32 cipher_suites[] = {
  22558. -@@ -7357,6 +7372,12 @@ int ath10k_mac_register(struct ath10k *a
  22559. +@@ -7975,6 +7990,12 @@ int ath10k_mac_register(struct ath10k *a
  22560. ar->hw->wiphy->cipher_suites = cipher_suites;
  22561. ar->hw->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
  22562. -+#if CPTCFG_MAC80211_LEDS
  22563. ++#ifdef CPTCFG_MAC80211_LEDS
  22564. + ieee80211_create_tpt_led_trigger(ar->hw,
  22565. + IEEE80211_TPT_LEDTRIG_FL_RADIO, ath10k_tpt_blink,
  22566. + ARRAY_SIZE(ath10k_tpt_blink));
  22567. diff --git a/package/kernel/mac80211/patches/936-ath10k_skip_otp_check.patch b/package/kernel/mac80211/patches/936-ath10k_skip_otp_check.patch
  22568. new file mode 100644
  22569. index 0000000..596ef98
  22570. --- /dev/null
  22571. +++ b/package/kernel/mac80211/patches/936-ath10k_skip_otp_check.patch
  22572. @@ -0,0 +1,51 @@
  22573. +--- a/drivers/net/wireless/ath/ath10k/core.c
  22574. ++++ b/drivers/net/wireless/ath/ath10k/core.c
  22575. +@@ -1243,9 +1243,6 @@ static int ath10k_core_fetch_firmware_fi
  22576. + {
  22577. + int ret;
  22578. +
  22579. +- /* calibration file is optional, don't check for any errors */
  22580. +- ath10k_fetch_cal_file(ar);
  22581. +-
  22582. + ar->fw_api = 5;
  22583. + ath10k_dbg(ar, ATH10K_DBG_BOOT, "trying fw api %d\n", ar->fw_api);
  22584. +
  22585. +@@ -1944,7 +1941,7 @@ EXPORT_SYMBOL(ath10k_core_stop);
  22586. + static int ath10k_core_probe_fw(struct ath10k *ar)
  22587. + {
  22588. + struct bmi_target_info target_info;
  22589. +- int ret = 0;
  22590. ++ int calret, ret = 0;
  22591. +
  22592. + ret = ath10k_hif_power_up(ar);
  22593. + if (ret) {
  22594. +@@ -1968,6 +1965,9 @@ static int ath10k_core_probe_fw(struct a
  22595. + goto err_power_down;
  22596. + }
  22597. +
  22598. ++ /* calibration file is optional, don't check for any errors */
  22599. ++ calret = ath10k_fetch_cal_file(ar);
  22600. ++
  22601. + ret = ath10k_core_fetch_firmware_files(ar);
  22602. + if (ret) {
  22603. + ath10k_err(ar, "could not fetch firmware files (%d)\n", ret);
  22604. +@@ -1990,11 +1990,14 @@ static int ath10k_core_probe_fw(struct a
  22605. + "could not load pre cal data: %d\n", ret);
  22606. + }
  22607. +
  22608. +- ret = ath10k_core_get_board_id_from_otp(ar);
  22609. +- if (ret && ret != -EOPNOTSUPP) {
  22610. +- ath10k_err(ar, "failed to get board id from otp: %d\n",
  22611. +- ret);
  22612. +- goto err_free_firmware_files;
  22613. ++ /* otp and board file not needed if calibration data is present */
  22614. ++ if (calret) {
  22615. ++ ret = ath10k_core_get_board_id_from_otp(ar);
  22616. ++ if (ret && ret != -EOPNOTSUPP) {
  22617. ++ ath10k_err(ar, "failed to get board id from otp: %d\n",
  22618. ++ ret);
  22619. ++ goto err_free_firmware_files;
  22620. ++ }
  22621. + }
  22622. +
  22623. + ret = ath10k_core_fetch_board_file(ar);
  22624. diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile
  22625. index e49dd48..bd851e6 100644
  22626. --- a/package/kernel/mt76/Makefile
  22627. +++ b/package/kernel/mt76/Makefile
  22628. @@ -1,7 +1,7 @@
  22629. include $(TOPDIR)/rules.mk
  22630. PKG_NAME:=mt76
  22631. -PKG_VERSION:=2016-03-03
  22632. +PKG_VERSION:=2016-08-25
  22633. PKG_RELEASE=1
  22634. PKG_LICENSE:=GPLv2
  22635. @@ -10,23 +10,26 @@ PKG_LICENSE_FILES:=
  22636. PKG_SOURCE_URL:=https://github.com/openwrt/mt76
  22637. PKG_SOURCE_PROTO:=git
  22638. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  22639. -PKG_SOURCE_VERSION:=310d420178c86e253a172413da30ecf479b64251
  22640. +PKG_SOURCE_VERSION:=c3127d2acc354b4a27c8604716b0591093601971
  22641. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
  22642. -PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  22643. +PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  22644. PKG_BUILD_PARALLEL:=1
  22645. +STAMP_CONFIGURED_DEPENDS := $(STAGING_DIR)/usr/include/mac80211-backport/backport/autoconf.h
  22646. +
  22647. include $(INCLUDE_DIR)/kernel.mk
  22648. include $(INCLUDE_DIR)/package.mk
  22649. define KernelPackage/mt76
  22650. SUBMENU:=Wireless Drivers
  22651. - TITLE:=MediaTek MT76x2 wireless driver
  22652. - DEPENDS:=+kmod-mac80211 +@DRIVER_11N_SUPPORT @PCI_SUPPORT
  22653. + TITLE:=MediaTek MT76x2/MT7603 wireless driver
  22654. + DEPENDS:=+kmod-mac80211 +@DRIVER_11N_SUPPORT @PCI_SUPPORT @!LINUX_3_18
  22655. FILES:=\
  22656. $(PKG_BUILD_DIR)/mt76.ko \
  22657. - $(PKG_BUILD_DIR)/mt76x2e.ko
  22658. - AUTOLOAD:=$(call AutoLoad,50,mac80211 mt76 mt76x2e)
  22659. + $(PKG_BUILD_DIR)/mt76x2e.ko \
  22660. + $(PKG_BUILD_DIR)/mt7603e.ko
  22661. + AUTOLOAD:=$(call AutoLoad,50,mac80211 mt76 mt76x2e mt7603e)
  22662. endef
  22663. NOSTDINC_FLAGS = \
  22664. @@ -54,6 +57,12 @@ endef
  22665. define KernelPackage/mt76/install
  22666. $(INSTALL_DIR) $(1)/lib/firmware
  22667. cp \
  22668. + $(if $(CONFIG_TARGET_ramips_mt7628) || $(CONFIG_TARGET_ramips_mt7688), \
  22669. + $(PKG_BUILD_DIR)/firmware/mt7628_e1.bin \
  22670. + $(PKG_BUILD_DIR)/firmware/mt7628_e2.bin \
  22671. + ) \
  22672. + $(PKG_BUILD_DIR)/firmware/mt7603_e1.bin \
  22673. + $(PKG_BUILD_DIR)/firmware/mt7603_e2.bin \
  22674. $(PKG_BUILD_DIR)/firmware/mt7662_rom_patch.bin \
  22675. $(PKG_BUILD_DIR)/firmware/mt7662.bin \
  22676. $(1)/lib/firmware
  22677. diff --git a/package/kernel/mwlwifi/Makefile b/package/kernel/mwlwifi/Makefile
  22678. index f59943d..b36486d 100644
  22679. --- a/package/kernel/mwlwifi/Makefile
  22680. +++ b/package/kernel/mwlwifi/Makefile
  22681. @@ -8,7 +8,7 @@
  22682. include $(TOPDIR)/rules.mk
  22683. PKG_NAME:=mwlwifi
  22684. -PKG_VERSION:=10.3.0.18-20160804
  22685. +PKG_VERSION:=10.3.0.18-20160823-1
  22686. PKG_RELEASE=1
  22687. PKG_LICENSE:=ISC
  22688. @@ -17,7 +17,7 @@ PKG_LICENSE_FILES:=
  22689. PKG_SOURCE_URL:=https://github.com/kaloz/mwlwifi
  22690. PKG_SOURCE_PROTO:=git
  22691. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  22692. -PKG_SOURCE_VERSION:=d48847cc83954930fdcd98818bbf33e75707b8e1
  22693. +PKG_SOURCE_VERSION:=af606563453c819fac156faf2b15b9caef844329
  22694. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
  22695. PKG_MAINTAINER:=Imre Kaloz <kaloz@openwrt.org>
  22696. @@ -29,7 +29,7 @@ include $(INCLUDE_DIR)/package.mk
  22697. define KernelPackage/mwlwifi
  22698. SUBMENU:=Wireless Drivers
  22699. TITLE:=Marvell 88W8864 wireless driver
  22700. - DEPENDS:=+kmod-mac80211 +@DRIVER_11N_SUPPORT @PCI_SUPPORT @TARGET_mvebu
  22701. + DEPENDS:=+kmod-mac80211 +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT @PCI_SUPPORT @TARGET_mvebu
  22702. FILES:=$(PKG_BUILD_DIR)/mwlwifi.ko
  22703. AUTOLOAD:=$(call AutoLoad,50,mac80211 mwlwifi)
  22704. endef
  22705. diff --git a/package/network/services/hostapd/Config.in b/package/network/services/hostapd/Config.in
  22706. index aee2a15..645888e 100644
  22707. --- a/package/network/services/hostapd/Config.in
  22708. +++ b/package/network/services/hostapd/Config.in
  22709. @@ -10,11 +10,10 @@ config WPA_SUPPLICANT_NO_TIMESTAMP_CHECK
  22710. choice
  22711. prompt "Choose TLS provider"
  22712. default WPA_SUPPLICANT_INTERNAL
  22713. - depends on PACKAGE_wpa-supplicant || PACKAGE_wpa-supplicant-mesh || PACKAGE_wpad || PACKAGE_wpad-mesh
  22714. + depends on PACKAGE_wpa-supplicant || PACKAGE_wpad
  22715. config WPA_SUPPLICANT_INTERNAL
  22716. bool "internal"
  22717. - depends on PACKAGE_wpa-supplicant || PACKAGE_wpad
  22718. config WPA_SUPPLICANT_OPENSSL
  22719. bool "openssl"
  22720. diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile
  22721. index 8e706dc..5caf3e3 100644
  22722. --- a/package/network/services/hostapd/Makefile
  22723. +++ b/package/network/services/hostapd/Makefile
  22724. @@ -7,18 +7,18 @@
  22725. include $(TOPDIR)/rules.mk
  22726. PKG_NAME:=hostapd
  22727. -PKG_VERSION:=2015-03-25
  22728. +PKG_VERSION:=2016-06-15
  22729. PKG_RELEASE:=1
  22730. -PKG_REV:=8278138e679174b1ec8af7f169c2810a8888e202
  22731. +PKG_REV:=31d3692fe5d56c05753ed4a70c7943979e1d29e7
  22732. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
  22733. -PKG_SOURCE_URL:=git://w1.fi/srv/git/hostap.git
  22734. +PKG_SOURCE_URL:=http://w1.fi/hostap.git
  22735. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  22736. PKG_SOURCE_VERSION:=$(PKG_REV)
  22737. PKG_SOURCE_PROTO:=git
  22738. # PKG_MIRROR_MD5SUM:=4e7c1f97edd7514535056fce54ae053a
  22739. -PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  22740. +PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  22741. PKG_LICENSE:=BSD-3-Clause
  22742. PKG_BUILD_PARALLEL:=1
  22743. @@ -29,7 +29,6 @@ PKG_CONFIG_DEPENDS:= \
  22744. CONFIG_PACKAGE_kmod-cfg80211 \
  22745. CONFIG_PACKAGE_hostapd \
  22746. CONFIG_PACKAGE_hostapd-mini \
  22747. - CONFIG_PACKAGE_kmod-hostap \
  22748. CONFIG_WPA_RFKILL_SUPPORT \
  22749. CONFIG_DRIVER_WEXT_SUPPORT \
  22750. CONFIG_DRIVER_11N_SUPPORT
  22751. @@ -40,6 +39,10 @@ LOCAL_TYPE=$(strip \
  22752. hostapd \
  22753. )))
  22754. LOCAL_VARIANT=$(patsubst wpad-%,%,$(patsubst supplicant-%,%,$(BUILD_VARIANT)))
  22755. +CONFIG_VARIANT:=$(LOCAL_VARIANT)
  22756. +ifeq ($(LOCAL_VARIANT),mesh)
  22757. + CONFIG_VARIANT:=full
  22758. +endif
  22759. ifeq ($(LOCAL_TYPE),supplicant)
  22760. ifeq ($(LOCAL_VARIANT),full)
  22761. @@ -47,10 +50,6 @@ ifeq ($(LOCAL_TYPE),supplicant)
  22762. CONFIG_WPA_SUPPLICANT_INTERNAL \
  22763. CONFIG_WPA_SUPPLICANT_OPENSSL
  22764. endif
  22765. - ifeq ($(LOCAL_VARIANT),mesh)
  22766. - PKG_CONFIG_DEPENDS += \
  22767. - CONFIG_WPA_SUPPLICANT_OPENSSL
  22768. - endif
  22769. endif
  22770. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
  22771. @@ -66,7 +65,6 @@ endif
  22772. DRIVER_MAKEOPTS= \
  22773. CONFIG_ACS=$(CONFIG_PACKAGE_kmod-cfg80211) \
  22774. CONFIG_DRIVER_NL80211=$(CONFIG_PACKAGE_kmod-cfg80211) \
  22775. - CONFIG_DRIVER_HOSTAP=$(CONFIG_PACKAGE_kmod-hostap) \
  22776. CONFIG_IEEE80211N=$(HOSTAPD_IEEE80211N) \
  22777. CONFIG_DRIVER_WEXT=$(CONFIG_DRIVER_WEXT_SUPPORT) \
  22778. @@ -82,7 +80,7 @@ ifneq ($(LOCAL_TYPE),hostapd)
  22779. endif
  22780. endif
  22781. ifeq ($(LOCAL_VARIANT),mesh)
  22782. - DRIVER_MAKEOPTS += CONFIG_TLS=openssl
  22783. + DRIVER_MAKEOPTS += CONFIG_TLS=openssl CONFIG_AP=y CONFIG_SAE=y CONFIG_MESH=y
  22784. TARGET_LDFLAGS += -lcrypto -lssl
  22785. endif
  22786. ifdef CONFIG_WPA_SUPPLICANT_NO_TIMESTAMP_CHECK
  22787. @@ -177,8 +175,7 @@ endef
  22788. define Package/wpad-mesh
  22789. $(call Package/wpad/Default)
  22790. TITLE+= (with 802.11s mesh and SAE support)
  22791. - DEPENDS:=$(DRV_DEPENDS) +libubus +libopenssl +@CONFIG_WPA_SUPPLICANT_OPENSSL @(!TARGET_uml||BROKEN)
  22792. - CONFLICTS:=@WPA_SUPPLICANT_INTERNAL
  22793. + DEPENDS:=$(DRV_DEPENDS) +libubus +PACKAGE_wpad-mesh:libopenssl @(!TARGET_uml||BROKEN)
  22794. VARIANT:=wpad-mesh
  22795. endef
  22796. @@ -257,12 +254,6 @@ define Package/hostapd-common
  22797. CATEGORY:=Network
  22798. endef
  22799. -define Package/hostapd-common-old
  22800. - TITLE:=hostapd/wpa_supplicant common support files (legacy drivers)
  22801. - SECTION:=net
  22802. - CATEGORY:=Network
  22803. -endef
  22804. -
  22805. define Package/eapol-test
  22806. TITLE:=802.1x authentication test utility
  22807. SECTION:=net
  22808. @@ -284,10 +275,10 @@ endif
  22809. define Build/Configure
  22810. $(Build/Configure/rebuild)
  22811. - $(if $(wildcard ./files/hostapd-$(LOCAL_VARIANT).config), \
  22812. - $(CP) ./files/hostapd-$(LOCAL_VARIANT).config $(PKG_BUILD_DIR)/hostapd/.config \
  22813. + $(if $(wildcard ./files/hostapd-$(CONFIG_VARIANT).config), \
  22814. + $(CP) ./files/hostapd-$(CONFIG_VARIANT).config $(PKG_BUILD_DIR)/hostapd/.config \
  22815. )
  22816. - $(CP) ./files/wpa_supplicant-$(LOCAL_VARIANT).config $(PKG_BUILD_DIR)/wpa_supplicant/.config
  22817. + $(CP) ./files/wpa_supplicant-$(CONFIG_VARIANT).config $(PKG_BUILD_DIR)/wpa_supplicant/.config
  22818. endef
  22819. TARGET_CPPFLAGS := \
  22820. @@ -379,12 +370,6 @@ define Package/hostapd-common/install
  22821. $(INSTALL_DATA) ./files/netifd.sh $(1)/lib/netifd/hostapd.sh
  22822. endef
  22823. -define Package/hostapd-common-old/install
  22824. - $(INSTALL_DIR) $(1)/lib/wifi
  22825. - $(INSTALL_DATA) ./files/hostapd.sh $(1)/lib/wifi/hostapd.sh
  22826. - $(INSTALL_DATA) ./files/wpa_supplicant.sh $(1)/lib/wifi/wpa_supplicant.sh
  22827. -endef
  22828. -
  22829. define Package/hostapd/install
  22830. $(call Install/hostapd,$(1))
  22831. $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd $(1)/usr/sbin/
  22832. @@ -442,5 +427,4 @@ $(eval $(call BuildPackage,wpa-supplicant-p2p))
  22833. $(eval $(call BuildPackage,wpa-cli))
  22834. $(eval $(call BuildPackage,hostapd-utils))
  22835. $(eval $(call BuildPackage,hostapd-common))
  22836. -$(eval $(call BuildPackage,hostapd-common-old))
  22837. $(eval $(call BuildPackage,eapol-test))
  22838. diff --git a/package/network/services/hostapd/files/hostapd-full.config b/package/network/services/hostapd/files/hostapd-full.config
  22839. index f1b2655..e388109 100644
  22840. --- a/package/network/services/hostapd/files/hostapd-full.config
  22841. +++ b/package/network/services/hostapd/files/hostapd-full.config
  22842. @@ -10,7 +10,7 @@
  22843. # to override previous values of the variables.
  22844. # Driver interface for Host AP driver
  22845. -CONFIG_DRIVER_HOSTAP=y
  22846. +#CONFIG_DRIVER_HOSTAP=y
  22847. # Driver interface for wired authenticator
  22848. CONFIG_DRIVER_WIRED=y
  22849. @@ -53,6 +53,9 @@ CONFIG_PEERKEY=y
  22850. # Integrated EAP server
  22851. CONFIG_EAP=y
  22852. +# EAP-FAST for the integrated EAP server
  22853. +CONFIG_EAP_FAST=y
  22854. +
  22855. # EAP-MD5 for the integrated EAP server
  22856. CONFIG_EAP_MD5=y
  22857. diff --git a/package/network/services/hostapd/files/hostapd-mini.config b/package/network/services/hostapd/files/hostapd-mini.config
  22858. index 118d97c..8baff18 100644
  22859. --- a/package/network/services/hostapd/files/hostapd-mini.config
  22860. +++ b/package/network/services/hostapd/files/hostapd-mini.config
  22861. @@ -10,7 +10,7 @@
  22862. # to override previous values of the variables.
  22863. # Driver interface for Host AP driver
  22864. -CONFIG_DRIVER_HOSTAP=y
  22865. +#CONFIG_DRIVER_HOSTAP=y
  22866. # Driver interface for wired authenticator
  22867. CONFIG_DRIVER_WIRED=y
  22868. diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh
  22869. deleted file mode 100644
  22870. index 7aec7ad..0000000
  22871. --- a/package/network/services/hostapd/files/hostapd.sh
  22872. +++ /dev/null
  22873. @@ -1,394 +0,0 @@
  22874. -hostapd_set_bss_options() {
  22875. - local var="$1"
  22876. - local vif="$2"
  22877. - local enc wep_rekey wpa_group_rekey wpa_pair_rekey wpa_master_rekey wps_possible wpa_key_mgmt
  22878. -
  22879. - config_get enc "$vif" encryption "none"
  22880. - config_get wep_rekey "$vif" wep_rekey # 300
  22881. - config_get wpa_group_rekey "$vif" wpa_group_rekey # 300
  22882. - config_get wpa_pair_rekey "$vif" wpa_pair_rekey # 300
  22883. - config_get wpa_master_rekey "$vif" wpa_master_rekey # 640
  22884. - config_get_bool ap_isolate "$vif" isolate 0
  22885. - config_get_bool disassoc_low_ack "$vif" disassoc_low_ack 1
  22886. - config_get max_num_sta "$vif" max_num_sta 0
  22887. - config_get max_inactivity "$vif" max_inactivity 0
  22888. - config_get_bool preamble "$vif" short_preamble 1
  22889. -
  22890. - config_get device "$vif" device
  22891. - config_get hwmode "$device" hwmode
  22892. - config_get phy "$device" phy
  22893. -
  22894. - append "$var" "ctrl_interface=/var/run/hostapd-$phy" "$N"
  22895. -
  22896. - if [ "$ap_isolate" -gt 0 ]; then
  22897. - append "$var" "ap_isolate=$ap_isolate" "$N"
  22898. - fi
  22899. - if [ "$max_num_sta" -gt 0 ]; then
  22900. - append "$var" "max_num_sta=$max_num_sta" "$N"
  22901. - fi
  22902. - if [ "$max_inactivity" -gt 0 ]; then
  22903. - append "$var" "ap_max_inactivity=$max_inactivity" "$N"
  22904. - fi
  22905. - append "$var" "disassoc_low_ack=$disassoc_low_ack" "$N"
  22906. - if [ "$preamble" -gt 0 ]; then
  22907. - append "$var" "preamble=$preamble" "$N"
  22908. - fi
  22909. -
  22910. - # Examples:
  22911. - # psk-mixed/tkip => WPA1+2 PSK, TKIP
  22912. - # wpa-psk2/tkip+aes => WPA2 PSK, CCMP+TKIP
  22913. - # wpa2/tkip+aes => WPA2 RADIUS, CCMP+TKIP
  22914. - # ...
  22915. -
  22916. - # TODO: move this parsing function somewhere generic, so that
  22917. - # later it can be reused by drivers that don't use hostapd
  22918. -
  22919. - # crypto defaults: WPA2 vs WPA1
  22920. - case "$enc" in
  22921. - wpa2*|*psk2*)
  22922. - wpa=2
  22923. - crypto="CCMP"
  22924. - ;;
  22925. - *mixed*)
  22926. - wpa=3
  22927. - crypto="CCMP TKIP"
  22928. - ;;
  22929. - *)
  22930. - wpa=1
  22931. - crypto="TKIP"
  22932. - ;;
  22933. - esac
  22934. -
  22935. - # explicit override for crypto setting
  22936. - case "$enc" in
  22937. - *tkip+aes|*tkip+ccmp|*aes+tkip|*ccmp+tkip) crypto="CCMP TKIP";;
  22938. - *aes|*ccmp) crypto="CCMP";;
  22939. - *tkip) crypto="TKIP";;
  22940. - esac
  22941. -
  22942. - # enforce CCMP for 11ng and 11na
  22943. - case "$hwmode:$crypto" in
  22944. - *ng:TKIP|*na:TKIP) crypto="CCMP TKIP";;
  22945. - esac
  22946. -
  22947. - # use crypto/auth settings for building the hostapd config
  22948. - case "$enc" in
  22949. - none)
  22950. - wps_possible=1
  22951. - wpa=0
  22952. - crypto=
  22953. - # Here we make the assumption that if we're in open mode
  22954. - # with WPS enabled, we got to be in unconfigured state.
  22955. - wps_not_configured=1
  22956. - ;;
  22957. - *psk*)
  22958. - config_get psk "$vif" key
  22959. - if [ ${#psk} -eq 64 ]; then
  22960. - append "$var" "wpa_psk=$psk" "$N"
  22961. - else
  22962. - append "$var" "wpa_passphrase=$psk" "$N"
  22963. - fi
  22964. - wps_possible=1
  22965. - [ -n "$wpa_group_rekey" ] && append "$var" "wpa_group_rekey=$wpa_group_rekey" "$N"
  22966. - [ -n "$wpa_pair_rekey" ] && append "$var" "wpa_ptk_rekey=$wpa_pair_rekey" "$N"
  22967. - [ -n "$wpa_master_rekey" ] && append "$var" "wpa_gmk_rekey=$wpa_master_rekey" "$N"
  22968. - append wpa_key_mgmt "WPA-PSK"
  22969. - ;;
  22970. - *wpa*|*8021x*)
  22971. - # required fields? formats?
  22972. - # hostapd is particular, maybe a default configuration for failures
  22973. - config_get auth_server "$vif" auth_server
  22974. - [ -z "$auth_server" ] && config_get auth_server "$vif" server
  22975. - append "$var" "auth_server_addr=$auth_server" "$N"
  22976. - config_get auth_port "$vif" auth_port
  22977. - [ -z "$auth_port" ] && config_get auth_port "$vif" port
  22978. - auth_port=${auth_port:-1812}
  22979. - append "$var" "auth_server_port=$auth_port" "$N"
  22980. - config_get auth_secret "$vif" auth_secret
  22981. - [ -z "$auth_secret" ] && config_get auth_secret "$vif" key
  22982. - append "$var" "auth_server_shared_secret=$auth_secret" "$N"
  22983. - # You don't really want to enable this unless you are doing
  22984. - # some corner case testing or are using OpenWrt as a work around
  22985. - # for some systematic issues.
  22986. - config_get_bool auth_cache "$vif" auth_cache 0
  22987. - config_get rsn_preauth "$vif" rsn_preauth
  22988. - [ "$auth_cache" -gt 0 ] || [[ "$rsn_preauth" = 1 ]] || append "$var" "disable_pmksa_caching=1" "$N"
  22989. - [ "$auth_cache" -gt 0 ] || [[ "$rsn_preauth" = 1 ]] || append "$var" "okc=0" "$N"
  22990. - config_get acct_server "$vif" acct_server
  22991. - [ -n "$acct_server" ] && append "$var" "acct_server_addr=$acct_server" "$N"
  22992. - config_get acct_port "$vif" acct_port
  22993. - [ -n "$acct_port" ] && acct_port=${acct_port:-1813}
  22994. - [ -n "$acct_port" ] && append "$var" "acct_server_port=$acct_port" "$N"
  22995. - config_get acct_secret "$vif" acct_secret
  22996. - [ -n "$acct_secret" ] && append "$var" "acct_server_shared_secret=$acct_secret" "$N"
  22997. - config_get eap_reauth_period "$vif" eap_reauth_period
  22998. - [ -n "$eap_reauth_period" ] && append "$var" "eap_reauth_period=$eap_reauth_period" "$N"
  22999. - config_get dae_client "$vif" dae_client
  23000. - config_get dae_secret "$vif" dae_secret
  23001. - [ -n "$dae_client" -a -n "$dae_secret" ] && {
  23002. - config_get dae_port "$vif" dae_port
  23003. - append "$var" "radius_das_port=${dae_port:-3799}" "$N"
  23004. - append "$var" "radius_das_client=$dae_client $dae_secret" "$N"
  23005. - }
  23006. - config_get ownip "$vif" ownip
  23007. - append "$var" "own_ip_addr=$ownip" "$N"
  23008. - append "$var" "eapol_key_index_workaround=1" "$N"
  23009. - append "$var" "ieee8021x=1" "$N"
  23010. - append wpa_key_mgmt "WPA-EAP"
  23011. - [ -n "$wpa_group_rekey" ] && append "$var" "wpa_group_rekey=$wpa_group_rekey" "$N"
  23012. - [ -n "$wpa_pair_rekey" ] && append "$var" "wpa_ptk_rekey=$wpa_pair_rekey" "$N"
  23013. - [ -n "$wpa_master_rekey" ] && append "$var" "wpa_gmk_rekey=$wpa_master_rekey" "$N"
  23014. - ;;
  23015. - *wep*)
  23016. - config_get key "$vif" key
  23017. - key="${key:-1}"
  23018. - case "$key" in
  23019. - [1234])
  23020. - for idx in 1 2 3 4; do
  23021. - local zidx
  23022. - zidx=$(($idx - 1))
  23023. - config_get ckey "$vif" "key${idx}"
  23024. - [ -n "$ckey" ] && \
  23025. - append "$var" "wep_key${zidx}=$(prepare_key_wep "$ckey")" "$N"
  23026. - done
  23027. - append "$var" "wep_default_key=$((key - 1))" "$N"
  23028. - ;;
  23029. - *)
  23030. - append "$var" "wep_key0=$(prepare_key_wep "$key")" "$N"
  23031. - append "$var" "wep_default_key=0" "$N"
  23032. - [ -n "$wep_rekey" ] && append "$var" "wep_rekey_period=$wep_rekey" "$N"
  23033. - ;;
  23034. - esac
  23035. - case "$enc" in
  23036. - *shared*)
  23037. - auth_algs=2
  23038. - ;;
  23039. - *mixed*)
  23040. - auth_algs=3
  23041. - ;;
  23042. - esac
  23043. - wpa=0
  23044. - crypto=
  23045. - ;;
  23046. - *)
  23047. - wpa=0
  23048. - crypto=
  23049. - ;;
  23050. - esac
  23051. - append "$var" "auth_algs=${auth_algs:-1}" "$N"
  23052. - append "$var" "wpa=$wpa" "$N"
  23053. - [ -n "$crypto" ] && append "$var" "wpa_pairwise=$crypto" "$N"
  23054. - [ -n "$wpa_group_rekey" ] && append "$var" "wpa_group_rekey=$wpa_group_rekey" "$N"
  23055. -
  23056. - config_get ssid "$vif" ssid
  23057. - config_get bridge "$vif" bridge
  23058. - config_get ieee80211d "$vif" ieee80211d
  23059. - config_get iapp_interface "$vif" iapp_interface
  23060. -
  23061. - config_get_bool wps_pbc "$vif" wps_pushbutton 0
  23062. - config_get_bool wps_label "$vif" wps_label 0
  23063. -
  23064. - config_get config_methods "$vif" wps_config
  23065. - [ "$wps_pbc" -gt 0 ] && append config_methods push_button
  23066. -
  23067. - [ -n "$wps_possible" -a -n "$config_methods" ] && {
  23068. - config_get device_type "$vif" wps_device_type "6-0050F204-1"
  23069. - config_get device_name "$vif" wps_device_name "OpenWrt AP"
  23070. - config_get manufacturer "$vif" wps_manufacturer "openwrt.org"
  23071. - config_get wps_pin "$vif" wps_pin
  23072. -
  23073. - config_get_bool ext_registrar "$vif" ext_registrar 0
  23074. - [ "$ext_registrar" -gt 0 -a -n "$bridge" ] && append "$var" "upnp_iface=$bridge" "$N"
  23075. -
  23076. - append "$var" "eap_server=1" "$N"
  23077. - [ -n "$wps_pin" ] && append "$var" "ap_pin=$wps_pin" "$N"
  23078. - append "$var" "wps_state=${wps_not_configured:-2}" "$N"
  23079. - append "$var" "ap_setup_locked=0" "$N"
  23080. - append "$var" "device_type=$device_type" "$N"
  23081. - append "$var" "device_name=$device_name" "$N"
  23082. - append "$var" "manufacturer=$manufacturer" "$N"
  23083. - append "$var" "config_methods=$config_methods" "$N"
  23084. - }
  23085. -
  23086. - append "$var" "ssid=$ssid" "$N"
  23087. - [ -n "$bridge" ] && append "$var" "bridge=$bridge" "$N"
  23088. - [ -n "$ieee80211d" ] && append "$var" "ieee80211d=$ieee80211d" "$N"
  23089. - [ -n "$iapp_interface" ] && append "$var" iapp_interface=$(uci_get_state network "$iapp_interface" ifname "$iapp_interface") "$N"
  23090. -
  23091. - if [ "$wpa" -ge "1" ]
  23092. - then
  23093. - config_get nasid "$vif" nasid
  23094. - [ -n "$nasid" ] && append "$var" "nas_identifier=$nasid" "$N"
  23095. -
  23096. - config_get_bool ieee80211r "$vif" ieee80211r 0
  23097. - if [ "$ieee80211r" -gt 0 ]
  23098. - then
  23099. - config_get mobility_domain "$vif" mobility_domain "4f57"
  23100. - config_get r0_key_lifetime "$vif" r0_key_lifetime "10000"
  23101. - config_get r1_key_holder "$vif" r1_key_holder "00004f577274"
  23102. - config_get reassociation_deadline "$vif" reassociation_deadline "1000"
  23103. - config_get r0kh "$vif" r0kh
  23104. - config_get r1kh "$vif" r1kh
  23105. - config_get_bool pmk_r1_push "$vif" pmk_r1_push 0
  23106. -
  23107. - append "$var" "mobility_domain=$mobility_domain" "$N"
  23108. - append "$var" "r0_key_lifetime=$r0_key_lifetime" "$N"
  23109. - append "$var" "r1_key_holder=$r1_key_holder" "$N"
  23110. - append "$var" "reassociation_deadline=$reassociation_deadline" "$N"
  23111. - append "$var" "pmk_r1_push=$pmk_r1_push" "$N"
  23112. -
  23113. - for kh in $r0kh; do
  23114. - "$var" "r0kh=${kh//,/ }" "$N"
  23115. - done
  23116. - for kh in $r1kh; do
  23117. - "$var" "r1kh=${kh//,/ }" "$N"
  23118. - done
  23119. -
  23120. - [ "$wpa_key_mgmt" != "${wpa_key_mgmt/EAP/}" ] && append wpa_key_mgmt "FT-EAP"
  23121. - [ "$wpa_key_mgmt" != "${wpa_key_mgmt/PSK/}" ] && append wpa_key_mgmt "FT-PSK"
  23122. - fi
  23123. -
  23124. - [ -n "wpa_key_mgmt" ] && append "$var" "wpa_key_mgmt=$wpa_key_mgmt"
  23125. - fi
  23126. -
  23127. - if [ "$wpa" -ge "2" ]
  23128. - then
  23129. - # RSN -> allow preauthentication. You have two
  23130. - # options, rsn_preauth for production or rsn_preauth_testing
  23131. - # for validation / testing.
  23132. - if [ -n "$bridge" -a "$rsn_preauth" = 1 ]
  23133. - then
  23134. - append "$var" "rsn_preauth=1" "$N"
  23135. - append "$var" "rsn_preauth_interfaces=$bridge" "$N"
  23136. - append "$var" "okc=1" "$N"
  23137. - else
  23138. - # RSN preauthentication testings hould disable
  23139. - # Opportunistic Key Caching (okc) as otherwise the PMKSA
  23140. - # entry for a test could come from the Opportunistic Key Caching
  23141. - config_get rsn_preauth_testing "$vif" rsn_preauth_testing
  23142. - if [ -n "$bridge" -a "$rsn_preauth_testing" = 1 ]
  23143. - then
  23144. - append "$var" "rsn_preauth=1" "$N"
  23145. - append "$var" "rsn_preauth_interfaces=$bridge" "$N"
  23146. - append "$var" "okc=0" "$N"
  23147. - fi
  23148. - fi
  23149. -
  23150. - # RSN -> allow management frame protection
  23151. - config_get ieee80211w "$vif" ieee80211w
  23152. - case "$ieee80211w" in
  23153. - [012])
  23154. - append "$var" "ieee80211w=$ieee80211w" "$N"
  23155. - [ "$ieee80211w" -gt "0" ] && {
  23156. - config_get ieee80211w_max_timeout "$vif" ieee80211w_max_timeout
  23157. - config_get ieee80211w_retry_timeout "$vif" ieee80211w_retry_timeout
  23158. - [ -n "$ieee80211w_max_timeout" ] && \
  23159. - append "$var" "assoc_sa_query_max_timeout=$ieee80211w_max_timeout" "$N"
  23160. - [ -n "$ieee80211w_retry_timeout" ] && \
  23161. - append "$var" "assoc_sa_query_retry_timeout=$ieee80211w_retry_timeout" "$N"
  23162. - }
  23163. - ;;
  23164. - esac
  23165. - fi
  23166. -
  23167. - config_get macfile "$vif" macfile
  23168. - config_get maclist "$vif" maclist
  23169. - if [ -z "$macfile" ]
  23170. - then
  23171. - # if no macfile has been specified, fallback to the default name
  23172. - # and truncate file to avoid aggregating entries over time
  23173. - macfile="/var/run/hostapd-$ifname.maclist"
  23174. - echo "" > "$macfile"
  23175. - else
  23176. - if [ -n "$maclist" ]
  23177. - then
  23178. - # to avoid to overwrite the original file, make a copy
  23179. - # before appending the entries specified by the maclist
  23180. - # option
  23181. - cp $macfile $macfile.maclist
  23182. - macfile=$macfile.maclist
  23183. - fi
  23184. - fi
  23185. -
  23186. - if [ -n "$maclist" ]
  23187. - then
  23188. - for mac in $maclist; do
  23189. - echo "$mac" >> $macfile
  23190. - done
  23191. - fi
  23192. -
  23193. - config_get macfilter "$vif" macfilter
  23194. - case "$macfilter" in
  23195. - allow)
  23196. - append "$var" "macaddr_acl=1" "$N"
  23197. - append "$var" "accept_mac_file=$macfile" "$N"
  23198. - ;;
  23199. - deny)
  23200. - append "$var" "macaddr_acl=0" "$N"
  23201. - append "$var" "deny_mac_file=$macfile" "$N"
  23202. - ;;
  23203. - esac
  23204. -}
  23205. -
  23206. -hostapd_set_log_options() {
  23207. - local var="$1"
  23208. - local cfg="$2"
  23209. - local log_level log_80211 log_8021x log_radius log_wpa log_driver log_iapp log_mlme
  23210. -
  23211. - config_get log_level "$cfg" log_level 2
  23212. -
  23213. - config_get_bool log_80211 "$cfg" log_80211 1
  23214. - config_get_bool log_8021x "$cfg" log_8021x 1
  23215. - config_get_bool log_radius "$cfg" log_radius 1
  23216. - config_get_bool log_wpa "$cfg" log_wpa 1
  23217. - config_get_bool log_driver "$cfg" log_driver 1
  23218. - config_get_bool log_iapp "$cfg" log_iapp 1
  23219. - config_get_bool log_mlme "$cfg" log_mlme 1
  23220. -
  23221. - local log_mask=$(( \
  23222. - ($log_80211 << 0) | \
  23223. - ($log_8021x << 1) | \
  23224. - ($log_radius << 2) | \
  23225. - ($log_wpa << 3) | \
  23226. - ($log_driver << 4) | \
  23227. - ($log_iapp << 5) | \
  23228. - ($log_mlme << 6) \
  23229. - ))
  23230. -
  23231. - append "$var" "logger_syslog=$log_mask" "$N"
  23232. - append "$var" "logger_syslog_level=$log_level" "$N"
  23233. - append "$var" "logger_stdout=$log_mask" "$N"
  23234. - append "$var" "logger_stdout_level=$log_level" "$N"
  23235. -}
  23236. -
  23237. -hostapd_setup_vif() {
  23238. - local vif="$1"
  23239. - local driver="$2"
  23240. - local ifname device channel hwmode
  23241. -
  23242. - hostapd_cfg=
  23243. -
  23244. - config_get ifname "$vif" ifname
  23245. - config_get device "$vif" device
  23246. - config_get channel "$device" channel
  23247. - config_get hwmode "$device" hwmode
  23248. -
  23249. - hostapd_set_log_options hostapd_cfg "$device"
  23250. - hostapd_set_bss_options hostapd_cfg "$vif"
  23251. -
  23252. - case "$hwmode" in
  23253. - *bg|*gdt|*gst|*fh) hwmode=g;;
  23254. - *adt|*ast) hwmode=a;;
  23255. - esac
  23256. - [ "$channel" = auto ] && channel=
  23257. - [ -n "$channel" -a -z "$hwmode" ] && wifi_fixup_hwmode "$device"
  23258. - cat > /var/run/hostapd-$ifname.conf <<EOF
  23259. -driver=$driver
  23260. -interface=$ifname
  23261. -${hwmode:+hw_mode=${hwmode#11}}
  23262. -${channel:+channel=$channel}
  23263. -$hostapd_cfg
  23264. -EOF
  23265. - hostapd -P /var/run/wifi-$ifname.pid -B /var/run/hostapd-$ifname.conf
  23266. -}
  23267. -
  23268. diff --git a/package/network/services/hostapd/files/netifd.sh b/package/network/services/hostapd/files/netifd.sh
  23269. index 23d2e7e..e6b0b0d 100644
  23270. --- a/package/network/services/hostapd/files/netifd.sh
  23271. +++ b/package/network/services/hostapd/files/netifd.sh
  23272. @@ -1,3 +1,5 @@
  23273. +. /lib/functions/network.sh
  23274. +
  23275. wpa_supplicant_add_rate() {
  23276. local var="$1"
  23277. local val="$(($2 / 1000))"
  23278. @@ -120,6 +122,7 @@ hostapd_common_add_bss_config() {
  23279. config_add_boolean rsn_preauth auth_cache
  23280. config_add_int ieee80211w
  23281. + config_add_int eapol_version
  23282. config_add_string 'auth_server:host' 'server:host'
  23283. config_add_string auth_secret
  23284. @@ -136,10 +139,11 @@ hostapd_common_add_bss_config() {
  23285. config_add_string nasid
  23286. config_add_string ownip
  23287. config_add_string iapp_interface
  23288. - config_add_string eap_type ca_cert client_cert identity auth priv_key priv_key_pwd
  23289. + config_add_string eap_type ca_cert client_cert identity anonymous_identity auth priv_key priv_key_pwd
  23290. config_add_int dynamic_vlan vlan_naming
  23291. config_add_string vlan_tagged_interface vlan_bridge
  23292. + config_add_string vlan_file
  23293. config_add_string 'key1:wepkey' 'key2:wepkey' 'key3:wepkey' 'key4:wepkey' 'password:wpakey'
  23294. @@ -182,7 +186,7 @@ hostapd_set_bss_options() {
  23295. wps_pushbutton wps_label ext_registrar wps_pbc_in_m1 \
  23296. wps_device_type wps_device_name wps_manufacturer wps_pin \
  23297. macfilter ssid wmm uapsd hidden short_preamble rsn_preauth \
  23298. - iapp_interface
  23299. + iapp_interface eapol_version acct_server acct_secret acct_port
  23300. set_default isolate 0
  23301. set_default maxassoc 0
  23302. @@ -192,6 +196,8 @@ hostapd_set_bss_options() {
  23303. set_default hidden 0
  23304. set_default wmm 1
  23305. set_default uapsd 1
  23306. + set_default eapol_version 0
  23307. + set_default acct_port 1813
  23308. append bss_conf "ctrl_interface=/var/run/hostapd"
  23309. if [ "$isolate" -gt 0 ]; then
  23310. @@ -216,6 +222,13 @@ hostapd_set_bss_options() {
  23311. [ -n "$wpa_master_rekey" ] && append bss_conf "wpa_gmk_rekey=$wpa_master_rekey" "$N"
  23312. }
  23313. + [ -n "$acct_server" ] && {
  23314. + append bss_conf "acct_server_addr=$acct_server" "$N"
  23315. + append bss_conf "acct_server_port=$acct_port" "$N"
  23316. + [ -n "$acct_secret" ] && \
  23317. + append bss_conf "acct_server_shared_secret=$acct_secret" "$N"
  23318. + }
  23319. +
  23320. case "$auth_type" in
  23321. none)
  23322. wps_possible=1
  23323. @@ -237,18 +250,19 @@ hostapd_set_bss_options() {
  23324. [ -e "$wpa_psk_file" ] || touch "$wpa_psk_file"
  23325. append bss_conf "wpa_psk_file=$wpa_psk_file" "$N"
  23326. }
  23327. + [ "$eapol_version" -ge "1" -a "$eapol_version" -le "2" ] && append bss_conf "eapol_version=$eapol_version" "$N"
  23328. +
  23329. wps_possible=1
  23330. append wpa_key_mgmt "WPA-PSK"
  23331. ;;
  23332. eap)
  23333. json_get_vars \
  23334. auth_server auth_secret auth_port \
  23335. - acct_server acct_secret acct_port \
  23336. dae_client dae_secret dae_port \
  23337. ownip \
  23338. eap_reauth_period dynamic_vlan \
  23339. vlan_naming vlan_tagged_interface \
  23340. - vlan_bridge
  23341. + vlan_bridge vlan_file
  23342. # legacy compatibility
  23343. [ -n "$auth_server" ] || json_get_var auth_server server
  23344. @@ -256,7 +270,6 @@ hostapd_set_bss_options() {
  23345. [ -n "$auth_secret" ] || json_get_var auth_secret key
  23346. set_default auth_port 1812
  23347. - set_default acct_port 1813
  23348. set_default dae_port 3799
  23349. set_default vlan_naming 1
  23350. @@ -265,13 +278,6 @@ hostapd_set_bss_options() {
  23351. append bss_conf "auth_server_port=$auth_port" "$N"
  23352. append bss_conf "auth_server_shared_secret=$auth_secret" "$N"
  23353. - [ -n "$acct_server" ] && {
  23354. - append bss_conf "acct_server_addr=$acct_server" "$N"
  23355. - append bss_conf "acct_server_port=$acct_port" "$N"
  23356. - [ -n "$acct_secret" ] && \
  23357. - append bss_conf "acct_server_shared_secret=$acct_secret" "$N"
  23358. - }
  23359. -
  23360. [ -n "$eap_reauth_period" ] && append bss_conf "eap_reauth_period=$eap_reauth_period" "$N"
  23361. [ -n "$dae_client" -a -n "$dae_secret" ] && {
  23362. @@ -291,7 +297,13 @@ hostapd_set_bss_options() {
  23363. append bss_conf "vlan_bridge=$vlan_bridge" "$N"
  23364. [ -n "$vlan_tagged_interface" ] && \
  23365. append bss_conf "vlan_tagged_interface=$vlan_tagged_interface" "$N"
  23366. + [ -n "$vlan_file" ] && {
  23367. + [ -e "$vlan_file" ] || touch "$vlan_file"
  23368. + append bss_conf "vlan_file=$vlan_file" "$N"
  23369. + }
  23370. }
  23371. +
  23372. + [ "$eapol_version" -ge "1" -a "$eapol_version" -le "2" ] && append bss_conf "eapol_version=$eapol_version" "$N"
  23373. ;;
  23374. wep)
  23375. local wep_keyidx=0
  23376. @@ -318,8 +330,8 @@ hostapd_set_bss_options() {
  23377. [ -n "$wps_possible" -a -n "$config_methods" ] && {
  23378. set_default ext_registrar 0
  23379. set_default wps_device_type "6-0050F204-1"
  23380. - set_default wps_device_name "OpenWrt AP"
  23381. - set_default wps_manufacturer "openwrt.org"
  23382. + set_default wps_device_name "Lede AP"
  23383. + set_default wps_manufacturer "www.lede-project.org"
  23384. wps_state=2
  23385. [ -n "$wps_configured" ] && wps_state=1
  23386. @@ -340,8 +352,9 @@ hostapd_set_bss_options() {
  23387. append bss_conf "ssid=$ssid" "$N"
  23388. [ -n "$network_bridge" ] && append bss_conf "bridge=$network_bridge" "$N"
  23389. [ -n "$iapp_interface" ] && {
  23390. - iapp_interface="$(uci_get_state network "$iapp_interface" ifname "$iapp_interface")"
  23391. - [ -n "$iapp_interface" ] && append bss_conf "iapp_interface=$iapp_interface" "$N"
  23392. + local ifname
  23393. + network_get_device ifname "$iapp_interface" || ifname = "$iapp_interface"
  23394. + append bss_conf "iapp_interface=$ifname" "$N"
  23395. }
  23396. if [ "$wpa" -ge "1" ]; then
  23397. @@ -522,9 +535,15 @@ wpa_supplicant_prepare_interface() {
  23398. _w_modestr="mode=1"
  23399. }
  23400. + local country_str=
  23401. + [ -n "$country" ] && {
  23402. + country_str="country=$country"
  23403. + }
  23404. +
  23405. wpa_supplicant_teardown_interface "$ifname"
  23406. cat > "$_config" <<EOF
  23407. $ap_scan
  23408. +$country_str
  23409. EOF
  23410. return 0
  23411. }
  23412. @@ -538,7 +557,9 @@ wpa_supplicant_add_network() {
  23413. json_get_vars \
  23414. ssid bssid key \
  23415. basic_rate mcast_rate \
  23416. - ieee80211w
  23417. + ieee80211w ieee80211r
  23418. +
  23419. + set_default ieee80211r 0
  23420. local key_mgmt='NONE'
  23421. local enc_str=
  23422. @@ -549,6 +570,8 @@ wpa_supplicant_add_network() {
  23423. local scan_ssid="scan_ssid=1"
  23424. local freq
  23425. + [ "$ieee80211r" -gt 0 ] && wpa_key_mgmt="FT-PSK $wpa_key_mgmt"
  23426. +
  23427. [[ "$_w_mode" = "adhoc" ]] && {
  23428. append network_data "mode=1" "$N$T"
  23429. [ -n "$channel" ] && {
  23430. @@ -563,6 +586,9 @@ wpa_supplicant_add_network() {
  23431. }
  23432. [[ "$_w_mode" = "mesh" ]] && {
  23433. + json_get_vars mesh_id
  23434. + ssid="${mesh_id}"
  23435. +
  23436. append network_data "mode=5" "$N$T"
  23437. [ -n "$channel" ] && {
  23438. freq="$(get_freq "$phy" "$channel")"
  23439. @@ -594,10 +620,12 @@ wpa_supplicant_add_network() {
  23440. ;;
  23441. eap)
  23442. key_mgmt='WPA-EAP'
  23443. + [ "$ieee80211r" -gt 0 ] && key_mgmt="FT-EAP $key_mgmt"
  23444. - json_get_vars eap_type identity ca_cert
  23445. + json_get_vars eap_type identity anonymous_identity ca_cert
  23446. [ -n "$ca_cert" ] && append network_data "ca_cert=\"$ca_cert\"" "$N$T"
  23447. [ -n "$identity" ] && append network_data "identity=\"$identity\"" "$N$T"
  23448. + [ -n "$anonymous_identity" ] && append network_data "anonymous_identity=\"$anonymous_identity\"" "$N$T"
  23449. case "$eap_type" in
  23450. tls)
  23451. json_get_vars client_cert priv_key priv_key_pwd
  23452. @@ -605,11 +633,32 @@ wpa_supplicant_add_network() {
  23453. append network_data "private_key=\"$priv_key\"" "$N$T"
  23454. append network_data "private_key_passwd=\"$priv_key_pwd\"" "$N$T"
  23455. ;;
  23456. - peap|ttls)
  23457. - json_get_vars auth password
  23458. + fast|peap|ttls)
  23459. + json_get_vars auth password ca_cert2 client_cert2 priv_key2 priv_key2_pwd
  23460. set_default auth MSCHAPV2
  23461. - append network_data "phase2=\"$auth\"" "$N$T"
  23462. - append network_data "password=\"$password\"" "$N$T"
  23463. +
  23464. + if [ "$auth" = "EAP-TLS" ]; then
  23465. + [ -n "$ca_cert2" ] &&
  23466. + append network_data "ca_cert2=\"$ca_cert2\"" "$N$T"
  23467. + append network_data "client_cert2=\"$client_cert2\"" "$N$T"
  23468. + append network_data "private_key2=\"$priv_key2\"" "$N$T"
  23469. + append network_data "private_key2_passwd=\"$priv_key2_pwd\"" "$N$T"
  23470. + else
  23471. + append network_data "password=\"$password\"" "$N$T"
  23472. + fi
  23473. +
  23474. + phase2proto="auth="
  23475. + case "$auth" in
  23476. + "auth"*)
  23477. + phase2proto=""
  23478. + ;;
  23479. + "EAP-"*)
  23480. + auth="$(echo $auth | cut -b 5- )"
  23481. + [ "$eap_type" = "ttls" ] &&
  23482. + phase2proto="autheap="
  23483. + ;;
  23484. + esac
  23485. + append network_data "phase2=\"$phase2proto$auth\"" "$N$T"
  23486. ;;
  23487. esac
  23488. append network_data "eap=$(echo $eap_type | tr 'a-z' 'A-Z')" "$N$T"
  23489. diff --git a/package/network/services/hostapd/files/wpa_supplicant-full.config b/package/network/services/hostapd/files/wpa_supplicant-full.config
  23490. index a9d04ab..18c3f9a 100644
  23491. --- a/package/network/services/hostapd/files/wpa_supplicant-full.config
  23492. +++ b/package/network/services/hostapd/files/wpa_supplicant-full.config
  23493. @@ -41,7 +41,7 @@
  23494. # Driver interface for Host AP driver
  23495. -CONFIG_DRIVER_HOSTAP=y
  23496. +#CONFIG_DRIVER_HOSTAP=y
  23497. # Driver interface for Agere driver
  23498. #CONFIG_DRIVER_HERMES=y
  23499. @@ -121,6 +121,9 @@ CONFIG_DRIVER_WIRED=y
  23500. # included)
  23501. CONFIG_IEEE8021X_EAPOL=y
  23502. +# EAP-FAST
  23503. +CONFIG_EAP_FAST=y
  23504. +
  23505. # EAP-MD5
  23506. CONFIG_EAP_MD5=y
  23507. @@ -367,7 +370,7 @@ CONFIG_INTERNAL_LIBTOMMATH_FAST=y
  23508. #CONFIG_DYNAMIC_EAP_METHODS=y
  23509. # IEEE Std 802.11r-2008 (Fast BSS Transition)
  23510. -#CONFIG_IEEE80211R=y
  23511. +CONFIG_IEEE80211R=y
  23512. # Add support for writing debug log to a file (/tmp/wpa_supplicant-log-#.txt)
  23513. #CONFIG_DEBUG_FILE=y
  23514. diff --git a/package/network/services/hostapd/files/wpa_supplicant-mesh.config b/package/network/services/hostapd/files/wpa_supplicant-mesh.config
  23515. deleted file mode 100644
  23516. index 36e2908..0000000
  23517. --- a/package/network/services/hostapd/files/wpa_supplicant-mesh.config
  23518. +++ /dev/null
  23519. @@ -1,407 +0,0 @@
  23520. -# Example wpa_supplicant build time configuration
  23521. -#
  23522. -# This file lists the configuration options that are used when building the
  23523. -# hostapd binary. All lines starting with # are ignored. Configuration option
  23524. -# lines must be commented out complete, if they are not to be included, i.e.,
  23525. -# just setting VARIABLE=n is not disabling that variable.
  23526. -#
  23527. -# This file is included in Makefile, so variables like CFLAGS and LIBS can also
  23528. -# be modified from here. In most cases, these lines should use += in order not
  23529. -# to override previous values of the variables.
  23530. -
  23531. -
  23532. -# Uncomment following two lines and fix the paths if you have installed OpenSSL
  23533. -# or GnuTLS in non-default location
  23534. -#CFLAGS += -I/usr/local/openssl/include
  23535. -#LIBS += -L/usr/local/openssl/lib
  23536. -
  23537. -# Some Red Hat versions seem to include kerberos header files from OpenSSL, but
  23538. -# the kerberos files are not in the default include path. Following line can be
  23539. -# used to fix build issues on such systems (krb5.h not found).
  23540. -#CFLAGS += -I/usr/include/kerberos
  23541. -
  23542. -# Example configuration for various cross-compilation platforms
  23543. -
  23544. -#### sveasoft (e.g., for Linksys WRT54G) ######################################
  23545. -#CC=mipsel-uclibc-gcc
  23546. -#CC=/opt/brcm/hndtools-mipsel-uclibc/bin/mipsel-uclibc-gcc
  23547. -#CFLAGS += -Os
  23548. -#CPPFLAGS += -I../src/include -I../../src/router/openssl/include
  23549. -#LIBS += -L/opt/brcm/hndtools-mipsel-uclibc-0.9.19/lib -lssl
  23550. -###############################################################################
  23551. -
  23552. -#### openwrt (e.g., for Linksys WRT54G) #######################################
  23553. -#CC=mipsel-uclibc-gcc
  23554. -#CC=/opt/brcm/hndtools-mipsel-uclibc/bin/mipsel-uclibc-gcc
  23555. -#CFLAGS += -Os
  23556. -#CPPFLAGS=-I../src/include -I../openssl-0.9.7d/include \
  23557. -# -I../WRT54GS/release/src/include
  23558. -#LIBS = -lssl
  23559. -###############################################################################
  23560. -
  23561. -
  23562. -# Driver interface for Host AP driver
  23563. -CONFIG_DRIVER_HOSTAP=y
  23564. -
  23565. -# Driver interface for Agere driver
  23566. -#CONFIG_DRIVER_HERMES=y
  23567. -# Change include directories to match with the local setup
  23568. -#CFLAGS += -I../../hcf -I../../include -I../../include/hcf
  23569. -#CFLAGS += -I../../include/wireless
  23570. -
  23571. -# Driver interface for ndiswrapper
  23572. -# Deprecated; use CONFIG_DRIVER_WEXT=y instead.
  23573. -#CONFIG_DRIVER_NDISWRAPPER=y
  23574. -
  23575. -# Driver interface for Atmel driver
  23576. -# CONFIG_DRIVER_ATMEL=y
  23577. -
  23578. -# Driver interface for old Broadcom driver
  23579. -# Please note that the newer Broadcom driver ("hybrid Linux driver") supports
  23580. -# Linux wireless extensions and does not need (or even work) with the old
  23581. -# driver wrapper. Use CONFIG_DRIVER_WEXT=y with that driver.
  23582. -#CONFIG_DRIVER_BROADCOM=y
  23583. -# Example path for wlioctl.h; change to match your configuration
  23584. -#CFLAGS += -I/opt/WRT54GS/release/src/include
  23585. -
  23586. -# Driver interface for Intel ipw2100/2200 driver
  23587. -# Deprecated; use CONFIG_DRIVER_WEXT=y instead.
  23588. -#CONFIG_DRIVER_IPW=y
  23589. -
  23590. -# Driver interface for Ralink driver
  23591. -#CONFIG_DRIVER_RALINK=y
  23592. -
  23593. -# Driver interface for generic Linux wireless extensions
  23594. -CONFIG_DRIVER_WEXT=y
  23595. -
  23596. -# Driver interface for Linux drivers using the nl80211 kernel interface
  23597. -CONFIG_DRIVER_NL80211=y
  23598. -
  23599. -# Driver interface for FreeBSD net80211 layer (e.g., Atheros driver)
  23600. -#CONFIG_DRIVER_BSD=y
  23601. -#CFLAGS += -I/usr/local/include
  23602. -#LIBS += -L/usr/local/lib
  23603. -#LIBS_p += -L/usr/local/lib
  23604. -#LIBS_c += -L/usr/local/lib
  23605. -
  23606. -# Driver interface for Windows NDIS
  23607. -#CONFIG_DRIVER_NDIS=y
  23608. -#CFLAGS += -I/usr/include/w32api/ddk
  23609. -#LIBS += -L/usr/local/lib
  23610. -# For native build using mingw
  23611. -#CONFIG_NATIVE_WINDOWS=y
  23612. -# Additional directories for cross-compilation on Linux host for mingw target
  23613. -#CFLAGS += -I/opt/mingw/mingw32/include/ddk
  23614. -#LIBS += -L/opt/mingw/mingw32/lib
  23615. -#CC=mingw32-gcc
  23616. -# By default, driver_ndis uses WinPcap for low-level operations. This can be
  23617. -# replaced with the following option which replaces WinPcap calls with NDISUIO.
  23618. -# However, this requires that WZC is disabled (net stop wzcsvc) before starting
  23619. -# wpa_supplicant.
  23620. -# CONFIG_USE_NDISUIO=y
  23621. -
  23622. -# Driver interface for development testing
  23623. -#CONFIG_DRIVER_TEST=y
  23624. -
  23625. -# Include client MLME (management frame processing) for test driver
  23626. -# This can be used to test MLME operations in hostapd with the test interface.
  23627. -# space.
  23628. -#CONFIG_CLIENT_MLME=y
  23629. -
  23630. -# Driver interface for wired Ethernet drivers
  23631. -CONFIG_DRIVER_WIRED=y
  23632. -
  23633. -# Driver interface for the Broadcom RoboSwitch family
  23634. -#CONFIG_DRIVER_ROBOSWITCH=y
  23635. -
  23636. -# Driver interface for no driver (e.g., WPS ER only)
  23637. -#CONFIG_DRIVER_NONE=y
  23638. -
  23639. -# Enable IEEE 802.1X Supplicant (automatically included if any EAP method is
  23640. -# included)
  23641. -CONFIG_IEEE8021X_EAPOL=y
  23642. -
  23643. -# EAP-MD5
  23644. -CONFIG_EAP_MD5=y
  23645. -
  23646. -# EAP-MSCHAPv2
  23647. -CONFIG_EAP_MSCHAPV2=y
  23648. -
  23649. -# EAP-TLS
  23650. -CONFIG_EAP_TLS=y
  23651. -
  23652. -# EAL-PEAP
  23653. -CONFIG_EAP_PEAP=y
  23654. -
  23655. -# EAP-TTLS
  23656. -CONFIG_EAP_TTLS=y
  23657. -
  23658. -# EAP-FAST
  23659. -# Note: Default OpenSSL package does not include support for all the
  23660. -# functionality needed for EAP-FAST. If EAP-FAST is enabled with OpenSSL,
  23661. -# the OpenSSL library must be patched (openssl-0.9.8d-tls-extensions.patch)
  23662. -# to add the needed functions.
  23663. -#CONFIG_EAP_FAST=y
  23664. -
  23665. -# EAP-GTC
  23666. -CONFIG_EAP_GTC=y
  23667. -
  23668. -# EAP-OTP
  23669. -CONFIG_EAP_OTP=y
  23670. -
  23671. -# EAP-SIM (enable CONFIG_PCSC, if EAP-SIM is used)
  23672. -#CONFIG_EAP_SIM=y
  23673. -
  23674. -# EAP-PSK (experimental; this is _not_ needed for WPA-PSK)
  23675. -#CONFIG_EAP_PSK=y
  23676. -
  23677. -# EAP-PAX
  23678. -#CONFIG_EAP_PAX=y
  23679. -
  23680. -# LEAP
  23681. -CONFIG_EAP_LEAP=y
  23682. -
  23683. -# EAP-AKA (enable CONFIG_PCSC, if EAP-AKA is used)
  23684. -#CONFIG_EAP_AKA=y
  23685. -
  23686. -# EAP-AKA' (enable CONFIG_PCSC, if EAP-AKA' is used).
  23687. -# This requires CONFIG_EAP_AKA to be enabled, too.
  23688. -#CONFIG_EAP_AKA_PRIME=y
  23689. -
  23690. -# Enable USIM simulator (Milenage) for EAP-AKA
  23691. -#CONFIG_USIM_SIMULATOR=y
  23692. -
  23693. -# EAP-SAKE
  23694. -#CONFIG_EAP_SAKE=y
  23695. -
  23696. -# EAP-GPSK
  23697. -#CONFIG_EAP_GPSK=y
  23698. -# Include support for optional SHA256 cipher suite in EAP-GPSK
  23699. -#CONFIG_EAP_GPSK_SHA256=y
  23700. -
  23701. -# EAP-TNC and related Trusted Network Connect support (experimental)
  23702. -#CONFIG_EAP_TNC=y
  23703. -
  23704. -# Wi-Fi Protected Setup (WPS)
  23705. -CONFIG_WPS=y
  23706. -
  23707. -# EAP-IKEv2
  23708. -#CONFIG_EAP_IKEV2=y
  23709. -
  23710. -# PKCS#12 (PFX) support (used to read private key and certificate file from
  23711. -# a file that usually has extension .p12 or .pfx)
  23712. -CONFIG_PKCS12=y
  23713. -
  23714. -# Smartcard support (i.e., private key on a smartcard), e.g., with openssl
  23715. -# engine.
  23716. -CONFIG_SMARTCARD=y
  23717. -
  23718. -# PC/SC interface for smartcards (USIM, GSM SIM)
  23719. -# Enable this if EAP-SIM or EAP-AKA is included
  23720. -#CONFIG_PCSC=y
  23721. -
  23722. -# Development testing
  23723. -#CONFIG_EAPOL_TEST=y
  23724. -
  23725. -# Select control interface backend for external programs, e.g, wpa_cli:
  23726. -# unix = UNIX domain sockets (default for Linux/*BSD)
  23727. -# udp = UDP sockets using localhost (127.0.0.1)
  23728. -# named_pipe = Windows Named Pipe (default for Windows)
  23729. -# y = use default (backwards compatibility)
  23730. -# If this option is commented out, control interface is not included in the
  23731. -# build.
  23732. -CONFIG_CTRL_IFACE=y
  23733. -
  23734. -# Include support for GNU Readline and History Libraries in wpa_cli.
  23735. -# When building a wpa_cli binary for distribution, please note that these
  23736. -# libraries are licensed under GPL and as such, BSD license may not apply for
  23737. -# the resulting binary.
  23738. -#CONFIG_READLINE=y
  23739. -
  23740. -# Remove debugging code that is printing out debug message to stdout.
  23741. -# This can be used to reduce the size of the wpa_supplicant considerably
  23742. -# if debugging code is not needed. The size reduction can be around 35%
  23743. -# (e.g., 90 kB).
  23744. -#CONFIG_NO_STDOUT_DEBUG=y
  23745. -
  23746. -# Remove WPA support, e.g., for wired-only IEEE 802.1X supplicant, to save
  23747. -# 35-50 kB in code size.
  23748. -#CONFIG_NO_WPA=y
  23749. -
  23750. -# Remove WPA2 support. This allows WPA to be used, but removes WPA2 code to
  23751. -# save about 1 kB in code size when building only WPA-Personal (no EAP support)
  23752. -# or 6 kB if building for WPA-Enterprise.
  23753. -#CONFIG_NO_WPA2=y
  23754. -
  23755. -# Remove IEEE 802.11i/WPA-Personal ASCII passphrase support
  23756. -# This option can be used to reduce code size by removing support for
  23757. -# converting ASCII passphrases into PSK. If this functionality is removed, the
  23758. -# PSK can only be configured as the 64-octet hexstring (e.g., from
  23759. -# wpa_passphrase). This saves about 0.5 kB in code size.
  23760. -#CONFIG_NO_WPA_PASSPHRASE=y
  23761. -
  23762. -# Disable scan result processing (ap_mode=1) to save code size by about 1 kB.
  23763. -# This can be used if ap_scan=1 mode is never enabled.
  23764. -#CONFIG_NO_SCAN_PROCESSING=y
  23765. -
  23766. -# Select configuration backend:
  23767. -# file = text file (e.g., wpa_supplicant.conf; note: the configuration file
  23768. -# path is given on command line, not here; this option is just used to
  23769. -# select the backend that allows configuration files to be used)
  23770. -# winreg = Windows registry (see win_example.reg for an example)
  23771. -CONFIG_BACKEND=file
  23772. -
  23773. -# Remove configuration write functionality (i.e., to allow the configuration
  23774. -# file to be updated based on runtime configuration changes). The runtime
  23775. -# configuration can still be changed, the changes are just not going to be
  23776. -# persistent over restarts. This option can be used to reduce code size by
  23777. -# about 3.5 kB.
  23778. -#CONFIG_NO_CONFIG_WRITE=y
  23779. -
  23780. -# Remove support for configuration blobs to reduce code size by about 1.5 kB.
  23781. -#CONFIG_NO_CONFIG_BLOBS=y
  23782. -
  23783. -# Select program entry point implementation:
  23784. -# main = UNIX/POSIX like main() function (default)
  23785. -# main_winsvc = Windows service (read parameters from registry)
  23786. -# main_none = Very basic example (development use only)
  23787. -#CONFIG_MAIN=main
  23788. -
  23789. -# Select wrapper for operatins system and C library specific functions
  23790. -# unix = UNIX/POSIX like systems (default)
  23791. -# win32 = Windows systems
  23792. -# none = Empty template
  23793. -#CONFIG_OS=unix
  23794. -
  23795. -# Select event loop implementation
  23796. -# eloop = select() loop (default)
  23797. -# eloop_win = Windows events and WaitForMultipleObject() loop
  23798. -# eloop_none = Empty template
  23799. -#CONFIG_ELOOP=eloop
  23800. -
  23801. -# Select layer 2 packet implementation
  23802. -# linux = Linux packet socket (default)
  23803. -# pcap = libpcap/libdnet/WinPcap
  23804. -# freebsd = FreeBSD libpcap
  23805. -# winpcap = WinPcap with receive thread
  23806. -# ndis = Windows NDISUIO (note: requires CONFIG_USE_NDISUIO=y)
  23807. -# none = Empty template
  23808. -#CONFIG_L2_PACKET=linux
  23809. -
  23810. -# PeerKey handshake for Station to Station Link (IEEE 802.11e DLS)
  23811. -CONFIG_PEERKEY=y
  23812. -
  23813. -# IEEE 802.11w (management frame protection)
  23814. -# This version is an experimental implementation based on IEEE 802.11w/D1.0
  23815. -# draft and is subject to change since the standard has not yet been finalized.
  23816. -# Driver support is also needed for IEEE 802.11w.
  23817. -CONFIG_IEEE80211W=y
  23818. -
  23819. -# Select TLS implementation
  23820. -# openssl = OpenSSL (default)
  23821. -# gnutls = GnuTLS (needed for TLS/IA, see also CONFIG_GNUTLS_EXTRA)
  23822. -# internal = Internal TLSv1 implementation (experimental)
  23823. -# none = Empty template
  23824. -CONFIG_TLS=internal
  23825. -
  23826. -# Whether to enable TLS/IA support, which is required for EAP-TTLSv1.
  23827. -# You need CONFIG_TLS=gnutls for this to have any effect. Please note that
  23828. -# even though the core GnuTLS library is released under LGPL, this extra
  23829. -# library uses GPL and as such, the terms of GPL apply to the combination
  23830. -# of wpa_supplicant and GnuTLS if this option is enabled. BSD license may not
  23831. -# apply for distribution of the resulting binary.
  23832. -#CONFIG_GNUTLS_EXTRA=y
  23833. -
  23834. -# If CONFIG_TLS=internal is used, additional library and include paths are
  23835. -# needed for LibTomMath. Alternatively, an integrated, minimal version of
  23836. -# LibTomMath can be used. See beginning of libtommath.c for details on benefits
  23837. -# and drawbacks of this option.
  23838. -CONFIG_INTERNAL_LIBTOMMATH=y
  23839. -#ifndef CONFIG_INTERNAL_LIBTOMMATH
  23840. -#LTM_PATH=/usr/src/libtommath-0.39
  23841. -#CFLAGS += -I$(LTM_PATH)
  23842. -#LIBS += -L$(LTM_PATH)
  23843. -#LIBS_p += -L$(LTM_PATH)
  23844. -#endif
  23845. -# At the cost of about 4 kB of additional binary size, the internal LibTomMath
  23846. -# can be configured to include faster routines for exptmod, sqr, and div to
  23847. -# speed up DH and RSA calculation considerably
  23848. -CONFIG_INTERNAL_LIBTOMMATH_FAST=y
  23849. -
  23850. -# Include NDIS event processing through WMI into wpa_supplicant/wpasvc.
  23851. -# This is only for Windows builds and requires WMI-related header files and
  23852. -# WbemUuid.Lib from Platform SDK even when building with MinGW.
  23853. -#CONFIG_NDIS_EVENTS_INTEGRATED=y
  23854. -#PLATFORMSDKLIB="/opt/Program Files/Microsoft Platform SDK/Lib"
  23855. -
  23856. -# Add support for old DBus control interface
  23857. -# (fi.epitest.hostap.WPASupplicant)
  23858. -#CONFIG_CTRL_IFACE_DBUS=y
  23859. -
  23860. -# Add support for new DBus control interface
  23861. -# (fi.w1.hostap.wpa_supplicant1)
  23862. -#CONFIG_CTRL_IFACE_DBUS_NEW=y
  23863. -
  23864. -# Add introspection support for new DBus control interface
  23865. -#CONFIG_CTRL_IFACE_DBUS_INTRO=y
  23866. -
  23867. -# Add support for loading EAP methods dynamically as shared libraries.
  23868. -# When this option is enabled, each EAP method can be either included
  23869. -# statically (CONFIG_EAP_<method>=y) or dynamically (CONFIG_EAP_<method>=dyn).
  23870. -# Dynamic EAP methods are build as shared objects (eap_*.so) and they need to
  23871. -# be loaded in the beginning of the wpa_supplicant configuration file
  23872. -# (see load_dynamic_eap parameter in the example file) before being used in
  23873. -# the network blocks.
  23874. -#
  23875. -# Note that some shared parts of EAP methods are included in the main program
  23876. -# and in order to be able to use dynamic EAP methods using these parts, the
  23877. -# main program must have been build with the EAP method enabled (=y or =dyn).
  23878. -# This means that EAP-TLS/PEAP/TTLS/FAST cannot be added as dynamic libraries
  23879. -# unless at least one of them was included in the main build to force inclusion
  23880. -# of the shared code. Similarly, at least one of EAP-SIM/AKA must be included
  23881. -# in the main build to be able to load these methods dynamically.
  23882. -#
  23883. -# Please also note that using dynamic libraries will increase the total binary
  23884. -# size. Thus, it may not be the best option for targets that have limited
  23885. -# amount of memory/flash.
  23886. -#CONFIG_DYNAMIC_EAP_METHODS=y
  23887. -
  23888. -# IEEE Std 802.11r-2008 (Fast BSS Transition)
  23889. -#CONFIG_IEEE80211R=y
  23890. -
  23891. -# Add support for writing debug log to a file (/tmp/wpa_supplicant-log-#.txt)
  23892. -#CONFIG_DEBUG_FILE=y
  23893. -
  23894. -# Enable privilege separation (see README 'Privilege separation' for details)
  23895. -#CONFIG_PRIVSEP=y
  23896. -
  23897. -# Enable mitigation against certain attacks against TKIP by delaying Michael
  23898. -# MIC error reports by a random amount of time between 0 and 60 seconds
  23899. -#CONFIG_DELAYED_MIC_ERROR_REPORT=y
  23900. -
  23901. -# Enable tracing code for developer debugging
  23902. -# This tracks use of memory allocations and other registrations and reports
  23903. -# incorrect use with a backtrace of call (or allocation) location.
  23904. -#CONFIG_WPA_TRACE=y
  23905. -# For BSD, comment out these.
  23906. -#LIBS += -lexecinfo
  23907. -#LIBS_p += -lexecinfo
  23908. -#LIBS_c += -lexecinfo
  23909. -
  23910. -# Use libbfd to get more details for developer debugging
  23911. -# This enables use of libbfd to get more detailed symbols for the backtraces
  23912. -# generated by CONFIG_WPA_TRACE=y.
  23913. -#CONFIG_WPA_TRACE_BFD=y
  23914. -# For BSD, comment out these.
  23915. -#LIBS += -lbfd -liberty -lz
  23916. -#LIBS_p += -lbfd -liberty -lz
  23917. -#LIBS_c += -lbfd -liberty -lz
  23918. -
  23919. -CONFIG_NO_RANDOM_POOL=y
  23920. -NEED_80211_COMMON=y
  23921. -
  23922. -CONFIG_IBSS_RSN=y
  23923. -
  23924. -CONFIG_MESH=y
  23925. -CONFIG_SAE=y
  23926. -CONFIG_AP=y
  23927. diff --git a/package/network/services/hostapd/files/wpa_supplicant-mini.config b/package/network/services/hostapd/files/wpa_supplicant-mini.config
  23928. index a8d334d..c272153 100644
  23929. --- a/package/network/services/hostapd/files/wpa_supplicant-mini.config
  23930. +++ b/package/network/services/hostapd/files/wpa_supplicant-mini.config
  23931. @@ -41,7 +41,7 @@
  23932. # Driver interface for Host AP driver
  23933. -CONFIG_DRIVER_HOSTAP=y
  23934. +#CONFIG_DRIVER_HOSTAP=y
  23935. # Driver interface for Agere driver
  23936. #CONFIG_DRIVER_HERMES=y
  23937. diff --git a/package/network/services/hostapd/files/wpa_supplicant-p2p.config b/package/network/services/hostapd/files/wpa_supplicant-p2p.config
  23938. index 1c307d0..563dace 100644
  23939. --- a/package/network/services/hostapd/files/wpa_supplicant-p2p.config
  23940. +++ b/package/network/services/hostapd/files/wpa_supplicant-p2p.config
  23941. @@ -41,7 +41,7 @@
  23942. # Driver interface for Host AP driver
  23943. -CONFIG_DRIVER_HOSTAP=y
  23944. +#CONFIG_DRIVER_HOSTAP=y
  23945. # Driver interface for Agere driver
  23946. #CONFIG_DRIVER_HERMES=y
  23947. diff --git a/package/network/services/hostapd/files/wpa_supplicant.sh b/package/network/services/hostapd/files/wpa_supplicant.sh
  23948. deleted file mode 100644
  23949. index b678484..0000000
  23950. --- a/package/network/services/hostapd/files/wpa_supplicant.sh
  23951. +++ /dev/null
  23952. @@ -1,194 +0,0 @@
  23953. -wpa_supplicant_setup_vif() {
  23954. - local vif="$1"
  23955. - local driver="$2"
  23956. - local key="$key"
  23957. - local options="$3"
  23958. - local freq=""
  23959. - local ht="$5"
  23960. - local ap_scan=""
  23961. - local scan_ssid="1"
  23962. - [ -n "$4" ] && freq="frequency=$4"
  23963. -
  23964. - config_get enc "$vif" encryption
  23965. - config_get key "$vif" key
  23966. -
  23967. - local net_cfg bridge
  23968. - config_get bridge "$vif" bridge
  23969. - [ -z "$bridge" ] && {
  23970. - net_cfg="$(find_net_config "$vif")"
  23971. - [ -z "$net_cfg" ] || bridge="$(bridge_interface "$net_cfg")"
  23972. - config_set "$vif" bridge "$bridge"
  23973. - }
  23974. -
  23975. - local mode ifname wds modestr=""
  23976. - config_get mode "$vif" mode
  23977. - config_get ifname "$vif" ifname
  23978. - config_get_bool wds "$vif" wds 0
  23979. - [ -z "$bridge" ] || [ "$mode" = ap ] || [ "$mode" = sta -a $wds -eq 1 ] || {
  23980. - echo "wpa_supplicant_setup_vif($ifname): Refusing to bridge $mode mode interface"
  23981. - return 1
  23982. - }
  23983. - [ "$mode" = "adhoc" ] && {
  23984. - modestr="mode=1"
  23985. - scan_ssid="0"
  23986. - ap_scan="ap_scan=2"
  23987. - }
  23988. -
  23989. - key_mgmt='NONE'
  23990. - case "$enc" in
  23991. - *none*) ;;
  23992. - *wep*)
  23993. - config_get key "$vif" key
  23994. - key="${key:-1}"
  23995. - case "$key" in
  23996. - [1234])
  23997. - for idx in 1 2 3 4; do
  23998. - local zidx
  23999. - zidx=$(($idx - 1))
  24000. - config_get ckey "$vif" "key${idx}"
  24001. - [ -n "$ckey" ] && \
  24002. - append "wep_key${zidx}" "wep_key${zidx}=$(prepare_key_wep "$ckey")"
  24003. - done
  24004. - wep_tx_keyidx="wep_tx_keyidx=$((key - 1))"
  24005. - ;;
  24006. - *)
  24007. - wep_key0="wep_key0=$(prepare_key_wep "$key")"
  24008. - wep_tx_keyidx="wep_tx_keyidx=0"
  24009. - ;;
  24010. - esac
  24011. - ;;
  24012. - *psk*)
  24013. - key_mgmt='WPA-PSK'
  24014. - # if you want to use PSK with a non-nl80211 driver you
  24015. - # have to use WPA-NONE and wext driver for wpa_s
  24016. - [ "$mode" = "adhoc" -a "$driver" != "nl80211" ] && {
  24017. - key_mgmt='WPA-NONE'
  24018. - driver='wext'
  24019. - }
  24020. - if [ ${#key} -eq 64 ]; then
  24021. - passphrase="psk=${key}"
  24022. - else
  24023. - passphrase="psk=\"${key}\""
  24024. - fi
  24025. - case "$enc" in
  24026. - *psk2*)
  24027. - proto='proto=RSN'
  24028. - config_get ieee80211w "$vif" ieee80211w
  24029. - ;;
  24030. - *psk*)
  24031. - proto='proto=WPA'
  24032. - ;;
  24033. - esac
  24034. - ;;
  24035. - *wpa*|*8021x*)
  24036. - proto='proto=WPA2'
  24037. - key_mgmt='WPA-EAP'
  24038. - config_get ieee80211w "$vif" ieee80211w
  24039. - config_get ca_cert "$vif" ca_cert
  24040. - config_get eap_type "$vif" eap_type
  24041. - ca_cert=${ca_cert:+"ca_cert=\"$ca_cert\""}
  24042. - case "$eap_type" in
  24043. - tls)
  24044. - pairwise='pairwise=CCMP'
  24045. - group='group=CCMP'
  24046. - config_get identity "$vif" identity
  24047. - config_get client_cert "$vif" client_cert
  24048. - config_get priv_key "$vif" priv_key
  24049. - config_get priv_key_pwd "$vif" priv_key_pwd
  24050. - identity="identity=\"$identity\""
  24051. - client_cert="client_cert=\"$client_cert\""
  24052. - priv_key="private_key=\"$priv_key\""
  24053. - priv_key_pwd="private_key_passwd=\"$priv_key_pwd\""
  24054. - ;;
  24055. - peap|ttls)
  24056. - config_get auth "$vif" auth
  24057. - config_get identity "$vif" identity
  24058. - config_get password "$vif" password
  24059. - phase2="phase2=\"auth=${auth:-MSCHAPV2}\""
  24060. - identity="identity=\"$identity\""
  24061. - password="${password:+password=\"$password\"}"
  24062. - ;;
  24063. - esac
  24064. - eap_type="eap=$(echo $eap_type | tr 'a-z' 'A-Z')"
  24065. - ;;
  24066. - esac
  24067. -
  24068. - case "$ieee80211w" in
  24069. - [012])
  24070. - ieee80211w="ieee80211w=$ieee80211w"
  24071. - ;;
  24072. - esac
  24073. -
  24074. - local fixed_freq bssid1 beacon_int brates mrate
  24075. - config_get ifname "$vif" ifname
  24076. - config_get bridge "$vif" bridge
  24077. - config_get ssid "$vif" ssid
  24078. - config_get bssid "$vif" bssid
  24079. - bssid1=${bssid:+"bssid=$bssid"}
  24080. - beacon_int=${beacon_int:+"beacon_int=$beacon_int"}
  24081. -
  24082. - local br brval brsub brstr
  24083. - [ -n "$basic_rate_list" ] && {
  24084. - for br in $basic_rate_list; do
  24085. - brval="$(($br / 1000))"
  24086. - brsub="$((($br / 100) % 10))"
  24087. - [ "$brsub" -gt 0 ] && brval="$brval.$brsub"
  24088. - [ -n "$brstr" ] && brstr="$brstr,"
  24089. - brstr="$brstr$brval"
  24090. - done
  24091. - brates=${basic_rate_list:+"rates=$brstr"}
  24092. - }
  24093. -
  24094. - local mcval=""
  24095. - [ -n "$mcast_rate" ] && {
  24096. - mcval="$(($mcast_rate / 1000))"
  24097. - mcsub="$(( ($mcast_rate / 100) % 10 ))"
  24098. - [ "$mcsub" -gt 0 ] && mcval="$mcval.$mcsub"
  24099. - mrate=${mcast_rate:+"mcast_rate=$mcval"}
  24100. - }
  24101. -
  24102. - local ht_str
  24103. - [ -n "$ht" ] && ht_str="htmode=$ht"
  24104. -
  24105. - rm -rf /var/run/wpa_supplicant-$ifname
  24106. - cat > /var/run/wpa_supplicant-$ifname.conf <<EOF
  24107. -ctrl_interface=/var/run/wpa_supplicant-$ifname
  24108. -$ap_scan
  24109. -network={
  24110. - $modestr
  24111. - scan_ssid=$scan_ssid
  24112. - ssid="$ssid"
  24113. - $bssid1
  24114. - key_mgmt=$key_mgmt
  24115. - $proto
  24116. - $freq
  24117. - ${fixed:+"fixed_freq=1"}
  24118. - $beacon_int
  24119. - $brates
  24120. - $mrate
  24121. - $ht_str
  24122. - $ieee80211w
  24123. - $passphrase
  24124. - $pairwise
  24125. - $group
  24126. - $eap_type
  24127. - $ca_cert
  24128. - $client_cert
  24129. - $priv_key
  24130. - $priv_key_pwd
  24131. - $phase2
  24132. - $identity
  24133. - $password
  24134. - $wep_key0
  24135. - $wep_key1
  24136. - $wep_key2
  24137. - $wep_key3
  24138. - $wep_tx_keyidx
  24139. -}
  24140. -EOF
  24141. - if [ -n "$proto" -o "$key_mgmt" = "NONE" ]; then
  24142. - wpa_supplicant ${bridge:+ -b $bridge} -B -P "/var/run/wifi-${ifname}.pid" -D ${driver:-wext} -i "$ifname" -c /var/run/wpa_supplicant-$ifname.conf $options
  24143. - else
  24144. - return 0
  24145. - fi
  24146. -}
  24147. 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
  24148. new file mode 100644
  24149. index 0000000..5c8b662
  24150. --- /dev/null
  24151. +++ b/package/network/services/hostapd/patches/001-4addr-fix-reconnecting-client-on-connection-lost.patch
  24152. @@ -0,0 +1,25 @@
  24153. +From: Matthias May <matthias.may@neratec.com>
  24154. +Date: Tue, 5 Jul 2016 15:00:43 +0200
  24155. +Subject: [PATCH] 4addr: fix reconnecting client on connection lost
  24156. +
  24157. +When a 4addr client suddenly looses its connection (no deauth/deassoc)
  24158. +the AP still thinks it is connected.
  24159. +If the client reconnects before the AP timeoutes the client, traffic
  24160. +cannot flow.
  24161. +
  24162. +Fix this by making sure the WLAN_STA_WDS flag is unset in the sta->flags
  24163. +when the client completes association.
  24164. +
  24165. +Signed-off-by: Matthias May <matthias.may@neratec.com>
  24166. +---
  24167. +
  24168. +--- a/src/ap/ieee802_11.c
  24169. ++++ b/src/ap/ieee802_11.c
  24170. +@@ -2826,6 +2826,7 @@ static void handle_assoc_cb(struct hosta
  24171. + new_assoc = 0;
  24172. + sta->flags |= WLAN_STA_ASSOC;
  24173. + sta->flags &= ~WLAN_STA_WNM_SLEEP_MODE;
  24174. ++ sta->flags &= ~WLAN_STA_WDS;
  24175. + if ((!hapd->conf->ieee802_1x && !hapd->conf->wpa && !hapd->conf->osen) ||
  24176. + sta->auth_alg == WLAN_AUTH_FT) {
  24177. + /*
  24178. 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
  24179. deleted file mode 100644
  24180. index e408fbe..0000000
  24181. --- a/package/network/services/hostapd/patches/001-P2P-Validate-SSID-element-length-before-copying-it-C.patch
  24182. +++ /dev/null
  24183. @@ -1,37 +0,0 @@
  24184. -From 9ed4eee345f85e3025c33c6e20aa25696e341ccd Mon Sep 17 00:00:00 2001
  24185. -From: Jouni Malinen <jouni@qca.qualcomm.com>
  24186. -Date: Tue, 7 Apr 2015 11:32:11 +0300
  24187. -Subject: [PATCH] P2P: Validate SSID element length before copying it
  24188. - (CVE-2015-1863)
  24189. -
  24190. -This fixes a possible memcpy overflow for P2P dev->oper_ssid in
  24191. -p2p_add_device(). The length provided by the peer device (0..255 bytes)
  24192. -was used without proper bounds checking and that could have resulted in
  24193. -arbitrary data of up to 223 bytes being written beyond the end of the
  24194. -dev->oper_ssid[] array (of which about 150 bytes would be beyond the
  24195. -heap allocation) when processing a corrupted management frame for P2P
  24196. -peer discovery purposes.
  24197. -
  24198. -This could result in corrupted state in heap, unexpected program
  24199. -behavior due to corrupted P2P peer device information, denial of service
  24200. -due to process crash, exposure of memory contents during GO Negotiation,
  24201. -and potentially arbitrary code execution.
  24202. -
  24203. -Thanks to Google security team for reporting this issue and smart
  24204. -hardware research group of Alibaba security team for discovering it.
  24205. -
  24206. -Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
  24207. ----
  24208. - src/p2p/p2p.c | 1 +
  24209. - 1 file changed, 1 insertion(+)
  24210. -
  24211. ---- a/src/p2p/p2p.c
  24212. -+++ b/src/p2p/p2p.c
  24213. -@@ -778,6 +778,7 @@ int p2p_add_device(struct p2p_data *p2p,
  24214. - if (os_memcmp(addr, p2p_dev_addr, ETH_ALEN) != 0)
  24215. - os_memcpy(dev->interface_addr, addr, ETH_ALEN);
  24216. - if (msg.ssid &&
  24217. -+ msg.ssid[1] <= sizeof(dev->oper_ssid) &&
  24218. - (msg.ssid[1] != P2P_WILDCARD_SSID_LEN ||
  24219. - os_memcmp(msg.ssid + 2, P2P_WILDCARD_SSID, P2P_WILDCARD_SSID_LEN)
  24220. - != 0)) {
  24221. 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
  24222. deleted file mode 100644
  24223. index bc4d60f..0000000
  24224. --- a/package/network/services/hostapd/patches/002-AP-WMM-Fix-integer-underflow-in-WMM-Action-frame-par.patch
  24225. +++ /dev/null
  24226. @@ -1,36 +0,0 @@
  24227. -From ef566a4d4f74022e1fdb0a2addfe81e6de9f4aae Mon Sep 17 00:00:00 2001
  24228. -From: Jouni Malinen <j@w1.fi>
  24229. -Date: Wed, 29 Apr 2015 02:21:53 +0300
  24230. -Subject: [PATCH] AP WMM: Fix integer underflow in WMM Action frame parser
  24231. -
  24232. -The length of the WMM Action frame was not properly validated and the
  24233. -length of the information elements (int left) could end up being
  24234. -negative. This would result in reading significantly past the stack
  24235. -buffer while parsing the IEs in ieee802_11_parse_elems() and while doing
  24236. -so, resulting in segmentation fault.
  24237. -
  24238. -This can result in an invalid frame being used for a denial of service
  24239. -attack (hostapd process killed) against an AP with a driver that uses
  24240. -hostapd for management frame processing (e.g., all mac80211-based
  24241. -drivers).
  24242. -
  24243. -Thanks to Kostya Kortchinsky of Google security team for discovering and
  24244. -reporting this issue.
  24245. -
  24246. -Signed-off-by: Jouni Malinen <j@w1.fi>
  24247. ----
  24248. - src/ap/wmm.c | 3 +++
  24249. - 1 file changed, 3 insertions(+)
  24250. -
  24251. ---- a/src/ap/wmm.c
  24252. -+++ b/src/ap/wmm.c
  24253. -@@ -274,6 +274,9 @@ void hostapd_wmm_action(struct hostapd_d
  24254. - return;
  24255. - }
  24256. -
  24257. -+ if (left < 0)
  24258. -+ return; /* not a valid WMM Action frame */
  24259. -+
  24260. - /* extract the tspec info element */
  24261. - if (ieee802_11_parse_elems(pos, left, &elems, 1) == ParseFailed) {
  24262. - hostapd_logger(hapd, mgmt->sa, HOSTAPD_MODULE_IEEE80211,
  24263. 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
  24264. new file mode 100644
  24265. index 0000000..2439220
  24266. --- /dev/null
  24267. +++ b/package/network/services/hostapd/patches/002-mesh-Set-correct-secondary-channel-offset-if-HT40-is.patch
  24268. @@ -0,0 +1,61 @@
  24269. +From: Masashi Honma <masashi.honma@gmail.com>
  24270. +Date: Tue, 26 Jul 2016 11:45:40 +0900
  24271. +Subject: [PATCH] mesh: Set correct secondary channel offset if HT40 is
  24272. + disabled
  24273. +
  24274. +Previously, secondary channel offset could be non zero even though
  24275. +disable_ht40=1. This patch fixes it.
  24276. +
  24277. +Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
  24278. +---
  24279. +
  24280. +--- a/wpa_supplicant/wpa_supplicant.c
  24281. ++++ b/wpa_supplicant/wpa_supplicant.c
  24282. +@@ -1901,20 +1901,27 @@ void ibss_mesh_setup_freq(struct wpa_sup
  24283. + break;
  24284. + }
  24285. + }
  24286. ++#ifdef CONFIG_HT_OVERRIDES
  24287. ++ if (ssid->disable_ht40)
  24288. ++ ht40 = 0;
  24289. ++#endif /* CONFIG_HT_OVERRIDES */
  24290. +
  24291. +- /* Find secondary channel */
  24292. +- for (i = 0; i < mode->num_channels; i++) {
  24293. +- sec_chan = &mode->channels[i];
  24294. +- if (sec_chan->chan == channel + ht40 * 4)
  24295. +- break;
  24296. +- sec_chan = NULL;
  24297. +- }
  24298. +- if (!sec_chan)
  24299. +- return;
  24300. ++ if (ht40) {
  24301. ++ /* Find secondary channel */
  24302. ++ for (i = 0; i < mode->num_channels; i++) {
  24303. ++ sec_chan = &mode->channels[i];
  24304. ++ if (sec_chan->chan == channel + ht40 * 4)
  24305. ++ break;
  24306. ++ sec_chan = NULL;
  24307. ++ }
  24308. ++ if (!sec_chan)
  24309. ++ return;
  24310. +
  24311. +- /* Check secondary channel flags */
  24312. +- if (sec_chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR))
  24313. +- return;
  24314. ++ /* Check secondary channel flags */
  24315. ++ if (sec_chan->flag &
  24316. ++ (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR))
  24317. ++ return;
  24318. ++ }
  24319. +
  24320. + freq->channel = pri_chan->chan;
  24321. +
  24322. +@@ -1930,6 +1937,7 @@ void ibss_mesh_setup_freq(struct wpa_sup
  24323. + freq->sec_channel_offset = 1;
  24324. + break;
  24325. + default:
  24326. ++ freq->sec_channel_offset = 0;
  24327. + break;
  24328. + }
  24329. +
  24330. 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
  24331. deleted file mode 100644
  24332. index 36b4ca2..0000000
  24333. --- a/package/network/services/hostapd/patches/003-WPS-Fix-HTTP-chunked-transfer-encoding-parser.patch
  24334. +++ /dev/null
  24335. @@ -1,49 +0,0 @@
  24336. -From 5acd23f4581da58683f3cf5e36cb71bbe4070bd7 Mon Sep 17 00:00:00 2001
  24337. -From: Jouni Malinen <j@w1.fi>
  24338. -Date: Tue, 28 Apr 2015 17:08:33 +0300
  24339. -Subject: [PATCH] WPS: Fix HTTP chunked transfer encoding parser
  24340. -
  24341. -strtoul() return value may end up overflowing the int h->chunk_size and
  24342. -resulting in a negative value to be stored as the chunk_size. This could
  24343. -result in the following memcpy operation using a very large length
  24344. -argument which would result in a buffer overflow and segmentation fault.
  24345. -
  24346. -This could have been used to cause a denial service by any device that
  24347. -has been authorized for network access (either wireless or wired). This
  24348. -would affect both the WPS UPnP functionality in a WPS AP (hostapd with
  24349. -upnp_iface parameter set in the configuration) and WPS ER
  24350. -(wpa_supplicant with WPS_ER_START control interface command used).
  24351. -
  24352. -Validate the parsed chunk length value to avoid this. In addition to
  24353. -rejecting negative values, we can also reject chunk size that would be
  24354. -larger than the maximum configured body length.
  24355. -
  24356. -Thanks to Kostya Kortchinsky of Google security team for discovering and
  24357. -reporting this issue.
  24358. -
  24359. -Signed-off-by: Jouni Malinen <j@w1.fi>
  24360. ----
  24361. - src/wps/httpread.c | 7 +++++++
  24362. - 1 file changed, 7 insertions(+)
  24363. -
  24364. -diff --git a/src/wps/httpread.c b/src/wps/httpread.c
  24365. -index 2f08f37..d2855e3 100644
  24366. ---- a/src/wps/httpread.c
  24367. -+++ b/src/wps/httpread.c
  24368. -@@ -533,6 +533,13 @@ static void httpread_read_handler(int sd, void *eloop_ctx, void *sock_ctx)
  24369. - if (!isxdigit(*cbp))
  24370. - goto bad;
  24371. - h->chunk_size = strtoul(cbp, NULL, 16);
  24372. -+ if (h->chunk_size < 0 ||
  24373. -+ h->chunk_size > h->max_bytes) {
  24374. -+ wpa_printf(MSG_DEBUG,
  24375. -+ "httpread: Invalid chunk size %d",
  24376. -+ h->chunk_size);
  24377. -+ goto bad;
  24378. -+ }
  24379. - /* throw away chunk header
  24380. - * so we have only real data
  24381. - */
  24382. ---
  24383. -1.9.1
  24384. -
  24385. 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
  24386. deleted file mode 100644
  24387. index 91627fb..0000000
  24388. --- a/package/network/services/hostapd/patches/004-EAP-pwd-peer-Fix-payload-length-validation-for-Commi.patch
  24389. +++ /dev/null
  24390. @@ -1,73 +0,0 @@
  24391. -From dd2f043c9c43d156494e33d7ce22db96e6ef42c7 Mon Sep 17 00:00:00 2001
  24392. -From: Jouni Malinen <j@w1.fi>
  24393. -Date: Fri, 1 May 2015 16:37:45 +0300
  24394. -Subject: [PATCH 1/5] EAP-pwd peer: Fix payload length validation for Commit
  24395. - and Confirm
  24396. -
  24397. -The length of the received Commit and Confirm message payloads was not
  24398. -checked before reading them. This could result in a buffer read
  24399. -overflow when processing an invalid message.
  24400. -
  24401. -Fix this by verifying that the payload is of expected length before
  24402. -processing it. In addition, enforce correct state transition sequence to
  24403. -make sure there is no unexpected behavior if receiving a Commit/Confirm
  24404. -message before the previous exchanges have been completed.
  24405. -
  24406. -Thanks to Kostya Kortchinsky of Google security team for discovering and
  24407. -reporting this issue.
  24408. -
  24409. -Signed-off-by: Jouni Malinen <j@w1.fi>
  24410. ----
  24411. - src/eap_peer/eap_pwd.c | 29 +++++++++++++++++++++++++++++
  24412. - 1 file changed, 29 insertions(+)
  24413. -
  24414. -diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c
  24415. -index f2b0926..a629437 100644
  24416. ---- a/src/eap_peer/eap_pwd.c
  24417. -+++ b/src/eap_peer/eap_pwd.c
  24418. -@@ -355,6 +355,23 @@ eap_pwd_perform_commit_exchange(struct eap_sm *sm, struct eap_pwd_data *data,
  24419. - BIGNUM *mask = NULL, *x = NULL, *y = NULL, *cofactor = NULL;
  24420. - u16 offset;
  24421. - u8 *ptr, *scalar = NULL, *element = NULL;
  24422. -+ size_t prime_len, order_len;
  24423. -+
  24424. -+ if (data->state != PWD_Commit_Req) {
  24425. -+ ret->ignore = TRUE;
  24426. -+ goto fin;
  24427. -+ }
  24428. -+
  24429. -+ prime_len = BN_num_bytes(data->grp->prime);
  24430. -+ order_len = BN_num_bytes(data->grp->order);
  24431. -+
  24432. -+ if (payload_len != 2 * prime_len + order_len) {
  24433. -+ wpa_printf(MSG_INFO,
  24434. -+ "EAP-pwd: Unexpected Commit payload length %u (expected %u)",
  24435. -+ (unsigned int) payload_len,
  24436. -+ (unsigned int) (2 * prime_len + order_len));
  24437. -+ goto fin;
  24438. -+ }
  24439. -
  24440. - if (((data->private_value = BN_new()) == NULL) ||
  24441. - ((data->my_element = EC_POINT_new(data->grp->group)) == NULL) ||
  24442. -@@ -554,6 +571,18 @@ eap_pwd_perform_confirm_exchange(struct eap_sm *sm, struct eap_pwd_data *data,
  24443. - u8 conf[SHA256_MAC_LEN], *cruft = NULL, *ptr;
  24444. - int offset;
  24445. -
  24446. -+ if (data->state != PWD_Confirm_Req) {
  24447. -+ ret->ignore = TRUE;
  24448. -+ goto fin;
  24449. -+ }
  24450. -+
  24451. -+ if (payload_len != SHA256_MAC_LEN) {
  24452. -+ wpa_printf(MSG_INFO,
  24453. -+ "EAP-pwd: Unexpected Confirm payload length %u (expected %u)",
  24454. -+ (unsigned int) payload_len, SHA256_MAC_LEN);
  24455. -+ goto fin;
  24456. -+ }
  24457. -+
  24458. - /*
  24459. - * first build up the ciphersuite which is group | random_function |
  24460. - * prf
  24461. ---
  24462. -1.9.1
  24463. -
  24464. 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
  24465. deleted file mode 100644
  24466. index 5dca20b..0000000
  24467. --- a/package/network/services/hostapd/patches/005-EAP-pwd-server-Fix-payload-length-validation-for-Com.patch
  24468. +++ /dev/null
  24469. @@ -1,66 +0,0 @@
  24470. -From e28a58be26184c2a23f80b410e0997ef1bd5d578 Mon Sep 17 00:00:00 2001
  24471. -From: Jouni Malinen <j@w1.fi>
  24472. -Date: Fri, 1 May 2015 16:40:44 +0300
  24473. -Subject: [PATCH 2/5] EAP-pwd server: Fix payload length validation for Commit
  24474. - and Confirm
  24475. -
  24476. -The length of the received Commit and Confirm message payloads was not
  24477. -checked before reading them. This could result in a buffer read
  24478. -overflow when processing an invalid message.
  24479. -
  24480. -Fix this by verifying that the payload is of expected length before
  24481. -processing it. In addition, enforce correct state transition sequence to
  24482. -make sure there is no unexpected behavior if receiving a Commit/Confirm
  24483. -message before the previous exchanges have been completed.
  24484. -
  24485. -Thanks to Kostya Kortchinsky of Google security team for discovering and
  24486. -reporting this issue.
  24487. -
  24488. -Signed-off-by: Jouni Malinen <j@w1.fi>
  24489. ----
  24490. - src/eap_server/eap_server_pwd.c | 19 +++++++++++++++++++
  24491. - 1 file changed, 19 insertions(+)
  24492. -
  24493. -diff --git a/src/eap_server/eap_server_pwd.c b/src/eap_server/eap_server_pwd.c
  24494. -index 66bd5d2..3189105 100644
  24495. ---- a/src/eap_server/eap_server_pwd.c
  24496. -+++ b/src/eap_server/eap_server_pwd.c
  24497. -@@ -656,9 +656,21 @@ eap_pwd_process_commit_resp(struct eap_sm *sm, struct eap_pwd_data *data,
  24498. - BIGNUM *x = NULL, *y = NULL, *cofactor = NULL;
  24499. - EC_POINT *K = NULL, *point = NULL;
  24500. - int res = 0;
  24501. -+ size_t prime_len, order_len;
  24502. -
  24503. - wpa_printf(MSG_DEBUG, "EAP-pwd: Received commit response");
  24504. -
  24505. -+ prime_len = BN_num_bytes(data->grp->prime);
  24506. -+ order_len = BN_num_bytes(data->grp->order);
  24507. -+
  24508. -+ if (payload_len != 2 * prime_len + order_len) {
  24509. -+ wpa_printf(MSG_INFO,
  24510. -+ "EAP-pwd: Unexpected Commit payload length %u (expected %u)",
  24511. -+ (unsigned int) payload_len,
  24512. -+ (unsigned int) (2 * prime_len + order_len));
  24513. -+ goto fin;
  24514. -+ }
  24515. -+
  24516. - if (((data->peer_scalar = BN_new()) == NULL) ||
  24517. - ((data->k = BN_new()) == NULL) ||
  24518. - ((cofactor = BN_new()) == NULL) ||
  24519. -@@ -774,6 +786,13 @@ eap_pwd_process_confirm_resp(struct eap_sm *sm, struct eap_pwd_data *data,
  24520. - u8 conf[SHA256_MAC_LEN], *cruft = NULL, *ptr;
  24521. - int offset;
  24522. -
  24523. -+ if (payload_len != SHA256_MAC_LEN) {
  24524. -+ wpa_printf(MSG_INFO,
  24525. -+ "EAP-pwd: Unexpected Confirm payload length %u (expected %u)",
  24526. -+ (unsigned int) payload_len, SHA256_MAC_LEN);
  24527. -+ goto fin;
  24528. -+ }
  24529. -+
  24530. - /* build up the ciphersuite: group | random_function | prf */
  24531. - grp = htons(data->group_num);
  24532. - ptr = (u8 *) &cs;
  24533. ---
  24534. -1.9.1
  24535. -
  24536. 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
  24537. deleted file mode 100644
  24538. index 4d2f9d8..0000000
  24539. --- a/package/network/services/hostapd/patches/006-EAP-pwd-peer-Fix-Total-Length-parsing-for-fragment-r.patch
  24540. +++ /dev/null
  24541. @@ -1,52 +0,0 @@
  24542. -From 477c74395acd0123340457ba6f15ab345d42016e Mon Sep 17 00:00:00 2001
  24543. -From: Jouni Malinen <j@w1.fi>
  24544. -Date: Sat, 2 May 2015 19:23:04 +0300
  24545. -Subject: [PATCH 3/5] EAP-pwd peer: Fix Total-Length parsing for fragment
  24546. - reassembly
  24547. -
  24548. -The remaining number of bytes in the message could be smaller than the
  24549. -Total-Length field size, so the length needs to be explicitly checked
  24550. -prior to reading the field and decrementing the len variable. This could
  24551. -have resulted in the remaining length becoming negative and interpreted
  24552. -as a huge positive integer.
  24553. -
  24554. -In addition, check that there is no already started fragment in progress
  24555. -before allocating a new buffer for reassembling fragments. This avoid a
  24556. -potential memory leak when processing invalid message.
  24557. -
  24558. -Signed-off-by: Jouni Malinen <j@w1.fi>
  24559. ----
  24560. - src/eap_peer/eap_pwd.c | 12 ++++++++++++
  24561. - 1 file changed, 12 insertions(+)
  24562. -
  24563. -diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c
  24564. -index a629437..1d2079b 100644
  24565. ---- a/src/eap_peer/eap_pwd.c
  24566. -+++ b/src/eap_peer/eap_pwd.c
  24567. -@@ -866,11 +866,23 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret,
  24568. - * if it's the first fragment there'll be a length field
  24569. - */
  24570. - if (EAP_PWD_GET_LENGTH_BIT(lm_exch)) {
  24571. -+ if (len < 2) {
  24572. -+ wpa_printf(MSG_DEBUG,
  24573. -+ "EAP-pwd: Frame too short to contain Total-Length field");
  24574. -+ ret->ignore = TRUE;
  24575. -+ return NULL;
  24576. -+ }
  24577. - tot_len = WPA_GET_BE16(pos);
  24578. - wpa_printf(MSG_DEBUG, "EAP-pwd: Incoming fragments whose "
  24579. - "total length = %d", tot_len);
  24580. - if (tot_len > 15000)
  24581. - return NULL;
  24582. -+ if (data->inbuf) {
  24583. -+ wpa_printf(MSG_DEBUG,
  24584. -+ "EAP-pwd: Unexpected new fragment start when previous fragment is still in use");
  24585. -+ ret->ignore = TRUE;
  24586. -+ return NULL;
  24587. -+ }
  24588. - data->inbuf = wpabuf_alloc(tot_len);
  24589. - if (data->inbuf == NULL) {
  24590. - wpa_printf(MSG_INFO, "Out of memory to buffer "
  24591. ---
  24592. -1.9.1
  24593. -
  24594. 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
  24595. deleted file mode 100644
  24596. index 7edef09..0000000
  24597. --- a/package/network/services/hostapd/patches/007-EAP-pwd-server-Fix-Total-Length-parsing-for-fragment.patch
  24598. +++ /dev/null
  24599. @@ -1,50 +0,0 @@
  24600. -From 3035cc2894e08319b905bd6561e8bddc8c2db9fa Mon Sep 17 00:00:00 2001
  24601. -From: Jouni Malinen <j@w1.fi>
  24602. -Date: Sat, 2 May 2015 19:26:06 +0300
  24603. -Subject: [PATCH 4/5] EAP-pwd server: Fix Total-Length parsing for fragment
  24604. - reassembly
  24605. -
  24606. -The remaining number of bytes in the message could be smaller than the
  24607. -Total-Length field size, so the length needs to be explicitly checked
  24608. -prior to reading the field and decrementing the len variable. This could
  24609. -have resulted in the remaining length becoming negative and interpreted
  24610. -as a huge positive integer.
  24611. -
  24612. -In addition, check that there is no already started fragment in progress
  24613. -before allocating a new buffer for reassembling fragments. This avoid a
  24614. -potential memory leak when processing invalid message.
  24615. -
  24616. -Signed-off-by: Jouni Malinen <j@w1.fi>
  24617. ----
  24618. - src/eap_server/eap_server_pwd.c | 10 ++++++++++
  24619. - 1 file changed, 10 insertions(+)
  24620. -
  24621. -diff --git a/src/eap_server/eap_server_pwd.c b/src/eap_server/eap_server_pwd.c
  24622. -index 3189105..2bfc3c2 100644
  24623. ---- a/src/eap_server/eap_server_pwd.c
  24624. -+++ b/src/eap_server/eap_server_pwd.c
  24625. -@@ -942,11 +942,21 @@ static void eap_pwd_process(struct eap_sm *sm, void *priv,
  24626. - * the first fragment has a total length
  24627. - */
  24628. - if (EAP_PWD_GET_LENGTH_BIT(lm_exch)) {
  24629. -+ if (len < 2) {
  24630. -+ wpa_printf(MSG_DEBUG,
  24631. -+ "EAP-pwd: Frame too short to contain Total-Length field");
  24632. -+ return;
  24633. -+ }
  24634. - tot_len = WPA_GET_BE16(pos);
  24635. - wpa_printf(MSG_DEBUG, "EAP-pwd: Incoming fragments, total "
  24636. - "length = %d", tot_len);
  24637. - if (tot_len > 15000)
  24638. - return;
  24639. -+ if (data->inbuf) {
  24640. -+ wpa_printf(MSG_DEBUG,
  24641. -+ "EAP-pwd: Unexpected new fragment start when previous fragment is still in use");
  24642. -+ return;
  24643. -+ }
  24644. - data->inbuf = wpabuf_alloc(tot_len);
  24645. - if (data->inbuf == NULL) {
  24646. - wpa_printf(MSG_INFO, "EAP-pwd: Out of memory to "
  24647. ---
  24648. -1.9.1
  24649. -
  24650. 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
  24651. deleted file mode 100644
  24652. index a601323..0000000
  24653. --- a/package/network/services/hostapd/patches/008-EAP-pwd-peer-Fix-asymmetric-fragmentation-behavior.patch
  24654. +++ /dev/null
  24655. @@ -1,32 +0,0 @@
  24656. -From 28a069a545b06b99eb55ad53f63f2c99e65a98f6 Mon Sep 17 00:00:00 2001
  24657. -From: Jouni Malinen <j@w1.fi>
  24658. -Date: Sat, 2 May 2015 19:26:28 +0300
  24659. -Subject: [PATCH 5/5] EAP-pwd peer: Fix asymmetric fragmentation behavior
  24660. -
  24661. -The L (Length) and M (More) flags needs to be cleared before deciding
  24662. -whether the locally generated response requires fragmentation. This
  24663. -fixes an issue where these flags from the server could have been invalid
  24664. -for the following message. In some cases, this could have resulted in
  24665. -triggering the wpabuf security check that would terminate the process
  24666. -due to invalid buffer allocation.
  24667. -
  24668. -Signed-off-by: Jouni Malinen <j@w1.fi>
  24669. ----
  24670. - src/eap_peer/eap_pwd.c | 1 +
  24671. - 1 file changed, 1 insertion(+)
  24672. -
  24673. -diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c
  24674. -index 1d2079b..e58b13a 100644
  24675. ---- a/src/eap_peer/eap_pwd.c
  24676. -+++ b/src/eap_peer/eap_pwd.c
  24677. -@@ -968,6 +968,7 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret,
  24678. - /*
  24679. - * we have output! Do we need to fragment it?
  24680. - */
  24681. -+ lm_exch = EAP_PWD_GET_EXCHANGE(lm_exch);
  24682. - len = wpabuf_len(data->outbuf);
  24683. - if ((len + EAP_PWD_HDR_SIZE) > data->mtu) {
  24684. - resp = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_PWD, data->mtu,
  24685. ---
  24686. -1.9.1
  24687. -
  24688. 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
  24689. deleted file mode 100644
  24690. index dd34624..0000000
  24691. --- a/package/network/services/hostapd/patches/009-NFC-Fix-payload-length-validation-in-NDEF-record-par.patch
  24692. +++ /dev/null
  24693. @@ -1,61 +0,0 @@
  24694. -From df9079e72760ceb7ebe7fb11538200c516bdd886 Mon Sep 17 00:00:00 2001
  24695. -From: Jouni Malinen <j@w1.fi>
  24696. -Date: Tue, 7 Jul 2015 21:57:28 +0300
  24697. -Subject: [PATCH] NFC: Fix payload length validation in NDEF record parser
  24698. -
  24699. -It was possible for the 32-bit record->total_length value to end up
  24700. -wrapping around due to integer overflow if the longer form of payload
  24701. -length field is used and record->payload_length gets a value close to
  24702. -2^32. This could result in ndef_parse_record() accepting a too large
  24703. -payload length value and the record type filter reading up to about 20
  24704. -bytes beyond the end of the buffer and potentially killing the process.
  24705. -This could also result in an attempt to allocate close to 2^32 bytes of
  24706. -heap memory and if that were to succeed, a buffer read overflow of the
  24707. -same length which would most likely result in the process termination.
  24708. -In case of record->total_length ending up getting the value 0, there
  24709. -would be no buffer read overflow, but record parsing would result in an
  24710. -infinite loop in ndef_parse_records().
  24711. -
  24712. -Any of these error cases could potentially be used for denial of service
  24713. -attacks over NFC by using a malformed NDEF record on an NFC Tag or
  24714. -sending them during NFC connection handover if the application providing
  24715. -the NDEF message to hostapd/wpa_supplicant did no validation of the
  24716. -received records. While such validation is likely done in the NFC stack
  24717. -that needs to parse the NFC messages before further processing,
  24718. -hostapd/wpa_supplicant better be prepared for any data being included
  24719. -here.
  24720. -
  24721. -Fix this by validating record->payload_length value in a way that
  24722. -detects integer overflow. (CID 122668)
  24723. -
  24724. -Signed-off-by: Jouni Malinen <j@w1.fi>
  24725. ----
  24726. - src/wps/ndef.c | 5 ++++-
  24727. - 1 file changed, 4 insertions(+), 1 deletion(-)
  24728. -
  24729. -diff --git a/src/wps/ndef.c b/src/wps/ndef.c
  24730. -index 5604b0a..50d018f 100644
  24731. ---- a/src/wps/ndef.c
  24732. -+++ b/src/wps/ndef.c
  24733. -@@ -48,6 +48,8 @@ static int ndef_parse_record(const u8 *data, u32 size,
  24734. - if (size < 6)
  24735. - return -1;
  24736. - record->payload_length = ntohl(*(u32 *)pos);
  24737. -+ if (record->payload_length > size - 6)
  24738. -+ return -1;
  24739. - pos += sizeof(u32);
  24740. - }
  24741. -
  24742. -@@ -68,7 +70,8 @@ static int ndef_parse_record(const u8 *data, u32 size,
  24743. - pos += record->payload_length;
  24744. -
  24745. - record->total_length = pos - data;
  24746. -- if (record->total_length > size)
  24747. -+ if (record->total_length > size ||
  24748. -+ record->total_length < record->payload_length)
  24749. - return -1;
  24750. - return 0;
  24751. - }
  24752. ---
  24753. -1.9.1
  24754. -
  24755. 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
  24756. deleted file mode 100644
  24757. index 00e5b7c..0000000
  24758. --- a/package/network/services/hostapd/patches/010-WNM-Ignore-Key-Data-in-WNM-Sleep-Mode-Response-frame.patch
  24759. +++ /dev/null
  24760. @@ -1,32 +0,0 @@
  24761. -From 6b12d93d2c7428a34bfd4b3813ba339ed57b698a Mon Sep 17 00:00:00 2001
  24762. -From: Jouni Malinen <j@w1.fi>
  24763. -Date: Sun, 25 Oct 2015 15:45:50 +0200
  24764. -Subject: [PATCH] WNM: Ignore Key Data in WNM Sleep Mode Response frame if no
  24765. - PMF in use
  24766. -
  24767. -WNM Sleep Mode Response frame is used to update GTK/IGTK only if PMF is
  24768. -enabled. Verify that PMF is in use before using this field on station
  24769. -side to avoid accepting unauthenticated key updates. (CVE-2015-5310)
  24770. -
  24771. -Signed-off-by: Jouni Malinen <j@w1.fi>
  24772. ----
  24773. - wpa_supplicant/wnm_sta.c | 6 ++++++
  24774. - 1 file changed, 6 insertions(+)
  24775. -
  24776. -diff --git a/wpa_supplicant/wnm_sta.c b/wpa_supplicant/wnm_sta.c
  24777. -index 954de67..7d79499 100644
  24778. ---- a/wpa_supplicant/wnm_sta.c
  24779. -+++ b/wpa_supplicant/wnm_sta.c
  24780. -@@ -187,6 +187,12 @@ static void wnm_sleep_mode_exit_success(struct wpa_supplicant *wpa_s,
  24781. - end = ptr + key_len_total;
  24782. - wpa_hexdump_key(MSG_DEBUG, "WNM: Key Data", ptr, key_len_total);
  24783. -
  24784. -+ if (key_len_total && !wpa_sm_pmf_enabled(wpa_s->wpa)) {
  24785. -+ wpa_msg(wpa_s, MSG_INFO,
  24786. -+ "WNM: Ignore Key Data in WNM-Sleep Mode Response - PMF not enabled");
  24787. -+ return;
  24788. -+ }
  24789. -+
  24790. - while (ptr + 1 < end) {
  24791. - if (ptr + 2 + ptr[1] > end) {
  24792. - wpa_printf(MSG_DEBUG, "WNM: Invalid Key Data element "
  24793. 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
  24794. deleted file mode 100644
  24795. index 82c2639..0000000
  24796. --- a/package/network/services/hostapd/patches/011-EAP-pwd-peer-Fix-last-fragment-length-validation.patch
  24797. +++ /dev/null
  24798. @@ -1,54 +0,0 @@
  24799. -From 8057821706784608b828e769ccefbced95591e50 Mon Sep 17 00:00:00 2001
  24800. -From: Jouni Malinen <j@w1.fi>
  24801. -Date: Sun, 1 Nov 2015 18:18:17 +0200
  24802. -Subject: [PATCH] EAP-pwd peer: Fix last fragment length validation
  24803. -
  24804. -All but the last fragment had their length checked against the remaining
  24805. -room in the reassembly buffer. This allowed a suitably constructed last
  24806. -fragment frame to try to add extra data that would go beyond the buffer.
  24807. -The length validation code in wpabuf_put_data() prevents an actual
  24808. -buffer write overflow from occurring, but this results in process
  24809. -termination. (CVE-2015-5315)
  24810. -
  24811. -Signed-off-by: Jouni Malinen <j@w1.fi>
  24812. ----
  24813. - src/eap_peer/eap_pwd.c | 7 +++----
  24814. - 1 file changed, 3 insertions(+), 4 deletions(-)
  24815. -
  24816. -diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c
  24817. -index 1f78544..75ceef1 100644
  24818. ---- a/src/eap_peer/eap_pwd.c
  24819. -+++ b/src/eap_peer/eap_pwd.c
  24820. -@@ -903,7 +903,7 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret,
  24821. - /*
  24822. - * buffer and ACK the fragment
  24823. - */
  24824. -- if (EAP_PWD_GET_MORE_BIT(lm_exch)) {
  24825. -+ if (EAP_PWD_GET_MORE_BIT(lm_exch) || data->in_frag_pos) {
  24826. - data->in_frag_pos += len;
  24827. - if (data->in_frag_pos > wpabuf_size(data->inbuf)) {
  24828. - wpa_printf(MSG_INFO, "EAP-pwd: Buffer overflow attack "
  24829. -@@ -916,7 +916,8 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret,
  24830. - return NULL;
  24831. - }
  24832. - wpabuf_put_data(data->inbuf, pos, len);
  24833. --
  24834. -+ }
  24835. -+ if (EAP_PWD_GET_MORE_BIT(lm_exch)) {
  24836. - resp = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_PWD,
  24837. - EAP_PWD_HDR_SIZE,
  24838. - EAP_CODE_RESPONSE, eap_get_id(reqData));
  24839. -@@ -930,10 +931,8 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret,
  24840. - * we're buffering and this is the last fragment
  24841. - */
  24842. - if (data->in_frag_pos) {
  24843. -- wpabuf_put_data(data->inbuf, pos, len);
  24844. - wpa_printf(MSG_DEBUG, "EAP-pwd: Last fragment, %d bytes",
  24845. - (int) len);
  24846. -- data->in_frag_pos += len;
  24847. - pos = wpabuf_head_u8(data->inbuf);
  24848. - len = data->in_frag_pos;
  24849. - }
  24850. ---
  24851. -1.9.1
  24852. -
  24853. 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
  24854. deleted file mode 100644
  24855. index bfc4c74..0000000
  24856. --- a/package/network/services/hostapd/patches/012-EAP-pwd-server-Fix-last-fragment-length-validation.patch
  24857. +++ /dev/null
  24858. @@ -1,51 +0,0 @@
  24859. -From bef802ece03f9ae9d52a21f0cf4f1bc2c5a1f8aa Mon Sep 17 00:00:00 2001
  24860. -From: Jouni Malinen <j@w1.fi>
  24861. -Date: Sun, 1 Nov 2015 18:24:16 +0200
  24862. -Subject: [PATCH] EAP-pwd server: Fix last fragment length validation
  24863. -
  24864. -All but the last fragment had their length checked against the remaining
  24865. -room in the reassembly buffer. This allowed a suitably constructed last
  24866. -fragment frame to try to add extra data that would go beyond the buffer.
  24867. -The length validation code in wpabuf_put_data() prevents an actual
  24868. -buffer write overflow from occurring, but this results in process
  24869. -termination. (CVE-2015-5314)
  24870. -
  24871. -Signed-off-by: Jouni Malinen <j@w1.fi>
  24872. ----
  24873. - src/eap_server/eap_server_pwd.c | 6 +++---
  24874. - 1 file changed, 3 insertions(+), 3 deletions(-)
  24875. -
  24876. -diff --git a/src/eap_server/eap_server_pwd.c b/src/eap_server/eap_server_pwd.c
  24877. -index cb83ff7..9f787ab 100644
  24878. ---- a/src/eap_server/eap_server_pwd.c
  24879. -+++ b/src/eap_server/eap_server_pwd.c
  24880. -@@ -970,7 +970,7 @@ static void eap_pwd_process(struct eap_sm *sm, void *priv,
  24881. - /*
  24882. - * the first and all intermediate fragments have the M bit set
  24883. - */
  24884. -- if (EAP_PWD_GET_MORE_BIT(lm_exch)) {
  24885. -+ if (EAP_PWD_GET_MORE_BIT(lm_exch) || data->in_frag_pos) {
  24886. - if ((data->in_frag_pos + len) > wpabuf_size(data->inbuf)) {
  24887. - wpa_printf(MSG_DEBUG, "EAP-pwd: Buffer overflow "
  24888. - "attack detected! (%d+%d > %d)",
  24889. -@@ -981,6 +981,8 @@ static void eap_pwd_process(struct eap_sm *sm, void *priv,
  24890. - }
  24891. - wpabuf_put_data(data->inbuf, pos, len);
  24892. - data->in_frag_pos += len;
  24893. -+ }
  24894. -+ if (EAP_PWD_GET_MORE_BIT(lm_exch)) {
  24895. - wpa_printf(MSG_DEBUG, "EAP-pwd: Got a %d byte fragment",
  24896. - (int) len);
  24897. - return;
  24898. -@@ -990,8 +992,6 @@ static void eap_pwd_process(struct eap_sm *sm, void *priv,
  24899. - * buffering fragments so that's how we know it's the last)
  24900. - */
  24901. - if (data->in_frag_pos) {
  24902. -- wpabuf_put_data(data->inbuf, pos, len);
  24903. -- data->in_frag_pos += len;
  24904. - pos = wpabuf_head_u8(data->inbuf);
  24905. - len = data->in_frag_pos;
  24906. - wpa_printf(MSG_DEBUG, "EAP-pwd: Last fragment, %d bytes",
  24907. ---
  24908. -1.9.1
  24909. -
  24910. 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
  24911. deleted file mode 100644
  24912. index 3088f6a..0000000
  24913. --- a/package/network/services/hostapd/patches/013-EAP-pwd-peer-Fix-error-path-for-unexpected-Confirm-m.patch
  24914. +++ /dev/null
  24915. @@ -1,34 +0,0 @@
  24916. -From 95577884ca4fa76be91344ff7a8d5d1e6dc3da61 Mon Sep 17 00:00:00 2001
  24917. -From: Jouni Malinen <j@w1.fi>
  24918. -Date: Sun, 1 Nov 2015 19:35:44 +0200
  24919. -Subject: [PATCH] EAP-pwd peer: Fix error path for unexpected Confirm message
  24920. -
  24921. -If the Confirm message is received from the server before the Identity
  24922. -exchange has been completed, the group has not yet been determined and
  24923. -data->grp is NULL. The error path in eap_pwd_perform_confirm_exchange()
  24924. -did not take this corner case into account and could end up
  24925. -dereferencing a NULL pointer and terminating the process if invalid
  24926. -message sequence is received. (CVE-2015-5316)
  24927. -
  24928. -Signed-off-by: Jouni Malinen <j@w1.fi>
  24929. ----
  24930. - src/eap_peer/eap_pwd.c | 3 ++-
  24931. - 1 file changed, 2 insertions(+), 1 deletion(-)
  24932. -
  24933. -diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c
  24934. -index 75ceef1..892b590 100644
  24935. ---- a/src/eap_peer/eap_pwd.c
  24936. -+++ b/src/eap_peer/eap_pwd.c
  24937. -@@ -774,7 +774,8 @@ eap_pwd_perform_confirm_exchange(struct eap_sm *sm, struct eap_pwd_data *data,
  24938. - wpabuf_put_data(data->outbuf, conf, SHA256_MAC_LEN);
  24939. -
  24940. - fin:
  24941. -- bin_clear_free(cruft, BN_num_bytes(data->grp->prime));
  24942. -+ if (data->grp)
  24943. -+ bin_clear_free(cruft, BN_num_bytes(data->grp->prime));
  24944. - BN_clear_free(x);
  24945. - BN_clear_free(y);
  24946. - if (data->outbuf == NULL) {
  24947. ---
  24948. -1.9.1
  24949. -
  24950. diff --git a/package/network/services/hostapd/patches/014-nl80211-Try-running-without-mgmt-frame-subscription-.patch b/package/network/services/hostapd/patches/014-nl80211-Try-running-without-mgmt-frame-subscription-.patch
  24951. deleted file mode 100644
  24952. index 25ba87d..0000000
  24953. --- a/package/network/services/hostapd/patches/014-nl80211-Try-running-without-mgmt-frame-subscription-.patch
  24954. +++ /dev/null
  24955. @@ -1,48 +0,0 @@
  24956. -From f4830bed661f4adff51f50a0d37c64ceb748e780 Mon Sep 17 00:00:00 2001
  24957. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  24958. -Date: Mon, 25 Apr 2016 17:10:47 +0200
  24959. -Subject: [PATCH] nl80211: Try running without mgmt frame subscription (driver
  24960. - AP SME)
  24961. -MIME-Version: 1.0
  24962. -Content-Type: text/plain; charset=UTF-8
  24963. -Content-Transfer-Encoding: 8bit
  24964. -
  24965. -One of supported code paths already allows this scenario. It is used if
  24966. -driver doesn't report NL80211_ATTR_DEVICE_AP_SME and doesn't support
  24967. -monitor interface. In such situation:
  24968. -1) We don't quit if subscribing for WLAN_FC_STYPE_PROBE_REQ fails
  24969. -2) We don't try subscribing for WLAN_FC_STYPE_ACTION
  24970. -3) We fallback to AP SME mode after failing to create monitor interface
  24971. -4) We don't quit if subscribing for WLAN_FC_STYPE_PROBE_REQ fails
  24972. -Above scenario is used, e.g., with brcmfmac. As you can see - thanks to
  24973. -events provided by cfg80211 - it's not really required to receive Probe
  24974. -Request or action frames.
  24975. -
  24976. -However, the previous implementation did not allow using hostapd with
  24977. -drivers that:
  24978. -1) Report NL80211_ATTR_DEVICE_AP_SME
  24979. -2) Don't support subscribing for PROBE_REQ and/or ACTION frames
  24980. -In case of using such a driver hostapd will cancel setup after failing
  24981. -to subscribe for WLAN_FC_STYPE_ACTION. I noticed it after setting flag
  24982. -WIPHY_FLAG_HAVE_AP_SME in brcmfmac driver for my experiments.
  24983. -
  24984. -This patch allows working with such drivers with just a small warning
  24985. -printed as debug message.
  24986. -
  24987. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  24988. ----
  24989. - src/drivers/driver_nl80211.c | 3 ++-
  24990. - 1 file changed, 2 insertions(+), 1 deletion(-)
  24991. -
  24992. ---- a/src/drivers/driver_nl80211.c
  24993. -+++ b/src/drivers/driver_nl80211.c
  24994. -@@ -4108,7 +4108,8 @@ static int nl80211_setup_ap(struct i802_
  24995. -
  24996. - if (drv->device_ap_sme && !drv->use_monitor)
  24997. - if (nl80211_mgmt_subscribe_ap_dev_sme(bss))
  24998. -- return -1;
  24999. -+ wpa_printf(MSG_DEBUG,
  25000. -+ "nl80211: Failed to subscribe for mgmt frames from SME driver - trying to run without it");
  25001. -
  25002. - if (!drv->device_ap_sme && drv->use_monitor &&
  25003. - nl80211_create_monitor_interface(drv) &&
  25004. diff --git a/package/network/services/hostapd/patches/100-mesh_mode_fix.patch b/package/network/services/hostapd/patches/100-mesh_mode_fix.patch
  25005. new file mode 100644
  25006. index 0000000..ceb4c53
  25007. --- /dev/null
  25008. +++ b/package/network/services/hostapd/patches/100-mesh_mode_fix.patch
  25009. @@ -0,0 +1,12 @@
  25010. +--- a/src/drivers/driver_nl80211.c
  25011. ++++ b/src/drivers/driver_nl80211.c
  25012. +@@ -2332,7 +2332,8 @@ wpa_driver_nl80211_finish_drv_init(struc
  25013. +
  25014. + if (drv->hostapd || bss->static_ap)
  25015. + nlmode = NL80211_IFTYPE_AP;
  25016. +- else if (bss->if_dynamic)
  25017. ++ else if (bss->if_dynamic ||
  25018. ++ nl80211_get_ifmode(bss) == NL80211_IFTYPE_MESH_POINT)
  25019. + nlmode = nl80211_get_ifmode(bss);
  25020. + else
  25021. + nlmode = NL80211_IFTYPE_STATION;
  25022. diff --git a/package/network/services/hostapd/patches/110-bool_fix.patch b/package/network/services/hostapd/patches/110-bool_fix.patch
  25023. deleted file mode 100644
  25024. index 865c014..0000000
  25025. --- a/package/network/services/hostapd/patches/110-bool_fix.patch
  25026. +++ /dev/null
  25027. @@ -1,14 +0,0 @@
  25028. ---- a/src/ap/ieee802_1x.c
  25029. -+++ b/src/ap/ieee802_1x.c
  25030. -@@ -2332,9 +2332,9 @@ void ieee802_1x_notify_pre_auth(struct e
  25031. - }
  25032. -
  25033. -
  25034. --static const char * bool_txt(Boolean bool)
  25035. -+static const char * bool_txt(Boolean bool_val)
  25036. - {
  25037. -- return bool ? "TRUE" : "FALSE";
  25038. -+ return bool_val ? "TRUE" : "FALSE";
  25039. - }
  25040. -
  25041. -
  25042. 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
  25043. new file mode 100644
  25044. index 0000000..67fb899
  25045. --- /dev/null
  25046. +++ b/package/network/services/hostapd/patches/110-fix_parse_das_client.patch
  25047. @@ -0,0 +1,10 @@
  25048. +--- a/hostapd/config_file.c
  25049. ++++ b/hostapd/config_file.c
  25050. +@@ -645,6 +645,7 @@ static int hostapd_parse_das_client(stru
  25051. + if (secret == NULL)
  25052. + return -1;
  25053. +
  25054. ++ *secret = 0;
  25055. + secret++;
  25056. +
  25057. + if (hostapd_parse_ip_addr(val, &bss->radius_das_client_addr))
  25058. diff --git a/package/network/services/hostapd/patches/120-daemonize_fix.patch b/package/network/services/hostapd/patches/120-daemonize_fix.patch
  25059. index 032e207..0389406 100644
  25060. --- a/package/network/services/hostapd/patches/120-daemonize_fix.patch
  25061. +++ b/package/network/services/hostapd/patches/120-daemonize_fix.patch
  25062. @@ -8,7 +8,7 @@
  25063. #ifdef ANDROID
  25064. #include <sys/capability.h>
  25065. -@@ -155,59 +156,46 @@ int os_gmtime(os_time_t t, struct os_tm
  25066. +@@ -179,59 +180,46 @@ int os_gmtime(os_time_t t, struct os_tm
  25067. return 0;
  25068. }
  25069. @@ -60,13 +60,13 @@
  25070. + if (chdir("/") < 0)
  25071. return -1;
  25072. - }
  25073. --
  25074. +
  25075. - return 0;
  25076. -}
  25077. -#else /* __APPLE__ */
  25078. -#define os_daemon daemon
  25079. -#endif /* __APPLE__ */
  25080. -
  25081. +-
  25082. -
  25083. -int os_daemonize(const char *pid_file)
  25084. -{
  25085. diff --git a/package/network/services/hostapd/patches/130-no_eapol_fix.patch b/package/network/services/hostapd/patches/130-no_eapol_fix.patch
  25086. index d23b47b..5aee3d0 100644
  25087. --- a/package/network/services/hostapd/patches/130-no_eapol_fix.patch
  25088. +++ b/package/network/services/hostapd/patches/130-no_eapol_fix.patch
  25089. @@ -1,6 +1,6 @@
  25090. --- a/wpa_supplicant/wpa_supplicant.c
  25091. +++ b/wpa_supplicant/wpa_supplicant.c
  25092. -@@ -252,9 +252,10 @@ void wpa_supplicant_cancel_auth_timeout(
  25093. +@@ -257,9 +257,10 @@ void wpa_supplicant_cancel_auth_timeout(
  25094. */
  25095. void wpa_supplicant_initiate_eapol(struct wpa_supplicant *wpa_s)
  25096. {
  25097. 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
  25098. index 6337d8d..fdd5da9 100644
  25099. --- a/package/network/services/hostapd/patches/140-disable_bridge_packet_workaround.patch
  25100. +++ b/package/network/services/hostapd/patches/140-disable_bridge_packet_workaround.patch
  25101. @@ -1,6 +1,6 @@
  25102. --- a/src/l2_packet/l2_packet_linux.c
  25103. +++ b/src/l2_packet/l2_packet_linux.c
  25104. -@@ -307,8 +307,7 @@ struct l2_packet_data * l2_packet_init_b
  25105. +@@ -337,8 +337,7 @@ struct l2_packet_data * l2_packet_init_b
  25106. l2 = l2_packet_init(br_ifname, own_addr, protocol, rx_callback,
  25107. rx_callback_ctx, l2_hdr);
  25108. @@ -8,5 +8,5 @@
  25109. - return NULL;
  25110. + return l2;
  25111. + #ifndef CONFIG_NO_LINUX_PACKET_SOCKET_WAR
  25112. /*
  25113. - * The Linux packet socket behavior has changed over the years and there
  25114. 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
  25115. deleted file mode 100644
  25116. index 66c682f..0000000
  25117. --- a/package/network/services/hostapd/patches/150-nl80211-Report-disassociated-STA-lost-peer-for-the-c.patch
  25118. +++ /dev/null
  25119. @@ -1,67 +0,0 @@
  25120. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  25121. -Date: Mon, 11 Jan 2016 19:18:06 +0100
  25122. -Subject: [PATCH] nl80211: Report disassociated STA / lost peer for the correct
  25123. - BSS
  25124. -MIME-Version: 1.0
  25125. -Content-Type: text/plain; charset=UTF-8
  25126. -Content-Transfer-Encoding: 8bit
  25127. -
  25128. -We shouldn't use drv->ctx as it always points to the first BSS. When
  25129. -using FullMAC driver with multi-BSS support it resulted in incorrect
  25130. -treating nl80211 events. I noticed with with brcmfmac and BCM43602.
  25131. -
  25132. -Before my change I was getting "disassociated" on a wrong interface:
  25133. -wlan0-1: STA 78:d6:f0:00:11:22 IEEE 802.11: associated
  25134. -wlan0-1: STA 78:d6:f0:00:11:22 WPA: pairwise key handshake completed (RSN)
  25135. -wlan0: STA 78:d6:f0:00:11:22 IEEE 802.11: disassociated
  25136. -
  25137. -With this patch it works as expected:
  25138. -wlan0-1: STA 78:d6:f0:00:11:22 IEEE 802.11: associated
  25139. -wlan0-1: STA 78:d6:f0:00:11:22 WPA: pairwise key handshake completed (RSN)
  25140. -wlan0-1: STA 78:d6:f0:00:11:22 IEEE 802.11: disassociated
  25141. -
  25142. -This doesn't apply to hostapd dealing with SoftMAC drivers when handling
  25143. -AP SME & MLME is done it hostapd not the firmware.
  25144. -
  25145. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  25146. ----
  25147. - src/drivers/driver_nl80211_event.c | 7 ++++---
  25148. - 1 file changed, 4 insertions(+), 3 deletions(-)
  25149. -
  25150. ---- a/src/drivers/driver_nl80211_event.c
  25151. -+++ b/src/drivers/driver_nl80211_event.c
  25152. -@@ -1154,6 +1154,7 @@ static void nl80211_new_station_event(st
  25153. -
  25154. -
  25155. - static void nl80211_del_station_event(struct wpa_driver_nl80211_data *drv,
  25156. -+ struct i802_bss *bss,
  25157. - struct nlattr **tb)
  25158. - {
  25159. - u8 *addr;
  25160. -@@ -1166,7 +1167,7 @@ static void nl80211_del_station_event(st
  25161. - MAC2STR(addr));
  25162. -
  25163. - if (is_ap_interface(drv->nlmode) && drv->device_ap_sme) {
  25164. -- drv_event_disassoc(drv->ctx, addr);
  25165. -+ drv_event_disassoc(bss->ctx, addr);
  25166. - return;
  25167. - }
  25168. -
  25169. -@@ -1175,7 +1176,7 @@ static void nl80211_del_station_event(st
  25170. -
  25171. - os_memset(&data, 0, sizeof(data));
  25172. - os_memcpy(data.ibss_peer_lost.peer, addr, ETH_ALEN);
  25173. -- wpa_supplicant_event(drv->ctx, EVENT_IBSS_PEER_LOST, &data);
  25174. -+ wpa_supplicant_event(bss->ctx, EVENT_IBSS_PEER_LOST, &data);
  25175. - }
  25176. -
  25177. -
  25178. -@@ -1939,7 +1940,7 @@ static void do_process_drv_event(struct
  25179. - nl80211_new_station_event(drv, bss, tb);
  25180. - break;
  25181. - case NL80211_CMD_DEL_STATION:
  25182. -- nl80211_del_station_event(drv, tb);
  25183. -+ nl80211_del_station_event(drv, bss, tb);
  25184. - break;
  25185. - case NL80211_CMD_SET_REKEY_OFFLOAD:
  25186. - nl80211_rekey_offload_event(drv, tb);
  25187. diff --git a/package/network/services/hostapd/patches/200-multicall.patch b/package/network/services/hostapd/patches/200-multicall.patch
  25188. index de4a3a8..40bd733 100644
  25189. --- a/package/network/services/hostapd/patches/200-multicall.patch
  25190. +++ b/package/network/services/hostapd/patches/200-multicall.patch
  25191. @@ -1,15 +1,25 @@
  25192. --- a/hostapd/Makefile
  25193. +++ b/hostapd/Makefile
  25194. -@@ -17,6 +17,7 @@ export BINDIR ?= /usr/local/bin/
  25195. - # CFLAGS += -DUSE_KERNEL_HEADERS -I/usr/src/linux/include
  25196. +@@ -28,6 +28,7 @@ CFLAGS += -I$(abspath ../src/utils)
  25197. + export BINDIR ?= /usr/local/bin/
  25198. -include .config
  25199. +-include $(if $(MULTICALL), ../wpa_supplicant/.config)
  25200. - ifdef CONFIG_TESTING_OPTIONS
  25201. - CFLAGS += -DCONFIG_TESTING_OPTIONS
  25202. -@@ -242,10 +243,14 @@ ifdef CONFIG_IEEE80211AC
  25203. - CFLAGS += -DCONFIG_IEEE80211AC
  25204. + ifndef CONFIG_NO_GITVER
  25205. + # Add VERSION_STR postfix for builds from a git repository
  25206. +@@ -190,7 +191,8 @@ endif
  25207. +
  25208. + ifdef CONFIG_NO_VLAN
  25209. + CFLAGS += -DCONFIG_NO_VLAN
  25210. +-else
  25211. ++endif
  25212. ++ifneq ($(findstring CONFIG_NO_VLAN,$(CFLAGS)), CONFIG_NO_VLAN)
  25213. + OBJS += ../src/ap/vlan_init.o
  25214. + OBJS += ../src/ap/vlan_ifconfig.o
  25215. + OBJS += ../src/ap/vlan.o
  25216. +@@ -315,10 +317,14 @@ CFLAGS += -DCONFIG_MBO
  25217. + OBJS += ../src/ap/mbo_ap.o
  25218. endif
  25219. +ifndef MULTICALL
  25220. @@ -26,7 +36,7 @@
  25221. LIBS += $(DRV_AP_LIBS)
  25222. ifdef CONFIG_L2_PACKET
  25223. -@@ -941,6 +946,12 @@ install: $(addprefix $(DESTDIR)$(BINDIR)
  25224. +@@ -1051,6 +1057,12 @@ install: $(addprefix $(DESTDIR)$(BINDIR)
  25225. BCHECK=../src/drivers/build.hostapd
  25226. @@ -39,30 +49,40 @@
  25227. hostapd: $(BCHECK) $(OBJS)
  25228. $(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS)
  25229. @$(E) " LD " $@
  25230. -@@ -980,6 +991,12 @@ HOBJS += ../src/crypto/aes-internal.o
  25231. +@@ -1092,6 +1104,12 @@ HOBJS += ../src/crypto/aes-internal.o
  25232. HOBJS += ../src/crypto/aes-internal-enc.o
  25233. endif
  25234. +dump_cflags:
  25235. -+ @echo -n $(CFLAGS) " "
  25236. ++ @printf "%s " "$(CFLAGS)"
  25237. +
  25238. +dump_ldflags:
  25239. -+ @echo -n $(LDFLAGS) $(LIBS) $(EXTRALIBS) " "
  25240. ++ @printf "%s " "$(LDFLAGS) $(LIBS) $(EXTRALIBS)"
  25241. +
  25242. nt_password_hash: $(NOBJS)
  25243. $(Q)$(CC) $(LDFLAGS) -o nt_password_hash $(NOBJS) $(LIBS_n)
  25244. @$(E) " LD " $@
  25245. --- a/wpa_supplicant/Makefile
  25246. +++ b/wpa_supplicant/Makefile
  25247. -@@ -15,6 +15,7 @@ CFLAGS += -I$(abspath ../src)
  25248. +@@ -27,6 +27,7 @@ CFLAGS += -I$(abspath ../src)
  25249. CFLAGS += -I$(abspath ../src/utils)
  25250. -include .config
  25251. +-include $(if $(MULTICALL),../hostapd/.config)
  25252. - ifdef CONFIG_TESTING_OPTIONS
  25253. - CFLAGS += -DCONFIG_TESTING_OPTIONS
  25254. -@@ -773,6 +774,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS
  25255. + ifndef CONFIG_NO_GITVER
  25256. + # Add VERSION_STR postfix for builds from a git repository
  25257. +@@ -312,7 +313,9 @@ endif
  25258. + ifdef CONFIG_IBSS_RSN
  25259. + NEED_RSN_AUTHENTICATOR=y
  25260. + CFLAGS += -DCONFIG_IBSS_RSN
  25261. ++ifndef MULTICALL
  25262. + CFLAGS += -DCONFIG_NO_VLAN
  25263. ++endif
  25264. + OBJS += ibss_rsn.o
  25265. + endif
  25266. +
  25267. +@@ -803,6 +806,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS
  25268. CFLAGS += -DCONFIG_DYNAMIC_EAP_METHODS
  25269. LIBS += -ldl -rdynamic
  25270. endif
  25271. @@ -73,7 +93,7 @@
  25272. endif
  25273. ifdef CONFIG_MACSEC
  25274. -@@ -793,9 +798,11 @@ NEED_EAP_COMMON=y
  25275. +@@ -823,9 +830,11 @@ NEED_EAP_COMMON=y
  25276. NEED_RSN_AUTHENTICATOR=y
  25277. CFLAGS += -DCONFIG_AP
  25278. OBJS += ap.o
  25279. @@ -85,7 +105,7 @@
  25280. OBJS += ../src/ap/hostapd.o
  25281. OBJS += ../src/ap/wpa_auth_glue.o
  25282. OBJS += ../src/ap/utils.o
  25283. -@@ -858,10 +865,18 @@ endif
  25284. +@@ -898,10 +907,18 @@ endif
  25285. ifdef CONFIG_HS20
  25286. OBJS += ../src/ap/hs20.o
  25287. endif
  25288. @@ -104,7 +124,7 @@
  25289. NEED_AES_WRAP=y
  25290. OBJS += ../src/ap/wpa_auth.o
  25291. OBJS += ../src/ap/wpa_auth_ie.o
  25292. -@@ -1603,6 +1618,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv)
  25293. +@@ -1680,6 +1697,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv)
  25294. $(OBJS_c) $(OBJS_t) $(OBJS_t2) $(OBJS) $(BCHECK) $(EXTRA_progs): .config
  25295. @@ -117,22 +137,22 @@
  25296. wpa_supplicant: $(BCHECK) $(OBJS) $(EXTRA_progs)
  25297. $(Q)$(LDO) $(LDFLAGS) -o wpa_supplicant $(OBJS) $(LIBS) $(EXTRALIBS)
  25298. @$(E) " LD " $@
  25299. -@@ -1694,6 +1715,12 @@ endif
  25300. - $(Q)sed -e 's|\@BINDIR\@|$(BINDIR)|g' $< >$@
  25301. +@@ -1782,6 +1805,12 @@ endif
  25302. + -e 's|\@DBUS_INTERFACE\@|$(DBUS_INTERFACE)|g' $< >$@
  25303. @$(E) " sed" $<
  25304. +dump_cflags:
  25305. -+ @echo -n $(CFLAGS) " "
  25306. ++ @printf "%s " "$(CFLAGS)"
  25307. +
  25308. +dump_ldflags:
  25309. -+ @echo -n $(LDFLAGS) $(LIBS) $(EXTRALIBS) " "
  25310. ++ @printf "%s " "$(LDFLAGS) $(LIBS) $(EXTRALIBS)"
  25311. +
  25312. wpa_supplicant.exe: wpa_supplicant
  25313. mv -f $< $@
  25314. wpa_cli.exe: wpa_cli
  25315. --- a/src/drivers/driver.h
  25316. +++ b/src/drivers/driver.h
  25317. -@@ -4581,8 +4581,8 @@ union wpa_event_data {
  25318. +@@ -4794,8 +4794,8 @@ union wpa_event_data {
  25319. * Driver wrapper code should call this function whenever an event is received
  25320. * from the driver.
  25321. */
  25322. @@ -141,11 +161,20 @@
  25323. +extern void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event,
  25324. + union wpa_event_data *data);
  25325. + /**
  25326. + * wpa_supplicant_event_global - Report a driver event for wpa_supplicant
  25327. +@@ -4807,7 +4807,7 @@ void wpa_supplicant_event(void *ctx, enu
  25328. + * Same as wpa_supplicant_event(), but we search for the interface in
  25329. + * wpa_global.
  25330. + */
  25331. +-void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
  25332. ++extern void (*wpa_supplicant_event_global)(void *ctx, enum wpa_event_type event,
  25333. + union wpa_event_data *data);
  25334. /*
  25335. --- a/src/ap/drv_callbacks.c
  25336. +++ b/src/ap/drv_callbacks.c
  25337. -@@ -1075,8 +1075,8 @@ static void hostapd_event_dfs_cac_starte
  25338. +@@ -1157,8 +1157,8 @@ static void hostapd_event_dfs_cac_starte
  25339. #endif /* NEED_AP_MLME */
  25340. @@ -156,9 +185,18 @@
  25341. {
  25342. struct hostapd_data *hapd = ctx;
  25343. #ifndef CONFIG_NO_STDOUT_DEBUG
  25344. +@@ -1367,7 +1367,7 @@ void wpa_supplicant_event(void *ctx, enu
  25345. + }
  25346. +
  25347. +
  25348. +-void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
  25349. ++void hostapd_wpa_event_global(void *ctx, enum wpa_event_type event,
  25350. + union wpa_event_data *data)
  25351. + {
  25352. + struct hapd_interfaces *interfaces = ctx;
  25353. --- a/wpa_supplicant/wpa_priv.c
  25354. +++ b/wpa_supplicant/wpa_priv.c
  25355. -@@ -819,8 +819,8 @@ static void wpa_priv_send_ft_response(st
  25356. +@@ -940,8 +940,8 @@ static void wpa_priv_send_ft_response(st
  25357. }
  25358. @@ -169,17 +207,27 @@
  25359. {
  25360. struct wpa_priv_interface *iface = ctx;
  25361. -@@ -961,6 +961,7 @@ int main(int argc, char *argv[])
  25362. +@@ -1010,7 +1010,7 @@ void wpa_supplicant_event(void *ctx, enu
  25363. + }
  25364. +
  25365. +
  25366. +-void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
  25367. ++void supplicant_event_global(void *ctx, enum wpa_event_type event,
  25368. + union wpa_event_data *data)
  25369. + {
  25370. + struct wpa_priv_global *global = ctx;
  25371. +@@ -1122,6 +1122,8 @@ int main(int argc, char *argv[])
  25372. if (os_program_init())
  25373. return -1;
  25374. + wpa_supplicant_event = supplicant_event;
  25375. ++ wpa_supplicant_event_global = supplicant_event_global;
  25376. wpa_priv_fd_workaround();
  25377. - for (;;) {
  25378. + os_memset(&global, 0, sizeof(global));
  25379. --- a/wpa_supplicant/events.c
  25380. +++ b/wpa_supplicant/events.c
  25381. -@@ -3138,8 +3138,8 @@ static void wpa_supplicant_event_assoc_a
  25382. +@@ -3384,8 +3384,8 @@ static void wpa_supplicant_event_assoc_a
  25383. }
  25384. @@ -189,88 +237,125 @@
  25385. + union wpa_event_data *data)
  25386. {
  25387. struct wpa_supplicant *wpa_s = ctx;
  25388. + int resched;
  25389. +@@ -4051,7 +4051,7 @@ void wpa_supplicant_event(void *ctx, enu
  25390. + #endif /* CONFIG_AP */
  25391. + break;
  25392. + case EVENT_ACS_CHANNEL_SELECTED:
  25393. +-#ifdef CONFIG_ACS
  25394. ++#if defined(CONFIG_ACS) && defined(CONFIG_AP)
  25395. + if (!wpa_s->ap_iface)
  25396. + break;
  25397. + hostapd_acs_channel_selected(wpa_s->ap_iface->bss[0],
  25398. +@@ -4065,7 +4065,7 @@ void wpa_supplicant_event(void *ctx, enu
  25399. + }
  25400. +
  25401. +-void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
  25402. ++void supplicant_event_global(void *ctx, enum wpa_event_type event,
  25403. + union wpa_event_data *data)
  25404. + {
  25405. + struct wpa_supplicant *wpa_s;
  25406. --- a/wpa_supplicant/wpa_supplicant.c
  25407. +++ b/wpa_supplicant/wpa_supplicant.c
  25408. -@@ -4300,6 +4300,9 @@ static void wpa_supplicant_deinit_iface(
  25409. - os_free(wpa_s);
  25410. +@@ -4990,7 +4990,6 @@ struct wpa_interface * wpa_supplicant_ma
  25411. + return NULL;
  25412. }
  25413. +-
  25414. + /**
  25415. + * wpa_supplicant_match_existing - Match existing interfaces
  25416. + * @global: Pointer to global data from wpa_supplicant_init()
  25417. +@@ -5027,6 +5026,11 @@ static int wpa_supplicant_match_existing
  25418. +
  25419. + #endif /* CONFIG_MATCH_IFACE */
  25420. +
  25421. +extern void supplicant_event(void *ctx, enum wpa_event_type event,
  25422. + union wpa_event_data *data);
  25423. +
  25424. ++extern void supplicant_event_global(void *ctx, enum wpa_event_type event,
  25425. ++ union wpa_event_data *data);
  25426. /**
  25427. * wpa_supplicant_add_iface - Add a new network interface
  25428. -@@ -4526,6 +4529,7 @@ struct wpa_global * wpa_supplicant_init(
  25429. +@@ -5282,6 +5286,8 @@ struct wpa_global * wpa_supplicant_init(
  25430. #ifndef CONFIG_NO_WPA_MSG
  25431. wpa_msg_register_ifname_cb(wpa_supplicant_msg_ifname_cb);
  25432. #endif /* CONFIG_NO_WPA_MSG */
  25433. + wpa_supplicant_event = supplicant_event;
  25434. ++ wpa_supplicant_event_global = supplicant_event_global;
  25435. if (params->wpa_debug_file_path)
  25436. wpa_debug_open_file(params->wpa_debug_file_path);
  25437. --- a/hostapd/main.c
  25438. +++ b/hostapd/main.c
  25439. -@@ -511,6 +511,9 @@ static int hostapd_get_ctrl_iface_group(
  25440. - return 0;
  25441. +@@ -583,6 +583,11 @@ fail:
  25442. + return -1;
  25443. }
  25444. +void hostapd_wpa_event(void *ctx, enum wpa_event_type event,
  25445. + union wpa_event_data *data);
  25446. +
  25447. ++void hostapd_wpa_event_global(void *ctx, enum wpa_event_type event,
  25448. ++ union wpa_event_data *data);
  25449. #ifdef CONFIG_WPS
  25450. static int gen_uuid(const char *txt_addr)
  25451. -@@ -562,6 +565,7 @@ int main(int argc, char *argv[])
  25452. - interfaces.global_iface_name = NULL;
  25453. +@@ -660,6 +665,8 @@ int main(int argc, char *argv[])
  25454. interfaces.global_ctrl_sock = -1;
  25455. + dl_list_init(&interfaces.global_ctrl_dst);
  25456. + wpa_supplicant_event = hostapd_wpa_event;
  25457. ++ wpa_supplicant_event_global = hostapd_wpa_event_global;
  25458. for (;;) {
  25459. - c = getopt(argc, argv, "b:Bde:f:hKP:Ttu:vg:G:");
  25460. + c = getopt(argc, argv, "b:Bde:f:hi:KP:STtu:vg:G:");
  25461. if (c < 0)
  25462. --- a/src/drivers/drivers.c
  25463. +++ b/src/drivers/drivers.c
  25464. -@@ -10,6 +10,9 @@
  25465. +@@ -10,6 +10,11 @@
  25466. #include "utils/common.h"
  25467. #include "driver.h"
  25468. +void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event,
  25469. + union wpa_event_data *data);
  25470. ++void (*wpa_supplicant_event_global)(void *ctx, enum wpa_event_type event,
  25471. ++ union wpa_event_data *data);
  25472. +
  25473. #ifdef CONFIG_DRIVER_WEXT
  25474. extern struct wpa_driver_ops wpa_driver_wext_ops; /* driver_wext.c */
  25475. #endif /* CONFIG_DRIVER_WEXT */
  25476. --- a/wpa_supplicant/eapol_test.c
  25477. +++ b/wpa_supplicant/eapol_test.c
  25478. -@@ -28,8 +28,12 @@
  25479. +@@ -29,7 +29,12 @@
  25480. #include "ctrl_iface.h"
  25481. #include "pcsc_funcs.h"
  25482. #include "wpas_glue.h"
  25483. +#include "drivers/driver.h"
  25484. -
  25485. +void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event,
  25486. + union wpa_event_data *data);
  25487. -+
  25488. - struct wpa_driver_ops *wpa_drivers[] = { NULL };
  25489. ++void (*wpa_supplicant_event_global)(void *ctx, enum wpa_event_type event,
  25490. ++ union wpa_event_data *data);
  25491. + const struct wpa_driver_ops *const wpa_drivers[] = { NULL };
  25492. -@@ -1203,6 +1207,8 @@ static void usage(void)
  25493. +@@ -1295,6 +1300,10 @@ static void usage(void)
  25494. "option several times.\n");
  25495. }
  25496. +extern void supplicant_event(void *ctx, enum wpa_event_type event,
  25497. + union wpa_event_data *data);
  25498. ++extern void supplicant_event_global(void *ctx, enum wpa_event_type event,
  25499. ++ union wpa_event_data *data);
  25500. int main(int argc, char *argv[])
  25501. {
  25502. -@@ -1221,6 +1227,7 @@ int main(int argc, char *argv[])
  25503. +@@ -1315,6 +1324,8 @@ int main(int argc, char *argv[])
  25504. if (os_program_init())
  25505. return -1;
  25506. + wpa_supplicant_event = supplicant_event;
  25507. ++ wpa_supplicant_event_global = supplicant_event_global;
  25508. hostapd_logger_register_cb(hostapd_logger_cb);
  25509. os_memset(&eapol_test, 0, sizeof(eapol_test));
  25510. diff --git a/package/network/services/hostapd/patches/300-noscan.patch b/package/network/services/hostapd/patches/300-noscan.patch
  25511. index 57d8fe2..21d6316 100644
  25512. --- a/package/network/services/hostapd/patches/300-noscan.patch
  25513. +++ b/package/network/services/hostapd/patches/300-noscan.patch
  25514. @@ -1,6 +1,6 @@
  25515. --- a/hostapd/config_file.c
  25516. +++ b/hostapd/config_file.c
  25517. -@@ -2771,6 +2771,10 @@ static int hostapd_config_fill(struct ho
  25518. +@@ -2862,6 +2862,10 @@ static int hostapd_config_fill(struct ho
  25519. }
  25520. #endif /* CONFIG_IEEE80211W */
  25521. #ifdef CONFIG_IEEE80211N
  25522. @@ -13,7 +13,7 @@
  25523. } else if (os_strcmp(buf, "ht_capab") == 0) {
  25524. --- a/src/ap/ap_config.h
  25525. +++ b/src/ap/ap_config.h
  25526. -@@ -619,6 +619,8 @@ struct hostapd_config {
  25527. +@@ -655,6 +655,8 @@ struct hostapd_config {
  25528. int ht_op_mode_fixed;
  25529. u16 ht_capab;
  25530. @@ -21,21 +21,22 @@
  25531. + int no_ht_coex;
  25532. int ieee80211n;
  25533. int secondary_channel;
  25534. - int require_ht;
  25535. + int no_pri_sec_switch;
  25536. --- a/src/ap/hw_features.c
  25537. +++ b/src/ap/hw_features.c
  25538. -@@ -461,7 +461,7 @@ static int ieee80211n_check_40mhz(struct
  25539. - struct wpa_driver_scan_params params;
  25540. +@@ -474,7 +474,8 @@ static int ieee80211n_check_40mhz(struct
  25541. int ret;
  25542. -- if (!iface->conf->secondary_channel)
  25543. -+ if (!iface->conf->secondary_channel || iface->conf->noscan)
  25544. - return 0; /* HT40 not used */
  25545. + /* Check that HT40 is used and PRI / SEC switch is allowed */
  25546. +- if (!iface->conf->secondary_channel || iface->conf->no_pri_sec_switch)
  25547. ++ if (!iface->conf->secondary_channel || iface->conf->no_pri_sec_switch ||
  25548. ++ iface->conf->noscan)
  25549. + return 0;
  25550. hostapd_set_state(iface, HAPD_IFACE_HT_SCAN);
  25551. --- a/src/ap/ieee802_11_ht.c
  25552. +++ b/src/ap/ieee802_11_ht.c
  25553. -@@ -221,6 +221,9 @@ void hostapd_2040_coex_action(struct hos
  25554. +@@ -244,6 +244,9 @@ void hostapd_2040_coex_action(struct hos
  25555. if (!(iface->conf->ht_capab & HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET))
  25556. return;
  25557. @@ -45,7 +46,7 @@
  25558. if (len < IEEE80211_HDRLEN + 2 + sizeof(*bc_ie))
  25559. return;
  25560. -@@ -346,6 +349,9 @@ void ht40_intolerant_add(struct hostapd_
  25561. +@@ -368,6 +371,9 @@ void ht40_intolerant_add(struct hostapd_
  25562. if (iface->current_mode->mode != HOSTAPD_MODE_IEEE80211G)
  25563. return;
  25564. diff --git a/package/network/services/hostapd/patches/310-rescan_immediately.patch b/package/network/services/hostapd/patches/310-rescan_immediately.patch
  25565. index 7be8c32..3f46cc4 100644
  25566. --- a/package/network/services/hostapd/patches/310-rescan_immediately.patch
  25567. +++ b/package/network/services/hostapd/patches/310-rescan_immediately.patch
  25568. @@ -1,6 +1,6 @@
  25569. --- a/wpa_supplicant/wpa_supplicant.c
  25570. +++ b/wpa_supplicant/wpa_supplicant.c
  25571. -@@ -3249,7 +3249,7 @@ wpa_supplicant_alloc(struct wpa_supplica
  25572. +@@ -3556,7 +3556,7 @@ wpa_supplicant_alloc(struct wpa_supplica
  25573. if (wpa_s == NULL)
  25574. return NULL;
  25575. wpa_s->scan_req = INITIAL_SCAN_REQ;
  25576. @@ -8,4 +8,4 @@
  25577. + wpa_s->scan_interval = 1;
  25578. wpa_s->new_connection = 1;
  25579. wpa_s->parent = parent ? parent : wpa_s;
  25580. - wpa_s->sched_scanning = 0;
  25581. + wpa_s->p2pdev = wpa_s->parent;
  25582. diff --git a/package/network/services/hostapd/patches/320-optional_rfkill.patch b/package/network/services/hostapd/patches/320-optional_rfkill.patch
  25583. index 75b4b07..cf2a2c1 100644
  25584. --- a/package/network/services/hostapd/patches/320-optional_rfkill.patch
  25585. +++ b/package/network/services/hostapd/patches/320-optional_rfkill.patch
  25586. @@ -1,14 +1,14 @@
  25587. --- a/src/drivers/drivers.mak
  25588. +++ b/src/drivers/drivers.mak
  25589. -@@ -34,7 +34,6 @@ NEED_SME=y
  25590. +@@ -36,7 +36,6 @@ NEED_SME=y
  25591. NEED_AP_MLME=y
  25592. NEED_NETLINK=y
  25593. NEED_LINUX_IOCTL=y
  25594. -NEED_RFKILL=y
  25595. + NEED_RADIOTAP=y
  25596. ifdef CONFIG_LIBNL32
  25597. - DRV_LIBS += -lnl-3
  25598. -@@ -116,7 +115,6 @@ DRV_WPA_CFLAGS += -DCONFIG_DRIVER_WEXT
  25599. +@@ -123,7 +122,6 @@ DRV_WPA_CFLAGS += -DCONFIG_DRIVER_WEXT
  25600. CONFIG_WIRELESS_EXTENSION=y
  25601. NEED_NETLINK=y
  25602. NEED_LINUX_IOCTL=y
  25603. @@ -16,7 +16,7 @@
  25604. endif
  25605. ifdef CONFIG_DRIVER_NDIS
  25606. -@@ -142,7 +140,6 @@ endif
  25607. +@@ -149,7 +147,6 @@ endif
  25608. ifdef CONFIG_WIRELESS_EXTENSION
  25609. DRV_WPA_CFLAGS += -DCONFIG_WIRELESS_EXTENSION
  25610. DRV_WPA_OBJS += ../src/drivers/driver_wext.o
  25611. @@ -24,14 +24,14 @@
  25612. endif
  25613. ifdef NEED_NETLINK
  25614. -@@ -155,6 +152,7 @@ endif
  25615. +@@ -162,6 +159,7 @@ endif
  25616. ifdef NEED_RFKILL
  25617. DRV_OBJS += ../src/drivers/rfkill.o
  25618. +DRV_WPA_CFLAGS += -DCONFIG_RFKILL
  25619. endif
  25620. - ifdef CONFIG_VLAN_NETLINK
  25621. + ifdef NEED_RADIOTAP
  25622. --- a/src/drivers/rfkill.h
  25623. +++ b/src/drivers/rfkill.h
  25624. @@ -18,8 +18,24 @@ struct rfkill_config {
  25625. 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
  25626. index dd90877..ca46012 100644
  25627. --- a/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch
  25628. +++ b/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch
  25629. @@ -1,6 +1,6 @@
  25630. --- a/src/drivers/driver_nl80211.c
  25631. +++ b/src/drivers/driver_nl80211.c
  25632. -@@ -3616,7 +3616,7 @@ static int nl80211_set_channel(struct i8
  25633. +@@ -3795,7 +3795,7 @@ static int nl80211_set_channel(struct i8
  25634. freq->freq, freq->ht_enabled, freq->vht_enabled,
  25635. freq->bandwidth, freq->center_freq1, freq->center_freq2);
  25636. diff --git a/package/network/services/hostapd/patches/340-reload_freq_change.patch b/package/network/services/hostapd/patches/340-reload_freq_change.patch
  25637. index 91b6196..086ade9 100644
  25638. --- a/package/network/services/hostapd/patches/340-reload_freq_change.patch
  25639. +++ b/package/network/services/hostapd/patches/340-reload_freq_change.patch
  25640. @@ -1,6 +1,6 @@
  25641. --- a/src/ap/hostapd.c
  25642. +++ b/src/ap/hostapd.c
  25643. -@@ -76,6 +76,16 @@ static void hostapd_reload_bss(struct ho
  25644. +@@ -80,6 +80,16 @@ static void hostapd_reload_bss(struct ho
  25645. #endif /* CONFIG_NO_RADIUS */
  25646. ssid = &hapd->conf->ssid;
  25647. @@ -17,7 +17,7 @@
  25648. if (!ssid->wpa_psk_set && ssid->wpa_psk && !ssid->wpa_psk->next &&
  25649. ssid->wpa_passphrase_set && ssid->wpa_passphrase) {
  25650. /*
  25651. -@@ -175,21 +185,12 @@ int hostapd_reload_config(struct hostapd
  25652. +@@ -179,21 +189,12 @@ int hostapd_reload_config(struct hostapd
  25653. oldconf = hapd->iconf;
  25654. iface->conf = newconf;
  25655. 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
  25656. index a14fa03..247f154 100644
  25657. --- a/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch
  25658. +++ b/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch
  25659. @@ -1,6 +1,6 @@
  25660. --- a/src/drivers/driver_nl80211.c
  25661. +++ b/src/drivers/driver_nl80211.c
  25662. -@@ -2254,13 +2254,18 @@ wpa_driver_nl80211_finish_drv_init(struc
  25663. +@@ -2394,13 +2394,18 @@ wpa_driver_nl80211_finish_drv_init(struc
  25664. }
  25665. @@ -22,7 +22,7 @@
  25666. return send_and_recv_msgs(drv, msg, NULL, NULL);
  25667. }
  25668. -@@ -2311,7 +2316,7 @@ static void wpa_driver_nl80211_deinit(st
  25669. +@@ -2452,7 +2457,7 @@ static void wpa_driver_nl80211_deinit(st
  25670. nl80211_remove_monitor_interface(drv);
  25671. if (is_ap_interface(drv->nlmode))
  25672. @@ -31,7 +31,7 @@
  25673. if (drv->eapol_sock >= 0) {
  25674. eloop_unregister_read_sock(drv->eapol_sock);
  25675. -@@ -4140,8 +4145,7 @@ static void nl80211_teardown_ap(struct i
  25676. +@@ -4385,8 +4390,7 @@ static void nl80211_teardown_ap(struct i
  25677. nl80211_remove_monitor_interface(drv);
  25678. else
  25679. nl80211_mgmt_unsubscribe(bss, "AP teardown");
  25680. @@ -41,7 +41,7 @@
  25681. }
  25682. -@@ -6066,8 +6070,6 @@ static int wpa_driver_nl80211_if_remove(
  25683. +@@ -6387,8 +6391,6 @@ static int wpa_driver_nl80211_if_remove(
  25684. } else {
  25685. wpa_printf(MSG_DEBUG, "nl80211: First BSS - reassign context");
  25686. nl80211_teardown_ap(bss);
  25687. @@ -50,7 +50,7 @@
  25688. nl80211_destroy_bss(bss);
  25689. if (!bss->added_if)
  25690. i802_set_iface_flags(bss, 0);
  25691. -@@ -6389,8 +6391,7 @@ static int wpa_driver_nl80211_deinit_ap(
  25692. +@@ -6750,8 +6752,7 @@ static int wpa_driver_nl80211_deinit_ap(
  25693. struct wpa_driver_nl80211_data *drv = bss->drv;
  25694. if (!is_ap_interface(drv->nlmode))
  25695. return -1;
  25696. @@ -60,7 +60,7 @@
  25697. /*
  25698. * If the P2P GO interface was dynamically added, then it is
  25699. -@@ -6409,8 +6410,7 @@ static int wpa_driver_nl80211_stop_ap(vo
  25700. +@@ -6770,8 +6771,7 @@ static int wpa_driver_nl80211_stop_ap(vo
  25701. struct wpa_driver_nl80211_data *drv = bss->drv;
  25702. if (!is_ap_interface(drv->nlmode))
  25703. return -1;
  25704. diff --git a/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch b/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch
  25705. index 06b005e..1e405cb 100644
  25706. --- a/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch
  25707. +++ b/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch
  25708. @@ -1,22 +1,22 @@
  25709. --- a/hostapd/ctrl_iface.c
  25710. +++ b/hostapd/ctrl_iface.c
  25711. -@@ -45,6 +45,7 @@
  25712. - #include "wps/wps.h"
  25713. +@@ -54,6 +54,7 @@
  25714. + #include "fst/fst_ctrl_iface.h"
  25715. #include "config_file.h"
  25716. #include "ctrl_iface.h"
  25717. +#include "config_file.h"
  25718. - struct wpa_ctrl_dst {
  25719. -@@ -55,6 +56,7 @@ struct wpa_ctrl_dst {
  25720. - int errors;
  25721. - };
  25722. + #define HOSTAPD_CLI_DUP_VALUE_MAX_LEN 256
  25723. +@@ -72,6 +73,7 @@ static void hostapd_ctrl_iface_send(stru
  25724. + enum wpa_msg_type type,
  25725. + const char *buf, size_t len);
  25726. +static char *reload_opts = NULL;
  25727. - static void hostapd_ctrl_iface_send(struct hostapd_data *hapd, int level,
  25728. - const char *buf, size_t len);
  25729. -@@ -164,6 +166,61 @@ static int hostapd_ctrl_iface_new_sta(st
  25730. + static int hostapd_ctrl_iface_attach(struct hostapd_data *hapd,
  25731. + struct sockaddr_storage *from,
  25732. +@@ -123,6 +125,61 @@ static int hostapd_ctrl_iface_new_sta(st
  25733. return 0;
  25734. }
  25735. @@ -78,7 +78,7 @@
  25736. #ifdef CONFIG_IEEE80211W
  25737. #ifdef NEED_AP_MLME
  25738. -@@ -2086,6 +2143,8 @@ static void hostapd_ctrl_iface_receive(i
  25739. +@@ -2483,6 +2540,8 @@ static int hostapd_ctrl_iface_receive_pr
  25740. } else if (os_strncmp(buf, "VENDOR ", 7) == 0) {
  25741. reply_len = hostapd_ctrl_iface_vendor(hapd, buf + 7, reply,
  25742. reply_size);
  25743. @@ -89,7 +89,7 @@
  25744. #ifdef RADIUS_SERVER
  25745. --- a/src/ap/ctrl_iface_ap.c
  25746. +++ b/src/ap/ctrl_iface_ap.c
  25747. -@@ -541,5 +541,11 @@ int hostapd_parse_csa_settings(const cha
  25748. +@@ -593,7 +593,13 @@ int hostapd_parse_csa_settings(const cha
  25749. int hostapd_ctrl_iface_stop_ap(struct hostapd_data *hapd)
  25750. {
  25751. @@ -102,3 +102,5 @@
  25752. +
  25753. + return 0;
  25754. }
  25755. +
  25756. +
  25757. diff --git a/package/network/services/hostapd/patches/370-ap_sta_support.patch b/package/network/services/hostapd/patches/370-ap_sta_support.patch
  25758. index ea235e6..a77d4c9 100644
  25759. --- a/package/network/services/hostapd/patches/370-ap_sta_support.patch
  25760. +++ b/package/network/services/hostapd/patches/370-ap_sta_support.patch
  25761. @@ -1,6 +1,6 @@
  25762. --- a/wpa_supplicant/wpa_supplicant_i.h
  25763. +++ b/wpa_supplicant/wpa_supplicant_i.h
  25764. -@@ -110,6 +110,11 @@ struct wpa_interface {
  25765. +@@ -100,6 +100,11 @@ struct wpa_interface {
  25766. const char *ifname;
  25767. /**
  25768. @@ -12,8 +12,8 @@
  25769. * bridge_ifname - Optional bridge interface name
  25770. *
  25771. * If the driver interface (ifname) is included in a Linux bridge
  25772. -@@ -442,6 +447,8 @@ struct wpa_supplicant {
  25773. - #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
  25774. +@@ -484,6 +489,8 @@ struct wpa_supplicant {
  25775. + #endif /* CONFIG_CTRL_IFACE_BINDER */
  25776. char bridge_ifname[16];
  25777. + struct wpa_ctrl *hostapd;
  25778. @@ -23,7 +23,7 @@
  25779. --- a/wpa_supplicant/Makefile
  25780. +++ b/wpa_supplicant/Makefile
  25781. -@@ -14,6 +14,10 @@ CFLAGS += $(EXTRA_CFLAGS)
  25782. +@@ -26,6 +26,10 @@ CFLAGS += $(EXTRA_CFLAGS)
  25783. CFLAGS += -I$(abspath ../src)
  25784. CFLAGS += -I$(abspath ../src/utils)
  25785. @@ -34,7 +34,7 @@
  25786. -include .config
  25787. -include $(if $(MULTICALL),../hostapd/.config)
  25788. -@@ -84,6 +88,8 @@ OBJS_c += ../src/utils/wpa_debug.o
  25789. +@@ -113,6 +117,8 @@ OBJS_c += ../src/utils/wpa_debug.o
  25790. OBJS_c += ../src/utils/common.o
  25791. OBJS += wmm_ac.o
  25792. @@ -45,7 +45,7 @@
  25793. CONFIG_OS=win32
  25794. --- a/wpa_supplicant/wpa_supplicant.c
  25795. +++ b/wpa_supplicant/wpa_supplicant.c
  25796. -@@ -107,6 +107,55 @@ const char *wpa_supplicant_full_license5
  25797. +@@ -112,6 +112,55 @@ const char *const wpa_supplicant_full_li
  25798. "\n";
  25799. #endif /* CONFIG_NO_STDOUT_DEBUG */
  25800. @@ -73,7 +73,7 @@
  25801. + int ret;
  25802. +
  25803. + if (!bss)
  25804. -+ return;
  25805. ++ return -1;
  25806. +
  25807. + if (bss->ht_param & HT_INFO_HT_PARAM_STA_CHNL_WIDTH) {
  25808. + int sec = bss->ht_param & HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK;
  25809. @@ -101,7 +101,7 @@
  25810. /* Configure default/group WEP keys for static WEP */
  25811. int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
  25812. {
  25813. -@@ -743,8 +792,12 @@ void wpa_supplicant_set_state(struct wpa
  25814. +@@ -812,8 +861,12 @@ void wpa_supplicant_set_state(struct wpa
  25815. wpas_p2p_completed(wpa_s);
  25816. sme_sched_obss_scan(wpa_s, 1);
  25817. @@ -114,7 +114,7 @@
  25818. wpa_s->new_connection = 1;
  25819. wpa_drv_set_operstate(wpa_s, 0);
  25820. #ifndef IEEE8021X_EAPOL
  25821. -@@ -4038,6 +4091,20 @@ static int wpa_supplicant_init_iface(str
  25822. +@@ -4646,6 +4699,20 @@ static int wpa_supplicant_init_iface(str
  25823. sizeof(wpa_s->bridge_ifname));
  25824. }
  25825. @@ -135,7 +135,7 @@
  25826. /* RSNA Supplicant Key Management - INITIALIZE */
  25827. eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE);
  25828. eapol_sm_notify_portValid(wpa_s->eapol, FALSE);
  25829. -@@ -4280,6 +4347,11 @@ static void wpa_supplicant_deinit_iface(
  25830. +@@ -4937,6 +5004,11 @@ static void wpa_supplicant_deinit_iface(
  25831. if (terminate)
  25832. wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_TERMINATING);
  25833. @@ -157,7 +157,7 @@
  25834. #include "drivers/driver.h"
  25835. #include "wpa_supplicant_i.h"
  25836. #include "config.h"
  25837. -@@ -277,6 +278,10 @@ static void calculate_update_time(const
  25838. +@@ -287,6 +288,10 @@ static void calculate_update_time(const
  25839. static void wpa_bss_copy_res(struct wpa_bss *dst, struct wpa_scan_res *src,
  25840. struct os_reltime *fetch_time)
  25841. {
  25842. @@ -168,7 +168,7 @@
  25843. dst->flags = src->flags;
  25844. os_memcpy(dst->bssid, src->bssid, ETH_ALEN);
  25845. dst->freq = src->freq;
  25846. -@@ -289,6 +294,15 @@ static void wpa_bss_copy_res(struct wpa_
  25847. +@@ -299,6 +304,15 @@ static void wpa_bss_copy_res(struct wpa_
  25848. dst->est_throughput = src->est_throughput;
  25849. dst->snr = src->snr;
  25850. @@ -186,7 +186,7 @@
  25851. --- a/wpa_supplicant/main.c
  25852. +++ b/wpa_supplicant/main.c
  25853. -@@ -33,7 +33,7 @@ static void usage(void)
  25854. +@@ -34,7 +34,7 @@ static void usage(void)
  25855. "vW] [-P<pid file>] "
  25856. "[-g<global ctrl>] \\\n"
  25857. " [-G<group>] \\\n"
  25858. @@ -195,24 +195,24 @@
  25859. "[-p<driver_param>] \\\n"
  25860. " [-b<br_ifname>] [-e<entropy file>]"
  25861. #ifdef CONFIG_DEBUG_FILE
  25862. -@@ -84,6 +84,7 @@ static void usage(void)
  25863. - #endif /* CONFIG_DEBUG_LINUX_TRACING */
  25864. - printf(" -t = include timestamp in debug messages\n"
  25865. +@@ -74,6 +74,7 @@ static void usage(void)
  25866. + " -g = global ctrl_interface\n"
  25867. + " -G = global ctrl_interface group\n"
  25868. " -h = show this help text\n"
  25869. -+ " -H = connect to a hostapd instance to manage state changes\n"
  25870. - " -L = show license (BSD)\n"
  25871. - " -o = override driver parameter for new interfaces\n"
  25872. - " -O = override ctrl_interface parameter for new interfaces\n"
  25873. -@@ -175,7 +176,7 @@ int main(int argc, char *argv[])
  25874. ++ " -H = connect to a hostapd instance to manage state changes\n"
  25875. + " -i = interface name\n"
  25876. + " -I = additional configuration file\n"
  25877. + " -K = include keys (passwords, etc.) in debug output\n"
  25878. +@@ -201,7 +202,7 @@ int main(int argc, char *argv[])
  25879. for (;;) {
  25880. c = getopt(argc, argv,
  25881. -- "b:Bc:C:D:de:f:g:G:hi:I:KLm:No:O:p:P:qsTtuvW");
  25882. -+ "b:Bc:C:D:de:f:g:G:hH:i:I:KLm:No:O:p:P:qsTtuvW");
  25883. +- "b:Bc:C:D:de:f:g:G:hi:I:KLMm:No:O:p:P:qsTtuvW");
  25884. ++ "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuvW");
  25885. if (c < 0)
  25886. break;
  25887. switch (c) {
  25888. -@@ -222,6 +223,9 @@ int main(int argc, char *argv[])
  25889. +@@ -248,6 +249,9 @@ int main(int argc, char *argv[])
  25890. usage();
  25891. exitcode = 0;
  25892. goto out;
  25893. @@ -224,11 +224,11 @@
  25894. break;
  25895. --- a/wpa_supplicant/bss.h
  25896. +++ b/wpa_supplicant/bss.h
  25897. -@@ -72,6 +72,10 @@ struct wpa_bss {
  25898. - u8 ssid[32];
  25899. +@@ -79,6 +79,10 @@ struct wpa_bss {
  25900. + u8 ssid[SSID_MAX_LEN];
  25901. /** Length of SSID */
  25902. size_t ssid_len;
  25903. -+ /** HT caapbilities */
  25904. ++ /** HT capabilities */
  25905. + u16 ht_capab;
  25906. + /* Five octets of HT Operation Information */
  25907. + u8 ht_param;
  25908. 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
  25909. index 3a41b82..9e815e9 100644
  25910. --- a/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch
  25911. +++ b/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch
  25912. @@ -1,18 +1,18 @@
  25913. --- a/hostapd/Makefile
  25914. +++ b/hostapd/Makefile
  25915. -@@ -168,6 +168,9 @@ endif
  25916. +@@ -212,6 +212,9 @@ endif
  25917. ifdef CONFIG_NO_CTRL_IFACE
  25918. CFLAGS += -DCONFIG_NO_CTRL_IFACE
  25919. else
  25920. +ifdef CONFIG_CTRL_IFACE_MIB
  25921. +CFLAGS += -DCONFIG_CTRL_IFACE_MIB
  25922. +endif
  25923. - OBJS += ctrl_iface.o
  25924. - OBJS += ../src/ap/ctrl_iface_ap.o
  25925. - endif
  25926. + ifeq ($(CONFIG_CTRL_IFACE), udp)
  25927. + CFLAGS += -DCONFIG_CTRL_IFACE_UDP
  25928. + else
  25929. --- a/hostapd/ctrl_iface.c
  25930. +++ b/hostapd/ctrl_iface.c
  25931. -@@ -1953,6 +1953,7 @@ static void hostapd_ctrl_iface_receive(i
  25932. +@@ -2342,6 +2342,7 @@ static int hostapd_ctrl_iface_receive_pr
  25933. reply_size);
  25934. } else if (os_strcmp(buf, "STATUS-DRIVER") == 0) {
  25935. reply_len = hostapd_drv_status(hapd, reply, reply_size);
  25936. @@ -20,18 +20,18 @@
  25937. } else if (os_strcmp(buf, "MIB") == 0) {
  25938. reply_len = ieee802_11_get_mib(hapd, reply, reply_size);
  25939. if (reply_len >= 0) {
  25940. -@@ -1994,6 +1995,7 @@ static void hostapd_ctrl_iface_receive(i
  25941. +@@ -2383,6 +2384,7 @@ static int hostapd_ctrl_iface_receive_pr
  25942. } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) {
  25943. reply_len = hostapd_ctrl_iface_sta_next(hapd, buf + 9, reply,
  25944. reply_size);
  25945. +#endif
  25946. } else if (os_strcmp(buf, "ATTACH") == 0) {
  25947. - if (hostapd_ctrl_iface_attach(hapd, &from, fromlen))
  25948. + if (hostapd_ctrl_iface_attach(hapd, from, fromlen))
  25949. reply_len = -1;
  25950. --- a/wpa_supplicant/Makefile
  25951. +++ b/wpa_supplicant/Makefile
  25952. -@@ -837,6 +837,9 @@ ifdef CONFIG_WNM
  25953. - OBJS += ../src/ap/wnm_ap.o
  25954. +@@ -874,6 +874,9 @@ ifdef CONFIG_MBO
  25955. + OBJS += ../src/ap/mbo_ap.o
  25956. endif
  25957. ifdef CONFIG_CTRL_IFACE
  25958. +ifdef CONFIG_CTRL_IFACE_MIB
  25959. @@ -42,7 +42,7 @@
  25960. --- a/wpa_supplicant/ctrl_iface.c
  25961. +++ b/wpa_supplicant/ctrl_iface.c
  25962. -@@ -1795,7 +1795,7 @@ static int wpa_supplicant_ctrl_iface_sta
  25963. +@@ -1895,7 +1895,7 @@ static int wpa_supplicant_ctrl_iface_sta
  25964. pos += ret;
  25965. }
  25966. @@ -51,7 +51,7 @@
  25967. if (wpa_s->ap_iface) {
  25968. pos += ap_ctrl_iface_wpa_get_status(wpa_s, pos,
  25969. end - pos,
  25970. -@@ -7896,6 +7896,7 @@ char * wpa_supplicant_ctrl_iface_process
  25971. +@@ -8687,6 +8687,7 @@ char * wpa_supplicant_ctrl_iface_process
  25972. reply_len = -1;
  25973. } else if (os_strncmp(buf, "NOTE ", 5) == 0) {
  25974. wpa_printf(MSG_INFO, "NOTE: %s", buf + 5);
  25975. @@ -59,7 +59,7 @@
  25976. } else if (os_strcmp(buf, "MIB") == 0) {
  25977. reply_len = wpa_sm_get_mib(wpa_s->wpa, reply, reply_size);
  25978. if (reply_len >= 0) {
  25979. -@@ -7903,6 +7904,7 @@ char * wpa_supplicant_ctrl_iface_process
  25980. +@@ -8694,6 +8695,7 @@ char * wpa_supplicant_ctrl_iface_process
  25981. reply + reply_len,
  25982. reply_size - reply_len);
  25983. }
  25984. @@ -67,7 +67,7 @@
  25985. } else if (os_strncmp(buf, "STATUS", 6) == 0) {
  25986. reply_len = wpa_supplicant_ctrl_iface_status(
  25987. wpa_s, buf + 6, reply, reply_size);
  25988. -@@ -8353,6 +8355,7 @@ char * wpa_supplicant_ctrl_iface_process
  25989. +@@ -9164,6 +9166,7 @@ char * wpa_supplicant_ctrl_iface_process
  25990. reply_len = wpa_supplicant_ctrl_iface_bss(
  25991. wpa_s, buf + 4, reply, reply_size);
  25992. #ifdef CONFIG_AP
  25993. @@ -75,7 +75,7 @@
  25994. } else if (os_strcmp(buf, "STA-FIRST") == 0) {
  25995. reply_len = ap_ctrl_iface_sta_first(wpa_s, reply, reply_size);
  25996. } else if (os_strncmp(buf, "STA ", 4) == 0) {
  25997. -@@ -8361,12 +8364,15 @@ char * wpa_supplicant_ctrl_iface_process
  25998. +@@ -9172,12 +9175,15 @@ char * wpa_supplicant_ctrl_iface_process
  25999. } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) {
  26000. reply_len = ap_ctrl_iface_sta_next(wpa_s, buf + 9, reply,
  26001. reply_size);
  26002. @@ -93,15 +93,15 @@
  26003. reply_len = -1;
  26004. --- a/src/ap/ctrl_iface_ap.c
  26005. +++ b/src/ap/ctrl_iface_ap.c
  26006. -@@ -22,6 +22,7 @@
  26007. - #include "ctrl_iface_ap.h"
  26008. +@@ -24,6 +24,7 @@
  26009. #include "ap_drv_ops.h"
  26010. + #include "mbo_ap.h"
  26011. +#ifdef CONFIG_CTRL_IFACE_MIB
  26012. static int hostapd_get_sta_tx_rx(struct hostapd_data *hapd,
  26013. struct sta_info *sta,
  26014. -@@ -224,6 +225,7 @@ int hostapd_ctrl_iface_sta_next(struct h
  26015. +@@ -249,6 +250,7 @@ int hostapd_ctrl_iface_sta_next(struct h
  26016. return hostapd_ctrl_iface_sta_mib(hapd, sta->next, buf, buflen);
  26017. }
  26018. @@ -111,33 +111,33 @@
  26019. static int p2p_manager_disconnect(struct hostapd_data *hapd, u16 stype,
  26020. --- a/src/ap/ieee802_1x.c
  26021. +++ b/src/ap/ieee802_1x.c
  26022. -@@ -2337,6 +2337,7 @@ static const char * bool_txt(Boolean boo
  26023. - return bool_val ? "TRUE" : "FALSE";
  26024. +@@ -2441,6 +2441,7 @@ static const char * bool_txt(Boolean val
  26025. + return val ? "TRUE" : "FALSE";
  26026. }
  26027. +#ifdef CONFIG_CTRL_IFACE_MIB
  26028. int ieee802_1x_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen)
  26029. {
  26030. -@@ -2512,6 +2513,7 @@ int ieee802_1x_get_mib_sta(struct hostap
  26031. +@@ -2616,6 +2617,7 @@ int ieee802_1x_get_mib_sta(struct hostap
  26032. return len;
  26033. }
  26034. +#endif
  26035. - static void ieee802_1x_finished(struct hostapd_data *hapd,
  26036. - struct sta_info *sta, int success,
  26037. + #ifdef CONFIG_HS20
  26038. + static void ieee802_1x_wnm_notif_send(void *eloop_ctx, void *timeout_ctx)
  26039. --- a/src/ap/wpa_auth.c
  26040. +++ b/src/ap/wpa_auth.c
  26041. -@@ -2999,6 +2999,7 @@ static const char * wpa_bool_txt(int boo
  26042. - return bool ? "TRUE" : "FALSE";
  26043. +@@ -3069,6 +3069,7 @@ static const char * wpa_bool_txt(int val
  26044. + return val ? "TRUE" : "FALSE";
  26045. }
  26046. +#ifdef CONFIG_CTRL_IFACE_MIB
  26047. #define RSN_SUITE "%02x-%02x-%02x-%d"
  26048. #define RSN_SUITE_ARG(s) \
  26049. -@@ -3143,7 +3144,7 @@ int wpa_get_mib_sta(struct wpa_state_mac
  26050. +@@ -3213,7 +3214,7 @@ int wpa_get_mib_sta(struct wpa_state_mac
  26051. return len;
  26052. }
  26053. @@ -148,7 +148,7 @@
  26054. {
  26055. --- a/src/rsn_supp/wpa.c
  26056. +++ b/src/rsn_supp/wpa.c
  26057. -@@ -2032,6 +2032,8 @@ static u32 wpa_key_mgmt_suite(struct wpa
  26058. +@@ -2108,6 +2108,8 @@ static u32 wpa_key_mgmt_suite(struct wpa
  26059. }
  26060. @@ -157,7 +157,7 @@
  26061. #define RSN_SUITE "%02x-%02x-%02x-%d"
  26062. #define RSN_SUITE_ARG(s) \
  26063. ((s) >> 24) & 0xff, ((s) >> 16) & 0xff, ((s) >> 8) & 0xff, (s) & 0xff
  26064. -@@ -2115,6 +2117,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch
  26065. +@@ -2191,6 +2193,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch
  26066. return (int) len;
  26067. }
  26068. @@ -167,7 +167,7 @@
  26069. --- a/wpa_supplicant/ap.c
  26070. +++ b/wpa_supplicant/ap.c
  26071. -@@ -1015,7 +1015,7 @@ int wpas_ap_wps_nfc_report_handover(stru
  26072. +@@ -1114,7 +1114,7 @@ int wpas_ap_wps_nfc_report_handover(stru
  26073. #endif /* CONFIG_WPS */
  26074. 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
  26075. index 1065a7f..c9e7bf4 100644
  26076. --- a/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch
  26077. +++ b/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch
  26078. @@ -1,6 +1,6 @@
  26079. --- a/src/common/wpa_common.c
  26080. +++ b/src/common/wpa_common.c
  26081. -@@ -1228,6 +1228,31 @@ u32 wpa_akm_to_suite(int akm)
  26082. +@@ -1244,6 +1244,31 @@ u32 wpa_akm_to_suite(int akm)
  26083. }
  26084. @@ -32,7 +32,7 @@
  26085. int wpa_compare_rsn_ie(int ft_initial_assoc,
  26086. const u8 *ie1, size_t ie1len,
  26087. const u8 *ie2, size_t ie2len)
  26088. -@@ -1235,8 +1260,19 @@ int wpa_compare_rsn_ie(int ft_initial_as
  26089. +@@ -1251,8 +1276,19 @@ int wpa_compare_rsn_ie(int ft_initial_as
  26090. if (ie1 == NULL || ie2 == NULL)
  26091. return -1;
  26092. 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
  26093. index 083af5b..f5872cd 100644
  26094. --- a/package/network/services/hostapd/patches/400-wps_single_auth_enc_type.patch
  26095. +++ b/package/network/services/hostapd/patches/400-wps_single_auth_enc_type.patch
  26096. @@ -1,25 +1,22 @@
  26097. --- a/src/ap/wps_hostapd.c
  26098. +++ b/src/ap/wps_hostapd.c
  26099. -@@ -1052,11 +1052,9 @@ int hostapd_init_wps(struct hostapd_data
  26100. -
  26101. - if (conf->rsn_pairwise & (WPA_CIPHER_CCMP | WPA_CIPHER_GCMP))
  26102. +@@ -352,8 +352,7 @@ static int hapd_wps_reconfig_in_memory(s
  26103. + bss->wpa_pairwise |= WPA_CIPHER_GCMP;
  26104. + else
  26105. + bss->wpa_pairwise |= WPA_CIPHER_CCMP;
  26106. +- }
  26107. +- if (cred->encr_type & WPS_ENCR_TKIP)
  26108. ++ } else if (cred->encr_type & WPS_ENCR_TKIP)
  26109. + bss->wpa_pairwise |= WPA_CIPHER_TKIP;
  26110. + bss->rsn_pairwise = bss->wpa_pairwise;
  26111. + bss->wpa_group = wpa_select_ap_group_cipher(bss->wpa,
  26112. +@@ -1073,8 +1072,7 @@ int hostapd_init_wps(struct hostapd_data
  26113. + if (conf->rsn_pairwise & (WPA_CIPHER_CCMP | WPA_CIPHER_GCMP)) {
  26114. wps->encr_types |= WPS_ENCR_AES;
  26115. -- if (conf->rsn_pairwise & WPA_CIPHER_TKIP)
  26116. -+ else if (conf->rsn_pairwise & WPA_CIPHER_TKIP)
  26117. + wps->encr_types_rsn |= WPS_ENCR_AES;
  26118. +- }
  26119. +- if (conf->rsn_pairwise & WPA_CIPHER_TKIP) {
  26120. ++ } else if (conf->rsn_pairwise & WPA_CIPHER_TKIP) {
  26121. wps->encr_types |= WPS_ENCR_TKIP;
  26122. -- }
  26123. --
  26124. -- if (conf->wpa & WPA_PROTO_WPA) {
  26125. -+ } else if (conf->wpa & WPA_PROTO_WPA) {
  26126. - if (conf->wpa_key_mgmt & WPA_KEY_MGMT_PSK)
  26127. - wps->auth_types |= WPS_AUTH_WPAPSK;
  26128. - if (conf->wpa_key_mgmt & WPA_KEY_MGMT_IEEE8021X)
  26129. -@@ -1064,7 +1062,7 @@ int hostapd_init_wps(struct hostapd_data
  26130. -
  26131. - if (conf->wpa_pairwise & WPA_CIPHER_CCMP)
  26132. - wps->encr_types |= WPS_ENCR_AES;
  26133. -- if (conf->wpa_pairwise & WPA_CIPHER_TKIP)
  26134. -+ else if (conf->wpa_pairwise & WPA_CIPHER_TKIP)
  26135. - wps->encr_types |= WPS_ENCR_TKIP;
  26136. - }
  26137. -
  26138. + wps->encr_types_rsn |= WPS_ENCR_TKIP;
  26139. + }
  26140. diff --git a/package/network/services/hostapd/patches/410-limit_debug_messages.patch b/package/network/services/hostapd/patches/410-limit_debug_messages.patch
  26141. index da88732..a48b696 100644
  26142. --- a/package/network/services/hostapd/patches/410-limit_debug_messages.patch
  26143. +++ b/package/network/services/hostapd/patches/410-limit_debug_messages.patch
  26144. @@ -64,7 +64,7 @@
  26145. #ifdef CONFIG_DEBUG_FILE
  26146. static char *last_path = NULL;
  26147. #endif /* CONFIG_DEBUG_FILE */
  26148. -@@ -602,7 +576,7 @@ void wpa_msg_register_ifname_cb(wpa_msg_
  26149. +@@ -604,7 +578,7 @@ void wpa_msg_register_ifname_cb(wpa_msg_
  26150. }
  26151. @@ -73,7 +73,7 @@
  26152. {
  26153. va_list ap;
  26154. char *buf;
  26155. -@@ -640,7 +614,7 @@ void wpa_msg(void *ctx, int level, const
  26156. +@@ -642,7 +616,7 @@ void wpa_msg(void *ctx, int level, const
  26157. }
  26158. @@ -183,7 +183,7 @@
  26159. /*
  26160. * wpa_dbg() behaves like wpa_msg(), but it can be removed from build to reduce
  26161. -@@ -181,7 +222,12 @@ void wpa_hexdump_ascii_key(int level, co
  26162. +@@ -182,7 +223,12 @@ void wpa_hexdump_ascii_key(int level, co
  26163. *
  26164. * Note: New line '\n' is added to the end of the text when printing to stdout.
  26165. */
  26166. @@ -197,7 +197,7 @@
  26167. /**
  26168. * wpa_msg_ctrl - Conditional printf for ctrl_iface monitors
  26169. -@@ -195,8 +241,13 @@ void wpa_msg(void *ctx, int level, const
  26170. +@@ -196,8 +242,13 @@ void wpa_msg(void *ctx, int level, const
  26171. * attached ctrl_iface monitors. In other words, it can be used for frequent
  26172. * events that do not need to be sent to syslog.
  26173. */
  26174. diff --git a/package/network/services/hostapd/patches/420-indicate-features.patch b/package/network/services/hostapd/patches/420-indicate-features.patch
  26175. index 64c92df..335e71e 100644
  26176. --- a/package/network/services/hostapd/patches/420-indicate-features.patch
  26177. +++ b/package/network/services/hostapd/patches/420-indicate-features.patch
  26178. @@ -8,16 +8,16 @@
  26179. #include "crypto/random.h"
  26180. #include "crypto/tls.h"
  26181. #include "common/version.h"
  26182. -@@ -567,7 +568,7 @@ int main(int argc, char *argv[])
  26183. -
  26184. +@@ -668,7 +669,7 @@ int main(int argc, char *argv[])
  26185. wpa_supplicant_event = hostapd_wpa_event;
  26186. + wpa_supplicant_event_global = hostapd_wpa_event_global;
  26187. for (;;) {
  26188. -- c = getopt(argc, argv, "b:Bde:f:hKP:Ttu:vg:G:");
  26189. -+ c = getopt(argc, argv, "b:Bde:f:hKP:Ttu:g:G:v::");
  26190. +- c = getopt(argc, argv, "b:Bde:f:hi:KP:STtu:vg:G:");
  26191. ++ c = getopt(argc, argv, "b:Bde:f:hi:KP:STtu:g:G:v::");
  26192. if (c < 0)
  26193. break;
  26194. switch (c) {
  26195. -@@ -604,6 +605,8 @@ int main(int argc, char *argv[])
  26196. +@@ -705,6 +706,8 @@ int main(int argc, char *argv[])
  26197. break;
  26198. #endif /* CONFIG_DEBUG_LINUX_TRACING */
  26199. case 'v':
  26200. @@ -33,19 +33,19 @@
  26201. #include "common.h"
  26202. +#include "build_features.h"
  26203. + #include "fst/fst.h"
  26204. #include "wpa_supplicant_i.h"
  26205. #include "driver_i.h"
  26206. - #include "p2p_supplicant.h"
  26207. -@@ -176,7 +177,7 @@ int main(int argc, char *argv[])
  26208. +@@ -202,7 +203,7 @@ int main(int argc, char *argv[])
  26209. for (;;) {
  26210. c = getopt(argc, argv,
  26211. -- "b:Bc:C:D:de:f:g:G:hH:i:I:KLm:No:O:p:P:qsTtuvW");
  26212. -+ "b:Bc:C:D:de:f:g:G:hH:i:I:KLm:No:O:p:P:qsTtuv::W");
  26213. +- "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuvW");
  26214. ++ "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuv::W");
  26215. if (c < 0)
  26216. break;
  26217. switch (c) {
  26218. -@@ -279,8 +280,12 @@ int main(int argc, char *argv[])
  26219. +@@ -305,8 +306,12 @@ int main(int argc, char *argv[])
  26220. break;
  26221. #endif /* CONFIG_DBUS */
  26222. case 'v':
  26223. diff --git a/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch b/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch
  26224. index 85d2e16..d07b747 100644
  26225. --- a/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch
  26226. +++ b/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch
  26227. @@ -1,6 +1,6 @@
  26228. --- a/hostapd/hostapd_cli.c
  26229. +++ b/hostapd/hostapd_cli.c
  26230. -@@ -67,7 +67,6 @@ static const char *commands_help =
  26231. +@@ -69,7 +69,6 @@ static const char *const commands_help =
  26232. #ifdef CONFIG_IEEE80211W
  26233. " sa_query <addr> send SA Query to a station\n"
  26234. #endif /* CONFIG_IEEE80211W */
  26235. @@ -8,7 +8,7 @@
  26236. " wps_pin <uuid> <pin> [timeout] [addr] add WPS Enrollee PIN\n"
  26237. " wps_check_pin <PIN> verify PIN checksum\n"
  26238. " wps_pbc indicate button pushed to initiate PBC\n"
  26239. -@@ -80,7 +79,6 @@ static const char *commands_help =
  26240. +@@ -82,7 +81,6 @@ static const char *const commands_help =
  26241. " wps_ap_pin <cmd> [params..] enable/disable AP PIN\n"
  26242. " wps_config <SSID> <auth> <encr> <key> configure AP\n"
  26243. " wps_get_status show current WPS status\n"
  26244. @@ -16,7 +16,7 @@
  26245. " get_config show current configuration\n"
  26246. " help show this usage help\n"
  26247. " interface [ifname] show interfaces/select interface\n"
  26248. -@@ -353,7 +351,6 @@ static int hostapd_cli_cmd_sa_query(stru
  26249. +@@ -418,7 +416,6 @@ static int hostapd_cli_cmd_sa_query(stru
  26250. #endif /* CONFIG_IEEE80211W */
  26251. @@ -24,7 +24,7 @@
  26252. static int hostapd_cli_cmd_wps_pin(struct wpa_ctrl *ctrl, int argc,
  26253. char *argv[])
  26254. {
  26255. -@@ -579,7 +576,6 @@ static int hostapd_cli_cmd_wps_config(st
  26256. +@@ -644,7 +641,6 @@ static int hostapd_cli_cmd_wps_config(st
  26257. ssid_hex, argv[1]);
  26258. return wpa_ctrl_command(ctrl, buf);
  26259. }
  26260. @@ -32,7 +32,7 @@
  26261. static int hostapd_cli_cmd_disassoc_imminent(struct wpa_ctrl *ctrl, int argc,
  26262. -@@ -1027,7 +1023,6 @@ static struct hostapd_cli_cmd hostapd_cl
  26263. +@@ -1236,7 +1232,6 @@ static const struct hostapd_cli_cmd host
  26264. #ifdef CONFIG_IEEE80211W
  26265. { "sa_query", hostapd_cli_cmd_sa_query },
  26266. #endif /* CONFIG_IEEE80211W */
  26267. @@ -40,7 +40,7 @@
  26268. { "wps_pin", hostapd_cli_cmd_wps_pin },
  26269. { "wps_check_pin", hostapd_cli_cmd_wps_check_pin },
  26270. { "wps_pbc", hostapd_cli_cmd_wps_pbc },
  26271. -@@ -1041,7 +1036,6 @@ static struct hostapd_cli_cmd hostapd_cl
  26272. +@@ -1250,7 +1245,6 @@ static const struct hostapd_cli_cmd host
  26273. { "wps_ap_pin", hostapd_cli_cmd_wps_ap_pin },
  26274. { "wps_config", hostapd_cli_cmd_wps_config },
  26275. { "wps_get_status", hostapd_cli_cmd_wps_get_status },
  26276. diff --git a/package/network/services/hostapd/patches/431-wpa_cli_ifdef.patch b/package/network/services/hostapd/patches/431-wpa_cli_ifdef.patch
  26277. index 874ff4b..256f6b5 100644
  26278. --- a/package/network/services/hostapd/patches/431-wpa_cli_ifdef.patch
  26279. +++ b/package/network/services/hostapd/patches/431-wpa_cli_ifdef.patch
  26280. @@ -1,13 +1,12 @@
  26281. --- a/wpa_supplicant/wpa_cli.c
  26282. +++ b/wpa_supplicant/wpa_cli.c
  26283. -@@ -26,6 +26,10 @@
  26284. +@@ -25,6 +25,9 @@
  26285. + #include <cutils/properties.h>
  26286. #endif /* ANDROID */
  26287. -
  26288. +#ifndef CONFIG_P2P
  26289. +#define CONFIG_P2P
  26290. +#endif
  26291. -+
  26292. - static const char *wpa_cli_version =
  26293. +
  26294. + static const char *const wpa_cli_version =
  26295. "wpa_cli v" VERSION_STR "\n"
  26296. - "Copyright (c) 2004-2015, Jouni Malinen <j@w1.fi> and contributors";
  26297. diff --git a/package/network/services/hostapd/patches/432-missing-typedef.patch b/package/network/services/hostapd/patches/432-missing-typedef.patch
  26298. new file mode 100644
  26299. index 0000000..7a100f1
  26300. --- /dev/null
  26301. +++ b/package/network/services/hostapd/patches/432-missing-typedef.patch
  26302. @@ -0,0 +1,10 @@
  26303. +--- a/src/drivers/linux_wext.h
  26304. ++++ b/src/drivers/linux_wext.h
  26305. +@@ -26,6 +26,7 @@ typedef int32_t __s32;
  26306. + typedef uint16_t __u16;
  26307. + typedef int16_t __s16;
  26308. + typedef uint8_t __u8;
  26309. ++typedef int8_t __s8;
  26310. + #ifndef __user
  26311. + #define __user
  26312. + #endif /* __user */
  26313. 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
  26314. deleted file mode 100644
  26315. index 74aef26..0000000
  26316. --- a/package/network/services/hostapd/patches/440-max_num_sta_probe.patch
  26317. +++ /dev/null
  26318. @@ -1,13 +0,0 @@
  26319. ---- a/src/ap/beacon.c
  26320. -+++ b/src/ap/beacon.c
  26321. -@@ -664,6 +664,10 @@ void handle_probe_req(struct hostapd_dat
  26322. - return;
  26323. - }
  26324. -
  26325. -+ if (!sta && hapd->num_sta >= hapd->conf->max_num_sta)
  26326. -+ wpa_printf(MSG_MSGDUMP, "Probe Request from " MACSTR " ignored,"
  26327. -+ " too many connected stations.", MAC2STR(mgmt->sa));
  26328. -+
  26329. - #ifdef CONFIG_INTERWORKING
  26330. - if (hapd->conf->interworking &&
  26331. - elems.interworking && elems.interworking_len >= 1) {
  26332. diff --git a/package/network/services/hostapd/patches/450-scan_wait.patch b/package/network/services/hostapd/patches/450-scan_wait.patch
  26333. index 87ebd45..78cf306 100644
  26334. --- a/package/network/services/hostapd/patches/450-scan_wait.patch
  26335. +++ b/package/network/services/hostapd/patches/450-scan_wait.patch
  26336. @@ -1,6 +1,6 @@
  26337. --- a/hostapd/main.c
  26338. +++ b/hostapd/main.c
  26339. -@@ -36,6 +36,8 @@ struct hapd_global {
  26340. +@@ -37,6 +37,8 @@ struct hapd_global {
  26341. };
  26342. static struct hapd_global global;
  26343. @@ -9,7 +9,7 @@
  26344. #ifndef CONFIG_NO_HOSTAPD_LOGGER
  26345. -@@ -142,6 +144,14 @@ static void hostapd_logger_cb(void *ctx,
  26346. +@@ -143,6 +145,14 @@ static void hostapd_logger_cb(void *ctx,
  26347. }
  26348. #endif /* CONFIG_NO_HOSTAPD_LOGGER */
  26349. @@ -24,7 +24,7 @@
  26350. /**
  26351. * hostapd_driver_init - Preparate driver interface
  26352. -@@ -160,6 +170,8 @@ static int hostapd_driver_init(struct ho
  26353. +@@ -161,6 +171,8 @@ static int hostapd_driver_init(struct ho
  26354. return -1;
  26355. }
  26356. @@ -33,7 +33,7 @@
  26357. /* Initialize the driver interface */
  26358. if (!(b[0] | b[1] | b[2] | b[3] | b[4] | b[5]))
  26359. b = NULL;
  26360. -@@ -381,8 +393,6 @@ static void hostapd_global_deinit(const
  26361. +@@ -401,8 +413,6 @@ static void hostapd_global_deinit(const
  26362. #endif /* CONFIG_NATIVE_WINDOWS */
  26363. eap_server_unregister_methods();
  26364. @@ -42,19 +42,26 @@
  26365. }
  26366. -@@ -408,11 +418,6 @@ static int hostapd_global_run(struct hap
  26367. +@@ -428,18 +438,6 @@ static int hostapd_global_run(struct hap
  26368. }
  26369. #endif /* EAP_SERVER_TNC */
  26370. -- if (daemonize && os_daemonize(pid_file)) {
  26371. -- wpa_printf(MSG_ERROR, "daemon: %s", strerror(errno));
  26372. -- return -1;
  26373. +- if (daemonize) {
  26374. +- if (os_daemonize(pid_file)) {
  26375. +- wpa_printf(MSG_ERROR, "daemon: %s", strerror(errno));
  26376. +- return -1;
  26377. +- }
  26378. +- if (eloop_sock_requeue()) {
  26379. +- wpa_printf(MSG_ERROR, "eloop_sock_requeue: %s",
  26380. +- strerror(errno));
  26381. +- return -1;
  26382. +- }
  26383. - }
  26384. -
  26385. eloop_run();
  26386. return 0;
  26387. -@@ -542,8 +547,7 @@ int main(int argc, char *argv[])
  26388. +@@ -638,8 +636,7 @@ int main(int argc, char *argv[])
  26389. struct hapd_interfaces interfaces;
  26390. int ret = 1;
  26391. size_t i, j;
  26392. 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
  26393. index 217e701..6a5866e 100644
  26394. --- a/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch
  26395. +++ b/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch
  26396. @@ -18,15 +18,15 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  26397. #define WPA_SUPPLICANT_DRIVER_VERSION 4
  26398. -+#include "drivers/nl80211_copy.h"
  26399. ++#include "ap/sta_info.h"
  26400. #include "common/defs.h"
  26401. + #include "common/ieee802_11_defs.h"
  26402. #include "utils/list.h"
  26403. -
  26404. -@@ -538,6 +539,9 @@ struct wpa_driver_associate_params {
  26405. +@@ -587,6 +588,9 @@ struct wpa_driver_associate_params {
  26406. * responsible for selecting with which BSS to associate. */
  26407. const u8 *bssid;
  26408. -+ unsigned char rates[NL80211_MAX_SUPP_RATES];
  26409. ++ unsigned char rates[WLAN_SUPP_RATES_MAX];
  26410. + int mcast_rate;
  26411. +
  26412. /**
  26413. @@ -34,15 +34,15 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  26414. *
  26415. --- a/wpa_supplicant/config.c
  26416. +++ b/wpa_supplicant/config.c
  26417. -@@ -15,6 +15,7 @@
  26418. - #include "rsn_supp/wpa.h"
  26419. +@@ -16,6 +16,7 @@
  26420. #include "eap_peer/eap.h"
  26421. #include "p2p/p2p.h"
  26422. -+#include "drivers/nl80211_copy.h"
  26423. + #include "fst/fst.h"
  26424. ++#include "ap/sta_info.h"
  26425. #include "config.h"
  26426. -@@ -1722,6 +1723,97 @@ static char * wpa_config_write_mesh_basi
  26427. +@@ -1816,6 +1817,97 @@ static char * wpa_config_write_mesh_basi
  26428. #endif /* CONFIG_MESH */
  26429. @@ -88,7 +88,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  26430. + pos = (char *)value;
  26431. + r = strtok_r(pos, ",", &sptr);
  26432. + i = 0;
  26433. -+ while (pos && i < NL80211_MAX_SUPP_RATES) {
  26434. ++ while (pos && i < WLAN_SUPP_RATES_MAX) {
  26435. + rate = 0.0;
  26436. + if (r)
  26437. + rate = strtod(r, &end);
  26438. @@ -113,11 +113,11 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  26439. + if (ssid->rates[0] <= 0)
  26440. + return NULL;
  26441. +
  26442. -+ value = os_malloc(6 * NL80211_MAX_SUPP_RATES + 1);
  26443. ++ value = os_malloc(6 * WLAN_SUPP_RATES_MAX + 1);
  26444. + if (value == NULL)
  26445. + return NULL;
  26446. + pos = value;
  26447. -+ for (i = 0; i < NL80211_MAX_SUPP_RATES - 1; i++) {
  26448. ++ for (i = 0; i < WLAN_SUPP_RATES_MAX - 1; i++) {
  26449. + res = os_snprintf(pos, 6, "%.1f,", (double)ssid->rates[i] / 2);
  26450. + if (res < 0) {
  26451. + os_free(value);
  26452. @@ -126,13 +126,13 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  26453. + pos += res;
  26454. + }
  26455. + res = os_snprintf(pos, 6, "%.1f",
  26456. -+ (double)ssid->rates[NL80211_MAX_SUPP_RATES - 1] / 2);
  26457. ++ (double)ssid->rates[WLAN_SUPP_RATES_MAX - 1] / 2);
  26458. + if (res < 0) {
  26459. + os_free(value);
  26460. + return NULL;
  26461. + }
  26462. +
  26463. -+ value[6 * NL80211_MAX_SUPP_RATES] = '\0';
  26464. ++ value[6 * WLAN_SUPP_RATES_MAX] = '\0';
  26465. + return value;
  26466. +}
  26467. +#endif /* NO_CONFIG_WRITE */
  26468. @@ -140,7 +140,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  26469. /* Helper macros for network block parser */
  26470. #ifdef OFFSET
  26471. -@@ -1947,6 +2039,9 @@ static const struct parse_data ssid_fiel
  26472. +@@ -2047,6 +2139,9 @@ static const struct parse_data ssid_fiel
  26473. { INT(ap_max_inactivity) },
  26474. { INT(dtim_period) },
  26475. { INT(beacon_int) },
  26476. @@ -152,19 +152,22 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  26477. #endif /* CONFIG_MACSEC */
  26478. --- a/wpa_supplicant/config_ssid.h
  26479. +++ b/wpa_supplicant/config_ssid.h
  26480. -@@ -12,6 +12,7 @@
  26481. +@@ -10,8 +10,10 @@
  26482. + #define CONFIG_SSID_H
  26483. +
  26484. #include "common/defs.h"
  26485. ++#include "ap/sta_info.h"
  26486. #include "utils/list.h"
  26487. #include "eap_peer/eap_config.h"
  26488. +#include "drivers/nl80211_copy.h"
  26489. - #define MAX_SSID_LEN 32
  26490. -@@ -675,6 +676,9 @@ struct wpa_ssid {
  26491. + #define DEFAULT_EAP_WORKAROUND ((unsigned int) -1)
  26492. +@@ -711,6 +713,9 @@ struct wpa_ssid {
  26493. */
  26494. void *parent_cred;
  26495. -+ unsigned char rates[NL80211_MAX_SUPP_RATES];
  26496. ++ unsigned char rates[WLAN_SUPP_RATES_MAX];
  26497. + double mcast_rate;
  26498. +
  26499. #ifdef CONFIG_MACSEC
  26500. @@ -172,13 +175,13 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  26501. * macsec_policy - Determines the policy for MACsec secure session
  26502. --- a/wpa_supplicant/wpa_supplicant.c
  26503. +++ b/wpa_supplicant/wpa_supplicant.c
  26504. -@@ -2266,6 +2266,13 @@ static void wpas_start_assoc_cb(struct w
  26505. +@@ -2518,6 +2518,13 @@ static void wpas_start_assoc_cb(struct w
  26506. params.beacon_int = ssid->beacon_int;
  26507. else
  26508. params.beacon_int = wpa_s->conf->beacon_int;
  26509. + params.fixed_freq = ssid->fixed_freq;
  26510. + i = 0;
  26511. -+ while (i < NL80211_MAX_SUPP_RATES) {
  26512. ++ while (i < WLAN_SUPP_RATES_MAX) {
  26513. + params.rates[i] = ssid->rates[i];
  26514. + i++;
  26515. + }
  26516. 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
  26517. index 730cc31..459bdb9 100644
  26518. --- a/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch
  26519. +++ b/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch
  26520. @@ -10,7 +10,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  26521. --- a/src/drivers/driver_nl80211.c
  26522. +++ b/src/drivers/driver_nl80211.c
  26523. -@@ -4398,7 +4398,7 @@ static int wpa_driver_nl80211_ibss(struc
  26524. +@@ -4644,7 +4644,7 @@ static int wpa_driver_nl80211_ibss(struc
  26525. struct wpa_driver_associate_params *params)
  26526. {
  26527. struct nl_msg *msg;
  26528. @@ -19,7 +19,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  26529. int count = 0;
  26530. wpa_printf(MSG_DEBUG, "nl80211: Join IBSS (ifindex=%d)", drv->ifindex);
  26531. -@@ -4425,6 +4425,37 @@ retry:
  26532. +@@ -4671,6 +4671,37 @@ retry:
  26533. nl80211_put_beacon_int(msg, params->beacon_int))
  26534. goto fail;
  26535. 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
  26536. index 30bb2dc..80fe49c 100644
  26537. --- a/package/network/services/hostapd/patches/462-wpa_s-support-htmode-param.patch
  26538. +++ b/package/network/services/hostapd/patches/462-wpa_s-support-htmode-param.patch
  26539. @@ -16,9 +16,9 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  26540. --- a/src/drivers/driver.h
  26541. +++ b/src/drivers/driver.h
  26542. -@@ -541,6 +541,8 @@ struct wpa_driver_associate_params {
  26543. +@@ -590,6 +590,8 @@ struct wpa_driver_associate_params {
  26544. - unsigned char rates[NL80211_MAX_SUPP_RATES];
  26545. + unsigned char rates[WLAN_SUPP_RATES_MAX];
  26546. int mcast_rate;
  26547. + int ht_set;
  26548. + unsigned int htmode;
  26549. @@ -27,7 +27,7 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  26550. * bssid_hint - BSSID of a proposed AP
  26551. --- a/src/drivers/driver_nl80211.c
  26552. +++ b/src/drivers/driver_nl80211.c
  26553. -@@ -4456,6 +4456,22 @@ retry:
  26554. +@@ -4702,6 +4702,22 @@ retry:
  26555. nla_put_u32(msg, NL80211_ATTR_MCAST_RATE, params->mcast_rate);
  26556. }
  26557. @@ -52,7 +52,7 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  26558. goto fail;
  26559. --- a/wpa_supplicant/config.c
  26560. +++ b/wpa_supplicant/config.c
  26561. -@@ -1754,6 +1754,71 @@ static char * wpa_config_write_mcast_rat
  26562. +@@ -1848,6 +1848,71 @@ static char * wpa_config_write_mcast_rat
  26563. }
  26564. #endif /* NO_CONFIG_WRITE */
  26565. @@ -124,7 +124,7 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  26566. static int wpa_config_parse_rates(const struct parse_data *data,
  26567. struct wpa_ssid *ssid, int line,
  26568. const char *value)
  26569. -@@ -2042,6 +2107,7 @@ static const struct parse_data ssid_fiel
  26570. +@@ -2142,6 +2207,7 @@ static const struct parse_data ssid_fiel
  26571. { INT_RANGE(fixed_freq, 0, 1) },
  26572. { FUNC(rates) },
  26573. { FUNC(mcast_rate) },
  26574. @@ -134,9 +134,9 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  26575. #endif /* CONFIG_MACSEC */
  26576. --- a/wpa_supplicant/config_ssid.h
  26577. +++ b/wpa_supplicant/config_ssid.h
  26578. -@@ -678,6 +678,8 @@ struct wpa_ssid {
  26579. +@@ -715,6 +715,8 @@ struct wpa_ssid {
  26580. - unsigned char rates[NL80211_MAX_SUPP_RATES];
  26581. + unsigned char rates[WLAN_SUPP_RATES_MAX];
  26582. double mcast_rate;
  26583. + int ht_set;
  26584. + unsigned int htmode;
  26585. @@ -145,7 +145,7 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  26586. /**
  26587. --- a/wpa_supplicant/wpa_supplicant.c
  26588. +++ b/wpa_supplicant/wpa_supplicant.c
  26589. -@@ -2273,6 +2273,8 @@ static void wpas_start_assoc_cb(struct w
  26590. +@@ -2525,6 +2525,8 @@ static void wpas_start_assoc_cb(struct w
  26591. i++;
  26592. }
  26593. params.mcast_rate = ssid->mcast_rate;
  26594. diff --git a/package/network/services/hostapd/patches/470-survey_data_fallback.patch b/package/network/services/hostapd/patches/470-survey_data_fallback.patch
  26595. new file mode 100644
  26596. index 0000000..4e40a87
  26597. --- /dev/null
  26598. +++ b/package/network/services/hostapd/patches/470-survey_data_fallback.patch
  26599. @@ -0,0 +1,45 @@
  26600. +--- a/src/ap/acs.c
  26601. ++++ b/src/ap/acs.c
  26602. +@@ -292,18 +292,12 @@ static void acs_fail(struct hostapd_ifac
  26603. + static long double
  26604. + acs_survey_interference_factor(struct freq_survey *survey, s8 min_nf)
  26605. + {
  26606. +- long double factor, busy, total;
  26607. ++ long double factor, busy = 0, total;
  26608. +
  26609. + if (survey->filled & SURVEY_HAS_CHAN_TIME_BUSY)
  26610. + busy = survey->channel_time_busy;
  26611. + else if (survey->filled & SURVEY_HAS_CHAN_TIME_RX)
  26612. + busy = survey->channel_time_rx;
  26613. +- else {
  26614. +- /* This shouldn't really happen as survey data is checked in
  26615. +- * acs_sanity_check() */
  26616. +- wpa_printf(MSG_ERROR, "ACS: Survey data missing");
  26617. +- return 0;
  26618. +- }
  26619. +
  26620. + total = survey->channel_time;
  26621. +
  26622. +@@ -395,20 +389,19 @@ static int acs_usable_vht80_chan(struct
  26623. + static int acs_survey_is_sufficient(struct freq_survey *survey)
  26624. + {
  26625. + if (!(survey->filled & SURVEY_HAS_NF)) {
  26626. ++ survey->nf = -95;
  26627. + wpa_printf(MSG_INFO, "ACS: Survey is missing noise floor");
  26628. +- return 0;
  26629. + }
  26630. +
  26631. + if (!(survey->filled & SURVEY_HAS_CHAN_TIME)) {
  26632. ++ survey->channel_time = 0;
  26633. + wpa_printf(MSG_INFO, "ACS: Survey is missing channel time");
  26634. +- return 0;
  26635. + }
  26636. +
  26637. + if (!(survey->filled & SURVEY_HAS_CHAN_TIME_BUSY) &&
  26638. + !(survey->filled & SURVEY_HAS_CHAN_TIME_RX)) {
  26639. + wpa_printf(MSG_INFO,
  26640. + "ACS: Survey is missing RX and busy time (at least one is required)");
  26641. +- return 0;
  26642. + }
  26643. +
  26644. + return 1;
  26645. 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
  26646. deleted file mode 100644
  26647. index e6bbddd..0000000
  26648. --- a/package/network/services/hostapd/patches/470-wait-for-nullfunc-longer.patch
  26649. +++ /dev/null
  26650. @@ -1,11 +0,0 @@
  26651. ---- a/src/ap/sta_info.h
  26652. -+++ b/src/ap/sta_info.h
  26653. -@@ -179,7 +179,7 @@ struct sta_info {
  26654. - * AP_DISASSOC_DELAY seconds. Similarly, the station will be deauthenticated
  26655. - * after AP_DEAUTH_DELAY seconds has passed after disassociation. */
  26656. - #define AP_MAX_INACTIVITY (5 * 60)
  26657. --#define AP_DISASSOC_DELAY (1)
  26658. -+#define AP_DISASSOC_DELAY (3)
  26659. - #define AP_DEAUTH_DELAY (1)
  26660. - /* Number of seconds to keep STA entry with Authenticated flag after it has
  26661. - * been disassociated. */
  26662. diff --git a/package/network/services/hostapd/patches/600-ubus_support.patch b/package/network/services/hostapd/patches/600-ubus_support.patch
  26663. index df2eac8..feacdf2 100644
  26664. --- a/package/network/services/hostapd/patches/600-ubus_support.patch
  26665. +++ b/package/network/services/hostapd/patches/600-ubus_support.patch
  26666. @@ -1,6 +1,6 @@
  26667. --- a/hostapd/Makefile
  26668. +++ b/hostapd/Makefile
  26669. -@@ -121,6 +121,11 @@ OBJS += ../src/common/hw_features_common
  26670. +@@ -157,6 +157,11 @@ OBJS += ../src/common/hw_features_common
  26671. OBJS += ../src/eapol_auth/eapol_auth_sm.o
  26672. @@ -22,7 +22,7 @@
  26673. struct wpa_ctrl_dst;
  26674. struct radius_server_data;
  26675. -@@ -103,6 +104,7 @@ struct hostapd_data {
  26676. +@@ -118,6 +119,7 @@ struct hostapd_data {
  26677. struct hostapd_iface *iface;
  26678. struct hostapd_config *iconf;
  26679. struct hostapd_bss_config *conf;
  26680. @@ -30,7 +30,7 @@
  26681. int interface_added; /* virtual interface added for this BSS */
  26682. unsigned int started:1;
  26683. unsigned int disabled:1;
  26684. -@@ -286,6 +288,8 @@ struct hostapd_iface {
  26685. +@@ -323,6 +325,8 @@ struct hostapd_iface {
  26686. struct hostapd_config *conf;
  26687. char phy[16]; /* Name of the PHY (radio) */
  26688. @@ -41,10 +41,10 @@
  26689. HAPD_IFACE_DISABLED,
  26690. --- /dev/null
  26691. +++ b/src/ap/ubus.c
  26692. -@@ -0,0 +1,511 @@
  26693. +@@ -0,0 +1,536 @@
  26694. +/*
  26695. + * hostapd / ubus support
  26696. -+ * Copyright (c) 2013, Felix Fietkau <nbd@openwrt.org>
  26697. ++ * Copyright (c) 2013, Felix Fietkau <nbd@nbd.name>
  26698. + *
  26699. + * This software may be distributed under the terms of the BSD license.
  26700. + * See README for more details.
  26701. @@ -58,6 +58,8 @@
  26702. +#include "wps_hostapd.h"
  26703. +#include "sta_info.h"
  26704. +#include "ubus.h"
  26705. ++#include "ap_drv_ops.h"
  26706. ++#include "beacon.h"
  26707. +
  26708. +static struct ubus_context *ctx;
  26709. +static struct blob_buf b;
  26710. @@ -417,6 +419,10 @@
  26711. +{
  26712. + struct blob_attr *tb[__VENDOR_ELEMENTS_MAX];
  26713. + struct hostapd_data *hapd = get_hapd_from_object(obj);
  26714. ++ struct hostapd_bss_config *bss = hapd->conf;
  26715. ++ struct wpabuf *elems;
  26716. ++ const char *pos;
  26717. ++ size_t len;
  26718. +
  26719. + blobmsg_parse(ve_policy, __VENDOR_ELEMENTS_MAX, tb,
  26720. + blob_data(msg), blob_len(msg));
  26721. @@ -424,10 +430,29 @@
  26722. + if (!tb[VENDOR_ELEMENTS])
  26723. + return UBUS_STATUS_INVALID_ARGUMENT;
  26724. +
  26725. -+ const char *vendor_elements = blobmsg_data(tb[VENDOR_ELEMENTS]);
  26726. -+ if (hostapd_set_iface(hapd->iconf, hapd->conf, "vendor_elements",
  26727. -+ vendor_elements) != 0)
  26728. -+ return UBUS_STATUS_NOT_SUPPORTED;
  26729. ++ pos = blobmsg_data(tb[VENDOR_ELEMENTS]);
  26730. ++ len = os_strlen(pos);
  26731. ++ if (len & 0x01)
  26732. ++ return UBUS_STATUS_INVALID_ARGUMENT;
  26733. ++
  26734. ++ len /= 2;
  26735. ++ if (len == 0) {
  26736. ++ wpabuf_free(bss->vendor_elements);
  26737. ++ bss->vendor_elements = NULL;
  26738. ++ return 0;
  26739. ++ }
  26740. ++
  26741. ++ elems = wpabuf_alloc(len);
  26742. ++ if (elems == NULL)
  26743. ++ return 1;
  26744. ++
  26745. ++ if (hexstr2bin(pos, wpabuf_put(elems, len), len)) {
  26746. ++ wpabuf_free(elems);
  26747. ++ return UBUS_STATUS_INVALID_ARGUMENT;
  26748. ++ }
  26749. ++
  26750. ++ wpabuf_free(bss->vendor_elements);
  26751. ++ bss->vendor_elements = elems;
  26752. +
  26753. + /* update beacons if vendor elements were set successfully */
  26754. + if (ieee802_11_update_beacons(hapd->iface) != 0)
  26755. @@ -558,7 +583,7 @@
  26756. @@ -0,0 +1,78 @@
  26757. +/*
  26758. + * hostapd / ubus support
  26759. -+ * Copyright (c) 2013, Felix Fietkau <nbd@openwrt.org>
  26760. ++ * Copyright (c) 2013, Felix Fietkau <nbd@nbd.name>
  26761. + *
  26762. + * This software may be distributed under the terms of the BSD license.
  26763. + * See README for more details.
  26764. @@ -636,7 +661,7 @@
  26765. +#endif
  26766. --- a/src/ap/hostapd.c
  26767. +++ b/src/ap/hostapd.c
  26768. -@@ -277,6 +277,7 @@ static void hostapd_free_hapd_data(struc
  26769. +@@ -284,6 +284,7 @@ static void hostapd_free_hapd_data(struc
  26770. hapd->started = 0;
  26771. wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface);
  26772. @@ -644,7 +669,7 @@
  26773. iapp_deinit(hapd->iapp);
  26774. hapd->iapp = NULL;
  26775. accounting_deinit(hapd);
  26776. -@@ -1098,6 +1099,8 @@ static int hostapd_setup_bss(struct host
  26777. +@@ -1139,6 +1140,8 @@ static int hostapd_setup_bss(struct host
  26778. if (hapd->driver && hapd->driver->set_operstate)
  26779. hapd->driver->set_operstate(hapd->drv_priv, 1);
  26780. @@ -653,7 +678,7 @@
  26781. return 0;
  26782. }
  26783. -@@ -1384,6 +1387,7 @@ int hostapd_setup_interface_complete(str
  26784. +@@ -1664,6 +1667,7 @@ static int hostapd_setup_interface_compl
  26785. if (err)
  26786. goto fail;
  26787. @@ -661,15 +686,15 @@
  26788. wpa_printf(MSG_DEBUG, "Completing interface initialization");
  26789. if (iface->conf->channel) {
  26790. #ifdef NEED_AP_MLME
  26791. -@@ -1544,6 +1548,7 @@ dfs_offload:
  26792. +@@ -1844,6 +1848,7 @@ dfs_offload:
  26793. fail:
  26794. wpa_printf(MSG_ERROR, "Interface initialization failed");
  26795. + hostapd_ubus_free_iface(iface);
  26796. hostapd_set_state(iface, HAPD_IFACE_DISABLED);
  26797. wpa_msg(hapd->msg_ctx, MSG_INFO, AP_EVENT_DISABLED);
  26798. - if (iface->interfaces && iface->interfaces->terminate_on_error)
  26799. -@@ -1873,6 +1878,7 @@ void hostapd_interface_deinit_free(struc
  26800. + #ifdef CONFIG_FST
  26801. +@@ -2277,6 +2282,7 @@ void hostapd_interface_deinit_free(struc
  26802. (unsigned int) iface->conf->num_bss);
  26803. driver = iface->bss[0]->driver;
  26804. drv_priv = iface->bss[0]->drv_priv;
  26805. @@ -679,7 +704,7 @@
  26806. __func__, driver, drv_priv);
  26807. --- a/src/ap/ieee802_11.c
  26808. +++ b/src/ap/ieee802_11.c
  26809. -@@ -881,7 +881,8 @@ int auth_sae_init_committed(struct hosta
  26810. +@@ -980,7 +980,8 @@ int auth_sae_init_committed(struct hosta
  26811. static void handle_auth(struct hostapd_data *hapd,
  26812. @@ -689,7 +714,7 @@
  26813. {
  26814. u16 auth_alg, auth_transaction, status_code;
  26815. u16 resp = WLAN_STATUS_SUCCESS;
  26816. -@@ -897,6 +898,11 @@ static void handle_auth(struct hostapd_d
  26817. +@@ -996,6 +997,11 @@ static void handle_auth(struct hostapd_d
  26818. char *identity = NULL;
  26819. char *radius_cui = NULL;
  26820. u16 seq_ctrl;
  26821. @@ -699,9 +724,9 @@
  26822. + .frame_info = fi,
  26823. + };
  26824. - if (len < IEEE80211_HDRLEN + sizeof(mgmt->u.auth)) {
  26825. - wpa_printf(MSG_INFO, "handle_auth - too short payload (len=%lu)",
  26826. -@@ -983,6 +989,14 @@ static void handle_auth(struct hostapd_d
  26827. + os_memset(&vlan_id, 0, sizeof(vlan_id));
  26828. +
  26829. +@@ -1149,6 +1155,14 @@ static void handle_auth(struct hostapd_d
  26830. resp = WLAN_STATUS_UNSPECIFIED_FAILURE;
  26831. goto fail;
  26832. }
  26833. @@ -716,7 +741,7 @@
  26834. if (res == HOSTAPD_ACL_PENDING) {
  26835. wpa_printf(MSG_DEBUG, "Authentication frame from " MACSTR
  26836. " waiting for an external authentication",
  26837. -@@ -1694,13 +1708,18 @@ static void send_assoc_resp(struct hosta
  26838. +@@ -2033,13 +2047,18 @@ static u16 send_assoc_resp(struct hostap
  26839. static void handle_assoc(struct hostapd_data *hapd,
  26840. const struct ieee80211_mgmt *mgmt, size_t len,
  26841. @@ -724,7 +749,7 @@
  26842. + int reassoc, struct hostapd_frame_info *fi)
  26843. {
  26844. u16 capab_info, listen_interval, seq_ctrl, fc;
  26845. - u16 resp = WLAN_STATUS_SUCCESS;
  26846. + u16 resp = WLAN_STATUS_SUCCESS, reply_res;
  26847. const u8 *pos;
  26848. int left, i;
  26849. struct sta_info *sta;
  26850. @@ -736,9 +761,9 @@
  26851. if (len < IEEE80211_HDRLEN + (reassoc ? sizeof(mgmt->u.reassoc_req) :
  26852. sizeof(mgmt->u.assoc_req))) {
  26853. -@@ -1820,6 +1839,13 @@ static void handle_assoc(struct hostapd_
  26854. - goto fail;
  26855. +@@ -2159,6 +2178,13 @@ static void handle_assoc(struct hostapd_
  26856. }
  26857. + #endif /* CONFIG_MBO */
  26858. + if (hostapd_ubus_handle_event(hapd, &req)) {
  26859. + wpa_printf(MSG_DEBUG, "Station " MACSTR " assoc rejected by ubus handler.\n",
  26860. @@ -747,10 +772,10 @@
  26861. + goto fail;
  26862. + }
  26863. +
  26864. - sta->capability = capab_info;
  26865. - sta->listen_interval = listen_interval;
  26866. -
  26867. -@@ -2236,7 +2262,7 @@ int ieee802_11_mgmt(struct hostapd_data
  26868. + /*
  26869. + * sta->capability is used in check_assoc_ies() for RRM enabled
  26870. + * capability element.
  26871. +@@ -2639,7 +2665,7 @@ int ieee802_11_mgmt(struct hostapd_data
  26872. if (stype == WLAN_FC_STYPE_PROBE_REQ) {
  26873. @@ -759,7 +784,7 @@
  26874. return 1;
  26875. }
  26876. -@@ -2251,17 +2277,17 @@ int ieee802_11_mgmt(struct hostapd_data
  26877. +@@ -2657,17 +2683,17 @@ int ieee802_11_mgmt(struct hostapd_data
  26878. switch (stype) {
  26879. case WLAN_FC_STYPE_AUTH:
  26880. wpa_printf(MSG_DEBUG, "mgmt::auth");
  26881. @@ -782,7 +807,7 @@
  26882. case WLAN_FC_STYPE_DISASSOC:
  26883. --- a/src/ap/beacon.c
  26884. +++ b/src/ap/beacon.c
  26885. -@@ -542,7 +542,7 @@ static enum ssid_match_result ssid_match
  26886. +@@ -675,7 +675,7 @@ sta_track_seen_on(struct hostapd_iface *
  26887. void handle_probe_req(struct hostapd_data *hapd,
  26888. const struct ieee80211_mgmt *mgmt, size_t len,
  26889. @@ -791,22 +816,23 @@
  26890. {
  26891. u8 *resp;
  26892. struct ieee802_11_elems elems;
  26893. -@@ -550,8 +550,14 @@ void handle_probe_req(struct hostapd_dat
  26894. - size_t ie_len;
  26895. - struct sta_info *sta = NULL;
  26896. +@@ -684,9 +684,15 @@ void handle_probe_req(struct hostapd_dat
  26897. size_t i, resp_len;
  26898. -+ int ssi_signal = fi->ssi_signal;
  26899. int noack;
  26900. enum ssid_match_result res;
  26901. ++ int ssi_signal = fi->ssi_signal;
  26902. + int ret;
  26903. + u16 csa_offs[2];
  26904. + size_t csa_offs_len;
  26905. + struct hostapd_ubus_request req = {
  26906. + .type = HOSTAPD_UBUS_PROBE_REQ,
  26907. + .mgmt_frame = mgmt,
  26908. + .frame_info = fi,
  26909. + };
  26910. - ie = mgmt->u.probe_req.variable;
  26911. - if (len < IEEE80211_HDRLEN + sizeof(mgmt->u.probe_req))
  26912. -@@ -710,6 +716,12 @@ void handle_probe_req(struct hostapd_dat
  26913. + if (len < IEEE80211_HDRLEN)
  26914. + return;
  26915. +@@ -838,6 +844,12 @@ void handle_probe_req(struct hostapd_dat
  26916. }
  26917. #endif /* CONFIG_P2P */
  26918. @@ -832,7 +858,7 @@
  26919. int ieee802_11_update_beacons(struct hostapd_iface *iface);
  26920. --- a/src/ap/drv_callbacks.c
  26921. +++ b/src/ap/drv_callbacks.c
  26922. -@@ -49,6 +49,10 @@ int hostapd_notif_assoc(struct hostapd_d
  26923. +@@ -52,6 +52,10 @@ int hostapd_notif_assoc(struct hostapd_d
  26924. u16 reason = WLAN_REASON_UNSPECIFIED;
  26925. u16 status = WLAN_STATUS_SUCCESS;
  26926. const u8 *p2p_dev_addr = NULL;
  26927. @@ -843,9 +869,9 @@
  26928. if (addr == NULL) {
  26929. /*
  26930. -@@ -113,6 +117,12 @@ int hostapd_notif_assoc(struct hostapd_d
  26931. +@@ -124,6 +128,12 @@ int hostapd_notif_assoc(struct hostapd_d
  26932. + goto fail;
  26933. }
  26934. - sta->flags &= ~(WLAN_STA_WPS | WLAN_STA_MAYBE_WPS | WLAN_STA_WPS2);
  26935. + if (hostapd_ubus_handle_event(hapd, &req)) {
  26936. + wpa_printf(MSG_DEBUG, "Station " MACSTR " assoc rejected by ubus handler.\n",
  26937. diff --git a/package/network/utils/iw/Makefile b/package/network/utils/iw/Makefile
  26938. index ad82081..d17cbca 100644
  26939. --- a/package/network/utils/iw/Makefile
  26940. +++ b/package/network/utils/iw/Makefile
  26941. @@ -12,10 +12,10 @@ PKG_VERSION:=4.3
  26942. PKG_RELEASE:=1
  26943. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  26944. -PKG_SOURCE_URL:=https://www.kernel.org/pub/software/network/iw
  26945. +PKG_SOURCE_URL:=@KERNEL/software/network/iw
  26946. PKG_MD5SUM:=7adec72e91ebdd9c55429fa34a23a6f5
  26947. -PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  26948. +PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  26949. PKG_LICENSE:=GPL-2.0
  26950. include $(INCLUDE_DIR)/package.mk
  26951. diff --git a/package/network/utils/iw/patches/001-nl80211_h_sync.patch b/package/network/utils/iw/patches/001-nl80211_h_sync.patch
  26952. index 7de2258..e5ea8f7 100644
  26953. --- a/package/network/utils/iw/patches/001-nl80211_h_sync.patch
  26954. +++ b/package/network/utils/iw/patches/001-nl80211_h_sync.patch
  26955. @@ -8,7 +8,17 @@
  26956. *
  26957. * Permission to use, copy, modify, and/or distribute this software for any
  26958. * purpose with or without fee is hereby granted, provided that the above
  26959. -@@ -328,7 +329,15 @@
  26960. +@@ -321,14 +322,24 @@
  26961. + * @NL80211_CMD_GET_SCAN: get scan results
  26962. + * @NL80211_CMD_TRIGGER_SCAN: trigger a new scan with the given parameters
  26963. + * %NL80211_ATTR_TX_NO_CCK_RATE is used to decide whether to send the
  26964. +- * probe requests at CCK rate or not.
  26965. ++ * probe requests at CCK rate or not. %NL80211_ATTR_MAC can be used to
  26966. ++ * specify a BSSID to scan for; if not included, the wildcard BSSID will
  26967. ++ * be used.
  26968. + * @NL80211_CMD_NEW_SCAN_RESULTS: scan notification (as a reply to
  26969. + * NL80211_CMD_GET_SCAN and on the "scan" multicast group)
  26970. + * @NL80211_CMD_SCAN_ABORTED: scan was aborted, for unspecified reasons,
  26971. * partial scan results may be available
  26972. *
  26973. * @NL80211_CMD_START_SCHED_SCAN: start a scheduled scan at certain
  26974. @@ -25,7 +35,82 @@
  26975. * Like with normal scans, if SSIDs (%NL80211_ATTR_SCAN_SSIDS)
  26976. * are passed, they are used in the probe requests. For
  26977. * broadcast, a broadcast SSID must be passed (ie. an empty
  26978. -@@ -1761,6 +1770,22 @@ enum nl80211_commands {
  26979. +@@ -418,7 +429,11 @@
  26980. + * @NL80211_CMD_ASSOCIATE: association request and notification; like
  26981. + * NL80211_CMD_AUTHENTICATE but for Association and Reassociation
  26982. + * (similar to MLME-ASSOCIATE.request, MLME-REASSOCIATE.request,
  26983. +- * MLME-ASSOCIATE.confirm or MLME-REASSOCIATE.confirm primitives).
  26984. ++ * MLME-ASSOCIATE.confirm or MLME-REASSOCIATE.confirm primitives). The
  26985. ++ * %NL80211_ATTR_PREV_BSSID attribute is used to specify whether the
  26986. ++ * request is for the initial association to an ESS (that attribute not
  26987. ++ * included) or for reassociation within the ESS (that attribute is
  26988. ++ * included).
  26989. + * @NL80211_CMD_DEAUTHENTICATE: deauthentication request and notification; like
  26990. + * NL80211_CMD_AUTHENTICATE but for Deauthentication frames (similar to
  26991. + * MLME-DEAUTHENTICATION.request and MLME-DEAUTHENTICATE.indication
  26992. +@@ -468,6 +483,9 @@
  26993. + * set of BSSID,frequency parameters is used (i.e., either the enforcing
  26994. + * %NL80211_ATTR_MAC,%NL80211_ATTR_WIPHY_FREQ or the less strict
  26995. + * %NL80211_ATTR_MAC_HINT and %NL80211_ATTR_WIPHY_FREQ_HINT).
  26996. ++ * %NL80211_ATTR_PREV_BSSID can be used to request a reassociation within
  26997. ++ * the ESS in case the device is already associated and an association with
  26998. ++ * a different BSS is desired.
  26999. + * Background scan period can optionally be
  27000. + * specified in %NL80211_ATTR_BG_SCAN_PERIOD,
  27001. + * if not specified default background scan configuration
  27002. +@@ -811,6 +829,10 @@
  27003. + * as an event to indicate changes for devices with wiphy-specific regdom
  27004. + * management.
  27005. + *
  27006. ++ * @NL80211_CMD_ABORT_SCAN: Stop an ongoing scan. Returns -ENOENT if a scan is
  27007. ++ * not running. The driver indicates the status of the scan through
  27008. ++ * cfg80211_scan_done().
  27009. ++ *
  27010. + * @NL80211_CMD_MAX: highest used command number
  27011. + * @__NL80211_CMD_AFTER_LAST: internal use
  27012. + */
  27013. +@@ -997,6 +1019,8 @@ enum nl80211_commands {
  27014. +
  27015. + NL80211_CMD_WIPHY_REG_CHANGE,
  27016. +
  27017. ++ NL80211_CMD_ABORT_SCAN,
  27018. ++
  27019. + /* add new commands above here */
  27020. +
  27021. + /* used to define NL80211_CMD_MAX below */
  27022. +@@ -1270,8 +1294,11 @@ enum nl80211_commands {
  27023. + * @NL80211_ATTR_RESP_IE: (Re)association response information elements as
  27024. + * sent by peer, for ROAM and successful CONNECT events.
  27025. + *
  27026. +- * @NL80211_ATTR_PREV_BSSID: previous BSSID, to be used by in ASSOCIATE
  27027. +- * commands to specify using a reassociate frame
  27028. ++ * @NL80211_ATTR_PREV_BSSID: previous BSSID, to be used in ASSOCIATE and CONNECT
  27029. ++ * commands to specify a request to reassociate within an ESS, i.e., to use
  27030. ++ * Reassociate Request frame (with the value of this attribute in the
  27031. ++ * Current AP address field) instead of Association Request frame which is
  27032. ++ * used for the initial association to an ESS.
  27033. + *
  27034. + * @NL80211_ATTR_KEY: key information in a nested attribute with
  27035. + * %NL80211_KEY_* sub-attributes
  27036. +@@ -1712,6 +1739,8 @@ enum nl80211_commands {
  27037. + * underlying device supports these minimal RRM features:
  27038. + * %NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES,
  27039. + * %NL80211_FEATURE_QUIET,
  27040. ++ * Or, if global RRM is supported, see:
  27041. ++ * %NL80211_EXT_FEATURE_RRM
  27042. + * If this flag is used, driver must add the Power Capabilities IE to the
  27043. + * association request. In addition, it must also set the RRM capability
  27044. + * flag in the association request's Capability Info field.
  27045. +@@ -1755,12 +1784,44 @@ enum nl80211_commands {
  27046. + * over all channels.
  27047. + *
  27048. + * @NL80211_ATTR_SCHED_SCAN_DELAY: delay before the first cycle of a
  27049. +- * scheduled scan (or a WoWLAN net-detect scan) is started, u32
  27050. +- * in seconds.
  27051. ++ * scheduled scan is started. Or the delay before a WoWLAN
  27052. ++ * net-detect scan is started, counting from the moment the
  27053. ++ * system is suspended. This value is a u32, in seconds.
  27054. +
  27055. * @NL80211_ATTR_REG_INDOOR: flag attribute, if set indicates that the device
  27056. * is operating in an indoor environment.
  27057. *
  27058. @@ -41,6 +126,21 @@
  27059. + * thus it must not specify the number of iterations, only the interval
  27060. + * between scans. The scan plans are executed sequentially.
  27061. + * Each scan plan is a nested attribute of &enum nl80211_sched_scan_plan.
  27062. ++ * @NL80211_ATTR_PBSS: flag attribute. If set it means operate
  27063. ++ * in a PBSS. Specified in %NL80211_CMD_CONNECT to request
  27064. ++ * connecting to a PCP, and in %NL80211_CMD_START_AP to start
  27065. ++ * a PCP instead of AP. Relevant for DMG networks only.
  27066. ++ * @NL80211_ATTR_BSS_SELECT: nested attribute for driver supporting the
  27067. ++ * BSS selection feature. When used with %NL80211_CMD_GET_WIPHY it contains
  27068. ++ * attributes according &enum nl80211_bss_select_attr to indicate what
  27069. ++ * BSS selection behaviours are supported. When used with %NL80211_CMD_CONNECT
  27070. ++ * it contains the behaviour-specific attribute containing the parameters for
  27071. ++ * BSS selection to be done by driver and/or firmware.
  27072. ++ *
  27073. ++ * @NL80211_ATTR_STA_SUPPORT_P2P_PS: whether P2P PS mechanism supported
  27074. ++ * or not. u8, one of the values of &enum nl80211_sta_p2p_ps_status
  27075. ++ *
  27076. ++ * @NL80211_ATTR_PAD: attribute used for padding for 64-bit alignment
  27077. + *
  27078. + * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce
  27079. + * transmit power to stay within regulatory limits. u32, dBi.
  27080. @@ -48,7 +148,7 @@
  27081. * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  27082. * @NL80211_ATTR_MAX: highest attribute number currently defined
  27083. * @__NL80211_ATTR_AFTER_LAST: internal use
  27084. -@@ -2130,6 +2155,13 @@ enum nl80211_attrs {
  27085. +@@ -2130,6 +2191,21 @@ enum nl80211_attrs {
  27086. NL80211_ATTR_REG_INDOOR,
  27087. @@ -57,30 +157,147 @@
  27088. + NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS,
  27089. + NL80211_ATTR_SCHED_SCAN_PLANS,
  27090. +
  27091. ++ NL80211_ATTR_PBSS,
  27092. ++
  27093. ++ NL80211_ATTR_BSS_SELECT,
  27094. ++
  27095. ++ NL80211_ATTR_STA_SUPPORT_P2P_PS,
  27096. ++
  27097. ++ NL80211_ATTR_PAD,
  27098. ++
  27099. + NL80211_ATTR_WIPHY_ANTENNA_GAIN,
  27100. +
  27101. /* add attributes here, update the policy in nl80211.c */
  27102. __NL80211_ATTR_AFTER_LAST,
  27103. -@@ -3364,6 +3396,9 @@ enum nl80211_bss_scan_width {
  27104. +@@ -2273,6 +2349,20 @@ enum nl80211_sta_flags {
  27105. + NL80211_STA_FLAG_MAX = __NL80211_STA_FLAG_AFTER_LAST - 1
  27106. + };
  27107. +
  27108. ++/**
  27109. ++ * enum nl80211_sta_p2p_ps_status - station support of P2P PS
  27110. ++ *
  27111. ++ * @NL80211_P2P_PS_UNSUPPORTED: station doesn't support P2P PS mechanism
  27112. ++ * @@NL80211_P2P_PS_SUPPORTED: station supports P2P PS mechanism
  27113. ++ * @NUM_NL80211_P2P_PS_STATUS: number of values
  27114. ++ */
  27115. ++enum nl80211_sta_p2p_ps_status {
  27116. ++ NL80211_P2P_PS_UNSUPPORTED = 0,
  27117. ++ NL80211_P2P_PS_SUPPORTED,
  27118. ++
  27119. ++ NUM_NL80211_P2P_PS_STATUS,
  27120. ++};
  27121. ++
  27122. + #define NL80211_STA_FLAG_MAX_OLD_API NL80211_STA_FLAG_TDLS_PEER
  27123. +
  27124. + /**
  27125. +@@ -2430,6 +2520,9 @@ enum nl80211_sta_bss_param {
  27126. + * TID+1 and the special TID 16 (i.e. value 17) is used for non-QoS frames;
  27127. + * each one of those is again nested with &enum nl80211_tid_stats
  27128. + * attributes carrying the actual values.
  27129. ++ * @NL80211_STA_INFO_RX_DURATION: aggregate PPDU duration for all frames
  27130. ++ * received from the station (u64, usec)
  27131. ++ * @NL80211_STA_INFO_PAD: attribute used for padding for 64-bit alignment
  27132. + * @__NL80211_STA_INFO_AFTER_LAST: internal
  27133. + * @NL80211_STA_INFO_MAX: highest possible station info attribute
  27134. + */
  27135. +@@ -2466,6 +2559,8 @@ enum nl80211_sta_info {
  27136. + NL80211_STA_INFO_BEACON_RX,
  27137. + NL80211_STA_INFO_BEACON_SIGNAL_AVG,
  27138. + NL80211_STA_INFO_TID_STATS,
  27139. ++ NL80211_STA_INFO_RX_DURATION,
  27140. ++ NL80211_STA_INFO_PAD,
  27141. +
  27142. + /* keep last */
  27143. + __NL80211_STA_INFO_AFTER_LAST,
  27144. +@@ -2482,6 +2577,7 @@ enum nl80211_sta_info {
  27145. + * transmitted MSDUs (not counting the first attempt; u64)
  27146. + * @NL80211_TID_STATS_TX_MSDU_FAILED: number of failed transmitted
  27147. + * MSDUs (u64)
  27148. ++ * @NL80211_TID_STATS_PAD: attribute used for padding for 64-bit alignment
  27149. + * @NUM_NL80211_TID_STATS: number of attributes here
  27150. + * @NL80211_TID_STATS_MAX: highest numbered attribute here
  27151. + */
  27152. +@@ -2491,6 +2587,7 @@ enum nl80211_tid_stats {
  27153. + NL80211_TID_STATS_TX_MSDU,
  27154. + NL80211_TID_STATS_TX_MSDU_RETRIES,
  27155. + NL80211_TID_STATS_TX_MSDU_FAILED,
  27156. ++ NL80211_TID_STATS_PAD,
  27157. +
  27158. + /* keep last */
  27159. + NUM_NL80211_TID_STATS,
  27160. +@@ -2927,6 +3024,7 @@ enum nl80211_user_reg_hint_type {
  27161. + * transmitting data (on channel or globally)
  27162. + * @NL80211_SURVEY_INFO_TIME_SCAN: time the radio spent for scan
  27163. + * (on this channel or globally)
  27164. ++ * @NL80211_SURVEY_INFO_PAD: attribute used for padding for 64-bit alignment
  27165. + * @NL80211_SURVEY_INFO_MAX: highest survey info attribute number
  27166. + * currently defined
  27167. + * @__NL80211_SURVEY_INFO_AFTER_LAST: internal use
  27168. +@@ -2942,6 +3040,7 @@ enum nl80211_survey_info {
  27169. + NL80211_SURVEY_INFO_TIME_RX,
  27170. + NL80211_SURVEY_INFO_TIME_TX,
  27171. + NL80211_SURVEY_INFO_TIME_SCAN,
  27172. ++ NL80211_SURVEY_INFO_PAD,
  27173. +
  27174. + /* keep last */
  27175. + __NL80211_SURVEY_INFO_AFTER_LAST,
  27176. +@@ -3364,6 +3463,10 @@ enum nl80211_bss_scan_width {
  27177. * (not present if no beacon frame has been received yet)
  27178. * @NL80211_BSS_PRESP_DATA: the data in @NL80211_BSS_INFORMATION_ELEMENTS and
  27179. * @NL80211_BSS_TSF is known to be from a probe response (flag attribute)
  27180. + * @NL80211_BSS_LAST_SEEN_BOOTTIME: CLOCK_BOOTTIME timestamp when this entry
  27181. + * was last updated by a received frame. The value is expected to be
  27182. + * accurate to about 10ms. (u64, nanoseconds)
  27183. ++ * @NL80211_BSS_PAD: attribute used for padding for 64-bit alignment
  27184. * @__NL80211_BSS_AFTER_LAST: internal
  27185. * @NL80211_BSS_MAX: highest BSS attribute
  27186. */
  27187. -@@ -3383,6 +3418,7 @@ enum nl80211_bss {
  27188. +@@ -3383,6 +3486,8 @@ enum nl80211_bss {
  27189. NL80211_BSS_CHAN_WIDTH,
  27190. NL80211_BSS_BEACON_TSF,
  27191. NL80211_BSS_PRESP_DATA,
  27192. + NL80211_BSS_LAST_SEEN_BOOTTIME,
  27193. ++ NL80211_BSS_PAD,
  27194. /* keep last */
  27195. __NL80211_BSS_AFTER_LAST,
  27196. -@@ -4589,4 +4625,28 @@ enum nl80211_tdls_peer_capability {
  27197. +@@ -3568,11 +3673,15 @@ enum nl80211_txrate_gi {
  27198. + * @NL80211_BAND_2GHZ: 2.4 GHz ISM band
  27199. + * @NL80211_BAND_5GHZ: around 5 GHz band (4.9 - 5.7 GHz)
  27200. + * @NL80211_BAND_60GHZ: around 60 GHz band (58.32 - 64.80 GHz)
  27201. ++ * @NUM_NL80211_BANDS: number of bands, avoid using this in userspace
  27202. ++ * since newer kernel versions may support more bands
  27203. + */
  27204. + enum nl80211_band {
  27205. + NL80211_BAND_2GHZ,
  27206. + NL80211_BAND_5GHZ,
  27207. + NL80211_BAND_60GHZ,
  27208. ++
  27209. ++ NUM_NL80211_BANDS,
  27210. + };
  27211. +
  27212. + /**
  27213. +@@ -4358,12 +4467,18 @@ enum nl80211_feature_flags {
  27214. + /**
  27215. + * enum nl80211_ext_feature_index - bit index of extended features.
  27216. + * @NL80211_EXT_FEATURE_VHT_IBSS: This driver supports IBSS with VHT datarates.
  27217. ++ * @NL80211_EXT_FEATURE_RRM: This driver supports RRM. When featured, user can
  27218. ++ * can request to use RRM (see %NL80211_ATTR_USE_RRM) with
  27219. ++ * %NL80211_CMD_ASSOCIATE and %NL80211_CMD_CONNECT requests, which will set
  27220. ++ * the ASSOC_REQ_USE_RRM flag in the association request even if
  27221. ++ * NL80211_FEATURE_QUIET is not advertized.
  27222. + *
  27223. + * @NUM_NL80211_EXT_FEATURES: number of extended features.
  27224. + * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
  27225. + */
  27226. + enum nl80211_ext_feature_index {
  27227. + NL80211_EXT_FEATURE_VHT_IBSS,
  27228. ++ NL80211_EXT_FEATURE_RRM,
  27229. +
  27230. + /* add new features before the definition below */
  27231. + NUM_NL80211_EXT_FEATURES,
  27232. +@@ -4589,4 +4704,72 @@ enum nl80211_tdls_peer_capability {
  27233. NL80211_TDLS_PEER_WMM = 1<<2,
  27234. };
  27235. @@ -108,4 +325,48 @@
  27236. + __NL80211_SCHED_SCAN_PLAN_AFTER_LAST - 1
  27237. +};
  27238. +
  27239. ++/**
  27240. ++ * struct nl80211_bss_select_rssi_adjust - RSSI adjustment parameters.
  27241. ++ *
  27242. ++ * @band: band of BSS that must match for RSSI value adjustment.
  27243. ++ * @delta: value used to adjust the RSSI value of matching BSS.
  27244. ++ */
  27245. ++struct nl80211_bss_select_rssi_adjust {
  27246. ++ __u8 band;
  27247. ++ __s8 delta;
  27248. ++} __attribute__((packed));
  27249. ++
  27250. ++/**
  27251. ++ * enum nl80211_bss_select_attr - attributes for bss selection.
  27252. ++ *
  27253. ++ * @__NL80211_BSS_SELECT_ATTR_INVALID: reserved.
  27254. ++ * @NL80211_BSS_SELECT_ATTR_RSSI: Flag indicating only RSSI-based BSS selection
  27255. ++ * is requested.
  27256. ++ * @NL80211_BSS_SELECT_ATTR_BAND_PREF: attribute indicating BSS
  27257. ++ * selection should be done such that the specified band is preferred.
  27258. ++ * When there are multiple BSS-es in the preferred band, the driver
  27259. ++ * shall use RSSI-based BSS selection as a second step. The value of
  27260. ++ * this attribute is according to &enum nl80211_band (u32).
  27261. ++ * @NL80211_BSS_SELECT_ATTR_RSSI_ADJUST: When present the RSSI level for
  27262. ++ * BSS-es in the specified band is to be adjusted before doing
  27263. ++ * RSSI-based BSS selection. The attribute value is a packed structure
  27264. ++ * value as specified by &struct nl80211_bss_select_rssi_adjust.
  27265. ++ * @NL80211_BSS_SELECT_ATTR_MAX: highest bss select attribute number.
  27266. ++ * @__NL80211_BSS_SELECT_ATTR_AFTER_LAST: internal use.
  27267. ++ *
  27268. ++ * One and only one of these attributes are found within %NL80211_ATTR_BSS_SELECT
  27269. ++ * for %NL80211_CMD_CONNECT. It specifies the required BSS selection behaviour
  27270. ++ * which the driver shall use.
  27271. ++ */
  27272. ++enum nl80211_bss_select_attr {
  27273. ++ __NL80211_BSS_SELECT_ATTR_INVALID,
  27274. ++ NL80211_BSS_SELECT_ATTR_RSSI,
  27275. ++ NL80211_BSS_SELECT_ATTR_BAND_PREF,
  27276. ++ NL80211_BSS_SELECT_ATTR_RSSI_ADJUST,
  27277. ++
  27278. ++ /* keep last */
  27279. ++ __NL80211_BSS_SELECT_ATTR_AFTER_LAST,
  27280. ++ NL80211_BSS_SELECT_ATTR_MAX = __NL80211_BSS_SELECT_ATTR_AFTER_LAST - 1
  27281. ++};
  27282. ++
  27283. #endif /* __LINUX_NL80211_H */
  27284. 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
  27285. index 574c490..2cdf360 100644
  27286. --- a/package/network/utils/iw/patches/300-display_interface_TX_power.patch
  27287. +++ b/package/network/utils/iw/patches/300-display_interface_TX_power.patch
  27288. @@ -12,11 +12,9 @@ Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  27289. interface.c | 7 +++++++
  27290. 1 file changed, 7 insertions(+)
  27291. -diff --git a/interface.c b/interface.c
  27292. -index 73ccecd..4f0821d 100644
  27293. --- a/interface.c
  27294. +++ b/interface.c
  27295. -@@ -368,6 +368,13 @@ static int print_iface_handler(struct nl_msg *msg, void *arg)
  27296. +@@ -368,6 +368,13 @@ static int print_iface_handler(struct nl
  27297. printf("\n");
  27298. }
  27299. diff --git a/package/network/utils/iw/patches/301-ibss_add_VHT80.patch b/package/network/utils/iw/patches/301-ibss_add_VHT80.patch
  27300. index 709fbb2..0627bcc 100644
  27301. --- a/package/network/utils/iw/patches/301-ibss_add_VHT80.patch
  27302. +++ b/package/network/utils/iw/patches/301-ibss_add_VHT80.patch
  27303. @@ -14,8 +14,6 @@ Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  27304. ibss.c | 49 +++++++++++++++++++++++++++++++++++++++++--------
  27305. 1 file changed, 41 insertions(+), 8 deletions(-)
  27306. -diff --git a/ibss.c b/ibss.c
  27307. -index 7a0b707..a99a262 100644
  27308. --- a/ibss.c
  27309. +++ b/ibss.c
  27310. @@ -16,6 +16,39 @@
  27311. @@ -58,7 +56,7 @@ index 7a0b707..a99a262 100644
  27312. static int join_ibss(struct nl80211_state *state,
  27313. struct nl_msg *msg,
  27314. int argc, char **argv,
  27315. -@@ -30,12 +63,8 @@ static int join_ibss(struct nl80211_state *state,
  27316. +@@ -30,12 +63,8 @@ static int join_ibss(struct nl80211_stat
  27317. int bintval;
  27318. int i;
  27319. unsigned long freq;
  27320. @@ -73,7 +71,7 @@ index 7a0b707..a99a262 100644
  27321. { .name = "HT20",
  27322. .width = NL80211_CHAN_WIDTH_20,
  27323. .freq1_diff = 0,
  27324. -@@ -60,6 +89,10 @@ static int join_ibss(struct nl80211_state *state,
  27325. +@@ -60,6 +89,10 @@ static int join_ibss(struct nl80211_stat
  27326. .width = NL80211_CHAN_WIDTH_10,
  27327. .freq1_diff = 0,
  27328. .chantype = -1 },
  27329. @@ -84,7 +82,7 @@ index 7a0b707..a99a262 100644
  27330. };
  27331. if (argc < 2)
  27332. -@@ -90,7 +123,7 @@ static int join_ibss(struct nl80211_state *state,
  27333. +@@ -90,7 +123,7 @@ static int join_ibss(struct nl80211_stat
  27334. NLA_PUT_U32(msg, NL80211_ATTR_CHANNEL_WIDTH,
  27335. chanmode_selected->width);
  27336. NLA_PUT_U32(msg, NL80211_ATTR_CENTER_FREQ1,
  27337. 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
  27338. index fc44427..f96d5ea 100644
  27339. --- a/package/network/utils/iw/patches/302-ibss_use_MHz_instead_MHZ.patch
  27340. +++ b/package/network/utils/iw/patches/302-ibss_use_MHz_instead_MHZ.patch
  27341. @@ -7,11 +7,9 @@ Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  27342. ibss.c | 8 ++++----
  27343. 1 file changed, 4 insertions(+), 4 deletions(-)
  27344. -diff --git a/ibss.c b/ibss.c
  27345. -index a99a262..23bda70 100644
  27346. --- a/ibss.c
  27347. +++ b/ibss.c
  27348. -@@ -81,15 +81,15 @@ static int join_ibss(struct nl80211_state *state,
  27349. +@@ -81,15 +81,15 @@ static int join_ibss(struct nl80211_stat
  27350. .width = NL80211_CHAN_WIDTH_20_NOHT,
  27351. .freq1_diff = 0,
  27352. .chantype = NL80211_CHAN_NO_HT },
  27353. diff --git a/package/network/utils/iw/patches/303-mesh_add_VHT80.patch b/package/network/utils/iw/patches/303-mesh_add_VHT80.patch
  27354. index fe8dc21..956b050 100644
  27355. --- a/package/network/utils/iw/patches/303-mesh_add_VHT80.patch
  27356. +++ b/package/network/utils/iw/patches/303-mesh_add_VHT80.patch
  27357. @@ -15,8 +15,6 @@ Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
  27358. util.c | 26 ++++++++++++++++++++++++++
  27359. 4 files changed, 43 insertions(+), 41 deletions(-)
  27360. -diff --git a/ibss.c b/ibss.c
  27361. -index 23bda70..ac06fc5 100644
  27362. --- a/ibss.c
  27363. +++ b/ibss.c
  27364. @@ -16,39 +16,6 @@
  27365. @@ -59,8 +57,6 @@ index 23bda70..ac06fc5 100644
  27366. static int join_ibss(struct nl80211_state *state,
  27367. struct nl_msg *msg,
  27368. int argc, char **argv,
  27369. -diff --git a/iw.h b/iw.h
  27370. -index cef9da8..8e1a37a 100644
  27371. --- a/iw.h
  27372. +++ b/iw.h
  27373. @@ -59,6 +59,13 @@ struct cmd {
  27374. @@ -77,7 +73,7 @@ index cef9da8..8e1a37a 100644
  27375. #define ARRAY_SIZE(ar) (sizeof(ar)/sizeof(ar[0]))
  27376. #define DIV_ROUND_UP(x, y) (((x) + (y - 1)) / (y))
  27377. -@@ -174,6 +181,8 @@ void print_ies(unsigned char *ie, int ielen, bool unknown,
  27378. +@@ -174,6 +181,8 @@ void print_ies(unsigned char *ie, int ie
  27379. void parse_bitrate(struct nlattr *bitrate_attr, char *buf, int buflen);
  27380. void iw_hexdump(const char *prefix, const __u8 *data, size_t len);
  27381. @@ -86,11 +82,9 @@ index cef9da8..8e1a37a 100644
  27382. #define SCHED_SCAN_OPTIONS "interval <in_msecs> [delay <in_secs>] " \
  27383. "[freqs <freq>+] [matches [ssid <ssid>]+]] [active [ssid <ssid>]+|passive] [randomise[=<addr>/<mask>]]"
  27384. int parse_sched_scan(struct nl_msg *msg, int *argc, char ***argv);
  27385. -diff --git a/mesh.c b/mesh.c
  27386. -index 0090530..930d58f 100644
  27387. --- a/mesh.c
  27388. +++ b/mesh.c
  27389. -@@ -439,12 +439,8 @@ static int join_mesh(struct nl80211_state *state,
  27390. +@@ -439,12 +439,8 @@ static int join_mesh(struct nl80211_stat
  27391. int bintval, dtim_period, i, n_rates = 0;
  27392. char *end, *value = NULL, *sptr = NULL;
  27393. unsigned long freq = 0;
  27394. @@ -105,7 +99,7 @@ index 0090530..930d58f 100644
  27395. { .name = "HT20",
  27396. .width = NL80211_CHAN_WIDTH_20,
  27397. .freq1_diff = 0,
  27398. -@@ -461,6 +457,10 @@ static int join_mesh(struct nl80211_state *state,
  27399. +@@ -461,6 +457,10 @@ static int join_mesh(struct nl80211_stat
  27400. .width = NL80211_CHAN_WIDTH_20_NOHT,
  27401. .freq1_diff = 0,
  27402. .chantype = NL80211_CHAN_NO_HT },
  27403. @@ -116,7 +110,7 @@ index 0090530..930d58f 100644
  27404. };
  27405. if (argc < 1)
  27406. -@@ -497,7 +497,7 @@ static int join_mesh(struct nl80211_state *state,
  27407. +@@ -497,7 +497,7 @@ static int join_mesh(struct nl80211_stat
  27408. NLA_PUT_U32(msg, NL80211_ATTR_CHANNEL_WIDTH,
  27409. chanmode_selected->width);
  27410. NLA_PUT_U32(msg, NL80211_ATTR_CENTER_FREQ1,
  27411. @@ -125,7 +119,7 @@ index 0090530..930d58f 100644
  27412. if (chanmode_selected->chantype != -1)
  27413. NLA_PUT_U32(msg,
  27414. NL80211_ATTR_WIPHY_CHANNEL_TYPE,
  27415. -@@ -599,7 +599,7 @@ static int join_mesh(struct nl80211_state *state,
  27416. +@@ -599,7 +599,7 @@ static int join_mesh(struct nl80211_stat
  27417. nla_put_failure:
  27418. return -ENOBUFS;
  27419. }
  27420. @@ -134,11 +128,9 @@ index 0090530..930d58f 100644
  27421. " [basic-rates <rate in Mbps,rate2,...>]], [mcast-rate <rate in Mbps>]"
  27422. " [beacon-interval <time in TUs>] [dtim-period <value>]"
  27423. " [vendor_sync on|off] [<param>=<value>]*",
  27424. -diff --git a/util.c b/util.c
  27425. -index 4efc4c8..d75ffe0 100644
  27426. --- a/util.c
  27427. +++ b/util.c
  27428. -@@ -728,3 +728,29 @@ void iw_hexdump(const char *prefix, const __u8 *buf, size_t size)
  27429. +@@ -728,3 +728,29 @@ void iw_hexdump(const char *prefix, cons
  27430. }
  27431. printf("\n\n");
  27432. }
  27433. 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
  27434. index d382453..20bb06e 100644
  27435. --- a/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.c
  27436. +++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.c
  27437. @@ -39,6 +39,18 @@ __init void ap9x_pci_setup_wmac_led_pin(unsigned wmac, int pin)
  27438. }
  27439. }
  27440. +__init void ap9x_pci_setup_wmac_led_name(unsigned wmac, const char *led_name)
  27441. +{
  27442. + switch (wmac) {
  27443. + case 0:
  27444. + ap9x_wmac0_data.led_name = led_name;
  27445. + break;
  27446. + case 1:
  27447. + ap9x_wmac1_data.led_name = led_name;
  27448. + break;
  27449. + }
  27450. +}
  27451. +
  27452. __init struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac)
  27453. {
  27454. switch (wmac) {
  27455. @@ -81,6 +93,20 @@ __init void ap9x_pci_setup_wmac_leds(unsigned wmac, struct gpio_led *leds,
  27456. }
  27457. }
  27458. +__init void ap9x_pci_setup_wmac_btns(unsigned wmac,
  27459. + struct gpio_keys_button *btns,
  27460. + unsigned num_btns, unsigned poll_interval)
  27461. +{
  27462. + struct ath9k_platform_data *ap9x_wmac_data;
  27463. +
  27464. + if (!(ap9x_wmac_data = ap9x_pci_get_wmac_data(wmac)))
  27465. + return;
  27466. +
  27467. + ap9x_wmac_data->btns = btns;
  27468. + ap9x_wmac_data->num_btns = num_btns;
  27469. + ap9x_wmac_data->btn_poll_interval = poll_interval;
  27470. +}
  27471. +
  27472. static int ap91_pci_plat_dev_init(struct pci_dev *dev)
  27473. {
  27474. switch (PCI_SLOT(dev->devfn)) {
  27475. 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
  27476. index ad288cb..d7c0185 100644
  27477. --- a/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.h
  27478. +++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.h
  27479. @@ -12,6 +12,7 @@
  27480. #define _ATH79_DEV_AP9X_PCI_H
  27481. struct gpio_led;
  27482. +struct gpio_keys_button;
  27483. struct ath9k_platform_data;
  27484. #if defined(CONFIG_ATH79_DEV_AP9X_PCI)
  27485. @@ -19,6 +20,9 @@ void ap9x_pci_setup_wmac_led_pin(unsigned wmac, int pin);
  27486. void ap9x_pci_setup_wmac_gpio(unsigned wmac, u32 mask, u32 val);
  27487. void ap9x_pci_setup_wmac_leds(unsigned wmac, struct gpio_led *leds,
  27488. int num_leds);
  27489. +void ap9x_pci_setup_wmac_led_name(unsigned wmac, const char *led_name);
  27490. +void ap9x_pci_setup_wmac_btns(unsigned wmac, struct gpio_keys_button *btns,
  27491. + unsigned num_btns, unsigned poll_interval);
  27492. struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac);
  27493. void ap91_pci_init(u8 *cal_data, u8 *mac_addr);
  27494. @@ -33,6 +37,12 @@ static inline void ap9x_pci_setup_wmac_gpio(unsigned wmac,
  27495. static inline void ap9x_pci_setup_wmac_leds(unsigned wmac,
  27496. struct gpio_led *leds,
  27497. int num_leds) {}
  27498. +static inline void ap9x_pci_setup_wmac_led_name(unsigned wmac,
  27499. + const char *led_name) {}
  27500. +static inline void ap9x_pci_setup_wmac_btns(unsigned wmac,
  27501. + struct gpio_keys_button *btns,
  27502. + unsigned num_btns,
  27503. + unsigned poll_interval) {}
  27504. static inline struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac)
  27505. {
  27506. return NULL;
  27507. diff --git a/target/linux/generic/files/include/linux/ath9k_platform.h b/target/linux/generic/files/include/linux/ath9k_platform.h
  27508. index 30ce216..2c19f3b 100644
  27509. --- a/target/linux/generic/files/include/linux/ath9k_platform.h
  27510. +++ b/target/linux/generic/files/include/linux/ath9k_platform.h
  27511. @@ -31,6 +31,10 @@ struct ath9k_platform_data {
  27512. u32 gpio_mask;
  27513. u32 gpio_val;
  27514. + u32 bt_active_pin;
  27515. + u32 bt_priority_pin;
  27516. + u32 wlan_active_pin;
  27517. +
  27518. bool endian_check;
  27519. bool is_clk_25mhz;
  27520. bool tx_gain_buffalo;
  27521. @@ -45,6 +49,11 @@ struct ath9k_platform_data {
  27522. int num_leds;
  27523. const struct gpio_led *leds;
  27524. + const char *led_name;
  27525. +
  27526. + unsigned num_btns;
  27527. + const struct gpio_keys_button *btns;
  27528. + unsigned btn_poll_interval;
  27529. };
  27530. #endif /* _LINUX_ATH9K_PLATFORM_H */