0007-mac80211-update-to-LEDE-b47f438d98cd4b731d7f4431448dde973eae4739.patch 446 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554
  1. From: Matthias Schiffer <mschiffer@universe-factory.net>
  2. Date: Tue, 7 Jun 2016 14:06:23 +0200
  3. Subject: mac80211: update to LEDE b47f438d98cd4b731d7f4431448dde973eae4739
  4. diff --git a/package/firmware/ath10k-firmware/Makefile b/package/firmware/ath10k-firmware/Makefile
  5. index b03d644..e2cf92e 100644
  6. --- a/package/firmware/ath10k-firmware/Makefile
  7. +++ b/package/firmware/ath10k-firmware/Makefile
  8. @@ -8,7 +8,7 @@
  9. include $(TOPDIR)/rules.mk
  10. PKG_NAME:=ath10k-firmware
  11. -PKG_SOURCE_VERSION:=77f72b5f7dd940386d9e619a17904987759b7186
  12. +PKG_SOURCE_VERSION:=b00eb8d30fbebb6a5047ccacefa8c37e072fca9c
  13. PKG_VERSION:=2014-11-13-$(PKG_SOURCE_VERSION)
  14. PKG_RELEASE:=1
  15. @@ -17,7 +17,7 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  16. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  17. PKG_SOURCE_URL:=https://github.com/kvalo/ath10k-firmware.git
  18. -PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  19. +PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  20. include $(INCLUDE_DIR)/package.mk
  21. @@ -28,14 +28,19 @@ define Package/ath10k-firmware-default
  22. CATEGORY:=Kernel modules
  23. SUBMENU:=$(WMENU)
  24. URL:=$(PKG_SOURCE_URL)
  25. + DEPENDS:=
  26. endef
  27. define Package/ath10k-firmware-qca988x
  28. $(Package/ath10k-firmware-default)
  29. + DEFAULT:=PACKAGE_kmod-ath10k
  30. TITLE:=ath10k firmware for QCA988x devices
  31. endef
  32. QCA988X_FIRMWARE_FILE:=firmware-5.bin_10.2.4.97-1
  33. +QCA988X_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-16.1.bin-lede
  34. +QCA99X0_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-7.bin-lede.001
  35. +QCA9984_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-7.bin-lede.001
  36. define Download/ath10k-firmware-qca988x
  37. URL:=https://www.codeaurora.org/cgit/quic/qsdk/oss/firmware/ath10k-firmware/plain/10.2.4/
  38. @@ -44,11 +49,83 @@ define Download/ath10k-firmware-qca988x
  39. endef
  40. $(eval $(call Download,ath10k-firmware-qca988x))
  41. +define Download/ath10k-firmware-qca988x-ct
  42. + URL:=https://www.candelatech.com/downloads/
  43. + FILE:=$(QCA988X_FIRMWARE_FILE_CT)
  44. + MD5SUM:=d7e081e9782936ed544b78994c9133fb
  45. +endef
  46. +$(eval $(call Download,ath10k-firmware-qca988x-ct))
  47. +
  48. +define Download/ath10k-firmware-qca99x0-ct
  49. + URL:=https://www.candelatech.com/downloads/ath10k-10-4/
  50. + FILE:=$(QCA99X0_FIRMWARE_FILE_CT)
  51. + MD5SUM:=eb710949ff79142954aadae24616169c
  52. +endef
  53. +$(eval $(call Download,ath10k-firmware-qca99x0-ct))
  54. +
  55. +define Download/ath10k-firmware-qca9984-ct
  56. + URL:=https://www.candelatech.com/downloads/ath10k-9984-10-4/
  57. + FILE:=$(QCA9984_FIRMWARE_FILE_CT)
  58. + MD5SUM:=747cc1394f15aef97b5ea15e4c208e58
  59. +endef
  60. +$(eval $(call Download,ath10k-firmware-qca9984-ct))
  61. +
  62. define Package/ath10k-firmware-qca99x0
  63. $(Package/ath10k-firmware-default)
  64. TITLE:=ath10k firmware for QCA99x0 devices
  65. endef
  66. +define Package/ath10k-firmware-qca988x-ct
  67. +$(Package/ath10k-firmware-default)
  68. + TITLE:=ath10k CT 10.1 firmware for QCA988x devices
  69. +endef
  70. +
  71. +define Package/ath10k-firmware-qca988x-ct/description
  72. +Alternative ath10k firmware for QCA988X from Candela Technologies.
  73. +Enables IBSS and other features. See:
  74. +http://www.candelatech.com/ath10k-10.1.php
  75. +This firmware will NOT be used unless the standard ath10k-firmware-qca988x
  76. +is un-selected since the driver will try to load firmware-5.bin before
  77. +firmware-2.bin
  78. +endef
  79. +
  80. +define Package/ath10k-firmware-qca99x0-ct/description
  81. +Alternative ath10k firmware for QCA99x0 from Candela Technologies.
  82. +Enables IBSS and other features. See:
  83. +http://www.candelatech.com/ath10k-10.4.php
  84. +This firmware conflicts with the standard 99x0 firmware, so select only
  85. +one.
  86. +endef
  87. +
  88. +define Package/ath10k-firmware-qca9984-ct/description
  89. +Alternative ath10k firmware for QCA9984 from Candela Technologies.
  90. +Enables IBSS and other features. See:
  91. +http://www.candelatech.com/ath10k-10.4-9984.php
  92. +This firmware conflicts with the standard 9984 firmware, so select only
  93. +one.
  94. +endef
  95. +
  96. +define Package/ath10k-firmware-qca99x0/description
  97. +Standard ath10k firmware for QCA99x0 from QCA
  98. +This firmware conflicts with the CT 99x0 firmware, so select only
  99. +one.
  100. +endef
  101. +
  102. +define Package/ath10k-firmware-qca99x0-ct
  103. +$(Package/ath10k-firmware-default)
  104. + TITLE:=ath10k CT 10.4.3 firmware for QCA99x0 devices
  105. +endef
  106. +
  107. +define Package/ath10k-firmware-qca9984-ct
  108. +$(Package/ath10k-firmware-default)
  109. + TITLE:=ath10k CT 10.4.3 firmware for QCA9984 devices
  110. +endef
  111. +
  112. +define Package/ath10k-firmware-qca9984
  113. +$(Package/ath10k-firmware-default)
  114. + TITLE:=ath10k firmware for QCA9984 devices
  115. +endef
  116. +
  117. define Package/ath10k-firmware-qca6174
  118. $(Package/ath10k-firmware-default)
  119. TITLE:=ath10k firmware for QCA6174 devices
  120. @@ -58,8 +135,8 @@ QCA99X0_BOARD_REV:=ddcec9efd245da9365c474f513a855a55f3ac7fe
  121. QCA99X0_BOARD_FILE:=board-2.bin.$(QCA99X0_BOARD_REV)
  122. define Download/qca99x0-board
  123. - URL:=https://www.codeaurora.org/cgit/quic/qsdk/oss/firmware/ath10k-firmware/plain/ath10k/QCA99X0/hw2.0
  124. - URL_FILE:=board-2.bin?id=ddcec9efd245da9365c474f513a855a55f3ac7fe
  125. + URL:=https://source.codeaurora.org/quic/qsdk/oss/firmware/ath10k-firmware/plain/ath10k/QCA99X0/hw2.0
  126. + URL_FILE:=board-2.bin?id=$(QCA99X0_BOARD_REV)
  127. FILE:=$(QCA99X0_BOARD_FILE)
  128. MD5SUM:=a2b3c653c2363a5641200051d6333d0a
  129. endef
  130. @@ -79,6 +156,16 @@ define Package/ath10k-firmware-qca988x/install
  131. $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-5.bin
  132. endef
  133. +define Package/ath10k-firmware-qca988x-ct/install
  134. + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA988X/hw2.0
  135. + $(INSTALL_DATA) \
  136. + $(PKG_BUILD_DIR)/QCA988X/board.bin \
  137. + $(1)/lib/firmware/ath10k/QCA988X/hw2.0/
  138. + $(INSTALL_DATA) \
  139. + $(DL_DIR)/$(QCA988X_FIRMWARE_FILE_CT) \
  140. + $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-2.bin
  141. +endef
  142. +
  143. define Package/ath10k-firmware-qca6174/install
  144. $(INSTALL_DIR) $(1)/lib/firmware/ath10k
  145. $(CP) $(PKG_BUILD_DIR)/QCA6174 $(1)/lib/firmware/ath10k/
  146. @@ -97,6 +184,50 @@ define Package/ath10k-firmware-qca99x0/install
  147. $(1)/lib/firmware/ath10k/QCA99X0/hw2.0/firmware-5.bin
  148. endef
  149. +define Package/ath10k-firmware-qca99x0-ct/install
  150. + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA99X0/hw2.0
  151. + $(INSTALL_DATA) \
  152. + $(DL_DIR)/$(QCA99X0_BOARD_FILE) \
  153. + $(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board-2.bin
  154. + $(INSTALL_DATA) \
  155. + $(PKG_BUILD_DIR)/QCA99X0/hw2.0/boardData_AR900B_CUS239_5G_v2_001.bin \
  156. + $(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board.bin
  157. + $(INSTALL_DATA) \
  158. + $(DL_DIR)/$(QCA99X0_FIRMWARE_FILE_CT) \
  159. + $(1)/lib/firmware/ath10k/QCA99X0/hw2.0/firmware-5.bin
  160. +endef
  161. +
  162. +define Package/ath10k-firmware-qca9984/install
  163. + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9984/hw1.0
  164. + ln -s \
  165. + ../../cal-pci-0000:01:00.0.bin \
  166. + $(1)/lib/firmware/ath10k/QCA9984/hw1.0/board.bin
  167. + $(INSTALL_DATA) \
  168. + $(PKG_BUILD_DIR)/QCA9984/hw1.0/board-2.bin \
  169. + $(1)/lib/firmware/ath10k/QCA9984/hw1.0/board-2.bin
  170. + $(INSTALL_DATA) \
  171. + $(PKG_BUILD_DIR)/QCA9984/hw1.0/firmware-5.bin_10.4-3.2-00072 \
  172. + $(1)/lib/firmware/ath10k/QCA9984/hw1.0/firmware-5.bin
  173. +endef
  174. +
  175. +define Package/ath10k-firmware-qca9984-ct/install
  176. + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9984/hw1.0
  177. + ln -s \
  178. + ../../cal-pci-0000:01:00.0.bin \
  179. + $(1)/lib/firmware/ath10k/QCA9984/hw1.0/board.bin
  180. + $(INSTALL_DATA) \
  181. + $(PKG_BUILD_DIR)/QCA9984/hw1.0/board-2.bin \
  182. + $(1)/lib/firmware/ath10k/QCA9984/hw1.0/board-2.bin
  183. + $(INSTALL_DATA) \
  184. + $(DL_DIR)/$(QCA9984_FIRMWARE_FILE_CT) \
  185. + $(1)/lib/firmware/ath10k/QCA9984/hw1.0/firmware-5.bin
  186. +endef
  187. +
  188. $(eval $(call BuildPackage,ath10k-firmware-qca988x))
  189. $(eval $(call BuildPackage,ath10k-firmware-qca99x0))
  190. $(eval $(call BuildPackage,ath10k-firmware-qca6174))
  191. +$(eval $(call BuildPackage,ath10k-firmware-qca9984))
  192. +
  193. +$(eval $(call BuildPackage,ath10k-firmware-qca988x-ct))
  194. +$(eval $(call BuildPackage,ath10k-firmware-qca99x0-ct))
  195. +$(eval $(call BuildPackage,ath10k-firmware-qca9984-ct))
  196. diff --git a/package/firmware/linux-firmware/Makefile b/package/firmware/linux-firmware/Makefile
  197. index 2fcd93b..7a2e977 100644
  198. --- a/package/firmware/linux-firmware/Makefile
  199. +++ b/package/firmware/linux-firmware/Makefile
  200. @@ -16,10 +16,10 @@ PKG_SOURCE_PROTO:=git
  201. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  202. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION)
  203. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
  204. -PKG_SOURCE_URL:=git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
  205. -PKG_MIRROR_MD5SUM:=ca4d289ad9380471cae376fc7dd3660a
  206. +PKG_SOURCE_URL:=https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
  207. +PKG_MIRROR_MD5SUM:=8d44332359de89b1936b4ff608a72614
  208. -PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  209. +PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  210. SCAN_DEPS = *.mk
  211. diff --git a/package/firmware/linux-firmware/realtek.mk b/package/firmware/linux-firmware/realtek.mk
  212. index 0f8b1ce..4229ca0 100644
  213. --- a/package/firmware/linux-firmware/realtek.mk
  214. +++ b/package/firmware/linux-firmware/realtek.mk
  215. @@ -43,8 +43,15 @@ endef
  216. $(eval $(call BuildPackage,rtl8192de-firmware))
  217. Package/rtl8192se-firmware = $(call Package/firmware-default,RealTek RTL8192SE firmware)
  218. -define KernelPackage/rtl8192se/install
  219. +define Package/rtl8192se-firmware/install
  220. $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  221. $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8192sefw.bin $(1)/lib/firmware/rtlwifi
  222. endef
  223. $(eval $(call BuildPackage,rtl8192se-firmware))
  224. +
  225. +Package/rtl8192su-firmware = $(call Package/firmware-default,RealTek RTL8192SU firmware)
  226. +define Package/rtl8192su-firmware/install
  227. + $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  228. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8712u.bin $(1)/lib/firmware/rtlwifi
  229. +endef
  230. +$(eval $(call BuildPackage,rtl8192su-firmware))
  231. diff --git a/package/kernel/acx-mac80211/Makefile b/package/kernel/acx-mac80211/Makefile
  232. index 1820e7a..8fce374 100644
  233. --- a/package/kernel/acx-mac80211/Makefile
  234. +++ b/package/kernel/acx-mac80211/Makefile
  235. @@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk
  236. include $(INCLUDE_DIR)/kernel.mk
  237. PKG_NAME:=acx-mac80211
  238. -PKG_REV:=v20130127
  239. -PKG_VERSION:=20130909
  240. +PKG_REV:=b6fc31491020cb01d2cd1acc170cfa03ced7e726
  241. +PKG_VERSION:=20140216
  242. PKG_RELEASE:=1
  243. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
  244. -PKG_SOURCE_URL:=git://acx100.git.sourceforge.net/gitroot/acx100/acx-mac80211
  245. +PKG_SOURCE_URL:=http://git.code.sf.net/p/acx100/acx-mac80211
  246. PKG_SOURCE_PROTO:=git
  247. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  248. PKG_SOURCE_VERSION:=$(PKG_REV)
  249. @@ -190,7 +190,7 @@ define Build/Compile
  250. CROSS_COMPILE="$(TARGET_CROSS)" \
  251. SUBDIRS="$(PKG_BUILD_DIR)" \
  252. $(PKG_EXTRA_KCONFIG) \
  253. - EXTRA_CFLAGS="$(PKG_EXTRA_CFLAGS) -DCONFIG_ACX_MAC80211_VERSION=\"KERNEL_VERSION(3,14,0)\"" \
  254. + EXTRA_CFLAGS="$(PKG_EXTRA_CFLAGS) -DCONFIG_ACX_MAC80211_VERSION=\"KERNEL_VERSION(4,2,0)\"" \
  255. LINUXINCLUDE="-I$(STAGING_DIR)/usr/include/mac80211-backport/uapi -I$(STAGING_DIR)/usr/include/mac80211-backport \
  256. -I$(STAGING_DIR)/usr/include/mac80211/uapi -I$(STAGING_DIR)/usr/include/mac80211 \
  257. -I$(LINUX_DIR)/include -I$(LINUX_DIR)/include/$(LINUX_UAPI_DIR) \
  258. diff --git a/package/kernel/acx-mac80211/patches/001-pci-mem-Fix-3.8-build.patch b/package/kernel/acx-mac80211/patches/001-pci-mem-Fix-3.8-build.patch
  259. deleted file mode 100644
  260. index fa4a6be..0000000
  261. --- a/package/kernel/acx-mac80211/patches/001-pci-mem-Fix-3.8-build.patch
  262. +++ /dev/null
  263. @@ -1,129 +0,0 @@
  264. -From 8a0f5890019bf43f4bc95ef0754b062ddfcfa9cd Mon Sep 17 00:00:00 2001
  265. -From: Oliver Winker <oliver@oli1170.net>
  266. -Date: Sun, 10 Mar 2013 21:04:23 +0100
  267. -Subject: [PATCH 1/3] pci, mem: Fix 3.8 build
  268. -
  269. -__devexit and __devinit not used anymore in 3.8
  270. -
  271. -Signed-off-by: Reinhard Karcher <reinhard.karcher@gmx.net>
  272. -Signed-off-by: Oliver Winker <oliver@oli1170.net>
  273. ----
  274. - mem.c | 13 ++++++++++++-
  275. - pci.c | 26 +++++++++++++++++++++++++-
  276. - 2 files changed, 37 insertions(+), 2 deletions(-)
  277. -
  278. ---- a/mem.c
  279. -+++ b/mem.c
  280. -@@ -2216,7 +2216,11 @@ int acx100mem_ioctl_set_phy_amp_bias(str
  281. - * ==================================================
  282. - */
  283. -
  284. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  285. - static int __devinit acxmem_probe(struct platform_device *pdev)
  286. -+#else
  287. -+static int acxmem_probe(struct platform_device *pdev)
  288. -+#endif
  289. - {
  290. - acx_device_t *adev = NULL;
  291. - const char *chip_name;
  292. -@@ -2392,7 +2396,11 @@ static int __devinit acxmem_probe(struct
  293. - * pdev - ptr to PCI device structure containing info about pci
  294. - * configuration
  295. - */
  296. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  297. - static int __devexit acxmem_remove(struct platform_device *pdev)
  298. -+#else
  299. -+static int acxmem_remove(struct platform_device *pdev)
  300. -+#endif
  301. - {
  302. - struct ieee80211_hw *hw = (struct ieee80211_hw *)
  303. - platform_get_drvdata(pdev);
  304. -@@ -2594,8 +2602,11 @@ static struct platform_driver acxmem_dri
  305. - .name = "acx-mem",
  306. - },
  307. - .probe = acxmem_probe,
  308. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  309. - .remove = __devexit_p(acxmem_remove),
  310. --
  311. -+#else
  312. -+ .remove = acxmem_remove,
  313. -+#endif
  314. - #ifdef CONFIG_PM
  315. - .suspend = acxmem_e_suspend,
  316. - .resume = acxmem_e_resume
  317. ---- a/pci.c
  318. -+++ b/pci.c
  319. -@@ -1039,7 +1039,11 @@ int acx100pci_ioctl_set_phy_amp_bias(str
  320. - * id - ptr to the device id entry that matched this device
  321. - */
  322. - #ifdef CONFIG_PCI
  323. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  324. - static int __devinit acxpci_probe(struct pci_dev *pdev,
  325. -+#else
  326. -+static int acxpci_probe(struct pci_dev *pdev,
  327. -+#endif
  328. - const struct pci_device_id *id)
  329. - {
  330. - unsigned long mem_region1 = 0;
  331. -@@ -1292,7 +1296,11 @@ static int __devinit acxpci_probe(struct
  332. - *
  333. - * pdev - ptr to PCI device structure containing info about pci configuration
  334. - */
  335. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  336. - static void __devexit acxpci_remove(struct pci_dev *pdev)
  337. -+#else
  338. -+static void acxpci_remove(struct pci_dev *pdev)
  339. -+#endif
  340. - {
  341. - struct ieee80211_hw *hw
  342. - = (struct ieee80211_hw *) pci_get_drvdata(pdev);
  343. -@@ -1505,7 +1513,11 @@ static struct pci_driver acxpci_driver =
  344. - .name = "acx_pci",
  345. - .id_table = acxpci_id_tbl,
  346. - .probe = acxpci_probe,
  347. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  348. - .remove = __devexit_p(acxpci_remove),
  349. -+#else
  350. -+ .remove = acxpci_remove,
  351. -+#endif
  352. - #ifdef CONFIG_PM
  353. - .suspend = acxpci_e_suspend,
  354. - .resume = acxpci_e_resume
  355. -@@ -1603,8 +1615,12 @@ static struct vlynq_device_id acx_vlynq_
  356. - };
  357. -
  358. -
  359. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  360. - static __devinit int vlynq_probe(struct vlynq_device *vdev,
  361. -- struct vlynq_device_id *id)
  362. -+#else
  363. -+static int vlynq_probe(struct vlynq_device *vdev,
  364. -+#endif
  365. -+ struct vlynq_device_id *id)
  366. - {
  367. - int result = -EIO, i;
  368. - u32 addr;
  369. -@@ -1785,7 +1801,11 @@ static __devinit int vlynq_probe(struct
  370. - return result;
  371. - }
  372. -
  373. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  374. - static __devexit void vlynq_remove(struct vlynq_device *vdev)
  375. -+#else
  376. -+static void vlynq_remove(struct vlynq_device *vdev)
  377. -+#endif
  378. - {
  379. - struct ieee80211_hw *hw = vlynq_get_drvdata(vdev);
  380. - acx_device_t *adev = hw2adev(hw);
  381. -@@ -1851,7 +1871,11 @@ static struct vlynq_driver acxvlynq_driv
  382. - .name = "acx_vlynq",
  383. - .id_table = acx_vlynq_id,
  384. - .probe = vlynq_probe,
  385. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  386. - .remove = __devexit_p(vlynq_remove),
  387. -+#else
  388. -+ .remove = vlynq_remove,
  389. -+#endif
  390. - };
  391. - #endif /* CONFIG_VLYNQ */
  392. -
  393. diff --git a/package/kernel/acx-mac80211/patches/003-Fix-3.10-build.patch b/package/kernel/acx-mac80211/patches/003-Fix-3.10-build.patch
  394. deleted file mode 100644
  395. index c737844..0000000
  396. --- a/package/kernel/acx-mac80211/patches/003-Fix-3.10-build.patch
  397. +++ /dev/null
  398. @@ -1,31 +0,0 @@
  399. -From 1daf4bfdb072b08f3b4e412bbfa9645f88dc0a01 Mon Sep 17 00:00:00 2001
  400. -From: Oliver Winker <oliver@oli1170.net>
  401. -Date: Tue, 3 Sep 2013 20:36:36 +0200
  402. -Subject: [PATCH 3/3] Fix 3.10 build
  403. -
  404. -Signed-off-by: Reinhard Karcher <reinhard.karcher@gmx.net>
  405. -Signed-off-by: Oliver Winker <oliver@oli1170.net>
  406. ----
  407. - main.c | 7 +++++++
  408. - 1 file changed, 7 insertions(+)
  409. -
  410. ---- a/main.c
  411. -+++ b/main.c
  412. -@@ -682,10 +682,17 @@ int acx_op_config(struct ieee80211_hw *h
  413. -
  414. - if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
  415. - logf1(L_DEBUG, "IEEE80211_CONF_CHANGE_CHANNEL,"
  416. -+#if CONFIG_ACX_MAC80211_VERSION >= KERNEL_VERSION(3, 10, 0)
  417. -+ "channel->hw_value=%i\n", conf->chandef.chan->hw_value);
  418. -+
  419. -+ acx_set_channel(adev, conf->chandef.chan->hw_value,
  420. -+ conf->chandef.chan->center_freq);
  421. -+#else
  422. - "channel->hw_value=%i\n", conf->channel->hw_value);
  423. -
  424. - acx_set_channel(adev, conf->channel->hw_value,
  425. - conf->channel->center_freq);
  426. -+#endif
  427. -
  428. - changed_not_done &= ~IEEE80211_CONF_CHANGE_CHANNEL;
  429. - }
  430. diff --git a/package/kernel/acx-mac80211/patches/004-Fix-3.14-build.patch b/package/kernel/acx-mac80211/patches/004-Fix-3.14-build.patch
  431. deleted file mode 100644
  432. index 847b573..0000000
  433. --- a/package/kernel/acx-mac80211/patches/004-Fix-3.14-build.patch
  434. +++ /dev/null
  435. @@ -1,22 +0,0 @@
  436. -From d17fcac710e629463591f6bd09d76b66ec591583 Mon Sep 17 00:00:00 2001
  437. -From: Hauke Mehrtens <hauke@hauke-m.de>
  438. -Date: Wed, 5 Feb 2014 20:57:07 +0100
  439. -Subject: [PATCH] Fix 3.14 build
  440. -
  441. -Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
  442. ----
  443. - main.c | 2 ++
  444. - 1 file changed, 2 insertions(+)
  445. -
  446. ---- a/main.c
  447. -+++ b/main.c
  448. -@@ -500,7 +500,9 @@ int acx_init_ieee80211(acx_device_t *ade
  449. - hw->flags &= ~IEEE80211_HW_RX_INCLUDES_FCS;
  450. - hw->queues = 1;
  451. - hw->wiphy->max_scan_ssids = 1;
  452. -+#if CONFIG_ACX_MAC80211_VERSION < KERNEL_VERSION(3, 14, 0)
  453. - hw->channel_change_time = 10000;
  454. -+#endif
  455. -
  456. - /* OW TODO Check if RTS/CTS threshold can be included here */
  457. -
  458. diff --git a/package/kernel/acx-mac80211/patches/300-api_sync.patch b/package/kernel/acx-mac80211/patches/300-api_sync.patch
  459. new file mode 100644
  460. index 0000000..94d6135
  461. --- /dev/null
  462. +++ b/package/kernel/acx-mac80211/patches/300-api_sync.patch
  463. @@ -0,0 +1,83 @@
  464. +--- a/main.c
  465. ++++ b/main.c
  466. +@@ -497,7 +497,7 @@ int acx_free_mechanics(acx_device_t *ade
  467. +
  468. + int acx_init_ieee80211(acx_device_t *adev, struct ieee80211_hw *hw)
  469. + {
  470. +- hw->flags &= ~IEEE80211_HW_RX_INCLUDES_FCS;
  471. ++ __clear_bit(IEEE80211_HW_RX_INCLUDES_FCS, hw->flags);
  472. + hw->queues = 1;
  473. + hw->wiphy->max_scan_ssids = 1;
  474. +
  475. +@@ -525,14 +525,14 @@ int acx_init_ieee80211(acx_device_t *ade
  476. + /* We base signal quality on winlevel approach of previous driver
  477. + * TODO OW 20100615 This should into a common init code
  478. + */
  479. +- hw->flags |= IEEE80211_HW_SIGNAL_UNSPEC;
  480. ++ __set_bit(IEEE80211_HW_SIGNAL_UNSPEC, hw->flags);
  481. + hw->max_signal = 100;
  482. +
  483. + if (IS_ACX100(adev)) {
  484. +- adev->hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
  485. ++ adev->hw->wiphy->bands[NL80211_BAND_2GHZ] =
  486. + &acx100_band_2GHz;
  487. + } else if (IS_ACX111(adev))
  488. +- adev->hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
  489. ++ adev->hw->wiphy->bands[NL80211_BAND_2GHZ] =
  490. + &acx111_band_2GHz;
  491. + else {
  492. + log(L_ANY, "Error: Unknown device");
  493. +@@ -945,8 +945,8 @@ void acx_op_configure_filter(struct ieee
  494. + changed_flags, *total_flags);
  495. +
  496. + /* OWI TODO: Set also FIF_PROBE_REQ ? */
  497. +- *total_flags &= (FIF_PROMISC_IN_BSS | FIF_ALLMULTI | FIF_FCSFAIL
  498. +- | FIF_CONTROL | FIF_OTHER_BSS);
  499. ++ *total_flags &= (FIF_ALLMULTI | FIF_FCSFAIL | FIF_CONTROL
  500. ++ | FIF_OTHER_BSS);
  501. +
  502. + logf1(L_DEBUG, "2: *total_flags=0x%08x\n", *total_flags);
  503. +
  504. +@@ -1045,9 +1045,10 @@ void acx_op_tx(struct ieee80211_hw *hw,
  505. + }
  506. +
  507. + int acx_op_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  508. +- struct cfg80211_scan_request *req)
  509. ++ struct ieee80211_scan_request *hw_req)
  510. + {
  511. + acx_device_t *adev = hw2adev(hw);
  512. ++ struct cfg80211_scan_request *req = &hw_req->req;
  513. + struct sk_buff *skb;
  514. + size_t ssid_len = 0;
  515. + u8 *ssid = NULL;
  516. +@@ -1082,7 +1083,7 @@ int acx_op_hw_scan(struct ieee80211_hw *
  517. + goto out;
  518. + }
  519. + #else
  520. +- skb = ieee80211_probereq_get(adev->hw, adev->vif, ssid, ssid_len,
  521. ++ skb = ieee80211_probereq_get(adev->hw, vif->addr, ssid, ssid_len,
  522. + req->ie_len);
  523. + if (!skb) {
  524. + ret = -ENOMEM;
  525. +--- a/main.h
  526. ++++ b/main.h
  527. +@@ -62,7 +62,7 @@ void acx_op_tx(struct ieee80211_hw *hw,
  528. + #endif
  529. +
  530. + int acx_op_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  531. +- struct cfg80211_scan_request *req);
  532. ++ struct ieee80211_scan_request *req);
  533. +
  534. + int acx_recover_hw(acx_device_t *adev);
  535. +
  536. +--- a/cardsetting.c
  537. ++++ b/cardsetting.c
  538. +@@ -159,7 +159,7 @@ int acx_set_channel(acx_device_t *adev,
  539. + int res = 0;
  540. +
  541. + adev->rx_status.freq = freq;
  542. +- adev->rx_status.band = IEEE80211_BAND_2GHZ;
  543. ++ adev->rx_status.band = NL80211_BAND_2GHZ;
  544. +
  545. + adev->channel = channel;
  546. +
  547. diff --git a/package/kernel/ath10k-ct/Makefile b/package/kernel/ath10k-ct/Makefile
  548. new file mode 100644
  549. index 0000000..7a025aa
  550. --- /dev/null
  551. +++ b/package/kernel/ath10k-ct/Makefile
  552. @@ -0,0 +1,80 @@
  553. +include $(TOPDIR)/rules.mk
  554. +
  555. +PKG_NAME:=ath10k-ct
  556. +PKG_VERSION:=2016-07-21
  557. +PKG_RELEASE=1
  558. +
  559. +PKG_LICENSE:=GPLv2
  560. +PKG_LICENSE_FILES:=
  561. +
  562. +PKG_SOURCE_URL:=https://github.com/greearb/ath10k-ct.git
  563. +PKG_SOURCE_PROTO:=git
  564. +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  565. +PKG_SOURCE_VERSION:=a142524abc8eef3ba30b12f9b5ac74385c8ddc39
  566. +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
  567. +
  568. +PKG_MAINTAINER:=Ben Greear <greearb@candelatech.com>
  569. +PKG_BUILD_PARALLEL:=1
  570. +
  571. +STAMP_CONFIGURED_DEPENDS := $(STAGING_DIR)/usr/include/mac80211-backport/backport/autoconf.h
  572. +
  573. +include $(INCLUDE_DIR)/kernel.mk
  574. +include $(INCLUDE_DIR)/package.mk
  575. +
  576. +define KernelPackage/ath10k-ct
  577. + SUBMENU:=Wireless Drivers
  578. + TITLE:=ath10k-ct driver optimized for CT ath10k firmware
  579. + DEPENDS:=+kmod-mac80211 +kmod-ath +@DRIVER_11N_SUPPORT @PCI_SUPPORT
  580. + FILES:=\
  581. + $(PKG_BUILD_DIR)/ath10k/ath10k_pci.ko \
  582. + $(PKG_BUILD_DIR)/ath10k/ath10k_core.ko
  583. + AUTOLOAD:=$(call AutoLoad,50,mac80211 ath ath10k_core ath10k_pci)
  584. +endef
  585. +
  586. +NOSTDINC_FLAGS = \
  587. + -I$(PKG_BUILD_DIR) \
  588. + -I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \
  589. + -I$(STAGING_DIR)/usr/include/mac80211-backport \
  590. + -I$(STAGING_DIR)/usr/include/mac80211/uapi \
  591. + -I$(STAGING_DIR)/usr/include/mac80211 \
  592. + -include backport/autoconf.h \
  593. + -include backport/backport.h
  594. +
  595. +ifdef CONFIG_PACKAGE_MAC80211_MESH
  596. + NOSTDINC_FLAGS += -DCONFIG_MAC80211_MESH
  597. +endif
  598. +
  599. +CT_MAKEDEFS += CONFIG_ATH10K=m CONFIG_ATH10K_PCI=m
  600. +# No AHB support enabled yet. Could conditionally enable it later.
  601. +#CT_MAKEDEFS += CONFIG_ATH10K_AHB=y
  602. +#NOSTDINC_FLAGS += -DCONFIG_ATH10K_AHB
  603. +NOSTDINC_FLAGS += -DSTANDALONE_CT
  604. +
  605. +ifdef CONFIG_PACKAGE_MAC80211_DEBUGFS
  606. + CT_MAKEDEFS += CONFIG_ATH10K_DEBUGFS=y CONFIG_MAC80211_DEBUGFS=y
  607. + NOSTDINC_FLAGS += -DCONFIG_MAC80211_DEBUGFS
  608. + NOSTDINC_FLAGS += -DCONFIG_ATH10K_DEBUGFS
  609. +endif
  610. +
  611. +ifdef CONFIG_PACKAGE_ATH_DEBUG
  612. + NOSTDINC_FLAGS += -DCONFIG_ATH10K_DEBUG
  613. +endif
  614. +
  615. +define Build/Configure
  616. + cp $(STAGING_DIR)/usr/include/mac80211/ath/*.h $(PKG_BUILD_DIR)
  617. +endef
  618. +
  619. +ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
  620. + CT_MAKEDEFS += V=1
  621. +endif
  622. +
  623. +define Build/Compile
  624. + +$(MAKE) $(CT_MAKEDEFS) $(PKG_JOBS) -C "$(LINUX_DIR)" \
  625. + ARCH="$(LINUX_KARCH)" \
  626. + CROSS_COMPILE="$(TARGET_CROSS)" \
  627. + SUBDIRS="$(PKG_BUILD_DIR)/ath10k" \
  628. + NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \
  629. + modules
  630. +endef
  631. +
  632. +$(eval $(call KernelPackage,ath10k-ct))
  633. diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile
  634. index 30da1cf..f2839cd 100644
  635. --- a/package/kernel/mac80211/Makefile
  636. +++ b/package/kernel/mac80211/Makefile
  637. @@ -10,20 +10,21 @@ include $(INCLUDE_DIR)/kernel.mk
  638. PKG_NAME:=mac80211
  639. -PKG_VERSION:=2016-01-10
  640. +PKG_VERSION:=2016-06-20
  641. PKG_RELEASE:=1
  642. PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources
  643. PKG_BACKPORT_VERSION:=
  644. -PKG_MD5SUM:=be5fae2e8d6f7490f9b073374fb895ba
  645. +PKG_MD5SUM:=29c79bdc3928ef5113b17042ebda9237
  646. PKG_SOURCE:=compat-wireless-$(PKG_VERSION)$(PKG_BACKPORT_VERSION).tar.bz2
  647. PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/compat-wireless-$(PKG_VERSION)
  648. PKG_BUILD_PARALLEL:=1
  649. -PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  650. +PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  651. PKG_DRIVERS = \
  652. adm8211 \
  653. + airo \
  654. ath ath5k ath9k ath9k-common ath9k-htc ath10k \
  655. b43 b43legacy \
  656. carl9170 \
  657. @@ -52,6 +53,7 @@ PKG_CONFIG_DEPENDS:= \
  658. $(patsubst %,CONFIG_PACKAGE_kmod-%,$(PKG_DRIVERS)) \
  659. CONFIG_PACKAGE_MAC80211_DEBUGFS \
  660. CONFIG_PACKAGE_MAC80211_MESH \
  661. + CONFIG_PACKAGE_MAC80211_TRACING \
  662. CONFIG_PACKAGE_ATH_DEBUG \
  663. CONFIG_PACKAGE_ATH_DFS \
  664. CONFIG_PACKAGE_B43_DEBUG \
  665. @@ -63,7 +65,12 @@ PKG_CONFIG_DEPENDS:= \
  666. CONFIG_PACKAGE_B43_BUSES_BCMA_AND_SSB \
  667. CONFIG_PACKAGE_B43_BUSES_BCMA \
  668. CONFIG_PACKAGE_B43_BUSES_SSB \
  669. + CONFIG_PACKAGE_BRCM80211_DEBUG \
  670. + CONFIG_PACKAGE_IWLWIFI_DEBUG \
  671. + CONFIG_PACKAGE_IWLWIFI_DEBUGFS \
  672. CONFIG_PACKAGE_RTLWIFI_DEBUG \
  673. + CONFIG_ATH9K_SUPPORT_PCOEM \
  674. + CONFIG_ATH9K_TX99 \
  675. CONFIG_ATH_USER_REGD \
  676. include $(INCLUDE_DIR)/package.mk
  677. @@ -73,7 +80,7 @@ WMENU:=Wireless Drivers
  678. define KernelPackage/mac80211/Default
  679. SUBMENU:=$(WMENU)
  680. URL:=https://wireless.wiki.kernel.org/
  681. - MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  682. + MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  683. endef
  684. define KernelPackage/cfg80211
  685. @@ -92,7 +99,7 @@ endef
  686. define KernelPackage/mac80211
  687. $(call KernelPackage/mac80211/Default)
  688. TITLE:=Linux 802.11 Wireless Networking Stack
  689. - DEPENDS+= +kmod-cfg80211 +hostapd-common +kmod-crypto-core +kmod-crypto-arc4
  690. + DEPENDS+= +kmod-cfg80211 +hostapd-common
  691. KCONFIG:=\
  692. CONFIG_AVERAGE=y
  693. FILES:= $(PKG_BUILD_DIR)/net/mac80211/mac80211.ko
  694. @@ -138,10 +145,23 @@ define KernelPackage/adm8211
  695. AUTOLOAD:=$(call AutoProbe,adm8211)
  696. endef
  697. +define KernelPackage/airo
  698. + $(call KernelPackage/mac80211/Default)
  699. + TITLE:=Cisco Aironet driver
  700. + DEPENDS+=@PCI_SUPPORT +@DRIVER_WEXT_SUPPORT +kmod-cfg80211 @TARGET_x86
  701. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/cisco/airo.ko
  702. + AUTOLOAD:=$(call AutoProbe,airo)
  703. +endef
  704. +
  705. +define KernelPackage/airo/description
  706. + Kernel support for Cisco Aironet cards
  707. +endef
  708. +
  709. define KernelPackage/ath/config
  710. if PACKAGE_kmod-ath
  711. config ATH_USER_REGD
  712. bool "Force Atheros drivers to respect the user's regdomain settings"
  713. + default y
  714. help
  715. Atheros' idea of regulatory handling is that the EEPROM of the card defines
  716. the regulatory limits and the user is only allowed to restrict the settings
  717. @@ -199,6 +219,7 @@ define KernelPackage/ath9k-common
  718. $(call KernelPackage/mac80211/Default)
  719. TITLE:=Atheros 802.11n wireless devices (common code for ath9k and ath9k_htc)
  720. URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
  721. + HIDDEN:=1
  722. DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT +@KERNEL_RELAY
  723. FILES:= \
  724. $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_common.ko \
  725. @@ -226,6 +247,10 @@ define KernelPackage/ath9k/config
  726. bool "Support chips used in PC OEM cards"
  727. depends on PACKAGE_kmod-ath9k
  728. + config ATH9K_TX99
  729. + bool "Enable TX99 support"
  730. + depends on PACKAGE_kmod-ath9k
  731. +
  732. endef
  733. define KernelPackage/ath9k-htc
  734. @@ -247,7 +272,7 @@ define KernelPackage/ath10k
  735. $(call KernelPackage/mac80211/Default)
  736. TITLE:=Atheros 802.11ac wireless cards support
  737. URL:=https://wireless.wiki.kernel.org/en/users/Drivers/ath10k
  738. - DEPENDS+= @PCI_SUPPORT +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT +@KERNEL_RELAY +ath10k-firmware-qca988x
  739. + DEPENDS+= @PCI_SUPPORT +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT +@KERNEL_RELAY
  740. FILES:= \
  741. $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_core.ko \
  742. $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_pci.ko
  743. @@ -673,6 +698,7 @@ define KernelPackage/brcmfmac/config
  744. config BRCMFMAC_SDIO
  745. bool "Enable SDIO bus interface support"
  746. + default y if TARGET_brcm2708
  747. default n
  748. help
  749. Enable support for cards attached to an SDIO bus.
  750. @@ -761,7 +787,7 @@ endef
  751. define KernelPackage/iwlwifi
  752. $(call KernelPackage/mac80211/Default)
  753. - DEPENDS:= +kmod-mac80211 @PCI_SUPPORT +@DRIVER_11N_SUPPORT +iwlwifi-firmware
  754. + DEPENDS:= +kmod-mac80211 @PCI_SUPPORT +@DRIVER_11N_SUPPORT +iwlwifi-firmware @!LINUX_3_18
  755. TITLE:=Intel AGN Wireless support
  756. FILES:= \
  757. $(PKG_BUILD_DIR)/drivers/net/wireless/intel/iwlwifi/iwlwifi.ko \
  758. @@ -870,7 +896,7 @@ endef
  759. define KernelPackage/lib80211
  760. $(call KernelPackage/mac80211/Default)
  761. TITLE:=802.11 Networking stack
  762. - DEPENDS:=+kmod-cfg80211
  763. + DEPENDS:=+kmod-cfg80211 +kmod-crypto-hash
  764. FILES:= \
  765. $(PKG_BUILD_DIR)/net/wireless/lib80211.ko \
  766. $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_wep.ko \
  767. @@ -897,7 +923,7 @@ endef
  768. define KernelPackage/libipw
  769. $(call KernelPackage/mac80211/Default)
  770. TITLE:=libipw for ipw2100 and ipw2200
  771. - DEPENDS:=@PCI_SUPPORT +kmod-crypto-michael-mic +kmod-crypto-core +kmod-crypto-arc4 +kmod-lib80211 +kmod-cfg80211 +@DRIVER_WEXT_SUPPORT @!BIG_ENDIAN
  772. + DEPENDS:=@PCI_SUPPORT +kmod-crypto-michael-mic +kmod-lib80211 +kmod-cfg80211 +@DRIVER_WEXT_SUPPORT @!BIG_ENDIAN
  773. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intel/ipw2x00/libipw.ko
  774. AUTOLOAD:=$(call AutoProbe,libipw)
  775. endef
  776. @@ -978,7 +1004,7 @@ endef
  777. define KernelPackage/libertas-spi
  778. $(call KernelPackage/mac80211/Default)
  779. SUBMENU:=Wireless Drivers
  780. - DEPENDS+= +kmod-cfg80211 +kmod-lib80211 +@DRIVER_WEXT_SUPPORT +libertas-spi-firmware
  781. + DEPENDS+= +kmod-cfg80211 +kmod-lib80211 +@DRIVER_WEXT_SUPPORT @!TARGET_uml +libertas-spi-firmware
  782. KCONFIG := \
  783. CONFIG_SPI=y \
  784. CONFIG_SPI_MASTER=y
  785. @@ -1036,33 +1062,6 @@ define KernelPackage/mwifiex-pcie/description
  786. Kernel modules for Marvell 802.11n/802.11ac PCIe Wireless cards
  787. endef
  788. -
  789. -# Prism54 drivers
  790. -P54PCIFW:=2.13.12.0.arm
  791. -P54USBFW:=2.13.24.0.lm87.arm
  792. -P54SPIFW:=2.13.0.0.a.13.14.arm
  793. -
  794. -define Download/p54usb
  795. - FILE:=$(P54USBFW)
  796. - URL:=http://daemonizer.de/prism54/prism54-fw/fw-usb
  797. - MD5SUM:=8e8ab005a4f8f0123bcdc51bc25b47f6
  798. -endef
  799. -$(eval $(call Download,p54usb))
  800. -
  801. -define Download/p54pci
  802. - FILE:=$(P54PCIFW)
  803. - URL:=http://daemonizer.de/prism54/prism54-fw/fw-softmac
  804. - MD5SUM:=ff7536af2092b1c4b21315bd103ef4c4
  805. -endef
  806. -$(eval $(call Download,p54pci))
  807. -
  808. -define Download/p54spi
  809. - FILE:=$(P54SPIFW)
  810. - URL:=http://daemonizer.de/prism54/prism54-fw/stlc4560
  811. - MD5SUM:=42661f8ecbadd88012807493f596081d
  812. -endef
  813. -$(eval $(call Download,p54spi))
  814. -
  815. define KernelPackage/p54/Default
  816. $(call KernelPackage/mac80211/Default)
  817. TITLE:=Prism54 Drivers
  818. @@ -1082,7 +1081,7 @@ endef
  819. define KernelPackage/p54-pci
  820. $(call KernelPackage/p54/Default)
  821. TITLE+= (PCI)
  822. - DEPENDS+= @PCI_SUPPORT +kmod-p54-common
  823. + DEPENDS+= @PCI_SUPPORT +kmod-p54-common +p54-pci-firmware
  824. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/p54/p54pci.ko
  825. AUTOLOAD:=$(call AutoProbe,p54pci)
  826. endef
  827. @@ -1090,7 +1089,7 @@ endef
  828. define KernelPackage/p54-usb
  829. $(call KernelPackage/p54/Default)
  830. TITLE+= (USB)
  831. - DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-p54-common
  832. + DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-p54-common +p54-usb-firmware
  833. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/p54/p54usb.ko
  834. AUTOLOAD:=$(call AutoProbe,p54usb)
  835. endef
  836. @@ -1098,7 +1097,7 @@ endef
  837. define KernelPackage/p54-spi
  838. $(call KernelPackage/p54/Default)
  839. TITLE+= (SPI)
  840. - DEPENDS+= @TARGET_omap24xx +kmod-p54-common
  841. + DEPENDS+= @TARGET_omap24xx +kmod-p54-common +p54-spi-firmware
  842. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/p54/p54spi.ko
  843. AUTOLOAD:=$(call AutoProbe,p54spi)
  844. endef
  845. @@ -1453,6 +1452,7 @@ config-y:= \
  846. WLAN_VENDOR_ATH \
  847. WLAN_VENDOR_ATMEL \
  848. WLAN_VENDOR_BROADCOM \
  849. + WLAN_VENDOR_CISCO \
  850. WLAN_VENDOR_INTEL \
  851. WLAN_VENDOR_INTERSIL \
  852. WLAN_VENDOR_MARVELL \
  853. @@ -1491,6 +1491,8 @@ endif
  854. config-$(call config_package,lib80211) += LIB80211 LIB80211_CRYPT_WEP LIB80211_CRYPT_CCMP LIB80211_CRYPT_TKIP
  855. +config-$(call config_package,airo) += AIRO
  856. +
  857. config-$(call config_package,ath) += ATH_CARDS ATH_COMMON
  858. config-$(CONFIG_PACKAGE_ATH_DEBUG) += ATH_DEBUG ATH10K_DEBUG
  859. config-$(CONFIG_PACKAGE_ATH_DFS) += ATH9K_DFS_CERTIFIED ATH10K_DFS_CERTIFIED
  860. @@ -1501,6 +1503,7 @@ config-$(CONFIG_TARGET_ar71xx) += ATH9K_AHB
  861. config-$(CONFIG_PCI) += ATH9K_PCI
  862. config-$(CONFIG_ATH_USER_REGD) += ATH_USER_REGD
  863. config-$(CONFIG_ATH9K_SUPPORT_PCOEM) += ATH9K_PCOEM
  864. +config-$(CONFIG_ATH9K_TX99) += ATH9K_TX99
  865. config-$(call config_package,ath9k-htc) += ATH9K_HTC
  866. config-$(call config_package,ath10k) += ATH10K ATH10K_PCI
  867. @@ -1742,21 +1745,6 @@ define KernelPackage/ipw2200/install
  868. $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(IPW2200_NAME)-$(IPW2200_VERSION)/ipw2200*.fw $(1)/lib/firmware
  869. endef
  870. -define KernelPackage/p54-pci/install
  871. - $(INSTALL_DIR) $(1)/lib/firmware
  872. - $(INSTALL_DATA) $(DL_DIR)/$(P54PCIFW) $(1)/lib/firmware/isl3886pci
  873. -endef
  874. -
  875. -define KernelPackage/p54-usb/install
  876. - $(INSTALL_DIR) $(1)/lib/firmware
  877. - $(INSTALL_DATA) $(DL_DIR)/$(P54USBFW) $(1)/lib/firmware/isl3887usb
  878. -endef
  879. -
  880. -define KernelPackage/p54-spi/install
  881. - $(INSTALL_DIR) $(1)/lib/firmware
  882. - $(INSTALL_DATA) $(DL_DIR)/$(P54SPIFW) $(1)/lib/firmware/3826.arm
  883. -endef
  884. -
  885. define KernelPackage/zd1211rw/install
  886. $(INSTALL_DIR) $(1)/lib/firmware/zd1211
  887. $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(ZD1211FW_NAME)/zd1211* $(1)/lib/firmware/zd1211
  888. @@ -1764,6 +1752,7 @@ endef
  889. $(eval $(call KernelPackage,adm8211))
  890. +$(eval $(call KernelPackage,airo))
  891. $(eval $(call KernelPackage,ath))
  892. $(eval $(call KernelPackage,ath10k))
  893. $(eval $(call KernelPackage,ath5k))
  894. diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
  895. index fb2f928..e3d612e 100644
  896. --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
  897. +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
  898. @@ -23,6 +23,7 @@ drv_mac80211_init_device_config() {
  899. config_add_int rxantenna txantenna antenna_gain txpower distance
  900. config_add_boolean noscan ht_coex
  901. config_add_array ht_capab
  902. + config_add_array channels
  903. config_add_boolean \
  904. rxldpc \
  905. short_gi_80 \
  906. @@ -89,6 +90,7 @@ mac80211_hostapd_setup_base() {
  907. json_select config
  908. [ "$auto_channel" -gt 0 ] && channel=acs_survey
  909. + [ "$auto_channel" -gt 0 ] && json_get_values channel_list channels
  910. json_get_vars noscan ht_coex
  911. json_get_values ht_capab_list ht_capab
  912. @@ -218,7 +220,6 @@ mac80211_hostapd_setup_base() {
  913. vht_max_a_mpdu_len_exp:7 \
  914. vht_max_mpdu:11454 \
  915. rx_stbc:4 \
  916. - tx_stbc:4 \
  917. vht_link_adapt:3 \
  918. vht160:2
  919. @@ -230,13 +231,13 @@ mac80211_hostapd_setup_base() {
  920. cap_rx_stbc=$((($vht_cap >> 8) & 7))
  921. [ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc="$rx_stbc"
  922. - ht_cap_mask="$(( ($vht_cap & ~(0x700)) | ($cap_rx_stbc << 8) ))"
  923. + vht_cap="$(( ($vht_cap & ~(0x700)) | ($cap_rx_stbc << 8) ))"
  924. mac80211_add_capabilities vht_capab $vht_cap \
  925. RXLDPC:0x10::$rxldpc \
  926. SHORT-GI-80:0x20::$short_gi_80 \
  927. SHORT-GI-160:0x40::$short_gi_160 \
  928. - TX-STBC-2BY1:0x80::$tx_stbc \
  929. + TX-STBC-2BY1:0x80::$tx_stbc_2by1 \
  930. SU-BEAMFORMER:0x800::$su_beamformer \
  931. SU-BEAMFORMEE:0x1000::$su_beamformee \
  932. MU-BEAMFORMER:0x80000::$mu_beamformer \
  933. @@ -245,10 +246,10 @@ mac80211_hostapd_setup_base() {
  934. HTC-VHT:0x400000::$htc_vht \
  935. RX-ANTENNA-PATTERN:0x10000000::$rx_antenna_pattern \
  936. TX-ANTENNA-PATTERN:0x20000000::$tx_antenna_pattern \
  937. - RX-STBC1:0x700:0x100:1 \
  938. - RX-STBC12:0x700:0x200:1 \
  939. - RX-STBC123:0x700:0x300:1 \
  940. - RX-STBC1234:0x700:0x400:1 \
  941. + RX-STBC-1:0x700:0x100:1 \
  942. + RX-STBC-12:0x700:0x200:1 \
  943. + RX-STBC-123:0x700:0x300:1 \
  944. + RX-STBC-1234:0x700:0x400:1 \
  945. # supported Channel widths
  946. vht160_hw=0
  947. @@ -301,6 +302,7 @@ mac80211_hostapd_setup_base() {
  948. hostapd_prepare_device_config "$hostapd_conf_file" nl80211
  949. cat >> "$hostapd_conf_file" <<EOF
  950. ${channel:+channel=$channel}
  951. +${channel_list:+chanlist=$channel_list}
  952. ${noscan:+noscan=$noscan}
  953. $base_cfg
  954. @@ -391,11 +393,10 @@ mac80211_generate_mac() {
  955. find_phy() {
  956. [ -n "$phy" -a -d /sys/class/ieee80211/$phy ] && return 0
  957. [ -n "$path" ] && {
  958. - for phy in /sys/devices/$path/ieee80211/phy*; do
  959. - [ -e "$phy" ] && {
  960. - phy="${phy##*/}"
  961. - return 0
  962. - }
  963. + for phy in $(ls /sys/class/ieee80211 2>/dev/null); do
  964. + case "$(readlink -f /sys/class/ieee80211/$phy/device)" in
  965. + *$path) return 0;;
  966. + esac
  967. done
  968. }
  969. [ -n "$macaddr" ] && {
  970. @@ -481,7 +482,7 @@ mac80211_prepare_vif() {
  971. # All interfaces must have unique mac addresses
  972. # which can either be explicitly set in the device
  973. # section, or automatically generated
  974. - ifconfig "$ifname" hw ether "$macaddr"
  975. + ip link set dev "$ifname" address "$macaddr"
  976. fi
  977. json_select ..
  978. @@ -496,7 +497,7 @@ mac80211_setup_supplicant() {
  979. mac80211_setup_adhoc_htmode() {
  980. case "$htmode" in
  981. VHT20|HT20) ibss_htmode=HT20;;
  982. - HT40*|VHT40|VHT80|VHT160)
  983. + HT40*|VHT40|VHT160)
  984. case "$hwmode" in
  985. a)
  986. case "$(( ($channel / 4) % 2 ))" in
  987. @@ -520,6 +521,9 @@ mac80211_setup_adhoc_htmode() {
  988. esac
  989. [ "$auto_channel" -gt 0 ] && ibss_htmode="HT40+"
  990. ;;
  991. + VHT80)
  992. + ibss_htmode="80MHZ"
  993. + ;;
  994. NONE|NOHT)
  995. ibss_htmode="NOHT"
  996. ;;
  997. @@ -580,7 +584,7 @@ mac80211_setup_vif() {
  998. json_get_vars mode
  999. json_get_var vif_txpower txpower
  1000. - ifconfig "$ifname" up || {
  1001. + ip link set dev "$ifname" up || {
  1002. wireless_setup_vif_failed IFUP_ERROR
  1003. json_select ..
  1004. return
  1005. @@ -643,7 +647,7 @@ mac80211_interface_cleanup() {
  1006. local phy="$1"
  1007. for wdev in $(list_phy_interfaces "$phy"); do
  1008. - ifconfig "$wdev" down 2>/dev/null
  1009. + ip link set dev "$wdev" down 2>/dev/null
  1010. iw dev "$wdev" del
  1011. done
  1012. }
  1013. diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
  1014. index ea229d6..06f3b8b 100644
  1015. --- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh
  1016. +++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
  1017. @@ -9,11 +9,10 @@ lookup_phy() {
  1018. local devpath
  1019. config_get devpath "$device" path
  1020. [ -n "$devpath" ] && {
  1021. - for _phy in /sys/devices/$devpath/ieee80211/phy*; do
  1022. - [ -e "$_phy" ] && {
  1023. - phy="${_phy##*/}"
  1024. - return
  1025. - }
  1026. + for phy in $(ls /sys/class/ieee80211 2>/dev/null); do
  1027. + case "$(readlink -f /sys/class/ieee80211/$phy/device)" in
  1028. + *$devpath) return;;
  1029. + esac
  1030. done
  1031. }
  1032. @@ -102,6 +101,9 @@ detect_mac80211() {
  1033. fi
  1034. if [ -n "$path" ]; then
  1035. path="${path##/sys/devices/}"
  1036. + case "$path" in
  1037. + platform*/pci*) path="${path##platform/}";;
  1038. + esac
  1039. dev_id=" option path '$path'"
  1040. else
  1041. dev_id=" option macaddr $(cat /sys/class/ieee80211/${dev}/macaddress)"
  1042. diff --git a/package/kernel/mac80211/patches/004-backports-add-skb_free_frag.patch b/package/kernel/mac80211/patches/004-backports-add-skb_free_frag.patch
  1043. deleted file mode 100644
  1044. index 9adfd8f..0000000
  1045. --- a/package/kernel/mac80211/patches/004-backports-add-skb_free_frag.patch
  1046. +++ /dev/null
  1047. @@ -1,21 +0,0 @@
  1048. -From: Felix Fietkau <nbd@openwrt.org>
  1049. -Date: Thu, 28 Jan 2016 15:16:35 +0100
  1050. -Subject: [PATCH] backports: add skb_free_frag()
  1051. -
  1052. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  1053. ----
  1054. -
  1055. ---- a/backport-include/linux/skbuff.h
  1056. -+++ b/backport-include/linux/skbuff.h
  1057. -@@ -300,4 +300,11 @@ int skb_ensure_writable(struct sk_buff *
  1058. -
  1059. - #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) */
  1060. -
  1061. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
  1062. -+static inline void skb_free_frag(void *data)
  1063. -+{
  1064. -+ put_page(virt_to_head_page(data));
  1065. -+}
  1066. -+#endif
  1067. -+
  1068. - #endif /* __BACKPORT_SKBUFF_H */
  1069. diff --git a/package/kernel/mac80211/patches/004-fix_duplicate_skcipher_backport.patch b/package/kernel/mac80211/patches/004-fix_duplicate_skcipher_backport.patch
  1070. new file mode 100644
  1071. index 0000000..38b3179
  1072. --- /dev/null
  1073. +++ b/package/kernel/mac80211/patches/004-fix_duplicate_skcipher_backport.patch
  1074. @@ -0,0 +1,11 @@
  1075. +--- a/compat/Makefile
  1076. ++++ b/compat/Makefile
  1077. +@@ -35,8 +35,6 @@ compat-$(CPTCFG_KERNEL_4_6) += backport-
  1078. +
  1079. + compat-$(CPTCFG_BPAUTO_BUILD_CRYPTO_CCM) += crypto-ccm.o
  1080. + compat-$(CPTCFG_BPAUTO_CRYPTO_SKCIPHER) += crypto-skcipher.o
  1081. +-skcipher-objs += crypto-skcipher.o
  1082. +-obj-$(CPTCFG_BPAUTO_CRYPTO_SKCIPHER) += skcipher.o
  1083. + compat-$(CPTCFG_BPAUTO_BUILD_WANT_DEV_COREDUMP) += drivers-base-devcoredump.o
  1084. + compat-$(CPTCFG_BPAUTO_RHASHTABLE) += lib-rhashtable.o
  1085. + cordic-objs += lib-cordic.o
  1086. diff --git a/package/kernel/mac80211/patches/005-backport_skb_get_hash_perturb.patch b/package/kernel/mac80211/patches/005-backport_skb_get_hash_perturb.patch
  1087. new file mode 100644
  1088. index 0000000..29bccc1
  1089. --- /dev/null
  1090. +++ b/package/kernel/mac80211/patches/005-backport_skb_get_hash_perturb.patch
  1091. @@ -0,0 +1,22 @@
  1092. +--- a/backport-include/linux/skbuff.h
  1093. ++++ b/backport-include/linux/skbuff.h
  1094. +@@ -305,6 +305,19 @@ static inline void skb_free_frag(void *d
  1095. + {
  1096. + put_page(virt_to_head_page(data));
  1097. + }
  1098. ++
  1099. ++#include <net/flow_keys.h>
  1100. ++#include <linux/jhash.h>
  1101. ++
  1102. ++static inline u32 skb_get_hash_perturb(struct sk_buff *skb, u32 key)
  1103. ++{
  1104. ++ struct flow_keys keys;
  1105. ++
  1106. ++ skb_flow_dissect(skb, &keys);
  1107. ++ return jhash_3words((__force u32)keys.dst,
  1108. ++ (__force u32)keys.src ^ keys.ip_proto,
  1109. ++ (__force u32)keys.ports, key);
  1110. ++}
  1111. + #endif
  1112. +
  1113. + #endif /* __BACKPORT_SKBUFF_H */
  1114. diff --git a/package/kernel/mac80211/patches/005-backports-add-napi_alloc_frag.patch b/package/kernel/mac80211/patches/005-backports-add-napi_alloc_frag.patch
  1115. deleted file mode 100644
  1116. index 9b672a8..0000000
  1117. --- a/package/kernel/mac80211/patches/005-backports-add-napi_alloc_frag.patch
  1118. +++ /dev/null
  1119. @@ -1,20 +0,0 @@
  1120. -From: Felix Fietkau <nbd@openwrt.org>
  1121. -Date: Thu, 28 Jan 2016 15:19:22 +0100
  1122. -Subject: [PATCH] backports: add napi_alloc_frag
  1123. -
  1124. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  1125. ----
  1126. -
  1127. ---- a/backport-include/linux/netdevice.h
  1128. -+++ b/backport-include/linux/netdevice.h
  1129. -@@ -232,6 +232,10 @@ static inline void backport_unregister_n
  1130. - #define unregister_netdevice_many LINUX_BACKPORT(unregister_netdevice_many)
  1131. - #endif
  1132. -
  1133. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
  1134. -+#define napi_alloc_frag netdev_alloc_frag
  1135. -+#endif
  1136. -+
  1137. - /*
  1138. - * Complicated way of saying: We only backport netdev_rss_key stuff on kernels
  1139. - * that either already have net_get_random_once() (>= 3.13) or where we've been
  1140. diff --git a/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch b/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
  1141. index fd1e1cf..8be5fa1 100644
  1142. --- a/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
  1143. +++ b/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
  1144. @@ -1,6 +1,6 @@
  1145. --- a/.local-symbols
  1146. +++ b/.local-symbols
  1147. -@@ -476,44 +476,6 @@ USB_IPHETH=
  1148. +@@ -481,45 +481,6 @@ USB_IPHETH=
  1149. USB_SIERRA_NET=
  1150. USB_VL600=
  1151. USB_NET_CH9200=
  1152. @@ -37,6 +37,7 @@
  1153. -BCMA_DRIVER_PCI=
  1154. -BCMA_DRIVER_PCI_HOSTMODE=
  1155. -BCMA_DRIVER_MIPS=
  1156. +-BCMA_PFLASH=
  1157. -BCMA_SFLASH=
  1158. -BCMA_NFLASH=
  1159. -BCMA_DRIVER_GMAC_CMN=
  1160. @@ -56,7 +57,7 @@
  1161. return (bus->chipco.dev ? bus->chipco.dev : bus->pcicore.dev);
  1162. #else
  1163. return bus->chipco.dev;
  1164. -@@ -4903,7 +4903,7 @@ static int b43_wireless_core_init(struct
  1165. +@@ -4883,7 +4883,7 @@ static int b43_wireless_core_init(struct
  1166. }
  1167. if (sprom->boardflags_lo & B43_BFL_XTAL_NOSLOW)
  1168. hf |= B43_HF_DSCRQ; /* Disable slowclock requests from ucode. */
  1169. diff --git a/package/kernel/mac80211/patches/080-disable_clk_backport.patch b/package/kernel/mac80211/patches/080-disable_clk_backport.patch
  1170. deleted file mode 100644
  1171. index 3765591..0000000
  1172. --- a/package/kernel/mac80211/patches/080-disable_clk_backport.patch
  1173. +++ /dev/null
  1174. @@ -1,20 +0,0 @@
  1175. ---- a/compat/compat-3.6.c
  1176. -+++ b/compat/compat-3.6.c
  1177. -@@ -147,17 +147,3 @@ int sg_alloc_table_from_pages(struct sg_
  1178. - return 0;
  1179. - }
  1180. - EXPORT_SYMBOL_GPL(sg_alloc_table_from_pages);
  1181. --
  1182. --/* whoopsie ! */
  1183. --#ifndef CONFIG_COMMON_CLK
  1184. --int clk_enable(struct clk *clk)
  1185. --{
  1186. -- return 0;
  1187. --}
  1188. --EXPORT_SYMBOL_GPL(clk_enable);
  1189. --
  1190. --void clk_disable(struct clk *clk)
  1191. --{
  1192. --}
  1193. --EXPORT_SYMBOL_GPL(clk_disable);
  1194. --#endif
  1195. diff --git a/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch b/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
  1196. index 02f46c7..fbe22e5 100644
  1197. --- a/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
  1198. +++ b/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
  1199. @@ -309,7 +309,7 @@
  1200. #endif /* AES_GMAC_H */
  1201. --- a/net/mac80211/key.h
  1202. +++ b/net/mac80211/key.h
  1203. -@@ -84,7 +84,7 @@ struct ieee80211_key {
  1204. +@@ -88,7 +88,7 @@ struct ieee80211_key {
  1205. * Management frames.
  1206. */
  1207. u8 rx_pn[IEEE80211_NUM_TIDS + 1][IEEE80211_CCMP_PN_LEN];
  1208. @@ -320,7 +320,7 @@
  1209. struct {
  1210. --- a/net/mac80211/wpa.c
  1211. +++ b/net/mac80211/wpa.c
  1212. -@@ -307,7 +307,8 @@ ieee80211_crypto_tkip_decrypt(struct iee
  1213. +@@ -304,7 +304,8 @@ ieee80211_crypto_tkip_decrypt(struct iee
  1214. }
  1215. @@ -330,7 +330,7 @@
  1216. {
  1217. __le16 mask_fc;
  1218. int a4_included, mgmt;
  1219. -@@ -337,14 +338,8 @@ static void ccmp_special_blocks(struct s
  1220. +@@ -334,14 +335,8 @@ static void ccmp_special_blocks(struct s
  1221. else
  1222. qos_tid = 0;
  1223. @@ -347,7 +347,7 @@
  1224. /* Nonce: Nonce Flags | A2 | PN
  1225. * Nonce Flags: Priority (b0..b3) | Management (b4) | Reserved (b5..b7)
  1226. -@@ -352,6 +347,8 @@ static void ccmp_special_blocks(struct s
  1227. +@@ -349,6 +344,8 @@ static void ccmp_special_blocks(struct s
  1228. b_0[1] = qos_tid | (mgmt << 4);
  1229. memcpy(&b_0[2], hdr->addr2, ETH_ALEN);
  1230. memcpy(&b_0[8], pn, IEEE80211_CCMP_PN_LEN);
  1231. @@ -356,7 +356,7 @@
  1232. /* AAD (extra authenticate-only data) / masked 802.11 header
  1233. * FC | A1 | A2 | A3 | SC | [A4] | [QC] */
  1234. -@@ -463,7 +460,7 @@ static int ccmp_encrypt_skb(struct ieee8
  1235. +@@ -460,7 +457,7 @@ static int ccmp_encrypt_skb(struct ieee8
  1236. return 0;
  1237. pos += IEEE80211_CCMP_HDR_LEN;
  1238. @@ -365,7 +365,7 @@
  1239. ieee80211_aes_ccm_encrypt(key->u.ccmp.tfm, b_0, aad, pos, len,
  1240. skb_put(skb, mic_len), mic_len);
  1241. -@@ -534,7 +531,7 @@ ieee80211_crypto_ccmp_decrypt(struct iee
  1242. +@@ -537,7 +534,7 @@ ieee80211_crypto_ccmp_decrypt(struct iee
  1243. u8 aad[2 * AES_BLOCK_SIZE];
  1244. u8 b_0[AES_BLOCK_SIZE];
  1245. /* hardware didn't decrypt/verify MIC */
  1246. diff --git a/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch b/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch
  1247. index d1d9fbd..3ca166f 100644
  1248. --- a/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch
  1249. +++ b/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch
  1250. @@ -2,7 +2,7 @@ Used for AP+STA support in OpenWrt - preserve AP mode keys across STA reconnects
  1251. --- a/net/mac80211/cfg.c
  1252. +++ b/net/mac80211/cfg.c
  1253. -@@ -846,7 +846,6 @@ static int ieee80211_stop_ap(struct wiph
  1254. +@@ -850,7 +850,6 @@ static int ieee80211_stop_ap(struct wiph
  1255. sdata->u.ap.driver_smps_mode = IEEE80211_SMPS_OFF;
  1256. __sta_info_flush(sdata, true);
  1257. diff --git a/package/kernel/mac80211/patches/150-disable_addr_notifier.patch b/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
  1258. index 2855a88..16fab84 100644
  1259. --- a/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
  1260. +++ b/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
  1261. @@ -18,9 +18,9 @@
  1262. static int ieee80211_ifa6_changed(struct notifier_block *nb,
  1263. unsigned long data, void *arg)
  1264. {
  1265. -@@ -1087,14 +1087,14 @@ int ieee80211_register_hw(struct ieee802
  1266. -
  1267. - rtnl_unlock();
  1268. +@@ -1090,14 +1090,14 @@ int ieee80211_register_hw(struct ieee802
  1269. + if (result)
  1270. + goto fail_flows;
  1271. -#ifdef CONFIG_INET
  1272. +#ifdef __disabled__CONFIG_INET
  1273. @@ -35,7 +35,7 @@
  1274. local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed;
  1275. result = register_inet6addr_notifier(&local->ifa6_notifier);
  1276. if (result)
  1277. -@@ -1103,13 +1103,13 @@ int ieee80211_register_hw(struct ieee802
  1278. +@@ -1106,13 +1106,13 @@ int ieee80211_register_hw(struct ieee802
  1279. return 0;
  1280. @@ -51,8 +51,8 @@
  1281. +#if defined(__disabled__CONFIG_INET) || defined(__disabled__CONFIG_IPV6)
  1282. fail_ifa:
  1283. #endif
  1284. - rtnl_lock();
  1285. -@@ -1137,10 +1137,10 @@ void ieee80211_unregister_hw(struct ieee
  1286. + ieee80211_txq_teardown_flows(local);
  1287. +@@ -1142,10 +1142,10 @@ void ieee80211_unregister_hw(struct ieee
  1288. tasklet_kill(&local->tx_pending_tasklet);
  1289. tasklet_kill(&local->tasklet);
  1290. diff --git a/package/kernel/mac80211/patches/210-ap_scan.patch b/package/kernel/mac80211/patches/210-ap_scan.patch
  1291. index a99cbd2..29f05c4 100644
  1292. --- a/package/kernel/mac80211/patches/210-ap_scan.patch
  1293. +++ b/package/kernel/mac80211/patches/210-ap_scan.patch
  1294. @@ -1,6 +1,6 @@
  1295. --- a/net/mac80211/cfg.c
  1296. +++ b/net/mac80211/cfg.c
  1297. -@@ -1999,7 +1999,7 @@ static int ieee80211_scan(struct wiphy *
  1298. +@@ -2008,7 +2008,7 @@ static int ieee80211_scan(struct wiphy *
  1299. * the frames sent while scanning on other channel will be
  1300. * lost)
  1301. */
  1302. diff --git a/package/kernel/mac80211/patches/220-fq_disable_hack.patch b/package/kernel/mac80211/patches/220-fq_disable_hack.patch
  1303. new file mode 100644
  1304. index 0000000..7f420be
  1305. --- /dev/null
  1306. +++ b/package/kernel/mac80211/patches/220-fq_disable_hack.patch
  1307. @@ -0,0 +1,15 @@
  1308. +mac80211 fq has been found to cause a regression in multi-stream TCP
  1309. +performance. Disable it until the cause has been found and fixed
  1310. +
  1311. +--- a/include/net/fq_impl.h
  1312. ++++ b/include/net/fq_impl.h
  1313. +@@ -104,6 +104,9 @@ static struct fq_flow *fq_flow_classify(
  1314. +
  1315. + lockdep_assert_held(&fq->lock);
  1316. +
  1317. ++ /* HACK: disable fq for now until TCP issues are fixed */
  1318. ++ return get_default_func(fq, tin, 0, skb);
  1319. ++
  1320. + hash = skb_get_hash_perturb(skb, fq->perturbation);
  1321. + idx = reciprocal_scale(hash, fq->flows_cnt);
  1322. + flow = &fq->flows[idx];
  1323. diff --git a/package/kernel/mac80211/patches/300-ath9k-force-rx_clear-when-disabling-rx.patch b/package/kernel/mac80211/patches/300-ath9k-force-rx_clear-when-disabling-rx.patch
  1324. index bddb15a..098bda7 100644
  1325. --- a/package/kernel/mac80211/patches/300-ath9k-force-rx_clear-when-disabling-rx.patch
  1326. +++ b/package/kernel/mac80211/patches/300-ath9k-force-rx_clear-when-disabling-rx.patch
  1327. @@ -3,15 +3,16 @@ Date: Sun, 7 Jun 2015 13:53:35 +0200
  1328. Subject: [PATCH] ath9k: force rx_clear when disabling rx
  1329. This makes stopping Rx more reliable and should reduce the frequency of
  1330. -Rx related DMA stop warnings
  1331. +Rx related DMA stop warnings. Don't use rx_clear in TX99 mode.
  1332. Cc: stable@vger.kernel.org
  1333. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  1334. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  1335. +Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
  1336. ---
  1337. --- a/drivers/net/wireless/ath/ath9k/mac.c
  1338. +++ b/drivers/net/wireless/ath/ath9k/mac.c
  1339. -@@ -677,13 +677,15 @@ void ath9k_hw_startpcureceive(struct ath
  1340. +@@ -677,13 +677,18 @@ void ath9k_hw_startpcureceive(struct ath
  1341. ath9k_ani_reset(ah, is_scanning);
  1342. @@ -24,8 +25,11 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  1343. void ath9k_hw_abortpcurecv(struct ath_hw *ah)
  1344. {
  1345. - REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_ABORT | AR_DIAG_RX_DIS);
  1346. -+ REG_SET_BIT(ah, AR_DIAG_SW,
  1347. -+ AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT | AR_DIAG_FORCE_RX_CLEAR);
  1348. ++ u32 reg = AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT;
  1349. ++
  1350. ++ if (!config_enabled(CPTCFG_ATH9K_TX99))
  1351. ++ reg |= AR_DIAG_FORCE_RX_CLEAR;
  1352. ++ REG_SET_BIT(ah, AR_DIAG_SW, reg);
  1353. ath9k_hw_disable_mib_counters(ah);
  1354. }
  1355. diff --git a/package/kernel/mac80211/patches/302-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch b/package/kernel/mac80211/patches/302-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch
  1356. new file mode 100644
  1357. index 0000000..7caa9be
  1358. --- /dev/null
  1359. +++ b/package/kernel/mac80211/patches/302-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch
  1360. @@ -0,0 +1,37 @@
  1361. +From: Felix Fietkau <nbd@nbd.name>
  1362. +Date: Sat, 14 May 2016 14:51:02 +0200
  1363. +Subject: [PATCH] Revert "ath9k: interpret requested txpower in EIRP
  1364. + domain"
  1365. +
  1366. +This reverts commit 71f5137bf010c6faffab50c0ec15374c59c4a411.
  1367. +---
  1368. +
  1369. +--- a/drivers/net/wireless/ath/ath9k/hw.c
  1370. ++++ b/drivers/net/wireless/ath/ath9k/hw.c
  1371. +@@ -2914,7 +2914,8 @@ void ath9k_hw_apply_txpower(struct ath_h
  1372. + {
  1373. + struct ath_regulatory *reg = ath9k_hw_regulatory(ah);
  1374. + struct ieee80211_channel *channel;
  1375. +- int chan_pwr, new_pwr;
  1376. ++ int chan_pwr, new_pwr, max_gain;
  1377. ++ int ant_gain, ant_reduction = 0;
  1378. +
  1379. + if (!chan)
  1380. + return;
  1381. +@@ -2922,10 +2923,15 @@ void ath9k_hw_apply_txpower(struct ath_h
  1382. + channel = chan->chan;
  1383. + chan_pwr = min_t(int, channel->max_power * 2, MAX_RATE_POWER);
  1384. + new_pwr = min_t(int, chan_pwr, reg->power_limit);
  1385. ++ max_gain = chan_pwr - new_pwr + channel->max_antenna_gain * 2;
  1386. ++
  1387. ++ ant_gain = get_antenna_gain(ah, chan);
  1388. ++ if (ant_gain > max_gain)
  1389. ++ ant_reduction = ant_gain - max_gain;
  1390. +
  1391. + ah->eep_ops->set_txpower(ah, chan,
  1392. + ath9k_regd_get_ctl(reg, chan),
  1393. +- get_antenna_gain(ah, chan), new_pwr, test);
  1394. ++ ant_reduction, new_pwr, test);
  1395. + }
  1396. +
  1397. + void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test)
  1398. diff --git a/package/kernel/mac80211/patches/302-ath9k_hw-add-low-power-tx-gain-table-for-AR953x.patch b/package/kernel/mac80211/patches/302-ath9k_hw-add-low-power-tx-gain-table-for-AR953x.patch
  1399. deleted file mode 100644
  1400. index 22b987a..0000000
  1401. --- a/package/kernel/mac80211/patches/302-ath9k_hw-add-low-power-tx-gain-table-for-AR953x.patch
  1402. +++ /dev/null
  1403. @@ -1,95 +0,0 @@
  1404. -From: Felix Fietkau <nbd@openwrt.org>
  1405. -Date: Thu, 14 Jan 2016 03:14:03 +0100
  1406. -Subject: [PATCH] ath9k_hw: add low power tx gain table for AR953x
  1407. -
  1408. -Used in some newer TP-Link AR9533 devices.
  1409. -
  1410. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  1411. ----
  1412. -
  1413. ---- a/drivers/net/wireless/ath/ath9k/ar9003_hw.c
  1414. -+++ b/drivers/net/wireless/ath/ath9k/ar9003_hw.c
  1415. -@@ -698,6 +698,9 @@ static void ar9003_tx_gain_table_mode2(s
  1416. - else if (AR_SREV_9340(ah))
  1417. - INIT_INI_ARRAY(&ah->iniModesTxGain,
  1418. - ar9340Modes_low_ob_db_tx_gain_table_1p0);
  1419. -+ else if (AR_SREV_9531_11(ah))
  1420. -+ INIT_INI_ARRAY(&ah->iniModesTxGain,
  1421. -+ qca953x_1p1_modes_no_xpa_low_power_tx_gain_table);
  1422. - else if (AR_SREV_9485_11_OR_LATER(ah))
  1423. - INIT_INI_ARRAY(&ah->iniModesTxGain,
  1424. - ar9485Modes_low_ob_db_tx_gain_1_1);
  1425. ---- a/drivers/net/wireless/ath/ath9k/ar953x_initvals.h
  1426. -+++ b/drivers/net/wireless/ath/ath9k/ar953x_initvals.h
  1427. -@@ -757,6 +757,71 @@ static const u32 qca953x_1p1_modes_xpa_t
  1428. - {0x00016448, 0x6c927a70},
  1429. - };
  1430. -
  1431. -+static const u32 qca953x_1p1_modes_no_xpa_low_power_tx_gain_table[][2] = {
  1432. -+ /* Addr allmodes */
  1433. -+ {0x0000a2dc, 0xfff55592},
  1434. -+ {0x0000a2e0, 0xfff99924},
  1435. -+ {0x0000a2e4, 0xfffe1e00},
  1436. -+ {0x0000a2e8, 0xffffe000},
  1437. -+ {0x0000a410, 0x000050d6},
  1438. -+ {0x0000a500, 0x00000069},
  1439. -+ {0x0000a504, 0x0400006b},
  1440. -+ {0x0000a508, 0x0800006d},
  1441. -+ {0x0000a50c, 0x0c000269},
  1442. -+ {0x0000a510, 0x1000026b},
  1443. -+ {0x0000a514, 0x1400026d},
  1444. -+ {0x0000a518, 0x18000669},
  1445. -+ {0x0000a51c, 0x1c00066b},
  1446. -+ {0x0000a520, 0x1d000a68},
  1447. -+ {0x0000a524, 0x21000a6a},
  1448. -+ {0x0000a528, 0x25000a6c},
  1449. -+ {0x0000a52c, 0x29000a6e},
  1450. -+ {0x0000a530, 0x2d0012a9},
  1451. -+ {0x0000a534, 0x310012ab},
  1452. -+ {0x0000a538, 0x350012ad},
  1453. -+ {0x0000a53c, 0x39001b0a},
  1454. -+ {0x0000a540, 0x3d001b0c},
  1455. -+ {0x0000a544, 0x41001b0e},
  1456. -+ {0x0000a548, 0x43001bae},
  1457. -+ {0x0000a54c, 0x45001914},
  1458. -+ {0x0000a550, 0x47001916},
  1459. -+ {0x0000a554, 0x49001b96},
  1460. -+ {0x0000a558, 0x49001b96},
  1461. -+ {0x0000a55c, 0x49001b96},
  1462. -+ {0x0000a560, 0x49001b96},
  1463. -+ {0x0000a564, 0x49001b96},
  1464. -+ {0x0000a568, 0x49001b96},
  1465. -+ {0x0000a56c, 0x49001b96},
  1466. -+ {0x0000a570, 0x49001b96},
  1467. -+ {0x0000a574, 0x49001b96},
  1468. -+ {0x0000a578, 0x49001b96},
  1469. -+ {0x0000a57c, 0x49001b96},
  1470. -+ {0x0000a600, 0x00000000},
  1471. -+ {0x0000a604, 0x00000000},
  1472. -+ {0x0000a608, 0x00000000},
  1473. -+ {0x0000a60c, 0x00000000},
  1474. -+ {0x0000a610, 0x00000000},
  1475. -+ {0x0000a614, 0x00000000},
  1476. -+ {0x0000a618, 0x00804201},
  1477. -+ {0x0000a61c, 0x01408201},
  1478. -+ {0x0000a620, 0x01408502},
  1479. -+ {0x0000a624, 0x01408502},
  1480. -+ {0x0000a628, 0x01408502},
  1481. -+ {0x0000a62c, 0x01408502},
  1482. -+ {0x0000a630, 0x01408502},
  1483. -+ {0x0000a634, 0x01408502},
  1484. -+ {0x0000a638, 0x01408502},
  1485. -+ {0x0000a63c, 0x01408502},
  1486. -+ {0x0000b2dc, 0xfff55592},
  1487. -+ {0x0000b2e0, 0xfff99924},
  1488. -+ {0x0000b2e4, 0xfffe1e00},
  1489. -+ {0x0000b2e8, 0xffffe000},
  1490. -+ {0x00016044, 0x044922db},
  1491. -+ {0x00016048, 0x6c927a70},
  1492. -+ {0x00016444, 0x044922db},
  1493. -+ {0x00016448, 0x6c927a70},
  1494. -+};
  1495. -+
  1496. - static const u32 qca953x_2p0_baseband_core[][2] = {
  1497. - /* Addr allmodes */
  1498. - {0x00009800, 0xafe68e30},
  1499. diff --git a/package/kernel/mac80211/patches/303-ath10k-Ensure-txrx-compl-task-is-stopped-when-cleani.patch b/package/kernel/mac80211/patches/303-ath10k-Ensure-txrx-compl-task-is-stopped-when-cleani.patch
  1500. new file mode 100644
  1501. index 0000000..73accd8
  1502. --- /dev/null
  1503. +++ b/package/kernel/mac80211/patches/303-ath10k-Ensure-txrx-compl-task-is-stopped-when-cleani.patch
  1504. @@ -0,0 +1,21 @@
  1505. +From: Ben Greear <greearb@candelatech.com>
  1506. +Date: Fri, 1 Apr 2016 14:12:08 -0700
  1507. +Subject: [PATCH] ath10k: Ensure txrx-compl-task is stopped when cleaning
  1508. + htt-tx.
  1509. +
  1510. +Otherwise, the txrx-compl-task may access some bad memory?
  1511. +
  1512. +Signed-off-by: Ben Greear <greearb@candelatech.com>
  1513. +---
  1514. +
  1515. +--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
  1516. ++++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
  1517. +@@ -388,6 +388,8 @@ void ath10k_htt_tx_free(struct ath10k_ht
  1518. + {
  1519. + int size;
  1520. +
  1521. ++ tasklet_kill(&htt->txrx_compl_task);
  1522. ++
  1523. + idr_for_each(&htt->pending_tx, ath10k_htt_tx_clean_up_pending, htt->ar);
  1524. + idr_destroy(&htt->pending_tx);
  1525. +
  1526. diff --git a/package/kernel/mac80211/patches/303-rt2x00-fix-monitor-mode-regression.patch b/package/kernel/mac80211/patches/303-rt2x00-fix-monitor-mode-regression.patch
  1527. deleted file mode 100644
  1528. index 7bb7435..0000000
  1529. --- a/package/kernel/mac80211/patches/303-rt2x00-fix-monitor-mode-regression.patch
  1530. +++ /dev/null
  1531. @@ -1,156 +0,0 @@
  1532. -From: Eli Cooper <elicooper@gmx.com>
  1533. -Date: Thu, 14 Jan 2016 00:07:12 +0800
  1534. -Subject: [PATCH] rt2x00: fix monitor mode regression
  1535. -
  1536. -Since commit df1404650ccbfeb76a84f301f22316be0d00a864 monitor mode for rt2x00
  1537. -has been made effectively useless because the hardware filter is configured to
  1538. -drop packets whose intended recipient is not the device, regardless of the
  1539. -presence of monitor mode interfaces.
  1540. -
  1541. -This patch fixes this regression by adding explicit monitor mode support, and
  1542. -configuring the hardware filter accordingly.
  1543. -
  1544. -Signed-off-by: Eli Cooper <elicooper@gmx.com>
  1545. ----
  1546. -
  1547. ---- a/drivers/net/wireless/ralink/rt2x00/rt2400pci.c
  1548. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2400pci.c
  1549. -@@ -273,8 +273,10 @@ static void rt2400pci_config_filter(stru
  1550. - !(filter_flags & FIF_PLCPFAIL));
  1551. - rt2x00_set_field32(&reg, RXCSR0_DROP_CONTROL,
  1552. - !(filter_flags & FIF_CONTROL));
  1553. -- rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME, 1);
  1554. -+ rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME,
  1555. -+ !rt2x00dev->is_monitoring);
  1556. - rt2x00_set_field32(&reg, RXCSR0_DROP_TODS,
  1557. -+ !rt2x00dev->is_monitoring &&
  1558. - !rt2x00dev->intf_ap_count);
  1559. - rt2x00_set_field32(&reg, RXCSR0_DROP_VERSION_ERROR, 1);
  1560. - rt2x00mmio_register_write(rt2x00dev, RXCSR0, reg);
  1561. ---- a/drivers/net/wireless/ralink/rt2x00/rt2500pci.c
  1562. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2500pci.c
  1563. -@@ -274,8 +274,10 @@ static void rt2500pci_config_filter(stru
  1564. - !(filter_flags & FIF_PLCPFAIL));
  1565. - rt2x00_set_field32(&reg, RXCSR0_DROP_CONTROL,
  1566. - !(filter_flags & FIF_CONTROL));
  1567. -- rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME, 1);
  1568. -+ rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME,
  1569. -+ !rt2x00dev->is_monitoring);
  1570. - rt2x00_set_field32(&reg, RXCSR0_DROP_TODS,
  1571. -+ !rt2x00dev->is_monitoring &&
  1572. - !rt2x00dev->intf_ap_count);
  1573. - rt2x00_set_field32(&reg, RXCSR0_DROP_VERSION_ERROR, 1);
  1574. - rt2x00_set_field32(&reg, RXCSR0_DROP_MCAST,
  1575. ---- a/drivers/net/wireless/ralink/rt2x00/rt2500usb.c
  1576. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2500usb.c
  1577. -@@ -437,8 +437,10 @@ static void rt2500usb_config_filter(stru
  1578. - !(filter_flags & FIF_PLCPFAIL));
  1579. - rt2x00_set_field16(&reg, TXRX_CSR2_DROP_CONTROL,
  1580. - !(filter_flags & FIF_CONTROL));
  1581. -- rt2x00_set_field16(&reg, TXRX_CSR2_DROP_NOT_TO_ME, 1);
  1582. -+ rt2x00_set_field16(&reg, TXRX_CSR2_DROP_NOT_TO_ME,
  1583. -+ !rt2x00dev->is_monitoring);
  1584. - rt2x00_set_field16(&reg, TXRX_CSR2_DROP_TODS,
  1585. -+ !rt2x00dev->is_monitoring &&
  1586. - !rt2x00dev->intf_ap_count);
  1587. - rt2x00_set_field16(&reg, TXRX_CSR2_DROP_VERSION_ERROR, 1);
  1588. - rt2x00_set_field16(&reg, TXRX_CSR2_DROP_MULTICAST,
  1589. ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  1590. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  1591. -@@ -1490,7 +1490,8 @@ void rt2800_config_filter(struct rt2x00_
  1592. - !(filter_flags & FIF_FCSFAIL));
  1593. - rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_PHY_ERROR,
  1594. - !(filter_flags & FIF_PLCPFAIL));
  1595. -- rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_TO_ME, 1);
  1596. -+ rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_TO_ME,
  1597. -+ !rt2x00dev->is_monitoring);
  1598. - rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_MY_BSSD, 0);
  1599. - rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_VER_ERROR, 1);
  1600. - rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_MULTICAST,
  1601. ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  1602. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  1603. -@@ -844,11 +844,13 @@ struct rt2x00_dev {
  1604. - * - Open sta interface count.
  1605. - * - Association count.
  1606. - * - Beaconing enabled count.
  1607. -+ * - Whether the device is monitoring.
  1608. - */
  1609. - unsigned int intf_ap_count;
  1610. - unsigned int intf_sta_count;
  1611. - unsigned int intf_associated;
  1612. - unsigned int intf_beaconing;
  1613. -+ bool is_monitoring;
  1614. -
  1615. - /*
  1616. - * Interface combinations
  1617. ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00config.c
  1618. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00config.c
  1619. -@@ -244,6 +244,16 @@ void rt2x00lib_config(struct rt2x00_dev
  1620. - (ieee80211_flags & IEEE80211_CONF_CHANGE_PS))
  1621. - cancel_delayed_work_sync(&rt2x00dev->autowakeup_work);
  1622. -
  1623. -+ if (ieee80211_flags & IEEE80211_CONF_CHANGE_MONITOR) {
  1624. -+ if (conf->flags & IEEE80211_CONF_MONITOR) {
  1625. -+ rt2x00_dbg(rt2x00dev, "Monitor mode is enabled\n");
  1626. -+ rt2x00dev->is_monitoring = true;
  1627. -+ } else {
  1628. -+ rt2x00_dbg(rt2x00dev, "Monitor mode is disabled\n");
  1629. -+ rt2x00dev->is_monitoring = false;
  1630. -+ }
  1631. -+ }
  1632. -+
  1633. - /*
  1634. - * Start configuration.
  1635. - */
  1636. ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  1637. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  1638. -@@ -1204,6 +1204,7 @@ int rt2x00lib_start(struct rt2x00_dev *r
  1639. - rt2x00dev->intf_ap_count = 0;
  1640. - rt2x00dev->intf_sta_count = 0;
  1641. - rt2x00dev->intf_associated = 0;
  1642. -+ rt2x00dev->is_monitoring = false;
  1643. -
  1644. - /* Enable the radio */
  1645. - retval = rt2x00lib_enable_radio(rt2x00dev);
  1646. ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
  1647. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
  1648. -@@ -385,11 +385,6 @@ void rt2x00mac_configure_filter(struct i
  1649. - *total_flags |= FIF_PSPOLL;
  1650. - }
  1651. -
  1652. -- /*
  1653. -- * Check if there is any work left for us.
  1654. -- */
  1655. -- if (rt2x00dev->packet_filter == *total_flags)
  1656. -- return;
  1657. - rt2x00dev->packet_filter = *total_flags;
  1658. -
  1659. - rt2x00dev->ops->lib->config_filter(rt2x00dev, *total_flags);
  1660. ---- a/drivers/net/wireless/ralink/rt2x00/rt61pci.c
  1661. -+++ b/drivers/net/wireless/ralink/rt2x00/rt61pci.c
  1662. -@@ -530,8 +530,10 @@ static void rt61pci_config_filter(struct
  1663. - !(filter_flags & FIF_PLCPFAIL));
  1664. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_CONTROL,
  1665. - !(filter_flags & (FIF_CONTROL | FIF_PSPOLL)));
  1666. -- rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME, 1);
  1667. -+ rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME,
  1668. -+ !rt2x00dev->is_monitoring);
  1669. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_TO_DS,
  1670. -+ !rt2x00dev->is_monitoring &&
  1671. - !rt2x00dev->intf_ap_count);
  1672. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_VERSION_ERROR, 1);
  1673. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_MULTICAST,
  1674. ---- a/drivers/net/wireless/ralink/rt2x00/rt73usb.c
  1675. -+++ b/drivers/net/wireless/ralink/rt2x00/rt73usb.c
  1676. -@@ -480,8 +480,10 @@ static void rt73usb_config_filter(struct
  1677. - !(filter_flags & FIF_PLCPFAIL));
  1678. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_CONTROL,
  1679. - !(filter_flags & (FIF_CONTROL | FIF_PSPOLL)));
  1680. -- rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME, 1);
  1681. -+ rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME,
  1682. -+ !rt2x00dev->is_monitoring);
  1683. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_TO_DS,
  1684. -+ !rt2x00dev->is_monitoring &&
  1685. - !rt2x00dev->intf_ap_count);
  1686. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_VERSION_ERROR, 1);
  1687. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_MULTICAST,
  1688. diff --git a/package/kernel/mac80211/patches/304-ath10k-Ensure-peer_map-references-are-cleaned-up.patch b/package/kernel/mac80211/patches/304-ath10k-Ensure-peer_map-references-are-cleaned-up.patch
  1689. new file mode 100644
  1690. index 0000000..7dec1fb
  1691. --- /dev/null
  1692. +++ b/package/kernel/mac80211/patches/304-ath10k-Ensure-peer_map-references-are-cleaned-up.patch
  1693. @@ -0,0 +1,60 @@
  1694. +From: Ben Greear <greearb@candelatech.com>
  1695. +Date: Fri, 1 Apr 2016 14:12:09 -0700
  1696. +Subject: [PATCH] ath10k: Ensure peer_map references are cleaned up.
  1697. +
  1698. +While debugging OS crashes due to firmware crashes, I enabled
  1699. +kasan, and it noticed that peer objects were being used-after-freed.
  1700. +
  1701. +Looks like there are two places we could be leaving stale references
  1702. +in the peer-map, so clean that up.
  1703. +
  1704. +Signed-off-by: Ben Greear <greearb@candelatech.com>
  1705. +---
  1706. +
  1707. +--- a/drivers/net/wireless/ath/ath10k/mac.c
  1708. ++++ b/drivers/net/wireless/ath/ath10k/mac.c
  1709. +@@ -802,6 +802,7 @@ static void ath10k_peer_cleanup(struct a
  1710. + {
  1711. + struct ath10k_peer *peer, *tmp;
  1712. + int peer_id;
  1713. ++ int i;
  1714. +
  1715. + lockdep_assert_held(&ar->conf_mutex);
  1716. +
  1717. +@@ -818,6 +819,17 @@ static void ath10k_peer_cleanup(struct a
  1718. + ar->peer_map[peer_id] = NULL;
  1719. + }
  1720. +
  1721. ++ /* Double check that peer is properly un-referenced from
  1722. ++ * the peer_map
  1723. ++ */
  1724. ++ for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) {
  1725. ++ if (ar->peer_map[i] == peer) {
  1726. ++ ath10k_warn(ar, "removing stale peer_map entry for %pM (ptr %p idx %d)\n",
  1727. ++ peer->addr, peer, i);
  1728. ++ ar->peer_map[i] = NULL;
  1729. ++ }
  1730. ++ }
  1731. ++
  1732. + list_del(&peer->list);
  1733. + kfree(peer);
  1734. + ar->num_peers--;
  1735. +@@ -828,6 +840,7 @@ static void ath10k_peer_cleanup(struct a
  1736. + static void ath10k_peer_cleanup_all(struct ath10k *ar)
  1737. + {
  1738. + struct ath10k_peer *peer, *tmp;
  1739. ++ int i;
  1740. +
  1741. + lockdep_assert_held(&ar->conf_mutex);
  1742. +
  1743. +@@ -836,6 +849,10 @@ static void ath10k_peer_cleanup_all(stru
  1744. + list_del(&peer->list);
  1745. + kfree(peer);
  1746. + }
  1747. ++
  1748. ++ for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++)
  1749. ++ ar->peer_map[i] = NULL;
  1750. ++
  1751. + spin_unlock_bh(&ar->data_lock);
  1752. +
  1753. + ar->num_peers = 0;
  1754. diff --git a/package/kernel/mac80211/patches/304-ath9k-avoid-ANI-restart-if-no-trigger.patch b/package/kernel/mac80211/patches/304-ath9k-avoid-ANI-restart-if-no-trigger.patch
  1755. deleted file mode 100644
  1756. index 049059a..0000000
  1757. --- a/package/kernel/mac80211/patches/304-ath9k-avoid-ANI-restart-if-no-trigger.patch
  1758. +++ /dev/null
  1759. @@ -1,32 +0,0 @@
  1760. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  1761. -Date: Fri, 15 Jan 2016 18:17:17 +0800
  1762. -Subject: [PATCH] ath9k: avoid ANI restart if no trigger
  1763. -
  1764. -Fixes commit 54da20d83f0e ("ath9k_hw: improve ANI processing and rx desensitizing parameters")
  1765. -
  1766. -Call ath9k_ani_restart() only when the phy error rate reach the
  1767. -ANI immunity threshold. Sync the logic with internal code base.
  1768. -
  1769. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  1770. ----
  1771. -
  1772. ---- a/drivers/net/wireless/ath/ath9k/ani.c
  1773. -+++ b/drivers/net/wireless/ath/ath9k/ani.c
  1774. -@@ -444,14 +444,16 @@ void ath9k_hw_ani_monitor(struct ath_hw
  1775. - ofdmPhyErrRate < ah->config.ofdm_trig_low) {
  1776. - ath9k_hw_ani_lower_immunity(ah);
  1777. - aniState->ofdmsTurn = !aniState->ofdmsTurn;
  1778. -+ ath9k_ani_restart(ah);
  1779. - } else if (ofdmPhyErrRate > ah->config.ofdm_trig_high) {
  1780. - ath9k_hw_ani_ofdm_err_trigger(ah);
  1781. - aniState->ofdmsTurn = false;
  1782. -+ ath9k_ani_restart(ah);
  1783. - } else if (cckPhyErrRate > ah->config.cck_trig_high) {
  1784. - ath9k_hw_ani_cck_err_trigger(ah);
  1785. - aniState->ofdmsTurn = true;
  1786. -+ ath9k_ani_restart(ah);
  1787. - }
  1788. -- ath9k_ani_restart(ah);
  1789. - }
  1790. - }
  1791. - EXPORT_SYMBOL(ath9k_hw_ani_monitor);
  1792. diff --git a/package/kernel/mac80211/patches/305-ath10k-Clean-up-peer-when-sta-goes-away.patch b/package/kernel/mac80211/patches/305-ath10k-Clean-up-peer-when-sta-goes-away.patch
  1793. new file mode 100644
  1794. index 0000000..7248a8c
  1795. --- /dev/null
  1796. +++ b/package/kernel/mac80211/patches/305-ath10k-Clean-up-peer-when-sta-goes-away.patch
  1797. @@ -0,0 +1,32 @@
  1798. +From: Ben Greear <greearb@candelatech.com>
  1799. +Date: Fri, 1 Apr 2016 14:12:11 -0700
  1800. +Subject: [PATCH] ath10k: Clean up peer when sta goes away.
  1801. +
  1802. +If WMI and/or firmware has issues removing the peer object,
  1803. +then we still need to clean up the peer object in the driver.
  1804. +
  1805. +Signed-off-by: Ben Greear <greearb@candelatech.com>
  1806. +---
  1807. +
  1808. +--- a/drivers/net/wireless/ath/ath10k/mac.c
  1809. ++++ b/drivers/net/wireless/ath/ath10k/mac.c
  1810. +@@ -5992,9 +5992,17 @@ static int ath10k_sta_state(struct ieee8
  1811. + continue;
  1812. +
  1813. + if (peer->sta == sta) {
  1814. +- ath10k_warn(ar, "found sta peer %pM entry on vdev %i after it was supposedly removed\n",
  1815. +- sta->addr, arvif->vdev_id);
  1816. ++ ath10k_warn(ar, "found sta peer %pM (ptr %p id %d) entry on vdev %i after it was supposedly removed\n",
  1817. ++ sta->addr, peer, i, arvif->vdev_id);
  1818. + peer->sta = NULL;
  1819. ++
  1820. ++ /* Clean up the peer object as well since we
  1821. ++ * must have failed to do this above.
  1822. ++ */
  1823. ++ list_del(&peer->list);
  1824. ++ ar->peer_map[i] = NULL;
  1825. ++ kfree(peer);
  1826. ++ ar->num_peers--;
  1827. + }
  1828. + }
  1829. + spin_unlock_bh(&ar->data_lock);
  1830. diff --git a/package/kernel/mac80211/patches/305-ath9k-clean-up-ANI-per-channel-pointer-checking.patch b/package/kernel/mac80211/patches/305-ath9k-clean-up-ANI-per-channel-pointer-checking.patch
  1831. deleted file mode 100644
  1832. index a1ac67c..0000000
  1833. --- a/package/kernel/mac80211/patches/305-ath9k-clean-up-ANI-per-channel-pointer-checking.patch
  1834. +++ /dev/null
  1835. @@ -1,91 +0,0 @@
  1836. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  1837. -Date: Fri, 15 Jan 2016 18:17:18 +0800
  1838. -Subject: [PATCH] ath9k: clean up ANI per-channel pointer checking
  1839. -
  1840. -commit c24bd3620c50 ("ath9k: Do not maintain ANI state per-channel")
  1841. -removed per-channel handling, the code to check 'curchan' also
  1842. -should be removed as never used.
  1843. -
  1844. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  1845. ----
  1846. -
  1847. ---- a/drivers/net/wireless/ath/ath9k/ani.c
  1848. -+++ b/drivers/net/wireless/ath/ath9k/ani.c
  1849. -@@ -126,12 +126,8 @@ static void ath9k_hw_update_mibstats(str
  1850. -
  1851. - static void ath9k_ani_restart(struct ath_hw *ah)
  1852. - {
  1853. -- struct ar5416AniState *aniState;
  1854. --
  1855. -- if (!ah->curchan)
  1856. -- return;
  1857. -+ struct ar5416AniState *aniState = &ah->ani;
  1858. -
  1859. -- aniState = &ah->ani;
  1860. - aniState->listenTime = 0;
  1861. -
  1862. - ENABLE_REGWRITE_BUFFER(ah);
  1863. -@@ -221,12 +217,7 @@ static void ath9k_hw_set_ofdm_nil(struct
  1864. -
  1865. - static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hw *ah)
  1866. - {
  1867. -- struct ar5416AniState *aniState;
  1868. --
  1869. -- if (!ah->curchan)
  1870. -- return;
  1871. --
  1872. -- aniState = &ah->ani;
  1873. -+ struct ar5416AniState *aniState = &ah->ani;
  1874. -
  1875. - if (aniState->ofdmNoiseImmunityLevel < ATH9K_ANI_OFDM_MAX_LEVEL)
  1876. - ath9k_hw_set_ofdm_nil(ah, aniState->ofdmNoiseImmunityLevel + 1, false);
  1877. -@@ -281,12 +272,7 @@ static void ath9k_hw_set_cck_nil(struct
  1878. -
  1879. - static void ath9k_hw_ani_cck_err_trigger(struct ath_hw *ah)
  1880. - {
  1881. -- struct ar5416AniState *aniState;
  1882. --
  1883. -- if (!ah->curchan)
  1884. -- return;
  1885. --
  1886. -- aniState = &ah->ani;
  1887. -+ struct ar5416AniState *aniState = &ah->ani;
  1888. -
  1889. - if (aniState->cckNoiseImmunityLevel < ATH9K_ANI_CCK_MAX_LEVEL)
  1890. - ath9k_hw_set_cck_nil(ah, aniState->cckNoiseImmunityLevel + 1,
  1891. -@@ -299,9 +285,7 @@ static void ath9k_hw_ani_cck_err_trigger
  1892. - */
  1893. - static void ath9k_hw_ani_lower_immunity(struct ath_hw *ah)
  1894. - {
  1895. -- struct ar5416AniState *aniState;
  1896. --
  1897. -- aniState = &ah->ani;
  1898. -+ struct ar5416AniState *aniState = &ah->ani;
  1899. -
  1900. - /* lower OFDM noise immunity */
  1901. - if (aniState->ofdmNoiseImmunityLevel > 0 &&
  1902. -@@ -329,7 +313,7 @@ void ath9k_ani_reset(struct ath_hw *ah,
  1903. - struct ath_common *common = ath9k_hw_common(ah);
  1904. - int ofdm_nil, cck_nil;
  1905. -
  1906. -- if (!ah->curchan)
  1907. -+ if (!chan)
  1908. - return;
  1909. -
  1910. - BUG_ON(aniState == NULL);
  1911. -@@ -416,14 +400,10 @@ static bool ath9k_hw_ani_read_counters(s
  1912. -
  1913. - void ath9k_hw_ani_monitor(struct ath_hw *ah, struct ath9k_channel *chan)
  1914. - {
  1915. -- struct ar5416AniState *aniState;
  1916. -+ struct ar5416AniState *aniState = &ah->ani;
  1917. - struct ath_common *common = ath9k_hw_common(ah);
  1918. - u32 ofdmPhyErrRate, cckPhyErrRate;
  1919. -
  1920. -- if (!ah->curchan)
  1921. -- return;
  1922. --
  1923. -- aniState = &ah->ani;
  1924. - if (!ath9k_hw_ani_read_counters(ah))
  1925. - return;
  1926. -
  1927. diff --git a/package/kernel/mac80211/patches/306-ath9k-do-not-reset-while-BB-panic-0x4000409-on-ar956.patch b/package/kernel/mac80211/patches/306-ath9k-do-not-reset-while-BB-panic-0x4000409-on-ar956.patch
  1928. deleted file mode 100644
  1929. index cf8194a..0000000
  1930. --- a/package/kernel/mac80211/patches/306-ath9k-do-not-reset-while-BB-panic-0x4000409-on-ar956.patch
  1931. +++ /dev/null
  1932. @@ -1,31 +0,0 @@
  1933. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  1934. -Date: Fri, 15 Jan 2016 18:17:19 +0800
  1935. -Subject: [PATCH] ath9k: do not reset while BB panic(0x4000409) on ar9561
  1936. -
  1937. -BB panic(0x4000409) observed while AP enabling/disabling
  1938. -bursting.
  1939. -
  1940. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  1941. ----
  1942. -
  1943. ---- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  1944. -+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  1945. -@@ -2071,7 +2071,8 @@ void ar9003_hw_attach_phy_ops(struct ath
  1946. - * to be disabled.
  1947. - *
  1948. - * 0x04000409: Packet stuck on receive.
  1949. -- * Full chip reset is required for all chips except AR9340.
  1950. -+ * Full chip reset is required for all chips except
  1951. -+ * AR9340, AR9531 and AR9561.
  1952. - */
  1953. -
  1954. - /*
  1955. -@@ -2100,7 +2101,7 @@ bool ar9003_hw_bb_watchdog_check(struct
  1956. - case 0x04000b09:
  1957. - return true;
  1958. - case 0x04000409:
  1959. -- if (AR_SREV_9340(ah) || AR_SREV_9531(ah))
  1960. -+ if (AR_SREV_9340(ah) || AR_SREV_9531(ah) || AR_SREV_9561(ah))
  1961. - return false;
  1962. - else
  1963. - return true;
  1964. diff --git a/package/kernel/mac80211/patches/306-mac80211-add-hdrlen-to-ieee80211_tx_data.patch b/package/kernel/mac80211/patches/306-mac80211-add-hdrlen-to-ieee80211_tx_data.patch
  1965. new file mode 100644
  1966. index 0000000..4a8f143
  1967. --- /dev/null
  1968. +++ b/package/kernel/mac80211/patches/306-mac80211-add-hdrlen-to-ieee80211_tx_data.patch
  1969. @@ -0,0 +1,203 @@
  1970. +From: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  1971. +Date: Fri, 19 Feb 2016 11:01:49 +0100
  1972. +Subject: [PATCH] mac80211: add hdrlen to ieee80211_tx_data
  1973. +
  1974. +Add hdrlen to ieee80211_tx_data and use this
  1975. +when wep/ccmd/tkip. This is preparation for
  1976. +aligned4 code.
  1977. +
  1978. +Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  1979. +---
  1980. +
  1981. +--- a/net/mac80211/ieee80211_i.h
  1982. ++++ b/net/mac80211/ieee80211_i.h
  1983. +@@ -173,6 +173,7 @@ struct ieee80211_tx_data {
  1984. + struct ieee80211_tx_rate rate;
  1985. +
  1986. + unsigned int flags;
  1987. ++ unsigned int hdrlen;
  1988. + };
  1989. +
  1990. +
  1991. +--- a/net/mac80211/tx.c
  1992. ++++ b/net/mac80211/tx.c
  1993. +@@ -922,7 +922,7 @@ ieee80211_tx_h_fragment(struct ieee80211
  1994. + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  1995. + struct ieee80211_hdr *hdr = (void *)skb->data;
  1996. + int frag_threshold = tx->local->hw.wiphy->frag_threshold;
  1997. +- int hdrlen;
  1998. ++ int hdrlen = tx->hdrlen;
  1999. + int fragnum;
  2000. +
  2001. + /* no matter what happens, tx->skb moves to tx->skbs */
  2002. +@@ -943,8 +943,6 @@ ieee80211_tx_h_fragment(struct ieee80211
  2003. + if (WARN_ON(info->flags & IEEE80211_TX_CTL_AMPDU))
  2004. + return TX_DROP;
  2005. +
  2006. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2007. +-
  2008. + /* internal error, why isn't DONTFRAG set? */
  2009. + if (WARN_ON(skb->len + FCS_LEN <= frag_threshold))
  2010. + return TX_DROP;
  2011. +@@ -1176,6 +1174,8 @@ ieee80211_tx_prepare(struct ieee80211_su
  2012. +
  2013. + hdr = (struct ieee80211_hdr *) skb->data;
  2014. +
  2015. ++ tx->hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2016. ++
  2017. + if (likely(sta)) {
  2018. + if (!IS_ERR(sta))
  2019. + tx->sta = sta;
  2020. +--- a/net/mac80211/util.c
  2021. ++++ b/net/mac80211/util.c
  2022. +@@ -1226,6 +1226,7 @@ void ieee80211_send_auth(struct ieee8021
  2023. + struct ieee80211_local *local = sdata->local;
  2024. + struct sk_buff *skb;
  2025. + struct ieee80211_mgmt *mgmt;
  2026. ++ unsigned int hdrlen;
  2027. + int err;
  2028. +
  2029. + /* 24 + 6 = header + auth_algo + auth_transaction + status_code */
  2030. +@@ -1250,8 +1251,10 @@ void ieee80211_send_auth(struct ieee8021
  2031. + memcpy(skb_put(skb, extra_len), extra, extra_len);
  2032. +
  2033. + if (auth_alg == WLAN_AUTH_SHARED_KEY && transaction == 3) {
  2034. ++ hdrlen = ieee80211_hdrlen(mgmt->frame_control);
  2035. + mgmt->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
  2036. +- err = ieee80211_wep_encrypt(local, skb, key, key_len, key_idx);
  2037. ++ err = ieee80211_wep_encrypt(local, skb, hdrlen, key,
  2038. ++ key_len, key_idx);
  2039. + WARN_ON(err);
  2040. + }
  2041. +
  2042. +--- a/net/mac80211/wep.c
  2043. ++++ b/net/mac80211/wep.c
  2044. +@@ -89,11 +89,11 @@ static void ieee80211_wep_get_iv(struct
  2045. +
  2046. + static u8 *ieee80211_wep_add_iv(struct ieee80211_local *local,
  2047. + struct sk_buff *skb,
  2048. ++ unsigned int hdrlen,
  2049. + int keylen, int keyidx)
  2050. + {
  2051. + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  2052. + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  2053. +- unsigned int hdrlen;
  2054. + u8 *newhdr;
  2055. +
  2056. + hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
  2057. +@@ -101,7 +101,6 @@ static u8 *ieee80211_wep_add_iv(struct i
  2058. + if (WARN_ON(skb_headroom(skb) < IEEE80211_WEP_IV_LEN))
  2059. + return NULL;
  2060. +
  2061. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2062. + newhdr = skb_push(skb, IEEE80211_WEP_IV_LEN);
  2063. + memmove(newhdr, newhdr + IEEE80211_WEP_IV_LEN, hdrlen);
  2064. +
  2065. +@@ -160,6 +159,7 @@ int ieee80211_wep_encrypt_data(struct cr
  2066. + */
  2067. + int ieee80211_wep_encrypt(struct ieee80211_local *local,
  2068. + struct sk_buff *skb,
  2069. ++ unsigned int hdrlen,
  2070. + const u8 *key, int keylen, int keyidx)
  2071. + {
  2072. + u8 *iv;
  2073. +@@ -169,7 +169,7 @@ int ieee80211_wep_encrypt(struct ieee802
  2074. + if (WARN_ON(skb_tailroom(skb) < IEEE80211_WEP_ICV_LEN))
  2075. + return -1;
  2076. +
  2077. +- iv = ieee80211_wep_add_iv(local, skb, keylen, keyidx);
  2078. ++ iv = ieee80211_wep_add_iv(local, skb, hdrlen, keylen, keyidx);
  2079. + if (!iv)
  2080. + return -1;
  2081. +
  2082. +@@ -306,13 +306,14 @@ static int wep_encrypt_skb(struct ieee80
  2083. + struct ieee80211_key_conf *hw_key = info->control.hw_key;
  2084. +
  2085. + if (!hw_key) {
  2086. +- if (ieee80211_wep_encrypt(tx->local, skb, tx->key->conf.key,
  2087. ++ if (ieee80211_wep_encrypt(tx->local, skb, tx->hdrlen,
  2088. ++ tx->key->conf.key,
  2089. + tx->key->conf.keylen,
  2090. + tx->key->conf.keyidx))
  2091. + return -1;
  2092. + } else if ((hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV) ||
  2093. + (hw_key->flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE)) {
  2094. +- if (!ieee80211_wep_add_iv(tx->local, skb,
  2095. ++ if (!ieee80211_wep_add_iv(tx->local, skb, tx->hdrlen,
  2096. + tx->key->conf.keylen,
  2097. + tx->key->conf.keyidx))
  2098. + return -1;
  2099. +--- a/net/mac80211/wep.h
  2100. ++++ b/net/mac80211/wep.h
  2101. +@@ -22,6 +22,7 @@ int ieee80211_wep_encrypt_data(struct cr
  2102. + size_t klen, u8 *data, size_t data_len);
  2103. + int ieee80211_wep_encrypt(struct ieee80211_local *local,
  2104. + struct sk_buff *skb,
  2105. ++ unsigned int hdrlen,
  2106. + const u8 *key, int keylen, int keyidx);
  2107. + int ieee80211_wep_decrypt_data(struct crypto_cipher *tfm, u8 *rc4key,
  2108. + size_t klen, u8 *data, size_t data_len);
  2109. +--- a/net/mac80211/wpa.c
  2110. ++++ b/net/mac80211/wpa.c
  2111. +@@ -43,7 +43,7 @@ ieee80211_tx_h_michael_mic_add(struct ie
  2112. + skb->len < 24 || !ieee80211_is_data_present(hdr->frame_control))
  2113. + return TX_CONTINUE;
  2114. +
  2115. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2116. ++ hdrlen = tx->hdrlen;
  2117. + if (skb->len < hdrlen)
  2118. + return TX_DROP;
  2119. +
  2120. +@@ -186,7 +186,6 @@ mic_fail_no_key:
  2121. +
  2122. + static int tkip_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
  2123. + {
  2124. +- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
  2125. + struct ieee80211_key *key = tx->key;
  2126. + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  2127. + unsigned int hdrlen;
  2128. +@@ -201,7 +200,7 @@ static int tkip_encrypt_skb(struct ieee8
  2129. + return 0;
  2130. + }
  2131. +
  2132. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2133. ++ hdrlen = tx->hdrlen;
  2134. + len = skb->len - hdrlen;
  2135. +
  2136. + if (info->control.hw_key)
  2137. +@@ -418,7 +417,7 @@ static int ccmp_encrypt_skb(struct ieee8
  2138. + return 0;
  2139. + }
  2140. +
  2141. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2142. ++ hdrlen = tx->hdrlen;
  2143. + len = skb->len - hdrlen;
  2144. +
  2145. + if (info->control.hw_key)
  2146. +@@ -651,7 +650,7 @@ static int gcmp_encrypt_skb(struct ieee8
  2147. + return 0;
  2148. + }
  2149. +
  2150. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2151. ++ hdrlen = tx->hdrlen;
  2152. + len = skb->len - hdrlen;
  2153. +
  2154. + if (info->control.hw_key)
  2155. +@@ -791,7 +790,6 @@ static ieee80211_tx_result
  2156. + ieee80211_crypto_cs_encrypt(struct ieee80211_tx_data *tx,
  2157. + struct sk_buff *skb)
  2158. + {
  2159. +- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  2160. + struct ieee80211_key *key = tx->key;
  2161. + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  2162. + int hdrlen;
  2163. +@@ -807,8 +805,7 @@ ieee80211_crypto_cs_encrypt(struct ieee8
  2164. + pskb_expand_head(skb, iv_len, 0, GFP_ATOMIC)))
  2165. + return TX_DROP;
  2166. +
  2167. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2168. +-
  2169. ++ hdrlen = tx->hdrlen;
  2170. + pos = skb_push(skb, iv_len);
  2171. + memmove(pos, pos + iv_len, hdrlen);
  2172. +
  2173. diff --git a/package/kernel/mac80211/patches/307-ath9k-fix-inconsistent-use-of-tab-and-space-in-inden.patch b/package/kernel/mac80211/patches/307-ath9k-fix-inconsistent-use-of-tab-and-space-in-inden.patch
  2174. deleted file mode 100644
  2175. index 80b781c..0000000
  2176. --- a/package/kernel/mac80211/patches/307-ath9k-fix-inconsistent-use-of-tab-and-space-in-inden.patch
  2177. +++ /dev/null
  2178. @@ -1,27 +0,0 @@
  2179. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  2180. -Date: Fri, 15 Jan 2016 18:17:20 +0800
  2181. -Subject: [PATCH] ath9k: fix inconsistent use of tab and space in
  2182. - indentation
  2183. -
  2184. -Minor changes for indenting.
  2185. -
  2186. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  2187. ----
  2188. -
  2189. ---- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
  2190. -+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
  2191. -@@ -5485,11 +5485,11 @@ unsigned int ar9003_get_paprd_scale_fact
  2192. - AR9300_PAPRD_SCALE_1);
  2193. - else {
  2194. - if (chan->channel >= 5700)
  2195. -- return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt20),
  2196. -- AR9300_PAPRD_SCALE_1);
  2197. -+ return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt20),
  2198. -+ AR9300_PAPRD_SCALE_1);
  2199. - else if (chan->channel >= 5400)
  2200. - return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt40),
  2201. -- AR9300_PAPRD_SCALE_2);
  2202. -+ AR9300_PAPRD_SCALE_2);
  2203. - else
  2204. - return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt40),
  2205. - AR9300_PAPRD_SCALE_1);
  2206. diff --git a/package/kernel/mac80211/patches/307-mac80211-add-NEED_ALIGNED4_SKBS-hw-flag.patch b/package/kernel/mac80211/patches/307-mac80211-add-NEED_ALIGNED4_SKBS-hw-flag.patch
  2207. new file mode 100644
  2208. index 0000000..eeb881e
  2209. --- /dev/null
  2210. +++ b/package/kernel/mac80211/patches/307-mac80211-add-NEED_ALIGNED4_SKBS-hw-flag.patch
  2211. @@ -0,0 +1,235 @@
  2212. +From: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  2213. +Date: Fri, 19 Feb 2016 11:01:50 +0100
  2214. +Subject: [PATCH] mac80211: add NEED_ALIGNED4_SKBS hw flag
  2215. +
  2216. +HW/driver should set NEED_ALIGNED4_SKBS flag in case
  2217. +require aligned skbs to four-byte boundaries.
  2218. +This affect only TX direction.
  2219. +
  2220. +Padding is added after ieee80211_hdr, before IV/LLC.
  2221. +
  2222. +Before we have to do memmove(hdrlen) twice in the
  2223. +dirver. Once before we pass this to HW and next
  2224. +in tx completion (to be sure monitor will report
  2225. +this tx frame correctly).
  2226. +
  2227. +With this patch we can skip this memmove() and save CPU.
  2228. +
  2229. +Currently this was tested with ath9k, both hw/sw crypt for
  2230. +wep/tkip/ccmp.
  2231. +
  2232. +Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  2233. +---
  2234. +
  2235. +--- a/include/net/mac80211.h
  2236. ++++ b/include/net/mac80211.h
  2237. +@@ -2014,6 +2014,9 @@ struct ieee80211_txq {
  2238. + * @IEEE80211_HW_TX_FRAG_LIST: Hardware (or driver) supports sending frag_list
  2239. + * skbs, needed for zero-copy software A-MSDU.
  2240. + *
  2241. ++ * @IEEE80211_HW_NEEDS_ALIGNED4_SKBS: Driver need aligned skbs to four-byte.
  2242. ++ * Padding will be added after ieee80211_hdr, before IV/LLC.
  2243. ++ *
  2244. + * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
  2245. + */
  2246. + enum ieee80211_hw_flags {
  2247. +@@ -2054,6 +2057,7 @@ enum ieee80211_hw_flags {
  2248. + IEEE80211_HW_USES_RSS,
  2249. + IEEE80211_HW_TX_AMSDU,
  2250. + IEEE80211_HW_TX_FRAG_LIST,
  2251. ++ IEEE80211_HW_NEEDS_ALIGNED4_SKBS,
  2252. +
  2253. + /* keep last, obviously */
  2254. + NUM_IEEE80211_HW_FLAGS
  2255. +--- a/net/mac80211/debugfs.c
  2256. ++++ b/net/mac80211/debugfs.c
  2257. +@@ -302,6 +302,7 @@ static const char *hw_flag_names[] = {
  2258. + FLAG(USES_RSS),
  2259. + FLAG(TX_AMSDU),
  2260. + FLAG(TX_FRAG_LIST),
  2261. ++ FLAG(NEEDS_ALIGNED4_SKBS),
  2262. + #undef FLAG
  2263. + };
  2264. +
  2265. +--- a/net/mac80211/ieee80211_i.h
  2266. ++++ b/net/mac80211/ieee80211_i.h
  2267. +@@ -1497,6 +1497,29 @@ ieee80211_have_rx_timestamp(struct ieee8
  2268. + return false;
  2269. + }
  2270. +
  2271. ++static inline unsigned int
  2272. ++ieee80211_hdr_padsize(struct ieee80211_hw *hw, unsigned int hdrlen)
  2273. ++{
  2274. ++ /*
  2275. ++ * While hdrlen is already aligned to two-byte boundaries,
  2276. ++ * simple check with & 2 will return correct padsize.
  2277. ++ */
  2278. ++ if (ieee80211_hw_check(hw, NEEDS_ALIGNED4_SKBS))
  2279. ++ return hdrlen & 2;
  2280. ++ return 0;
  2281. ++}
  2282. ++
  2283. ++static inline unsigned int
  2284. ++ieee80211_padded_hdrlen(struct ieee80211_hw *hw, __le16 fc)
  2285. ++{
  2286. ++ unsigned int hdrlen;
  2287. ++
  2288. ++ hdrlen = ieee80211_hdrlen(fc);
  2289. ++ hdrlen += ieee80211_hdr_padsize(hw, hdrlen);
  2290. ++
  2291. ++ return hdrlen;
  2292. ++}
  2293. ++
  2294. + u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local,
  2295. + struct ieee80211_rx_status *status,
  2296. + unsigned int mpdu_len,
  2297. +--- a/net/mac80211/sta_info.h
  2298. ++++ b/net/mac80211/sta_info.h
  2299. +@@ -279,7 +279,7 @@ struct ieee80211_fast_tx {
  2300. + u8 hdr_len;
  2301. + u8 sa_offs, da_offs, pn_offs;
  2302. + u8 band;
  2303. +- u8 hdr[30 + 2 + IEEE80211_FAST_XMIT_MAX_IV +
  2304. ++ u8 hdr[30 + 2 + 2 + IEEE80211_FAST_XMIT_MAX_IV +
  2305. + sizeof(rfc1042_header)] __aligned(2);
  2306. +
  2307. + struct rcu_head rcu_head;
  2308. +--- a/net/mac80211/status.c
  2309. ++++ b/net/mac80211/status.c
  2310. +@@ -683,9 +683,22 @@ void ieee80211_tx_monitor(struct ieee802
  2311. + struct sk_buff *skb2;
  2312. + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  2313. + struct ieee80211_sub_if_data *sdata;
  2314. ++ struct ieee80211_hdr *hdr = (void *)skb->data;
  2315. + struct net_device *prev_dev = NULL;
  2316. ++ unsigned int hdrlen, padsize;
  2317. + int rtap_len;
  2318. +
  2319. ++ /* Remove padding if was added */
  2320. ++ if (ieee80211_hw_check(&local->hw, NEEDS_ALIGNED4_SKBS)) {
  2321. ++ hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2322. ++ padsize = ieee80211_hdr_padsize(&local->hw, hdrlen);
  2323. ++
  2324. ++ if (padsize && skb->len > hdrlen + padsize) {
  2325. ++ memmove(skb->data + padsize, skb->data, hdrlen);
  2326. ++ skb_pull(skb, padsize);
  2327. ++ }
  2328. ++ }
  2329. ++
  2330. + /* send frame to monitor interfaces now */
  2331. + rtap_len = ieee80211_tx_radiotap_len(info);
  2332. + if (WARN_ON_ONCE(skb_headroom(skb) < rtap_len)) {
  2333. +--- a/net/mac80211/tkip.c
  2334. ++++ b/net/mac80211/tkip.c
  2335. +@@ -201,10 +201,12 @@ void ieee80211_get_tkip_p2k(struct ieee8
  2336. + {
  2337. + struct ieee80211_key *key = (struct ieee80211_key *)
  2338. + container_of(keyconf, struct ieee80211_key, conf);
  2339. ++ struct ieee80211_hw *hw = &key->local->hw;
  2340. + const u8 *tk = &key->conf.key[NL80211_TKIP_DATA_OFFSET_ENCR_KEY];
  2341. + struct tkip_ctx *ctx = &key->u.tkip.tx;
  2342. + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  2343. +- const u8 *data = (u8 *)hdr + ieee80211_hdrlen(hdr->frame_control);
  2344. ++ const u8 *data = (u8 *)hdr + ieee80211_padded_hdrlen(hw,
  2345. ++ hdr->frame_control);
  2346. + u32 iv32 = get_unaligned_le32(&data[4]);
  2347. + u16 iv16 = data[2] | (data[0] << 8);
  2348. +
  2349. +--- a/net/mac80211/tx.c
  2350. ++++ b/net/mac80211/tx.c
  2351. +@@ -1173,8 +1173,7 @@ ieee80211_tx_prepare(struct ieee80211_su
  2352. + info->flags &= ~IEEE80211_TX_INTFL_NEED_TXPROCESSING;
  2353. +
  2354. + hdr = (struct ieee80211_hdr *) skb->data;
  2355. +-
  2356. +- tx->hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2357. ++ tx->hdrlen = ieee80211_padded_hdrlen(&local->hw, hdr->frame_control);
  2358. +
  2359. + if (likely(sta)) {
  2360. + if (!IS_ERR(sta))
  2361. +@@ -2108,7 +2107,7 @@ netdev_tx_t ieee80211_monitor_start_xmit
  2362. + goto fail;
  2363. +
  2364. + hdr = (struct ieee80211_hdr *)(skb->data + len_rthdr);
  2365. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2366. ++ hdrlen = ieee80211_padded_hdrlen(&local->hw, hdr->frame_control);
  2367. +
  2368. + if (skb->len < len_rthdr + hdrlen)
  2369. + goto fail;
  2370. +@@ -2334,7 +2333,7 @@ static struct sk_buff *ieee80211_build_h
  2371. + struct ieee80211_chanctx_conf *chanctx_conf;
  2372. + struct ieee80211_sub_if_data *ap_sdata;
  2373. + enum nl80211_band band;
  2374. +- int ret;
  2375. ++ int padsize, ret;
  2376. +
  2377. + if (IS_ERR(sta))
  2378. + sta = NULL;
  2379. +@@ -2554,6 +2553,9 @@ static struct sk_buff *ieee80211_build_h
  2380. + hdrlen += 2;
  2381. + }
  2382. +
  2383. ++ /* Check aligned4 skb required */
  2384. ++ padsize = ieee80211_hdr_padsize(&sdata->local->hw, hdrlen);
  2385. ++
  2386. + /*
  2387. + * Drop unicast frames to unauthorised stations unless they are
  2388. + * EAPOL frames from the local station.
  2389. +@@ -2640,6 +2642,7 @@ static struct sk_buff *ieee80211_build_h
  2390. + h_pos -= skip_header_bytes;
  2391. +
  2392. + head_need = hdrlen + encaps_len + meshhdrlen - skb_headroom(skb);
  2393. ++ head_need += padsize;
  2394. +
  2395. + /*
  2396. + * So we need to modify the skb header and hence need a copy of
  2397. +@@ -2678,6 +2681,9 @@ static struct sk_buff *ieee80211_build_h
  2398. + }
  2399. + #endif
  2400. +
  2401. ++ if (padsize)
  2402. ++ memset(skb_push(skb, padsize), 0, padsize);
  2403. ++
  2404. + if (ieee80211_is_data_qos(fc)) {
  2405. + __le16 *qos_control;
  2406. +
  2407. +@@ -2691,8 +2697,8 @@ static struct sk_buff *ieee80211_build_h
  2408. + } else
  2409. + memcpy(skb_push(skb, hdrlen), &hdr, hdrlen);
  2410. +
  2411. +- nh_pos += hdrlen;
  2412. +- h_pos += hdrlen;
  2413. ++ nh_pos += hdrlen + padsize;
  2414. ++ h_pos += hdrlen + padsize;
  2415. +
  2416. + /* Update skb pointers to various headers since this modified frame
  2417. + * is going to go through Linux networking code that may potentially
  2418. +@@ -2861,6 +2867,9 @@ void ieee80211_check_fast_xmit(struct st
  2419. + fc |= cpu_to_le16(IEEE80211_STYPE_QOS_DATA);
  2420. + }
  2421. +
  2422. ++ /* Check aligned4 skb required */
  2423. ++ build.hdr_len += ieee80211_hdr_padsize(&local->hw, build.hdr_len);
  2424. ++
  2425. + /* We store the key here so there's no point in using rcu_dereference()
  2426. + * but that's fine because the code that changes the pointers will call
  2427. + * this function after doing so. For a single CPU that would be enough,
  2428. +--- a/net/mac80211/util.c
  2429. ++++ b/net/mac80211/util.c
  2430. +@@ -1224,6 +1224,7 @@ void ieee80211_send_auth(struct ieee8021
  2431. + u32 tx_flags)
  2432. + {
  2433. + struct ieee80211_local *local = sdata->local;
  2434. ++ struct ieee80211_hw *hw = &local->hw;
  2435. + struct sk_buff *skb;
  2436. + struct ieee80211_mgmt *mgmt;
  2437. + unsigned int hdrlen;
  2438. +@@ -1251,7 +1252,7 @@ void ieee80211_send_auth(struct ieee8021
  2439. + memcpy(skb_put(skb, extra_len), extra, extra_len);
  2440. +
  2441. + if (auth_alg == WLAN_AUTH_SHARED_KEY && transaction == 3) {
  2442. +- hdrlen = ieee80211_hdrlen(mgmt->frame_control);
  2443. ++ hdrlen = ieee80211_padded_hdrlen(hw, mgmt->frame_control);
  2444. + mgmt->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
  2445. + err = ieee80211_wep_encrypt(local, skb, hdrlen, key,
  2446. + key_len, key_idx);
  2447. diff --git a/package/kernel/mac80211/patches/308-ath10k-Fix-sending-NULL-Qos-NULL-data-frames-for-QCA.patch b/package/kernel/mac80211/patches/308-ath10k-Fix-sending-NULL-Qos-NULL-data-frames-for-QCA.patch
  2448. new file mode 100644
  2449. index 0000000..8590aad
  2450. --- /dev/null
  2451. +++ b/package/kernel/mac80211/patches/308-ath10k-Fix-sending-NULL-Qos-NULL-data-frames-for-QCA.patch
  2452. @@ -0,0 +1,72 @@
  2453. +From: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
  2454. +Date: Thu, 23 Jun 2016 22:10:01 +0530
  2455. +Subject: [PATCH] ath10k: Fix sending NULL/ Qos NULL data frames for
  2456. + QCA99X0 and later
  2457. +
  2458. +For chipsets like QCA99X0, IPQ4019 and later we are not getting proper
  2459. +NULL func status (always acked/successs !!) when hostapd does a
  2460. +PROBE_CLIENT via nullfunc frames when the station is powered off
  2461. +abruptly (inactive timer probes client via null func after the inactive
  2462. +time reaches beyond the threshold). Fix this by disabling the workaround
  2463. +(getting the ACK status of NULL func frames by sending via HTT mgmt-tx
  2464. + path) introduced by the change ("ath10k: fix beacon loss handling ")
  2465. +for QCA99X0 and later chipsets. The normal tx path provides the proper
  2466. +ACK status for NULL data frames. As of now disable this workaround for
  2467. +chipsets QCA99X0 and later, once the 10.1 firmware is obselete we can
  2468. +completely get rid of this workaround for all the chipsets
  2469. +
  2470. +Signed-off-by: Tamizh chelvam <c_traja@qti.qualcomm.com>
  2471. +Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
  2472. +---
  2473. +
  2474. +--- a/drivers/net/wireless/ath/ath10k/core.c
  2475. ++++ b/drivers/net/wireless/ath/ath10k/core.c
  2476. +@@ -181,6 +181,7 @@ static const struct ath10k_hw_params ath
  2477. + .board = QCA99X0_HW_2_0_BOARD_DATA_FILE,
  2478. + .board_size = QCA99X0_BOARD_DATA_SZ,
  2479. + .board_ext_size = QCA99X0_BOARD_EXT_DATA_SZ,
  2480. ++ .disable_null_func_workaround = true,
  2481. + },
  2482. + },
  2483. + {
  2484. +@@ -204,6 +205,7 @@ static const struct ath10k_hw_params ath
  2485. + .board = QCA9984_HW_1_0_BOARD_DATA_FILE,
  2486. + .board_size = QCA99X0_BOARD_DATA_SZ,
  2487. + .board_ext_size = QCA99X0_BOARD_EXT_DATA_SZ,
  2488. ++ .disable_null_func_workaround = true,
  2489. + },
  2490. + },
  2491. + {
  2492. +@@ -262,6 +264,7 @@ static const struct ath10k_hw_params ath
  2493. + .board = QCA4019_HW_1_0_BOARD_DATA_FILE,
  2494. + .board_size = QCA4019_BOARD_DATA_SZ,
  2495. + .board_ext_size = QCA4019_BOARD_EXT_DATA_SZ,
  2496. ++ .disable_null_func_workaround = true,
  2497. + },
  2498. + },
  2499. + };
  2500. +--- a/drivers/net/wireless/ath/ath10k/core.h
  2501. ++++ b/drivers/net/wireless/ath/ath10k/core.h
  2502. +@@ -750,6 +750,12 @@ struct ath10k {
  2503. + const char *board;
  2504. + size_t board_size;
  2505. + size_t board_ext_size;
  2506. ++ /* Workaround of sending NULL data frames via
  2507. ++ * HTT mgmt TX and getting the proper ACK status does
  2508. ++ * not works for chipsets QCA99X0 and later, while
  2509. ++ * Tx data path reports the ACK status properly.
  2510. ++ */
  2511. ++ bool disable_null_func_workaround;
  2512. + } fw;
  2513. + } hw_params;
  2514. +
  2515. +--- a/drivers/net/wireless/ath/ath10k/mac.c
  2516. ++++ b/drivers/net/wireless/ath/ath10k/mac.c
  2517. +@@ -3253,6 +3253,7 @@ ath10k_mac_tx_h_get_txmode(struct ath10k
  2518. + * mode though because AP don't sleep.
  2519. + */
  2520. + if (ar->htt.target_version_major < 3 &&
  2521. ++ !ar->hw_params.fw.disable_null_func_workaround &&
  2522. + (ieee80211_is_nullfunc(fc) || ieee80211_is_qos_nullfunc(fc)) &&
  2523. + !test_bit(ATH10K_FW_FEATURE_HAS_WMI_MGMT_TX,
  2524. + ar->running_fw->fw_file.fw_features))
  2525. diff --git a/package/kernel/mac80211/patches/308-ath9k-fix-data-bus-error-on-ar9300-and-ar9580.patch b/package/kernel/mac80211/patches/308-ath9k-fix-data-bus-error-on-ar9300-and-ar9580.patch
  2526. deleted file mode 100644
  2527. index d408866..0000000
  2528. --- a/package/kernel/mac80211/patches/308-ath9k-fix-data-bus-error-on-ar9300-and-ar9580.patch
  2529. +++ /dev/null
  2530. @@ -1,65 +0,0 @@
  2531. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  2532. -Date: Fri, 15 Jan 2016 18:17:21 +0800
  2533. -Subject: [PATCH] ath9k: fix data bus error on ar9300 and ar9580
  2534. -
  2535. -One crash issue be found on ar9300: RTC_RC reg read leads crash, leading
  2536. -the data bus error, due to RTC_RC reg write not happen properly.
  2537. -
  2538. -Warm Reset trigger in continuous beacon stuck for one of the customer for
  2539. -other chip, noticed the MAC was stuck in RTC reset. After analysis noticed
  2540. -DMA did not complete when RTC was put in reset.
  2541. -
  2542. -So, before resetting the MAC need to make sure there are no pending DMA
  2543. -transactions because this reset does not reset all parts of the chip.
  2544. -
  2545. -The 12th and 11th bit of MAC _DMA_CFG register used to do that.
  2546. - 12 cfg_halt_ack 0x0
  2547. - 0 DMA has not yet halted
  2548. - 1 DMA has halted
  2549. - 11 cfg_halt_req 0x0
  2550. - 0 DMA logic operates normally
  2551. - 1 Request DMA logic to stop so software can reset the MAC
  2552. -
  2553. -The Bit [12] of this register indicates when the halt has taken effect or
  2554. -not. the DMA halt IS NOT recoverable; once software sets bit [11] to
  2555. -request a DMA halt, software must wait for bit [12] to be set and reset
  2556. -the MAC.
  2557. -
  2558. -So, the same thing we implemented for ar9580 chip.
  2559. -
  2560. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  2561. ----
  2562. -
  2563. ---- a/drivers/net/wireless/ath/ath9k/hw.c
  2564. -+++ b/drivers/net/wireless/ath/ath9k/hw.c
  2565. -@@ -1368,6 +1368,16 @@ static bool ath9k_hw_set_reset(struct at
  2566. - if (ath9k_hw_mci_is_enabled(ah))
  2567. - ar9003_mci_check_gpm_offset(ah);
  2568. -
  2569. -+ /* DMA HALT added to resolve ar9300 and ar9580 bus error during
  2570. -+ * RTC_RC reg read
  2571. -+ */
  2572. -+ if (AR_SREV_9300(ah) || AR_SREV_9580(ah)) {
  2573. -+ REG_SET_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  2574. -+ ath9k_hw_wait(ah, AR_CFG, AR_CFG_HALT_ACK, AR_CFG_HALT_ACK,
  2575. -+ 20 * AH_WAIT_TIMEOUT);
  2576. -+ REG_CLR_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  2577. -+ }
  2578. -+
  2579. - REG_WRITE(ah, AR_RTC_RC, rst_flags);
  2580. -
  2581. - REGWRITE_BUFFER_FLUSH(ah);
  2582. ---- a/drivers/net/wireless/ath/ath9k/reg.h
  2583. -+++ b/drivers/net/wireless/ath/ath9k/reg.h
  2584. -@@ -34,8 +34,10 @@
  2585. - #define AR_CFG_SWRG 0x00000010
  2586. - #define AR_CFG_AP_ADHOC_INDICATION 0x00000020
  2587. - #define AR_CFG_PHOK 0x00000100
  2588. --#define AR_CFG_CLK_GATE_DIS 0x00000400
  2589. - #define AR_CFG_EEBS 0x00000200
  2590. -+#define AR_CFG_CLK_GATE_DIS 0x00000400
  2591. -+#define AR_CFG_HALT_REQ 0x00000800
  2592. -+#define AR_CFG_HALT_ACK 0x00001000
  2593. - #define AR_CFG_PCI_MASTER_REQ_Q_THRESH 0x00060000
  2594. - #define AR_CFG_PCI_MASTER_REQ_Q_THRESH_S 17
  2595. -
  2596. diff --git a/package/kernel/mac80211/patches/309-01-brcmfmac-add-missing-include.patch b/package/kernel/mac80211/patches/309-01-brcmfmac-add-missing-include.patch
  2597. deleted file mode 100644
  2598. index d9511c8..0000000
  2599. --- a/package/kernel/mac80211/patches/309-01-brcmfmac-add-missing-include.patch
  2600. +++ /dev/null
  2601. @@ -1,19 +0,0 @@
  2602. -From: Felix Fietkau <nbd@openwrt.org>
  2603. -Date: Fri, 15 Jan 2016 15:59:45 +0100
  2604. -Subject: [PATCH] brcmfmac: add missing include
  2605. -
  2606. -linux/module.h is required for defining module parameters
  2607. -
  2608. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  2609. ----
  2610. -
  2611. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  2612. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  2613. -@@ -17,6 +17,7 @@
  2614. - #include <linux/kernel.h>
  2615. - #include <linux/string.h>
  2616. - #include <linux/netdevice.h>
  2617. -+#include <linux/module.h>
  2618. - #include <brcmu_wifi.h>
  2619. - #include <brcmu_utils.h>
  2620. - #include "core.h"
  2621. diff --git a/package/kernel/mac80211/patches/309-02-brcmfmac-fix-sdio-sg-table-alloc-crash.patch b/package/kernel/mac80211/patches/309-02-brcmfmac-fix-sdio-sg-table-alloc-crash.patch
  2622. deleted file mode 100644
  2623. index 711e019..0000000
  2624. --- a/package/kernel/mac80211/patches/309-02-brcmfmac-fix-sdio-sg-table-alloc-crash.patch
  2625. +++ /dev/null
  2626. @@ -1,118 +0,0 @@
  2627. -From: Hante Meuleman <meuleman@broadcom.com>
  2628. -Date: Tue, 19 Jan 2016 12:39:24 +0100
  2629. -Subject: [PATCH] brcmfmac: fix sdio sg table alloc crash
  2630. -
  2631. -With commit 7d34b0560567 ("brcmfmac: Move all module parameters to
  2632. -one place") a bug was introduced causing a null pointer exception.
  2633. -This patch fixes the bug by initializing the sg table till after
  2634. -the settings have been initialized.
  2635. -
  2636. -Fixes: 7d34b0560567 ("brcmfmac: Move all module parameters to one place")
  2637. -Reported-by: Marc Zyngier <marc.zyngier@arm.com>
  2638. -Tested-by: Marc Zyngier <marc.zyngier@arm.com>
  2639. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  2640. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  2641. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  2642. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  2643. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  2644. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  2645. ----
  2646. -
  2647. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  2648. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  2649. -@@ -879,11 +879,24 @@ int brcmf_sdiod_abort(struct brcmf_sdio_
  2650. - return 0;
  2651. - }
  2652. -
  2653. --static void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev)
  2654. -+void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev)
  2655. - {
  2656. -+ struct sdio_func *func;
  2657. -+ struct mmc_host *host;
  2658. -+ uint max_blocks;
  2659. - uint nents;
  2660. - int err;
  2661. -
  2662. -+ func = sdiodev->func[2];
  2663. -+ host = func->card->host;
  2664. -+ sdiodev->sg_support = host->max_segs > 1;
  2665. -+ max_blocks = min_t(uint, host->max_blk_count, 511u);
  2666. -+ sdiodev->max_request_size = min_t(uint, host->max_req_size,
  2667. -+ max_blocks * func->cur_blksize);
  2668. -+ sdiodev->max_segment_count = min_t(uint, host->max_segs,
  2669. -+ SG_MAX_SINGLE_ALLOC);
  2670. -+ sdiodev->max_segment_size = host->max_seg_size;
  2671. -+
  2672. - if (!sdiodev->sg_support)
  2673. - return;
  2674. -
  2675. -@@ -1021,9 +1034,6 @@ static void brcmf_sdiod_host_fixup(struc
  2676. -
  2677. - static int brcmf_sdiod_probe(struct brcmf_sdio_dev *sdiodev)
  2678. - {
  2679. -- struct sdio_func *func;
  2680. -- struct mmc_host *host;
  2681. -- uint max_blocks;
  2682. - int ret = 0;
  2683. -
  2684. - sdiodev->num_funcs = 2;
  2685. -@@ -1054,26 +1064,6 @@ static int brcmf_sdiod_probe(struct brcm
  2686. - goto out;
  2687. - }
  2688. -
  2689. -- /*
  2690. -- * determine host related variables after brcmf_sdiod_probe()
  2691. -- * as func->cur_blksize is properly set and F2 init has been
  2692. -- * completed successfully.
  2693. -- */
  2694. -- func = sdiodev->func[2];
  2695. -- host = func->card->host;
  2696. -- sdiodev->sg_support = host->max_segs > 1;
  2697. -- max_blocks = min_t(uint, host->max_blk_count, 511u);
  2698. -- sdiodev->max_request_size = min_t(uint, host->max_req_size,
  2699. -- max_blocks * func->cur_blksize);
  2700. -- sdiodev->max_segment_count = min_t(uint, host->max_segs,
  2701. -- SG_MAX_SINGLE_ALLOC);
  2702. -- sdiodev->max_segment_size = host->max_seg_size;
  2703. --
  2704. -- /* allocate scatter-gather table. sg support
  2705. -- * will be disabled upon allocation failure.
  2706. -- */
  2707. -- brcmf_sdiod_sgtable_alloc(sdiodev);
  2708. --
  2709. - ret = brcmf_sdiod_freezer_attach(sdiodev);
  2710. - if (ret)
  2711. - goto out;
  2712. -@@ -1084,7 +1074,7 @@ static int brcmf_sdiod_probe(struct brcm
  2713. - ret = -ENODEV;
  2714. - goto out;
  2715. - }
  2716. -- brcmf_sdiod_host_fixup(host);
  2717. -+ brcmf_sdiod_host_fixup(sdiodev->func[2]->card->host);
  2718. - out:
  2719. - if (ret)
  2720. - brcmf_sdiod_remove(sdiodev);
  2721. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  2722. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  2723. -@@ -4114,6 +4114,11 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
  2724. - goto fail;
  2725. - }
  2726. -
  2727. -+ /* allocate scatter-gather table. sg support
  2728. -+ * will be disabled upon allocation failure.
  2729. -+ */
  2730. -+ brcmf_sdiod_sgtable_alloc(bus->sdiodev);
  2731. -+
  2732. - /* Query the F2 block size, set roundup accordingly */
  2733. - bus->blocksize = bus->sdiodev->func[2]->cur_blksize;
  2734. - bus->roundup = min(max_roundup, bus->blocksize);
  2735. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
  2736. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
  2737. -@@ -342,6 +342,7 @@ int brcmf_sdiod_ramrw(struct brcmf_sdio_
  2738. -
  2739. - /* Issue an abort to the specified function */
  2740. - int brcmf_sdiod_abort(struct brcmf_sdio_dev *sdiodev, uint fn);
  2741. -+void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev);
  2742. - void brcmf_sdiod_change_state(struct brcmf_sdio_dev *sdiodev,
  2743. - enum brcmf_sdiod_state state);
  2744. - #ifdef CONFIG_PM_SLEEP
  2745. diff --git a/package/kernel/mac80211/patches/309-cfg80211-fix-proto-in-ieee80211_data_to_8023-for-fra.patch b/package/kernel/mac80211/patches/309-cfg80211-fix-proto-in-ieee80211_data_to_8023-for-fra.patch
  2746. new file mode 100644
  2747. index 0000000..41c27ca
  2748. --- /dev/null
  2749. +++ b/package/kernel/mac80211/patches/309-cfg80211-fix-proto-in-ieee80211_data_to_8023-for-fra.patch
  2750. @@ -0,0 +1,37 @@
  2751. +From: Felix Fietkau <nbd@nbd.name>
  2752. +Date: Wed, 29 Jun 2016 10:02:32 +0200
  2753. +Subject: [PATCH] cfg80211: fix proto in ieee80211_data_to_8023 for frames
  2754. + without LLC header
  2755. +
  2756. +The PDU length of incoming LLC frames is set to the total skb payload size
  2757. +in __ieee80211_data_to_8023() of net/wireless/util.c which incorrectly
  2758. +includes the length of the IEEE 802.11 header.
  2759. +
  2760. +The resulting LLC frame header has a too large PDU length, causing the
  2761. +llc_fixup_skb() function of net/llc/llc_input.c to reject the incoming
  2762. +skb, effectively breaking STP.
  2763. +
  2764. +Solve the problem by properly substracting the IEEE 802.11 frame header size
  2765. +from the PDU length, allowing the LLC processor to pick up the incoming
  2766. +control messages.
  2767. +
  2768. +Special thanks to Gerry Rozema for tracking down the regression and proposing
  2769. +a suitable patch.
  2770. +
  2771. +Fixes: 2d1c304cb2d5 ("cfg80211: add function for 802.3 conversion with separate output buffer")
  2772. +Cc: stable@vger.kernel.org
  2773. +Reported-by: Gerry Rozema <gerryr@rozeware.com>
  2774. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  2775. +---
  2776. +
  2777. +--- a/net/wireless/util.c
  2778. ++++ b/net/wireless/util.c
  2779. +@@ -509,7 +509,7 @@ static int __ieee80211_data_to_8023(stru
  2780. + * replace EtherType */
  2781. + hdrlen += ETH_ALEN + 2;
  2782. + else
  2783. +- tmp.h_proto = htons(skb->len);
  2784. ++ tmp.h_proto = htons(skb->len - hdrlen);
  2785. +
  2786. + pskb_pull(skb, hdrlen);
  2787. +
  2788. diff --git a/package/kernel/mac80211/patches/310-ath9k_hw-ignore-eeprom-magic-mismatch-on-flash-based.patch b/package/kernel/mac80211/patches/310-ath9k_hw-ignore-eeprom-magic-mismatch-on-flash-based.patch
  2789. deleted file mode 100644
  2790. index 287d6e1..0000000
  2791. --- a/package/kernel/mac80211/patches/310-ath9k_hw-ignore-eeprom-magic-mismatch-on-flash-based.patch
  2792. +++ /dev/null
  2793. @@ -1,38 +0,0 @@
  2794. -From: Felix Fietkau <nbd@openwrt.org>
  2795. -Date: Thu, 21 Jan 2016 16:28:44 +0100
  2796. -Subject: [PATCH] ath9k_hw: ignore eeprom magic mismatch on flash based devices
  2797. -
  2798. -Many AR913x based devices (maybe others too) do not have a valid EEPROM
  2799. -magic in their calibration data partition.
  2800. -
  2801. -Fixes: 6fa658fd5ab2 ("ath9k: Simplify and fix eeprom endianness swapping")
  2802. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  2803. ----
  2804. -
  2805. ---- a/drivers/net/wireless/ath/ath9k/eeprom.c
  2806. -+++ b/drivers/net/wireless/ath/ath9k/eeprom.c
  2807. -@@ -150,18 +150,18 @@ int ath9k_hw_nvram_swap_data(struct ath_
  2808. - return -EIO;
  2809. - }
  2810. -
  2811. -- if (magic == AR5416_EEPROM_MAGIC) {
  2812. -- *swap_needed = false;
  2813. -- } else if (swab16(magic) == AR5416_EEPROM_MAGIC) {
  2814. -+ *swap_needed = false;
  2815. -+ if (swab16(magic) == AR5416_EEPROM_MAGIC) {
  2816. - if (ah->ah_flags & AH_NO_EEP_SWAP) {
  2817. - ath_info(common,
  2818. - "Ignoring endianness difference in EEPROM magic bytes.\n");
  2819. --
  2820. -- *swap_needed = false;
  2821. - } else {
  2822. - *swap_needed = true;
  2823. - }
  2824. -- } else {
  2825. -+ } else if (magic != AR5416_EEPROM_MAGIC) {
  2826. -+ if (ath9k_hw_use_flash(ah))
  2827. -+ return 0;
  2828. -+
  2829. - ath_err(common,
  2830. - "Invalid EEPROM Magic (0x%04x).\n", magic);
  2831. - return -EINVAL;
  2832. diff --git a/package/kernel/mac80211/patches/310-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch b/package/kernel/mac80211/patches/310-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch
  2833. new file mode 100644
  2834. index 0000000..25929c9
  2835. --- /dev/null
  2836. +++ b/package/kernel/mac80211/patches/310-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch
  2837. @@ -0,0 +1,81 @@
  2838. +From: Chaitanya T K <chaitanya.mgit@gmail.com>
  2839. +Date: Mon, 27 Jun 2016 15:23:26 +0530
  2840. +Subject: [PATCH] mac80211: minstrel: Enable STBC and LDPC for VHT Rates
  2841. +
  2842. +If peer support reception of STBC and LDPC, enable them for better
  2843. +performance.
  2844. +
  2845. +Signed-off-by: Chaitanya TK <chaitanya.mgit@gmail.com>
  2846. +---
  2847. +
  2848. +--- a/include/linux/ieee80211.h
  2849. ++++ b/include/linux/ieee80211.h
  2850. +@@ -1550,6 +1550,7 @@ struct ieee80211_vht_operation {
  2851. + #define IEEE80211_VHT_CAP_RXSTBC_3 0x00000300
  2852. + #define IEEE80211_VHT_CAP_RXSTBC_4 0x00000400
  2853. + #define IEEE80211_VHT_CAP_RXSTBC_MASK 0x00000700
  2854. ++#define IEEE80211_VHT_CAP_RXSTBC_SHIFT 8
  2855. + #define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800
  2856. + #define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000
  2857. + #define IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT 13
  2858. +--- a/net/mac80211/rc80211_minstrel_ht.c
  2859. ++++ b/net/mac80211/rc80211_minstrel_ht.c
  2860. +@@ -1166,13 +1166,14 @@ minstrel_ht_update_caps(void *priv, stru
  2861. + struct minstrel_ht_sta_priv *msp = priv_sta;
  2862. + struct minstrel_ht_sta *mi = &msp->ht;
  2863. + struct ieee80211_mcs_info *mcs = &sta->ht_cap.mcs;
  2864. +- u16 sta_cap = sta->ht_cap.cap;
  2865. ++ u16 ht_cap = sta->ht_cap.cap;
  2866. + struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap;
  2867. + int use_vht;
  2868. + int n_supported = 0;
  2869. + int ack_dur;
  2870. + int stbc;
  2871. + int i;
  2872. ++ bool ldpc = false;
  2873. +
  2874. + /* fall back to the old minstrel for legacy stations */
  2875. + if (!sta->ht_cap.ht_supported)
  2876. +@@ -1210,16 +1211,24 @@ minstrel_ht_update_caps(void *priv, stru
  2877. + }
  2878. + mi->sample_tries = 4;
  2879. +
  2880. +- /* TODO tx_flags for vht - ATM the RC API is not fine-grained enough */
  2881. + if (!use_vht) {
  2882. +- stbc = (sta_cap & IEEE80211_HT_CAP_RX_STBC) >>
  2883. ++ stbc = (ht_cap & IEEE80211_HT_CAP_RX_STBC) >>
  2884. + IEEE80211_HT_CAP_RX_STBC_SHIFT;
  2885. +- mi->tx_flags |= stbc << IEEE80211_TX_CTL_STBC_SHIFT;
  2886. +
  2887. +- if (sta_cap & IEEE80211_HT_CAP_LDPC_CODING)
  2888. +- mi->tx_flags |= IEEE80211_TX_CTL_LDPC;
  2889. ++ if (ht_cap & IEEE80211_HT_CAP_LDPC_CODING)
  2890. ++ ldpc = true;
  2891. ++ } else {
  2892. ++ stbc = (vht_cap->cap & IEEE80211_VHT_CAP_RXSTBC_MASK) >>
  2893. ++ IEEE80211_VHT_CAP_RXSTBC_SHIFT;
  2894. ++
  2895. ++ if (vht_cap->cap & IEEE80211_VHT_CAP_RXLDPC)
  2896. ++ ldpc = true;
  2897. + }
  2898. +
  2899. ++ mi->tx_flags |= stbc << IEEE80211_TX_CTL_STBC_SHIFT;
  2900. ++ if (ldpc)
  2901. ++ mi->tx_flags |= IEEE80211_TX_CTL_LDPC;
  2902. ++
  2903. + for (i = 0; i < ARRAY_SIZE(mi->groups); i++) {
  2904. + u32 gflags = minstrel_mcs_groups[i].flags;
  2905. + int bw, nss;
  2906. +@@ -1232,10 +1241,10 @@ minstrel_ht_update_caps(void *priv, stru
  2907. +
  2908. + if (gflags & IEEE80211_TX_RC_SHORT_GI) {
  2909. + if (gflags & IEEE80211_TX_RC_40_MHZ_WIDTH) {
  2910. +- if (!(sta_cap & IEEE80211_HT_CAP_SGI_40))
  2911. ++ if (!(ht_cap & IEEE80211_HT_CAP_SGI_40))
  2912. + continue;
  2913. + } else {
  2914. +- if (!(sta_cap & IEEE80211_HT_CAP_SGI_20))
  2915. ++ if (!(ht_cap & IEEE80211_HT_CAP_SGI_20))
  2916. + continue;
  2917. + }
  2918. + }
  2919. diff --git a/package/kernel/mac80211/patches/311-ath10k-disable-wake_tx_queue-for-older-devices.patch b/package/kernel/mac80211/patches/311-ath10k-disable-wake_tx_queue-for-older-devices.patch
  2920. new file mode 100644
  2921. index 0000000..4cf26a6
  2922. --- /dev/null
  2923. +++ b/package/kernel/mac80211/patches/311-ath10k-disable-wake_tx_queue-for-older-devices.patch
  2924. @@ -0,0 +1,73 @@
  2925. +From: Michal Kazior <michal.kazior@tieto.com>
  2926. +Date: Tue, 17 May 2016 14:47:01 +0200
  2927. +Subject: [PATCH] ath10k: disable wake_tx_queue for older devices
  2928. +
  2929. +Some setups suffer performance regressions with
  2930. +current wake_tx_queue implementation.
  2931. +
  2932. +Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
  2933. +---
  2934. +
  2935. +--- a/drivers/net/wireless/ath/ath10k/core.h
  2936. ++++ b/drivers/net/wireless/ath/ath10k/core.h
  2937. +@@ -667,6 +667,7 @@ struct ath10k_fw_components {
  2938. + struct ath10k {
  2939. + struct ath_common ath_common;
  2940. + struct ieee80211_hw *hw;
  2941. ++ struct ieee80211_ops *ops;
  2942. + struct device *dev;
  2943. + u8 mac_addr[ETH_ALEN];
  2944. +
  2945. +--- a/drivers/net/wireless/ath/ath10k/mac.c
  2946. ++++ b/drivers/net/wireless/ath/ath10k/mac.c
  2947. +@@ -7497,21 +7497,32 @@ static const struct ieee80211_channel at
  2948. + struct ath10k *ath10k_mac_create(size_t priv_size)
  2949. + {
  2950. + struct ieee80211_hw *hw;
  2951. ++ struct ieee80211_ops *ops;
  2952. + struct ath10k *ar;
  2953. +
  2954. +- hw = ieee80211_alloc_hw(sizeof(struct ath10k) + priv_size, &ath10k_ops);
  2955. +- if (!hw)
  2956. ++ ops = kmemdup(&ath10k_ops, sizeof(ath10k_ops), GFP_KERNEL);
  2957. ++ if (!ops)
  2958. ++ return NULL;
  2959. ++
  2960. ++ hw = ieee80211_alloc_hw(sizeof(struct ath10k) + priv_size, ops);
  2961. ++ if (!hw) {
  2962. ++ kfree(ops);
  2963. + return NULL;
  2964. ++ }
  2965. +
  2966. + ar = hw->priv;
  2967. + ar->hw = hw;
  2968. ++ ar->ops = ops;
  2969. +
  2970. + return ar;
  2971. + }
  2972. +
  2973. + void ath10k_mac_destroy(struct ath10k *ar)
  2974. + {
  2975. ++ struct ieee80211_ops *ops = ar->ops;
  2976. ++
  2977. + ieee80211_free_hw(ar->hw);
  2978. ++ kfree(ops);
  2979. + }
  2980. +
  2981. + static const struct ieee80211_iface_limit ath10k_if_limits[] = {
  2982. +@@ -7945,6 +7956,15 @@ int ath10k_mac_register(struct ath10k *a
  2983. + ath10k_warn(ar, "failed to initialise DFS pattern detector\n");
  2984. + }
  2985. +
  2986. ++ /* Current wake_tx_queue implementation imposes a significant
  2987. ++ * performance penalty in some setups. The tx scheduling code needs
  2988. ++ * more work anyway so disable the wake_tx_queue unless firmware
  2989. ++ * supports the pull-push mechanism.
  2990. ++ */
  2991. ++ if (!test_bit(ATH10K_FW_FEATURE_PEER_FLOW_CONTROL,
  2992. ++ ar->running_fw->fw_file.fw_features))
  2993. ++ ar->ops->wake_tx_queue = NULL;
  2994. ++
  2995. + ret = ath_regd_init(&ar->ath_common.regulatory, ar->hw->wiphy,
  2996. + ath10k_reg_notifier);
  2997. + if (ret) {
  2998. diff --git a/package/kernel/mac80211/patches/311-ath9k-do-not-limit-the-number-of-DFS-interfaces-to-1.patch b/package/kernel/mac80211/patches/311-ath9k-do-not-limit-the-number-of-DFS-interfaces-to-1.patch
  2999. deleted file mode 100644
  3000. index 070efa9..0000000
  3001. --- a/package/kernel/mac80211/patches/311-ath9k-do-not-limit-the-number-of-DFS-interfaces-to-1.patch
  3002. +++ /dev/null
  3003. @@ -1,55 +0,0 @@
  3004. -From: Felix Fietkau <nbd@openwrt.org>
  3005. -Date: Fri, 22 Jan 2016 01:05:56 +0100
  3006. -Subject: [PATCH] ath9k: do not limit the number of DFS interfaces to 1
  3007. -
  3008. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  3009. ----
  3010. -
  3011. ---- a/drivers/net/wireless/ath/ath9k/init.c
  3012. -+++ b/drivers/net/wireless/ath/ath9k/init.c
  3013. -@@ -751,14 +751,6 @@ static const struct ieee80211_iface_comb
  3014. -
  3015. - #endif /* CPTCFG_ATH9K_CHANNEL_CONTEXT */
  3016. -
  3017. --static const struct ieee80211_iface_limit if_dfs_limits[] = {
  3018. -- { .max = 1, .types = BIT(NL80211_IFTYPE_AP) |
  3019. --#ifdef CPTCFG_MAC80211_MESH
  3020. -- BIT(NL80211_IFTYPE_MESH_POINT) |
  3021. --#endif
  3022. -- BIT(NL80211_IFTYPE_ADHOC) },
  3023. --};
  3024. --
  3025. - static const struct ieee80211_iface_combination if_comb[] = {
  3026. - {
  3027. - .limits = if_limits,
  3028. -@@ -766,6 +758,11 @@ static const struct ieee80211_iface_comb
  3029. - .max_interfaces = 2048,
  3030. - .num_different_channels = 1,
  3031. - .beacon_int_infra_match = true,
  3032. -+#ifdef CPTCFG_ATH9K_DFS_CERTIFIED
  3033. -+ .radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) |
  3034. -+ BIT(NL80211_CHAN_WIDTH_20) |
  3035. -+ BIT(NL80211_CHAN_WIDTH_40),
  3036. -+#endif
  3037. - },
  3038. - {
  3039. - .limits = wds_limits,
  3040. -@@ -774,18 +771,6 @@ static const struct ieee80211_iface_comb
  3041. - .num_different_channels = 1,
  3042. - .beacon_int_infra_match = true,
  3043. - },
  3044. --#ifdef CPTCFG_ATH9K_DFS_CERTIFIED
  3045. -- {
  3046. -- .limits = if_dfs_limits,
  3047. -- .n_limits = ARRAY_SIZE(if_dfs_limits),
  3048. -- .max_interfaces = 1,
  3049. -- .num_different_channels = 1,
  3050. -- .beacon_int_infra_match = true,
  3051. -- .radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) |
  3052. -- BIT(NL80211_CHAN_WIDTH_20) |
  3053. -- BIT(NL80211_CHAN_WIDTH_40),
  3054. -- }
  3055. --#endif
  3056. - };
  3057. -
  3058. - #ifdef CPTCFG_ATH9K_CHANNEL_CONTEXT
  3059. diff --git a/package/kernel/mac80211/patches/312-ath9k-Correct-TSF-adjustment-to-align-the-beacon-tim.patch b/package/kernel/mac80211/patches/312-ath9k-Correct-TSF-adjustment-to-align-the-beacon-tim.patch
  3060. new file mode 100644
  3061. index 0000000..df43105
  3062. --- /dev/null
  3063. +++ b/package/kernel/mac80211/patches/312-ath9k-Correct-TSF-adjustment-to-align-the-beacon-tim.patch
  3064. @@ -0,0 +1,45 @@
  3065. +From: Benjamin Berg <benjamin.berg@open-mesh.com>
  3066. +Date: Mon, 4 Jul 2016 14:37:20 +0200
  3067. +Subject: [PATCH] ath9k: Correct TSF adjustment to align the beacon time
  3068. + correctly
  3069. +
  3070. +Beacons were not send out at (timestamp % beacon_time == 0) for interfaces
  3071. +other than the primary one. To send out beacons with the correct timestamp
  3072. +according to 10.1.3.2 of the 802.11 standard the tsf_adjustment has to be
  3073. +set to the negative time difference instead of positive. This way the
  3074. +later beacons get corrected to have a lower (and similar) timestamp with
  3075. +regard to the beacon from slot 0.
  3076. +
  3077. +I am not aware about any issues that have been caused by this.
  3078. +
  3079. +Signed-off-by: Benjamin Berg <benjamin.berg@open-mesh.com>
  3080. +---
  3081. +
  3082. +--- a/drivers/net/wireless/ath/ath9k/beacon.c
  3083. ++++ b/drivers/net/wireless/ath/ath9k/beacon.c
  3084. +@@ -279,17 +279,21 @@ static void ath9k_set_tsfadjust(struct a
  3085. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  3086. + struct ath_vif *avp = (void *)vif->drv_priv;
  3087. + struct ath_beacon_config *cur_conf = &avp->chanctx->beacon;
  3088. +- u32 tsfadjust;
  3089. ++ s64 tsfadjust;
  3090. +
  3091. + if (avp->av_bslot == 0)
  3092. + return;
  3093. +
  3094. ++ /* tsf_adjust is added to the TSF value. We send out the beacon late,
  3095. ++ * so need to adjust the TSF starting point to be later in time (i.e.
  3096. ++ * the theoretical first beacon has a TSF of 0 after correction).
  3097. ++ */
  3098. + tsfadjust = cur_conf->beacon_interval * avp->av_bslot;
  3099. +- tsfadjust = TU_TO_USEC(tsfadjust) / ATH_BCBUF;
  3100. ++ tsfadjust = -TU_TO_USEC(tsfadjust) / ATH_BCBUF;
  3101. + avp->tsf_adjust = cpu_to_le64(tsfadjust);
  3102. +
  3103. +- ath_dbg(common, CONFIG, "tsfadjust is: %llu for bslot: %d\n",
  3104. +- (unsigned long long)tsfadjust, avp->av_bslot);
  3105. ++ ath_dbg(common, CONFIG, "tsfadjust is: %lld for bslot: %d\n",
  3106. ++ (signed long long)tsfadjust, avp->av_bslot);
  3107. + }
  3108. +
  3109. + bool ath9k_csa_is_finished(struct ath_softc *sc, struct ieee80211_vif *vif)
  3110. diff --git a/package/kernel/mac80211/patches/312-mac80211-fix-txq-queue-related-crashes.patch b/package/kernel/mac80211/patches/312-mac80211-fix-txq-queue-related-crashes.patch
  3111. deleted file mode 100644
  3112. index 61cafc7..0000000
  3113. --- a/package/kernel/mac80211/patches/312-mac80211-fix-txq-queue-related-crashes.patch
  3114. +++ /dev/null
  3115. @@ -1,27 +0,0 @@
  3116. -From: Michal Kazior <michal.kazior@tieto.com>
  3117. -Date: Thu, 21 Jan 2016 14:23:07 +0100
  3118. -Subject: [PATCH] mac80211: fix txq queue related crashes
  3119. -
  3120. -The driver can access the queue simultanously
  3121. -while mac80211 tears down the interface. Without
  3122. -spinlock protection this could lead to corrupting
  3123. -sk_buff_head and subsequently to an invalid
  3124. -pointer dereference.
  3125. -
  3126. -Fixes: ba8c3d6f16a1 ("mac80211: add an intermediate software queue implementation")
  3127. -Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
  3128. ----
  3129. -
  3130. ---- a/net/mac80211/iface.c
  3131. -+++ b/net/mac80211/iface.c
  3132. -@@ -977,7 +977,10 @@ static void ieee80211_do_stop(struct iee
  3133. - if (sdata->vif.txq) {
  3134. - struct txq_info *txqi = to_txq_info(sdata->vif.txq);
  3135. -
  3136. -+ spin_lock_bh(&txqi->queue.lock);
  3137. - ieee80211_purge_tx_queue(&local->hw, &txqi->queue);
  3138. -+ spin_unlock_bh(&txqi->queue.lock);
  3139. -+
  3140. - atomic_set(&sdata->txqs_len[txqi->txq.ac], 0);
  3141. - }
  3142. -
  3143. diff --git a/package/kernel/mac80211/patches/313-ath9k-Handle-channel-context-in-get_-set_-reset_tsf.patch b/package/kernel/mac80211/patches/313-ath9k-Handle-channel-context-in-get_-set_-reset_tsf.patch
  3144. new file mode 100644
  3145. index 0000000..ef0afbe
  3146. --- /dev/null
  3147. +++ b/package/kernel/mac80211/patches/313-ath9k-Handle-channel-context-in-get_-set_-reset_tsf.patch
  3148. @@ -0,0 +1,70 @@
  3149. +From: Benjamin Berg <benjamin.berg@open-mesh.com>
  3150. +Date: Mon, 4 Jul 2016 14:37:21 +0200
  3151. +Subject: [PATCH] ath9k: Handle channel context in get_/set_/reset_tsf
  3152. +
  3153. +The ath9k TSF handling routines need to be aware of the channel context that
  3154. +is being modified. With this change the TSF related values that are stored
  3155. +in each channel context will be correctly tracked and the harware will only
  3156. +be updated if the modified context is currently the active one.
  3157. +
  3158. +Without this change the TSF modifications done using these routines would
  3159. +for example be lost during a hardware reset as done by ath_complete_reset.
  3160. +
  3161. +Signed-off-by: Benjamin Berg <benjamin.berg@open-mesh.com>
  3162. +---
  3163. +
  3164. +--- a/drivers/net/wireless/ath/ath9k/main.c
  3165. ++++ b/drivers/net/wireless/ath/ath9k/main.c
  3166. +@@ -1823,11 +1823,18 @@ static void ath9k_bss_info_changed(struc
  3167. + static u64 ath9k_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
  3168. + {
  3169. + struct ath_softc *sc = hw->priv;
  3170. ++ struct ath_vif *avp = (void *)vif->drv_priv;
  3171. + u64 tsf;
  3172. +
  3173. + mutex_lock(&sc->mutex);
  3174. + ath9k_ps_wakeup(sc);
  3175. +- tsf = ath9k_hw_gettsf64(sc->sc_ah);
  3176. ++ /* Get current TSF either from HW or kernel time. */
  3177. ++ if (sc->cur_chan == avp->chanctx) {
  3178. ++ tsf = ath9k_hw_gettsf64(sc->sc_ah);
  3179. ++ } else {
  3180. ++ tsf = sc->cur_chan->tsf_val +
  3181. ++ ath9k_hw_get_tsf_offset(&sc->cur_chan->tsf_ts, NULL);
  3182. ++ }
  3183. + ath9k_ps_restore(sc);
  3184. + mutex_unlock(&sc->mutex);
  3185. +
  3186. +@@ -1839,10 +1846,14 @@ static void ath9k_set_tsf(struct ieee802
  3187. + u64 tsf)
  3188. + {
  3189. + struct ath_softc *sc = hw->priv;
  3190. ++ struct ath_vif *avp = (void *)vif->drv_priv;
  3191. +
  3192. + mutex_lock(&sc->mutex);
  3193. + ath9k_ps_wakeup(sc);
  3194. +- ath9k_hw_settsf64(sc->sc_ah, tsf);
  3195. ++ getrawmonotonic(&avp->chanctx->tsf_ts);
  3196. ++ if (sc->cur_chan == avp->chanctx)
  3197. ++ ath9k_hw_settsf64(sc->sc_ah, tsf);
  3198. ++ avp->chanctx->tsf_val = tsf;
  3199. + ath9k_ps_restore(sc);
  3200. + mutex_unlock(&sc->mutex);
  3201. + }
  3202. +@@ -1850,11 +1861,15 @@ static void ath9k_set_tsf(struct ieee802
  3203. + static void ath9k_reset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
  3204. + {
  3205. + struct ath_softc *sc = hw->priv;
  3206. ++ struct ath_vif *avp = (void *)vif->drv_priv;
  3207. +
  3208. + mutex_lock(&sc->mutex);
  3209. +
  3210. + ath9k_ps_wakeup(sc);
  3211. +- ath9k_hw_reset_tsf(sc->sc_ah);
  3212. ++ getrawmonotonic(&avp->chanctx->tsf_ts);
  3213. ++ if (sc->cur_chan == avp->chanctx)
  3214. ++ ath9k_hw_reset_tsf(sc->sc_ah);
  3215. ++ avp->chanctx->tsf_val = 0;
  3216. + ath9k_ps_restore(sc);
  3217. +
  3218. + mutex_unlock(&sc->mutex);
  3219. diff --git a/package/kernel/mac80211/patches/313-mac80211-fix-unnecessary-frame-drops-in-mesh-fwding.patch b/package/kernel/mac80211/patches/313-mac80211-fix-unnecessary-frame-drops-in-mesh-fwding.patch
  3220. deleted file mode 100644
  3221. index 844d43b..0000000
  3222. --- a/package/kernel/mac80211/patches/313-mac80211-fix-unnecessary-frame-drops-in-mesh-fwding.patch
  3223. +++ /dev/null
  3224. @@ -1,57 +0,0 @@
  3225. -From: Michal Kazior <michal.kazior@tieto.com>
  3226. -Date: Mon, 25 Jan 2016 14:43:24 +0100
  3227. -Subject: [PATCH] mac80211: fix unnecessary frame drops in mesh fwding
  3228. -
  3229. -The ieee80211_queue_stopped() expects hw queue
  3230. -number but it was given raw WMM AC number instead.
  3231. -
  3232. -This could cause frame drops and problems with
  3233. -traffic in some cases - most notably if driver
  3234. -doesn't map AC numbers to queue numbers 1:1 and
  3235. -uses ieee80211_stop_queues() and
  3236. -ieee80211_wake_queue() only without ever calling
  3237. -ieee80211_wake_queues().
  3238. -
  3239. -On ath10k it was possible to hit this problem in
  3240. -the following case:
  3241. -
  3242. - 1. wlan0 uses queue 0
  3243. - (ath10k maps queues per vif)
  3244. - 2. offchannel uses queue 15
  3245. - 3. queues 1-14 are unused
  3246. - 4. ieee80211_stop_queues()
  3247. - 5. ieee80211_wake_queue(q=0)
  3248. - 6. ieee80211_wake_queue(q=15)
  3249. - (other queues are not woken up because both
  3250. - driver and mac80211 know other queues are
  3251. - unused)
  3252. - 7. ieee80211_rx_h_mesh_fwding()
  3253. - 8. ieee80211_select_queue_80211() returns 2
  3254. - 9. ieee80211_queue_stopped(q=2) returns true
  3255. - 10. frame is dropped (oops!)
  3256. -
  3257. -Fixes: d3c1597b8d1b ("mac80211: fix forwarded mesh frame queue mapping")
  3258. -Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
  3259. ----
  3260. -
  3261. ---- a/net/mac80211/rx.c
  3262. -+++ b/net/mac80211/rx.c
  3263. -@@ -2235,7 +2235,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
  3264. - struct ieee80211_local *local = rx->local;
  3265. - struct ieee80211_sub_if_data *sdata = rx->sdata;
  3266. - struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
  3267. -- u16 q, hdrlen;
  3268. -+ u16 ac, q, hdrlen;
  3269. -
  3270. - hdr = (struct ieee80211_hdr *) skb->data;
  3271. - hdrlen = ieee80211_hdrlen(hdr->frame_control);
  3272. -@@ -2304,7 +2304,8 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
  3273. - ether_addr_equal(sdata->vif.addr, hdr->addr3))
  3274. - return RX_CONTINUE;
  3275. -
  3276. -- q = ieee80211_select_queue_80211(sdata, skb, hdr);
  3277. -+ ac = ieee80211_select_queue_80211(sdata, skb, hdr);
  3278. -+ q = sdata->vif.hw_queue[ac];
  3279. - if (ieee80211_queue_stopped(&local->hw, q)) {
  3280. - IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_congestion);
  3281. - return RX_DROP_MONITOR;
  3282. diff --git a/package/kernel/mac80211/patches/314-ath9k-Use-tsf-offset-helper-in-ath9k_hw_reset.patch b/package/kernel/mac80211/patches/314-ath9k-Use-tsf-offset-helper-in-ath9k_hw_reset.patch
  3283. new file mode 100644
  3284. index 0000000..e725a8b
  3285. --- /dev/null
  3286. +++ b/package/kernel/mac80211/patches/314-ath9k-Use-tsf-offset-helper-in-ath9k_hw_reset.patch
  3287. @@ -0,0 +1,65 @@
  3288. +From: Benjamin Berg <benjamin.berg@open-mesh.com>
  3289. +Date: Mon, 4 Jul 2016 14:37:22 +0200
  3290. +Subject: [PATCH] ath9k: Use tsf offset helper in ath9k_hw_reset
  3291. +
  3292. +These changes make ath9k_hw_reset more consistent with other places that
  3293. +handle the TSF value by using the same helper routine.
  3294. +
  3295. +A slight improvement is to not assume that a fixed time of 1.5ms has
  3296. +passed for the initval writes when compared to the first write attempt.
  3297. +Instead the TSF value is re-calculated which will yield a higher accuracy
  3298. +of the restored TSF timer.
  3299. +
  3300. +Signed-off-by: Benjamin Berg <benjamin.berg@open-mesh.com>
  3301. +---
  3302. +
  3303. +--- a/drivers/net/wireless/ath/ath9k/hw.c
  3304. ++++ b/drivers/net/wireless/ath/ath9k/hw.c
  3305. +@@ -1832,8 +1832,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  3306. + u32 saveLedState;
  3307. + u32 saveDefAntenna;
  3308. + u32 macStaId1;
  3309. ++ struct timespec tsf_ts;
  3310. ++ u32 tsf_offset;
  3311. + u64 tsf = 0;
  3312. +- s64 usec = 0;
  3313. + int r;
  3314. + bool start_mci_reset = false;
  3315. + bool save_fullsleep = ah->chip_fullsleep;
  3316. +@@ -1877,8 +1878,8 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  3317. + macStaId1 = REG_READ(ah, AR_STA_ID1) & AR_STA_ID1_BASE_RATE_11B;
  3318. +
  3319. + /* Save TSF before chip reset, a cold reset clears it */
  3320. ++ getrawmonotonic(&tsf_ts);
  3321. + tsf = ath9k_hw_gettsf64(ah);
  3322. +- usec = ktime_to_us(ktime_get_raw());
  3323. +
  3324. + saveLedState = REG_READ(ah, AR_CFG_LED) &
  3325. + (AR_CFG_LED_ASSOC_CTL | AR_CFG_LED_MODE_SEL |
  3326. +@@ -1911,8 +1912,8 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  3327. + }
  3328. +
  3329. + /* Restore TSF */
  3330. +- usec = ktime_to_us(ktime_get_raw()) - usec;
  3331. +- ath9k_hw_settsf64(ah, tsf + usec);
  3332. ++ tsf_offset = ath9k_hw_get_tsf_offset(&tsf_ts, NULL);
  3333. ++ ath9k_hw_settsf64(ah, tsf + tsf_offset);
  3334. +
  3335. + if (AR_SREV_9280_20_OR_LATER(ah))
  3336. + REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL, AR_GPIO_JTAG_DISABLE);
  3337. +@@ -1932,12 +1933,11 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  3338. + /*
  3339. + * Some AR91xx SoC devices frequently fail to accept TSF writes
  3340. + * right after the chip reset. When that happens, write a new
  3341. +- * value after the initvals have been applied, with an offset
  3342. +- * based on measured time difference
  3343. ++ * value after the initvals have been applied.
  3344. + */
  3345. + if (AR_SREV_9100(ah) && (ath9k_hw_gettsf64(ah) < tsf)) {
  3346. +- tsf += 1500;
  3347. +- ath9k_hw_settsf64(ah, tsf);
  3348. ++ tsf_offset = ath9k_hw_get_tsf_offset(&tsf_ts, NULL);
  3349. ++ ath9k_hw_settsf64(ah, tsf + tsf_offset);
  3350. + }
  3351. +
  3352. + ath9k_hw_init_mfp(ah);
  3353. diff --git a/package/kernel/mac80211/patches/314-mac80211-Requeue-work-after-scan-complete-for-all-VI.patch b/package/kernel/mac80211/patches/314-mac80211-Requeue-work-after-scan-complete-for-all-VI.patch
  3354. deleted file mode 100644
  3355. index 5b3efbd..0000000
  3356. --- a/package/kernel/mac80211/patches/314-mac80211-Requeue-work-after-scan-complete-for-all-VI.patch
  3357. +++ /dev/null
  3358. @@ -1,103 +0,0 @@
  3359. -From: Sachin Kulkarni <Sachin.Kulkarni@imgtec.com>
  3360. -Date: Tue, 12 Jan 2016 14:30:19 +0530
  3361. -Subject: [PATCH] mac80211: Requeue work after scan complete for all VIF
  3362. - types.
  3363. -
  3364. -During a sw scan ieee80211_iface_work ignores work items for all vifs.
  3365. -However after the scan complete work is requeued only for STA, ADHOC
  3366. -and MESH iftypes.
  3367. -
  3368. -This occasionally results in event processing getting delayed/not
  3369. -processed for iftype AP when it coexists with a STA. This can result
  3370. -in data halt and eventually disconnection on the AP interface.
  3371. -
  3372. -Signed-off-by: Sachin Kulkarni <Sachin.Kulkarni@imgtec.com>
  3373. -Cc: linux-wireless@vger.kernel.org
  3374. -Cc: johannes@sipsolutions.net
  3375. ----
  3376. -
  3377. ---- a/net/mac80211/ibss.c
  3378. -+++ b/net/mac80211/ibss.c
  3379. -@@ -1731,7 +1731,6 @@ void ieee80211_ibss_notify_scan_complete
  3380. - if (sdata->vif.type != NL80211_IFTYPE_ADHOC)
  3381. - continue;
  3382. - sdata->u.ibss.last_scan_completed = jiffies;
  3383. -- ieee80211_queue_work(&local->hw, &sdata->work);
  3384. - }
  3385. - mutex_unlock(&local->iflist_mtx);
  3386. - }
  3387. ---- a/net/mac80211/mesh.c
  3388. -+++ b/net/mac80211/mesh.c
  3389. -@@ -1369,17 +1369,6 @@ out:
  3390. - sdata_unlock(sdata);
  3391. - }
  3392. -
  3393. --void ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local)
  3394. --{
  3395. -- struct ieee80211_sub_if_data *sdata;
  3396. --
  3397. -- rcu_read_lock();
  3398. -- list_for_each_entry_rcu(sdata, &local->interfaces, list)
  3399. -- if (ieee80211_vif_is_mesh(&sdata->vif) &&
  3400. -- ieee80211_sdata_running(sdata))
  3401. -- ieee80211_queue_work(&local->hw, &sdata->work);
  3402. -- rcu_read_unlock();
  3403. --}
  3404. -
  3405. - void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata)
  3406. - {
  3407. ---- a/net/mac80211/mesh.h
  3408. -+++ b/net/mac80211/mesh.h
  3409. -@@ -362,14 +362,10 @@ static inline bool mesh_path_sel_is_hwmp
  3410. - return sdata->u.mesh.mesh_pp_id == IEEE80211_PATH_PROTOCOL_HWMP;
  3411. - }
  3412. -
  3413. --void ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local);
  3414. --
  3415. - void mesh_path_flush_by_iface(struct ieee80211_sub_if_data *sdata);
  3416. - void mesh_sync_adjust_tbtt(struct ieee80211_sub_if_data *sdata);
  3417. - void ieee80211s_stop(void);
  3418. - #else
  3419. --static inline void
  3420. --ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local) {}
  3421. - static inline bool mesh_path_sel_is_hwmp(struct ieee80211_sub_if_data *sdata)
  3422. - { return false; }
  3423. - static inline void mesh_path_flush_by_iface(struct ieee80211_sub_if_data *sdata)
  3424. ---- a/net/mac80211/mlme.c
  3425. -+++ b/net/mac80211/mlme.c
  3426. -@@ -3978,8 +3978,6 @@ static void ieee80211_restart_sta_timer(
  3427. - if (!ieee80211_hw_check(&sdata->local->hw, CONNECTION_MONITOR))
  3428. - ieee80211_queue_work(&sdata->local->hw,
  3429. - &sdata->u.mgd.monitor_work);
  3430. -- /* and do all the other regular work too */
  3431. -- ieee80211_queue_work(&sdata->local->hw, &sdata->work);
  3432. - }
  3433. - }
  3434. -
  3435. ---- a/net/mac80211/scan.c
  3436. -+++ b/net/mac80211/scan.c
  3437. -@@ -314,6 +314,7 @@ static void __ieee80211_scan_completed(s
  3438. - bool was_scanning = local->scanning;
  3439. - struct cfg80211_scan_request *scan_req;
  3440. - struct ieee80211_sub_if_data *scan_sdata;
  3441. -+ struct ieee80211_sub_if_data *sdata;
  3442. -
  3443. - lockdep_assert_held(&local->mtx);
  3444. -
  3445. -@@ -373,7 +374,15 @@ static void __ieee80211_scan_completed(s
  3446. -
  3447. - ieee80211_mlme_notify_scan_completed(local);
  3448. - ieee80211_ibss_notify_scan_completed(local);
  3449. -- ieee80211_mesh_notify_scan_completed(local);
  3450. -+
  3451. -+ /* Requeue all the work that might have been ignored while
  3452. -+ * the scan was in progress
  3453. -+ */
  3454. -+ list_for_each_entry_rcu(sdata, &local->interfaces, list) {
  3455. -+ if (ieee80211_sdata_running(sdata))
  3456. -+ ieee80211_queue_work(&sdata->local->hw, &sdata->work);
  3457. -+ }
  3458. -+
  3459. - if (was_scanning)
  3460. - ieee80211_start_next_roc(local);
  3461. - }
  3462. diff --git a/package/kernel/mac80211/patches/315-ath9k-Expose-tsf_adjustment-in-mac80211-tsf-getters-.patch b/package/kernel/mac80211/patches/315-ath9k-Expose-tsf_adjustment-in-mac80211-tsf-getters-.patch
  3463. new file mode 100644
  3464. index 0000000..c95ab7e
  3465. --- /dev/null
  3466. +++ b/package/kernel/mac80211/patches/315-ath9k-Expose-tsf_adjustment-in-mac80211-tsf-getters-.patch
  3467. @@ -0,0 +1,32 @@
  3468. +From: Benjamin Berg <benjamin.berg@open-mesh.com>
  3469. +Date: Mon, 4 Jul 2016 14:37:23 +0200
  3470. +Subject: [PATCH] ath9k: Expose tsf_adjustment in mac80211 tsf getters and
  3471. + setters.
  3472. +
  3473. +The ath9k driver modifies the TSF for VIFs for the purpose of sending
  3474. +beacons in a staggered fashion. This patch exposes this VIF specific
  3475. +adjustment of the TSF value to mac80211. Without the change the TSF
  3476. +routines handle the hardware TSF value instead of the actual TSF value as
  3477. +seen on the air.
  3478. +
  3479. +Signed-off-by: Benjamin Berg <benjamin.berg@open-mesh.com>
  3480. +---
  3481. +
  3482. +--- a/drivers/net/wireless/ath/ath9k/main.c
  3483. ++++ b/drivers/net/wireless/ath/ath9k/main.c
  3484. +@@ -1835,6 +1835,7 @@ static u64 ath9k_get_tsf(struct ieee8021
  3485. + tsf = sc->cur_chan->tsf_val +
  3486. + ath9k_hw_get_tsf_offset(&sc->cur_chan->tsf_ts, NULL);
  3487. + }
  3488. ++ tsf += le64_to_cpu(avp->tsf_adjust);
  3489. + ath9k_ps_restore(sc);
  3490. + mutex_unlock(&sc->mutex);
  3491. +
  3492. +@@ -1850,6 +1851,7 @@ static void ath9k_set_tsf(struct ieee802
  3493. +
  3494. + mutex_lock(&sc->mutex);
  3495. + ath9k_ps_wakeup(sc);
  3496. ++ tsf -= le64_to_cpu(avp->tsf_adjust);
  3497. + getrawmonotonic(&avp->chanctx->tsf_ts);
  3498. + if (sc->cur_chan == avp->chanctx)
  3499. + ath9k_hw_settsf64(sc->sc_ah, tsf);
  3500. diff --git a/package/kernel/mac80211/patches/315-mac80211-fix-ibss-scan-parameters.patch b/package/kernel/mac80211/patches/315-mac80211-fix-ibss-scan-parameters.patch
  3501. deleted file mode 100644
  3502. index 52fecb9..0000000
  3503. --- a/package/kernel/mac80211/patches/315-mac80211-fix-ibss-scan-parameters.patch
  3504. +++ /dev/null
  3505. @@ -1,57 +0,0 @@
  3506. -From: Sara Sharon <sara.sharon@intel.com>
  3507. -Date: Mon, 25 Jan 2016 15:46:35 +0200
  3508. -Subject: [PATCH] mac80211: fix ibss scan parameters
  3509. -
  3510. -When joining IBSS a full scan should be initiated in order to search
  3511. -for existing cell, unless the fixed_channel parameter was set.
  3512. -A default channel to create the IBSS on if no cell was found is
  3513. -provided as well.
  3514. -However - a scan is initiated only on the default channel provided
  3515. -regardless of whether ifibss->fixed_channel is set or not, with the
  3516. -obvious result of the cell not joining existing IBSS cell that is
  3517. -on another channel.
  3518. -
  3519. -Fixes: 76bed0f43b27 ("mac80211: IBSS fix scan request")
  3520. -Signed-off-by: Sara Sharon <sara.sharon@intel.com>
  3521. -Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
  3522. ----
  3523. -
  3524. ---- a/net/mac80211/ibss.c
  3525. -+++ b/net/mac80211/ibss.c
  3526. -@@ -7,6 +7,7 @@
  3527. - * Copyright 2007, Michael Wu <flamingice@sourmilk.net>
  3528. - * Copyright 2009, Johannes Berg <johannes@sipsolutions.net>
  3529. - * Copyright 2013-2014 Intel Mobile Communications GmbH
  3530. -+ * Copyright(c) 2016 Intel Deutschland GmbH
  3531. - *
  3532. - * This program is free software; you can redistribute it and/or modify
  3533. - * it under the terms of the GNU General Public License version 2 as
  3534. -@@ -1483,14 +1484,21 @@ static void ieee80211_sta_find_ibss(stru
  3535. -
  3536. - sdata_info(sdata, "Trigger new scan to find an IBSS to join\n");
  3537. -
  3538. -- num = ieee80211_ibss_setup_scan_channels(local->hw.wiphy,
  3539. -- &ifibss->chandef,
  3540. -- channels,
  3541. -- ARRAY_SIZE(channels));
  3542. - scan_width = cfg80211_chandef_to_scan_width(&ifibss->chandef);
  3543. -- ieee80211_request_ibss_scan(sdata, ifibss->ssid,
  3544. -- ifibss->ssid_len, channels, num,
  3545. -- scan_width);
  3546. -+
  3547. -+ if (ifibss->fixed_channel) {
  3548. -+ num = ieee80211_ibss_setup_scan_channels(local->hw.wiphy,
  3549. -+ &ifibss->chandef,
  3550. -+ channels,
  3551. -+ ARRAY_SIZE(channels));
  3552. -+ ieee80211_request_ibss_scan(sdata, ifibss->ssid,
  3553. -+ ifibss->ssid_len, channels,
  3554. -+ num, scan_width);
  3555. -+ } else {
  3556. -+ ieee80211_request_ibss_scan(sdata, ifibss->ssid,
  3557. -+ ifibss->ssid_len, NULL,
  3558. -+ 0, scan_width);
  3559. -+ }
  3560. - } else {
  3561. - int interval = IEEE80211_SCAN_INTERVAL;
  3562. -
  3563. diff --git a/package/kernel/mac80211/patches/316-ath9k-Remove-some-defined-constants-to-decrease-verb.patch b/package/kernel/mac80211/patches/316-ath9k-Remove-some-defined-constants-to-decrease-verb.patch
  3564. new file mode 100644
  3565. index 0000000..36aaa10
  3566. --- /dev/null
  3567. +++ b/package/kernel/mac80211/patches/316-ath9k-Remove-some-defined-constants-to-decrease-verb.patch
  3568. @@ -0,0 +1,137 @@
  3569. +From: Benjamin Berg <benjamin.berg@open-mesh.com>
  3570. +Date: Mon, 4 Jul 2016 14:37:24 +0200
  3571. +Subject: [PATCH] ath9k: Remove some #defined constants to decrease
  3572. + verbosity
  3573. +
  3574. +The removed ATH9K_SLOT_TIME_X constants simply map the value in microseconds
  3575. +to the same integer. These constants were not used consistently, so fix the
  3576. +inconsistency issue by replacing all occurances with the integer equivalent.
  3577. +
  3578. +Signed-off-by: Benjamin Berg <benjamin.berg@open-mesh.com>
  3579. +---
  3580. +
  3581. +--- a/drivers/net/wireless/ath/ath9k/beacon.c
  3582. ++++ b/drivers/net/wireless/ath/ath9k/beacon.c
  3583. +@@ -50,7 +50,7 @@ static void ath9k_beaconq_config(struct
  3584. + txq = sc->tx.txq_map[IEEE80211_AC_BE];
  3585. + ath9k_hw_get_txq_props(ah, txq->axq_qnum, &qi_be);
  3586. + qi.tqi_aifs = qi_be.tqi_aifs;
  3587. +- if (ah->slottime == ATH9K_SLOT_TIME_20)
  3588. ++ if (ah->slottime == 20)
  3589. + qi.tqi_cwmin = 2*qi_be.tqi_cwmin;
  3590. + else
  3591. + qi.tqi_cwmin = 4*qi_be.tqi_cwmin;
  3592. +--- a/drivers/net/wireless/ath/ath9k/dynack.c
  3593. ++++ b/drivers/net/wireless/ath/ath9k/dynack.c
  3594. +@@ -280,7 +280,7 @@ EXPORT_SYMBOL(ath_dynack_sample_ack_ts);
  3595. + void ath_dynack_node_init(struct ath_hw *ah, struct ath_node *an)
  3596. + {
  3597. + /* ackto = slottime + sifs + air delay */
  3598. +- u32 ackto = ATH9K_SLOT_TIME_9 + 16 + 64;
  3599. ++ u32 ackto = 9 + 16 + 64;
  3600. + struct ath_dynack *da = &ah->dynack;
  3601. +
  3602. + an->ackto = ackto;
  3603. +@@ -315,7 +315,7 @@ EXPORT_SYMBOL(ath_dynack_node_deinit);
  3604. + void ath_dynack_reset(struct ath_hw *ah)
  3605. + {
  3606. + /* ackto = slottime + sifs + air delay */
  3607. +- u32 ackto = ATH9K_SLOT_TIME_9 + 16 + 64;
  3608. ++ u32 ackto = 9 + 16 + 64;
  3609. + struct ath_dynack *da = &ah->dynack;
  3610. +
  3611. + da->lto = jiffies;
  3612. +--- a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
  3613. ++++ b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
  3614. +@@ -45,7 +45,7 @@ void ath9k_htc_beaconq_config(struct ath
  3615. + * Long slot time : 2x cwmin
  3616. + * Short slot time : 4x cwmin
  3617. + */
  3618. +- if (ah->slottime == ATH9K_SLOT_TIME_20)
  3619. ++ if (ah->slottime == 20)
  3620. + qi.tqi_cwmin = 2*qi_be.tqi_cwmin;
  3621. + else
  3622. + qi.tqi_cwmin = 4*qi_be.tqi_cwmin;
  3623. +--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
  3624. ++++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
  3625. +@@ -678,7 +678,7 @@ static int ath9k_init_priv(struct ath9k_
  3626. +
  3627. + for (i = 0; i < ATH9K_HTC_MAX_BCN_VIF; i++)
  3628. + priv->beacon.bslot[i] = NULL;
  3629. +- priv->beacon.slottime = ATH9K_SLOT_TIME_9;
  3630. ++ priv->beacon.slottime = 9;
  3631. +
  3632. + ath9k_cmn_init_channels_rates(common);
  3633. + ath9k_cmn_init_crypto(ah);
  3634. +--- a/drivers/net/wireless/ath/ath9k/hw.c
  3635. ++++ b/drivers/net/wireless/ath/ath9k/hw.c
  3636. +@@ -454,7 +454,7 @@ static void ath9k_hw_init_defaults(struc
  3637. + if (AR_SREV_9100(ah))
  3638. + ah->sta_id1_defaults |= AR_STA_ID1_AR9100_BA_FIX;
  3639. +
  3640. +- ah->slottime = ATH9K_SLOT_TIME_9;
  3641. ++ ah->slottime = 9;
  3642. + ah->globaltxtimeout = (u32) -1;
  3643. + ah->power_mode = ATH9K_PM_UNDEFINED;
  3644. + ah->htc_reset_init = true;
  3645. +--- a/drivers/net/wireless/ath/ath9k/init.c
  3646. ++++ b/drivers/net/wireless/ath/ath9k/init.c
  3647. +@@ -372,7 +372,7 @@ static void ath9k_init_misc(struct ath_s
  3648. +
  3649. + common->last_rssi = ATH_RSSI_DUMMY_MARKER;
  3650. + memcpy(common->bssidmask, ath_bcast_mac, ETH_ALEN);
  3651. +- sc->beacon.slottime = ATH9K_SLOT_TIME_9;
  3652. ++ sc->beacon.slottime = 9;
  3653. +
  3654. + for (i = 0; i < ARRAY_SIZE(sc->beacon.bslot); i++)
  3655. + sc->beacon.bslot[i] = NULL;
  3656. +--- a/drivers/net/wireless/ath/ath9k/mac.h
  3657. ++++ b/drivers/net/wireless/ath/ath9k/mac.h
  3658. +@@ -65,10 +65,6 @@
  3659. + #define INIT_SSH_RETRY 32
  3660. + #define INIT_SLG_RETRY 32
  3661. +
  3662. +-#define ATH9K_SLOT_TIME_6 6
  3663. +-#define ATH9K_SLOT_TIME_9 9
  3664. +-#define ATH9K_SLOT_TIME_20 20
  3665. +-
  3666. + #define ATH9K_TXERR_XRETRY 0x01
  3667. + #define ATH9K_TXERR_FILT 0x02
  3668. + #define ATH9K_TXERR_FIFO 0x04
  3669. +--- a/drivers/net/wireless/ath/ath9k/main.c
  3670. ++++ b/drivers/net/wireless/ath/ath9k/main.c
  3671. +@@ -926,7 +926,7 @@ static void ath9k_vif_iter(struct ath9k_
  3672. + }
  3673. +
  3674. + if (!vif->bss_conf.use_short_slot)
  3675. +- iter_data->slottime = ATH9K_SLOT_TIME_20;
  3676. ++ iter_data->slottime = 20;
  3677. +
  3678. + switch (vif->type) {
  3679. + case NL80211_IFTYPE_AP:
  3680. +@@ -999,7 +999,7 @@ void ath9k_calculate_iter_data(struct at
  3681. + */
  3682. + memset(iter_data, 0, sizeof(*iter_data));
  3683. + eth_broadcast_addr(iter_data->mask);
  3684. +- iter_data->slottime = ATH9K_SLOT_TIME_9;
  3685. ++ iter_data->slottime = 9;
  3686. +
  3687. + list_for_each_entry(avp, &ctx->vifs, list)
  3688. + ath9k_vif_iter(iter_data, avp->vif->addr, avp->vif);
  3689. +@@ -1061,7 +1061,7 @@ static void ath9k_set_offchannel_state(s
  3690. + ah->opmode = vif->type;
  3691. + ah->imask &= ~ATH9K_INT_SWBA;
  3692. + ah->imask &= ~ATH9K_INT_TSFOOR;
  3693. +- ah->slottime = ATH9K_SLOT_TIME_9;
  3694. ++ ah->slottime = 9;
  3695. +
  3696. + ath_hw_setbssidmask(common);
  3697. + ath9k_hw_setopmode(ah);
  3698. +@@ -1788,6 +1788,7 @@ static void ath9k_bss_info_changed(struc
  3699. + slottime = 9;
  3700. + else
  3701. + slottime = 20;
  3702. ++
  3703. + if (vif->type == NL80211_IFTYPE_AP) {
  3704. + /*
  3705. + * Defer update, so that connected stations can adjust
  3706. diff --git a/package/kernel/mac80211/patches/316-net-mac80211-agg-rx.c-fix-use-of-uninitialised-value.patch b/package/kernel/mac80211/patches/316-net-mac80211-agg-rx.c-fix-use-of-uninitialised-value.patch
  3707. deleted file mode 100644
  3708. index e78df36..0000000
  3709. --- a/package/kernel/mac80211/patches/316-net-mac80211-agg-rx.c-fix-use-of-uninitialised-value.patch
  3710. +++ /dev/null
  3711. @@ -1,50 +0,0 @@
  3712. -From: Chris Bainbridge <chris.bainbridge@gmail.com>
  3713. -Date: Wed, 27 Jan 2016 15:46:18 +0000
  3714. -Subject: [PATCH] net/mac80211/agg-rx.c: fix use of uninitialised values
  3715. -
  3716. -Use kzalloc instead of kmalloc for struct tid_ampdu_rx. Fixes:
  3717. -
  3718. -[ 7.976605] UBSAN: Undefined behaviour in net/mac80211/rx.c:932:29
  3719. -[ 7.976608] load of value 2 is not a valid value for type '_Bool'
  3720. -[ 7.976611] CPU: 3 PID: 1134 Comm: kworker/u16:7 Not tainted 4.5.0-rc1+ #265
  3721. -[ 7.976613] Hardware name: Apple Inc. MacBookPro10,2/Mac-AFD8A9D944EA4843, BIOS MBP102.88Z.0106.B0A.1509130955 09/13/2015
  3722. -[ 7.976616] Workqueue: phy0 rt2x00usb_work_rxdone
  3723. -[ 7.976619] 0000000000000004 ffff880254a7ba50 ffffffff8181d866 0000000000000007
  3724. -[ 7.976622] ffff880254a7ba78 ffff880254a7ba68 ffffffff8188422d ffffffff8379b500
  3725. -[ 7.976626] ffff880254a7bab8 ffffffff81884747 0000000000000202 0000000348620032
  3726. -[ 7.976629] Call Trace:
  3727. -[ 7.976633] [<ffffffff8181d866>] dump_stack+0x45/0x5f
  3728. -[ 7.976637] [<ffffffff8188422d>] ubsan_epilogue+0xd/0x40
  3729. -[ 7.976642] [<ffffffff81884747>] __ubsan_handle_load_invalid_value+0x67/0x70
  3730. -[ 7.976646] [<ffffffff82227b4d>] ieee80211_sta_reorder_release.isra.16+0x5ed/0x730
  3731. -[ 7.976650] [<ffffffff8222ca14>] ieee80211_prepare_and_rx_handle+0xd04/0x1c00
  3732. -[ 7.976654] [<ffffffff81cb27ce>] ? usb_hcd_map_urb_for_dma+0x65e/0x960
  3733. -[ 7.976659] [<ffffffff8222db03>] __ieee80211_rx_handle_packet+0x1f3/0x750
  3734. -[ 7.976663] [<ffffffff8222e4a7>] ieee80211_rx_napi+0x447/0x990
  3735. -[ 7.976667] [<ffffffff81c5fb85>] rt2x00lib_rxdone+0x305/0xbd0
  3736. -[ 7.976670] [<ffffffff811ac23f>] ? dequeue_task_fair+0x64f/0x1de0
  3737. -[ 7.976674] [<ffffffff811a1516>] ? sched_clock_cpu+0xe6/0x150
  3738. -[ 7.976678] [<ffffffff81c6c45c>] rt2x00usb_work_rxdone+0x7c/0x140
  3739. -[ 7.976682] [<ffffffff8117aef6>] process_one_work+0x226/0x860
  3740. -[ 7.976686] [<ffffffff8117b58c>] worker_thread+0x5c/0x680
  3741. -[ 7.976690] [<ffffffff8117b530>] ? process_one_work+0x860/0x860
  3742. -[ 7.976693] [<ffffffff81184f86>] kthread+0xf6/0x150
  3743. -[ 7.976697] [<ffffffff81184e90>] ? kthread_worker_fn+0x310/0x310
  3744. -[ 7.976700] [<ffffffff822a94df>] ret_from_fork+0x3f/0x70
  3745. -[ 7.976703] [<ffffffff81184e90>] ? kthread_worker_fn+0x310/0x310
  3746. -
  3747. -Link: https://lkml.org/lkml/2016/1/26/230
  3748. -Signed-off-by: Chris Bainbridge <chris.bainbridge@gmail.com>
  3749. ----
  3750. -
  3751. ---- a/net/mac80211/agg-rx.c
  3752. -+++ b/net/mac80211/agg-rx.c
  3753. -@@ -327,7 +327,7 @@ void __ieee80211_start_rx_ba_session(str
  3754. - }
  3755. -
  3756. - /* prepare A-MPDU MLME for Rx aggregation */
  3757. -- tid_agg_rx = kmalloc(sizeof(struct tid_ampdu_rx), GFP_KERNEL);
  3758. -+ tid_agg_rx = kzalloc(sizeof(struct tid_ampdu_rx), GFP_KERNEL);
  3759. - if (!tid_agg_rx)
  3760. - goto end;
  3761. -
  3762. diff --git a/package/kernel/mac80211/patches/317-ath9k-Fix-beacon-configuration-for-addition-removal-.patch b/package/kernel/mac80211/patches/317-ath9k-Fix-beacon-configuration-for-addition-removal-.patch
  3763. new file mode 100644
  3764. index 0000000..360dfbf
  3765. --- /dev/null
  3766. +++ b/package/kernel/mac80211/patches/317-ath9k-Fix-beacon-configuration-for-addition-removal-.patch
  3767. @@ -0,0 +1,544 @@
  3768. +From: Benjamin Berg <benjamin.berg@open-mesh.com>
  3769. +Date: Mon, 4 Jul 2016 14:37:25 +0200
  3770. +Subject: [PATCH] ath9k: Fix beacon configuration for addition/removal of
  3771. + interfaces
  3772. +
  3773. +This patch fixes some issues with interface reconfiguration. It could
  3774. +for example happen that an AP interface in beacon slot 0 was removed
  3775. +leaving an IBSS station in one of the other slots. When this happens
  3776. +the driver never sends out the beacon as it only tries to send a beacon
  3777. +from slot 0.
  3778. +
  3779. +Appart from that the tracking of required changes to the beacon config is
  3780. +relatively complicated and prone to errors.
  3781. +
  3782. +The approach taken here is to solve reconfiguration issues is to
  3783. +reconfigure the beacons when any interface changes. This means that
  3784. +the complexity of deciding whether an interface change may modify the
  3785. +beacon configuration is gone. It also means that the beacon config will
  3786. +be reliably updated when an interface is removed.
  3787. +
  3788. +The issue that a single non-AP interface might not be in beacon
  3789. +slot 0 and wouldn't be send out is solved by moving it into the
  3790. +first slot. The TSF value in hardware is adjusted accordingly so
  3791. +that the timestamp of the beacons stay consistent.
  3792. +
  3793. +Signed-off-by: Benjamin Berg <benjamin.berg@open-mesh.com>
  3794. +---
  3795. +
  3796. +--- a/drivers/net/wireless/ath/ath9k/ath9k.h
  3797. ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  3798. +@@ -637,6 +637,8 @@ struct ath9k_vif_iter_data {
  3799. + int nwds; /* number of WDS vifs */
  3800. + int nadhocs; /* number of adhoc vifs */
  3801. + int nocbs; /* number of OCB vifs */
  3802. ++ int nbcnvifs; /* number of beaconing vifs */
  3803. ++ struct ieee80211_vif *primary_beacon_vif;
  3804. + struct ieee80211_vif *primary_sta;
  3805. + };
  3806. +
  3807. +@@ -685,10 +687,11 @@ struct ath_beacon {
  3808. + };
  3809. +
  3810. + void ath9k_beacon_tasklet(unsigned long data);
  3811. +-void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif,
  3812. +- u32 changed);
  3813. ++void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *main_vif,
  3814. ++ bool beacons);
  3815. + void ath9k_beacon_assign_slot(struct ath_softc *sc, struct ieee80211_vif *vif);
  3816. + void ath9k_beacon_remove_slot(struct ath_softc *sc, struct ieee80211_vif *vif);
  3817. ++void ath9k_beacon_ensure_primary_slot(struct ath_softc *sc);
  3818. + void ath9k_set_beacon(struct ath_softc *sc);
  3819. + bool ath9k_csa_is_finished(struct ath_softc *sc, struct ieee80211_vif *vif);
  3820. + void ath9k_csa_update(struct ath_softc *sc);
  3821. +--- a/drivers/net/wireless/ath/ath9k/beacon.c
  3822. ++++ b/drivers/net/wireless/ath/ath9k/beacon.c
  3823. +@@ -209,7 +209,6 @@ void ath9k_beacon_assign_slot(struct ath
  3824. + }
  3825. +
  3826. + sc->beacon.bslot[avp->av_bslot] = vif;
  3827. +- sc->nbcnvifs++;
  3828. +
  3829. + ath_dbg(common, CONFIG, "Added interface at beacon slot: %d\n",
  3830. + avp->av_bslot);
  3831. +@@ -220,15 +219,12 @@ void ath9k_beacon_remove_slot(struct ath
  3832. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  3833. + struct ath_vif *avp = (void *)vif->drv_priv;
  3834. + struct ath_buf *bf = avp->av_bcbuf;
  3835. +- struct ath_beacon_config *cur_conf = &sc->cur_chan->beacon;
  3836. +
  3837. + ath_dbg(common, CONFIG, "Removing interface at beacon slot: %d\n",
  3838. + avp->av_bslot);
  3839. +
  3840. + tasklet_disable(&sc->bcon_tasklet);
  3841. +
  3842. +- cur_conf->enable_beacon &= ~BIT(avp->av_bslot);
  3843. +-
  3844. + if (bf && bf->bf_mpdu) {
  3845. + struct sk_buff *skb = bf->bf_mpdu;
  3846. + dma_unmap_single(sc->dev, bf->bf_buf_addr,
  3847. +@@ -240,12 +236,73 @@ void ath9k_beacon_remove_slot(struct ath
  3848. +
  3849. + avp->av_bcbuf = NULL;
  3850. + sc->beacon.bslot[avp->av_bslot] = NULL;
  3851. +- sc->nbcnvifs--;
  3852. + list_add_tail(&bf->list, &sc->beacon.bbuf);
  3853. +
  3854. + tasklet_enable(&sc->bcon_tasklet);
  3855. + }
  3856. +
  3857. ++void ath9k_beacon_ensure_primary_slot(struct ath_softc *sc)
  3858. ++{
  3859. ++ struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  3860. ++ struct ieee80211_vif *vif;
  3861. ++ struct ath_vif *avp;
  3862. ++ s64 tsfadjust;
  3863. ++ u32 offset;
  3864. ++ int first_slot = ATH_BCBUF;
  3865. ++ int slot;
  3866. ++
  3867. ++ tasklet_disable(&sc->bcon_tasklet);
  3868. ++
  3869. ++ /* Find first taken slot. */
  3870. ++ for (slot = 0; slot < ATH_BCBUF; slot++) {
  3871. ++ if (sc->beacon.bslot[slot]) {
  3872. ++ first_slot = slot;
  3873. ++ break;
  3874. ++ }
  3875. ++ }
  3876. ++ if (first_slot == 0)
  3877. ++ goto out;
  3878. ++
  3879. ++ /* Re-enumarate all slots, moving them forward. */
  3880. ++ for (slot = 0; slot < ATH_BCBUF; slot++) {
  3881. ++ if (slot + first_slot < ATH_BCBUF) {
  3882. ++ vif = sc->beacon.bslot[slot + first_slot];
  3883. ++ sc->beacon.bslot[slot] = vif;
  3884. ++
  3885. ++ if (vif) {
  3886. ++ avp = (void *)vif->drv_priv;
  3887. ++ avp->av_bslot = slot;
  3888. ++ }
  3889. ++ } else {
  3890. ++ sc->beacon.bslot[slot] = NULL;
  3891. ++ }
  3892. ++ }
  3893. ++
  3894. ++ vif = sc->beacon.bslot[0];
  3895. ++ if (WARN_ON(!vif))
  3896. ++ goto out;
  3897. ++
  3898. ++ /* Get the tsf_adjust value for the new first slot. */
  3899. ++ avp = (void *)vif->drv_priv;
  3900. ++ tsfadjust = le64_to_cpu(avp->tsf_adjust);
  3901. ++
  3902. ++ ath_dbg(common, CONFIG,
  3903. ++ "Adjusting global TSF after beacon slot reassignment: %lld\n",
  3904. ++ (signed long long)tsfadjust);
  3905. ++
  3906. ++ /* Modify TSF as required and update the HW. */
  3907. ++ avp->chanctx->tsf_val += tsfadjust;
  3908. ++ if (sc->cur_chan == avp->chanctx) {
  3909. ++ offset = ath9k_hw_get_tsf_offset(&avp->chanctx->tsf_ts, NULL);
  3910. ++ ath9k_hw_settsf64(sc->sc_ah, avp->chanctx->tsf_val + offset);
  3911. ++ }
  3912. ++
  3913. ++ /* The slots tsf_adjust will be updated by ath9k_beacon_config later. */
  3914. ++
  3915. ++out:
  3916. ++ tasklet_enable(&sc->bcon_tasklet);
  3917. ++}
  3918. ++
  3919. + static int ath9k_beacon_choose_slot(struct ath_softc *sc)
  3920. + {
  3921. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  3922. +@@ -274,26 +331,33 @@ static int ath9k_beacon_choose_slot(stru
  3923. + return slot;
  3924. + }
  3925. +
  3926. +-static void ath9k_set_tsfadjust(struct ath_softc *sc, struct ieee80211_vif *vif)
  3927. ++static void ath9k_set_tsfadjust(struct ath_softc *sc,
  3928. ++ struct ath_beacon_config *cur_conf)
  3929. + {
  3930. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  3931. +- struct ath_vif *avp = (void *)vif->drv_priv;
  3932. +- struct ath_beacon_config *cur_conf = &avp->chanctx->beacon;
  3933. + s64 tsfadjust;
  3934. ++ int slot;
  3935. +
  3936. +- if (avp->av_bslot == 0)
  3937. +- return;
  3938. ++ for (slot = 0; slot < ATH_BCBUF; slot++) {
  3939. ++ struct ath_vif *avp;
  3940. +
  3941. +- /* tsf_adjust is added to the TSF value. We send out the beacon late,
  3942. +- * so need to adjust the TSF starting point to be later in time (i.e.
  3943. +- * the theoretical first beacon has a TSF of 0 after correction).
  3944. +- */
  3945. +- tsfadjust = cur_conf->beacon_interval * avp->av_bslot;
  3946. +- tsfadjust = -TU_TO_USEC(tsfadjust) / ATH_BCBUF;
  3947. +- avp->tsf_adjust = cpu_to_le64(tsfadjust);
  3948. ++ if (!sc->beacon.bslot[slot])
  3949. ++ continue;
  3950. +
  3951. +- ath_dbg(common, CONFIG, "tsfadjust is: %lld for bslot: %d\n",
  3952. +- (signed long long)tsfadjust, avp->av_bslot);
  3953. ++ avp = (void *)sc->beacon.bslot[slot]->drv_priv;
  3954. ++
  3955. ++ /* tsf_adjust is added to the TSF value. We send out the
  3956. ++ * beacon late, so need to adjust the TSF starting point to be
  3957. ++ * later in time (i.e. the theoretical first beacon has a TSF
  3958. ++ * of 0 after correction).
  3959. ++ */
  3960. ++ tsfadjust = cur_conf->beacon_interval * avp->av_bslot;
  3961. ++ tsfadjust = -TU_TO_USEC(tsfadjust) / ATH_BCBUF;
  3962. ++ avp->tsf_adjust = cpu_to_le64(tsfadjust);
  3963. ++
  3964. ++ ath_dbg(common, CONFIG, "tsfadjust is: %lld for bslot: %d\n",
  3965. ++ (signed long long)tsfadjust, avp->av_bslot);
  3966. ++ }
  3967. + }
  3968. +
  3969. + bool ath9k_csa_is_finished(struct ath_softc *sc, struct ieee80211_vif *vif)
  3970. +@@ -447,20 +511,28 @@ void ath9k_beacon_tasklet(unsigned long
  3971. + * Both nexttbtt and intval have to be in usecs.
  3972. + */
  3973. + static void ath9k_beacon_init(struct ath_softc *sc, u32 nexttbtt,
  3974. +- u32 intval, bool reset_tsf)
  3975. ++ u32 intval)
  3976. + {
  3977. + struct ath_hw *ah = sc->sc_ah;
  3978. +
  3979. + ath9k_hw_disable_interrupts(ah);
  3980. +- if (reset_tsf)
  3981. +- ath9k_hw_reset_tsf(ah);
  3982. + ath9k_beaconq_config(sc);
  3983. + ath9k_hw_beaconinit(ah, nexttbtt, intval);
  3984. ++ ah->imask |= ATH9K_INT_SWBA;
  3985. + sc->beacon.bmisscnt = 0;
  3986. + ath9k_hw_set_interrupts(ah);
  3987. + ath9k_hw_enable_interrupts(ah);
  3988. + }
  3989. +
  3990. ++static void ath9k_beacon_stop(struct ath_softc *sc)
  3991. ++{
  3992. ++ ath9k_hw_disable_interrupts(sc->sc_ah);
  3993. ++ sc->sc_ah->imask &= ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS);
  3994. ++ sc->beacon.bmisscnt = 0;
  3995. ++ ath9k_hw_set_interrupts(sc->sc_ah);
  3996. ++ ath9k_hw_enable_interrupts(sc->sc_ah);
  3997. ++}
  3998. ++
  3999. + /*
  4000. + * For multi-bss ap support beacons are either staggered evenly over N slots or
  4001. + * burst together. For the former arrange for the SWBA to be delivered for each
  4002. +@@ -472,7 +544,7 @@ static void ath9k_beacon_config_ap(struc
  4003. + struct ath_hw *ah = sc->sc_ah;
  4004. +
  4005. + ath9k_cmn_beacon_config_ap(ah, conf, ATH_BCBUF);
  4006. +- ath9k_beacon_init(sc, conf->nexttbtt, conf->intval, false);
  4007. ++ ath9k_beacon_init(sc, conf->nexttbtt, conf->intval);
  4008. + }
  4009. +
  4010. + static void ath9k_beacon_config_sta(struct ath_hw *ah,
  4011. +@@ -501,7 +573,7 @@ static void ath9k_beacon_config_adhoc(st
  4012. +
  4013. + ath9k_cmn_beacon_config_adhoc(ah, conf);
  4014. +
  4015. +- ath9k_beacon_init(sc, conf->nexttbtt, conf->intval, conf->ibss_creator);
  4016. ++ ath9k_beacon_init(sc, conf->nexttbtt, conf->intval);
  4017. +
  4018. + /*
  4019. + * Set the global 'beacon has been configured' flag for the
  4020. +@@ -511,44 +583,6 @@ static void ath9k_beacon_config_adhoc(st
  4021. + set_bit(ATH_OP_BEACONS, &common->op_flags);
  4022. + }
  4023. +
  4024. +-static bool ath9k_allow_beacon_config(struct ath_softc *sc,
  4025. +- struct ieee80211_vif *vif)
  4026. +-{
  4027. +- struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  4028. +- struct ath_vif *avp = (void *)vif->drv_priv;
  4029. +-
  4030. +- if (ath9k_is_chanctx_enabled()) {
  4031. +- /*
  4032. +- * If the VIF is not present in the current channel context,
  4033. +- * then we can't do the usual opmode checks. Allow the
  4034. +- * beacon config for the VIF to be updated in this case and
  4035. +- * return immediately.
  4036. +- */
  4037. +- if (sc->cur_chan != avp->chanctx)
  4038. +- return true;
  4039. +- }
  4040. +-
  4041. +- if (sc->sc_ah->opmode == NL80211_IFTYPE_AP) {
  4042. +- if (vif->type != NL80211_IFTYPE_AP) {
  4043. +- ath_dbg(common, CONFIG,
  4044. +- "An AP interface is already present !\n");
  4045. +- return false;
  4046. +- }
  4047. +- }
  4048. +-
  4049. +- if (sc->sc_ah->opmode == NL80211_IFTYPE_STATION) {
  4050. +- if ((vif->type == NL80211_IFTYPE_STATION) &&
  4051. +- test_bit(ATH_OP_BEACONS, &common->op_flags) &&
  4052. +- vif != sc->cur_chan->primary_sta) {
  4053. +- ath_dbg(common, CONFIG,
  4054. +- "Beacon already configured for a station interface\n");
  4055. +- return false;
  4056. +- }
  4057. +- }
  4058. +-
  4059. +- return true;
  4060. +-}
  4061. +-
  4062. + static void ath9k_cache_beacon_config(struct ath_softc *sc,
  4063. + struct ath_chanctx *ctx,
  4064. + struct ieee80211_bss_conf *bss_conf)
  4065. +@@ -584,87 +618,79 @@ static void ath9k_cache_beacon_config(st
  4066. + if (cur_conf->dtim_period == 0)
  4067. + cur_conf->dtim_period = 1;
  4068. +
  4069. ++ ath9k_set_tsfadjust(sc, cur_conf);
  4070. + }
  4071. +
  4072. +-void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif,
  4073. +- u32 changed)
  4074. ++void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *main_vif,
  4075. ++ bool beacons)
  4076. + {
  4077. +- struct ieee80211_bss_conf *bss_conf = &vif->bss_conf;
  4078. +- struct ath_hw *ah = sc->sc_ah;
  4079. +- struct ath_common *common = ath9k_hw_common(ah);
  4080. +- struct ath_vif *avp = (void *)vif->drv_priv;
  4081. +- struct ath_chanctx *ctx = avp->chanctx;
  4082. ++ struct ath_hw *ah = sc->sc_ah;
  4083. ++ struct ath_common *common = ath9k_hw_common(ah);
  4084. ++ struct ath_vif *avp;
  4085. ++ struct ath_chanctx *ctx;
  4086. + struct ath_beacon_config *cur_conf;
  4087. + unsigned long flags;
  4088. ++ bool enabled;
  4089. + bool skip_beacon = false;
  4090. +
  4091. +- if (!ctx)
  4092. ++ if (!beacons) {
  4093. ++ clear_bit(ATH_OP_BEACONS, &common->op_flags);
  4094. ++ ath9k_beacon_stop(sc);
  4095. + return;
  4096. ++ }
  4097. +
  4098. +- cur_conf = &avp->chanctx->beacon;
  4099. +- if (vif->type == NL80211_IFTYPE_AP)
  4100. +- ath9k_set_tsfadjust(sc, vif);
  4101. +-
  4102. +- if (!ath9k_allow_beacon_config(sc, vif))
  4103. ++ if (WARN_ON(!main_vif))
  4104. + return;
  4105. +
  4106. +- if (vif->type == NL80211_IFTYPE_STATION) {
  4107. +- ath9k_cache_beacon_config(sc, ctx, bss_conf);
  4108. +- if (ctx != sc->cur_chan)
  4109. +- return;
  4110. ++ avp = (void *)main_vif->drv_priv;
  4111. ++ ctx = avp->chanctx;
  4112. ++ cur_conf = &ctx->beacon;
  4113. ++ enabled = cur_conf->enable_beacon;
  4114. ++ cur_conf->enable_beacon = beacons;
  4115. ++
  4116. ++ if (sc->sc_ah->opmode == NL80211_IFTYPE_STATION) {
  4117. ++ ath9k_cache_beacon_config(sc, ctx, &main_vif->bss_conf);
  4118. +
  4119. + ath9k_set_beacon(sc);
  4120. + set_bit(ATH_OP_BEACONS, &common->op_flags);
  4121. + return;
  4122. + }
  4123. +
  4124. +- /*
  4125. +- * Take care of multiple interfaces when
  4126. +- * enabling/disabling SWBA.
  4127. +- */
  4128. +- if (changed & BSS_CHANGED_BEACON_ENABLED) {
  4129. +- bool enabled = cur_conf->enable_beacon;
  4130. +-
  4131. +- if (!bss_conf->enable_beacon) {
  4132. +- cur_conf->enable_beacon &= ~BIT(avp->av_bslot);
  4133. +- } else {
  4134. +- cur_conf->enable_beacon |= BIT(avp->av_bslot);
  4135. +- if (!enabled)
  4136. +- ath9k_cache_beacon_config(sc, ctx, bss_conf);
  4137. +- }
  4138. +- }
  4139. +-
  4140. +- if (ctx != sc->cur_chan)
  4141. +- return;
  4142. ++ /* Update the beacon configuration. */
  4143. ++ ath9k_cache_beacon_config(sc, ctx, &main_vif->bss_conf);
  4144. +
  4145. + /*
  4146. + * Configure the HW beacon registers only when we have a valid
  4147. + * beacon interval.
  4148. + */
  4149. + if (cur_conf->beacon_interval) {
  4150. +- /*
  4151. +- * If we are joining an existing IBSS network, start beaconing
  4152. +- * only after a TSF-sync has taken place. Ensure that this
  4153. +- * happens by setting the appropriate flags.
  4154. ++ /* Special case to sync the TSF when joining an existing IBSS.
  4155. ++ * This is only done if no AP interface is active.
  4156. ++ * Note that mac80211 always resets the TSF when creating a new
  4157. ++ * IBSS interface.
  4158. + */
  4159. +- if ((changed & BSS_CHANGED_IBSS) && !bss_conf->ibss_creator &&
  4160. +- bss_conf->enable_beacon) {
  4161. ++ if (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC &&
  4162. ++ !enabled && beacons && !main_vif->bss_conf.ibss_creator) {
  4163. + spin_lock_irqsave(&sc->sc_pm_lock, flags);
  4164. + sc->ps_flags |= PS_BEACON_SYNC | PS_WAIT_FOR_BEACON;
  4165. + spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
  4166. + skip_beacon = true;
  4167. +- } else {
  4168. +- ath9k_set_beacon(sc);
  4169. + }
  4170. +
  4171. + /*
  4172. + * Do not set the ATH_OP_BEACONS flag for IBSS joiner mode
  4173. + * here, it is done in ath9k_beacon_config_adhoc().
  4174. + */
  4175. +- if (cur_conf->enable_beacon && !skip_beacon)
  4176. ++ if (beacons && !skip_beacon) {
  4177. + set_bit(ATH_OP_BEACONS, &common->op_flags);
  4178. +- else
  4179. ++ ath9k_set_beacon(sc);
  4180. ++ } else {
  4181. + clear_bit(ATH_OP_BEACONS, &common->op_flags);
  4182. ++ ath9k_beacon_stop(sc);
  4183. ++ }
  4184. ++ } else {
  4185. ++ clear_bit(ATH_OP_BEACONS, &common->op_flags);
  4186. ++ ath9k_beacon_stop(sc);
  4187. + }
  4188. + }
  4189. +
  4190. +--- a/drivers/net/wireless/ath/ath9k/common.h
  4191. ++++ b/drivers/net/wireless/ath/ath9k/common.h
  4192. +@@ -50,6 +50,7 @@
  4193. + #define IEEE80211_MS_TO_TU(x) (((x) * 1000) / 1024)
  4194. +
  4195. + struct ath_beacon_config {
  4196. ++ struct ieee80211_vif *main_vif;
  4197. + int beacon_interval;
  4198. + u16 dtim_period;
  4199. + u16 bmiss_timeout;
  4200. +--- a/drivers/net/wireless/ath/ath9k/main.c
  4201. ++++ b/drivers/net/wireless/ath/ath9k/main.c
  4202. +@@ -910,6 +910,22 @@ static bool ath9k_uses_beacons(int type)
  4203. + }
  4204. + }
  4205. +
  4206. ++static void ath9k_vif_iter_set_beacon(struct ath9k_vif_iter_data *iter_data,
  4207. ++ struct ieee80211_vif *vif)
  4208. ++{
  4209. ++ /* Use the first (configured) interface, but prefering AP interfaces. */
  4210. ++ if (!iter_data->primary_beacon_vif) {
  4211. ++ iter_data->primary_beacon_vif = vif;
  4212. ++ } else {
  4213. ++ if (iter_data->primary_beacon_vif->type != NL80211_IFTYPE_AP &&
  4214. ++ vif->type == NL80211_IFTYPE_AP)
  4215. ++ iter_data->primary_beacon_vif = vif;
  4216. ++ }
  4217. ++
  4218. ++ iter_data->beacons = true;
  4219. ++ iter_data->nbcnvifs += 1;
  4220. ++}
  4221. ++
  4222. + static void ath9k_vif_iter(struct ath9k_vif_iter_data *iter_data,
  4223. + u8 *mac, struct ieee80211_vif *vif)
  4224. + {
  4225. +@@ -931,6 +947,8 @@ static void ath9k_vif_iter(struct ath9k_
  4226. + switch (vif->type) {
  4227. + case NL80211_IFTYPE_AP:
  4228. + iter_data->naps++;
  4229. ++ if (vif->bss_conf.enable_beacon)
  4230. ++ ath9k_vif_iter_set_beacon(iter_data, vif);
  4231. + break;
  4232. + case NL80211_IFTYPE_STATION:
  4233. + iter_data->nstations++;
  4234. +@@ -943,12 +961,12 @@ static void ath9k_vif_iter(struct ath9k_
  4235. + case NL80211_IFTYPE_ADHOC:
  4236. + iter_data->nadhocs++;
  4237. + if (vif->bss_conf.enable_beacon)
  4238. +- iter_data->beacons = true;
  4239. ++ ath9k_vif_iter_set_beacon(iter_data, vif);
  4240. + break;
  4241. + case NL80211_IFTYPE_MESH_POINT:
  4242. + iter_data->nmeshes++;
  4243. + if (vif->bss_conf.enable_beacon)
  4244. +- iter_data->beacons = true;
  4245. ++ ath9k_vif_iter_set_beacon(iter_data, vif);
  4246. + break;
  4247. + case NL80211_IFTYPE_WDS:
  4248. + iter_data->nwds++;
  4249. +@@ -1081,7 +1099,6 @@ void ath9k_calculate_summary_state(struc
  4250. + struct ath_hw *ah = sc->sc_ah;
  4251. + struct ath_common *common = ath9k_hw_common(ah);
  4252. + struct ath9k_vif_iter_data iter_data;
  4253. +- struct ath_beacon_config *cur_conf;
  4254. +
  4255. + ath_chanctx_check_active(sc, ctx);
  4256. +
  4257. +@@ -1103,13 +1120,12 @@ void ath9k_calculate_summary_state(struc
  4258. + ath_hw_setbssidmask(common);
  4259. +
  4260. + if (iter_data.naps > 0) {
  4261. +- cur_conf = &ctx->beacon;
  4262. + ath9k_hw_set_tsfadjust(ah, true);
  4263. + ah->opmode = NL80211_IFTYPE_AP;
  4264. +- if (cur_conf->enable_beacon)
  4265. +- iter_data.beacons = true;
  4266. + } else {
  4267. + ath9k_hw_set_tsfadjust(ah, false);
  4268. ++ if (iter_data.beacons)
  4269. ++ ath9k_beacon_ensure_primary_slot(sc);
  4270. +
  4271. + if (iter_data.nmeshes)
  4272. + ah->opmode = NL80211_IFTYPE_MESH_POINT;
  4273. +@@ -1134,7 +1150,6 @@ void ath9k_calculate_summary_state(struc
  4274. + ctx->switch_after_beacon = true;
  4275. + }
  4276. +
  4277. +- ah->imask &= ~ATH9K_INT_SWBA;
  4278. + if (ah->opmode == NL80211_IFTYPE_STATION) {
  4279. + bool changed = (iter_data.primary_sta != ctx->primary_sta);
  4280. +
  4281. +@@ -1151,16 +1166,12 @@ void ath9k_calculate_summary_state(struc
  4282. + if (ath9k_hw_mci_is_enabled(sc->sc_ah))
  4283. + ath9k_mci_update_wlan_channels(sc, true);
  4284. + }
  4285. +- } else if (iter_data.beacons) {
  4286. +- ah->imask |= ATH9K_INT_SWBA;
  4287. + }
  4288. ++ sc->nbcnvifs = iter_data.nbcnvifs;
  4289. ++ ath9k_beacon_config(sc, iter_data.primary_beacon_vif,
  4290. ++ iter_data.beacons);
  4291. + ath9k_hw_set_interrupts(ah);
  4292. +
  4293. +- if (iter_data.beacons)
  4294. +- set_bit(ATH_OP_BEACONS, &common->op_flags);
  4295. +- else
  4296. +- clear_bit(ATH_OP_BEACONS, &common->op_flags);
  4297. +-
  4298. + if (ah->slottime != iter_data.slottime) {
  4299. + ah->slottime = iter_data.slottime;
  4300. + ath9k_hw_init_global_settings(ah);
  4301. +@@ -1777,9 +1788,7 @@ static void ath9k_bss_info_changed(struc
  4302. + if ((changed & BSS_CHANGED_BEACON_ENABLED) ||
  4303. + (changed & BSS_CHANGED_BEACON_INT) ||
  4304. + (changed & BSS_CHANGED_BEACON_INFO)) {
  4305. +- ath9k_beacon_config(sc, vif, changed);
  4306. +- if (changed & BSS_CHANGED_BEACON_ENABLED)
  4307. +- ath9k_calculate_summary_state(sc, avp->chanctx);
  4308. ++ ath9k_calculate_summary_state(sc, avp->chanctx);
  4309. + }
  4310. +
  4311. + if ((avp->chanctx == sc->cur_chan) &&
  4312. diff --git a/package/kernel/mac80211/patches/317-mac80211-minstrel_ht-fix-out-of-bound-in-minstrel_ht.patch b/package/kernel/mac80211/patches/317-mac80211-minstrel_ht-fix-out-of-bound-in-minstrel_ht.patch
  4313. deleted file mode 100644
  4314. index 5bf53b9..0000000
  4315. --- a/package/kernel/mac80211/patches/317-mac80211-minstrel_ht-fix-out-of-bound-in-minstrel_ht.patch
  4316. +++ /dev/null
  4317. @@ -1,45 +0,0 @@
  4318. -From: Konstantin Khlebnikov <koct9i@gmail.com>
  4319. -Date: Fri, 29 Jan 2016 11:35:12 +0300
  4320. -Subject: [PATCH] mac80211: minstrel_ht: fix out-of-bound in
  4321. - minstrel_ht_set_best_prob_rate
  4322. -
  4323. -Patch fixes this splat
  4324. -
  4325. -BUG: KASAN: slab-out-of-bounds in minstrel_ht_update_stats.isra.7+0x6e1/0x9e0
  4326. -[mac80211] at addr ffff8800cee640f4 Read of size 4 by task swapper/3/0
  4327. -
  4328. -Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>
  4329. -Link: http://lkml.kernel.org/r/CALYGNiNyJhSaVnE35qS6UCGaSb2Dx1_i5HcRavuOX14oTz2P+w@mail.gmail.com
  4330. ----
  4331. -
  4332. ---- a/net/mac80211/rc80211_minstrel_ht.c
  4333. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  4334. -@@ -414,15 +414,16 @@ minstrel_ht_set_best_prob_rate(struct mi
  4335. - (max_tp_group != MINSTREL_CCK_GROUP))
  4336. - return;
  4337. -
  4338. -+ max_gpr_group = mg->max_group_prob_rate / MCS_GROUP_RATES;
  4339. -+ max_gpr_idx = mg->max_group_prob_rate % MCS_GROUP_RATES;
  4340. -+ max_gpr_prob = mi->groups[max_gpr_group].rates[max_gpr_idx].prob_ewma;
  4341. -+
  4342. - if (mrs->prob_ewma > MINSTREL_FRAC(75, 100)) {
  4343. - cur_tp_avg = minstrel_ht_get_tp_avg(mi, cur_group, cur_idx,
  4344. - mrs->prob_ewma);
  4345. - if (cur_tp_avg > tmp_tp_avg)
  4346. - mi->max_prob_rate = index;
  4347. -
  4348. -- max_gpr_group = mg->max_group_prob_rate / MCS_GROUP_RATES;
  4349. -- max_gpr_idx = mg->max_group_prob_rate % MCS_GROUP_RATES;
  4350. -- max_gpr_prob = mi->groups[max_gpr_group].rates[max_gpr_idx].prob_ewma;
  4351. - max_gpr_tp_avg = minstrel_ht_get_tp_avg(mi, max_gpr_group,
  4352. - max_gpr_idx,
  4353. - max_gpr_prob);
  4354. -@@ -431,7 +432,7 @@ minstrel_ht_set_best_prob_rate(struct mi
  4355. - } else {
  4356. - if (mrs->prob_ewma > tmp_prob)
  4357. - mi->max_prob_rate = index;
  4358. -- if (mrs->prob_ewma > mg->rates[mg->max_group_prob_rate].prob_ewma)
  4359. -+ if (mrs->prob_ewma > max_gpr_prob)
  4360. - mg->max_group_prob_rate = index;
  4361. - }
  4362. - }
  4363. diff --git a/package/kernel/mac80211/patches/318-brcmfmac-slightly-simplify-building-interface-combin.patch b/package/kernel/mac80211/patches/318-brcmfmac-slightly-simplify-building-interface-combin.patch
  4364. new file mode 100644
  4365. index 0000000..d946ecc
  4366. --- /dev/null
  4367. +++ b/package/kernel/mac80211/patches/318-brcmfmac-slightly-simplify-building-interface-combin.patch
  4368. @@ -0,0 +1,108 @@
  4369. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4370. +Date: Tue, 7 Jun 2016 21:10:18 +0200
  4371. +Subject: [PATCH] brcmfmac: slightly simplify building interface combinations
  4372. +MIME-Version: 1.0
  4373. +Content-Type: text/plain; charset=UTF-8
  4374. +Content-Transfer-Encoding: 8bit
  4375. +
  4376. +This change reorders some operations in brcmf_setup_ifmodes in hope to
  4377. +make it simpler:
  4378. +1) It allocates arrays right before filling them. This way it's easier
  4379. + to follow requested array length as it's immediately followed by
  4380. + code filling it. It's easier to check e.g. why we need 4 entries for
  4381. + P2P. Other than that it deduplicates some checks (e.g. for P2P).
  4382. +2) It reorders code to first prepare limits and then define a new combo.
  4383. + Previously this was mixed (e.g. we were setting num of channels
  4384. + before preparing limits).
  4385. +3) It modifies mbss code to use i variable just like other combos do.
  4386. +
  4387. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4388. +Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  4389. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4390. +---
  4391. +
  4392. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  4393. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  4394. +@@ -6284,29 +6284,15 @@ static int brcmf_setup_ifmodes(struct wi
  4395. + if (!combo)
  4396. + goto err;
  4397. +
  4398. +- c0_limits = kcalloc(p2p ? 3 : 2, sizeof(*c0_limits), GFP_KERNEL);
  4399. +- if (!c0_limits)
  4400. +- goto err;
  4401. +-
  4402. +- if (p2p) {
  4403. +- p2p_limits = kcalloc(4, sizeof(*p2p_limits), GFP_KERNEL);
  4404. +- if (!p2p_limits)
  4405. +- goto err;
  4406. +- }
  4407. +-
  4408. +- if (mbss) {
  4409. +- mbss_limits = kcalloc(1, sizeof(*mbss_limits), GFP_KERNEL);
  4410. +- if (!mbss_limits)
  4411. +- goto err;
  4412. +- }
  4413. +-
  4414. + wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
  4415. + BIT(NL80211_IFTYPE_ADHOC) |
  4416. + BIT(NL80211_IFTYPE_AP);
  4417. +
  4418. + c = 0;
  4419. + i = 0;
  4420. +- combo[c].num_different_channels = 1;
  4421. ++ c0_limits = kcalloc(p2p ? 3 : 2, sizeof(*c0_limits), GFP_KERNEL);
  4422. ++ if (!c0_limits)
  4423. ++ goto err;
  4424. + c0_limits[i].max = 1;
  4425. + c0_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  4426. + if (p2p) {
  4427. +@@ -6324,6 +6310,7 @@ static int brcmf_setup_ifmodes(struct wi
  4428. + c0_limits[i].max = 1;
  4429. + c0_limits[i++].types = BIT(NL80211_IFTYPE_AP);
  4430. + }
  4431. ++ combo[c].num_different_channels = 1;
  4432. + combo[c].max_interfaces = i;
  4433. + combo[c].n_limits = i;
  4434. + combo[c].limits = c0_limits;
  4435. +@@ -6331,7 +6318,9 @@ static int brcmf_setup_ifmodes(struct wi
  4436. + if (p2p) {
  4437. + c++;
  4438. + i = 0;
  4439. +- combo[c].num_different_channels = 1;
  4440. ++ p2p_limits = kcalloc(4, sizeof(*p2p_limits), GFP_KERNEL);
  4441. ++ if (!p2p_limits)
  4442. ++ goto err;
  4443. + p2p_limits[i].max = 1;
  4444. + p2p_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  4445. + p2p_limits[i].max = 1;
  4446. +@@ -6340,6 +6329,7 @@ static int brcmf_setup_ifmodes(struct wi
  4447. + p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT);
  4448. + p2p_limits[i].max = 1;
  4449. + p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  4450. ++ combo[c].num_different_channels = 1;
  4451. + combo[c].max_interfaces = i;
  4452. + combo[c].n_limits = i;
  4453. + combo[c].limits = p2p_limits;
  4454. +@@ -6347,14 +6337,19 @@ static int brcmf_setup_ifmodes(struct wi
  4455. +
  4456. + if (mbss) {
  4457. + c++;
  4458. ++ i = 0;
  4459. ++ mbss_limits = kcalloc(1, sizeof(*mbss_limits), GFP_KERNEL);
  4460. ++ if (!mbss_limits)
  4461. ++ goto err;
  4462. ++ mbss_limits[i].max = 4;
  4463. ++ mbss_limits[i++].types = BIT(NL80211_IFTYPE_AP);
  4464. + combo[c].beacon_int_infra_match = true;
  4465. + combo[c].num_different_channels = 1;
  4466. +- mbss_limits[0].max = 4;
  4467. +- mbss_limits[0].types = BIT(NL80211_IFTYPE_AP);
  4468. + combo[c].max_interfaces = 4;
  4469. +- combo[c].n_limits = 1;
  4470. ++ combo[c].n_limits = i;
  4471. + combo[c].limits = mbss_limits;
  4472. + }
  4473. ++
  4474. + wiphy->n_iface_combinations = n_combos;
  4475. + wiphy->iface_combinations = combo;
  4476. + return 0;
  4477. diff --git a/package/kernel/mac80211/patches/318-mac80211-move-A-MSDU-skb_linearize-call-to-ieee80211.patch b/package/kernel/mac80211/patches/318-mac80211-move-A-MSDU-skb_linearize-call-to-ieee80211.patch
  4478. deleted file mode 100644
  4479. index 655dc4b..0000000
  4480. --- a/package/kernel/mac80211/patches/318-mac80211-move-A-MSDU-skb_linearize-call-to-ieee80211.patch
  4481. +++ /dev/null
  4482. @@ -1,35 +0,0 @@
  4483. -From: Felix Fietkau <nbd@openwrt.org>
  4484. -Date: Tue, 2 Feb 2016 14:39:08 +0100
  4485. -Subject: [PATCH] mac80211: move A-MSDU skb_linearize call to
  4486. - ieee80211_amsdu_to_8023s
  4487. -
  4488. -Prepararation for zero-copy A-MSDU support with page fragment SKBs
  4489. -
  4490. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  4491. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  4492. ----
  4493. -
  4494. ---- a/net/mac80211/rx.c
  4495. -+++ b/net/mac80211/rx.c
  4496. -@@ -2203,9 +2203,6 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx
  4497. - skb->dev = dev;
  4498. - __skb_queue_head_init(&frame_list);
  4499. -
  4500. -- if (skb_linearize(skb))
  4501. -- return RX_DROP_UNUSABLE;
  4502. --
  4503. - ieee80211_amsdu_to_8023s(skb, &frame_list, dev->dev_addr,
  4504. - rx->sdata->vif.type,
  4505. - rx->local->hw.extra_tx_headroom, true);
  4506. ---- a/net/wireless/util.c
  4507. -+++ b/net/wireless/util.c
  4508. -@@ -657,6 +657,9 @@ void ieee80211_amsdu_to_8023s(struct sk_
  4509. - int remaining, err;
  4510. - u8 dst[ETH_ALEN], src[ETH_ALEN];
  4511. -
  4512. -+ if (skb_linearize(skb))
  4513. -+ goto out;
  4514. -+
  4515. - if (has_80211_header) {
  4516. - err = ieee80211_data_to_8023(skb, addr, iftype);
  4517. - if (err)
  4518. diff --git a/package/kernel/mac80211/patches/319-0001-brcmfmac-fix-lockup-when-removing-P2P-interface-afte.patch b/package/kernel/mac80211/patches/319-0001-brcmfmac-fix-lockup-when-removing-P2P-interface-afte.patch
  4519. new file mode 100644
  4520. index 0000000..073d012
  4521. --- /dev/null
  4522. +++ b/package/kernel/mac80211/patches/319-0001-brcmfmac-fix-lockup-when-removing-P2P-interface-afte.patch
  4523. @@ -0,0 +1,154 @@
  4524. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4525. +Date: Fri, 17 Jun 2016 12:29:21 +0200
  4526. +Subject: [PATCH] brcmfmac: fix lockup when removing P2P interface after
  4527. + event timeout
  4528. +MIME-Version: 1.0
  4529. +Content-Type: text/plain; charset=UTF-8
  4530. +Content-Transfer-Encoding: 8bit
  4531. +
  4532. +Removing P2P interface is handled by sending a proper request to the
  4533. +firmware. On success firmware triggers an event and driver's handler
  4534. +removes a matching interface.
  4535. +
  4536. +However on event timeout we remove interface directly from the cfg80211
  4537. +callback. Current code doesn't handle this case correctly as it always
  4538. +assumes rtnl to be unlocked.
  4539. +
  4540. +Fix it by adding an extra rtnl_locked parameter to functions and calling
  4541. +unregister_netdevice when needed.
  4542. +
  4543. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4544. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4545. +---
  4546. +
  4547. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  4548. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  4549. +@@ -548,12 +548,16 @@ fail:
  4550. + return -EBADE;
  4551. + }
  4552. +
  4553. +-static void brcmf_net_detach(struct net_device *ndev)
  4554. ++static void brcmf_net_detach(struct net_device *ndev, bool rtnl_locked)
  4555. + {
  4556. +- if (ndev->reg_state == NETREG_REGISTERED)
  4557. +- unregister_netdev(ndev);
  4558. +- else
  4559. ++ if (ndev->reg_state == NETREG_REGISTERED) {
  4560. ++ if (rtnl_locked)
  4561. ++ unregister_netdevice(ndev);
  4562. ++ else
  4563. ++ unregister_netdev(ndev);
  4564. ++ } else {
  4565. + brcmf_cfg80211_free_netdev(ndev);
  4566. ++ }
  4567. + }
  4568. +
  4569. + void brcmf_net_setcarrier(struct brcmf_if *ifp, bool on)
  4570. +@@ -651,7 +655,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  4571. + brcmf_err("ERROR: netdev:%s already exists\n",
  4572. + ifp->ndev->name);
  4573. + netif_stop_queue(ifp->ndev);
  4574. +- brcmf_net_detach(ifp->ndev);
  4575. ++ brcmf_net_detach(ifp->ndev, false);
  4576. + drvr->iflist[bsscfgidx] = NULL;
  4577. + } else {
  4578. + brcmf_dbg(INFO, "netdev:%s ignore IF event\n",
  4579. +@@ -699,7 +703,8 @@ struct brcmf_if *brcmf_add_if(struct brc
  4580. + return ifp;
  4581. + }
  4582. +
  4583. +-static void brcmf_del_if(struct brcmf_pub *drvr, s32 bsscfgidx)
  4584. ++static void brcmf_del_if(struct brcmf_pub *drvr, s32 bsscfgidx,
  4585. ++ bool rtnl_locked)
  4586. + {
  4587. + struct brcmf_if *ifp;
  4588. +
  4589. +@@ -729,7 +734,7 @@ static void brcmf_del_if(struct brcmf_pu
  4590. + cancel_work_sync(&ifp->multicast_work);
  4591. + cancel_work_sync(&ifp->ndoffload_work);
  4592. + }
  4593. +- brcmf_net_detach(ifp->ndev);
  4594. ++ brcmf_net_detach(ifp->ndev, rtnl_locked);
  4595. + } else {
  4596. + /* Only p2p device interfaces which get dynamically created
  4597. + * end up here. In this case the p2p module should be informed
  4598. +@@ -743,14 +748,14 @@ static void brcmf_del_if(struct brcmf_pu
  4599. + }
  4600. + }
  4601. +
  4602. +-void brcmf_remove_interface(struct brcmf_if *ifp)
  4603. ++void brcmf_remove_interface(struct brcmf_if *ifp, bool rtnl_locked)
  4604. + {
  4605. + if (!ifp || WARN_ON(ifp->drvr->iflist[ifp->bsscfgidx] != ifp))
  4606. + return;
  4607. + brcmf_dbg(TRACE, "Enter, bsscfgidx=%d, ifidx=%d\n", ifp->bsscfgidx,
  4608. + ifp->ifidx);
  4609. + brcmf_fws_del_interface(ifp);
  4610. +- brcmf_del_if(ifp->drvr, ifp->bsscfgidx);
  4611. ++ brcmf_del_if(ifp->drvr, ifp->bsscfgidx, rtnl_locked);
  4612. + }
  4613. +
  4614. + #ifdef CONFIG_INET
  4615. +@@ -1057,9 +1062,9 @@ fail:
  4616. + brcmf_fws_deinit(drvr);
  4617. + }
  4618. + if (ifp)
  4619. +- brcmf_net_detach(ifp->ndev);
  4620. ++ brcmf_net_detach(ifp->ndev, false);
  4621. + if (p2p_ifp)
  4622. +- brcmf_net_detach(p2p_ifp->ndev);
  4623. ++ brcmf_net_detach(p2p_ifp->ndev, false);
  4624. + drvr->iflist[0] = NULL;
  4625. + drvr->iflist[1] = NULL;
  4626. + if (drvr->settings->ignore_probe_fail)
  4627. +@@ -1128,7 +1133,7 @@ void brcmf_detach(struct device *dev)
  4628. +
  4629. + /* make sure primary interface removed last */
  4630. + for (i = BRCMF_MAX_IFS-1; i > -1; i--)
  4631. +- brcmf_remove_interface(drvr->iflist[i]);
  4632. ++ brcmf_remove_interface(drvr->iflist[i], false);
  4633. +
  4634. + brcmf_cfg80211_detach(drvr->config);
  4635. +
  4636. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  4637. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  4638. +@@ -216,7 +216,7 @@ struct brcmf_if *brcmf_get_ifp(struct br
  4639. + int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  4640. + struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
  4641. + bool is_p2pdev, char *name, u8 *mac_addr);
  4642. +-void brcmf_remove_interface(struct brcmf_if *ifp);
  4643. ++void brcmf_remove_interface(struct brcmf_if *ifp, bool rtnl_locked);
  4644. + void brcmf_txflowblock_if(struct brcmf_if *ifp,
  4645. + enum brcmf_netif_stop_reason reason, bool state);
  4646. + void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
  4647. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  4648. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  4649. +@@ -183,7 +183,7 @@ static void brcmf_fweh_handle_if_event(s
  4650. + err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data);
  4651. +
  4652. + if (ifp && ifevent->action == BRCMF_E_IF_DEL)
  4653. +- brcmf_remove_interface(ifp);
  4654. ++ brcmf_remove_interface(ifp, false);
  4655. + }
  4656. +
  4657. + /**
  4658. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  4659. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  4660. +@@ -2289,7 +2289,7 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  4661. + err = 0;
  4662. + }
  4663. + if (err)
  4664. +- brcmf_remove_interface(vif->ifp);
  4665. ++ brcmf_remove_interface(vif->ifp, true);
  4666. +
  4667. + brcmf_cfg80211_arm_vif_event(cfg, NULL);
  4668. + if (vif->wdev.iftype != NL80211_IFTYPE_P2P_DEVICE)
  4669. +@@ -2395,7 +2395,7 @@ void brcmf_p2p_detach(struct brcmf_p2p_i
  4670. + if (vif != NULL) {
  4671. + brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  4672. + brcmf_p2p_deinit_discovery(p2p);
  4673. +- brcmf_remove_interface(vif->ifp);
  4674. ++ brcmf_remove_interface(vif->ifp, false);
  4675. + }
  4676. + /* just set it all to zero */
  4677. + memset(p2p, 0, sizeof(*p2p));
  4678. diff --git a/package/kernel/mac80211/patches/319-0002-brcmfmac-use-const-char-for-interface-name-in-brcmf_.patch b/package/kernel/mac80211/patches/319-0002-brcmfmac-use-const-char-for-interface-name-in-brcmf_.patch
  4679. new file mode 100644
  4680. index 0000000..6d3f3c6
  4681. --- /dev/null
  4682. +++ b/package/kernel/mac80211/patches/319-0002-brcmfmac-use-const-char-for-interface-name-in-brcmf_.patch
  4683. @@ -0,0 +1,40 @@
  4684. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4685. +Date: Fri, 17 Jun 2016 12:48:44 +0200
  4686. +Subject: [PATCH] brcmfmac: use const char * for interface name in
  4687. + brcmf_add_if
  4688. +MIME-Version: 1.0
  4689. +Content-Type: text/plain; charset=UTF-8
  4690. +Content-Transfer-Encoding: 8bit
  4691. +
  4692. +This function can work just fine with const pointer, it only calls
  4693. +alloc_netdev which take const as well. Moreover it makes this function
  4694. +more flexible as some cfg80211 callback may provide const char * as
  4695. +well, e.g. add_virtual_intf. This will be needed for more advanced
  4696. +interface management.
  4697. +
  4698. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4699. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4700. +---
  4701. +
  4702. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  4703. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  4704. +@@ -638,7 +638,7 @@ fail:
  4705. + }
  4706. +
  4707. + struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
  4708. +- bool is_p2pdev, char *name, u8 *mac_addr)
  4709. ++ bool is_p2pdev, const char *name, u8 *mac_addr)
  4710. + {
  4711. + struct brcmf_if *ifp;
  4712. + struct net_device *ndev;
  4713. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  4714. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  4715. +@@ -215,7 +215,7 @@ char *brcmf_ifname(struct brcmf_if *ifp)
  4716. + struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx);
  4717. + int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  4718. + struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
  4719. +- bool is_p2pdev, char *name, u8 *mac_addr);
  4720. ++ bool is_p2pdev, const char *name, u8 *mac_addr);
  4721. + void brcmf_remove_interface(struct brcmf_if *ifp, bool rtnl_locked);
  4722. + void brcmf_txflowblock_if(struct brcmf_if *ifp,
  4723. + enum brcmf_netif_stop_reason reason, bool state);
  4724. diff --git a/package/kernel/mac80211/patches/319-0003-brcmfmac-include-also-core.h-header-in-cfg80211.h.patch b/package/kernel/mac80211/patches/319-0003-brcmfmac-include-also-core.h-header-in-cfg80211.h.patch
  4725. new file mode 100644
  4726. index 0000000..eeda766
  4727. --- /dev/null
  4728. +++ b/package/kernel/mac80211/patches/319-0003-brcmfmac-include-also-core.h-header-in-cfg80211.h.patch
  4729. @@ -0,0 +1,33 @@
  4730. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4731. +Date: Sat, 18 Jun 2016 18:49:38 +0200
  4732. +Subject: [PATCH] brcmfmac: include also core.h header in cfg80211.h
  4733. +MIME-Version: 1.0
  4734. +Content-Type: text/plain; charset=UTF-8
  4735. +Content-Transfer-Encoding: 8bit
  4736. +
  4737. +This header provides two inline functions using struct brcmf_if so we
  4738. +need core.h to avoid:
  4739. +
  4740. +drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h: In function ‘ndev_to_prof’:
  4741. +drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h:368:13: error: dereferencing pointer to incomplete type
  4742. + return &ifp->vif->profile;
  4743. + ^
  4744. +drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h: In function ‘ndev_to_vif’:
  4745. +drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h:374:12: error: dereferencing pointer to incomplete type
  4746. + return ifp->vif;
  4747. + ^
  4748. +
  4749. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4750. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4751. +---
  4752. +
  4753. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  4754. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  4755. +@@ -20,6 +20,7 @@
  4756. + /* for brcmu_d11inf */
  4757. + #include <brcmu_d11.h>
  4758. +
  4759. ++#include "core.h"
  4760. + #include "fwil_types.h"
  4761. + #include "p2p.h"
  4762. +
  4763. diff --git a/package/kernel/mac80211/patches/319-0004-brcmfmac-add-missing-break-when-deleting-P2P_DEVICE.patch b/package/kernel/mac80211/patches/319-0004-brcmfmac-add-missing-break-when-deleting-P2P_DEVICE.patch
  4764. new file mode 100644
  4765. index 0000000..3819248
  4766. --- /dev/null
  4767. +++ b/package/kernel/mac80211/patches/319-0004-brcmfmac-add-missing-break-when-deleting-P2P_DEVICE.patch
  4768. @@ -0,0 +1,27 @@
  4769. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4770. +Date: Sun, 19 Jun 2016 01:55:57 +0200
  4771. +Subject: [PATCH] brcmfmac: add missing break when deleting P2P_DEVICE
  4772. +MIME-Version: 1.0
  4773. +Content-Type: text/plain; charset=UTF-8
  4774. +Content-Transfer-Encoding: 8bit
  4775. +
  4776. +We obviously don't want to fall through in that switch. With this change
  4777. +1) We wait for event (triggered by p2p_disc) as expected
  4778. +2) We remove interface manually on timeout
  4779. +3) We return 0 on success instead of -ENOTSUPP
  4780. +
  4781. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4782. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4783. +---
  4784. +
  4785. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  4786. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  4787. +@@ -2263,6 +2263,8 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  4788. + return 0;
  4789. + brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  4790. + brcmf_p2p_deinit_discovery(p2p);
  4791. ++ break;
  4792. ++
  4793. + default:
  4794. + return -ENOTSUPP;
  4795. + }
  4796. diff --git a/package/kernel/mac80211/patches/319-0005-brcmfmac-delete-interface-directly-in-code-that-sent.patch b/package/kernel/mac80211/patches/319-0005-brcmfmac-delete-interface-directly-in-code-that-sent.patch
  4797. new file mode 100644
  4798. index 0000000..12d7eb4
  4799. --- /dev/null
  4800. +++ b/package/kernel/mac80211/patches/319-0005-brcmfmac-delete-interface-directly-in-code-that-sent.patch
  4801. @@ -0,0 +1,75 @@
  4802. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4803. +Date: Wed, 29 Jun 2016 21:54:26 +0200
  4804. +Subject: [PATCH] brcmfmac: delete interface directly in code that sent fw
  4805. + request
  4806. +MIME-Version: 1.0
  4807. +Content-Type: text/plain; charset=UTF-8
  4808. +Content-Transfer-Encoding: 8bit
  4809. +
  4810. +So far when receiving event about in-firmware-interface removal our
  4811. +event worker was notifying listener and afterwards it was removing Linux
  4812. +interface.
  4813. +
  4814. +First of all it was resulting in slightly unexpected order. The listener
  4815. +(del_virtual_intf callback) was (usually) returning with success before
  4816. +we even called unregister_netdev(ice).
  4817. +
  4818. +Please note this couldn't be simply fixed by changing order of calls in
  4819. +brcmf_fweh_handle_if_event as unregistering interface earlier could free
  4820. +struct brcmf_if.
  4821. +
  4822. +Another problem of current implementation are possible lockups. Focus on
  4823. +the time slot between calling event handler and removing Linux
  4824. +interface. During that time original caller may leave (unlocking rtnl
  4825. +semaphore) *and* another call to the same code may be done (locking it
  4826. +again). If that happens our event handler will stuck at removing Linux
  4827. +interface, it won't handle another event and will block process holding
  4828. +rtnl lock.
  4829. +
  4830. +This can be simply solved by unregistering interface in a proper
  4831. +callback, right after receiving confirmation event from firmware. This
  4832. +only required modifying worker to don't unregister on its own if there
  4833. +is someone waiting for the event.
  4834. +
  4835. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4836. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4837. +---
  4838. +
  4839. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  4840. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  4841. +@@ -18,6 +18,7 @@
  4842. + #include "brcmu_wifi.h"
  4843. + #include "brcmu_utils.h"
  4844. +
  4845. ++#include "cfg80211.h"
  4846. + #include "core.h"
  4847. + #include "debug.h"
  4848. + #include "tracepoint.h"
  4849. +@@ -182,8 +183,13 @@ static void brcmf_fweh_handle_if_event(s
  4850. +
  4851. + err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data);
  4852. +
  4853. +- if (ifp && ifevent->action == BRCMF_E_IF_DEL)
  4854. +- brcmf_remove_interface(ifp, false);
  4855. ++ if (ifp && ifevent->action == BRCMF_E_IF_DEL) {
  4856. ++ bool armed = brcmf_cfg80211_vif_event_armed(drvr->config);
  4857. ++
  4858. ++ /* Default handling in case no-one waits for this event */
  4859. ++ if (!armed)
  4860. ++ brcmf_remove_interface(ifp, false);
  4861. ++ }
  4862. + }
  4863. +
  4864. + /**
  4865. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  4866. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  4867. +@@ -2290,8 +2290,7 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  4868. + else
  4869. + err = 0;
  4870. + }
  4871. +- if (err)
  4872. +- brcmf_remove_interface(vif->ifp, true);
  4873. ++ brcmf_remove_interface(vif->ifp, true);
  4874. +
  4875. + brcmf_cfg80211_arm_vif_event(cfg, NULL);
  4876. + if (vif->wdev.iftype != NL80211_IFTYPE_P2P_DEVICE)
  4877. diff --git a/package/kernel/mac80211/patches/319-0006-brcmfmac-support-removing-AP-interfaces-with-interfa.patch b/package/kernel/mac80211/patches/319-0006-brcmfmac-support-removing-AP-interfaces-with-interfa.patch
  4878. new file mode 100644
  4879. index 0000000..2f7165e
  4880. --- /dev/null
  4881. +++ b/package/kernel/mac80211/patches/319-0006-brcmfmac-support-removing-AP-interfaces-with-interfa.patch
  4882. @@ -0,0 +1,84 @@
  4883. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4884. +Date: Wed, 29 Jun 2016 21:54:27 +0200
  4885. +Subject: [PATCH] brcmfmac: support removing AP interfaces with
  4886. + "interface_remove"
  4887. +MIME-Version: 1.0
  4888. +Content-Type: text/plain; charset=UTF-8
  4889. +Content-Transfer-Encoding: 8bit
  4890. +
  4891. +New firmwares (e.g. 10.10.69.36 for BCM4366) support "interface_remove"
  4892. +for removing interfaces. Try to use this method on cfg80211 request. In
  4893. +case of older firmwares (e.g. 7.35.177.56 for BCM43602 as I tested) this
  4894. +will just result in firmware rejecting command and this won't change any
  4895. +behavior.
  4896. +
  4897. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4898. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4899. +---
  4900. +
  4901. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  4902. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  4903. +@@ -785,12 +785,48 @@ s32 brcmf_notify_escan_complete(struct b
  4904. + return err;
  4905. + }
  4906. +
  4907. ++static int brcmf_cfg80211_del_ap_iface(struct wiphy *wiphy,
  4908. ++ struct wireless_dev *wdev)
  4909. ++{
  4910. ++ struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy);
  4911. ++ struct net_device *ndev = wdev->netdev;
  4912. ++ struct brcmf_if *ifp = netdev_priv(ndev);
  4913. ++ int ret;
  4914. ++ int err;
  4915. ++
  4916. ++ brcmf_cfg80211_arm_vif_event(cfg, ifp->vif);
  4917. ++
  4918. ++ err = brcmf_fil_bsscfg_data_set(ifp, "interface_remove", NULL, 0);
  4919. ++ if (err) {
  4920. ++ brcmf_err("interface_remove failed %d\n", err);
  4921. ++ goto err_unarm;
  4922. ++ }
  4923. ++
  4924. ++ /* wait for firmware event */
  4925. ++ ret = brcmf_cfg80211_wait_vif_event(cfg, BRCMF_E_IF_DEL,
  4926. ++ BRCMF_VIF_EVENT_TIMEOUT);
  4927. ++ if (!ret) {
  4928. ++ brcmf_err("timeout occurred\n");
  4929. ++ err = -EIO;
  4930. ++ goto err_unarm;
  4931. ++ }
  4932. ++
  4933. ++ brcmf_remove_interface(ifp, true);
  4934. ++
  4935. ++err_unarm:
  4936. ++ brcmf_cfg80211_arm_vif_event(cfg, NULL);
  4937. ++ return err;
  4938. ++}
  4939. ++
  4940. + static
  4941. + int brcmf_cfg80211_del_iface(struct wiphy *wiphy, struct wireless_dev *wdev)
  4942. + {
  4943. + struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy);
  4944. + struct net_device *ndev = wdev->netdev;
  4945. +
  4946. ++ if (ndev && ndev == cfg_to_ndev(cfg))
  4947. ++ return -ENOTSUPP;
  4948. ++
  4949. + /* vif event pending in firmware */
  4950. + if (brcmf_cfg80211_vif_event_armed(cfg))
  4951. + return -EBUSY;
  4952. +@@ -807,12 +843,13 @@ int brcmf_cfg80211_del_iface(struct wiph
  4953. + switch (wdev->iftype) {
  4954. + case NL80211_IFTYPE_ADHOC:
  4955. + case NL80211_IFTYPE_STATION:
  4956. +- case NL80211_IFTYPE_AP:
  4957. + case NL80211_IFTYPE_AP_VLAN:
  4958. + case NL80211_IFTYPE_WDS:
  4959. + case NL80211_IFTYPE_MONITOR:
  4960. + case NL80211_IFTYPE_MESH_POINT:
  4961. + return -EOPNOTSUPP;
  4962. ++ case NL80211_IFTYPE_AP:
  4963. ++ return brcmf_cfg80211_del_ap_iface(wiphy, wdev);
  4964. + case NL80211_IFTYPE_P2P_CLIENT:
  4965. + case NL80211_IFTYPE_P2P_GO:
  4966. + case NL80211_IFTYPE_P2P_DEVICE:
  4967. diff --git a/package/kernel/mac80211/patches/319-cfg80211-add-function-for-802.3-conversion-with-sepa.patch b/package/kernel/mac80211/patches/319-cfg80211-add-function-for-802.3-conversion-with-sepa.patch
  4968. deleted file mode 100644
  4969. index b646ab3..0000000
  4970. --- a/package/kernel/mac80211/patches/319-cfg80211-add-function-for-802.3-conversion-with-sepa.patch
  4971. +++ /dev/null
  4972. @@ -1,186 +0,0 @@
  4973. -From: Felix Fietkau <nbd@openwrt.org>
  4974. -Date: Tue, 2 Feb 2016 14:39:09 +0100
  4975. -Subject: [PATCH] cfg80211: add function for 802.3 conversion with separate
  4976. - output buffer
  4977. -
  4978. -Use skb_copy_bits in preparation for allowing fragmented skbs
  4979. -
  4980. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  4981. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  4982. ----
  4983. -
  4984. ---- a/net/wireless/util.c
  4985. -+++ b/net/wireless/util.c
  4986. -@@ -393,9 +393,9 @@ unsigned int ieee80211_get_hdrlen_from_s
  4987. - }
  4988. - EXPORT_SYMBOL(ieee80211_get_hdrlen_from_skb);
  4989. -
  4990. --unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr)
  4991. -+static unsigned int __ieee80211_get_mesh_hdrlen(u8 flags)
  4992. - {
  4993. -- int ae = meshhdr->flags & MESH_FLAGS_AE;
  4994. -+ int ae = flags & MESH_FLAGS_AE;
  4995. - /* 802.11-2012, 8.2.4.7.3 */
  4996. - switch (ae) {
  4997. - default:
  4998. -@@ -407,21 +407,31 @@ unsigned int ieee80211_get_mesh_hdrlen(s
  4999. - return 18;
  5000. - }
  5001. - }
  5002. -+
  5003. -+unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr)
  5004. -+{
  5005. -+ return __ieee80211_get_mesh_hdrlen(meshhdr->flags);
  5006. -+}
  5007. - EXPORT_SYMBOL(ieee80211_get_mesh_hdrlen);
  5008. -
  5009. --int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
  5010. -- enum nl80211_iftype iftype)
  5011. -+static int __ieee80211_data_to_8023(struct sk_buff *skb, struct ethhdr *ehdr,
  5012. -+ const u8 *addr, enum nl80211_iftype iftype)
  5013. - {
  5014. - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
  5015. -- u16 hdrlen, ethertype;
  5016. -- u8 *payload;
  5017. -- u8 dst[ETH_ALEN];
  5018. -- u8 src[ETH_ALEN] __aligned(2);
  5019. -+ struct {
  5020. -+ u8 hdr[ETH_ALEN] __aligned(2);
  5021. -+ __be16 proto;
  5022. -+ } payload;
  5023. -+ struct ethhdr tmp;
  5024. -+ u16 hdrlen;
  5025. -+ u8 mesh_flags = 0;
  5026. -
  5027. - if (unlikely(!ieee80211_is_data_present(hdr->frame_control)))
  5028. - return -1;
  5029. -
  5030. - hdrlen = ieee80211_hdrlen(hdr->frame_control);
  5031. -+ if (skb->len < hdrlen + 8)
  5032. -+ return -1;
  5033. -
  5034. - /* convert IEEE 802.11 header + possible LLC headers into Ethernet
  5035. - * header
  5036. -@@ -432,8 +442,11 @@ int ieee80211_data_to_8023(struct sk_buf
  5037. - * 1 0 BSSID SA DA n/a
  5038. - * 1 1 RA TA DA SA
  5039. - */
  5040. -- memcpy(dst, ieee80211_get_DA(hdr), ETH_ALEN);
  5041. -- memcpy(src, ieee80211_get_SA(hdr), ETH_ALEN);
  5042. -+ memcpy(tmp.h_dest, ieee80211_get_DA(hdr), ETH_ALEN);
  5043. -+ memcpy(tmp.h_source, ieee80211_get_SA(hdr), ETH_ALEN);
  5044. -+
  5045. -+ if (iftype == NL80211_IFTYPE_MESH_POINT)
  5046. -+ skb_copy_bits(skb, hdrlen, &mesh_flags, 1);
  5047. -
  5048. - switch (hdr->frame_control &
  5049. - cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) {
  5050. -@@ -450,44 +463,31 @@ int ieee80211_data_to_8023(struct sk_buf
  5051. - iftype != NL80211_IFTYPE_STATION))
  5052. - return -1;
  5053. - if (iftype == NL80211_IFTYPE_MESH_POINT) {
  5054. -- struct ieee80211s_hdr *meshdr =
  5055. -- (struct ieee80211s_hdr *) (skb->data + hdrlen);
  5056. -- /* make sure meshdr->flags is on the linear part */
  5057. -- if (!pskb_may_pull(skb, hdrlen + 1))
  5058. -- return -1;
  5059. -- if (meshdr->flags & MESH_FLAGS_AE_A4)
  5060. -+ if (mesh_flags & MESH_FLAGS_AE_A4)
  5061. - return -1;
  5062. -- if (meshdr->flags & MESH_FLAGS_AE_A5_A6) {
  5063. -+ if (mesh_flags & MESH_FLAGS_AE_A5_A6) {
  5064. - skb_copy_bits(skb, hdrlen +
  5065. - offsetof(struct ieee80211s_hdr, eaddr1),
  5066. -- dst, ETH_ALEN);
  5067. -- skb_copy_bits(skb, hdrlen +
  5068. -- offsetof(struct ieee80211s_hdr, eaddr2),
  5069. -- src, ETH_ALEN);
  5070. -+ tmp.h_dest, 2 * ETH_ALEN);
  5071. - }
  5072. -- hdrlen += ieee80211_get_mesh_hdrlen(meshdr);
  5073. -+ hdrlen += __ieee80211_get_mesh_hdrlen(mesh_flags);
  5074. - }
  5075. - break;
  5076. - case cpu_to_le16(IEEE80211_FCTL_FROMDS):
  5077. - if ((iftype != NL80211_IFTYPE_STATION &&
  5078. - iftype != NL80211_IFTYPE_P2P_CLIENT &&
  5079. - iftype != NL80211_IFTYPE_MESH_POINT) ||
  5080. -- (is_multicast_ether_addr(dst) &&
  5081. -- ether_addr_equal(src, addr)))
  5082. -+ (is_multicast_ether_addr(tmp.h_dest) &&
  5083. -+ ether_addr_equal(tmp.h_source, addr)))
  5084. - return -1;
  5085. - if (iftype == NL80211_IFTYPE_MESH_POINT) {
  5086. -- struct ieee80211s_hdr *meshdr =
  5087. -- (struct ieee80211s_hdr *) (skb->data + hdrlen);
  5088. -- /* make sure meshdr->flags is on the linear part */
  5089. -- if (!pskb_may_pull(skb, hdrlen + 1))
  5090. -- return -1;
  5091. -- if (meshdr->flags & MESH_FLAGS_AE_A5_A6)
  5092. -+ if (mesh_flags & MESH_FLAGS_AE_A5_A6)
  5093. - return -1;
  5094. -- if (meshdr->flags & MESH_FLAGS_AE_A4)
  5095. -+ if (mesh_flags & MESH_FLAGS_AE_A4)
  5096. - skb_copy_bits(skb, hdrlen +
  5097. - offsetof(struct ieee80211s_hdr, eaddr1),
  5098. -- src, ETH_ALEN);
  5099. -- hdrlen += ieee80211_get_mesh_hdrlen(meshdr);
  5100. -+ tmp.h_source, ETH_ALEN);
  5101. -+ hdrlen += __ieee80211_get_mesh_hdrlen(mesh_flags);
  5102. - }
  5103. - break;
  5104. - case cpu_to_le16(0):
  5105. -@@ -498,33 +498,33 @@ int ieee80211_data_to_8023(struct sk_buf
  5106. - break;
  5107. - }
  5108. -
  5109. -- if (!pskb_may_pull(skb, hdrlen + 8))
  5110. -- return -1;
  5111. --
  5112. -- payload = skb->data + hdrlen;
  5113. -- ethertype = (payload[6] << 8) | payload[7];
  5114. -+ skb_copy_bits(skb, hdrlen, &payload, sizeof(payload));
  5115. -+ tmp.h_proto = payload.proto;
  5116. -
  5117. -- if (likely((ether_addr_equal(payload, rfc1042_header) &&
  5118. -- ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) ||
  5119. -- ether_addr_equal(payload, bridge_tunnel_header))) {
  5120. -+ if (likely((ether_addr_equal(payload.hdr, rfc1042_header) &&
  5121. -+ tmp.h_proto != htons(ETH_P_AARP) &&
  5122. -+ tmp.h_proto != htons(ETH_P_IPX)) ||
  5123. -+ ether_addr_equal(payload.hdr, bridge_tunnel_header)))
  5124. - /* remove RFC1042 or Bridge-Tunnel encapsulation and
  5125. - * replace EtherType */
  5126. -- skb_pull(skb, hdrlen + 6);
  5127. -- memcpy(skb_push(skb, ETH_ALEN), src, ETH_ALEN);
  5128. -- memcpy(skb_push(skb, ETH_ALEN), dst, ETH_ALEN);
  5129. -- } else {
  5130. -- struct ethhdr *ehdr;
  5131. -- __be16 len;
  5132. -+ hdrlen += ETH_ALEN + 2;
  5133. -+ else
  5134. -+ tmp.h_proto = htons(skb->len);
  5135. -
  5136. -- skb_pull(skb, hdrlen);
  5137. -- len = htons(skb->len);
  5138. -+ pskb_pull(skb, hdrlen);
  5139. -+
  5140. -+ if (!ehdr)
  5141. - ehdr = (struct ethhdr *) skb_push(skb, sizeof(struct ethhdr));
  5142. -- memcpy(ehdr->h_dest, dst, ETH_ALEN);
  5143. -- memcpy(ehdr->h_source, src, ETH_ALEN);
  5144. -- ehdr->h_proto = len;
  5145. -- }
  5146. -+ memcpy(ehdr, &tmp, sizeof(tmp));
  5147. -+
  5148. - return 0;
  5149. - }
  5150. -+
  5151. -+int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
  5152. -+ enum nl80211_iftype iftype)
  5153. -+{
  5154. -+ return __ieee80211_data_to_8023(skb, NULL, addr, iftype);
  5155. -+}
  5156. - EXPORT_SYMBOL(ieee80211_data_to_8023);
  5157. -
  5158. - int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr,
  5159. diff --git a/package/kernel/mac80211/patches/320-cfg80211-add-support-for-non-linear-skbs-in-ieee8021.patch b/package/kernel/mac80211/patches/320-cfg80211-add-support-for-non-linear-skbs-in-ieee8021.patch
  5160. deleted file mode 100644
  5161. index 2eeed22..0000000
  5162. --- a/package/kernel/mac80211/patches/320-cfg80211-add-support-for-non-linear-skbs-in-ieee8021.patch
  5163. +++ /dev/null
  5164. @@ -1,159 +0,0 @@
  5165. -From: Felix Fietkau <nbd@openwrt.org>
  5166. -Date: Tue, 2 Feb 2016 14:39:10 +0100
  5167. -Subject: [PATCH] cfg80211: add support for non-linear skbs in
  5168. - ieee80211_amsdu_to_8023s
  5169. -
  5170. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  5171. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  5172. ----
  5173. -
  5174. ---- a/net/wireless/util.c
  5175. -+++ b/net/wireless/util.c
  5176. -@@ -644,73 +644,75 @@ int ieee80211_data_from_8023(struct sk_b
  5177. - }
  5178. - EXPORT_SYMBOL(ieee80211_data_from_8023);
  5179. -
  5180. -+static struct sk_buff *
  5181. -+__ieee80211_amsdu_copy(struct sk_buff *skb, unsigned int hlen,
  5182. -+ int offset, int len)
  5183. -+{
  5184. -+ struct sk_buff *frame;
  5185. -+
  5186. -+ if (skb->len - offset < len)
  5187. -+ return NULL;
  5188. -+
  5189. -+ /*
  5190. -+ * Allocate and reserve two bytes more for payload
  5191. -+ * alignment since sizeof(struct ethhdr) is 14.
  5192. -+ */
  5193. -+ frame = dev_alloc_skb(hlen + sizeof(struct ethhdr) + 2 + len);
  5194. -+
  5195. -+ skb_reserve(frame, hlen + sizeof(struct ethhdr) + 2);
  5196. -+ skb_copy_bits(skb, offset, skb_put(frame, len), len);
  5197. -+
  5198. -+ return frame;
  5199. -+}
  5200. -
  5201. - void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
  5202. - const u8 *addr, enum nl80211_iftype iftype,
  5203. - const unsigned int extra_headroom,
  5204. - bool has_80211_header)
  5205. - {
  5206. -+ unsigned int hlen = ALIGN(extra_headroom, 4);
  5207. - struct sk_buff *frame = NULL;
  5208. - u16 ethertype;
  5209. - u8 *payload;
  5210. -- const struct ethhdr *eth;
  5211. -- int remaining, err;
  5212. -- u8 dst[ETH_ALEN], src[ETH_ALEN];
  5213. --
  5214. -- if (skb_linearize(skb))
  5215. -- goto out;
  5216. -+ int offset = 0, remaining, err;
  5217. -+ struct ethhdr eth;
  5218. -+ bool reuse_skb = true;
  5219. -+ bool last = false;
  5220. -
  5221. - if (has_80211_header) {
  5222. -- err = ieee80211_data_to_8023(skb, addr, iftype);
  5223. -+ err = __ieee80211_data_to_8023(skb, &eth, addr, iftype);
  5224. - if (err)
  5225. - goto out;
  5226. --
  5227. -- /* skip the wrapping header */
  5228. -- eth = (struct ethhdr *) skb_pull(skb, sizeof(struct ethhdr));
  5229. -- if (!eth)
  5230. -- goto out;
  5231. -- } else {
  5232. -- eth = (struct ethhdr *) skb->data;
  5233. - }
  5234. -
  5235. -- while (skb != frame) {
  5236. -+ while (!last) {
  5237. -+ unsigned int subframe_len;
  5238. -+ int len;
  5239. - u8 padding;
  5240. -- __be16 len = eth->h_proto;
  5241. -- unsigned int subframe_len = sizeof(struct ethhdr) + ntohs(len);
  5242. --
  5243. -- remaining = skb->len;
  5244. -- memcpy(dst, eth->h_dest, ETH_ALEN);
  5245. -- memcpy(src, eth->h_source, ETH_ALEN);
  5246. -
  5247. -+ skb_copy_bits(skb, offset, &eth, sizeof(eth));
  5248. -+ len = ntohs(eth.h_proto);
  5249. -+ subframe_len = sizeof(struct ethhdr) + len;
  5250. - padding = (4 - subframe_len) & 0x3;
  5251. -+
  5252. - /* the last MSDU has no padding */
  5253. -+ remaining = skb->len - offset;
  5254. - if (subframe_len > remaining)
  5255. - goto purge;
  5256. -
  5257. -- skb_pull(skb, sizeof(struct ethhdr));
  5258. -+ offset += sizeof(struct ethhdr);
  5259. - /* reuse skb for the last subframe */
  5260. -- if (remaining <= subframe_len + padding)
  5261. -+ last = remaining <= subframe_len + padding;
  5262. -+ if (!skb_is_nonlinear(skb) && last) {
  5263. -+ skb_pull(skb, offset);
  5264. - frame = skb;
  5265. -- else {
  5266. -- unsigned int hlen = ALIGN(extra_headroom, 4);
  5267. -- /*
  5268. -- * Allocate and reserve two bytes more for payload
  5269. -- * alignment since sizeof(struct ethhdr) is 14.
  5270. -- */
  5271. -- frame = dev_alloc_skb(hlen + subframe_len + 2);
  5272. -+ reuse_skb = true;
  5273. -+ } else {
  5274. -+ frame = __ieee80211_amsdu_copy(skb, hlen, offset, len);
  5275. - if (!frame)
  5276. - goto purge;
  5277. -
  5278. -- skb_reserve(frame, hlen + sizeof(struct ethhdr) + 2);
  5279. -- memcpy(skb_put(frame, ntohs(len)), skb->data,
  5280. -- ntohs(len));
  5281. --
  5282. -- eth = (struct ethhdr *)skb_pull(skb, ntohs(len) +
  5283. -- padding);
  5284. -- if (!eth) {
  5285. -- dev_kfree_skb(frame);
  5286. -- goto purge;
  5287. -- }
  5288. -+ offset += len + padding;
  5289. - }
  5290. -
  5291. - skb_reset_network_header(frame);
  5292. -@@ -719,24 +721,20 @@ void ieee80211_amsdu_to_8023s(struct sk_
  5293. -
  5294. - payload = frame->data;
  5295. - ethertype = (payload[6] << 8) | payload[7];
  5296. --
  5297. - if (likely((ether_addr_equal(payload, rfc1042_header) &&
  5298. - ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) ||
  5299. - ether_addr_equal(payload, bridge_tunnel_header))) {
  5300. -- /* remove RFC1042 or Bridge-Tunnel
  5301. -- * encapsulation and replace EtherType */
  5302. -- skb_pull(frame, 6);
  5303. -- memcpy(skb_push(frame, ETH_ALEN), src, ETH_ALEN);
  5304. -- memcpy(skb_push(frame, ETH_ALEN), dst, ETH_ALEN);
  5305. -- } else {
  5306. -- memcpy(skb_push(frame, sizeof(__be16)), &len,
  5307. -- sizeof(__be16));
  5308. -- memcpy(skb_push(frame, ETH_ALEN), src, ETH_ALEN);
  5309. -- memcpy(skb_push(frame, ETH_ALEN), dst, ETH_ALEN);
  5310. -+ eth.h_proto = htons(ethertype);
  5311. -+ skb_pull(frame, ETH_ALEN + 2);
  5312. - }
  5313. -+
  5314. -+ memcpy(skb_push(frame, sizeof(eth)), &eth, sizeof(eth));
  5315. - __skb_queue_tail(list, frame);
  5316. - }
  5317. -
  5318. -+ if (!reuse_skb)
  5319. -+ dev_kfree_skb(skb);
  5320. -+
  5321. - return;
  5322. -
  5323. - purge:
  5324. diff --git a/package/kernel/mac80211/patches/321-ath9k_hw-reset-AHB-WMAC-interface-on-AR91xx.patch b/package/kernel/mac80211/patches/321-ath9k_hw-reset-AHB-WMAC-interface-on-AR91xx.patch
  5325. new file mode 100644
  5326. index 0000000..9caa76d
  5327. --- /dev/null
  5328. +++ b/package/kernel/mac80211/patches/321-ath9k_hw-reset-AHB-WMAC-interface-on-AR91xx.patch
  5329. @@ -0,0 +1,25 @@
  5330. +From: Felix Fietkau <nbd@nbd.name>
  5331. +Date: Sat, 9 Jul 2016 15:25:24 +0200
  5332. +Subject: [PATCH] ath9k_hw: reset AHB-WMAC interface on AR91xx
  5333. +
  5334. +Should fix a few stability issues
  5335. +
  5336. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  5337. +---
  5338. +
  5339. +--- a/drivers/net/wireless/ath/ath9k/hw.c
  5340. ++++ b/drivers/net/wireless/ath/ath9k/hw.c
  5341. +@@ -1398,8 +1398,12 @@ static bool ath9k_hw_set_reset(struct at
  5342. + if (!AR_SREV_9100(ah))
  5343. + REG_WRITE(ah, AR_RC, 0);
  5344. +
  5345. +- if (AR_SREV_9100(ah))
  5346. ++ if (AR_SREV_9100(ah)) {
  5347. ++ /* Reset the AHB-WMAC interface */
  5348. ++ if (ah->external_reset)
  5349. ++ ah->external_reset();
  5350. + udelay(50);
  5351. ++ }
  5352. +
  5353. + return true;
  5354. + }
  5355. diff --git a/package/kernel/mac80211/patches/321-mac80211-Parse-legacy-and-HT-rate-in-injected-frames.patch b/package/kernel/mac80211/patches/321-mac80211-Parse-legacy-and-HT-rate-in-injected-frames.patch
  5356. deleted file mode 100644
  5357. index c4155a1..0000000
  5358. --- a/package/kernel/mac80211/patches/321-mac80211-Parse-legacy-and-HT-rate-in-injected-frames.patch
  5359. +++ /dev/null
  5360. @@ -1,155 +0,0 @@
  5361. -From: Sven Eckelmann <sven@narfation.org>
  5362. -Date: Tue, 26 Jan 2016 17:11:13 +0100
  5363. -Subject: [PATCH] mac80211: Parse legacy and HT rate in injected frames
  5364. -
  5365. -Drivers/devices without their own rate control algorithm can get the
  5366. -information what rates they should use from either the radiotap header of
  5367. -injected frames or from the rate control algorithm. But the parsing of the
  5368. -legacy rate information from the radiotap header was removed in commit
  5369. -e6a9854b05c1 ("mac80211/drivers: rewrite the rate control API").
  5370. -
  5371. -The removal of this feature heavily reduced the usefulness of frame
  5372. -injection when wanting to simulate specific transmission behavior. Having
  5373. -rate parsing together with MCS rates and retry support allows a fine
  5374. -grained selection of the tx behavior of injected frames for these kind of
  5375. -tests.
  5376. -
  5377. -Signed-off-by: Sven Eckelmann <sven@narfation.org>
  5378. -Cc: Simon Wunderlich <sw@simonwunderlich.de>
  5379. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  5380. ----
  5381. -
  5382. ---- a/include/net/mac80211.h
  5383. -+++ b/include/net/mac80211.h
  5384. -@@ -708,12 +708,14 @@ enum mac80211_tx_info_flags {
  5385. - * protocol frame (e.g. EAP)
  5386. - * @IEEE80211_TX_CTRL_PS_RESPONSE: This frame is a response to a poll
  5387. - * frame (PS-Poll or uAPSD).
  5388. -+ * @IEEE80211_TX_CTRL_RATE_INJECT: This frame is injected with rate information
  5389. - *
  5390. - * These flags are used in tx_info->control.flags.
  5391. - */
  5392. - enum mac80211_tx_control_flags {
  5393. - IEEE80211_TX_CTRL_PORT_CTRL_PROTO = BIT(0),
  5394. - IEEE80211_TX_CTRL_PS_RESPONSE = BIT(1),
  5395. -+ IEEE80211_TX_CTRL_RATE_INJECT = BIT(2),
  5396. - };
  5397. -
  5398. - /*
  5399. ---- a/net/mac80211/tx.c
  5400. -+++ b/net/mac80211/tx.c
  5401. -@@ -710,6 +710,10 @@ ieee80211_tx_h_rate_ctrl(struct ieee8021
  5402. -
  5403. - info->control.short_preamble = txrc.short_preamble;
  5404. -
  5405. -+ /* don't ask rate control when rate already injected via radiotap */
  5406. -+ if (info->control.flags & IEEE80211_TX_CTRL_RATE_INJECT)
  5407. -+ return TX_CONTINUE;
  5408. -+
  5409. - if (tx->sta)
  5410. - assoc = test_sta_flag(tx->sta, WLAN_STA_ASSOC);
  5411. -
  5412. -@@ -1665,15 +1669,24 @@ void ieee80211_xmit(struct ieee80211_sub
  5413. - ieee80211_tx(sdata, sta, skb, false);
  5414. - }
  5415. -
  5416. --static bool ieee80211_parse_tx_radiotap(struct sk_buff *skb)
  5417. -+static bool ieee80211_parse_tx_radiotap(struct ieee80211_local *local,
  5418. -+ struct sk_buff *skb)
  5419. - {
  5420. - struct ieee80211_radiotap_iterator iterator;
  5421. - struct ieee80211_radiotap_header *rthdr =
  5422. - (struct ieee80211_radiotap_header *) skb->data;
  5423. - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  5424. -+ struct ieee80211_supported_band *sband =
  5425. -+ local->hw.wiphy->bands[info->band];
  5426. - int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len,
  5427. - NULL);
  5428. - u16 txflags;
  5429. -+ u16 rate = 0;
  5430. -+ bool rate_found = false;
  5431. -+ u8 rate_retries = 0;
  5432. -+ u16 rate_flags = 0;
  5433. -+ u8 mcs_known, mcs_flags;
  5434. -+ int i;
  5435. -
  5436. - info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT |
  5437. - IEEE80211_TX_CTL_DONTFRAG;
  5438. -@@ -1724,6 +1737,35 @@ static bool ieee80211_parse_tx_radiotap(
  5439. - info->flags |= IEEE80211_TX_CTL_NO_ACK;
  5440. - break;
  5441. -
  5442. -+ case IEEE80211_RADIOTAP_RATE:
  5443. -+ rate = *iterator.this_arg;
  5444. -+ rate_flags = 0;
  5445. -+ rate_found = true;
  5446. -+ break;
  5447. -+
  5448. -+ case IEEE80211_RADIOTAP_DATA_RETRIES:
  5449. -+ rate_retries = *iterator.this_arg;
  5450. -+ break;
  5451. -+
  5452. -+ case IEEE80211_RADIOTAP_MCS:
  5453. -+ mcs_known = iterator.this_arg[0];
  5454. -+ mcs_flags = iterator.this_arg[1];
  5455. -+ if (!(mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_MCS))
  5456. -+ break;
  5457. -+
  5458. -+ rate_found = true;
  5459. -+ rate = iterator.this_arg[2];
  5460. -+ rate_flags = IEEE80211_TX_RC_MCS;
  5461. -+
  5462. -+ if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_GI &&
  5463. -+ mcs_flags & IEEE80211_RADIOTAP_MCS_SGI)
  5464. -+ rate_flags |= IEEE80211_TX_RC_SHORT_GI;
  5465. -+
  5466. -+ if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_BW &&
  5467. -+ mcs_flags & IEEE80211_RADIOTAP_MCS_BW_40)
  5468. -+ rate_flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
  5469. -+ break;
  5470. -+
  5471. - /*
  5472. - * Please update the file
  5473. - * Documentation/networking/mac80211-injection.txt
  5474. -@@ -1738,6 +1780,32 @@ static bool ieee80211_parse_tx_radiotap(
  5475. - if (ret != -ENOENT) /* ie, if we didn't simply run out of fields */
  5476. - return false;
  5477. -
  5478. -+ if (rate_found) {
  5479. -+ info->control.flags |= IEEE80211_TX_CTRL_RATE_INJECT;
  5480. -+
  5481. -+ for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) {
  5482. -+ info->control.rates[i].idx = -1;
  5483. -+ info->control.rates[i].flags = 0;
  5484. -+ info->control.rates[i].count = 0;
  5485. -+ }
  5486. -+
  5487. -+ if (rate_flags & IEEE80211_TX_RC_MCS) {
  5488. -+ info->control.rates[0].idx = rate;
  5489. -+ } else {
  5490. -+ for (i = 0; i < sband->n_bitrates; i++) {
  5491. -+ if (rate * 5 != sband->bitrates[i].bitrate)
  5492. -+ continue;
  5493. -+
  5494. -+ info->control.rates[0].idx = i;
  5495. -+ break;
  5496. -+ }
  5497. -+ }
  5498. -+
  5499. -+ info->control.rates[0].flags = rate_flags;
  5500. -+ info->control.rates[0].count = min_t(u8, rate_retries + 1,
  5501. -+ local->hw.max_rate_tries);
  5502. -+ }
  5503. -+
  5504. - /*
  5505. - * remove the radiotap header
  5506. - * iterator->_max_length was sanity-checked against
  5507. -@@ -1819,7 +1887,7 @@ netdev_tx_t ieee80211_monitor_start_xmit
  5508. - IEEE80211_TX_CTL_INJECTED;
  5509. -
  5510. - /* process and remove the injection radiotap header */
  5511. -- if (!ieee80211_parse_tx_radiotap(skb))
  5512. -+ if (!ieee80211_parse_tx_radiotap(local, skb))
  5513. - goto fail;
  5514. -
  5515. - rcu_read_lock();
  5516. diff --git a/package/kernel/mac80211/patches/322-ath9k_hw-issue-external-reset-for-QCA9550.patch b/package/kernel/mac80211/patches/322-ath9k_hw-issue-external-reset-for-QCA9550.patch
  5517. new file mode 100644
  5518. index 0000000..5d4e849
  5519. --- /dev/null
  5520. +++ b/package/kernel/mac80211/patches/322-ath9k_hw-issue-external-reset-for-QCA9550.patch
  5521. @@ -0,0 +1,125 @@
  5522. +From: Felix Fietkau <nbd@nbd.name>
  5523. +Date: Sat, 9 Jul 2016 15:26:44 +0200
  5524. +Subject: [PATCH] ath9k_hw: issue external reset for QCA9550
  5525. +
  5526. +The RTC interface on the SoC needs to be reset along with the rest of
  5527. +the WMAC.
  5528. +
  5529. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  5530. +---
  5531. +
  5532. +--- a/drivers/net/wireless/ath/ath9k/hw.c
  5533. ++++ b/drivers/net/wireless/ath/ath9k/hw.c
  5534. +@@ -1275,39 +1275,56 @@ void ath9k_hw_get_delta_slope_vals(struc
  5535. + *coef_exponent = coef_exp - 16;
  5536. + }
  5537. +
  5538. +-/* AR9330 WAR:
  5539. +- * call external reset function to reset WMAC if:
  5540. +- * - doing a cold reset
  5541. +- * - we have pending frames in the TX queues.
  5542. +- */
  5543. +-static bool ath9k_hw_ar9330_reset_war(struct ath_hw *ah, int type)
  5544. ++static bool ath9k_hw_need_external_reset(struct ath_hw *ah, int type)
  5545. + {
  5546. +- int i, npend = 0;
  5547. ++ int i;
  5548. +
  5549. +- for (i = 0; i < AR_NUM_QCU; i++) {
  5550. +- npend = ath9k_hw_numtxpending(ah, i);
  5551. +- if (npend)
  5552. +- break;
  5553. ++ if (type == ATH9K_RESET_COLD)
  5554. ++ return true;
  5555. ++
  5556. ++ if (AR_SREV_9550(ah))
  5557. ++ return true;
  5558. ++
  5559. ++ /* AR9330 WAR:
  5560. ++ * call external reset function to reset WMAC if:
  5561. ++ * - doing a cold reset
  5562. ++ * - we have pending frames in the TX queues.
  5563. ++ */
  5564. ++ if (AR_SREV_9330(ah)) {
  5565. ++ for (i = 0; i < AR_NUM_QCU; i++) {
  5566. ++ if (ath9k_hw_numtxpending(ah, i))
  5567. ++ return true;
  5568. ++ }
  5569. + }
  5570. +
  5571. +- if (ah->external_reset &&
  5572. +- (npend || type == ATH9K_RESET_COLD)) {
  5573. +- int reset_err = 0;
  5574. ++ return false;
  5575. ++}
  5576. +
  5577. +- ath_dbg(ath9k_hw_common(ah), RESET,
  5578. +- "reset MAC via external reset\n");
  5579. ++static bool ath9k_hw_external_reset(struct ath_hw *ah, int type)
  5580. ++{
  5581. ++ int err;
  5582. +
  5583. +- reset_err = ah->external_reset();
  5584. +- if (reset_err) {
  5585. +- ath_err(ath9k_hw_common(ah),
  5586. +- "External reset failed, err=%d\n",
  5587. +- reset_err);
  5588. +- return false;
  5589. +- }
  5590. ++ if (!ah->external_reset || !ath9k_hw_need_external_reset(ah, type))
  5591. ++ return true;
  5592. +
  5593. +- REG_WRITE(ah, AR_RTC_RESET, 1);
  5594. ++ ath_dbg(ath9k_hw_common(ah), RESET,
  5595. ++ "reset MAC via external reset\n");
  5596. ++
  5597. ++ err = ah->external_reset();
  5598. ++ if (err) {
  5599. ++ ath_err(ath9k_hw_common(ah),
  5600. ++ "External reset failed, err=%d\n", err);
  5601. ++ return false;
  5602. ++ }
  5603. ++
  5604. ++ if (AR_SREV_9550(ah)) {
  5605. ++ REG_WRITE(ah, AR_RTC_RESET, 0);
  5606. ++ udelay(10);
  5607. + }
  5608. +
  5609. ++ REG_WRITE(ah, AR_RTC_RESET, 1);
  5610. ++ udelay(10);
  5611. ++
  5612. + return true;
  5613. + }
  5614. +
  5615. +@@ -1360,24 +1377,23 @@ static bool ath9k_hw_set_reset(struct at
  5616. + rst_flags |= AR_RTC_RC_MAC_COLD;
  5617. + }
  5618. +
  5619. +- if (AR_SREV_9330(ah)) {
  5620. +- if (!ath9k_hw_ar9330_reset_war(ah, type))
  5621. +- return false;
  5622. +- }
  5623. +-
  5624. + if (ath9k_hw_mci_is_enabled(ah))
  5625. + ar9003_mci_check_gpm_offset(ah);
  5626. +
  5627. + /* DMA HALT added to resolve ar9300 and ar9580 bus error during
  5628. +- * RTC_RC reg read
  5629. ++ * RTC_RC reg read. Also needed for AR9550 external reset
  5630. + */
  5631. +- if (AR_SREV_9300(ah) || AR_SREV_9580(ah)) {
  5632. ++ if (AR_SREV_9300(ah) || AR_SREV_9580(ah) || AR_SREV_9550(ah)) {
  5633. + REG_SET_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  5634. + ath9k_hw_wait(ah, AR_CFG, AR_CFG_HALT_ACK, AR_CFG_HALT_ACK,
  5635. + 20 * AH_WAIT_TIMEOUT);
  5636. +- REG_CLR_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  5637. + }
  5638. +
  5639. ++ ath9k_hw_external_reset(ah, type);
  5640. ++
  5641. ++ if (AR_SREV_9300(ah) || AR_SREV_9580(ah))
  5642. ++ REG_CLR_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  5643. ++
  5644. + REG_WRITE(ah, AR_RTC_RC, rst_flags);
  5645. +
  5646. + REGWRITE_BUFFER_FLUSH(ah);
  5647. diff --git a/package/kernel/mac80211/patches/322-mac80211-add-A-MSDU-tx-support.patch b/package/kernel/mac80211/patches/322-mac80211-add-A-MSDU-tx-support.patch
  5648. deleted file mode 100644
  5649. index e7bfb9c..0000000
  5650. --- a/package/kernel/mac80211/patches/322-mac80211-add-A-MSDU-tx-support.patch
  5651. +++ /dev/null
  5652. @@ -1,317 +0,0 @@
  5653. -From: Felix Fietkau <nbd@openwrt.org>
  5654. -Date: Fri, 5 Feb 2016 01:38:51 +0100
  5655. -Subject: [PATCH] mac80211: add A-MSDU tx support
  5656. -
  5657. -Requires software tx queueing support. frag_list support (for zero-copy)
  5658. -is optional.
  5659. -
  5660. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  5661. ----
  5662. -
  5663. ---- a/include/net/mac80211.h
  5664. -+++ b/include/net/mac80211.h
  5665. -@@ -709,6 +709,7 @@ enum mac80211_tx_info_flags {
  5666. - * @IEEE80211_TX_CTRL_PS_RESPONSE: This frame is a response to a poll
  5667. - * frame (PS-Poll or uAPSD).
  5668. - * @IEEE80211_TX_CTRL_RATE_INJECT: This frame is injected with rate information
  5669. -+ * @IEEE80211_TX_CTRL_AMSDU: This frame is an A-MSDU frame
  5670. - *
  5671. - * These flags are used in tx_info->control.flags.
  5672. - */
  5673. -@@ -716,6 +717,7 @@ enum mac80211_tx_control_flags {
  5674. - IEEE80211_TX_CTRL_PORT_CTRL_PROTO = BIT(0),
  5675. - IEEE80211_TX_CTRL_PS_RESPONSE = BIT(1),
  5676. - IEEE80211_TX_CTRL_RATE_INJECT = BIT(2),
  5677. -+ IEEE80211_TX_CTRL_AMSDU = BIT(3),
  5678. - };
  5679. -
  5680. - /*
  5681. -@@ -1728,6 +1730,7 @@ struct ieee80211_sta_rates {
  5682. - * size is min(max_amsdu_len, 7935) bytes.
  5683. - * Both additional HT limits must be enforced by the low level driver.
  5684. - * This is defined by the spec (IEEE 802.11-2012 section 8.3.2.2 NOTE 2).
  5685. -+ * @max_rc_amsdu_len: Maximum A-MSDU size in bytes recommended by rate control.
  5686. - * @txq: per-TID data TX queues (if driver uses the TXQ abstraction)
  5687. - */
  5688. - struct ieee80211_sta {
  5689. -@@ -1748,6 +1751,7 @@ struct ieee80211_sta {
  5690. - bool mfp;
  5691. - u8 max_amsdu_subframes;
  5692. - u16 max_amsdu_len;
  5693. -+ u16 max_rc_amsdu_len;
  5694. -
  5695. - struct ieee80211_txq *txq[IEEE80211_NUM_TIDS];
  5696. -
  5697. -@@ -1961,6 +1965,15 @@ struct ieee80211_txq {
  5698. - * order and does not need to manage its own reorder buffer or BA session
  5699. - * timeout.
  5700. - *
  5701. -+ * @IEEE80211_HW_TX_AMSDU: Hardware (or driver) supports software aggregated
  5702. -+ * A-MSDU frames. Requires software tx queueing and fast-xmit support.
  5703. -+ * When not using minstrel/minstrel_ht rate control, the driver should
  5704. -+ * limit the maximum A-MSDU size based on the current tx rate by setting
  5705. -+ * max_rc_amsdu_len in struct ieee80211_sta.
  5706. -+ *
  5707. -+ * @IEEE80211_HW_TX_FRAG_LIST: Hardware (or driver) supports sending frag_list
  5708. -+ * skbs, needed for zero-copy software A-MSDU.
  5709. -+ *
  5710. - * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
  5711. - */
  5712. - enum ieee80211_hw_flags {
  5713. -@@ -1998,6 +2011,8 @@ enum ieee80211_hw_flags {
  5714. - IEEE80211_HW_BEACON_TX_STATUS,
  5715. - IEEE80211_HW_NEEDS_UNIQUE_STA_ADDR,
  5716. - IEEE80211_HW_SUPPORTS_REORDERING_BUFFER,
  5717. -+ IEEE80211_HW_TX_AMSDU,
  5718. -+ IEEE80211_HW_TX_FRAG_LIST,
  5719. -
  5720. - /* keep last, obviously */
  5721. - NUM_IEEE80211_HW_FLAGS
  5722. -@@ -2070,6 +2085,9 @@ enum ieee80211_hw_flags {
  5723. - * size is smaller (an example is LinkSys WRT120N with FW v1.0.07
  5724. - * build 002 Jun 18 2012).
  5725. - *
  5726. -+ * @max_tx_fragments: maximum number of tx buffers per (A)-MSDU, sum
  5727. -+ * of 1 + skb_shinfo(skb)->nr_frags for each skb in the frag_list.
  5728. -+ *
  5729. - * @offchannel_tx_hw_queue: HW queue ID to use for offchannel TX
  5730. - * (if %IEEE80211_HW_QUEUE_CONTROL is set)
  5731. - *
  5732. -@@ -2124,6 +2142,7 @@ struct ieee80211_hw {
  5733. - u8 max_rate_tries;
  5734. - u8 max_rx_aggregation_subframes;
  5735. - u8 max_tx_aggregation_subframes;
  5736. -+ u8 max_tx_fragments;
  5737. - u8 offchannel_tx_hw_queue;
  5738. - u8 radiotap_mcs_details;
  5739. - u16 radiotap_vht_details;
  5740. ---- a/net/mac80211/agg-tx.c
  5741. -+++ b/net/mac80211/agg-tx.c
  5742. -@@ -935,6 +935,7 @@ void ieee80211_process_addba_resp(struct
  5743. - size_t len)
  5744. - {
  5745. - struct tid_ampdu_tx *tid_tx;
  5746. -+ struct ieee80211_txq *txq;
  5747. - u16 capab, tid;
  5748. - u8 buf_size;
  5749. - bool amsdu;
  5750. -@@ -945,6 +946,10 @@ void ieee80211_process_addba_resp(struct
  5751. - buf_size = (capab & IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK) >> 6;
  5752. - buf_size = min(buf_size, local->hw.max_tx_aggregation_subframes);
  5753. -
  5754. -+ txq = sta->sta.txq[tid];
  5755. -+ if (!amsdu && txq)
  5756. -+ set_bit(IEEE80211_TXQ_NO_AMSDU, &to_txq_info(txq)->flags);
  5757. -+
  5758. - mutex_lock(&sta->ampdu_mlme.mtx);
  5759. -
  5760. - tid_tx = rcu_dereference_protected_tid_tx(sta, tid);
  5761. ---- a/net/mac80211/debugfs.c
  5762. -+++ b/net/mac80211/debugfs.c
  5763. -@@ -127,6 +127,8 @@ static const char *hw_flag_names[NUM_IEE
  5764. - FLAG(BEACON_TX_STATUS),
  5765. - FLAG(NEEDS_UNIQUE_STA_ADDR),
  5766. - FLAG(SUPPORTS_REORDERING_BUFFER),
  5767. -+ FLAG(TX_AMSDU),
  5768. -+ FLAG(TX_FRAG_LIST),
  5769. -
  5770. - /* keep last for the build bug below */
  5771. - (void *)0x1
  5772. ---- a/net/mac80211/ieee80211_i.h
  5773. -+++ b/net/mac80211/ieee80211_i.h
  5774. -@@ -799,6 +799,7 @@ struct mac80211_qos_map {
  5775. - enum txq_info_flags {
  5776. - IEEE80211_TXQ_STOP,
  5777. - IEEE80211_TXQ_AMPDU,
  5778. -+ IEEE80211_TXQ_NO_AMSDU,
  5779. - };
  5780. -
  5781. - struct txq_info {
  5782. ---- a/net/mac80211/tx.c
  5783. -+++ b/net/mac80211/tx.c
  5784. -@@ -1318,6 +1318,10 @@ struct sk_buff *ieee80211_tx_dequeue(str
  5785. - out:
  5786. - spin_unlock_bh(&txqi->queue.lock);
  5787. -
  5788. -+ if (skb && skb_has_frag_list(skb) &&
  5789. -+ !ieee80211_hw_check(&local->hw, TX_FRAG_LIST))
  5790. -+ skb_linearize(skb);
  5791. -+
  5792. - return skb;
  5793. - }
  5794. - EXPORT_SYMBOL(ieee80211_tx_dequeue);
  5795. -@@ -2757,6 +2761,163 @@ void ieee80211_clear_fast_xmit(struct st
  5796. - kfree_rcu(fast_tx, rcu_head);
  5797. - }
  5798. -
  5799. -+static bool ieee80211_amsdu_realloc_pad(struct ieee80211_local *local,
  5800. -+ struct sk_buff *skb, int headroom,
  5801. -+ int *subframe_len)
  5802. -+{
  5803. -+ int amsdu_len = *subframe_len + sizeof(struct ethhdr);
  5804. -+ int padding = (4 - amsdu_len) & 3;
  5805. -+
  5806. -+ if (skb_headroom(skb) < headroom || skb_tailroom(skb) < padding) {
  5807. -+ I802_DEBUG_INC(local->tx_expand_skb_head);
  5808. -+
  5809. -+ if (pskb_expand_head(skb, headroom, padding, GFP_ATOMIC)) {
  5810. -+ wiphy_debug(local->hw.wiphy,
  5811. -+ "failed to reallocate TX buffer\n");
  5812. -+ return false;
  5813. -+ }
  5814. -+ }
  5815. -+
  5816. -+ if (padding) {
  5817. -+ *subframe_len += padding;
  5818. -+ memset(skb_put(skb, padding), 0, padding);
  5819. -+ }
  5820. -+
  5821. -+ return true;
  5822. -+}
  5823. -+
  5824. -+static bool ieee80211_amsdu_prepare_head(struct ieee80211_sub_if_data *sdata,
  5825. -+ struct ieee80211_fast_tx *fast_tx,
  5826. -+ struct sk_buff *skb)
  5827. -+{
  5828. -+ struct ieee80211_local *local = sdata->local;
  5829. -+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  5830. -+ struct ieee80211_hdr *hdr;
  5831. -+ struct ethhdr amsdu_hdr;
  5832. -+ int hdr_len = fast_tx->hdr_len - sizeof(rfc1042_header);
  5833. -+ int subframe_len = skb->len - hdr_len;
  5834. -+ void *data;
  5835. -+ u8 *qc;
  5836. -+
  5837. -+ if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE)
  5838. -+ return false;
  5839. -+
  5840. -+ if (info->control.flags & IEEE80211_TX_CTRL_AMSDU)
  5841. -+ return true;
  5842. -+
  5843. -+ if (!ieee80211_amsdu_realloc_pad(local, skb, sizeof(amsdu_hdr),
  5844. -+ &subframe_len))
  5845. -+ return false;
  5846. -+
  5847. -+ amsdu_hdr.h_proto = cpu_to_be16(subframe_len);
  5848. -+ memcpy(amsdu_hdr.h_source, skb->data + fast_tx->sa_offs, ETH_ALEN);
  5849. -+ memcpy(amsdu_hdr.h_dest, skb->data + fast_tx->da_offs, ETH_ALEN);
  5850. -+
  5851. -+ data = skb_push(skb, sizeof(amsdu_hdr));
  5852. -+ memmove(data, data + sizeof(amsdu_hdr), hdr_len);
  5853. -+ memcpy(data + hdr_len, &amsdu_hdr, sizeof(amsdu_hdr));
  5854. -+
  5855. -+ hdr = data;
  5856. -+ qc = ieee80211_get_qos_ctl(hdr);
  5857. -+ *qc |= IEEE80211_QOS_CTL_A_MSDU_PRESENT;
  5858. -+
  5859. -+ info->control.flags |= IEEE80211_TX_CTRL_AMSDU;
  5860. -+
  5861. -+ return true;
  5862. -+}
  5863. -+
  5864. -+static bool ieee80211_amsdu_aggregate(struct ieee80211_sub_if_data *sdata,
  5865. -+ struct sta_info *sta,
  5866. -+ struct ieee80211_fast_tx *fast_tx,
  5867. -+ struct sk_buff *skb)
  5868. -+{
  5869. -+ struct ieee80211_local *local = sdata->local;
  5870. -+ u8 tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK;
  5871. -+ struct ieee80211_txq *txq = sta->sta.txq[tid];
  5872. -+ struct txq_info *txqi;
  5873. -+ struct sk_buff **frag_tail, *head;
  5874. -+ int subframe_len = skb->len - ETH_ALEN;
  5875. -+ u8 max_subframes = sta->sta.max_amsdu_subframes;
  5876. -+ int max_frags = local->hw.max_tx_fragments;
  5877. -+ int max_amsdu_len = sta->sta.max_amsdu_len;
  5878. -+ __be16 len;
  5879. -+ void *data;
  5880. -+ bool ret = false;
  5881. -+ int n = 1, nfrags;
  5882. -+
  5883. -+ if (!ieee80211_hw_check(&local->hw, TX_AMSDU))
  5884. -+ return false;
  5885. -+
  5886. -+ if (!txq)
  5887. -+ return false;
  5888. -+
  5889. -+ txqi = to_txq_info(txq);
  5890. -+ if (test_bit(IEEE80211_TXQ_NO_AMSDU, &txqi->flags))
  5891. -+ return false;
  5892. -+
  5893. -+ if (sta->sta.max_rc_amsdu_len)
  5894. -+ max_amsdu_len = min_t(int, max_amsdu_len,
  5895. -+ sta->sta.max_rc_amsdu_len);
  5896. -+
  5897. -+ spin_lock_bh(&txqi->queue.lock);
  5898. -+
  5899. -+ head = skb_peek_tail(&txqi->queue);
  5900. -+ if (!head)
  5901. -+ goto out;
  5902. -+
  5903. -+ if (skb->len + head->len > max_amsdu_len)
  5904. -+ goto out;
  5905. -+
  5906. -+ /*
  5907. -+ * HT A-MPDU limits maximum MPDU size to 4095 bytes. Since aggregation
  5908. -+ * sessions are started/stopped without txq flush, use the limit here
  5909. -+ * to avoid having to de-aggregate later.
  5910. -+ */
  5911. -+ if (skb->len + head->len > 4095 &&
  5912. -+ !sta->sta.vht_cap.vht_supported)
  5913. -+ goto out;
  5914. -+
  5915. -+ if (!ieee80211_amsdu_prepare_head(sdata, fast_tx, head))
  5916. -+ goto out;
  5917. -+
  5918. -+ nfrags = 1 + skb_shinfo(skb)->nr_frags;
  5919. -+ nfrags += 1 + skb_shinfo(head)->nr_frags;
  5920. -+ frag_tail = &skb_shinfo(head)->frag_list;
  5921. -+ while (*frag_tail) {
  5922. -+ nfrags += 1 + skb_shinfo(*frag_tail)->nr_frags;
  5923. -+ frag_tail = &(*frag_tail)->next;
  5924. -+ n++;
  5925. -+ }
  5926. -+
  5927. -+ if (max_subframes && n > max_subframes)
  5928. -+ goto out;
  5929. -+
  5930. -+ if (max_frags && nfrags > max_frags)
  5931. -+ goto out;
  5932. -+
  5933. -+ if (!ieee80211_amsdu_realloc_pad(local, skb, sizeof(rfc1042_header) + 2,
  5934. -+ &subframe_len))
  5935. -+ return false;
  5936. -+
  5937. -+ ret = true;
  5938. -+ data = skb_push(skb, ETH_ALEN + 2);
  5939. -+ memmove(data, data + ETH_ALEN + 2, 2 * ETH_ALEN);
  5940. -+
  5941. -+ data += 2 * ETH_ALEN;
  5942. -+ len = cpu_to_be16(subframe_len);
  5943. -+ memcpy(data, &len, 2);
  5944. -+ memcpy(data + 2, rfc1042_header, sizeof(rfc1042_header));
  5945. -+
  5946. -+ head->len += skb->len;
  5947. -+ head->data_len += skb->len;
  5948. -+ *frag_tail = skb;
  5949. -+
  5950. -+out:
  5951. -+ spin_unlock_bh(&txqi->queue.lock);
  5952. -+
  5953. -+ return ret;
  5954. -+}
  5955. -+
  5956. - static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata,
  5957. - struct net_device *dev, struct sta_info *sta,
  5958. - struct ieee80211_fast_tx *fast_tx,
  5959. -@@ -2811,6 +2972,10 @@ static bool ieee80211_xmit_fast(struct i
  5960. -
  5961. - ieee80211_tx_stats(dev, skb->len + extra_head);
  5962. -
  5963. -+ if ((hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) &&
  5964. -+ ieee80211_amsdu_aggregate(sdata, sta, fast_tx, skb))
  5965. -+ return true;
  5966. -+
  5967. - /* will not be crypto-handled beyond what we do here, so use false
  5968. - * as the may-encrypt argument for the resize to not account for
  5969. - * more room than we already have in 'extra_head'
  5970. diff --git a/package/kernel/mac80211/patches/323-0000-brcmfmac-fix-setting-primary-channel-for-80-MHz-widt.patch b/package/kernel/mac80211/patches/323-0000-brcmfmac-fix-setting-primary-channel-for-80-MHz-widt.patch
  5971. deleted file mode 100644
  5972. index 9277b2c..0000000
  5973. --- a/package/kernel/mac80211/patches/323-0000-brcmfmac-fix-setting-primary-channel-for-80-MHz-widt.patch
  5974. +++ /dev/null
  5975. @@ -1,64 +0,0 @@
  5976. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  5977. -Date: Wed, 20 Jan 2016 16:46:04 +0100
  5978. -Subject: [PATCH] brcmfmac: fix setting primary channel for 80 MHz width
  5979. -MIME-Version: 1.0
  5980. -Content-Type: text/plain; charset=UTF-8
  5981. -Content-Transfer-Encoding: 8bit
  5982. -
  5983. -First of all it changes the way we calculate primary channel offset. If
  5984. -we use e.g. 80 MHz channel with primary frequency 5180 MHz (which means
  5985. -center frequency is 5210 MHz) it makes sense to calculate primary offset
  5986. -as -30 MHz.
  5987. -Then it fixes values we compare primary_offset with. We were comparing
  5988. -offset in MHz against -2 or 2 which was resulting in picking a wrong
  5989. -primary channel.
  5990. -
  5991. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  5992. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  5993. ----
  5994. -
  5995. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  5996. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  5997. -@@ -247,7 +247,7 @@ static u16 chandef_to_chanspec(struct br
  5998. - brcmf_dbg(TRACE, "chandef: control %d center %d width %d\n",
  5999. - ch->chan->center_freq, ch->center_freq1, ch->width);
  6000. - ch_inf.chnum = ieee80211_frequency_to_channel(ch->center_freq1);
  6001. -- primary_offset = ch->center_freq1 - ch->chan->center_freq;
  6002. -+ primary_offset = ch->chan->center_freq - ch->center_freq1;
  6003. - switch (ch->width) {
  6004. - case NL80211_CHAN_WIDTH_20:
  6005. - case NL80211_CHAN_WIDTH_20_NOHT:
  6006. -@@ -256,24 +256,21 @@ static u16 chandef_to_chanspec(struct br
  6007. - break;
  6008. - case NL80211_CHAN_WIDTH_40:
  6009. - ch_inf.bw = BRCMU_CHAN_BW_40;
  6010. -- if (primary_offset < 0)
  6011. -+ if (primary_offset > 0)
  6012. - ch_inf.sb = BRCMU_CHAN_SB_U;
  6013. - else
  6014. - ch_inf.sb = BRCMU_CHAN_SB_L;
  6015. - break;
  6016. - case NL80211_CHAN_WIDTH_80:
  6017. - ch_inf.bw = BRCMU_CHAN_BW_80;
  6018. -- if (primary_offset < 0) {
  6019. -- if (primary_offset < -CH_10MHZ_APART)
  6020. -- ch_inf.sb = BRCMU_CHAN_SB_UU;
  6021. -- else
  6022. -- ch_inf.sb = BRCMU_CHAN_SB_UL;
  6023. -- } else {
  6024. -- if (primary_offset > CH_10MHZ_APART)
  6025. -- ch_inf.sb = BRCMU_CHAN_SB_LL;
  6026. -- else
  6027. -- ch_inf.sb = BRCMU_CHAN_SB_LU;
  6028. -- }
  6029. -+ if (primary_offset == -30)
  6030. -+ ch_inf.sb = BRCMU_CHAN_SB_LL;
  6031. -+ else if (primary_offset == -10)
  6032. -+ ch_inf.sb = BRCMU_CHAN_SB_LU;
  6033. -+ else if (primary_offset == 10)
  6034. -+ ch_inf.sb = BRCMU_CHAN_SB_UL;
  6035. -+ else
  6036. -+ ch_inf.sb = BRCMU_CHAN_SB_UU;
  6037. - break;
  6038. - case NL80211_CHAN_WIDTH_80P80:
  6039. - case NL80211_CHAN_WIDTH_160:
  6040. diff --git a/package/kernel/mac80211/patches/323-0001-brcmfmac-analyze-descriptors-of-current-component-on.patch b/package/kernel/mac80211/patches/323-0001-brcmfmac-analyze-descriptors-of-current-component-on.patch
  6041. deleted file mode 100644
  6042. index d7018da..0000000
  6043. --- a/package/kernel/mac80211/patches/323-0001-brcmfmac-analyze-descriptors-of-current-component-on.patch
  6044. +++ /dev/null
  6045. @@ -1,51 +0,0 @@
  6046. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  6047. -Date: Tue, 26 Jan 2016 17:57:01 +0100
  6048. -Subject: [PATCH] brcmfmac: analyze descriptors of current component only
  6049. -MIME-Version: 1.0
  6050. -Content-Type: text/plain; charset=UTF-8
  6051. -Content-Transfer-Encoding: 8bit
  6052. -
  6053. -So far we were looking for address descriptors without a check for
  6054. -crossing current component border. In case of dealing with unsupported
  6055. -descriptor or descriptor missing at all the code would incorrectly get
  6056. -data from another component.
  6057. -
  6058. -Consider this binary-described component from BCM4366 EROM:
  6059. -4bf83b01 TAG==CI CID==0x83b
  6060. -20080201 TAG==CI PORTS==0+1 WRAPPERS==0+1
  6061. -18400035 TAG==ADDR SZ_SZD TYPE_SLAVE
  6062. -00050000
  6063. -18107085 TAG==ADDR SZ_4K TYPE_SWRAP
  6064. -
  6065. -Driver was assigning invalid base address to this core:
  6066. -brcmfmac: [6 ] core 0x83b:32 base 0x18109000 wrap 0x18107000
  6067. -which came from totally different component defined in EROM:
  6068. -43b36701 TAG==CI CID==0x367
  6069. -00000201 TAG==CI PORTS==0+1 WRAPPERS==0+0
  6070. -18109005 TAG==ADDR SZ_4K TYPE_SLAVE
  6071. -
  6072. -This change will also allow us to support components without wrapper
  6073. -address in the future.
  6074. -
  6075. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  6076. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6077. ----
  6078. -
  6079. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  6080. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  6081. -@@ -803,7 +803,14 @@ static int brcmf_chip_dmp_get_regaddr(st
  6082. - *eromaddr -= 4;
  6083. - return -EFAULT;
  6084. - }
  6085. -- } while (desc != DMP_DESC_ADDRESS);
  6086. -+ } while (desc != DMP_DESC_ADDRESS &&
  6087. -+ desc != DMP_DESC_COMPONENT);
  6088. -+
  6089. -+ /* stop if we crossed current component border */
  6090. -+ if (desc == DMP_DESC_COMPONENT) {
  6091. -+ *eromaddr -= 4;
  6092. -+ return 0;
  6093. -+ }
  6094. -
  6095. - /* skip upper 32-bit address descriptor */
  6096. - if (val & DMP_DESC_ADDRSIZE_GT32)
  6097. diff --git a/package/kernel/mac80211/patches/323-0002-brcmfmac-allow-storing-PMU-core-without-wrapper-addr.patch b/package/kernel/mac80211/patches/323-0002-brcmfmac-allow-storing-PMU-core-without-wrapper-addr.patch
  6098. deleted file mode 100644
  6099. index 045ab49..0000000
  6100. --- a/package/kernel/mac80211/patches/323-0002-brcmfmac-allow-storing-PMU-core-without-wrapper-addr.patch
  6101. +++ /dev/null
  6102. @@ -1,28 +0,0 @@
  6103. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  6104. -Date: Tue, 26 Jan 2016 17:57:02 +0100
  6105. -Subject: [PATCH] brcmfmac: allow storing PMU core without wrapper address
  6106. -MIME-Version: 1.0
  6107. -Content-Type: text/plain; charset=UTF-8
  6108. -Content-Transfer-Encoding: 8bit
  6109. -
  6110. -Separated PMU core can be found in new devices and should be used for
  6111. -accessing PMU registers (which were routed through ChipCommon so far).
  6112. -This core is one of exceptions that doesn't have or need wrapper address
  6113. -to be still safely accessible.
  6114. -
  6115. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  6116. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6117. ----
  6118. -
  6119. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  6120. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  6121. -@@ -883,7 +883,8 @@ int brcmf_chip_dmp_erom_scan(struct brcm
  6122. - rev = (val & DMP_COMP_REVISION) >> DMP_COMP_REVISION_S;
  6123. -
  6124. - /* need core with ports */
  6125. -- if (nmw + nsw == 0)
  6126. -+ if (nmw + nsw == 0 &&
  6127. -+ id != BCMA_CORE_PMU)
  6128. - continue;
  6129. -
  6130. - /* try to obtain register address info */
  6131. diff --git a/package/kernel/mac80211/patches/323-0003-brcmfmac-read-extended-capabilities-of-ChipCommon-co.patch b/package/kernel/mac80211/patches/323-0003-brcmfmac-read-extended-capabilities-of-ChipCommon-co.patch
  6132. deleted file mode 100644
  6133. index 7b7ba4f..0000000
  6134. --- a/package/kernel/mac80211/patches/323-0003-brcmfmac-read-extended-capabilities-of-ChipCommon-co.patch
  6135. +++ /dev/null
  6136. @@ -1,43 +0,0 @@
  6137. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  6138. -Date: Tue, 26 Jan 2016 17:57:03 +0100
  6139. -Subject: [PATCH] brcmfmac: read extended capabilities of ChipCommon core
  6140. -MIME-Version: 1.0
  6141. -Content-Type: text/plain; charset=UTF-8
  6142. -Content-Transfer-Encoding: 8bit
  6143. -
  6144. -This is an extra bitfield with info about some present hardware.
  6145. -
  6146. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  6147. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6148. ----
  6149. -
  6150. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  6151. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  6152. -@@ -1025,6 +1025,9 @@ static int brcmf_chip_setup(struct brcmf
  6153. - /* get chipcommon capabilites */
  6154. - pub->cc_caps = chip->ops->read32(chip->ctx,
  6155. - CORE_CC_REG(base, capabilities));
  6156. -+ pub->cc_caps_ext = chip->ops->read32(chip->ctx,
  6157. -+ CORE_CC_REG(base,
  6158. -+ capabilities_ext));
  6159. -
  6160. - /* get pmu caps & rev */
  6161. - if (pub->cc_caps & CC_CAP_PMU) {
  6162. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
  6163. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
  6164. -@@ -27,6 +27,7 @@
  6165. - * @chip: chip identifier.
  6166. - * @chiprev: chip revision.
  6167. - * @cc_caps: chipcommon core capabilities.
  6168. -+ * @cc_caps_ext: chipcommon core extended capabilities.
  6169. - * @pmucaps: PMU capabilities.
  6170. - * @pmurev: PMU revision.
  6171. - * @rambase: RAM base address (only applicable for ARM CR4 chips).
  6172. -@@ -38,6 +39,7 @@ struct brcmf_chip {
  6173. - u32 chip;
  6174. - u32 chiprev;
  6175. - u32 cc_caps;
  6176. -+ u32 cc_caps_ext;
  6177. - u32 pmucaps;
  6178. - u32 pmurev;
  6179. - u32 rambase;
  6180. diff --git a/package/kernel/mac80211/patches/323-0004-brcmfmac-access-PMU-registers-using-standalone-PMU-c.patch b/package/kernel/mac80211/patches/323-0004-brcmfmac-access-PMU-registers-using-standalone-PMU-c.patch
  6181. deleted file mode 100644
  6182. index 2af6fd9..0000000
  6183. --- a/package/kernel/mac80211/patches/323-0004-brcmfmac-access-PMU-registers-using-standalone-PMU-c.patch
  6184. +++ /dev/null
  6185. @@ -1,148 +0,0 @@
  6186. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  6187. -Date: Tue, 26 Jan 2016 17:57:04 +0100
  6188. -Subject: [PATCH] brcmfmac: access PMU registers using standalone PMU core if
  6189. - available
  6190. -MIME-Version: 1.0
  6191. -Content-Type: text/plain; charset=UTF-8
  6192. -Content-Transfer-Encoding: 8bit
  6193. -
  6194. -On recent Broadcom chipsets PMU is present as separated core and it
  6195. -can't be accessed using ChipCommon anymore as it fails with e.g.:
  6196. -[ 18.198412] Unhandled fault: imprecise external abort (0x1406) at 0xb6da200f
  6197. -
  6198. -Add a new helper function that will return a proper core that should be
  6199. -used for accessing PMU registers.
  6200. -
  6201. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  6202. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6203. ----
  6204. -
  6205. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  6206. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  6207. -@@ -1014,6 +1014,7 @@ static int brcmf_chip_setup(struct brcmf
  6208. - {
  6209. - struct brcmf_chip *pub;
  6210. - struct brcmf_core_priv *cc;
  6211. -+ struct brcmf_core *pmu;
  6212. - u32 base;
  6213. - u32 val;
  6214. - int ret = 0;
  6215. -@@ -1030,9 +1031,10 @@ static int brcmf_chip_setup(struct brcmf
  6216. - capabilities_ext));
  6217. -
  6218. - /* get pmu caps & rev */
  6219. -+ pmu = brcmf_chip_get_pmu(pub); /* after reading cc_caps_ext */
  6220. - if (pub->cc_caps & CC_CAP_PMU) {
  6221. - val = chip->ops->read32(chip->ctx,
  6222. -- CORE_CC_REG(base, pmucapabilities));
  6223. -+ CORE_CC_REG(pmu->base, pmucapabilities));
  6224. - pub->pmurev = val & PCAP_REV_MASK;
  6225. - pub->pmucaps = val;
  6226. - }
  6227. -@@ -1131,6 +1133,23 @@ struct brcmf_core *brcmf_chip_get_chipco
  6228. - return &cc->pub;
  6229. - }
  6230. -
  6231. -+struct brcmf_core *brcmf_chip_get_pmu(struct brcmf_chip *pub)
  6232. -+{
  6233. -+ struct brcmf_core *cc = brcmf_chip_get_chipcommon(pub);
  6234. -+ struct brcmf_core *pmu;
  6235. -+
  6236. -+ /* See if there is separated PMU core available */
  6237. -+ if (cc->rev >= 35 &&
  6238. -+ pub->cc_caps_ext & BCMA_CC_CAP_EXT_AOB_PRESENT) {
  6239. -+ pmu = brcmf_chip_get_core(pub, BCMA_CORE_PMU);
  6240. -+ if (pmu)
  6241. -+ return pmu;
  6242. -+ }
  6243. -+
  6244. -+ /* Fallback to ChipCommon core for older hardware */
  6245. -+ return cc;
  6246. -+}
  6247. -+
  6248. - bool brcmf_chip_iscoreup(struct brcmf_core *pub)
  6249. - {
  6250. - struct brcmf_core_priv *core;
  6251. -@@ -1301,6 +1320,7 @@ bool brcmf_chip_sr_capable(struct brcmf_
  6252. - {
  6253. - u32 base, addr, reg, pmu_cc3_mask = ~0;
  6254. - struct brcmf_chip_priv *chip;
  6255. -+ struct brcmf_core *pmu = brcmf_chip_get_pmu(pub);
  6256. -
  6257. - brcmf_dbg(TRACE, "Enter\n");
  6258. -
  6259. -@@ -1320,9 +1340,9 @@ bool brcmf_chip_sr_capable(struct brcmf_
  6260. - case BRCM_CC_4335_CHIP_ID:
  6261. - case BRCM_CC_4339_CHIP_ID:
  6262. - /* read PMU chipcontrol register 3 */
  6263. -- addr = CORE_CC_REG(base, chipcontrol_addr);
  6264. -+ addr = CORE_CC_REG(pmu->base, chipcontrol_addr);
  6265. - chip->ops->write32(chip->ctx, addr, 3);
  6266. -- addr = CORE_CC_REG(base, chipcontrol_data);
  6267. -+ addr = CORE_CC_REG(pmu->base, chipcontrol_data);
  6268. - reg = chip->ops->read32(chip->ctx, addr);
  6269. - return (reg & pmu_cc3_mask) != 0;
  6270. - case BRCM_CC_43430_CHIP_ID:
  6271. -@@ -1330,12 +1350,12 @@ bool brcmf_chip_sr_capable(struct brcmf_
  6272. - reg = chip->ops->read32(chip->ctx, addr);
  6273. - return reg != 0;
  6274. - default:
  6275. -- addr = CORE_CC_REG(base, pmucapabilities_ext);
  6276. -+ addr = CORE_CC_REG(pmu->base, pmucapabilities_ext);
  6277. - reg = chip->ops->read32(chip->ctx, addr);
  6278. - if ((reg & PCAPEXT_SR_SUPPORTED_MASK) == 0)
  6279. - return false;
  6280. -
  6281. -- addr = CORE_CC_REG(base, retention_ctl);
  6282. -+ addr = CORE_CC_REG(pmu->base, retention_ctl);
  6283. - reg = chip->ops->read32(chip->ctx, addr);
  6284. - return (reg & (PMU_RCTL_MACPHY_DISABLE_MASK |
  6285. - PMU_RCTL_LOGIC_DISABLE_MASK)) == 0;
  6286. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
  6287. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
  6288. -@@ -85,6 +85,7 @@ struct brcmf_chip *brcmf_chip_attach(voi
  6289. - void brcmf_chip_detach(struct brcmf_chip *chip);
  6290. - struct brcmf_core *brcmf_chip_get_core(struct brcmf_chip *chip, u16 coreid);
  6291. - struct brcmf_core *brcmf_chip_get_chipcommon(struct brcmf_chip *chip);
  6292. -+struct brcmf_core *brcmf_chip_get_pmu(struct brcmf_chip *pub);
  6293. - bool brcmf_chip_iscoreup(struct brcmf_core *core);
  6294. - void brcmf_chip_coredisable(struct brcmf_core *core, u32 prereset, u32 reset);
  6295. - void brcmf_chip_resetcore(struct brcmf_core *core, u32 prereset, u32 reset,
  6296. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  6297. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  6298. -@@ -3615,7 +3615,6 @@ brcmf_sdio_drivestrengthinit(struct brcm
  6299. - const struct sdiod_drive_str *str_tab = NULL;
  6300. - u32 str_mask;
  6301. - u32 str_shift;
  6302. -- u32 base;
  6303. - u32 i;
  6304. - u32 drivestrength_sel = 0;
  6305. - u32 cc_data_temp;
  6306. -@@ -3658,14 +3657,15 @@ brcmf_sdio_drivestrengthinit(struct brcm
  6307. - }
  6308. -
  6309. - if (str_tab != NULL) {
  6310. -+ struct brcmf_core *pmu = brcmf_chip_get_pmu(ci);
  6311. -+
  6312. - for (i = 0; str_tab[i].strength != 0; i++) {
  6313. - if (drivestrength >= str_tab[i].strength) {
  6314. - drivestrength_sel = str_tab[i].sel;
  6315. - break;
  6316. - }
  6317. - }
  6318. -- base = brcmf_chip_get_chipcommon(ci)->base;
  6319. -- addr = CORE_CC_REG(base, chipcontrol_addr);
  6320. -+ addr = CORE_CC_REG(pmu->base, chipcontrol_addr);
  6321. - brcmf_sdiod_regwl(sdiodev, addr, 1, NULL);
  6322. - cc_data_temp = brcmf_sdiod_regrl(sdiodev, addr, NULL);
  6323. - cc_data_temp &= ~str_mask;
  6324. -@@ -3835,8 +3835,7 @@ brcmf_sdio_probe_attach(struct brcmf_sdi
  6325. - goto fail;
  6326. -
  6327. - /* set PMUControl so a backplane reset does PMU state reload */
  6328. -- reg_addr = CORE_CC_REG(brcmf_chip_get_chipcommon(bus->ci)->base,
  6329. -- pmucontrol);
  6330. -+ reg_addr = CORE_CC_REG(brcmf_chip_get_pmu(bus->ci)->base, pmucontrol);
  6331. - reg_val = brcmf_sdiod_regrl(bus->sdiodev, reg_addr, &err);
  6332. - if (err)
  6333. - goto fail;
  6334. diff --git a/package/kernel/mac80211/patches/323-0005-brcmfmac-add-support-for-14e4-4365-PCI-ID-with-BCM43.patch b/package/kernel/mac80211/patches/323-0005-brcmfmac-add-support-for-14e4-4365-PCI-ID-with-BCM43.patch
  6335. deleted file mode 100644
  6336. index 35887fc..0000000
  6337. --- a/package/kernel/mac80211/patches/323-0005-brcmfmac-add-support-for-14e4-4365-PCI-ID-with-BCM43.patch
  6338. +++ /dev/null
  6339. @@ -1,38 +0,0 @@
  6340. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  6341. -Date: Tue, 26 Jan 2016 17:57:05 +0100
  6342. -Subject: [PATCH] brcmfmac: add support for 14e4:4365 PCI ID with BCM4366
  6343. - chipset
  6344. -MIME-Version: 1.0
  6345. -Content-Type: text/plain; charset=UTF-8
  6346. -Content-Transfer-Encoding: 8bit
  6347. -
  6348. -On Broadcom ARM routers BCM4366 cards are available with 14e4:4365 ID.
  6349. -Unfortunately this ID was already used by Broadcom for cards with
  6350. -BCM43142, a totally different chipset requiring SoftMAC driver. To avoid
  6351. -a conflict between brcmfmac and bcma use more specific ID entry with
  6352. -subvendor and subdevice specified.
  6353. -
  6354. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  6355. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6356. ----
  6357. -
  6358. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  6359. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  6360. -@@ -1951,6 +1951,9 @@ static const struct dev_pm_ops brcmf_pci
  6361. -
  6362. - #define BRCMF_PCIE_DEVICE(dev_id) { BRCM_PCIE_VENDOR_ID_BROADCOM, dev_id,\
  6363. - PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_NETWORK_OTHER << 8, 0xffff00, 0 }
  6364. -+#define BRCMF_PCIE_DEVICE_SUB(dev_id, subvend, subdev) { \
  6365. -+ BRCM_PCIE_VENDOR_ID_BROADCOM, dev_id,\
  6366. -+ subvend, subdev, PCI_CLASS_NETWORK_OTHER << 8, 0xffff00, 0 }
  6367. -
  6368. - static struct pci_device_id brcmf_pcie_devid_table[] = {
  6369. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4350_DEVICE_ID),
  6370. -@@ -1966,6 +1969,7 @@ static struct pci_device_id brcmf_pcie_d
  6371. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_DEVICE_ID),
  6372. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_2G_DEVICE_ID),
  6373. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_5G_DEVICE_ID),
  6374. -+ BRCMF_PCIE_DEVICE_SUB(0x4365, BRCM_PCIE_VENDOR_ID_BROADCOM, 0x4365),
  6375. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_DEVICE_ID),
  6376. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_2G_DEVICE_ID),
  6377. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_5G_DEVICE_ID),
  6378. diff --git a/package/kernel/mac80211/patches/323-ath9k-Fix-programming-of-minCCA-power-threshold.patch b/package/kernel/mac80211/patches/323-ath9k-Fix-programming-of-minCCA-power-threshold.patch
  6379. new file mode 100644
  6380. index 0000000..59ac29b
  6381. --- /dev/null
  6382. +++ b/package/kernel/mac80211/patches/323-ath9k-Fix-programming-of-minCCA-power-threshold.patch
  6383. @@ -0,0 +1,26 @@
  6384. +From: Sven Eckelmann <sven@narfation.org>
  6385. +Date: Fri, 17 Jun 2016 11:58:20 +0200
  6386. +Subject: [PATCH] ath9k: Fix programming of minCCA power threshold
  6387. +
  6388. +The function ar9003_hw_apply_minccapwr_thresh takes as second parameter not
  6389. +a pointer to the channel but a boolean value describing whether the channel
  6390. +is 2.4GHz or not. This broke (according to the origin commit) the ETSI
  6391. +regulatory compliance on 5GHz channels.
  6392. +
  6393. +Fixes: 3533bf6b15a0 ("ath9k: Fix regulatory compliance")
  6394. +Signed-off-by: Sven Eckelmann <sven@narfation.org>
  6395. +Cc: Simon Wunderlich <sw@simonwunderlich.de>
  6396. +Cc: Sujith Manoharan <c_manoha@qca.qualcomm.com>
  6397. +---
  6398. +
  6399. +--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
  6400. ++++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
  6401. +@@ -4175,7 +4175,7 @@ static void ath9k_hw_ar9300_set_board_va
  6402. + if (!AR_SREV_9330(ah) && !AR_SREV_9340(ah) && !AR_SREV_9531(ah))
  6403. + ar9003_hw_internal_regulator_apply(ah);
  6404. + ar9003_hw_apply_tuning_caps(ah);
  6405. +- ar9003_hw_apply_minccapwr_thresh(ah, chan);
  6406. ++ ar9003_hw_apply_minccapwr_thresh(ah, is2ghz);
  6407. + ar9003_hw_txend_to_xpa_off_apply(ah, is2ghz);
  6408. + ar9003_hw_thermometer_apply(ah);
  6409. + ar9003_hw_thermo_cal_apply(ah);
  6410. diff --git a/package/kernel/mac80211/patches/324-ath9k_hw-fix-spectral-scan-on-AR9285-and-newer.patch b/package/kernel/mac80211/patches/324-ath9k_hw-fix-spectral-scan-on-AR9285-and-newer.patch
  6411. new file mode 100644
  6412. index 0000000..b6f4868
  6413. --- /dev/null
  6414. +++ b/package/kernel/mac80211/patches/324-ath9k_hw-fix-spectral-scan-on-AR9285-and-newer.patch
  6415. @@ -0,0 +1,86 @@
  6416. +From: Felix Fietkau <nbd@nbd.name>
  6417. +Date: Mon, 11 Jul 2016 10:34:37 +0200
  6418. +Subject: [PATCH] ath9k_hw: fix spectral scan on AR9285 and newer
  6419. +
  6420. +The register layout of AR_PHY_SPECTRAL_SCAN has changed, only AR9280
  6421. +uses the old layout
  6422. +
  6423. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  6424. +---
  6425. +
  6426. +--- a/drivers/net/wireless/ath/ath9k/ar9002_phy.c
  6427. ++++ b/drivers/net/wireless/ath/ath9k/ar9002_phy.c
  6428. +@@ -476,6 +476,7 @@ static void ar9002_hw_set_bt_ant_diversi
  6429. + static void ar9002_hw_spectral_scan_config(struct ath_hw *ah,
  6430. + struct ath_spec_scan *param)
  6431. + {
  6432. ++ u32 repeat_bit;
  6433. + u8 count;
  6434. +
  6435. + if (!param->enabled) {
  6436. +@@ -486,12 +487,15 @@ static void ar9002_hw_spectral_scan_conf
  6437. + REG_SET_BIT(ah, AR_PHY_RADAR_0, AR_PHY_RADAR_0_FFT_ENA);
  6438. + REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN, AR_PHY_SPECTRAL_SCAN_ENABLE);
  6439. +
  6440. ++ if (AR_SREV_9280(ah))
  6441. ++ repeat_bit = AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT;
  6442. ++ else
  6443. ++ repeat_bit = AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_KIWI;
  6444. ++
  6445. + if (param->short_repeat)
  6446. +- REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN,
  6447. +- AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT);
  6448. ++ REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN, repeat_bit);
  6449. + else
  6450. +- REG_CLR_BIT(ah, AR_PHY_SPECTRAL_SCAN,
  6451. +- AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT);
  6452. ++ REG_CLR_BIT(ah, AR_PHY_SPECTRAL_SCAN, repeat_bit);
  6453. +
  6454. + /* on AR92xx, the highest bit of count will make the the chip send
  6455. + * spectral samples endlessly. Check if this really was intended,
  6456. +@@ -499,15 +503,25 @@ static void ar9002_hw_spectral_scan_conf
  6457. + */
  6458. + count = param->count;
  6459. + if (param->endless) {
  6460. +- if (AR_SREV_9271(ah))
  6461. +- count = 0;
  6462. +- else
  6463. ++ if (AR_SREV_9280(ah))
  6464. + count = 0x80;
  6465. ++ else
  6466. ++ count = 0;
  6467. + } else if (count & 0x80)
  6468. + count = 0x7f;
  6469. ++ else if (!count)
  6470. ++ count = 1;
  6471. ++
  6472. ++ if (AR_SREV_9280(ah)) {
  6473. ++ REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN,
  6474. ++ AR_PHY_SPECTRAL_SCAN_COUNT, count);
  6475. ++ } else {
  6476. ++ REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN,
  6477. ++ AR_PHY_SPECTRAL_SCAN_COUNT_KIWI, count);
  6478. ++ REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN,
  6479. ++ AR_PHY_SPECTRAL_SCAN_PHYERR_MASK_SELECT);
  6480. ++ }
  6481. +
  6482. +- REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN,
  6483. +- AR_PHY_SPECTRAL_SCAN_COUNT, count);
  6484. + REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN,
  6485. + AR_PHY_SPECTRAL_SCAN_PERIOD, param->period);
  6486. + REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN,
  6487. +--- a/drivers/net/wireless/ath/ath9k/ar9002_phy.h
  6488. ++++ b/drivers/net/wireless/ath/ath9k/ar9002_phy.h
  6489. +@@ -177,8 +177,11 @@
  6490. + #define AR_PHY_SPECTRAL_SCAN_PERIOD_S 8
  6491. + #define AR_PHY_SPECTRAL_SCAN_COUNT 0x00FF0000 /* Number of reports, reg 68, bits 16-23*/
  6492. + #define AR_PHY_SPECTRAL_SCAN_COUNT_S 16
  6493. ++#define AR_PHY_SPECTRAL_SCAN_COUNT_KIWI 0x0FFF0000 /* Number of reports, reg 68, bits 16-27*/
  6494. ++#define AR_PHY_SPECTRAL_SCAN_COUNT_KIWI_S 16
  6495. + #define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT 0x01000000 /* Short repeat, reg 68, bit 24*/
  6496. +-#define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_S 24 /* Short repeat, reg 68, bit 24*/
  6497. ++#define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_KIWI 0x10000000 /* Short repeat, reg 68, bit 28*/
  6498. ++#define AR_PHY_SPECTRAL_SCAN_PHYERR_MASK_SELECT 0x40000000
  6499. +
  6500. + #define AR_PHY_RX_DELAY 0x9914
  6501. + #define AR_PHY_SEARCH_START_DELAY 0x9918
  6502. diff --git a/package/kernel/mac80211/patches/324-brcmfmac-treat-NULL-character-in-NVRAM-as-separator.patch b/package/kernel/mac80211/patches/324-brcmfmac-treat-NULL-character-in-NVRAM-as-separator.patch
  6503. deleted file mode 100644
  6504. index 6ce60f1..0000000
  6505. --- a/package/kernel/mac80211/patches/324-brcmfmac-treat-NULL-character-in-NVRAM-as-separator.patch
  6506. +++ /dev/null
  6507. @@ -1,32 +0,0 @@
  6508. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  6509. -Date: Sun, 31 Jan 2016 12:14:34 +0100
  6510. -Subject: [PATCH] brcmfmac: treat NULL character in NVRAM as separator
  6511. -MIME-Version: 1.0
  6512. -Content-Type: text/plain; charset=UTF-8
  6513. -Content-Transfer-Encoding: 8bit
  6514. -
  6515. -Platform NVRAM (stored on a flash partition) has entries separated by a
  6516. -NULL (\0) char. Our parsing code switches from VALUE state to IDLE
  6517. -whenever it meets a NULL (\0). When that happens our IDLE handler should
  6518. -simply consume it and analyze whatever is placed ahead.
  6519. -
  6520. -This fixes harmless warnings spamming debugging output:
  6521. -[ 155.165624] brcmfmac: brcmf_nvram_handle_idle warning: ln=1:col=20: ignoring invalid character
  6522. -[ 155.180806] brcmfmac: brcmf_nvram_handle_idle warning: ln=1:col=44: ignoring invalid character
  6523. -[ 155.195971] brcmfmac: brcmf_nvram_handle_idle warning: ln=1:col=63: ignoring invalid character
  6524. -
  6525. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  6526. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6527. ----
  6528. -
  6529. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  6530. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  6531. -@@ -93,7 +93,7 @@ static enum nvram_parser_state brcmf_nvr
  6532. - c = nvp->data[nvp->pos];
  6533. - if (c == '\n')
  6534. - return COMMENT;
  6535. -- if (is_whitespace(c))
  6536. -+ if (is_whitespace(c) || c == '\0')
  6537. - goto proceed;
  6538. - if (c == '#')
  6539. - return COMMENT;
  6540. diff --git a/package/kernel/mac80211/patches/325-ath9k_hw-fix-duplicate-and-partially-wrong-definitio.patch b/package/kernel/mac80211/patches/325-ath9k_hw-fix-duplicate-and-partially-wrong-definitio.patch
  6541. new file mode 100644
  6542. index 0000000..6685f33
  6543. --- /dev/null
  6544. +++ b/package/kernel/mac80211/patches/325-ath9k_hw-fix-duplicate-and-partially-wrong-definitio.patch
  6545. @@ -0,0 +1,57 @@
  6546. +From: Felix Fietkau <nbd@nbd.name>
  6547. +Date: Mon, 11 Jul 2016 11:31:39 +0200
  6548. +Subject: [PATCH] ath9k_hw: fix duplicate (and partially wrong) definition
  6549. + of AR_CH0_THERM
  6550. +
  6551. +AR_PHY_65NM_CH0_THERM and AR_CH0_THERM were supposed to refer to the
  6552. +same register, however they had different SREV checks.
  6553. +
  6554. +Remove the duplicate and use the checks. Since there were other SREV
  6555. +checks present in the only place that uses this, this will probaby not
  6556. +affect runtime behavior.
  6557. +
  6558. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  6559. +---
  6560. +
  6561. +--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.h
  6562. ++++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.h
  6563. +@@ -689,13 +689,6 @@
  6564. + #define AR_CH0_TOP_XPABIASLVL (AR_SREV_9550(ah) ? 0x3c0 : 0x300)
  6565. + #define AR_CH0_TOP_XPABIASLVL_S (AR_SREV_9550(ah) ? 6 : 8)
  6566. +
  6567. +-#define AR_CH0_THERM (AR_SREV_9300(ah) ? 0x16290 : \
  6568. +- ((AR_SREV_9485(ah) ? 0x1628c : 0x16294)))
  6569. +-#define AR_CH0_THERM_XPABIASLVL_MSB 0x3
  6570. +-#define AR_CH0_THERM_XPABIASLVL_MSB_S 0
  6571. +-#define AR_CH0_THERM_XPASHORT2GND 0x4
  6572. +-#define AR_CH0_THERM_XPASHORT2GND_S 2
  6573. +-
  6574. + #define AR_SWITCH_TABLE_COM_ALL (0xffff)
  6575. + #define AR_SWITCH_TABLE_COM_ALL_S (0)
  6576. + #define AR_SWITCH_TABLE_COM_AR9462_ALL (0xffffff)
  6577. +@@ -712,15 +705,17 @@
  6578. + #define AR_SWITCH_TABLE_ALL (0xfff)
  6579. + #define AR_SWITCH_TABLE_ALL_S (0)
  6580. +
  6581. +-#define AR_PHY_65NM_CH0_THERM (AR_SREV_9300(ah) ? 0x16290 :\
  6582. +- ((AR_SREV_9462(ah) || AR_SREV_9565(ah)) ? 0x16294 : 0x1628c))
  6583. ++#define AR_CH0_THERM (AR_SREV_9300(ah) ? 0x16290 :\
  6584. ++ ((AR_SREV_9462(ah) || AR_SREV_9565(ah)) ? 0x16294 : 0x1628c))
  6585. ++#define AR_CH0_THERM_XPABIASLVL_MSB 0x3
  6586. ++#define AR_CH0_THERM_XPABIASLVL_MSB_S 0
  6587. ++#define AR_CH0_THERM_XPASHORT2GND 0x4
  6588. ++#define AR_CH0_THERM_XPASHORT2GND_S 2
  6589. +
  6590. +-#define AR_PHY_65NM_CH0_THERM_LOCAL 0x80000000
  6591. +-#define AR_PHY_65NM_CH0_THERM_LOCAL_S 31
  6592. +-#define AR_PHY_65NM_CH0_THERM_START 0x20000000
  6593. +-#define AR_PHY_65NM_CH0_THERM_START_S 29
  6594. +-#define AR_PHY_65NM_CH0_THERM_SAR_ADC_OUT 0x0000ff00
  6595. +-#define AR_PHY_65NM_CH0_THERM_SAR_ADC_OUT_S 8
  6596. ++#define AR_CH0_THERM_LOCAL 0x80000000
  6597. ++#define AR_CH0_THERM_START 0x20000000
  6598. ++#define AR_CH0_THERM_SAR_ADC_OUT 0x0000ff00
  6599. ++#define AR_CH0_THERM_SAR_ADC_OUT_S 8
  6600. +
  6601. + #define AR_CH0_TOP2 (AR_SREV_9300(ah) ? 0x1628c : \
  6602. + (AR_SREV_9462(ah) ? 0x16290 : 0x16284))
  6603. diff --git a/package/kernel/mac80211/patches/325-brcmfmac-sdio-Increase-the-default-timeouts-a-bit.patch b/package/kernel/mac80211/patches/325-brcmfmac-sdio-Increase-the-default-timeouts-a-bit.patch
  6604. deleted file mode 100644
  6605. index 012dea1..0000000
  6606. --- a/package/kernel/mac80211/patches/325-brcmfmac-sdio-Increase-the-default-timeouts-a-bit.patch
  6607. +++ /dev/null
  6608. @@ -1,41 +0,0 @@
  6609. -From: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
  6610. -Date: Mon, 25 Jan 2016 11:47:29 +0100
  6611. -Subject: [PATCH] brcmfmac: sdio: Increase the default timeouts a bit
  6612. -
  6613. -On a Radxa Rock2 board with a Ampak AP6335 (Broadcom 4339 core) it seems
  6614. -the card responds very quickly most of the time, unfortunately during
  6615. -initialisation it sometimes seems to take just a bit over 2 seconds to
  6616. -respond.
  6617. -
  6618. -This results intialization failing with message like:
  6619. - brcmf_c_preinit_dcmds: Retreiving cur_etheraddr failed, -52
  6620. - brcmf_bus_start: failed: -52
  6621. - brcmf_sdio_firmware_callback: dongle is not responding
  6622. -
  6623. -Increasing the timeout to allow for a bit more headroom allows the
  6624. -card to initialize reliably.
  6625. -
  6626. -A quick search online after diagnosing/fixing this showed that Google
  6627. -has a similar patch in their ChromeOS tree, so this doesn't seem
  6628. -specific to the board I'm using.
  6629. -
  6630. -Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
  6631. -Reviewed-by: Julian Calaby <julian.calaby@gmail.com>
  6632. -Acked-by: Arend van Spriel <arend@broadcom.com>
  6633. -Reviewed-by: Douglas Anderson <dianders@chromium.org>
  6634. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6635. ----
  6636. -
  6637. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  6638. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  6639. -@@ -45,8 +45,8 @@
  6640. - #include "chip.h"
  6641. - #include "firmware.h"
  6642. -
  6643. --#define DCMD_RESP_TIMEOUT msecs_to_jiffies(2000)
  6644. --#define CTL_DONE_TIMEOUT msecs_to_jiffies(2000)
  6645. -+#define DCMD_RESP_TIMEOUT msecs_to_jiffies(2500)
  6646. -+#define CTL_DONE_TIMEOUT msecs_to_jiffies(2500)
  6647. -
  6648. - #ifdef DEBUG
  6649. -
  6650. diff --git a/package/kernel/mac80211/patches/326-ath9k-make-NF-load-complete-quickly-and-reliably.patch b/package/kernel/mac80211/patches/326-ath9k-make-NF-load-complete-quickly-and-reliably.patch
  6651. deleted file mode 100644
  6652. index 71f7a40..0000000
  6653. --- a/package/kernel/mac80211/patches/326-ath9k-make-NF-load-complete-quickly-and-reliably.patch
  6654. +++ /dev/null
  6655. @@ -1,87 +0,0 @@
  6656. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  6657. -Date: Fri, 5 Feb 2016 09:45:50 +0800
  6658. -Subject: [PATCH] ath9k: make NF load complete quickly and reliably
  6659. -
  6660. -Make NF load complete quickly and reliably. NF load execution
  6661. -is delayed by HW to end of frame if frame Rx or Tx is ongoing.
  6662. -Increasing timeout to max frame duration. If NF cal is ongoing
  6663. -before NF load, stop it before load, and restart it afterwards.
  6664. -
  6665. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  6666. ----
  6667. -
  6668. ---- a/drivers/net/wireless/ath/ath9k/calib.c
  6669. -+++ b/drivers/net/wireless/ath/ath9k/calib.c
  6670. -@@ -241,6 +241,7 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  6671. - u8 chainmask = (ah->rxchainmask << 3) | ah->rxchainmask;
  6672. - struct ath_common *common = ath9k_hw_common(ah);
  6673. - s16 default_nf = ath9k_hw_get_default_nf(ah, chan);
  6674. -+ u32 bb_agc_ctl = REG_READ(ah, AR_PHY_AGC_CONTROL);
  6675. -
  6676. - if (ah->caldata)
  6677. - h = ah->caldata->nfCalHist;
  6678. -@@ -264,6 +265,16 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  6679. - }
  6680. -
  6681. - /*
  6682. -+ * stop NF cal if ongoing to ensure NF load completes immediately
  6683. -+ * (or after end rx/tx frame if ongoing)
  6684. -+ */
  6685. -+ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_NF) {
  6686. -+ REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF);
  6687. -+ REG_RMW_BUFFER_FLUSH(ah);
  6688. -+ ENABLE_REG_RMW_BUFFER(ah);
  6689. -+ }
  6690. -+
  6691. -+ /*
  6692. - * Load software filtered NF value into baseband internal minCCApwr
  6693. - * variable.
  6694. - */
  6695. -@@ -276,18 +287,33 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  6696. -
  6697. - /*
  6698. - * Wait for load to complete, should be fast, a few 10s of us.
  6699. -- * The max delay was changed from an original 250us to 10000us
  6700. -- * since 250us often results in NF load timeout and causes deaf
  6701. -- * condition during stress testing 12/12/2009
  6702. -+ * The max delay was changed from an original 250us to 22.2 msec.
  6703. -+ * This would increase timeout to the longest possible frame
  6704. -+ * (11n max length 22.1 msec)
  6705. - */
  6706. -- for (j = 0; j < 10000; j++) {
  6707. -+ for (j = 0; j < 22200; j++) {
  6708. - if ((REG_READ(ah, AR_PHY_AGC_CONTROL) &
  6709. -- AR_PHY_AGC_CONTROL_NF) == 0)
  6710. -+ AR_PHY_AGC_CONTROL_NF) == 0)
  6711. - break;
  6712. - udelay(10);
  6713. - }
  6714. -
  6715. - /*
  6716. -+ * Restart NF so it can continue.
  6717. -+ */
  6718. -+ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_NF) {
  6719. -+ ENABLE_REG_RMW_BUFFER(ah);
  6720. -+ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_ENABLE_NF)
  6721. -+ REG_SET_BIT(ah, AR_PHY_AGC_CONTROL,
  6722. -+ AR_PHY_AGC_CONTROL_ENABLE_NF);
  6723. -+ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_NO_UPDATE_NF)
  6724. -+ REG_SET_BIT(ah, AR_PHY_AGC_CONTROL,
  6725. -+ AR_PHY_AGC_CONTROL_NO_UPDATE_NF);
  6726. -+ REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF);
  6727. -+ REG_RMW_BUFFER_FLUSH(ah);
  6728. -+ }
  6729. -+
  6730. -+ /*
  6731. - * We timed out waiting for the noisefloor to load, probably due to an
  6732. - * in-progress rx. Simply return here and allow the load plenty of time
  6733. - * to complete before the next calibration interval. We need to avoid
  6734. -@@ -296,7 +322,7 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  6735. - * here, the baseband nf cal will just be capped by our present
  6736. - * noisefloor until the next calibration timer.
  6737. - */
  6738. -- if (j == 10000) {
  6739. -+ if (j == 22200) {
  6740. - ath_dbg(common, ANY,
  6741. - "Timeout while waiting for nf to load: AR_PHY_AGC_CONTROL=0x%x\n",
  6742. - REG_READ(ah, AR_PHY_AGC_CONTROL));
  6743. diff --git a/package/kernel/mac80211/patches/326-ath9k_hw-simplify-ar9003_hw_per_calibration.patch b/package/kernel/mac80211/patches/326-ath9k_hw-simplify-ar9003_hw_per_calibration.patch
  6744. new file mode 100644
  6745. index 0000000..999d993
  6746. --- /dev/null
  6747. +++ b/package/kernel/mac80211/patches/326-ath9k_hw-simplify-ar9003_hw_per_calibration.patch
  6748. @@ -0,0 +1,88 @@
  6749. +From: Felix Fietkau <nbd@nbd.name>
  6750. +Date: Mon, 11 Jul 2016 11:34:47 +0200
  6751. +Subject: [PATCH] ath9k_hw: simplify ar9003_hw_per_calibration
  6752. +
  6753. +Reduce indentation, use a variable to save a few pointer dereferences
  6754. +
  6755. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  6756. +---
  6757. +
  6758. +--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  6759. ++++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  6760. +@@ -75,50 +75,49 @@ static bool ar9003_hw_per_calibration(st
  6761. + struct ath9k_cal_list *currCal)
  6762. + {
  6763. + struct ath9k_hw_cal_data *caldata = ah->caldata;
  6764. +- /* Cal is assumed not done until explicitly set below */
  6765. +- bool iscaldone = false;
  6766. ++ const struct ath9k_percal_data *cur_caldata = currCal->calData;
  6767. +
  6768. + /* Calibration in progress. */
  6769. + if (currCal->calState == CAL_RUNNING) {
  6770. + /* Check to see if it has finished. */
  6771. +- if (!(REG_READ(ah, AR_PHY_TIMING4) & AR_PHY_TIMING4_DO_CAL)) {
  6772. +- /*
  6773. +- * Accumulate cal measures for active chains
  6774. +- */
  6775. +- currCal->calData->calCollect(ah);
  6776. +- ah->cal_samples++;
  6777. ++ if (REG_READ(ah, AR_PHY_TIMING4) & AR_PHY_TIMING4_DO_CAL)
  6778. ++ return false;
  6779. +
  6780. +- if (ah->cal_samples >=
  6781. +- currCal->calData->calNumSamples) {
  6782. +- unsigned int i, numChains = 0;
  6783. +- for (i = 0; i < AR9300_MAX_CHAINS; i++) {
  6784. +- if (rxchainmask & (1 << i))
  6785. +- numChains++;
  6786. +- }
  6787. ++ /*
  6788. ++ * Accumulate cal measures for active chains
  6789. ++ */
  6790. ++ cur_caldata->calCollect(ah);
  6791. ++ ah->cal_samples++;
  6792. +
  6793. +- /*
  6794. +- * Process accumulated data
  6795. +- */
  6796. +- currCal->calData->calPostProc(ah, numChains);
  6797. ++ if (ah->cal_samples >= cur_caldata->calNumSamples) {
  6798. ++ unsigned int i, numChains = 0;
  6799. ++ for (i = 0; i < AR9300_MAX_CHAINS; i++) {
  6800. ++ if (rxchainmask & (1 << i))
  6801. ++ numChains++;
  6802. ++ }
  6803. +
  6804. +- /* Calibration has finished. */
  6805. +- caldata->CalValid |= currCal->calData->calType;
  6806. +- currCal->calState = CAL_DONE;
  6807. +- iscaldone = true;
  6808. +- } else {
  6809. ++ /*
  6810. ++ * Process accumulated data
  6811. ++ */
  6812. ++ cur_caldata->calPostProc(ah, numChains);
  6813. ++
  6814. ++ /* Calibration has finished. */
  6815. ++ caldata->CalValid |= cur_caldata->calType;
  6816. ++ currCal->calState = CAL_DONE;
  6817. ++ return true;
  6818. ++ } else {
  6819. + /*
  6820. + * Set-up collection of another sub-sample until we
  6821. + * get desired number
  6822. + */
  6823. + ar9003_hw_setup_calibration(ah, currCal);
  6824. +- }
  6825. + }
  6826. +- } else if (!(caldata->CalValid & currCal->calData->calType)) {
  6827. ++ } else if (!(caldata->CalValid & cur_caldata->calType)) {
  6828. + /* If current cal is marked invalid in channel, kick it off */
  6829. + ath9k_hw_reset_calibration(ah, currCal);
  6830. + }
  6831. +
  6832. +- return iscaldone;
  6833. ++ return false;
  6834. + }
  6835. +
  6836. + static int ar9003_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan,
  6837. diff --git a/package/kernel/mac80211/patches/327-ath9k_hw-get-rid-of-some-duplicate-code-in-calibrati.patch b/package/kernel/mac80211/patches/327-ath9k_hw-get-rid-of-some-duplicate-code-in-calibrati.patch
  6838. new file mode 100644
  6839. index 0000000..b7f3823
  6840. --- /dev/null
  6841. +++ b/package/kernel/mac80211/patches/327-ath9k_hw-get-rid-of-some-duplicate-code-in-calibrati.patch
  6842. @@ -0,0 +1,94 @@
  6843. +From: Felix Fietkau <nbd@nbd.name>
  6844. +Date: Mon, 11 Jul 2016 11:35:20 +0200
  6845. +Subject: [PATCH] ath9k_hw: get rid of some duplicate code in calibration
  6846. + init
  6847. +
  6848. +Remove a misleading debug message as well
  6849. +
  6850. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  6851. +---
  6852. +
  6853. +--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  6854. ++++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  6855. +@@ -1373,6 +1373,26 @@ static void ar9003_hw_cl_cal_post_proc(s
  6856. + }
  6857. + }
  6858. +
  6859. ++static void ar9003_hw_init_cal_common(struct ath_hw *ah)
  6860. ++{
  6861. ++ struct ath9k_hw_cal_data *caldata = ah->caldata;
  6862. ++
  6863. ++ /* Initialize list pointers */
  6864. ++ ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL;
  6865. ++
  6866. ++ INIT_CAL(&ah->iq_caldata);
  6867. ++ INSERT_CAL(ah, &ah->iq_caldata);
  6868. ++
  6869. ++ /* Initialize current pointer to first element in list */
  6870. ++ ah->cal_list_curr = ah->cal_list;
  6871. ++
  6872. ++ if (ah->cal_list_curr)
  6873. ++ ath9k_hw_reset_calibration(ah, ah->cal_list_curr);
  6874. ++
  6875. ++ if (caldata)
  6876. ++ caldata->CalValid = 0;
  6877. ++}
  6878. ++
  6879. + static bool ar9003_hw_init_cal_pcoem(struct ath_hw *ah,
  6880. + struct ath9k_channel *chan)
  6881. + {
  6882. +@@ -1532,21 +1552,7 @@ skip_tx_iqcal:
  6883. + /* Revert chainmask to runtime parameters */
  6884. + ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask);
  6885. +
  6886. +- /* Initialize list pointers */
  6887. +- ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL;
  6888. +-
  6889. +- INIT_CAL(&ah->iq_caldata);
  6890. +- INSERT_CAL(ah, &ah->iq_caldata);
  6891. +- ath_dbg(common, CALIBRATE, "enabling IQ Calibration\n");
  6892. +-
  6893. +- /* Initialize current pointer to first element in list */
  6894. +- ah->cal_list_curr = ah->cal_list;
  6895. +-
  6896. +- if (ah->cal_list_curr)
  6897. +- ath9k_hw_reset_calibration(ah, ah->cal_list_curr);
  6898. +-
  6899. +- if (caldata)
  6900. +- caldata->CalValid = 0;
  6901. ++ ar9003_hw_init_cal_common(ah);
  6902. +
  6903. + return true;
  6904. + }
  6905. +@@ -1577,8 +1583,6 @@ static bool do_ar9003_agc_cal(struct ath
  6906. + static bool ar9003_hw_init_cal_soc(struct ath_hw *ah,
  6907. + struct ath9k_channel *chan)
  6908. + {
  6909. +- struct ath_common *common = ath9k_hw_common(ah);
  6910. +- struct ath9k_hw_cal_data *caldata = ah->caldata;
  6911. + bool txiqcal_done = false;
  6912. + bool status = true;
  6913. + bool run_agc_cal = false, sep_iq_cal = false;
  6914. +@@ -1676,21 +1680,7 @@ skip_tx_iqcal:
  6915. + /* Revert chainmask to runtime parameters */
  6916. + ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask);
  6917. +
  6918. +- /* Initialize list pointers */
  6919. +- ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL;
  6920. +-
  6921. +- INIT_CAL(&ah->iq_caldata);
  6922. +- INSERT_CAL(ah, &ah->iq_caldata);
  6923. +- ath_dbg(common, CALIBRATE, "enabling IQ Calibration\n");
  6924. +-
  6925. +- /* Initialize current pointer to first element in list */
  6926. +- ah->cal_list_curr = ah->cal_list;
  6927. +-
  6928. +- if (ah->cal_list_curr)
  6929. +- ath9k_hw_reset_calibration(ah, ah->cal_list_curr);
  6930. +-
  6931. +- if (caldata)
  6932. +- caldata->CalValid = 0;
  6933. ++ ar9003_hw_init_cal_common(ah);
  6934. +
  6935. + return true;
  6936. + }
  6937. diff --git a/package/kernel/mac80211/patches/327-mac80211-Remove-MPP-table-entries-with-MPath.patch b/package/kernel/mac80211/patches/327-mac80211-Remove-MPP-table-entries-with-MPath.patch
  6938. deleted file mode 100644
  6939. index f7f9df9..0000000
  6940. --- a/package/kernel/mac80211/patches/327-mac80211-Remove-MPP-table-entries-with-MPath.patch
  6941. +++ /dev/null
  6942. @@ -1,54 +0,0 @@
  6943. -From: Henning Rogge <hrogge@gmail.com>
  6944. -Date: Wed, 3 Feb 2016 13:58:36 +0100
  6945. -Subject: [PATCH] mac80211: Remove MPP table entries with MPath
  6946. -
  6947. -Make the mesh_path_del() function remove all mpp table entries
  6948. -that are proxied by the removed mesh path.
  6949. -
  6950. -Acked-by: Bob Copeland <me@bobcopeland.com>
  6951. -Signed-off-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
  6952. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  6953. ----
  6954. -
  6955. ---- a/net/mac80211/mesh_pathtbl.c
  6956. -+++ b/net/mac80211/mesh_pathtbl.c
  6957. -@@ -835,6 +835,29 @@ void mesh_path_flush_by_nexthop(struct s
  6958. - rcu_read_unlock();
  6959. - }
  6960. -
  6961. -+static void mpp_flush_by_proxy(struct ieee80211_sub_if_data *sdata,
  6962. -+ const u8 *proxy)
  6963. -+{
  6964. -+ struct mesh_table *tbl;
  6965. -+ struct mesh_path *mpp;
  6966. -+ struct mpath_node *node;
  6967. -+ int i;
  6968. -+
  6969. -+ rcu_read_lock();
  6970. -+ read_lock_bh(&pathtbl_resize_lock);
  6971. -+ tbl = resize_dereference_mpp_paths();
  6972. -+ for_each_mesh_entry(tbl, node, i) {
  6973. -+ mpp = node->mpath;
  6974. -+ if (ether_addr_equal(mpp->mpp, proxy)) {
  6975. -+ spin_lock(&tbl->hashwlock[i]);
  6976. -+ __mesh_path_del(tbl, node);
  6977. -+ spin_unlock(&tbl->hashwlock[i]);
  6978. -+ }
  6979. -+ }
  6980. -+ read_unlock_bh(&pathtbl_resize_lock);
  6981. -+ rcu_read_unlock();
  6982. -+}
  6983. -+
  6984. - static void table_flush_by_iface(struct mesh_table *tbl,
  6985. - struct ieee80211_sub_if_data *sdata)
  6986. - {
  6987. -@@ -892,6 +915,9 @@ int mesh_path_del(struct ieee80211_sub_i
  6988. - int hash_idx;
  6989. - int err = 0;
  6990. -
  6991. -+ /* flush relevant mpp entries first */
  6992. -+ mpp_flush_by_proxy(sdata, addr);
  6993. -+
  6994. - read_lock_bh(&pathtbl_resize_lock);
  6995. - tbl = resize_dereference_mesh_paths();
  6996. - hash_idx = mesh_table_hash(addr, sdata, tbl);
  6997. diff --git a/package/kernel/mac80211/patches/328-ath9k_hw-implement-temperature-compensation-support-.patch b/package/kernel/mac80211/patches/328-ath9k_hw-implement-temperature-compensation-support-.patch
  6998. new file mode 100644
  6999. index 0000000..cff32ad
  7000. --- /dev/null
  7001. +++ b/package/kernel/mac80211/patches/328-ath9k_hw-implement-temperature-compensation-support-.patch
  7002. @@ -0,0 +1,97 @@
  7003. +From: Felix Fietkau <nbd@nbd.name>
  7004. +Date: Mon, 11 Jul 2016 11:35:55 +0200
  7005. +Subject: [PATCH] ath9k_hw: implement temperature compensation support for
  7006. + AR9003+
  7007. +
  7008. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  7009. +---
  7010. +
  7011. +--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  7012. ++++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  7013. +@@ -33,6 +33,7 @@ struct coeff {
  7014. +
  7015. + enum ar9003_cal_types {
  7016. + IQ_MISMATCH_CAL = BIT(0),
  7017. ++ TEMP_COMP_CAL = BIT(1),
  7018. + };
  7019. +
  7020. + static void ar9003_hw_setup_calibration(struct ath_hw *ah,
  7021. +@@ -58,6 +59,12 @@ static void ar9003_hw_setup_calibration(
  7022. + /* Kick-off cal */
  7023. + REG_SET_BIT(ah, AR_PHY_TIMING4, AR_PHY_TIMING4_DO_CAL);
  7024. + break;
  7025. ++ case TEMP_COMP_CAL:
  7026. ++ ath_dbg(common, CALIBRATE,
  7027. ++ "starting Temperature Compensation Calibration\n");
  7028. ++ REG_SET_BIT(ah, AR_CH0_THERM, AR_CH0_THERM_LOCAL);
  7029. ++ REG_SET_BIT(ah, AR_CH0_THERM, AR_CH0_THERM_START);
  7030. ++ break;
  7031. + default:
  7032. + ath_err(common, "Invalid calibration type\n");
  7033. + break;
  7034. +@@ -86,7 +93,8 @@ static bool ar9003_hw_per_calibration(st
  7035. + /*
  7036. + * Accumulate cal measures for active chains
  7037. + */
  7038. +- cur_caldata->calCollect(ah);
  7039. ++ if (cur_caldata->calCollect)
  7040. ++ cur_caldata->calCollect(ah);
  7041. + ah->cal_samples++;
  7042. +
  7043. + if (ah->cal_samples >= cur_caldata->calNumSamples) {
  7044. +@@ -99,7 +107,8 @@ static bool ar9003_hw_per_calibration(st
  7045. + /*
  7046. + * Process accumulated data
  7047. + */
  7048. +- cur_caldata->calPostProc(ah, numChains);
  7049. ++ if (cur_caldata->calPostProc)
  7050. ++ cur_caldata->calPostProc(ah, numChains);
  7051. +
  7052. + /* Calibration has finished. */
  7053. + caldata->CalValid |= cur_caldata->calType;
  7054. +@@ -314,9 +323,16 @@ static const struct ath9k_percal_data iq
  7055. + ar9003_hw_iqcalibrate
  7056. + };
  7057. +
  7058. ++static const struct ath9k_percal_data temp_cal_single_sample = {
  7059. ++ TEMP_COMP_CAL,
  7060. ++ MIN_CAL_SAMPLES,
  7061. ++ PER_MAX_LOG_COUNT,
  7062. ++};
  7063. ++
  7064. + static void ar9003_hw_init_cal_settings(struct ath_hw *ah)
  7065. + {
  7066. + ah->iq_caldata.calData = &iq_cal_single_sample;
  7067. ++ ah->temp_caldata.calData = &temp_cal_single_sample;
  7068. +
  7069. + if (AR_SREV_9300_20_OR_LATER(ah)) {
  7070. + ah->enabled_cals |= TX_IQ_CAL;
  7071. +@@ -324,7 +340,7 @@ static void ar9003_hw_init_cal_settings(
  7072. + ah->enabled_cals |= TX_IQ_ON_AGC_CAL;
  7073. + }
  7074. +
  7075. +- ah->supp_cals = IQ_MISMATCH_CAL;
  7076. ++ ah->supp_cals = IQ_MISMATCH_CAL | TEMP_COMP_CAL;
  7077. + }
  7078. +
  7079. + #define OFF_UPPER_LT 24
  7080. +@@ -1383,6 +1399,9 @@ static void ar9003_hw_init_cal_common(st
  7081. + INIT_CAL(&ah->iq_caldata);
  7082. + INSERT_CAL(ah, &ah->iq_caldata);
  7083. +
  7084. ++ INIT_CAL(&ah->temp_caldata);
  7085. ++ INSERT_CAL(ah, &ah->temp_caldata);
  7086. ++
  7087. + /* Initialize current pointer to first element in list */
  7088. + ah->cal_list_curr = ah->cal_list;
  7089. +
  7090. +--- a/drivers/net/wireless/ath/ath9k/hw.h
  7091. ++++ b/drivers/net/wireless/ath/ath9k/hw.h
  7092. +@@ -830,6 +830,7 @@ struct ath_hw {
  7093. + /* Calibration */
  7094. + u32 supp_cals;
  7095. + struct ath9k_cal_list iq_caldata;
  7096. ++ struct ath9k_cal_list temp_caldata;
  7097. + struct ath9k_cal_list adcgain_caldata;
  7098. + struct ath9k_cal_list adcdc_caldata;
  7099. + struct ath9k_cal_list *cal_list;
  7100. diff --git a/package/kernel/mac80211/patches/328-mac80211-let-unused-MPP-table-entries-timeout.patch b/package/kernel/mac80211/patches/328-mac80211-let-unused-MPP-table-entries-timeout.patch
  7101. deleted file mode 100644
  7102. index 740993c..0000000
  7103. --- a/package/kernel/mac80211/patches/328-mac80211-let-unused-MPP-table-entries-timeout.patch
  7104. +++ /dev/null
  7105. @@ -1,104 +0,0 @@
  7106. -From: Henning Rogge <hrogge@gmail.com>
  7107. -Date: Wed, 3 Feb 2016 13:58:37 +0100
  7108. -Subject: [PATCH] mac80211: let unused MPP table entries timeout
  7109. -
  7110. -Remember the last time when a mpp table entry is used for
  7111. -rx or tx and remove them after MESH_PATH_EXPIRE time.
  7112. -
  7113. -Acked-by: Bob Copeland <me@bobcopeland.com>
  7114. -Signed-off-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
  7115. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  7116. ----
  7117. -
  7118. ---- a/net/mac80211/mesh_pathtbl.c
  7119. -+++ b/net/mac80211/mesh_pathtbl.c
  7120. -@@ -942,6 +942,46 @@ enddel:
  7121. - }
  7122. -
  7123. - /**
  7124. -+ * mpp_path_del - delete a mesh proxy path from the table
  7125. -+ *
  7126. -+ * @addr: addr address (ETH_ALEN length)
  7127. -+ * @sdata: local subif
  7128. -+ *
  7129. -+ * Returns: 0 if successful
  7130. -+ */
  7131. -+static int mpp_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr)
  7132. -+{
  7133. -+ struct mesh_table *tbl;
  7134. -+ struct mesh_path *mpath;
  7135. -+ struct mpath_node *node;
  7136. -+ struct hlist_head *bucket;
  7137. -+ int hash_idx;
  7138. -+ int err = 0;
  7139. -+
  7140. -+ read_lock_bh(&pathtbl_resize_lock);
  7141. -+ tbl = resize_dereference_mpp_paths();
  7142. -+ hash_idx = mesh_table_hash(addr, sdata, tbl);
  7143. -+ bucket = &tbl->hash_buckets[hash_idx];
  7144. -+
  7145. -+ spin_lock(&tbl->hashwlock[hash_idx]);
  7146. -+ hlist_for_each_entry(node, bucket, list) {
  7147. -+ mpath = node->mpath;
  7148. -+ if (mpath->sdata == sdata &&
  7149. -+ ether_addr_equal(addr, mpath->dst)) {
  7150. -+ __mesh_path_del(tbl, node);
  7151. -+ goto enddel;
  7152. -+ }
  7153. -+ }
  7154. -+
  7155. -+ err = -ENXIO;
  7156. -+enddel:
  7157. -+ mesh_paths_generation++;
  7158. -+ spin_unlock(&tbl->hashwlock[hash_idx]);
  7159. -+ read_unlock_bh(&pathtbl_resize_lock);
  7160. -+ return err;
  7161. -+}
  7162. -+
  7163. -+/**
  7164. - * mesh_path_tx_pending - sends pending frames in a mesh path queue
  7165. - *
  7166. - * @mpath: mesh path to activate
  7167. -@@ -1157,6 +1197,17 @@ void mesh_path_expire(struct ieee80211_s
  7168. - time_after(jiffies, mpath->exp_time + MESH_PATH_EXPIRE))
  7169. - mesh_path_del(mpath->sdata, mpath->dst);
  7170. - }
  7171. -+
  7172. -+ tbl = rcu_dereference(mpp_paths);
  7173. -+ for_each_mesh_entry(tbl, node, i) {
  7174. -+ if (node->mpath->sdata != sdata)
  7175. -+ continue;
  7176. -+ mpath = node->mpath;
  7177. -+ if ((!(mpath->flags & MESH_PATH_FIXED)) &&
  7178. -+ time_after(jiffies, mpath->exp_time + MESH_PATH_EXPIRE))
  7179. -+ mpp_path_del(mpath->sdata, mpath->dst);
  7180. -+ }
  7181. -+
  7182. - rcu_read_unlock();
  7183. - }
  7184. -
  7185. ---- a/net/mac80211/rx.c
  7186. -+++ b/net/mac80211/rx.c
  7187. -@@ -2291,6 +2291,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
  7188. - spin_lock_bh(&mppath->state_lock);
  7189. - if (!ether_addr_equal(mppath->mpp, mpp_addr))
  7190. - memcpy(mppath->mpp, mpp_addr, ETH_ALEN);
  7191. -+ mppath->exp_time = jiffies;
  7192. - spin_unlock_bh(&mppath->state_lock);
  7193. - }
  7194. - rcu_read_unlock();
  7195. ---- a/net/mac80211/tx.c
  7196. -+++ b/net/mac80211/tx.c
  7197. -@@ -2171,8 +2171,11 @@ static struct sk_buff *ieee80211_build_h
  7198. - mpp_lookup = true;
  7199. - }
  7200. -
  7201. -- if (mpp_lookup)
  7202. -+ if (mpp_lookup) {
  7203. - mppath = mpp_path_lookup(sdata, skb->data);
  7204. -+ if (mppath)
  7205. -+ mppath->exp_time = jiffies;
  7206. -+ }
  7207. -
  7208. - if (mppath && mpath)
  7209. - mesh_path_del(mpath->sdata, mpath->dst);
  7210. diff --git a/package/kernel/mac80211/patches/329-mac80211-Unify-mesh-and-mpp-path-removal-function.patch b/package/kernel/mac80211/patches/329-mac80211-Unify-mesh-and-mpp-path-removal-function.patch
  7211. deleted file mode 100644
  7212. index 0c36b1d..0000000
  7213. --- a/package/kernel/mac80211/patches/329-mac80211-Unify-mesh-and-mpp-path-removal-function.patch
  7214. +++ /dev/null
  7215. @@ -1,143 +0,0 @@
  7216. -From: Henning Rogge <hrogge@gmail.com>
  7217. -Date: Wed, 3 Feb 2016 13:58:38 +0100
  7218. -Subject: [PATCH] mac80211: Unify mesh and mpp path removal function
  7219. -
  7220. -mpp_path_del() and mesh_path_del() are mostly the same function.
  7221. -Move common code into a new static function.
  7222. -
  7223. -Acked-by: Bob Copeland <me@bobcopeland.com>
  7224. -Signed-off-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
  7225. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  7226. ----
  7227. -
  7228. ---- a/net/mac80211/mesh_pathtbl.c
  7229. -+++ b/net/mac80211/mesh_pathtbl.c
  7230. -@@ -55,16 +55,21 @@ int mpp_paths_generation;
  7231. - static DEFINE_RWLOCK(pathtbl_resize_lock);
  7232. -
  7233. -
  7234. -+static inline struct mesh_table *resize_dereference_paths(
  7235. -+ struct mesh_table __rcu *table)
  7236. -+{
  7237. -+ return rcu_dereference_protected(table,
  7238. -+ lockdep_is_held(&pathtbl_resize_lock));
  7239. -+}
  7240. -+
  7241. - static inline struct mesh_table *resize_dereference_mesh_paths(void)
  7242. - {
  7243. -- return rcu_dereference_protected(mesh_paths,
  7244. -- lockdep_is_held(&pathtbl_resize_lock));
  7245. -+ return resize_dereference_paths(mesh_paths);
  7246. - }
  7247. -
  7248. - static inline struct mesh_table *resize_dereference_mpp_paths(void)
  7249. - {
  7250. -- return rcu_dereference_protected(mpp_paths,
  7251. -- lockdep_is_held(&pathtbl_resize_lock));
  7252. -+ return resize_dereference_paths(mpp_paths);
  7253. - }
  7254. -
  7255. - /*
  7256. -@@ -899,14 +904,17 @@ void mesh_path_flush_by_iface(struct iee
  7257. - }
  7258. -
  7259. - /**
  7260. -- * mesh_path_del - delete a mesh path from the table
  7261. -+ * table_path_del - delete a path from the mesh or mpp table
  7262. - *
  7263. -- * @addr: dst address (ETH_ALEN length)
  7264. -+ * @tbl: mesh or mpp path table
  7265. - * @sdata: local subif
  7266. -+ * @addr: dst address (ETH_ALEN length)
  7267. - *
  7268. - * Returns: 0 if successful
  7269. - */
  7270. --int mesh_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr)
  7271. -+static int table_path_del(struct mesh_table __rcu *rcu_tbl,
  7272. -+ struct ieee80211_sub_if_data *sdata,
  7273. -+ const u8 *addr)
  7274. - {
  7275. - struct mesh_table *tbl;
  7276. - struct mesh_path *mpath;
  7277. -@@ -915,11 +923,7 @@ int mesh_path_del(struct ieee80211_sub_i
  7278. - int hash_idx;
  7279. - int err = 0;
  7280. -
  7281. -- /* flush relevant mpp entries first */
  7282. -- mpp_flush_by_proxy(sdata, addr);
  7283. --
  7284. -- read_lock_bh(&pathtbl_resize_lock);
  7285. -- tbl = resize_dereference_mesh_paths();
  7286. -+ tbl = resize_dereference_paths(rcu_tbl);
  7287. - hash_idx = mesh_table_hash(addr, sdata, tbl);
  7288. - bucket = &tbl->hash_buckets[hash_idx];
  7289. -
  7290. -@@ -935,9 +939,30 @@ int mesh_path_del(struct ieee80211_sub_i
  7291. -
  7292. - err = -ENXIO;
  7293. - enddel:
  7294. -- mesh_paths_generation++;
  7295. - spin_unlock(&tbl->hashwlock[hash_idx]);
  7296. -+ return err;
  7297. -+}
  7298. -+
  7299. -+/**
  7300. -+ * mesh_path_del - delete a mesh path from the table
  7301. -+ *
  7302. -+ * @addr: dst address (ETH_ALEN length)
  7303. -+ * @sdata: local subif
  7304. -+ *
  7305. -+ * Returns: 0 if successful
  7306. -+ */
  7307. -+int mesh_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr)
  7308. -+{
  7309. -+ int err = 0;
  7310. -+
  7311. -+ /* flush relevant mpp entries first */
  7312. -+ mpp_flush_by_proxy(sdata, addr);
  7313. -+
  7314. -+ read_lock_bh(&pathtbl_resize_lock);
  7315. -+ err = table_path_del(mesh_paths, sdata, addr);
  7316. -+ mesh_paths_generation++;
  7317. - read_unlock_bh(&pathtbl_resize_lock);
  7318. -+
  7319. - return err;
  7320. - }
  7321. -
  7322. -@@ -951,33 +976,13 @@ enddel:
  7323. - */
  7324. - static int mpp_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr)
  7325. - {
  7326. -- struct mesh_table *tbl;
  7327. -- struct mesh_path *mpath;
  7328. -- struct mpath_node *node;
  7329. -- struct hlist_head *bucket;
  7330. -- int hash_idx;
  7331. - int err = 0;
  7332. -
  7333. - read_lock_bh(&pathtbl_resize_lock);
  7334. -- tbl = resize_dereference_mpp_paths();
  7335. -- hash_idx = mesh_table_hash(addr, sdata, tbl);
  7336. -- bucket = &tbl->hash_buckets[hash_idx];
  7337. --
  7338. -- spin_lock(&tbl->hashwlock[hash_idx]);
  7339. -- hlist_for_each_entry(node, bucket, list) {
  7340. -- mpath = node->mpath;
  7341. -- if (mpath->sdata == sdata &&
  7342. -- ether_addr_equal(addr, mpath->dst)) {
  7343. -- __mesh_path_del(tbl, node);
  7344. -- goto enddel;
  7345. -- }
  7346. -- }
  7347. --
  7348. -- err = -ENXIO;
  7349. --enddel:
  7350. -- mesh_paths_generation++;
  7351. -- spin_unlock(&tbl->hashwlock[hash_idx]);
  7352. -+ err = table_path_del(mpp_paths, sdata, addr);
  7353. -+ mpp_paths_generation++;
  7354. - read_unlock_bh(&pathtbl_resize_lock);
  7355. -+
  7356. - return err;
  7357. - }
  7358. -
  7359. diff --git a/package/kernel/mac80211/patches/329-mac80211-fix-check-for-buffered-powersave-frames-wit.patch b/package/kernel/mac80211/patches/329-mac80211-fix-check-for-buffered-powersave-frames-wit.patch
  7360. new file mode 100644
  7361. index 0000000..38e541c
  7362. --- /dev/null
  7363. +++ b/package/kernel/mac80211/patches/329-mac80211-fix-check-for-buffered-powersave-frames-wit.patch
  7364. @@ -0,0 +1,21 @@
  7365. +From: Felix Fietkau <nbd@nbd.name>
  7366. +Date: Mon, 11 Jul 2016 15:07:06 +0200
  7367. +Subject: [PATCH] mac80211: fix check for buffered powersave frames with txq
  7368. +
  7369. +The logic was inverted here, set the bit if frames are pending.
  7370. +
  7371. +Fixes: ba8c3d6f16a1 ("mac80211: add an intermediate software queue implementation")
  7372. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  7373. +---
  7374. +
  7375. +--- a/net/mac80211/rx.c
  7376. ++++ b/net/mac80211/rx.c
  7377. +@@ -1268,7 +1268,7 @@ static void sta_ps_start(struct sta_info
  7378. + for (tid = 0; tid < ARRAY_SIZE(sta->sta.txq); tid++) {
  7379. + struct txq_info *txqi = to_txq_info(sta->sta.txq[tid]);
  7380. +
  7381. +- if (!txqi->tin.backlog_packets)
  7382. ++ if (txqi->tin.backlog_packets)
  7383. + set_bit(tid, &sta->txq_buffered_tids);
  7384. + else
  7385. + clear_bit(tid, &sta->txq_buffered_tids);
  7386. diff --git a/package/kernel/mac80211/patches/330-ath10k-fix-rx-status-reporting-for-A-MSDU-subframes.patch b/package/kernel/mac80211/patches/330-ath10k-fix-rx-status-reporting-for-A-MSDU-subframes.patch
  7387. new file mode 100644
  7388. index 0000000..a6031b9
  7389. --- /dev/null
  7390. +++ b/package/kernel/mac80211/patches/330-ath10k-fix-rx-status-reporting-for-A-MSDU-subframes.patch
  7391. @@ -0,0 +1,36 @@
  7392. +From: Felix Fietkau <nbd@nbd.name>
  7393. +Date: Sun, 17 Jul 2016 12:49:59 +0200
  7394. +Subject: [PATCH] ath10k: fix rx status reporting for A-MSDU subframes
  7395. +
  7396. +Patch by Nagarajan, Ashok Raj <arnagara@qti.qualcomm.com>
  7397. +
  7398. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  7399. +---
  7400. +
  7401. +--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
  7402. ++++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
  7403. +@@ -1525,7 +1525,7 @@ static void ath10k_htt_rx_h_filter(struc
  7404. + static int ath10k_htt_rx_handle_amsdu(struct ath10k_htt *htt)
  7405. + {
  7406. + struct ath10k *ar = htt->ar;
  7407. +- static struct ieee80211_rx_status rx_status;
  7408. ++ struct ieee80211_rx_status *rx_status = &htt->rx_status;
  7409. + struct sk_buff_head amsdu;
  7410. + int ret;
  7411. +
  7412. +@@ -1549,11 +1549,11 @@ static int ath10k_htt_rx_handle_amsdu(st
  7413. + return ret;
  7414. + }
  7415. +
  7416. +- ath10k_htt_rx_h_ppdu(ar, &amsdu, &rx_status, 0xffff);
  7417. ++ ath10k_htt_rx_h_ppdu(ar, &amsdu, rx_status, 0xffff);
  7418. + ath10k_htt_rx_h_unchain(ar, &amsdu, ret > 0);
  7419. +- ath10k_htt_rx_h_filter(ar, &amsdu, &rx_status);
  7420. +- ath10k_htt_rx_h_mpdu(ar, &amsdu, &rx_status);
  7421. +- ath10k_htt_rx_h_deliver(ar, &amsdu, &rx_status);
  7422. ++ ath10k_htt_rx_h_filter(ar, &amsdu, rx_status);
  7423. ++ ath10k_htt_rx_h_mpdu(ar, &amsdu, rx_status);
  7424. ++ ath10k_htt_rx_h_deliver(ar, &amsdu, rx_status);
  7425. +
  7426. + return 0;
  7427. + }
  7428. diff --git a/package/kernel/mac80211/patches/330-mac80211-minstrel-Change-expected-throughput-unit-ba.patch b/package/kernel/mac80211/patches/330-mac80211-minstrel-Change-expected-throughput-unit-ba.patch
  7429. deleted file mode 100644
  7430. index 4dc6d66..0000000
  7431. --- a/package/kernel/mac80211/patches/330-mac80211-minstrel-Change-expected-throughput-unit-ba.patch
  7432. +++ /dev/null
  7433. @@ -1,51 +0,0 @@
  7434. -From: Sven Eckelmann <sven.eckelmann@open-mesh.com>
  7435. -Date: Tue, 2 Feb 2016 08:12:26 +0100
  7436. -Subject: [PATCH] mac80211: minstrel: Change expected throughput unit back to
  7437. - Kbps
  7438. -
  7439. -The change from cur_tp to the function
  7440. -minstrel_get_tp_avg/minstrel_ht_get_tp_avg changed the unit used for the
  7441. -current throughput. For example in minstrel_ht the correct
  7442. -conversion between them would be:
  7443. -
  7444. - mrs->cur_tp / 10 == minstrel_ht_get_tp_avg(..).
  7445. -
  7446. -This factor 10 must also be included in the calculation of
  7447. -minstrel_get_expected_throughput and minstrel_ht_get_expected_throughput to
  7448. -return values with the unit [Kbps] instead of [10Kbps]. Otherwise routing
  7449. -algorithms like B.A.T.M.A.N. V will make incorrect decision based on these
  7450. -values. Its kernel based implementation expects expected_throughput always
  7451. -to have the unit [Kbps] and not sometimes [10Kbps] and sometimes [Kbps].
  7452. -
  7453. -The same requirement has iw or olsrdv2's nl80211 based statistics module
  7454. -which retrieve the same data via NL80211_STA_INFO_TX_BITRATE.
  7455. -
  7456. -Cc: stable@vger.kernel.org
  7457. -Fixes: 6a27b2c40b48 ("mac80211: restructure per-rate throughput calculation into function")
  7458. -Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
  7459. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  7460. ----
  7461. -
  7462. ---- a/net/mac80211/rc80211_minstrel.c
  7463. -+++ b/net/mac80211/rc80211_minstrel.c
  7464. -@@ -711,7 +711,7 @@ static u32 minstrel_get_expected_through
  7465. - * computing cur_tp
  7466. - */
  7467. - tmp_mrs = &mi->r[idx].stats;
  7468. -- tmp_cur_tp = minstrel_get_tp_avg(&mi->r[idx], tmp_mrs->prob_ewma);
  7469. -+ tmp_cur_tp = minstrel_get_tp_avg(&mi->r[idx], tmp_mrs->prob_ewma) * 10;
  7470. - tmp_cur_tp = tmp_cur_tp * 1200 * 8 / 1024;
  7471. -
  7472. - return tmp_cur_tp;
  7473. ---- a/net/mac80211/rc80211_minstrel_ht.c
  7474. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  7475. -@@ -1335,7 +1335,8 @@ static u32 minstrel_ht_get_expected_thro
  7476. - prob = mi->groups[i].rates[j].prob_ewma;
  7477. -
  7478. - /* convert tp_avg from pkt per second in kbps */
  7479. -- tp_avg = minstrel_ht_get_tp_avg(mi, i, j, prob) * AVG_PKT_SIZE * 8 / 1024;
  7480. -+ tp_avg = minstrel_ht_get_tp_avg(mi, i, j, prob) * 10;
  7481. -+ tp_avg = tp_avg * AVG_PKT_SIZE * 8 / 1024;
  7482. -
  7483. - return tp_avg;
  7484. - }
  7485. diff --git a/package/kernel/mac80211/patches/331-brcmfmac-Increase-nr-of-supported-flowrings.patch b/package/kernel/mac80211/patches/331-brcmfmac-Increase-nr-of-supported-flowrings.patch
  7486. deleted file mode 100644
  7487. index 1fd016f..0000000
  7488. --- a/package/kernel/mac80211/patches/331-brcmfmac-Increase-nr-of-supported-flowrings.patch
  7489. +++ /dev/null
  7490. @@ -1,307 +0,0 @@
  7491. -From: Hante Meuleman <meuleman@broadcom.com>
  7492. -Date: Sun, 7 Feb 2016 18:08:24 +0100
  7493. -Subject: [PATCH] brcmfmac: Increase nr of supported flowrings.
  7494. -MIME-Version: 1.0
  7495. -Content-Type: text/plain; charset=UTF-8
  7496. -Content-Transfer-Encoding: 8bit
  7497. -
  7498. -New generation devices have firmware which has more than 256 flowrings.
  7499. -E.g. following debugging message comes from 14e4:4365 BCM4366:
  7500. -[ 194.606245] brcmfmac: brcmf_pcie_init_ringbuffers Nr of flowrings is 264
  7501. -
  7502. -At various code places (related to flowrings) we were using u8 which
  7503. -could lead to storing wrong number or infinite loops when indexing with
  7504. -this type. This issue was quite easy to spot in brcmf_flowring_detach
  7505. -where it led to infinite loop e.g. on failed initialization.
  7506. -
  7507. -This patch switches code to proper types and increases the maximum
  7508. -number of supported flowrings to 512.
  7509. -
  7510. -Originally this change was sent in September 2015, but back it was
  7511. -causing a regression on BCM43602 resulting in:
  7512. -Unable to handle kernel NULL pointer dereference at virtual address ...
  7513. -
  7514. -The reason for this regression was missing update (s/u8/u16) of struct
  7515. -brcmf_flowring_ring. This problem was handled in 9f64df9 ("brcmfmac: Fix
  7516. -bug in flowring management."). Starting with that it's safe to apply
  7517. -this original patch as it doesn't cause a regression anymore.
  7518. -
  7519. -This patch fixes an infinite loop on BCM4366 which is supported since
  7520. -4.4 so it makes sense to apply it to stable 4.4+.
  7521. -
  7522. -Cc: <stable@vger.kernel.org> # 4.4+
  7523. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  7524. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  7525. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  7526. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  7527. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  7528. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  7529. ----
  7530. -
  7531. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c
  7532. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c
  7533. -@@ -32,7 +32,7 @@
  7534. - #define BRCMF_FLOWRING_LOW (BRCMF_FLOWRING_HIGH - 256)
  7535. - #define BRCMF_FLOWRING_INVALID_IFIDX 0xff
  7536. -
  7537. --#define BRCMF_FLOWRING_HASH_AP(da, fifo, ifidx) (da[5] + fifo + ifidx * 16)
  7538. -+#define BRCMF_FLOWRING_HASH_AP(da, fifo, ifidx) (da[5] * 2 + fifo + ifidx * 16)
  7539. - #define BRCMF_FLOWRING_HASH_STA(fifo, ifidx) (fifo + ifidx * 16)
  7540. -
  7541. - static const u8 brcmf_flowring_prio2fifo[] = {
  7542. -@@ -68,7 +68,7 @@ u32 brcmf_flowring_lookup(struct brcmf_f
  7543. - u8 prio, u8 ifidx)
  7544. - {
  7545. - struct brcmf_flowring_hash *hash;
  7546. -- u8 hash_idx;
  7547. -+ u16 hash_idx;
  7548. - u32 i;
  7549. - bool found;
  7550. - bool sta;
  7551. -@@ -88,6 +88,7 @@ u32 brcmf_flowring_lookup(struct brcmf_f
  7552. - }
  7553. - hash_idx = sta ? BRCMF_FLOWRING_HASH_STA(fifo, ifidx) :
  7554. - BRCMF_FLOWRING_HASH_AP(mac, fifo, ifidx);
  7555. -+ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1);
  7556. - found = false;
  7557. - hash = flow->hash;
  7558. - for (i = 0; i < BRCMF_FLOWRING_HASHSIZE; i++) {
  7559. -@@ -98,6 +99,7 @@ u32 brcmf_flowring_lookup(struct brcmf_f
  7560. - break;
  7561. - }
  7562. - hash_idx++;
  7563. -+ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1);
  7564. - }
  7565. - if (found)
  7566. - return hash[hash_idx].flowid;
  7567. -@@ -111,7 +113,7 @@ u32 brcmf_flowring_create(struct brcmf_f
  7568. - {
  7569. - struct brcmf_flowring_ring *ring;
  7570. - struct brcmf_flowring_hash *hash;
  7571. -- u8 hash_idx;
  7572. -+ u16 hash_idx;
  7573. - u32 i;
  7574. - bool found;
  7575. - u8 fifo;
  7576. -@@ -131,6 +133,7 @@ u32 brcmf_flowring_create(struct brcmf_f
  7577. - }
  7578. - hash_idx = sta ? BRCMF_FLOWRING_HASH_STA(fifo, ifidx) :
  7579. - BRCMF_FLOWRING_HASH_AP(mac, fifo, ifidx);
  7580. -+ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1);
  7581. - found = false;
  7582. - hash = flow->hash;
  7583. - for (i = 0; i < BRCMF_FLOWRING_HASHSIZE; i++) {
  7584. -@@ -140,6 +143,7 @@ u32 brcmf_flowring_create(struct brcmf_f
  7585. - break;
  7586. - }
  7587. - hash_idx++;
  7588. -+ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1);
  7589. - }
  7590. - if (found) {
  7591. - for (i = 0; i < flow->nrofrings; i++) {
  7592. -@@ -169,7 +173,7 @@ u32 brcmf_flowring_create(struct brcmf_f
  7593. - }
  7594. -
  7595. -
  7596. --u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u8 flowid)
  7597. -+u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u16 flowid)
  7598. - {
  7599. - struct brcmf_flowring_ring *ring;
  7600. -
  7601. -@@ -179,7 +183,7 @@ u8 brcmf_flowring_tid(struct brcmf_flowr
  7602. - }
  7603. -
  7604. -
  7605. --static void brcmf_flowring_block(struct brcmf_flowring *flow, u8 flowid,
  7606. -+static void brcmf_flowring_block(struct brcmf_flowring *flow, u16 flowid,
  7607. - bool blocked)
  7608. - {
  7609. - struct brcmf_flowring_ring *ring;
  7610. -@@ -228,10 +232,10 @@ static void brcmf_flowring_block(struct
  7611. - }
  7612. -
  7613. -
  7614. --void brcmf_flowring_delete(struct brcmf_flowring *flow, u8 flowid)
  7615. -+void brcmf_flowring_delete(struct brcmf_flowring *flow, u16 flowid)
  7616. - {
  7617. - struct brcmf_flowring_ring *ring;
  7618. -- u8 hash_idx;
  7619. -+ u16 hash_idx;
  7620. - struct sk_buff *skb;
  7621. -
  7622. - ring = flow->rings[flowid];
  7623. -@@ -253,7 +257,7 @@ void brcmf_flowring_delete(struct brcmf_
  7624. - }
  7625. -
  7626. -
  7627. --u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  7628. -+u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u16 flowid,
  7629. - struct sk_buff *skb)
  7630. - {
  7631. - struct brcmf_flowring_ring *ring;
  7632. -@@ -279,7 +283,7 @@ u32 brcmf_flowring_enqueue(struct brcmf_
  7633. - }
  7634. -
  7635. -
  7636. --struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u8 flowid)
  7637. -+struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u16 flowid)
  7638. - {
  7639. - struct brcmf_flowring_ring *ring;
  7640. - struct sk_buff *skb;
  7641. -@@ -300,7 +304,7 @@ struct sk_buff *brcmf_flowring_dequeue(s
  7642. - }
  7643. -
  7644. -
  7645. --void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u8 flowid,
  7646. -+void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u16 flowid,
  7647. - struct sk_buff *skb)
  7648. - {
  7649. - struct brcmf_flowring_ring *ring;
  7650. -@@ -311,7 +315,7 @@ void brcmf_flowring_reinsert(struct brcm
  7651. - }
  7652. -
  7653. -
  7654. --u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u8 flowid)
  7655. -+u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u16 flowid)
  7656. - {
  7657. - struct brcmf_flowring_ring *ring;
  7658. -
  7659. -@@ -326,7 +330,7 @@ u32 brcmf_flowring_qlen(struct brcmf_flo
  7660. - }
  7661. -
  7662. -
  7663. --void brcmf_flowring_open(struct brcmf_flowring *flow, u8 flowid)
  7664. -+void brcmf_flowring_open(struct brcmf_flowring *flow, u16 flowid)
  7665. - {
  7666. - struct brcmf_flowring_ring *ring;
  7667. -
  7668. -@@ -340,10 +344,10 @@ void brcmf_flowring_open(struct brcmf_fl
  7669. - }
  7670. -
  7671. -
  7672. --u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u8 flowid)
  7673. -+u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u16 flowid)
  7674. - {
  7675. - struct brcmf_flowring_ring *ring;
  7676. -- u8 hash_idx;
  7677. -+ u16 hash_idx;
  7678. -
  7679. - ring = flow->rings[flowid];
  7680. - hash_idx = ring->hash_id;
  7681. -@@ -384,7 +388,7 @@ void brcmf_flowring_detach(struct brcmf_
  7682. - struct brcmf_pub *drvr = bus_if->drvr;
  7683. - struct brcmf_flowring_tdls_entry *search;
  7684. - struct brcmf_flowring_tdls_entry *remove;
  7685. -- u8 flowid;
  7686. -+ u16 flowid;
  7687. -
  7688. - for (flowid = 0; flowid < flow->nrofrings; flowid++) {
  7689. - if (flow->rings[flowid])
  7690. -@@ -408,7 +412,7 @@ void brcmf_flowring_configure_addr_mode(
  7691. - struct brcmf_bus *bus_if = dev_get_drvdata(flow->dev);
  7692. - struct brcmf_pub *drvr = bus_if->drvr;
  7693. - u32 i;
  7694. -- u8 flowid;
  7695. -+ u16 flowid;
  7696. -
  7697. - if (flow->addr_mode[ifidx] != addr_mode) {
  7698. - for (i = 0; i < ARRAY_SIZE(flow->hash); i++) {
  7699. -@@ -434,7 +438,7 @@ void brcmf_flowring_delete_peer(struct b
  7700. - struct brcmf_flowring_tdls_entry *prev;
  7701. - struct brcmf_flowring_tdls_entry *search;
  7702. - u32 i;
  7703. -- u8 flowid;
  7704. -+ u16 flowid;
  7705. - bool sta;
  7706. -
  7707. - sta = (flow->addr_mode[ifidx] == ADDR_INDIRECT);
  7708. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.h
  7709. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.h
  7710. -@@ -16,7 +16,7 @@
  7711. - #define BRCMFMAC_FLOWRING_H
  7712. -
  7713. -
  7714. --#define BRCMF_FLOWRING_HASHSIZE 256
  7715. -+#define BRCMF_FLOWRING_HASHSIZE 512 /* has to be 2^x */
  7716. - #define BRCMF_FLOWRING_INVALID_ID 0xFFFFFFFF
  7717. -
  7718. -
  7719. -@@ -24,7 +24,7 @@ struct brcmf_flowring_hash {
  7720. - u8 mac[ETH_ALEN];
  7721. - u8 fifo;
  7722. - u8 ifidx;
  7723. -- u8 flowid;
  7724. -+ u16 flowid;
  7725. - };
  7726. -
  7727. - enum ring_status {
  7728. -@@ -61,16 +61,16 @@ u32 brcmf_flowring_lookup(struct brcmf_f
  7729. - u8 prio, u8 ifidx);
  7730. - u32 brcmf_flowring_create(struct brcmf_flowring *flow, u8 da[ETH_ALEN],
  7731. - u8 prio, u8 ifidx);
  7732. --void brcmf_flowring_delete(struct brcmf_flowring *flow, u8 flowid);
  7733. --void brcmf_flowring_open(struct brcmf_flowring *flow, u8 flowid);
  7734. --u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u8 flowid);
  7735. --u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  7736. -+void brcmf_flowring_delete(struct brcmf_flowring *flow, u16 flowid);
  7737. -+void brcmf_flowring_open(struct brcmf_flowring *flow, u16 flowid);
  7738. -+u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u16 flowid);
  7739. -+u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u16 flowid,
  7740. - struct sk_buff *skb);
  7741. --struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u8 flowid);
  7742. --void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u8 flowid,
  7743. -+struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u16 flowid);
  7744. -+void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u16 flowid,
  7745. - struct sk_buff *skb);
  7746. --u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u8 flowid);
  7747. --u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u8 flowid);
  7748. -+u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u16 flowid);
  7749. -+u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u16 flowid);
  7750. - struct brcmf_flowring *brcmf_flowring_attach(struct device *dev, u16 nrofrings);
  7751. - void brcmf_flowring_detach(struct brcmf_flowring *flow);
  7752. - void brcmf_flowring_configure_addr_mode(struct brcmf_flowring *flow, int ifidx,
  7753. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  7754. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  7755. -@@ -677,7 +677,7 @@ static u32 brcmf_msgbuf_flowring_create(
  7756. - }
  7757. -
  7758. -
  7759. --static void brcmf_msgbuf_txflow(struct brcmf_msgbuf *msgbuf, u8 flowid)
  7760. -+static void brcmf_msgbuf_txflow(struct brcmf_msgbuf *msgbuf, u16 flowid)
  7761. - {
  7762. - struct brcmf_flowring *flow = msgbuf->flow;
  7763. - struct brcmf_commonring *commonring;
  7764. -@@ -1310,7 +1310,7 @@ int brcmf_proto_msgbuf_rx_trigger(struct
  7765. - }
  7766. -
  7767. -
  7768. --void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u8 flowid)
  7769. -+void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u16 flowid)
  7770. - {
  7771. - struct brcmf_msgbuf *msgbuf = (struct brcmf_msgbuf *)drvr->proto->pd;
  7772. - struct msgbuf_tx_flowring_delete_req *delete;
  7773. -@@ -1415,6 +1415,13 @@ int brcmf_proto_msgbuf_attach(struct brc
  7774. - u32 count;
  7775. -
  7776. - if_msgbuf = drvr->bus_if->msgbuf;
  7777. -+
  7778. -+ if (if_msgbuf->nrof_flowrings >= BRCMF_FLOWRING_HASHSIZE) {
  7779. -+ brcmf_err("driver not configured for this many flowrings %d\n",
  7780. -+ if_msgbuf->nrof_flowrings);
  7781. -+ if_msgbuf->nrof_flowrings = BRCMF_FLOWRING_HASHSIZE - 1;
  7782. -+ }
  7783. -+
  7784. - msgbuf = kzalloc(sizeof(*msgbuf), GFP_KERNEL);
  7785. - if (!msgbuf)
  7786. - goto fail;
  7787. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.h
  7788. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.h
  7789. -@@ -33,7 +33,7 @@
  7790. -
  7791. -
  7792. - int brcmf_proto_msgbuf_rx_trigger(struct device *dev);
  7793. --void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u8 flowid);
  7794. -+void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u16 flowid);
  7795. - int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr);
  7796. - void brcmf_proto_msgbuf_detach(struct brcmf_pub *drvr);
  7797. - #else
  7798. diff --git a/package/kernel/mac80211/patches/331-mac80211-End-the-MPSP-even-if-EOSP-frame-was-not-rec.patch b/package/kernel/mac80211/patches/331-mac80211-End-the-MPSP-even-if-EOSP-frame-was-not-rec.patch
  7799. new file mode 100644
  7800. index 0000000..5d8a8fb
  7801. --- /dev/null
  7802. +++ b/package/kernel/mac80211/patches/331-mac80211-End-the-MPSP-even-if-EOSP-frame-was-not-rec.patch
  7803. @@ -0,0 +1,42 @@
  7804. +From: Masashi Honma <masashi.honma@gmail.com>
  7805. +Date: Wed, 13 Jul 2016 16:04:35 +0900
  7806. +Subject: [PATCH] mac80211: End the MPSP even if EOSP frame was not received
  7807. +
  7808. +The mesh STA sends QoS frame with EOSP (end of service period)
  7809. +subfiled=1 to end the MPSP(mesh peer service period). Previously, if
  7810. +the frame was not acked by peer, the mesh STA did not end the MPSP.
  7811. +This patch ends the MPSP even if the QoS frame was no acked.
  7812. +
  7813. +Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
  7814. +---
  7815. +
  7816. +--- a/net/mac80211/status.c
  7817. ++++ b/net/mac80211/status.c
  7818. +@@ -784,6 +784,13 @@ void ieee80211_tx_status(struct ieee8021
  7819. + clear_sta_flag(sta, WLAN_STA_SP);
  7820. +
  7821. + acked = !!(info->flags & IEEE80211_TX_STAT_ACK);
  7822. ++
  7823. ++ /* mesh Peer Service Period support */
  7824. ++ if (ieee80211_vif_is_mesh(&sta->sdata->vif) &&
  7825. ++ ieee80211_is_data_qos(fc))
  7826. ++ ieee80211_mpsp_trigger_process(
  7827. ++ ieee80211_get_qos_ctl(hdr), sta, true, acked);
  7828. ++
  7829. + if (!acked && test_sta_flag(sta, WLAN_STA_PS_STA)) {
  7830. + /*
  7831. + * The STA is in power save mode, so assume
  7832. +@@ -794,13 +801,6 @@ void ieee80211_tx_status(struct ieee8021
  7833. + return;
  7834. + }
  7835. +
  7836. +- /* mesh Peer Service Period support */
  7837. +- if (ieee80211_vif_is_mesh(&sta->sdata->vif) &&
  7838. +- ieee80211_is_data_qos(fc))
  7839. +- ieee80211_mpsp_trigger_process(
  7840. +- ieee80211_get_qos_ctl(hdr),
  7841. +- sta, true, acked);
  7842. +-
  7843. + if (ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL) &&
  7844. + (ieee80211_is_data(hdr->frame_control)) &&
  7845. + (rates_idx != -1))
  7846. diff --git a/package/kernel/mac80211/patches/332-ath10k-implement-NAPI-support.patch b/package/kernel/mac80211/patches/332-ath10k-implement-NAPI-support.patch
  7847. new file mode 100644
  7848. index 0000000..c6cc145
  7849. --- /dev/null
  7850. +++ b/package/kernel/mac80211/patches/332-ath10k-implement-NAPI-support.patch
  7851. @@ -0,0 +1,642 @@
  7852. +From: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
  7853. +Date: Thu, 21 Jul 2016 11:50:00 +0530
  7854. +Subject: [PATCH] ath10k: implement NAPI support
  7855. +
  7856. +Add NAPI support for rx and tx completion. NAPI poll is scheduled
  7857. +from interrupt handler. The design is as below
  7858. +
  7859. + - on interrupt
  7860. + - schedule napi and mask interrupts
  7861. + - on poll
  7862. + - process all pipes (no actual Tx/Rx)
  7863. + - process Rx within budget
  7864. + - if quota exceeds budget reschedule napi poll by returning budget
  7865. + - process Tx completions and update budget if necessary
  7866. + - process Tx fetch indications (pull-push)
  7867. + - push any other pending Tx (if possible)
  7868. + - before resched or napi completion replenish htt rx ring buffer
  7869. + - if work done < budget, complete napi poll and unmask interrupts
  7870. +
  7871. +This change also get rid of two tasklets (intr_tq and txrx_compl_task).
  7872. +
  7873. +Measured peak throughput with NAPI on IPQ4019 platform in controlled
  7874. +environment. No noticeable reduction in throughput is seen and also
  7875. +observed improvements in CPU usage. Approx. 15% CPU usage got reduced
  7876. +in UDP uplink case.
  7877. +
  7878. +DL: AP DUT Tx
  7879. +UL: AP DUT Rx
  7880. +
  7881. +IPQ4019 (avg. cpu usage %)
  7882. +========
  7883. + TOT +NAPI
  7884. + =========== =============
  7885. +TCP DL 644 Mbps (42%) 645 Mbps (36%)
  7886. +TCP UL 673 Mbps (30%) 675 Mbps (26%)
  7887. +UDP DL 682 Mbps (49%) 680 Mbps (49%)
  7888. +UDP UL 720 Mbps (28%) 717 Mbps (11%)
  7889. +
  7890. +Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
  7891. +---
  7892. +
  7893. +--- a/drivers/net/wireless/ath/ath10k/ahb.c
  7894. ++++ b/drivers/net/wireless/ath/ath10k/ahb.c
  7895. +@@ -462,13 +462,13 @@ static void ath10k_ahb_halt_chip(struct
  7896. + static irqreturn_t ath10k_ahb_interrupt_handler(int irq, void *arg)
  7897. + {
  7898. + struct ath10k *ar = arg;
  7899. +- struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
  7900. +
  7901. + if (!ath10k_pci_irq_pending(ar))
  7902. + return IRQ_NONE;
  7903. +
  7904. + ath10k_pci_disable_and_clear_legacy_irq(ar);
  7905. +- tasklet_schedule(&ar_pci->intr_tq);
  7906. ++ ath10k_pci_irq_msi_fw_mask(ar);
  7907. ++ napi_schedule(&ar->napi);
  7908. +
  7909. + return IRQ_HANDLED;
  7910. + }
  7911. +@@ -831,7 +831,7 @@ static int ath10k_ahb_probe(struct platf
  7912. + goto err_resource_deinit;
  7913. + }
  7914. +
  7915. +- ath10k_pci_init_irq_tasklets(ar);
  7916. ++ ath10k_pci_init_napi(ar);
  7917. +
  7918. + ret = ath10k_ahb_request_irq_legacy(ar);
  7919. + if (ret)
  7920. +--- a/drivers/net/wireless/ath/ath10k/core.c
  7921. ++++ b/drivers/net/wireless/ath/ath10k/core.c
  7922. +@@ -2226,6 +2226,8 @@ struct ath10k *ath10k_core_create(size_t
  7923. + INIT_WORK(&ar->register_work, ath10k_core_register_work);
  7924. + INIT_WORK(&ar->restart_work, ath10k_core_restart);
  7925. +
  7926. ++ init_dummy_netdev(&ar->napi_dev);
  7927. ++
  7928. + ret = ath10k_debug_create(ar);
  7929. + if (ret)
  7930. + goto err_free_aux_wq;
  7931. +--- a/drivers/net/wireless/ath/ath10k/core.h
  7932. ++++ b/drivers/net/wireless/ath/ath10k/core.h
  7933. +@@ -65,6 +65,10 @@
  7934. + #define ATH10K_KEEPALIVE_MAX_IDLE 3895
  7935. + #define ATH10K_KEEPALIVE_MAX_UNRESPONSIVE 3900
  7936. +
  7937. ++/* NAPI poll budget */
  7938. ++#define ATH10K_NAPI_BUDGET 64
  7939. ++#define ATH10K_NAPI_QUOTA_LIMIT 60
  7940. ++
  7941. + struct ath10k;
  7942. +
  7943. + enum ath10k_bus {
  7944. +@@ -933,6 +937,10 @@ struct ath10k {
  7945. + struct ath10k_thermal thermal;
  7946. + struct ath10k_wow wow;
  7947. +
  7948. ++ /* NAPI */
  7949. ++ struct net_device napi_dev;
  7950. ++ struct napi_struct napi;
  7951. ++
  7952. + /* must be last */
  7953. + u8 drv_priv[0] __aligned(sizeof(void *));
  7954. + };
  7955. +--- a/drivers/net/wireless/ath/ath10k/htt.h
  7956. ++++ b/drivers/net/wireless/ath/ath10k/htt.h
  7957. +@@ -1666,7 +1666,6 @@ struct ath10k_htt {
  7958. +
  7959. + /* This is used to group tx/rx completions separately and process them
  7960. + * in batches to reduce cache stalls */
  7961. +- struct tasklet_struct txrx_compl_task;
  7962. + struct sk_buff_head rx_compl_q;
  7963. + struct sk_buff_head rx_in_ord_compl_q;
  7964. + struct sk_buff_head tx_fetch_ind_q;
  7965. +@@ -1799,5 +1798,6 @@ int ath10k_htt_tx(struct ath10k_htt *htt
  7966. + struct sk_buff *msdu);
  7967. + void ath10k_htt_rx_pktlog_completion_handler(struct ath10k *ar,
  7968. + struct sk_buff *skb);
  7969. ++int ath10k_htt_txrx_compl_task(struct ath10k *ar, int budget);
  7970. +
  7971. + #endif
  7972. +--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
  7973. ++++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
  7974. +@@ -34,7 +34,6 @@
  7975. + #define HTT_RX_RING_REFILL_RESCHED_MS 5
  7976. +
  7977. + static int ath10k_htt_rx_get_csum_state(struct sk_buff *skb);
  7978. +-static void ath10k_htt_txrx_compl_task(unsigned long ptr);
  7979. +
  7980. + static struct sk_buff *
  7981. + ath10k_htt_rx_find_skb_paddr(struct ath10k *ar, u32 paddr)
  7982. +@@ -226,7 +225,6 @@ int ath10k_htt_rx_ring_refill(struct ath
  7983. + void ath10k_htt_rx_free(struct ath10k_htt *htt)
  7984. + {
  7985. + del_timer_sync(&htt->rx_ring.refill_retry_timer);
  7986. +- tasklet_kill(&htt->txrx_compl_task);
  7987. +
  7988. + skb_queue_purge(&htt->rx_compl_q);
  7989. + skb_queue_purge(&htt->rx_in_ord_compl_q);
  7990. +@@ -520,9 +518,6 @@ int ath10k_htt_rx_alloc(struct ath10k_ht
  7991. + skb_queue_head_init(&htt->tx_fetch_ind_q);
  7992. + atomic_set(&htt->num_mpdus_ready, 0);
  7993. +
  7994. +- tasklet_init(&htt->txrx_compl_task, ath10k_htt_txrx_compl_task,
  7995. +- (unsigned long)htt);
  7996. +-
  7997. + ath10k_dbg(ar, ATH10K_DBG_BOOT, "htt rx ring size %d fill_level %d\n",
  7998. + htt->rx_ring.size, htt->rx_ring.fill_level);
  7999. + return 0;
  8000. +@@ -958,7 +953,7 @@ static void ath10k_process_rx(struct ath
  8001. + trace_ath10k_rx_hdr(ar, skb->data, skb->len);
  8002. + trace_ath10k_rx_payload(ar, skb->data, skb->len);
  8003. +
  8004. +- ieee80211_rx(ar->hw, skb);
  8005. ++ ieee80211_rx_napi(ar->hw, NULL, skb, &ar->napi);
  8006. + }
  8007. +
  8008. + static int ath10k_htt_rx_nwifi_hdrlen(struct ath10k *ar,
  8009. +@@ -1527,7 +1522,7 @@ static int ath10k_htt_rx_handle_amsdu(st
  8010. + struct ath10k *ar = htt->ar;
  8011. + struct ieee80211_rx_status *rx_status = &htt->rx_status;
  8012. + struct sk_buff_head amsdu;
  8013. +- int ret;
  8014. ++ int ret, num_msdus;
  8015. +
  8016. + __skb_queue_head_init(&amsdu);
  8017. +
  8018. +@@ -1549,13 +1544,14 @@ static int ath10k_htt_rx_handle_amsdu(st
  8019. + return ret;
  8020. + }
  8021. +
  8022. ++ num_msdus = skb_queue_len(&amsdu);
  8023. + ath10k_htt_rx_h_ppdu(ar, &amsdu, rx_status, 0xffff);
  8024. + ath10k_htt_rx_h_unchain(ar, &amsdu, ret > 0);
  8025. + ath10k_htt_rx_h_filter(ar, &amsdu, rx_status);
  8026. + ath10k_htt_rx_h_mpdu(ar, &amsdu, rx_status);
  8027. + ath10k_htt_rx_h_deliver(ar, &amsdu, rx_status);
  8028. +
  8029. +- return 0;
  8030. ++ return num_msdus;
  8031. + }
  8032. +
  8033. + static void ath10k_htt_rx_proc_rx_ind(struct ath10k_htt *htt,
  8034. +@@ -1579,15 +1575,6 @@ static void ath10k_htt_rx_proc_rx_ind(st
  8035. + mpdu_count += mpdu_ranges[i].mpdu_count;
  8036. +
  8037. + atomic_add(mpdu_count, &htt->num_mpdus_ready);
  8038. +-
  8039. +- tasklet_schedule(&htt->txrx_compl_task);
  8040. +-}
  8041. +-
  8042. +-static void ath10k_htt_rx_frag_handler(struct ath10k_htt *htt)
  8043. +-{
  8044. +- atomic_inc(&htt->num_mpdus_ready);
  8045. +-
  8046. +- tasklet_schedule(&htt->txrx_compl_task);
  8047. + }
  8048. +
  8049. + static void ath10k_htt_rx_tx_compl_ind(struct ath10k *ar,
  8050. +@@ -1772,14 +1759,15 @@ static void ath10k_htt_rx_h_rx_offload_p
  8051. + RX_FLAG_MMIC_STRIPPED;
  8052. + }
  8053. +
  8054. +-static void ath10k_htt_rx_h_rx_offload(struct ath10k *ar,
  8055. +- struct sk_buff_head *list)
  8056. ++static int ath10k_htt_rx_h_rx_offload(struct ath10k *ar,
  8057. ++ struct sk_buff_head *list)
  8058. + {
  8059. + struct ath10k_htt *htt = &ar->htt;
  8060. + struct ieee80211_rx_status *status = &htt->rx_status;
  8061. + struct htt_rx_offload_msdu *rx;
  8062. + struct sk_buff *msdu;
  8063. + size_t offset;
  8064. ++ int num_msdu = 0;
  8065. +
  8066. + while ((msdu = __skb_dequeue(list))) {
  8067. + /* Offloaded frames don't have Rx descriptor. Instead they have
  8068. +@@ -1819,10 +1807,12 @@ static void ath10k_htt_rx_h_rx_offload(s
  8069. + ath10k_htt_rx_h_rx_offload_prot(status, msdu);
  8070. + ath10k_htt_rx_h_channel(ar, status, NULL, rx->vdev_id);
  8071. + ath10k_process_rx(ar, status, msdu);
  8072. ++ num_msdu++;
  8073. + }
  8074. ++ return num_msdu;
  8075. + }
  8076. +
  8077. +-static void ath10k_htt_rx_in_ord_ind(struct ath10k *ar, struct sk_buff *skb)
  8078. ++static int ath10k_htt_rx_in_ord_ind(struct ath10k *ar, struct sk_buff *skb)
  8079. + {
  8080. + struct ath10k_htt *htt = &ar->htt;
  8081. + struct htt_resp *resp = (void *)skb->data;
  8082. +@@ -1835,12 +1825,12 @@ static void ath10k_htt_rx_in_ord_ind(str
  8083. + u8 tid;
  8084. + bool offload;
  8085. + bool frag;
  8086. +- int ret;
  8087. ++ int ret, num_msdus = 0;
  8088. +
  8089. + lockdep_assert_held(&htt->rx_ring.lock);
  8090. +
  8091. + if (htt->rx_confused)
  8092. +- return;
  8093. ++ return -EIO;
  8094. +
  8095. + skb_pull(skb, sizeof(resp->hdr));
  8096. + skb_pull(skb, sizeof(resp->rx_in_ord_ind));
  8097. +@@ -1859,7 +1849,7 @@ static void ath10k_htt_rx_in_ord_ind(str
  8098. +
  8099. + if (skb->len < msdu_count * sizeof(*resp->rx_in_ord_ind.msdu_descs)) {
  8100. + ath10k_warn(ar, "dropping invalid in order rx indication\n");
  8101. +- return;
  8102. ++ return -EINVAL;
  8103. + }
  8104. +
  8105. + /* The event can deliver more than 1 A-MSDU. Each A-MSDU is later
  8106. +@@ -1870,14 +1860,14 @@ static void ath10k_htt_rx_in_ord_ind(str
  8107. + if (ret < 0) {
  8108. + ath10k_warn(ar, "failed to pop paddr list: %d\n", ret);
  8109. + htt->rx_confused = true;
  8110. +- return;
  8111. ++ return -EIO;
  8112. + }
  8113. +
  8114. + /* Offloaded frames are very different and need to be handled
  8115. + * separately.
  8116. + */
  8117. + if (offload)
  8118. +- ath10k_htt_rx_h_rx_offload(ar, &list);
  8119. ++ num_msdus = ath10k_htt_rx_h_rx_offload(ar, &list);
  8120. +
  8121. + while (!skb_queue_empty(&list)) {
  8122. + __skb_queue_head_init(&amsdu);
  8123. +@@ -1890,6 +1880,7 @@ static void ath10k_htt_rx_in_ord_ind(str
  8124. + * better to report something than nothing though. This
  8125. + * should still give an idea about rx rate to the user.
  8126. + */
  8127. ++ num_msdus += skb_queue_len(&amsdu);
  8128. + ath10k_htt_rx_h_ppdu(ar, &amsdu, status, vdev_id);
  8129. + ath10k_htt_rx_h_filter(ar, &amsdu, status);
  8130. + ath10k_htt_rx_h_mpdu(ar, &amsdu, status);
  8131. +@@ -1902,9 +1893,10 @@ static void ath10k_htt_rx_in_ord_ind(str
  8132. + ath10k_warn(ar, "failed to extract amsdu: %d\n", ret);
  8133. + htt->rx_confused = true;
  8134. + __skb_queue_purge(&list);
  8135. +- return;
  8136. ++ return -EIO;
  8137. + }
  8138. + }
  8139. ++ return num_msdus;
  8140. + }
  8141. +
  8142. + static void ath10k_htt_rx_tx_fetch_resp_id_confirm(struct ath10k *ar,
  8143. +@@ -2267,7 +2259,6 @@ bool ath10k_htt_t2h_msg_handler(struct a
  8144. + }
  8145. + case HTT_T2H_MSG_TYPE_TX_COMPL_IND:
  8146. + ath10k_htt_rx_tx_compl_ind(htt->ar, skb);
  8147. +- tasklet_schedule(&htt->txrx_compl_task);
  8148. + break;
  8149. + case HTT_T2H_MSG_TYPE_SEC_IND: {
  8150. + struct ath10k *ar = htt->ar;
  8151. +@@ -2284,7 +2275,7 @@ bool ath10k_htt_t2h_msg_handler(struct a
  8152. + case HTT_T2H_MSG_TYPE_RX_FRAG_IND: {
  8153. + ath10k_dbg_dump(ar, ATH10K_DBG_HTT_DUMP, NULL, "htt event: ",
  8154. + skb->data, skb->len);
  8155. +- ath10k_htt_rx_frag_handler(htt);
  8156. ++ atomic_inc(&htt->num_mpdus_ready);
  8157. + break;
  8158. + }
  8159. + case HTT_T2H_MSG_TYPE_TEST:
  8160. +@@ -2322,8 +2313,7 @@ bool ath10k_htt_t2h_msg_handler(struct a
  8161. + break;
  8162. + }
  8163. + case HTT_T2H_MSG_TYPE_RX_IN_ORD_PADDR_IND: {
  8164. +- skb_queue_tail(&htt->rx_in_ord_compl_q, skb);
  8165. +- tasklet_schedule(&htt->txrx_compl_task);
  8166. ++ __skb_queue_tail(&htt->rx_in_ord_compl_q, skb);
  8167. + return false;
  8168. + }
  8169. + case HTT_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND:
  8170. +@@ -2349,7 +2339,6 @@ bool ath10k_htt_t2h_msg_handler(struct a
  8171. + break;
  8172. + }
  8173. + skb_queue_tail(&htt->tx_fetch_ind_q, tx_fetch_ind);
  8174. +- tasklet_schedule(&htt->txrx_compl_task);
  8175. + break;
  8176. + }
  8177. + case HTT_T2H_MSG_TYPE_TX_FETCH_CONFIRM:
  8178. +@@ -2378,27 +2367,77 @@ void ath10k_htt_rx_pktlog_completion_han
  8179. + }
  8180. + EXPORT_SYMBOL(ath10k_htt_rx_pktlog_completion_handler);
  8181. +
  8182. +-static void ath10k_htt_txrx_compl_task(unsigned long ptr)
  8183. ++int ath10k_htt_txrx_compl_task(struct ath10k *ar, int budget)
  8184. + {
  8185. +- struct ath10k_htt *htt = (struct ath10k_htt *)ptr;
  8186. +- struct ath10k *ar = htt->ar;
  8187. ++ struct ath10k_htt *htt = &ar->htt;
  8188. + struct htt_tx_done tx_done = {};
  8189. +- struct sk_buff_head rx_ind_q;
  8190. + struct sk_buff_head tx_ind_q;
  8191. + struct sk_buff *skb;
  8192. + unsigned long flags;
  8193. +- int num_mpdus;
  8194. ++ int quota = 0, done, num_rx_msdus;
  8195. ++ bool resched_napi = false;
  8196. +
  8197. +- __skb_queue_head_init(&rx_ind_q);
  8198. + __skb_queue_head_init(&tx_ind_q);
  8199. +
  8200. +- spin_lock_irqsave(&htt->rx_in_ord_compl_q.lock, flags);
  8201. +- skb_queue_splice_init(&htt->rx_in_ord_compl_q, &rx_ind_q);
  8202. +- spin_unlock_irqrestore(&htt->rx_in_ord_compl_q.lock, flags);
  8203. ++ /* Since in-ord-ind can deliver more than 1 A-MSDU in single event,
  8204. ++ * process it first to utilize full available quota.
  8205. ++ */
  8206. ++ while (quota < budget) {
  8207. ++ if (skb_queue_empty(&htt->rx_in_ord_compl_q))
  8208. ++ break;
  8209. +
  8210. +- spin_lock_irqsave(&htt->tx_fetch_ind_q.lock, flags);
  8211. +- skb_queue_splice_init(&htt->tx_fetch_ind_q, &tx_ind_q);
  8212. +- spin_unlock_irqrestore(&htt->tx_fetch_ind_q.lock, flags);
  8213. ++ skb = __skb_dequeue(&htt->rx_in_ord_compl_q);
  8214. ++ if (!skb) {
  8215. ++ resched_napi = true;
  8216. ++ goto exit;
  8217. ++ }
  8218. ++
  8219. ++ spin_lock_bh(&htt->rx_ring.lock);
  8220. ++ num_rx_msdus = ath10k_htt_rx_in_ord_ind(ar, skb);
  8221. ++ spin_unlock_bh(&htt->rx_ring.lock);
  8222. ++ if (num_rx_msdus < 0) {
  8223. ++ resched_napi = true;
  8224. ++ goto exit;
  8225. ++ }
  8226. ++
  8227. ++ dev_kfree_skb_any(skb);
  8228. ++ if (num_rx_msdus > 0)
  8229. ++ quota += num_rx_msdus;
  8230. ++
  8231. ++ if ((quota > ATH10K_NAPI_QUOTA_LIMIT) &&
  8232. ++ !skb_queue_empty(&htt->rx_in_ord_compl_q)) {
  8233. ++ resched_napi = true;
  8234. ++ goto exit;
  8235. ++ }
  8236. ++ }
  8237. ++
  8238. ++ while (quota < budget) {
  8239. ++ /* no more data to receive */
  8240. ++ if (!atomic_read(&htt->num_mpdus_ready))
  8241. ++ break;
  8242. ++
  8243. ++ num_rx_msdus = ath10k_htt_rx_handle_amsdu(htt);
  8244. ++ if (num_rx_msdus < 0) {
  8245. ++ resched_napi = true;
  8246. ++ goto exit;
  8247. ++ }
  8248. ++
  8249. ++ quota += num_rx_msdus;
  8250. ++ atomic_dec(&htt->num_mpdus_ready);
  8251. ++ if ((quota > ATH10K_NAPI_QUOTA_LIMIT) &&
  8252. ++ atomic_read(&htt->num_mpdus_ready)) {
  8253. ++ resched_napi = true;
  8254. ++ goto exit;
  8255. ++ }
  8256. ++ }
  8257. ++
  8258. ++ /* From NAPI documentation:
  8259. ++ * The napi poll() function may also process TX completions, in which
  8260. ++ * case if it processes the entire TX ring then it should count that
  8261. ++ * work as the rest of the budget.
  8262. ++ */
  8263. ++ if ((quota < budget) && !kfifo_is_empty(&htt->txdone_fifo))
  8264. ++ quota = budget;
  8265. +
  8266. + /* kfifo_get: called only within txrx_tasklet so it's neatly serialized.
  8267. + * From kfifo_get() documentation:
  8268. +@@ -2408,27 +2447,22 @@ static void ath10k_htt_txrx_compl_task(u
  8269. + while (kfifo_get(&htt->txdone_fifo, &tx_done))
  8270. + ath10k_txrx_tx_unref(htt, &tx_done);
  8271. +
  8272. ++ spin_lock_irqsave(&htt->tx_fetch_ind_q.lock, flags);
  8273. ++ skb_queue_splice_init(&htt->tx_fetch_ind_q, &tx_ind_q);
  8274. ++ spin_unlock_irqrestore(&htt->tx_fetch_ind_q.lock, flags);
  8275. ++
  8276. + while ((skb = __skb_dequeue(&tx_ind_q))) {
  8277. + ath10k_htt_rx_tx_fetch_ind(ar, skb);
  8278. + dev_kfree_skb_any(skb);
  8279. + }
  8280. +
  8281. +- num_mpdus = atomic_read(&htt->num_mpdus_ready);
  8282. +-
  8283. +- while (num_mpdus) {
  8284. +- if (ath10k_htt_rx_handle_amsdu(htt))
  8285. +- break;
  8286. +-
  8287. +- num_mpdus--;
  8288. +- atomic_dec(&htt->num_mpdus_ready);
  8289. +- }
  8290. +-
  8291. +- while ((skb = __skb_dequeue(&rx_ind_q))) {
  8292. +- spin_lock_bh(&htt->rx_ring.lock);
  8293. +- ath10k_htt_rx_in_ord_ind(ar, skb);
  8294. +- spin_unlock_bh(&htt->rx_ring.lock);
  8295. +- dev_kfree_skb_any(skb);
  8296. +- }
  8297. +-
  8298. ++exit:
  8299. + ath10k_htt_rx_msdu_buff_replenish(htt);
  8300. ++ /* In case of rx failure or more data to read, report budget
  8301. ++ * to reschedule NAPI poll
  8302. ++ */
  8303. ++ done = resched_napi ? budget : quota;
  8304. ++
  8305. ++ return done;
  8306. + }
  8307. ++EXPORT_SYMBOL(ath10k_htt_txrx_compl_task);
  8308. +--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
  8309. ++++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
  8310. +@@ -388,8 +388,6 @@ void ath10k_htt_tx_free(struct ath10k_ht
  8311. + {
  8312. + int size;
  8313. +
  8314. +- tasklet_kill(&htt->txrx_compl_task);
  8315. +-
  8316. + idr_for_each(&htt->pending_tx, ath10k_htt_tx_clean_up_pending, htt->ar);
  8317. + idr_destroy(&htt->pending_tx);
  8318. +
  8319. +--- a/drivers/net/wireless/ath/ath10k/pci.c
  8320. ++++ b/drivers/net/wireless/ath/ath10k/pci.c
  8321. +@@ -1502,12 +1502,10 @@ void ath10k_pci_hif_send_complete_check(
  8322. + ath10k_ce_per_engine_service(ar, pipe);
  8323. + }
  8324. +
  8325. +-void ath10k_pci_kill_tasklet(struct ath10k *ar)
  8326. ++static void ath10k_pci_rx_retry_sync(struct ath10k *ar)
  8327. + {
  8328. + struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
  8329. +
  8330. +- tasklet_kill(&ar_pci->intr_tq);
  8331. +-
  8332. + del_timer_sync(&ar_pci->rx_post_retry);
  8333. + }
  8334. +
  8335. +@@ -1566,7 +1564,7 @@ void ath10k_pci_hif_get_default_pipe(str
  8336. + ul_pipe, dl_pipe);
  8337. + }
  8338. +
  8339. +-static void ath10k_pci_irq_msi_fw_mask(struct ath10k *ar)
  8340. ++void ath10k_pci_irq_msi_fw_mask(struct ath10k *ar)
  8341. + {
  8342. + u32 val;
  8343. +
  8344. +@@ -1747,7 +1745,7 @@ void ath10k_pci_ce_deinit(struct ath10k
  8345. +
  8346. + void ath10k_pci_flush(struct ath10k *ar)
  8347. + {
  8348. +- ath10k_pci_kill_tasklet(ar);
  8349. ++ ath10k_pci_rx_retry_sync(ar);
  8350. + ath10k_pci_buffer_cleanup(ar);
  8351. + }
  8352. +
  8353. +@@ -2754,35 +2752,53 @@ static irqreturn_t ath10k_pci_interrupt_
  8354. + return IRQ_NONE;
  8355. + }
  8356. +
  8357. +- if (ar_pci->oper_irq_mode == ATH10K_PCI_IRQ_LEGACY) {
  8358. +- if (!ath10k_pci_irq_pending(ar))
  8359. +- return IRQ_NONE;
  8360. +-
  8361. +- ath10k_pci_disable_and_clear_legacy_irq(ar);
  8362. +- }
  8363. ++ if ((ar_pci->oper_irq_mode == ATH10K_PCI_IRQ_LEGACY) &&
  8364. ++ !ath10k_pci_irq_pending(ar))
  8365. ++ return IRQ_NONE;
  8366. +
  8367. +- tasklet_schedule(&ar_pci->intr_tq);
  8368. ++ ath10k_pci_disable_and_clear_legacy_irq(ar);
  8369. ++ ath10k_pci_irq_msi_fw_mask(ar);
  8370. ++ napi_schedule(&ar->napi);
  8371. +
  8372. + return IRQ_HANDLED;
  8373. + }
  8374. +
  8375. +-static void ath10k_pci_tasklet(unsigned long data)
  8376. ++static int ath10k_pci_napi_poll(struct napi_struct *ctx, int budget)
  8377. + {
  8378. +- struct ath10k *ar = (struct ath10k *)data;
  8379. +- struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
  8380. ++ struct ath10k *ar = container_of(ctx, struct ath10k, napi);
  8381. ++ int done = 0;
  8382. +
  8383. + if (ath10k_pci_has_fw_crashed(ar)) {
  8384. +- ath10k_pci_irq_disable(ar);
  8385. + ath10k_pci_fw_crashed_clear(ar);
  8386. + ath10k_pci_fw_crashed_dump(ar);
  8387. +- return;
  8388. ++ napi_complete(ctx);
  8389. ++ return done;
  8390. + }
  8391. +
  8392. + ath10k_ce_per_engine_service_any(ar);
  8393. +
  8394. +- /* Re-enable legacy irq that was disabled in the irq handler */
  8395. +- if (ar_pci->oper_irq_mode == ATH10K_PCI_IRQ_LEGACY)
  8396. ++ done = ath10k_htt_txrx_compl_task(ar, budget);
  8397. ++
  8398. ++ if (done < budget) {
  8399. ++ napi_complete(ctx);
  8400. ++ /* In case of MSI, it is possible that interrupts are received
  8401. ++ * while NAPI poll is inprogress. So pending interrupts that are
  8402. ++ * received after processing all copy engine pipes by NAPI poll
  8403. ++ * will not be handled again. This is causing failure to
  8404. ++ * complete boot sequence in x86 platform. So before enabling
  8405. ++ * interrupts safer to check for pending interrupts for
  8406. ++ * immediate servicing.
  8407. ++ */
  8408. ++ if (CE_INTERRUPT_SUMMARY(ar)) {
  8409. ++ napi_reschedule(&ar->napi);
  8410. ++ goto out;
  8411. ++ }
  8412. + ath10k_pci_enable_legacy_irq(ar);
  8413. ++ ath10k_pci_irq_msi_fw_unmask(ar);
  8414. ++ }
  8415. ++
  8416. ++out:
  8417. ++ return done;
  8418. + }
  8419. +
  8420. + static int ath10k_pci_request_irq_msi(struct ath10k *ar)
  8421. +@@ -2840,11 +2856,11 @@ static void ath10k_pci_free_irq(struct a
  8422. + free_irq(ar_pci->pdev->irq, ar);
  8423. + }
  8424. +
  8425. +-void ath10k_pci_init_irq_tasklets(struct ath10k *ar)
  8426. ++void ath10k_pci_init_napi(struct ath10k *ar)
  8427. + {
  8428. +- struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
  8429. +-
  8430. +- tasklet_init(&ar_pci->intr_tq, ath10k_pci_tasklet, (unsigned long)ar);
  8431. ++ netif_napi_add(&ar->napi_dev, &ar->napi, ath10k_pci_napi_poll,
  8432. ++ ATH10K_NAPI_BUDGET);
  8433. ++ napi_enable(&ar->napi);
  8434. + }
  8435. +
  8436. + static int ath10k_pci_init_irq(struct ath10k *ar)
  8437. +@@ -2852,7 +2868,7 @@ static int ath10k_pci_init_irq(struct at
  8438. + struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
  8439. + int ret;
  8440. +
  8441. +- ath10k_pci_init_irq_tasklets(ar);
  8442. ++ ath10k_pci_init_napi(ar);
  8443. +
  8444. + if (ath10k_pci_irq_mode != ATH10K_PCI_IRQ_AUTO)
  8445. + ath10k_info(ar, "limiting irq mode to: %d\n",
  8446. +@@ -3113,7 +3129,8 @@ int ath10k_pci_setup_resource(struct ath
  8447. +
  8448. + void ath10k_pci_release_resource(struct ath10k *ar)
  8449. + {
  8450. +- ath10k_pci_kill_tasklet(ar);
  8451. ++ ath10k_pci_rx_retry_sync(ar);
  8452. ++ netif_napi_del(&ar->napi);
  8453. + ath10k_pci_ce_deinit(ar);
  8454. + ath10k_pci_free_pipes(ar);
  8455. + }
  8456. +@@ -3274,7 +3291,7 @@ static int ath10k_pci_probe(struct pci_d
  8457. +
  8458. + err_free_irq:
  8459. + ath10k_pci_free_irq(ar);
  8460. +- ath10k_pci_kill_tasklet(ar);
  8461. ++ ath10k_pci_rx_retry_sync(ar);
  8462. +
  8463. + err_deinit_irq:
  8464. + ath10k_pci_deinit_irq(ar);
  8465. +--- a/drivers/net/wireless/ath/ath10k/pci.h
  8466. ++++ b/drivers/net/wireless/ath/ath10k/pci.h
  8467. +@@ -177,8 +177,6 @@ struct ath10k_pci {
  8468. + /* Operating interrupt mode */
  8469. + enum ath10k_pci_irq_mode oper_irq_mode;
  8470. +
  8471. +- struct tasklet_struct intr_tq;
  8472. +-
  8473. + struct ath10k_pci_pipe pipe_info[CE_COUNT_MAX];
  8474. +
  8475. + /* Copy Engine used for Diagnostic Accesses */
  8476. +@@ -294,8 +292,7 @@ void ath10k_pci_free_pipes(struct ath10k
  8477. + void ath10k_pci_free_pipes(struct ath10k *ar);
  8478. + void ath10k_pci_rx_replenish_retry(unsigned long ptr);
  8479. + void ath10k_pci_ce_deinit(struct ath10k *ar);
  8480. +-void ath10k_pci_init_irq_tasklets(struct ath10k *ar);
  8481. +-void ath10k_pci_kill_tasklet(struct ath10k *ar);
  8482. ++void ath10k_pci_init_napi(struct ath10k *ar);
  8483. + int ath10k_pci_init_pipes(struct ath10k *ar);
  8484. + int ath10k_pci_init_config(struct ath10k *ar);
  8485. + void ath10k_pci_rx_post(struct ath10k *ar);
  8486. +@@ -303,6 +300,7 @@ void ath10k_pci_flush(struct ath10k *ar)
  8487. + void ath10k_pci_enable_legacy_irq(struct ath10k *ar);
  8488. + bool ath10k_pci_irq_pending(struct ath10k *ar);
  8489. + void ath10k_pci_disable_and_clear_legacy_irq(struct ath10k *ar);
  8490. ++void ath10k_pci_irq_msi_fw_mask(struct ath10k *ar);
  8491. + int ath10k_pci_wait_for_target_init(struct ath10k *ar);
  8492. + int ath10k_pci_setup_resource(struct ath10k *ar);
  8493. + void ath10k_pci_release_resource(struct ath10k *ar);
  8494. diff --git a/package/kernel/mac80211/patches/332-cfg80211-fix-faulty-variable-initialization-in-ieee8.patch b/package/kernel/mac80211/patches/332-cfg80211-fix-faulty-variable-initialization-in-ieee8.patch
  8495. deleted file mode 100644
  8496. index e414f23..0000000
  8497. --- a/package/kernel/mac80211/patches/332-cfg80211-fix-faulty-variable-initialization-in-ieee8.patch
  8498. +++ /dev/null
  8499. @@ -1,22 +0,0 @@
  8500. -From: Felix Fietkau <nbd@openwrt.org>
  8501. -Date: Mon, 8 Feb 2016 14:24:36 +0100
  8502. -Subject: [PATCH] cfg80211: fix faulty variable initialization in
  8503. - ieee80211_amsdu_to_8023s
  8504. -
  8505. -reuse_skb is set to true if the code decides to use the last segment.
  8506. -Fixes a memory leak
  8507. -
  8508. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  8509. ----
  8510. -
  8511. ---- a/net/wireless/util.c
  8512. -+++ b/net/wireless/util.c
  8513. -@@ -676,7 +676,7 @@ void ieee80211_amsdu_to_8023s(struct sk_
  8514. - u8 *payload;
  8515. - int offset = 0, remaining, err;
  8516. - struct ethhdr eth;
  8517. -- bool reuse_skb = true;
  8518. -+ bool reuse_skb = false;
  8519. - bool last = false;
  8520. -
  8521. - if (has_80211_header) {
  8522. diff --git a/package/kernel/mac80211/patches/333-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
  8523. deleted file mode 100644
  8524. index 6e2d0cf..0000000
  8525. --- a/package/kernel/mac80211/patches/333-cfg80211-reuse-existing-page-fragments-in-A-MSDU-rx.patch
  8526. +++ /dev/null
  8527. @@ -1,132 +0,0 @@
  8528. -From: Felix Fietkau <nbd@openwrt.org>
  8529. -Date: Mon, 8 Feb 2016 14:33:19 +0100
  8530. -Subject: [PATCH] cfg80211: reuse existing page fragments in A-MSDU rx
  8531. -
  8532. -This massively reduces data copying and thus improves rx performance
  8533. -
  8534. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  8535. ----
  8536. -
  8537. ---- a/net/wireless/util.c
  8538. -+++ b/net/wireless/util.c
  8539. -@@ -644,23 +644,93 @@ int ieee80211_data_from_8023(struct sk_b
  8540. - }
  8541. - EXPORT_SYMBOL(ieee80211_data_from_8023);
  8542. -
  8543. -+static void
  8544. -+__frame_add_frag(struct sk_buff *skb, struct page *page,
  8545. -+ void *ptr, int len, int size)
  8546. -+{
  8547. -+ struct skb_shared_info *sh = skb_shinfo(skb);
  8548. -+ int page_offset;
  8549. -+
  8550. -+ atomic_inc(&page->_count);
  8551. -+ page_offset = ptr - page_address(page);
  8552. -+ skb_add_rx_frag(skb, sh->nr_frags, page, page_offset, len, size);
  8553. -+}
  8554. -+
  8555. -+static void
  8556. -+__ieee80211_amsdu_copy_frag(struct sk_buff *skb, struct sk_buff *frame,
  8557. -+ int offset, int len)
  8558. -+{
  8559. -+ struct skb_shared_info *sh = skb_shinfo(skb);
  8560. -+ const skb_frag_t *frag = &sh->frags[-1];
  8561. -+ struct page *frag_page;
  8562. -+ void *frag_ptr;
  8563. -+ int frag_len, frag_size;
  8564. -+ int head_size = skb->len - skb->data_len;
  8565. -+ int cur_len;
  8566. -+
  8567. -+ frag_page = virt_to_head_page(skb->head);
  8568. -+ frag_ptr = skb->data;
  8569. -+ frag_size = head_size;
  8570. -+
  8571. -+ while (offset >= frag_size) {
  8572. -+ offset -= frag_size;
  8573. -+ frag++;
  8574. -+ frag_page = skb_frag_page(frag);
  8575. -+ frag_ptr = skb_frag_address(frag);
  8576. -+ frag_size = skb_frag_size(frag);
  8577. -+ }
  8578. -+
  8579. -+ frag_ptr += offset;
  8580. -+ frag_len = frag_size - offset;
  8581. -+
  8582. -+ cur_len = min(len, frag_len);
  8583. -+
  8584. -+ __frame_add_frag(frame, frag_page, frag_ptr, cur_len, frag_size);
  8585. -+ len -= cur_len;
  8586. -+
  8587. -+ while (len > 0) {
  8588. -+ frag++;
  8589. -+ frag_len = skb_frag_size(frag);
  8590. -+ cur_len = min(len, frag_len);
  8591. -+ __frame_add_frag(frame, skb_frag_page(frag),
  8592. -+ skb_frag_address(frag), cur_len, frag_len);
  8593. -+ len -= cur_len;
  8594. -+ }
  8595. -+}
  8596. -+
  8597. - static struct sk_buff *
  8598. - __ieee80211_amsdu_copy(struct sk_buff *skb, unsigned int hlen,
  8599. -- int offset, int len)
  8600. -+ int offset, int len, bool reuse_frag)
  8601. - {
  8602. - struct sk_buff *frame;
  8603. -+ int cur_len = len;
  8604. -
  8605. - if (skb->len - offset < len)
  8606. - return NULL;
  8607. -
  8608. - /*
  8609. -+ * When reusing framents, copy some data to the head to simplify
  8610. -+ * ethernet header handling and speed up protocol header processing
  8611. -+ * in the stack later.
  8612. -+ */
  8613. -+ if (reuse_frag)
  8614. -+ cur_len = min_t(int, len, 32);
  8615. -+
  8616. -+ /*
  8617. - * Allocate and reserve two bytes more for payload
  8618. - * alignment since sizeof(struct ethhdr) is 14.
  8619. - */
  8620. -- frame = dev_alloc_skb(hlen + sizeof(struct ethhdr) + 2 + len);
  8621. -+ frame = dev_alloc_skb(hlen + sizeof(struct ethhdr) + 2 + cur_len);
  8622. -
  8623. - skb_reserve(frame, hlen + sizeof(struct ethhdr) + 2);
  8624. -- skb_copy_bits(skb, offset, skb_put(frame, len), len);
  8625. -+ skb_copy_bits(skb, offset, skb_put(frame, cur_len), cur_len);
  8626. -+
  8627. -+ len -= cur_len;
  8628. -+ if (!len)
  8629. -+ return frame;
  8630. -+
  8631. -+ offset += cur_len;
  8632. -+ __ieee80211_amsdu_copy_frag(skb, frame, offset, len);
  8633. -
  8634. - return frame;
  8635. - }
  8636. -@@ -676,6 +746,7 @@ void ieee80211_amsdu_to_8023s(struct sk_
  8637. - u8 *payload;
  8638. - int offset = 0, remaining, err;
  8639. - struct ethhdr eth;
  8640. -+ bool reuse_frag = skb->head_frag && !skb_has_frag_list(skb);
  8641. - bool reuse_skb = false;
  8642. - bool last = false;
  8643. -
  8644. -@@ -703,12 +774,13 @@ void ieee80211_amsdu_to_8023s(struct sk_
  8645. - offset += sizeof(struct ethhdr);
  8646. - /* reuse skb for the last subframe */
  8647. - last = remaining <= subframe_len + padding;
  8648. -- if (!skb_is_nonlinear(skb) && last) {
  8649. -+ if (!skb_is_nonlinear(skb) && !reuse_frag && last) {
  8650. - skb_pull(skb, offset);
  8651. - frame = skb;
  8652. - reuse_skb = true;
  8653. - } else {
  8654. -- frame = __ieee80211_amsdu_copy(skb, hlen, offset, len);
  8655. -+ frame = __ieee80211_amsdu_copy(skb, hlen, offset, len,
  8656. -+ reuse_frag);
  8657. - if (!frame)
  8658. - goto purge;
  8659. -
  8660. 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
  8661. deleted file mode 100644
  8662. index f8f4f09..0000000
  8663. --- a/package/kernel/mac80211/patches/334-mac80211-fix-wiphy-supported_band-access.patch
  8664. +++ /dev/null
  8665. @@ -1,36 +0,0 @@
  8666. -From: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  8667. -Date: Wed, 10 Feb 2016 16:08:17 +0100
  8668. -Subject: [PATCH] mac80211: fix wiphy supported_band access
  8669. -
  8670. -Fix wiphy supported_band access in tx radiotap parsing. In particular,
  8671. -info->band is always set to 0 (IEEE80211_BAND_2GHZ) since it has not
  8672. -assigned yet. This cause a kernel crash on 5GHz only devices.
  8673. -Move ieee80211_parse_tx_radiotap() after info->band assignment
  8674. -
  8675. -Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  8676. ----
  8677. -
  8678. ---- a/net/mac80211/tx.c
  8679. -+++ b/net/mac80211/tx.c
  8680. -@@ -1890,10 +1890,6 @@ netdev_tx_t ieee80211_monitor_start_xmit
  8681. - info->flags = IEEE80211_TX_CTL_REQ_TX_STATUS |
  8682. - IEEE80211_TX_CTL_INJECTED;
  8683. -
  8684. -- /* process and remove the injection radiotap header */
  8685. -- if (!ieee80211_parse_tx_radiotap(local, skb))
  8686. -- goto fail;
  8687. --
  8688. - rcu_read_lock();
  8689. -
  8690. - /*
  8691. -@@ -1955,6 +1951,10 @@ netdev_tx_t ieee80211_monitor_start_xmit
  8692. - goto fail_rcu;
  8693. -
  8694. - info->band = chandef->chan->band;
  8695. -+ /* process and remove the injection radiotap header */
  8696. -+ if (!ieee80211_parse_tx_radiotap(local, skb))
  8697. -+ goto fail_rcu;
  8698. -+
  8699. - ieee80211_xmit(sdata, NULL, skb);
  8700. - rcu_read_unlock();
  8701. -
  8702. 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
  8703. deleted file mode 100644
  8704. index acaacf7..0000000
  8705. --- a/package/kernel/mac80211/patches/335-mac80211-minstrel_ht-set-A-MSDU-tx-limits-based-on-s.patch
  8706. +++ /dev/null
  8707. @@ -1,61 +0,0 @@
  8708. -From: Felix Fietkau <nbd@openwrt.org>
  8709. -Date: Thu, 18 Feb 2016 19:30:05 +0100
  8710. -Subject: [PATCH] mac80211: minstrel_ht: set A-MSDU tx limits based on selected
  8711. - max_prob_rate
  8712. -
  8713. -Prevents excessive A-MSDU aggregation at low data rates or bad
  8714. -conditions.
  8715. -
  8716. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  8717. ----
  8718. -
  8719. ---- a/net/mac80211/rc80211_minstrel_ht.c
  8720. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  8721. -@@ -883,6 +883,39 @@ minstrel_ht_set_rate(struct minstrel_pri
  8722. - ratetbl->rate[offset].flags = flags;
  8723. - }
  8724. -
  8725. -+static int
  8726. -+minstrel_ht_get_max_amsdu_len(struct minstrel_ht_sta *mi)
  8727. -+{
  8728. -+ int group = mi->max_prob_rate / MCS_GROUP_RATES;
  8729. -+ const struct mcs_group *g = &minstrel_mcs_groups[group];
  8730. -+ int rate = mi->max_prob_rate % MCS_GROUP_RATES;
  8731. -+
  8732. -+ /* Disable A-MSDU if max_prob_rate is bad */
  8733. -+ if (mi->groups[group].rates[rate].prob_ewma < MINSTREL_FRAC(50, 100))
  8734. -+ return 1;
  8735. -+
  8736. -+ /* If the rate is slower than single-stream MCS1, make A-MSDU limit small */
  8737. -+ if (g->duration[rate] > MCS_DURATION(1, 0, 52))
  8738. -+ return 500;
  8739. -+
  8740. -+ /*
  8741. -+ * If the rate is slower than single-stream MCS4, limit A-MSDU to usual
  8742. -+ * data packet size
  8743. -+ */
  8744. -+ if (g->duration[rate] > MCS_DURATION(1, 0, 104))
  8745. -+ return 1500;
  8746. -+
  8747. -+ /*
  8748. -+ * If the rate is slower than single-stream MCS7, limit A-MSDU to twice
  8749. -+ * the usual data packet size
  8750. -+ */
  8751. -+ if (g->duration[rate] > MCS_DURATION(1, 0, 260))
  8752. -+ return 3000;
  8753. -+
  8754. -+ /* unlimited */
  8755. -+ return 0;
  8756. -+}
  8757. -+
  8758. - static void
  8759. - minstrel_ht_update_rates(struct minstrel_priv *mp, struct minstrel_ht_sta *mi)
  8760. - {
  8761. -@@ -907,6 +940,7 @@ minstrel_ht_update_rates(struct minstrel
  8762. - minstrel_ht_set_rate(mp, mi, rates, i++, mi->max_prob_rate);
  8763. - }
  8764. -
  8765. -+ mi->sta->max_rc_amsdu_len = minstrel_ht_get_max_amsdu_len(mi);
  8766. - rates->rate[i].idx = -1;
  8767. - rate_control_set_rates(mp->hw, mi->sta, rates);
  8768. - }
  8769. 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
  8770. deleted file mode 100644
  8771. index 32a2ad6..0000000
  8772. --- a/package/kernel/mac80211/patches/336-mac80211-minstrel_ht-set-default-tx-aggregation-time.patch
  8773. +++ /dev/null
  8774. @@ -1,31 +0,0 @@
  8775. -From: Felix Fietkau <nbd@openwrt.org>
  8776. -Date: Thu, 18 Feb 2016 19:45:33 +0100
  8777. -Subject: [PATCH] mac80211: minstrel_ht: set default tx aggregation timeout to
  8778. - 0
  8779. -
  8780. -The value 5000 was put here with the addition of the timeout field to
  8781. -ieee80211_start_tx_ba_session. It was originally added in mac80211 to
  8782. -save resources for drivers like iwlwifi, which only supports a limited
  8783. -number of concurrent aggregation sessions.
  8784. -
  8785. -Since iwlwifi does not use minstrel_ht and other drivers don't need
  8786. -this, 0 is a better default - especially since there have been
  8787. -recent reports of aggregation setup related issues reproduced with
  8788. -ath9k. This should improve stability without causing any adverse
  8789. -effects.
  8790. -
  8791. -Cc: stable@vger.kernel.org
  8792. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  8793. ----
  8794. -
  8795. ---- a/net/mac80211/rc80211_minstrel_ht.c
  8796. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  8797. -@@ -692,7 +692,7 @@ minstrel_aggr_check(struct ieee80211_sta
  8798. - if (likely(sta->ampdu_mlme.tid_tx[tid]))
  8799. - return;
  8800. -
  8801. -- ieee80211_start_tx_ba_session(pubsta, tid, 5000);
  8802. -+ ieee80211_start_tx_ba_session(pubsta, tid, 0);
  8803. - }
  8804. -
  8805. - static void
  8806. 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
  8807. deleted file mode 100644
  8808. index 229351b..0000000
  8809. --- a/package/kernel/mac80211/patches/337-mac80211-minstrel_ht-fix-a-logic-error-in-RTS-CTS-ha.patch
  8810. +++ /dev/null
  8811. @@ -1,26 +0,0 @@
  8812. -From: Felix Fietkau <nbd@openwrt.org>
  8813. -Date: Wed, 24 Feb 2016 12:03:13 +0100
  8814. -Subject: [PATCH] mac80211: minstrel_ht: fix a logic error in RTS/CTS handling
  8815. -MIME-Version: 1.0
  8816. -Content-Type: text/plain; charset=UTF-8
  8817. -Content-Transfer-Encoding: 8bit
  8818. -
  8819. -RTS/CTS needs to be enabled if the rate is a fallback rate *or* if it's
  8820. -a dual-stream rate and the sta is in dynamic SMPS mode.
  8821. -
  8822. -Fixes: a3ebb4e1b763 ("mac80211: minstrel_ht: handle peers in dynamic SMPS")
  8823. -Reported-by: Matías Richart <mrichart@fing.edu.uy>
  8824. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  8825. ----
  8826. -
  8827. ---- a/net/mac80211/rc80211_minstrel_ht.c
  8828. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  8829. -@@ -872,7 +872,7 @@ minstrel_ht_set_rate(struct minstrel_pri
  8830. - * - if station is in dynamic SMPS (and streams > 1)
  8831. - * - for fallback rates, to increase chances of getting through
  8832. - */
  8833. -- if (offset > 0 &&
  8834. -+ if (offset > 0 ||
  8835. - (mi->sta->smps_mode == IEEE80211_SMPS_DYNAMIC &&
  8836. - group->streams > 1)) {
  8837. - ratetbl->rate[offset].count = ratetbl->rate[offset].count_rts;
  8838. 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
  8839. deleted file mode 100644
  8840. index 56cd94a..0000000
  8841. --- a/package/kernel/mac80211/patches/338-mac80211-Fix-Public-Action-frame-RX-in-AP-mode.patch
  8842. +++ /dev/null
  8843. @@ -1,35 +0,0 @@
  8844. -From: Jouni Malinen <jouni@qca.qualcomm.com>
  8845. -Date: Tue, 1 Mar 2016 00:29:00 +0200
  8846. -Subject: [PATCH] mac80211: Fix Public Action frame RX in AP mode
  8847. -
  8848. -Public Action frames use special rules for how the BSSID field (Address
  8849. -3) is set. A wildcard BSSID is used in cases where the transmitter and
  8850. -recipient are not members of the same BSS. As such, we need to accept
  8851. -Public Action frames with wildcard BSSID.
  8852. -
  8853. -Commit db8e17324553 ("mac80211: ignore frames between TDLS peers when
  8854. -operating as AP") added a rule that drops Action frames to TDLS-peers
  8855. -based on an Action frame having different DA (Address 1) and BSSID
  8856. -(Address 3) values. This is not correct since it misses the possibility
  8857. -of BSSID being a wildcard BSSID in which case the Address 1 would not
  8858. -necessarily match.
  8859. -
  8860. -Fix this by allowing mac80211 to accept wildcard BSSID in an Action
  8861. -frame when in AP mode.
  8862. -
  8863. -Fixes: db8e17324553 ("mac80211: ignore frames between TDLS peers when operating as AP")
  8864. -Cc: stable@vger.kernel.org
  8865. -Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
  8866. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  8867. ----
  8868. -
  8869. ---- a/net/mac80211/rx.c
  8870. -+++ b/net/mac80211/rx.c
  8871. -@@ -3374,6 +3374,7 @@ static bool ieee80211_accept_frame(struc
  8872. - return false;
  8873. - /* ignore action frames to TDLS-peers */
  8874. - if (ieee80211_is_action(hdr->frame_control) &&
  8875. -+ !is_broadcast_ether_addr(bssid) &&
  8876. - !ether_addr_equal(bssid, hdr->addr1))
  8877. - return false;
  8878. - }
  8879. 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
  8880. deleted file mode 100644
  8881. index 15d6cd0..0000000
  8882. --- a/package/kernel/mac80211/patches/339-cfg80211-add-radiotap-VHT-info-to-rtap_namespace_siz.patch
  8883. +++ /dev/null
  8884. @@ -1,21 +0,0 @@
  8885. -From: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  8886. -Date: Fri, 19 Feb 2016 11:43:04 +0100
  8887. -Subject: [PATCH] cfg80211: add radiotap VHT info to rtap_namespace_sizes
  8888. -
  8889. -Add IEEE80211_RADIOTAP_VHT entry to rtap_namespace_sizes array in order to
  8890. -define alignment and size of VHT info in tx radiotap
  8891. -
  8892. -Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  8893. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  8894. ----
  8895. -
  8896. ---- a/net/wireless/radiotap.c
  8897. -+++ b/net/wireless/radiotap.c
  8898. -@@ -43,6 +43,7 @@ static const struct radiotap_align_size
  8899. - [IEEE80211_RADIOTAP_DATA_RETRIES] = { .align = 1, .size = 1, },
  8900. - [IEEE80211_RADIOTAP_MCS] = { .align = 1, .size = 3, },
  8901. - [IEEE80211_RADIOTAP_AMPDU_STATUS] = { .align = 4, .size = 8, },
  8902. -+ [IEEE80211_RADIOTAP_VHT] = { .align = 2, .size = 12, },
  8903. - /*
  8904. - * add more here as they are defined in radiotap.h
  8905. - */
  8906. 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
  8907. deleted file mode 100644
  8908. index de1b386..0000000
  8909. --- a/package/kernel/mac80211/patches/340-mac80211-fix-parsing-of-40Mhz-in-injected-radiotap-h.patch
  8910. +++ /dev/null
  8911. @@ -1,36 +0,0 @@
  8912. -From: Sven Eckelmann <sven@narfation.org>
  8913. -Date: Wed, 24 Feb 2016 16:25:49 +0100
  8914. -Subject: [PATCH] mac80211: fix parsing of 40Mhz in injected radiotap
  8915. - header
  8916. -
  8917. -The MCS bandwidth part of the radiotap header is 2 bits wide. The full 2
  8918. -bit have to compared against IEEE80211_RADIOTAP_MCS_BW_40 and not only if
  8919. -the first bit is set. Otherwise IEEE80211_RADIOTAP_MCS_BW_40 can be
  8920. -confused with IEEE80211_RADIOTAP_MCS_BW_20U.
  8921. -
  8922. -Fixes: 5ec3aed9ba4c ("mac80211: Parse legacy and HT rate in injected frames")
  8923. -Signed-off-by: Sven Eckelmann <sven@narfation.org>
  8924. ----
  8925. -
  8926. ---- a/net/mac80211/tx.c
  8927. -+++ b/net/mac80211/tx.c
  8928. -@@ -1689,7 +1689,7 @@ static bool ieee80211_parse_tx_radiotap(
  8929. - bool rate_found = false;
  8930. - u8 rate_retries = 0;
  8931. - u16 rate_flags = 0;
  8932. -- u8 mcs_known, mcs_flags;
  8933. -+ u8 mcs_known, mcs_flags, mcs_bw;
  8934. - int i;
  8935. -
  8936. - info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT |
  8937. -@@ -1765,8 +1765,9 @@ static bool ieee80211_parse_tx_radiotap(
  8938. - mcs_flags & IEEE80211_RADIOTAP_MCS_SGI)
  8939. - rate_flags |= IEEE80211_TX_RC_SHORT_GI;
  8940. -
  8941. -+ mcs_bw = mcs_flags & IEEE80211_RADIOTAP_MCS_BW_MASK;
  8942. - if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_BW &&
  8943. -- mcs_flags & IEEE80211_RADIOTAP_MCS_BW_40)
  8944. -+ mcs_bw == IEEE80211_RADIOTAP_MCS_BW_40)
  8945. - rate_flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
  8946. - break;
  8947. -
  8948. 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
  8949. deleted file mode 100644
  8950. index ac1f251..0000000
  8951. --- a/package/kernel/mac80211/patches/341-mac80211-parse-VHT-info-in-injected-frames.patch
  8952. +++ /dev/null
  8953. @@ -1,65 +0,0 @@
  8954. -From: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  8955. -Date: Tue, 23 Feb 2016 15:43:35 +0100
  8956. -Subject: [PATCH] mac80211: parse VHT info in injected frames
  8957. -
  8958. -Add VHT radiotap parsing support to ieee80211_parse_tx_radiotap().
  8959. -That capability has been tested using a d-link dir-860l rev b1 running
  8960. -OpenWrt trunk and mt76 driver
  8961. -
  8962. -Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  8963. ----
  8964. -
  8965. ---- a/net/mac80211/tx.c
  8966. -+++ b/net/mac80211/tx.c
  8967. -@@ -1690,6 +1690,8 @@ static bool ieee80211_parse_tx_radiotap(
  8968. - u8 rate_retries = 0;
  8969. - u16 rate_flags = 0;
  8970. - u8 mcs_known, mcs_flags, mcs_bw;
  8971. -+ u16 vht_known;
  8972. -+ u8 vht_mcs = 0, vht_nss = 0;
  8973. - int i;
  8974. -
  8975. - info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT |
  8976. -@@ -1771,6 +1773,32 @@ static bool ieee80211_parse_tx_radiotap(
  8977. - rate_flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
  8978. - break;
  8979. -
  8980. -+ case IEEE80211_RADIOTAP_VHT:
  8981. -+ vht_known = get_unaligned_le16(iterator.this_arg);
  8982. -+ rate_found = true;
  8983. -+
  8984. -+ rate_flags = IEEE80211_TX_RC_VHT_MCS;
  8985. -+ if ((vht_known & IEEE80211_RADIOTAP_VHT_KNOWN_GI) &&
  8986. -+ (iterator.this_arg[2] &
  8987. -+ IEEE80211_RADIOTAP_VHT_FLAG_SGI))
  8988. -+ rate_flags |= IEEE80211_TX_RC_SHORT_GI;
  8989. -+ if (vht_known &
  8990. -+ IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH) {
  8991. -+ if (iterator.this_arg[3] == 1)
  8992. -+ rate_flags |=
  8993. -+ IEEE80211_TX_RC_40_MHZ_WIDTH;
  8994. -+ else if (iterator.this_arg[3] == 4)
  8995. -+ rate_flags |=
  8996. -+ IEEE80211_TX_RC_80_MHZ_WIDTH;
  8997. -+ else if (iterator.this_arg[3] == 11)
  8998. -+ rate_flags |=
  8999. -+ IEEE80211_TX_RC_160_MHZ_WIDTH;
  9000. -+ }
  9001. -+
  9002. -+ vht_mcs = iterator.this_arg[4] >> 4;
  9003. -+ vht_nss = iterator.this_arg[4] & 0xF;
  9004. -+ break;
  9005. -+
  9006. - /*
  9007. - * Please update the file
  9008. - * Documentation/networking/mac80211-injection.txt
  9009. -@@ -1796,6 +1824,9 @@ static bool ieee80211_parse_tx_radiotap(
  9010. -
  9011. - if (rate_flags & IEEE80211_TX_RC_MCS) {
  9012. - info->control.rates[0].idx = rate;
  9013. -+ } else if (rate_flags & IEEE80211_TX_RC_VHT_MCS) {
  9014. -+ ieee80211_rate_set_vht(info->control.rates, vht_mcs,
  9015. -+ vht_nss);
  9016. - } else {
  9017. - for (i = 0; i < sband->n_bitrates; i++) {
  9018. - if (rate * 5 != sband->bitrates[i].bitrate)
  9019. 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
  9020. deleted file mode 100644
  9021. index d7452c2..0000000
  9022. --- a/package/kernel/mac80211/patches/342-mac80211-do-not-pass-injected-frames-without-a-valid.patch
  9023. +++ /dev/null
  9024. @@ -1,23 +0,0 @@
  9025. -From: Felix Fietkau <nbd@openwrt.org>
  9026. -Date: Wed, 2 Mar 2016 15:51:40 +0100
  9027. -Subject: [PATCH] mac80211: do not pass injected frames without a valid rate to
  9028. - the driver
  9029. -
  9030. -Fall back to rate control if the requested bitrate was not found.
  9031. -
  9032. -Fixes: dfdfc2beb0dd ("mac80211: Parse legacy and HT rate in injected frames")
  9033. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  9034. ----
  9035. -
  9036. ---- a/net/mac80211/tx.c
  9037. -+++ b/net/mac80211/tx.c
  9038. -@@ -1837,6 +1837,9 @@ static bool ieee80211_parse_tx_radiotap(
  9039. - }
  9040. - }
  9041. -
  9042. -+ if (info->control.rates[0].idx < 0)
  9043. -+ info->control.flags &= ~IEEE80211_TX_CTRL_RATE_INJECT;
  9044. -+
  9045. - info->control.rates[0].flags = rate_flags;
  9046. - info->control.rates[0].count = min_t(u8, rate_retries + 1,
  9047. - local->hw.max_rate_tries);
  9048. 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
  9049. deleted file mode 100644
  9050. index 55ff817..0000000
  9051. --- a/package/kernel/mac80211/patches/343-mac80211-minstrel_ht-improve-sample-rate-skip-logic.patch
  9052. +++ /dev/null
  9053. @@ -1,77 +0,0 @@
  9054. -From: Felix Fietkau <nbd@openwrt.org>
  9055. -Date: Thu, 3 Mar 2016 23:20:06 +0100
  9056. -Subject: [PATCH] mac80211: minstrel_ht: improve sample rate skip logic
  9057. -
  9058. -There were a few issues that were slowing down the process of finding
  9059. -the optimal rate, especially on devices with multi-rate retry
  9060. -limitations:
  9061. -
  9062. -When max_tp_rate[0] was slower than max_tp_rate[1], the code did not
  9063. -sample max_tp_rate[1], which would often allow it to switch places with
  9064. -max_tp_rate[0] (e.g. if only the first sampling attempts were bad, but the
  9065. -rate is otherwise good).
  9066. -
  9067. -Also, sample attempts of rates between max_tp_rate[0] and [1] were being
  9068. -ignored in this case, because the code only checked if the rate was
  9069. -slower than [1].
  9070. -
  9071. -Fix this by checking against the fastest / second fastest max_tp_rate
  9072. -instead of assuming a specific order between the two.
  9073. -
  9074. -In my tests this patch significantly reduces the time until minstrel_ht
  9075. -finds the optimal rate right after assoc
  9076. -
  9077. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  9078. ----
  9079. -
  9080. ---- a/net/mac80211/rc80211_minstrel_ht.c
  9081. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  9082. -@@ -958,6 +958,7 @@ minstrel_get_sample_rate(struct minstrel
  9083. - struct minstrel_rate_stats *mrs;
  9084. - struct minstrel_mcs_group_data *mg;
  9085. - unsigned int sample_dur, sample_group, cur_max_tp_streams;
  9086. -+ int tp_rate1, tp_rate2;
  9087. - int sample_idx = 0;
  9088. -
  9089. - if (mi->sample_wait > 0) {
  9090. -@@ -979,14 +980,22 @@ minstrel_get_sample_rate(struct minstrel
  9091. - mrs = &mg->rates[sample_idx];
  9092. - sample_idx += sample_group * MCS_GROUP_RATES;
  9093. -
  9094. -+ /* Set tp_rate1, tp_rate2 to the highest / second highest max_tp_rate */
  9095. -+ if (minstrel_get_duration(mi->max_tp_rate[0]) >
  9096. -+ minstrel_get_duration(mi->max_tp_rate[1])) {
  9097. -+ tp_rate1 = mi->max_tp_rate[1];
  9098. -+ tp_rate2 = mi->max_tp_rate[0];
  9099. -+ } else {
  9100. -+ tp_rate1 = mi->max_tp_rate[0];
  9101. -+ tp_rate2 = mi->max_tp_rate[1];
  9102. -+ }
  9103. -+
  9104. - /*
  9105. - * Sampling might add some overhead (RTS, no aggregation)
  9106. -- * to the frame. Hence, don't use sampling for the currently
  9107. -- * used rates.
  9108. -+ * to the frame. Hence, don't use sampling for the highest currently
  9109. -+ * used highest throughput or probability rate.
  9110. - */
  9111. -- if (sample_idx == mi->max_tp_rate[0] ||
  9112. -- sample_idx == mi->max_tp_rate[1] ||
  9113. -- sample_idx == mi->max_prob_rate)
  9114. -+ if (sample_idx == mi->max_tp_rate[0] || sample_idx == mi->max_prob_rate)
  9115. - return -1;
  9116. -
  9117. - /*
  9118. -@@ -1001,10 +1010,10 @@ minstrel_get_sample_rate(struct minstrel
  9119. - * if the link is working perfectly.
  9120. - */
  9121. -
  9122. -- cur_max_tp_streams = minstrel_mcs_groups[mi->max_tp_rate[0] /
  9123. -+ cur_max_tp_streams = minstrel_mcs_groups[tp_rate1 /
  9124. - MCS_GROUP_RATES].streams;
  9125. - sample_dur = minstrel_get_duration(sample_idx);
  9126. -- if (sample_dur >= minstrel_get_duration(mi->max_tp_rate[1]) &&
  9127. -+ if (sample_dur >= minstrel_get_duration(tp_rate2) &&
  9128. - (cur_max_tp_streams - 1 <
  9129. - minstrel_mcs_groups[sample_group].streams ||
  9130. - sample_dur >= minstrel_get_duration(mi->max_prob_rate))) {
  9131. 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
  9132. deleted file mode 100644
  9133. index 3de0f64..0000000
  9134. --- a/package/kernel/mac80211/patches/344-0008-brcmfmac-use-device-memsize-config-from-fw-if-define.patch
  9135. +++ /dev/null
  9136. @@ -1,73 +0,0 @@
  9137. -From: Hante Meuleman <meuleman@broadcom.com>
  9138. -Date: Wed, 17 Feb 2016 11:26:57 +0100
  9139. -Subject: [PATCH] brcmfmac: use device memsize config from fw if defined
  9140. -
  9141. -Newer type pcie devices have memory which get shared between fw and
  9142. -hw. The division of this memory is done firmware compile time. As a
  9143. -result the ramsize as used by driver needs to be adjusted for this.
  9144. -This is done by reading the memory size from the firmware.
  9145. -
  9146. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  9147. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  9148. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  9149. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  9150. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  9151. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9152. ----
  9153. -
  9154. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  9155. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  9156. -@@ -207,6 +207,10 @@ static struct brcmf_firmware_mapping brc
  9157. - #define BRCMF_PCIE_CFGREG_REG_BAR3_CONFIG 0x4F4
  9158. - #define BRCMF_PCIE_LINK_STATUS_CTRL_ASPM_ENAB 3
  9159. -
  9160. -+/* Magic number at a magic location to find RAM size */
  9161. -+#define BRCMF_RAMSIZE_MAGIC 0x534d4152 /* SMAR */
  9162. -+#define BRCMF_RAMSIZE_OFFSET 0x6c
  9163. -+
  9164. -
  9165. - struct brcmf_pcie_console {
  9166. - u32 base_addr;
  9167. -@@ -1412,6 +1416,28 @@ static const struct brcmf_bus_ops brcmf_
  9168. - };
  9169. -
  9170. -
  9171. -+static void
  9172. -+brcmf_pcie_adjust_ramsize(struct brcmf_pciedev_info *devinfo, u8 *data,
  9173. -+ u32 data_len)
  9174. -+{
  9175. -+ __le32 *field;
  9176. -+ u32 newsize;
  9177. -+
  9178. -+ if (data_len < BRCMF_RAMSIZE_OFFSET + 8)
  9179. -+ return;
  9180. -+
  9181. -+ field = (__le32 *)&data[BRCMF_RAMSIZE_OFFSET];
  9182. -+ if (le32_to_cpup(field) != BRCMF_RAMSIZE_MAGIC)
  9183. -+ return;
  9184. -+ field++;
  9185. -+ newsize = le32_to_cpup(field);
  9186. -+
  9187. -+ brcmf_dbg(PCIE, "Found ramsize info in FW, adjusting to 0x%x\n",
  9188. -+ newsize);
  9189. -+ devinfo->ci->ramsize = newsize;
  9190. -+}
  9191. -+
  9192. -+
  9193. - static int
  9194. - brcmf_pcie_init_share_ram_info(struct brcmf_pciedev_info *devinfo,
  9195. - u32 sharedram_addr)
  9196. -@@ -1694,6 +1720,13 @@ static void brcmf_pcie_setup(struct devi
  9197. -
  9198. - brcmf_pcie_attach(devinfo);
  9199. -
  9200. -+ /* Some of the firmwares have the size of the memory of the device
  9201. -+ * defined inside the firmware. This is because part of the memory in
  9202. -+ * the device is shared and the devision is determined by FW. Parse
  9203. -+ * the firmware and adjust the chip memory size now.
  9204. -+ */
  9205. -+ brcmf_pcie_adjust_ramsize(devinfo, (u8 *)fw->data, fw->size);
  9206. -+
  9207. - ret = brcmf_pcie_download_fw_nvram(devinfo, fw, nvram, nvram_len);
  9208. - if (ret)
  9209. - goto fail;
  9210. 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
  9211. deleted file mode 100644
  9212. index ca03ffe..0000000
  9213. --- a/package/kernel/mac80211/patches/344-0009-brcmfmac-use-bar1-window-size-as-provided-by-pci-sub.patch
  9214. +++ /dev/null
  9215. @@ -1,58 +0,0 @@
  9216. -From: Hante Meuleman <meuleman@broadcom.com>
  9217. -Date: Wed, 17 Feb 2016 11:26:58 +0100
  9218. -Subject: [PATCH] brcmfmac: use bar1 window size as provided by pci subsystem
  9219. -
  9220. -The PCIE bar1 window size is specified by chip. Currently the
  9221. -ioremap of bar1 was using a define which always matched the size
  9222. -of bar1, but newer chips can have a different bar1 sizes. With
  9223. -this patch the ioremap will be called with the by chip provided
  9224. -window size.
  9225. -
  9226. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  9227. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  9228. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  9229. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  9230. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  9231. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9232. ----
  9233. -
  9234. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  9235. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  9236. -@@ -72,7 +72,6 @@ static struct brcmf_firmware_mapping brc
  9237. -
  9238. - #define BRCMF_PCIE_FW_UP_TIMEOUT 2000 /* msec */
  9239. -
  9240. --#define BRCMF_PCIE_TCM_MAP_SIZE (4096 * 1024)
  9241. - #define BRCMF_PCIE_REG_MAP_SIZE (32 * 1024)
  9242. -
  9243. - /* backplane addres space accessed by BAR0 */
  9244. -@@ -252,7 +251,6 @@ struct brcmf_pciedev_info {
  9245. - char nvram_name[BRCMF_FW_NAME_LEN];
  9246. - void __iomem *regs;
  9247. - void __iomem *tcm;
  9248. -- u32 tcm_size;
  9249. - u32 ram_base;
  9250. - u32 ram_size;
  9251. - struct brcmf_chip *ci;
  9252. -@@ -1592,8 +1590,7 @@ static int brcmf_pcie_get_resource(struc
  9253. - }
  9254. -
  9255. - devinfo->regs = ioremap_nocache(bar0_addr, BRCMF_PCIE_REG_MAP_SIZE);
  9256. -- devinfo->tcm = ioremap_nocache(bar1_addr, BRCMF_PCIE_TCM_MAP_SIZE);
  9257. -- devinfo->tcm_size = BRCMF_PCIE_TCM_MAP_SIZE;
  9258. -+ devinfo->tcm = ioremap_nocache(bar1_addr, bar1_size);
  9259. -
  9260. - if (!devinfo->regs || !devinfo->tcm) {
  9261. - brcmf_err("ioremap() failed (%p,%p)\n", devinfo->regs,
  9262. -@@ -1602,8 +1599,9 @@ static int brcmf_pcie_get_resource(struc
  9263. - }
  9264. - brcmf_dbg(PCIE, "Phys addr : reg space = %p base addr %#016llx\n",
  9265. - devinfo->regs, (unsigned long long)bar0_addr);
  9266. -- brcmf_dbg(PCIE, "Phys addr : mem space = %p base addr %#016llx\n",
  9267. -- devinfo->tcm, (unsigned long long)bar1_addr);
  9268. -+ brcmf_dbg(PCIE, "Phys addr : mem space = %p base addr %#016llx size 0x%x\n",
  9269. -+ devinfo->tcm, (unsigned long long)bar1_addr,
  9270. -+ (unsigned int)bar1_size);
  9271. -
  9272. - return 0;
  9273. - }
  9274. 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
  9275. deleted file mode 100644
  9276. index e4a8f30..0000000
  9277. --- a/package/kernel/mac80211/patches/344-0010-brcmfmac-add-support-for-the-PCIE-4366c0-chip.patch
  9278. +++ /dev/null
  9279. @@ -1,34 +0,0 @@
  9280. -From: Hante Meuleman <meuleman@broadcom.com>
  9281. -Date: Wed, 17 Feb 2016 11:26:59 +0100
  9282. -Subject: [PATCH] brcmfmac: add support for the PCIE 4366c0 chip
  9283. -
  9284. -A newer version of the 4366 PCIE chip has been released. Add
  9285. -support for this version of the chip.
  9286. -
  9287. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  9288. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  9289. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  9290. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  9291. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9292. ----
  9293. -
  9294. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  9295. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  9296. -@@ -53,6 +53,7 @@ BRCMF_FW_NVRAM_DEF(4358, "brcmfmac4358-p
  9297. - BRCMF_FW_NVRAM_DEF(4359, "brcmfmac4359-pcie.bin", "brcmfmac4359-pcie.txt");
  9298. - BRCMF_FW_NVRAM_DEF(4365B, "brcmfmac4365b-pcie.bin", "brcmfmac4365b-pcie.txt");
  9299. - BRCMF_FW_NVRAM_DEF(4366B, "brcmfmac4366b-pcie.bin", "brcmfmac4366b-pcie.txt");
  9300. -+BRCMF_FW_NVRAM_DEF(4366C, "brcmfmac4366c-pcie.bin", "brcmfmac4366c-pcie.txt");
  9301. - BRCMF_FW_NVRAM_DEF(4371, "brcmfmac4371-pcie.bin", "brcmfmac4371-pcie.txt");
  9302. -
  9303. - static struct brcmf_firmware_mapping brcmf_pcie_fwnames[] = {
  9304. -@@ -66,7 +67,8 @@ static struct brcmf_firmware_mapping brc
  9305. - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4358_CHIP_ID, 0xFFFFFFFF, 4358),
  9306. - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4359_CHIP_ID, 0xFFFFFFFF, 4359),
  9307. - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4365_CHIP_ID, 0xFFFFFFFF, 4365B),
  9308. -- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4366_CHIP_ID, 0xFFFFFFFF, 4366B),
  9309. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4366_CHIP_ID, 0x0000000F, 4366B),
  9310. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4366_CHIP_ID, 0xFFFFFFF0, 4366C),
  9311. - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4371_CHIP_ID, 0xFFFFFFFF, 4371),
  9312. - };
  9313. -
  9314. 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
  9315. deleted file mode 100644
  9316. index c529ff2..0000000
  9317. --- a/package/kernel/mac80211/patches/344-0012-brcmfmac-increase-timeout-for-tx-eapol.patch
  9318. +++ /dev/null
  9319. @@ -1,30 +0,0 @@
  9320. -From: Hante Meuleman <meuleman@broadcom.com>
  9321. -Date: Wed, 17 Feb 2016 11:27:01 +0100
  9322. -Subject: [PATCH] brcmfmac: increase timeout for tx eapol
  9323. -
  9324. -When keys get set and updated this has to happen after eapol got
  9325. -transmitted (without key or old key) before the key can be updated.
  9326. -To make sure the order of sending eapol and configuring key is done
  9327. -correctly a timeout for tx of eapol is applied. This timeout is set
  9328. -to 50 msec, which is not always enough. Especially in AP mode and
  9329. -key updates the timeout may need to be much longer because client(s)
  9330. -can be in powersave. Increase the timeout from 50 to 950 msec.
  9331. -
  9332. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  9333. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  9334. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  9335. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  9336. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9337. ----
  9338. -
  9339. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  9340. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  9341. -@@ -40,7 +40,7 @@ MODULE_AUTHOR("Broadcom Corporation");
  9342. - MODULE_DESCRIPTION("Broadcom 802.11 wireless LAN fullmac driver.");
  9343. - MODULE_LICENSE("Dual BSD/GPL");
  9344. -
  9345. --#define MAX_WAIT_FOR_8021X_TX msecs_to_jiffies(50)
  9346. -+#define MAX_WAIT_FOR_8021X_TX msecs_to_jiffies(950)
  9347. -
  9348. - /* AMPDU rx reordering definitions */
  9349. - #define BRCMF_RXREORDER_FLOWID_OFFSET 0
  9350. diff --git a/package/kernel/mac80211/patches/345-brcmfmac-insert-default-boardrev-in-nvram-data-if-mi.patch b/package/kernel/mac80211/patches/345-brcmfmac-insert-default-boardrev-in-nvram-data-if-mi.patch
  9351. deleted file mode 100644
  9352. index f293401..0000000
  9353. --- a/package/kernel/mac80211/patches/345-brcmfmac-insert-default-boardrev-in-nvram-data-if-mi.patch
  9354. +++ /dev/null
  9355. @@ -1,114 +0,0 @@
  9356. -From: Hante Meuleman <hante.meuleman@broadcom.com>
  9357. -Date: Mon, 11 Apr 2016 11:35:23 +0200
  9358. -Subject: [PATCH] brcmfmac: insert default boardrev in nvram data if
  9359. - missing
  9360. -
  9361. -Some nvram files/stores come without the boardrev information,
  9362. -but firmware requires this to be set. When not found in nvram then
  9363. -add a default boardrev string to the nvram data.
  9364. -
  9365. -Reported-by: Rafal Milecki <zajec5@gmail.com>
  9366. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  9367. -Reviewed-by: Franky (Zhenhui) Lin <franky.lin@broadcom.com>
  9368. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  9369. -Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
  9370. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  9371. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9372. ----
  9373. -
  9374. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  9375. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  9376. -@@ -29,6 +29,7 @@
  9377. - #define BRCMF_FW_MAX_NVRAM_SIZE 64000
  9378. - #define BRCMF_FW_NVRAM_DEVPATH_LEN 19 /* devpath0=pcie/1/4/ */
  9379. - #define BRCMF_FW_NVRAM_PCIEDEV_LEN 10 /* pcie/1/4/ + \0 */
  9380. -+#define BRCMF_FW_DEFAULT_BOARDREV "boardrev=0xff"
  9381. -
  9382. - enum nvram_parser_state {
  9383. - IDLE,
  9384. -@@ -51,6 +52,7 @@ enum nvram_parser_state {
  9385. - * @entry: start position of key,value entry.
  9386. - * @multi_dev_v1: detect pcie multi device v1 (compressed).
  9387. - * @multi_dev_v2: detect pcie multi device v2.
  9388. -+ * @boardrev_found: nvram contains boardrev information.
  9389. - */
  9390. - struct nvram_parser {
  9391. - enum nvram_parser_state state;
  9392. -@@ -63,6 +65,7 @@ struct nvram_parser {
  9393. - u32 entry;
  9394. - bool multi_dev_v1;
  9395. - bool multi_dev_v2;
  9396. -+ bool boardrev_found;
  9397. - };
  9398. -
  9399. - /**
  9400. -@@ -125,6 +128,8 @@ static enum nvram_parser_state brcmf_nvr
  9401. - nvp->multi_dev_v1 = true;
  9402. - if (strncmp(&nvp->data[nvp->entry], "pcie/", 5) == 0)
  9403. - nvp->multi_dev_v2 = true;
  9404. -+ if (strncmp(&nvp->data[nvp->entry], "boardrev", 8) == 0)
  9405. -+ nvp->boardrev_found = true;
  9406. - } else if (!is_nvram_char(c) || c == ' ') {
  9407. - brcmf_dbg(INFO, "warning: ln=%d:col=%d: '=' expected, skip invalid key entry\n",
  9408. - nvp->line, nvp->column);
  9409. -@@ -284,6 +289,8 @@ static void brcmf_fw_strip_multi_v1(stru
  9410. - while (i < nvp->nvram_len) {
  9411. - if ((nvp->nvram[i] - '0' == id) && (nvp->nvram[i + 1] == ':')) {
  9412. - i += 2;
  9413. -+ if (strncmp(&nvp->nvram[i], "boardrev", 8) == 0)
  9414. -+ nvp->boardrev_found = true;
  9415. - while (nvp->nvram[i] != 0) {
  9416. - nvram[j] = nvp->nvram[i];
  9417. - i++;
  9418. -@@ -335,6 +342,8 @@ static void brcmf_fw_strip_multi_v2(stru
  9419. - while (i < nvp->nvram_len - len) {
  9420. - if (strncmp(&nvp->nvram[i], prefix, len) == 0) {
  9421. - i += len;
  9422. -+ if (strncmp(&nvp->nvram[i], "boardrev", 8) == 0)
  9423. -+ nvp->boardrev_found = true;
  9424. - while (nvp->nvram[i] != 0) {
  9425. - nvram[j] = nvp->nvram[i];
  9426. - i++;
  9427. -@@ -356,6 +365,18 @@ fail:
  9428. - nvp->nvram_len = 0;
  9429. - }
  9430. -
  9431. -+static void brcmf_fw_add_defaults(struct nvram_parser *nvp)
  9432. -+{
  9433. -+ if (nvp->boardrev_found)
  9434. -+ return;
  9435. -+
  9436. -+ memcpy(&nvp->nvram[nvp->nvram_len], &BRCMF_FW_DEFAULT_BOARDREV,
  9437. -+ strlen(BRCMF_FW_DEFAULT_BOARDREV));
  9438. -+ nvp->nvram_len += strlen(BRCMF_FW_DEFAULT_BOARDREV);
  9439. -+ nvp->nvram[nvp->nvram_len] = '\0';
  9440. -+ nvp->nvram_len++;
  9441. -+}
  9442. -+
  9443. - /* brcmf_nvram_strip :Takes a buffer of "<var>=<value>\n" lines read from a fil
  9444. - * and ending in a NUL. Removes carriage returns, empty lines, comment lines,
  9445. - * and converts newlines to NULs. Shortens buffer as needed and pads with NULs.
  9446. -@@ -377,16 +398,21 @@ static void *brcmf_fw_nvram_strip(const
  9447. - if (nvp.state == END)
  9448. - break;
  9449. - }
  9450. -- if (nvp.multi_dev_v1)
  9451. -+ if (nvp.multi_dev_v1) {
  9452. -+ nvp.boardrev_found = false;
  9453. - brcmf_fw_strip_multi_v1(&nvp, domain_nr, bus_nr);
  9454. -- else if (nvp.multi_dev_v2)
  9455. -+ } else if (nvp.multi_dev_v2) {
  9456. -+ nvp.boardrev_found = false;
  9457. - brcmf_fw_strip_multi_v2(&nvp, domain_nr, bus_nr);
  9458. -+ }
  9459. -
  9460. - if (nvp.nvram_len == 0) {
  9461. - kfree(nvp.nvram);
  9462. - return NULL;
  9463. - }
  9464. -
  9465. -+ brcmf_fw_add_defaults(&nvp);
  9466. -+
  9467. - pad = nvp.nvram_len;
  9468. - *new_length = roundup(nvp.nvram_len + 1, 4);
  9469. - while (pad != *new_length) {
  9470. diff --git a/package/kernel/mac80211/patches/402-ath_regd_optional.patch b/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  9471. index 7351353..4634283 100644
  9472. --- a/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  9473. +++ b/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  9474. @@ -8,7 +8,7 @@
  9475. + return;
  9476. +#endif
  9477. +
  9478. - for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
  9479. + for (band = 0; band < NUM_NL80211_BANDS; band++) {
  9480. if (!wiphy->bands[band])
  9481. continue;
  9482. @@ -374,6 +378,10 @@ ath_reg_apply_ir_flags(struct wiphy *wip
  9483. @@ -19,7 +19,7 @@
  9484. + return;
  9485. +#endif
  9486. +
  9487. - sband = wiphy->bands[IEEE80211_BAND_2GHZ];
  9488. + sband = wiphy->bands[NL80211_BAND_2GHZ];
  9489. if (!sband)
  9490. return;
  9491. @@ -402,6 +410,10 @@ static void ath_reg_apply_radar_flags(st
  9492. @@ -30,7 +30,7 @@
  9493. + return;
  9494. +#endif
  9495. +
  9496. - if (!wiphy->bands[IEEE80211_BAND_5GHZ])
  9497. + if (!wiphy->bands[NL80211_BAND_5GHZ])
  9498. return;
  9499. @@ -633,6 +645,11 @@ ath_regd_init_wiphy(struct ath_regulator
  9500. @@ -59,7 +59,7 @@
  9501. ---help---
  9502. --- a/.local-symbols
  9503. +++ b/.local-symbols
  9504. -@@ -125,6 +125,7 @@ ADM8211=
  9505. +@@ -127,6 +127,7 @@ ADM8211=
  9506. ATH_COMMON=
  9507. WLAN_VENDOR_ATH=
  9508. ATH_DEBUG=
  9509. 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
  9510. index 1a62484..f2f52f9 100644
  9511. --- a/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch
  9512. +++ b/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch
  9513. @@ -1,6 +1,6 @@
  9514. --- a/drivers/net/wireless/ath/ath9k/init.c
  9515. +++ b/drivers/net/wireless/ath/ath9k/init.c
  9516. -@@ -722,6 +722,7 @@ static const struct ieee80211_iface_limi
  9517. +@@ -727,6 +727,7 @@ static const struct ieee80211_iface_limi
  9518. BIT(NL80211_IFTYPE_AP) },
  9519. { .max = 1, .types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  9520. BIT(NL80211_IFTYPE_P2P_GO) },
  9521. diff --git a/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch b/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch
  9522. index a7f9d9f..f21eed1 100644
  9523. --- a/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch
  9524. +++ b/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch
  9525. @@ -1,6 +1,6 @@
  9526. --- a/drivers/net/wireless/ath/ath9k/debug.c
  9527. +++ b/drivers/net/wireless/ath/ath9k/debug.c
  9528. -@@ -1301,6 +1301,53 @@ void ath9k_deinit_debug(struct ath_softc
  9529. +@@ -1315,6 +1315,53 @@ void ath9k_deinit_debug(struct ath_softc
  9530. ath9k_cmn_spectral_deinit_debug(&sc->spec_priv);
  9531. }
  9532. @@ -54,7 +54,7 @@
  9533. int ath9k_init_debug(struct ath_hw *ah)
  9534. {
  9535. struct ath_common *common = ath9k_hw_common(ah);
  9536. -@@ -1320,6 +1367,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  9537. +@@ -1334,6 +1381,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  9538. ath9k_tx99_init_debug(sc);
  9539. ath9k_cmn_spectral_init_debug(&sc->spec_priv, sc->debug.debugfs_phy);
  9540. diff --git a/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch b/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch
  9541. index 5892c3e..1825d77 100644
  9542. --- a/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch
  9543. +++ b/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch
  9544. @@ -1,6 +1,6 @@
  9545. --- a/drivers/net/wireless/ath/ath9k/init.c
  9546. +++ b/drivers/net/wireless/ath/ath9k/init.c
  9547. -@@ -1024,23 +1024,23 @@ static int __init ath9k_init(void)
  9548. +@@ -1030,23 +1030,23 @@ static int __init ath9k_init(void)
  9549. {
  9550. int error;
  9551. diff --git a/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch b/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch
  9552. index 6766111..15b8d7b 100644
  9553. --- a/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch
  9554. +++ b/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch
  9555. @@ -8,4 +8,4 @@
  9556. +#define ATH_RXBUF 256
  9557. #define ATH_TXBUF 512
  9558. #define ATH_TXBUF_RESERVE 5
  9559. - #define ATH_MAX_QDEPTH (ATH_TXBUF / 4 - ATH_TXBUF_RESERVE)
  9560. + #define ATH_TXMAXTRY 13
  9561. diff --git a/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch b/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch
  9562. index 5ecf528..c98072b 100644
  9563. --- a/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch
  9564. +++ b/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch
  9565. @@ -1,6 +1,6 @@
  9566. --- a/drivers/net/wireless/ath/ath9k/debug.c
  9567. +++ b/drivers/net/wireless/ath/ath9k/debug.c
  9568. -@@ -1348,6 +1348,52 @@ static const struct file_operations fops
  9569. +@@ -1362,6 +1362,52 @@ static const struct file_operations fops
  9570. .owner = THIS_MODULE
  9571. };
  9572. @@ -53,7 +53,7 @@
  9573. int ath9k_init_debug(struct ath_hw *ah)
  9574. {
  9575. struct ath_common *common = ath9k_hw_common(ah);
  9576. -@@ -1369,6 +1415,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  9577. +@@ -1383,6 +1429,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  9578. debugfs_create_file("eeprom", S_IRUSR, sc->debug.debugfs_phy, sc,
  9579. &fops_eeprom);
  9580. @@ -90,7 +90,7 @@
  9581. ichan->channel = chan->center_freq;
  9582. ichan->chan = chan;
  9583. @@ -308,7 +310,19 @@ static void ath9k_cmn_update_ichannel(st
  9584. - if (chan->band == IEEE80211_BAND_5GHZ)
  9585. + if (chan->band == NL80211_BAND_5GHZ)
  9586. flags |= CHANNEL_5GHZ;
  9587. - switch (chandef->width) {
  9588. diff --git a/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch b/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
  9589. index c84d1bc..167eeff 100644
  9590. --- a/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
  9591. +++ b/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
  9592. @@ -20,7 +20,7 @@
  9593. #define AR9160_DEVID_PCI 0x0027
  9594. --- a/drivers/net/wireless/ath/ath9k/pci.c
  9595. +++ b/drivers/net/wireless/ath/ath9k/pci.c
  9596. -@@ -751,6 +751,7 @@ static const struct pci_device_id ath_pc
  9597. +@@ -761,6 +761,7 @@ static const struct pci_device_id ath_pc
  9598. .driver_data = ATH9K_PCI_BT_ANT_DIV },
  9599. #endif
  9600. diff --git a/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
  9601. index e151a12..c40598d 100644
  9602. --- a/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
  9603. +++ b/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
  9604. @@ -1,6 +1,6 @@
  9605. --- a/include/net/cfg80211.h
  9606. +++ b/include/net/cfg80211.h
  9607. -@@ -2363,6 +2363,7 @@ struct cfg80211_qos_map {
  9608. +@@ -2410,6 +2410,7 @@ struct cfg80211_qos_map {
  9609. * (as advertised by the nl80211 feature flag.)
  9610. * @get_tx_power: store the current TX power into the dbm variable;
  9611. * return 0 if successful
  9612. @@ -8,7 +8,7 @@
  9613. *
  9614. * @set_wds_peer: set the WDS peer for a WDS interface
  9615. *
  9616. -@@ -2624,6 +2625,7 @@ struct cfg80211_ops {
  9617. +@@ -2671,6 +2672,7 @@ struct cfg80211_ops {
  9618. enum nl80211_tx_power_setting type, int mbm);
  9619. int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
  9620. int *dbm);
  9621. @@ -18,7 +18,7 @@
  9622. const u8 *addr);
  9623. --- a/include/net/mac80211.h
  9624. +++ b/include/net/mac80211.h
  9625. -@@ -1286,6 +1286,7 @@ enum ieee80211_smps_mode {
  9626. +@@ -1317,6 +1317,7 @@ enum ieee80211_smps_mode {
  9627. *
  9628. * @power_level: requested transmit power (in dBm), backward compatibility
  9629. * value only that is set to the minimum of all interfaces
  9630. @@ -26,7 +26,7 @@
  9631. *
  9632. * @chandef: the channel definition to tune to
  9633. * @radar_enabled: whether radar detection is enabled
  9634. -@@ -1306,6 +1307,7 @@ enum ieee80211_smps_mode {
  9635. +@@ -1337,6 +1338,7 @@ enum ieee80211_smps_mode {
  9636. struct ieee80211_conf {
  9637. u32 flags;
  9638. int power_level, dynamic_ps_timeout;
  9639. @@ -36,9 +36,9 @@
  9640. u8 ps_dtim_period;
  9641. --- a/include/uapi/linux/nl80211.h
  9642. +++ b/include/uapi/linux/nl80211.h
  9643. -@@ -1790,6 +1790,9 @@ enum nl80211_commands {
  9644. - * between scans. The scan plans are executed sequentially.
  9645. - * Each scan plan is a nested attribute of &enum nl80211_sched_scan_plan.
  9646. +@@ -1829,6 +1829,9 @@ enum nl80211_commands {
  9647. + * %NL80211_ATTR_EXT_CAPA_MASK, to specify the extended capabilities per
  9648. + * interface type.
  9649. *
  9650. + * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce
  9651. + * transmit power to stay within regulatory limits. u32, dBi.
  9652. @@ -46,9 +46,9 @@
  9653. * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  9654. * @NL80211_ATTR_MAX: highest attribute number currently defined
  9655. * @__NL80211_ATTR_AFTER_LAST: internal use
  9656. -@@ -2164,6 +2167,8 @@ enum nl80211_attrs {
  9657. - NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS,
  9658. - NL80211_ATTR_SCHED_SCAN_PLANS,
  9659. +@@ -2213,6 +2216,8 @@ enum nl80211_attrs {
  9660. +
  9661. + NL80211_ATTR_IFTYPE_EXT_CAPA,
  9662. + NL80211_ATTR_WIPHY_ANTENNA_GAIN,
  9663. +
  9664. @@ -57,7 +57,7 @@
  9665. __NL80211_ATTR_AFTER_LAST,
  9666. --- a/net/mac80211/cfg.c
  9667. +++ b/net/mac80211/cfg.c
  9668. -@@ -2229,6 +2229,19 @@ static int ieee80211_get_tx_power(struct
  9669. +@@ -2238,6 +2238,19 @@ static int ieee80211_get_tx_power(struct
  9670. return 0;
  9671. }
  9672. @@ -77,7 +77,7 @@
  9673. static int ieee80211_set_wds_peer(struct wiphy *wiphy, struct net_device *dev,
  9674. const u8 *addr)
  9675. {
  9676. -@@ -3403,6 +3416,7 @@ const struct cfg80211_ops mac80211_confi
  9677. +@@ -3412,6 +3425,7 @@ const struct cfg80211_ops mac80211_confi
  9678. .set_wiphy_params = ieee80211_set_wiphy_params,
  9679. .set_tx_power = ieee80211_set_tx_power,
  9680. .get_tx_power = ieee80211_get_tx_power,
  9681. @@ -87,7 +87,7 @@
  9682. CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd)
  9683. --- a/net/mac80211/ieee80211_i.h
  9684. +++ b/net/mac80211/ieee80211_i.h
  9685. -@@ -1318,6 +1318,7 @@ struct ieee80211_local {
  9686. +@@ -1338,6 +1338,7 @@ struct ieee80211_local {
  9687. int dynamic_ps_forced_timeout;
  9688. int user_power_level; /* in dBm, for all interfaces */
  9689. @@ -119,7 +119,7 @@
  9690. if (local->hw.conf.power_level != power) {
  9691. changed |= IEEE80211_CONF_CHANGE_POWER;
  9692. local->hw.conf.power_level = power;
  9693. -@@ -586,6 +592,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
  9694. +@@ -588,6 +594,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
  9695. IEEE80211_RADIOTAP_MCS_HAVE_BW;
  9696. local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI |
  9697. IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH;
  9698. @@ -129,15 +129,15 @@
  9699. local->user_power_level = IEEE80211_UNSET_POWER_LEVEL;
  9700. --- a/net/wireless/nl80211.c
  9701. +++ b/net/wireless/nl80211.c
  9702. -@@ -403,6 +403,7 @@ static const struct nla_policy nl80211_p
  9703. - [NL80211_ATTR_NETNS_FD] = { .type = NLA_U32 },
  9704. - [NL80211_ATTR_SCHED_SCAN_DELAY] = { .type = NLA_U32 },
  9705. - [NL80211_ATTR_REG_INDOOR] = { .type = NLA_FLAG },
  9706. +@@ -407,6 +407,7 @@ static const struct nla_policy nl80211_p
  9707. + [NL80211_ATTR_PBSS] = { .type = NLA_FLAG },
  9708. + [NL80211_ATTR_BSS_SELECT] = { .type = NLA_NESTED },
  9709. + [NL80211_ATTR_STA_SUPPORT_P2P_PS] = { .type = NLA_U8 },
  9710. + [NL80211_ATTR_WIPHY_ANTENNA_GAIN] = { .type = NLA_U32 },
  9711. };
  9712. /* policy for the key attributes */
  9713. -@@ -2220,6 +2221,20 @@ static int nl80211_set_wiphy(struct sk_b
  9714. +@@ -2294,6 +2295,20 @@ static int nl80211_set_wiphy(struct sk_b
  9715. if (result)
  9716. return result;
  9717. }
  9718. diff --git a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  9719. index 5a5e464..0b25749 100644
  9720. --- a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  9721. +++ b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  9722. @@ -1,16 +1,16 @@
  9723. --- a/drivers/net/wireless/ath/ath9k/ath9k.h
  9724. +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  9725. @@ -814,6 +814,9 @@ static inline int ath9k_dump_btcoex(stru
  9726. + #ifdef CPTCFG_MAC80211_LEDS
  9727. void ath_init_leds(struct ath_softc *sc);
  9728. void ath_deinit_leds(struct ath_softc *sc);
  9729. - void ath_fill_led_pin(struct ath_softc *sc);
  9730. +int ath_create_gpio_led(struct ath_softc *sc, int gpio, const char *name,
  9731. -+ const char *trigger, bool active_low);
  9732. ++ const char *trigger, bool active_low);
  9733. +
  9734. #else
  9735. static inline void ath_init_leds(struct ath_softc *sc)
  9736. {
  9737. -@@ -953,6 +956,13 @@ void ath_ant_comb_scan(struct ath_softc
  9738. +@@ -950,6 +953,13 @@ void ath_ant_comb_scan(struct ath_softc
  9739. #define ATH9K_NUM_CHANCTX 2 /* supports 2 operating channels */
  9740. @@ -24,7 +24,7 @@
  9741. struct ath_softc {
  9742. struct ieee80211_hw *hw;
  9743. struct device *dev;
  9744. -@@ -1005,9 +1015,8 @@ struct ath_softc {
  9745. +@@ -1002,9 +1012,8 @@ struct ath_softc {
  9746. spinlock_t chan_lock;
  9747. #ifdef CPTCFG_MAC80211_LEDS
  9748. @@ -38,24 +38,33 @@
  9749. #ifdef CPTCFG_ATH9K_DEBUGFS
  9750. --- a/drivers/net/wireless/ath/ath9k/gpio.c
  9751. +++ b/drivers/net/wireless/ath/ath9k/gpio.c
  9752. -@@ -24,45 +24,102 @@
  9753. - static void ath_led_brightness(struct led_classdev *led_cdev,
  9754. - enum led_brightness brightness)
  9755. +@@ -22,7 +22,7 @@
  9756. +
  9757. + #ifdef CPTCFG_MAC80211_LEDS
  9758. +
  9759. +-void ath_fill_led_pin(struct ath_softc *sc)
  9760. ++static void ath_fill_led_pin(struct ath_softc *sc)
  9761. {
  9762. -- struct ath_softc *sc = container_of(led_cdev, struct ath_softc, led_cdev);
  9763. -- u32 val = (brightness == LED_OFF);
  9764. + struct ath_hw *ah = sc->sc_ah;
  9765. +
  9766. +@@ -39,61 +39,111 @@ void ath_fill_led_pin(struct ath_softc *
  9767. + else
  9768. + ah->led_pin = ATH_LED_PIN_DEF;
  9769. + }
  9770. ++}
  9771. ++
  9772. ++static void ath_led_brightness(struct led_classdev *led_cdev,
  9773. ++ enum led_brightness brightness)
  9774. ++{
  9775. + struct ath_led *led = container_of(led_cdev, struct ath_led, cdev);
  9776. + struct ath_softc *sc = led->sc;
  9777. -
  9778. -- if (sc->sc_ah->config.led_active_high)
  9779. -- val = !val;
  9780. ++
  9781. + ath9k_ps_wakeup(sc);
  9782. + ath9k_hw_set_gpio(sc->sc_ah, led->gpio->gpio,
  9783. + (brightness != LED_OFF) ^ led->gpio->active_low);
  9784. + ath9k_ps_restore(sc);
  9785. +}
  9786. -
  9787. -- ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, val);
  9788. ++
  9789. +static int ath_add_led(struct ath_softc *sc, struct ath_led *led)
  9790. +{
  9791. + const struct gpio_led *gpio = led->gpio;
  9792. @@ -71,30 +80,40 @@
  9793. +
  9794. + led->sc = sc;
  9795. + list_add(&led->list, &sc->leds);
  9796. -+
  9797. -+ /* Configure gpio for output */
  9798. -+ ath9k_hw_cfg_output(sc->sc_ah, gpio->gpio,
  9799. -+ AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
  9800. -+
  9801. +
  9802. + /* Configure gpio for output */
  9803. +- ath9k_hw_gpio_request_out(ah, ah->led_pin, "ath9k-led",
  9804. ++ ath9k_hw_gpio_request_out(sc->sc_ah, gpio->gpio, gpio->name,
  9805. + AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
  9806. +
  9807. +- /* LED off, active low */
  9808. +- ath9k_hw_set_gpio(ah, ah->led_pin, ah->config.led_active_high ? 0 : 1);
  9809. + /* LED off */
  9810. + ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low);
  9811. +
  9812. + return 0;
  9813. -+}
  9814. -+
  9815. + }
  9816. +
  9817. +-static void ath_led_brightness(struct led_classdev *led_cdev,
  9818. +- enum led_brightness brightness)
  9819. +int ath_create_gpio_led(struct ath_softc *sc, int gpio_num, const char *name,
  9820. + const char *trigger, bool active_low)
  9821. -+{
  9822. + {
  9823. +- struct ath_softc *sc = container_of(led_cdev, struct ath_softc, led_cdev);
  9824. +- u32 val = (brightness == LED_OFF);
  9825. + struct ath_led *led;
  9826. + struct gpio_led *gpio;
  9827. + char *_name;
  9828. + int ret;
  9829. -+
  9830. +
  9831. +- if (sc->sc_ah->config.led_active_high)
  9832. +- val = !val;
  9833. + led = kzalloc(sizeof(*led) + sizeof(*gpio) + strlen(name) + 1,
  9834. + GFP_KERNEL);
  9835. + if (!led)
  9836. + return -ENOMEM;
  9837. -+
  9838. +
  9839. +- ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, val);
  9840. + led->gpio = gpio = (struct gpio_led *) (led + 1);
  9841. + _name = (char *) (led->gpio + 1);
  9842. +
  9843. @@ -115,15 +134,18 @@
  9844. {
  9845. - if (!sc->led_registered)
  9846. - return;
  9847. -+ struct ath_led *led;
  9848. -
  9849. +-
  9850. - ath_led_brightness(&sc->led_cdev, LED_OFF);
  9851. - led_classdev_unregister(&sc->led_cdev);
  9852. ++ struct ath_led *led;
  9853. +
  9854. +- ath9k_hw_gpio_free(sc->sc_ah, sc->sc_ah->led_pin);
  9855. + while (!list_empty(&sc->leds)) {
  9856. + led = list_first_entry(&sc->leds, struct ath_led, list);
  9857. + list_del(&led->list);
  9858. + ath_led_brightness(&led->cdev, LED_OFF);
  9859. + led_classdev_unregister(&led->cdev);
  9860. ++ ath9k_hw_gpio_free(sc->sc_ah, led->gpio->gpio);
  9861. + kfree(led);
  9862. + }
  9863. }
  9864. @@ -139,6 +161,8 @@
  9865. if (AR_SREV_9100(sc->sc_ah))
  9866. return;
  9867. + ath_fill_led_pin(sc);
  9868. +
  9869. - if (!ath9k_led_blink)
  9870. - sc->led_cdev.default_trigger =
  9871. - ieee80211_get_radio_led_name(sc->hw);
  9872. @@ -159,13 +183,14 @@
  9873. + trigger = ieee80211_get_radio_led_name(sc->hw);
  9874. - sc->led_registered = true;
  9875. -+ ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, !sc->sc_ah->config.led_active_high);
  9876. ++ ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger,
  9877. ++ !sc->sc_ah->config.led_active_high);
  9878. }
  9879. + #endif
  9880. - void ath_fill_led_pin(struct ath_softc *sc)
  9881. --- a/drivers/net/wireless/ath/ath9k/init.c
  9882. +++ b/drivers/net/wireless/ath/ath9k/init.c
  9883. -@@ -936,7 +936,7 @@ int ath9k_init_device(u16 devid, struct
  9884. +@@ -942,7 +942,7 @@ int ath9k_init_device(u16 devid, struct
  9885. #ifdef CPTCFG_MAC80211_LEDS
  9886. /* must be initialized before ieee80211_register_hw */
  9887. @@ -176,7 +201,7 @@
  9888. #endif
  9889. --- a/drivers/net/wireless/ath/ath9k/debug.c
  9890. +++ b/drivers/net/wireless/ath/ath9k/debug.c
  9891. -@@ -1393,6 +1393,61 @@ static const struct file_operations fops
  9892. +@@ -1407,6 +1407,61 @@ static const struct file_operations fops
  9893. .llseek = default_llseek,
  9894. };
  9895. @@ -238,7 +263,7 @@
  9896. int ath9k_init_debug(struct ath_hw *ah)
  9897. {
  9898. -@@ -1417,6 +1472,10 @@ int ath9k_init_debug(struct ath_hw *ah)
  9899. +@@ -1431,6 +1486,10 @@ int ath9k_init_debug(struct ath_hw *ah)
  9900. &fops_eeprom);
  9901. debugfs_create_file("chanbw", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
  9902. sc, &fops_chanbw);
  9903. diff --git a/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch b/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch
  9904. index 7c10ea6..f656697 100644
  9905. --- a/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch
  9906. +++ b/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch
  9907. @@ -1,6 +1,6 @@
  9908. --- a/include/linux/ath9k_platform.h
  9909. +++ b/include/linux/ath9k_platform.h
  9910. -@@ -41,6 +41,9 @@ struct ath9k_platform_data {
  9911. +@@ -45,6 +45,9 @@ struct ath9k_platform_data {
  9912. int (*external_reset)(void);
  9913. bool use_eeprom;
  9914. @@ -20,7 +20,7 @@
  9915. /********************************/
  9916. /* LED functions */
  9917. -@@ -88,6 +89,24 @@ int ath_create_gpio_led(struct ath_softc
  9918. +@@ -108,6 +109,24 @@ int ath_create_gpio_led(struct ath_softc
  9919. return ret;
  9920. }
  9921. @@ -45,7 +45,7 @@
  9922. void ath_deinit_leds(struct ath_softc *sc)
  9923. {
  9924. struct ath_led *led;
  9925. -@@ -103,8 +122,10 @@ void ath_deinit_leds(struct ath_softc *s
  9926. +@@ -124,8 +143,10 @@ void ath_deinit_leds(struct ath_softc *s
  9927. void ath_init_leds(struct ath_softc *sc)
  9928. {
  9929. @@ -56,10 +56,10 @@
  9930. INIT_LIST_HEAD(&sc->leds);
  9931. -@@ -120,6 +141,12 @@ void ath_init_leds(struct ath_softc *sc)
  9932. - trigger = ieee80211_get_radio_led_name(sc->hw);
  9933. +@@ -144,6 +165,12 @@ void ath_init_leds(struct ath_softc *sc)
  9934. - ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, !sc->sc_ah->config.led_active_high);
  9935. + ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger,
  9936. + !sc->sc_ah->config.led_active_high);
  9937. +
  9938. + if (!pdata)
  9939. + return;
  9940. @@ -67,5 +67,5 @@
  9941. + for (i = 0; i < pdata->num_leds; i++)
  9942. + ath_create_platform_led(sc, &pdata->leds[i]);
  9943. }
  9944. + #endif
  9945. - void ath_fill_led_pin(struct ath_softc *sc)
  9946. 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
  9947. index 6d62a2b..50d8a7a 100644
  9948. --- a/package/kernel/mac80211/patches/532-ath9k_get_led_polarity_from_platform_data.patch
  9949. +++ b/package/kernel/mac80211/patches/532-ath9k_get_led_polarity_from_platform_data.patch
  9950. @@ -1,6 +1,6 @@
  9951. --- a/include/linux/ath9k_platform.h
  9952. +++ b/include/linux/ath9k_platform.h
  9953. -@@ -36,6 +36,7 @@ struct ath9k_platform_data {
  9954. +@@ -40,6 +40,7 @@ struct ath9k_platform_data {
  9955. bool tx_gain_buffalo;
  9956. bool disable_2ghz;
  9957. bool disable_5ghz;
  9958. @@ -10,7 +10,7 @@
  9959. int (*external_reset)(void);
  9960. --- a/drivers/net/wireless/ath/ath9k/init.c
  9961. +++ b/drivers/net/wireless/ath/ath9k/init.c
  9962. -@@ -577,6 +577,7 @@ static int ath9k_init_softc(u16 devid, s
  9963. +@@ -580,6 +580,7 @@ static int ath9k_init_softc(u16 devid, s
  9964. ah->external_reset = pdata->external_reset;
  9965. ah->disable_2ghz = pdata->disable_2ghz;
  9966. ah->disable_5ghz = pdata->disable_5ghz;
  9967. 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
  9968. index 3c5e9f5..c2d2781 100644
  9969. --- a/package/kernel/mac80211/patches/541-ath9k_rx_dma_stop_check.patch
  9970. +++ b/package/kernel/mac80211/patches/541-ath9k_rx_dma_stop_check.patch
  9971. @@ -1,6 +1,6 @@
  9972. --- a/drivers/net/wireless/ath/ath9k/mac.c
  9973. +++ b/drivers/net/wireless/ath/ath9k/mac.c
  9974. -@@ -695,7 +695,7 @@ bool ath9k_hw_stopdmarecv(struct ath_hw
  9975. +@@ -698,7 +698,7 @@ bool ath9k_hw_stopdmarecv(struct ath_hw
  9976. {
  9977. #define AH_RX_STOP_DMA_TIMEOUT 10000 /* usec */
  9978. struct ath_common *common = ath9k_hw_common(ah);
  9979. @@ -9,7 +9,7 @@
  9980. int i;
  9981. /* Enable access to the DMA observation bus */
  9982. -@@ -725,6 +725,16 @@ bool ath9k_hw_stopdmarecv(struct ath_hw
  9983. +@@ -728,6 +728,16 @@ bool ath9k_hw_stopdmarecv(struct ath_hw
  9984. }
  9985. if (i == 0) {
  9986. diff --git a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  9987. index e83c6bf..4615643 100644
  9988. --- a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  9989. +++ b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  9990. @@ -1,6 +1,6 @@
  9991. --- a/drivers/net/wireless/ath/ath9k/debug.c
  9992. +++ b/drivers/net/wireless/ath/ath9k/debug.c
  9993. -@@ -1449,6 +1449,50 @@ static const struct file_operations fops
  9994. +@@ -1463,6 +1463,50 @@ static const struct file_operations fops
  9995. #endif
  9996. @@ -51,7 +51,7 @@
  9997. int ath9k_init_debug(struct ath_hw *ah)
  9998. {
  9999. struct ath_common *common = ath9k_hw_common(ah);
  10000. -@@ -1476,6 +1520,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  10001. +@@ -1490,6 +1534,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  10002. debugfs_create_file("gpio_led", S_IWUSR,
  10003. sc->debug.debugfs_phy, sc, &fops_gpio_led);
  10004. #endif
  10005. @@ -62,7 +62,7 @@
  10006. debugfs_create_devm_seqfile(sc->dev, "interrupt", sc->debug.debugfs_phy,
  10007. --- a/drivers/net/wireless/ath/ath9k/hw.h
  10008. +++ b/drivers/net/wireless/ath/ath9k/hw.h
  10009. -@@ -519,6 +519,12 @@ enum {
  10010. +@@ -520,6 +520,12 @@ enum {
  10011. ATH9K_RESET_COLD,
  10012. };
  10013. @@ -75,7 +75,7 @@
  10014. struct ath9k_hw_version {
  10015. u32 magic;
  10016. u16 devid;
  10017. -@@ -804,6 +810,8 @@ struct ath_hw {
  10018. +@@ -805,6 +811,8 @@ struct ath_hw {
  10019. u32 rfkill_polarity;
  10020. u32 ah_flags;
  10021. @@ -84,7 +84,7 @@
  10022. bool reset_power_on;
  10023. bool htc_reset_init;
  10024. -@@ -1066,6 +1074,7 @@ void ath9k_hw_check_nav(struct ath_hw *a
  10025. +@@ -1068,6 +1076,7 @@ void ath9k_hw_check_nav(struct ath_hw *a
  10026. bool ath9k_hw_check_alive(struct ath_hw *ah);
  10027. bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode);
  10028. @@ -94,7 +94,7 @@
  10029. struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah,
  10030. --- a/drivers/net/wireless/ath/ath9k/hw.c
  10031. +++ b/drivers/net/wireless/ath/ath9k/hw.c
  10032. -@@ -1819,6 +1819,20 @@ u32 ath9k_hw_get_tsf_offset(struct times
  10033. +@@ -1841,6 +1841,20 @@ u32 ath9k_hw_get_tsf_offset(struct times
  10034. }
  10035. EXPORT_SYMBOL(ath9k_hw_get_tsf_offset);
  10036. @@ -115,7 +115,7 @@
  10037. int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
  10038. struct ath9k_hw_cal_data *caldata, bool fastcc)
  10039. {
  10040. -@@ -2027,6 +2041,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  10041. +@@ -2049,6 +2063,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  10042. ar9003_hw_disable_phy_restart(ah);
  10043. ath9k_hw_apply_gpio_override(ah);
  10044. diff --git a/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch b/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  10045. index d7bb5a1..656ed43 100644
  10046. --- a/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  10047. +++ b/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  10048. @@ -1,6 +1,6 @@
  10049. --- a/drivers/net/wireless/ath/ath9k/hw.h
  10050. +++ b/drivers/net/wireless/ath/ath9k/hw.h
  10051. -@@ -720,6 +720,7 @@ struct ath_spec_scan {
  10052. +@@ -721,6 +721,7 @@ struct ath_spec_scan {
  10053. * @config_pci_powersave:
  10054. * @calibrate: periodic calibration for NF, ANI, IQ, ADC gain, ADC-DC
  10055. *
  10056. @@ -8,7 +8,7 @@
  10057. * @spectral_scan_config: set parameters for spectral scan and enable/disable it
  10058. * @spectral_scan_trigger: trigger a spectral scan run
  10059. * @spectral_scan_wait: wait for a spectral scan run to finish
  10060. -@@ -742,6 +743,7 @@ struct ath_hw_ops {
  10061. +@@ -743,6 +744,7 @@ struct ath_hw_ops {
  10062. struct ath_hw_antcomb_conf *antconf);
  10063. void (*antdiv_comb_conf_set)(struct ath_hw *ah,
  10064. struct ath_hw_antcomb_conf *antconf);
  10065. @@ -18,7 +18,7 @@
  10066. void (*spectral_scan_trigger)(struct ath_hw *ah);
  10067. --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  10068. +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  10069. -@@ -1998,6 +1998,26 @@ void ar9003_hw_init_rate_txpower(struct
  10070. +@@ -1945,6 +1945,26 @@ void ar9003_hw_init_rate_txpower(struct
  10071. }
  10072. }
  10073. @@ -45,7 +45,7 @@
  10074. void ar9003_hw_attach_phy_ops(struct ath_hw *ah)
  10075. {
  10076. struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah);
  10077. -@@ -2034,6 +2054,7 @@ void ar9003_hw_attach_phy_ops(struct ath
  10078. +@@ -1981,6 +2001,7 @@ void ar9003_hw_attach_phy_ops(struct ath
  10079. priv_ops->set_radar_params = ar9003_hw_set_radar_params;
  10080. priv_ops->fast_chan_change = ar9003_hw_fast_chan_change;
  10081. @@ -55,9 +55,9 @@
  10082. ops->spectral_scan_config = ar9003_hw_spectral_scan_config;
  10083. --- a/drivers/net/wireless/ath/ath9k/init.c
  10084. +++ b/drivers/net/wireless/ath/ath9k/init.c
  10085. -@@ -711,7 +711,8 @@ static void ath9k_init_txpower_limits(st
  10086. +@@ -716,7 +716,8 @@ static void ath9k_init_txpower_limits(st
  10087. if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)
  10088. - ath9k_init_band_txpower(sc, IEEE80211_BAND_5GHZ);
  10089. + ath9k_init_band_txpower(sc, NL80211_BAND_5GHZ);
  10090. - ah->curchan = curchan;
  10091. + if (curchan)
  10092. @@ -65,7 +65,7 @@
  10093. }
  10094. static const struct ieee80211_iface_limit if_limits[] = {
  10095. -@@ -897,6 +898,18 @@ static void ath9k_set_hw_capab(struct at
  10096. +@@ -903,6 +904,18 @@ static void ath9k_set_hw_capab(struct at
  10097. SET_IEEE80211_PERM_ADDR(hw, common->macaddr);
  10098. }
  10099. @@ -84,7 +84,7 @@
  10100. int ath9k_init_device(u16 devid, struct ath_softc *sc,
  10101. const struct ath_bus_ops *bus_ops)
  10102. {
  10103. -@@ -942,6 +955,8 @@ int ath9k_init_device(u16 devid, struct
  10104. +@@ -948,6 +961,8 @@ int ath9k_init_device(u16 devid, struct
  10105. ARRAY_SIZE(ath9k_tpt_blink));
  10106. #endif
  10107. @@ -110,7 +110,7 @@
  10108. static inline void ath9k_hw_set_bt_ant_diversity(struct ath_hw *ah, bool enable)
  10109. --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  10110. +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  10111. -@@ -1327,9 +1327,30 @@ void ar5008_hw_init_rate_txpower(struct
  10112. +@@ -1325,9 +1325,30 @@ void ar5008_hw_init_rate_txpower(struct
  10113. }
  10114. }
  10115. @@ -141,7 +141,7 @@
  10116. static const u32 ar5416_cca_regs[6] = {
  10117. AR_PHY_CCA,
  10118. AR_PHY_CH1_CCA,
  10119. -@@ -1344,6 +1365,8 @@ int ar5008_hw_attach_phy_ops(struct ath_
  10120. +@@ -1342,6 +1363,8 @@ int ar5008_hw_attach_phy_ops(struct ath_
  10121. if (ret)
  10122. return ret;
  10123. @@ -175,7 +175,7 @@
  10124. #define AR_PHY_TIMING2 0x9810
  10125. #define AR_PHY_TIMING3 0x9814
  10126. #define AR_PHY_TIMING3_DSC_MAN 0xFFFE0000
  10127. -@@ -390,6 +399,8 @@
  10128. +@@ -393,6 +402,8 @@
  10129. #define AR_PHY_RFBUS_GRANT 0x9C20
  10130. #define AR_PHY_RFBUS_GRANT_EN 0x00000001
  10131. 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
  10132. index 8768c5d..b9c962e 100644
  10133. --- a/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch
  10134. +++ b/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch
  10135. @@ -20,9 +20,9 @@
  10136. /******************/
  10137. /* Chip Revisions */
  10138. /******************/
  10139. -@@ -1397,6 +1410,9 @@ static bool ath9k_hw_set_reset(struct at
  10140. - if (AR_SREV_9100(ah))
  10141. +@@ -1417,6 +1430,9 @@ static bool ath9k_hw_set_reset(struct at
  10142. udelay(50);
  10143. + }
  10144. + if (AR_SREV_9330(ah) || AR_SREV_9340(ah))
  10145. + ath9k_hw_disable_pll_lock_detect(ah);
  10146. @@ -30,7 +30,7 @@
  10147. return true;
  10148. }
  10149. -@@ -1496,6 +1512,9 @@ static bool ath9k_hw_chip_reset(struct a
  10150. +@@ -1516,6 +1532,9 @@ static bool ath9k_hw_chip_reset(struct a
  10151. ar9003_hw_internal_regulator_apply(ah);
  10152. ath9k_hw_init_pll(ah, chan);
  10153. @@ -40,7 +40,7 @@
  10154. return true;
  10155. }
  10156. -@@ -1797,8 +1816,14 @@ static int ath9k_hw_do_fastcc(struct ath
  10157. +@@ -1819,8 +1838,14 @@ static int ath9k_hw_do_fastcc(struct ath
  10158. if (AR_SREV_9271(ah))
  10159. ar9002_hw_load_ani_reg(ah, chan);
  10160. @@ -55,7 +55,7 @@
  10161. return -EINVAL;
  10162. }
  10163. -@@ -2052,6 +2077,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  10164. +@@ -2074,6 +2099,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  10165. ath9k_hw_set_radar_params(ah);
  10166. }
  10167. diff --git a/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch b/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
  10168. index 3d24ccd..b639f97 100644
  10169. --- a/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
  10170. +++ b/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
  10171. @@ -1,6 +1,6 @@
  10172. --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  10173. +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  10174. -@@ -956,55 +956,6 @@ static bool ar5008_hw_ani_control_new(st
  10175. +@@ -954,55 +954,6 @@ static bool ar5008_hw_ani_control_new(st
  10176. * on == 0 means more noise imm
  10177. */
  10178. u32 on = param ? 1 : 0;
  10179. @@ -58,7 +58,7 @@
  10180. REG_SET_BIT(ah, AR_PHY_SFCORR_LOW,
  10181. --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  10182. +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  10183. -@@ -41,20 +41,6 @@ static const int cycpwrThr1_table[] =
  10184. +@@ -42,20 +42,6 @@ static const int cycpwrThr1_table[] =
  10185. /* level: 0 1 2 3 4 5 6 7 8 */
  10186. { -6, -4, -2, 0, 2, 4, 6, 8 }; /* lvl 0-7, default 3 */
  10187. @@ -79,7 +79,7 @@
  10188. static const u8 ofdm2pwr[] = {
  10189. ALL_TARGET_LEGACY_6_24,
  10190. ALL_TARGET_LEGACY_6_24,
  10191. -@@ -1089,11 +1075,6 @@ static bool ar9003_hw_ani_control(struct
  10192. +@@ -1095,11 +1081,6 @@ static bool ar9003_hw_ani_control(struct
  10193. struct ath_common *common = ath9k_hw_common(ah);
  10194. struct ath9k_channel *chan = ah->curchan;
  10195. struct ar5416AniState *aniState = &ah->ani;
  10196. @@ -91,7 +91,7 @@
  10197. s32 value, value2;
  10198. switch (cmd & ah->ani_function) {
  10199. -@@ -1107,61 +1088,6 @@ static bool ar9003_hw_ani_control(struct
  10200. +@@ -1113,61 +1094,6 @@ static bool ar9003_hw_ani_control(struct
  10201. */
  10202. u32 on = param ? 1 : 0;
  10203. diff --git a/package/kernel/mac80211/patches/546-ath9k_platform_led_name.patch b/package/kernel/mac80211/patches/546-ath9k_platform_led_name.patch
  10204. new file mode 100644
  10205. index 0000000..ced72c6
  10206. --- /dev/null
  10207. +++ b/package/kernel/mac80211/patches/546-ath9k_platform_led_name.patch
  10208. @@ -0,0 +1,39 @@
  10209. +From: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  10210. +Date: Sun, 31 Jan 2016 20:45:57 +0100
  10211. +Subject: [PATCH v4 1/8] mac80211: ath9k: enable platform WLAN LED name
  10212. +
  10213. +Enable platform-supplied WLAN LED name for ath9k device. It replaces generic
  10214. +'ath9k-phy*' label with string set during platform initialization.
  10215. +
  10216. +Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  10217. +---
  10218. + drivers/net/wireless/ath/ath9k/gpio.c | 10 +++++++---
  10219. + include/linux/ath9k_platform.h | 1 +
  10220. + 2 files changed, 8 insertions(+), 3 deletions(-)
  10221. +
  10222. +--- a/drivers/net/wireless/ath/ath9k/gpio.c
  10223. ++++ b/drivers/net/wireless/ath/ath9k/gpio.c
  10224. +@@ -155,8 +155,11 @@ void ath_init_leds(struct ath_softc *sc)
  10225. +
  10226. + ath_fill_led_pin(sc);
  10227. +
  10228. +- snprintf(led_name, sizeof(led_name), "ath9k-%s",
  10229. +- wiphy_name(sc->hw->wiphy));
  10230. ++ if (pdata && pdata->led_name)
  10231. ++ strncpy(led_name, pdata->led_name, sizeof(led_name));
  10232. ++ else
  10233. ++ snprintf(led_name, sizeof(led_name), "ath9k-%s",
  10234. ++ wiphy_name(sc->hw->wiphy));
  10235. +
  10236. + if (ath9k_led_blink)
  10237. + trigger = sc->led_default_trigger;
  10238. +--- a/include/linux/ath9k_platform.h
  10239. ++++ b/include/linux/ath9k_platform.h
  10240. +@@ -49,6 +49,7 @@ struct ath9k_platform_data {
  10241. +
  10242. + int num_leds;
  10243. + const struct gpio_led *leds;
  10244. ++ const char *led_name;
  10245. + };
  10246. +
  10247. + #endif /* _LINUX_ATH9K_PLATFORM_H */
  10248. diff --git a/package/kernel/mac80211/patches/547-ath9k_led_defstate_fix.patch b/package/kernel/mac80211/patches/547-ath9k_led_defstate_fix.patch
  10249. new file mode 100644
  10250. index 0000000..5d84cf0
  10251. --- /dev/null
  10252. +++ b/package/kernel/mac80211/patches/547-ath9k_led_defstate_fix.patch
  10253. @@ -0,0 +1,29 @@
  10254. +From: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  10255. +Date: Sun, 31 Jan 2016 20:48:49 +0100
  10256. +Subject: [PATCH v4 2/8] mac80211: ath9k: set default state for platform LEDs
  10257. +
  10258. +Support default state for platform LEDs connected to ath9k device.
  10259. +Now LEDs are correctly set on or off at ath9k module initialization.
  10260. +Very useful if power LED is connected to wireless chip.
  10261. +
  10262. +Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  10263. +---
  10264. + gpio.c | 7 +++++--
  10265. + 1 file changed, 5 insertions(+), 2 deletions(-)
  10266. +
  10267. +--- a/drivers/net/wireless/ath/ath9k/gpio.c
  10268. ++++ b/drivers/net/wireless/ath/ath9k/gpio.c
  10269. +@@ -74,8 +74,11 @@ static int ath_add_led(struct ath_softc
  10270. + ath9k_hw_gpio_request_out(sc->sc_ah, gpio->gpio, gpio->name,
  10271. + AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
  10272. +
  10273. +- /* LED off */
  10274. +- ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low);
  10275. ++ /* Set default LED state */
  10276. ++ if (gpio->default_state == LEDS_GPIO_DEFSTATE_ON)
  10277. ++ ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, !gpio->active_low);
  10278. ++ else
  10279. ++ ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low);
  10280. +
  10281. + return 0;
  10282. + }
  10283. diff --git a/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch b/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch
  10284. new file mode 100644
  10285. index 0000000..de7c0ac
  10286. --- /dev/null
  10287. +++ b/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch
  10288. @@ -0,0 +1,234 @@
  10289. +From: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  10290. +Date: Sun, 31 Jan 2016 21:01:31 +0100
  10291. +Subject: [PATCH v4 4/8] mac80211: ath9k: enable access to GPIO
  10292. +
  10293. +Enable access to GPIO chip and its pins for Atheros AR92xx
  10294. +wireless devices. For now AR9285 and AR9287 are supported.
  10295. +
  10296. +Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  10297. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  10298. +---
  10299. +--- a/drivers/net/wireless/ath/ath9k/ath9k.h
  10300. ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  10301. +@@ -24,6 +24,7 @@
  10302. + #include <linux/completion.h>
  10303. + #include <linux/time.h>
  10304. + #include <linux/hw_random.h>
  10305. ++#include <linux/gpio/driver.h>
  10306. +
  10307. + #include "common.h"
  10308. + #include "debug.h"
  10309. +@@ -960,6 +961,14 @@ struct ath_led {
  10310. + struct led_classdev cdev;
  10311. + };
  10312. +
  10313. ++#ifdef CONFIG_GPIOLIB
  10314. ++struct ath9k_gpio_chip {
  10315. ++ struct ath_softc *sc;
  10316. ++ char label[32];
  10317. ++ struct gpio_chip gchip;
  10318. ++};
  10319. ++#endif
  10320. ++
  10321. + struct ath_softc {
  10322. + struct ieee80211_hw *hw;
  10323. + struct device *dev;
  10324. +@@ -1014,6 +1023,9 @@ struct ath_softc {
  10325. + #ifdef CPTCFG_MAC80211_LEDS
  10326. + const char *led_default_trigger;
  10327. + struct list_head leds;
  10328. ++#ifdef CONFIG_GPIOLIB
  10329. ++ struct ath9k_gpio_chip *gpiochip;
  10330. ++#endif
  10331. + #endif
  10332. +
  10333. + #ifdef CPTCFG_ATH9K_DEBUGFS
  10334. +--- a/drivers/net/wireless/ath/ath9k/gpio.c
  10335. ++++ b/drivers/net/wireless/ath/ath9k/gpio.c
  10336. +@@ -16,13 +16,135 @@
  10337. +
  10338. + #include "ath9k.h"
  10339. + #include <linux/ath9k_platform.h>
  10340. ++#include <linux/gpio.h>
  10341. ++
  10342. ++#ifdef CPTCFG_MAC80211_LEDS
  10343. ++
  10344. ++#ifdef CONFIG_GPIOLIB
  10345. ++
  10346. ++/***************/
  10347. ++/* GPIO Chip */
  10348. ++/***************/
  10349. ++
  10350. ++/* gpio_chip handler : set GPIO to input */
  10351. ++static int ath9k_gpio_pin_cfg_input(struct gpio_chip *chip, unsigned offset)
  10352. ++{
  10353. ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip,
  10354. ++ gchip);
  10355. ++
  10356. ++ ath9k_hw_gpio_request_in(gc->sc->sc_ah, offset, "ath9k-gpio");
  10357. ++
  10358. ++ return 0;
  10359. ++}
  10360. ++
  10361. ++/* gpio_chip handler : set GPIO to output */
  10362. ++static int ath9k_gpio_pin_cfg_output(struct gpio_chip *chip, unsigned offset,
  10363. ++ int value)
  10364. ++{
  10365. ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip,
  10366. ++ gchip);
  10367. ++
  10368. ++ ath9k_hw_gpio_request_out(gc->sc->sc_ah, offset, "ath9k-gpio",
  10369. ++ AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
  10370. ++ ath9k_hw_set_gpio(gc->sc->sc_ah, offset, value);
  10371. ++
  10372. ++ return 0;
  10373. ++}
  10374. ++
  10375. ++/* gpio_chip handler : query GPIO direction (0=out, 1=in) */
  10376. ++static int ath9k_gpio_pin_get_dir(struct gpio_chip *chip, unsigned offset)
  10377. ++{
  10378. ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip,
  10379. ++ gchip);
  10380. ++ struct ath_hw *ah = gc->sc->sc_ah;
  10381. ++
  10382. ++ return !((REG_READ(ah, AR_GPIO_OE_OUT) >> (offset * 2)) & 3);
  10383. ++}
  10384. ++
  10385. ++/* gpio_chip handler : get GPIO pin value */
  10386. ++static int ath9k_gpio_pin_get(struct gpio_chip *chip, unsigned offset)
  10387. ++{
  10388. ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip,
  10389. ++ gchip);
  10390. ++
  10391. ++ return ath9k_hw_gpio_get(gc->sc->sc_ah, offset);
  10392. ++}
  10393. ++
  10394. ++/* gpio_chip handler : set GPIO pin to value */
  10395. ++static void ath9k_gpio_pin_set(struct gpio_chip *chip, unsigned offset,
  10396. ++ int value)
  10397. ++{
  10398. ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip,
  10399. ++ gchip);
  10400. ++
  10401. ++ ath9k_hw_set_gpio(gc->sc->sc_ah, offset, value);
  10402. ++}
  10403. ++
  10404. ++/* register GPIO chip */
  10405. ++static void ath9k_register_gpio_chip(struct ath_softc *sc)
  10406. ++{
  10407. ++ struct ath9k_gpio_chip *gc;
  10408. ++ struct ath_hw *ah = sc->sc_ah;
  10409. ++
  10410. ++ gc = kzalloc(sizeof(struct ath9k_gpio_chip), GFP_KERNEL);
  10411. ++ if (!gc)
  10412. ++ return;
  10413. ++
  10414. ++ snprintf(gc->label, sizeof(gc->label), "ath9k-%s",
  10415. ++ wiphy_name(sc->hw->wiphy));
  10416. ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0)
  10417. ++ gc->gchip.parent = sc->dev;
  10418. ++#else
  10419. ++ gc->gchip.dev = sc->dev;
  10420. ++#endif
  10421. ++ gc->gchip.label = gc->label;
  10422. ++ gc->gchip.base = -1; /* determine base automatically */
  10423. ++ gc->gchip.ngpio = ah->caps.num_gpio_pins;
  10424. ++ gc->gchip.direction_input = ath9k_gpio_pin_cfg_input;
  10425. ++ gc->gchip.direction_output = ath9k_gpio_pin_cfg_output;
  10426. ++ gc->gchip.get_direction = ath9k_gpio_pin_get_dir;
  10427. ++ gc->gchip.get = ath9k_gpio_pin_get;
  10428. ++ gc->gchip.set = ath9k_gpio_pin_set;
  10429. ++
  10430. ++ if (gpiochip_add(&gc->gchip)) {
  10431. ++ kfree(gc);
  10432. ++ return;
  10433. ++ }
  10434. ++
  10435. ++ gc->gchip.owner = NULL;
  10436. ++ sc->gpiochip = gc;
  10437. ++ gc->sc = sc;
  10438. ++}
  10439. ++
  10440. ++/* remove GPIO chip */
  10441. ++static void ath9k_unregister_gpio_chip(struct ath_softc *sc)
  10442. ++{
  10443. ++ struct ath9k_gpio_chip *gc = sc->gpiochip;
  10444. ++
  10445. ++ if (!gc)
  10446. ++ return;
  10447. ++
  10448. ++ gpiochip_remove(&gc->gchip);
  10449. ++ kfree(gc);
  10450. ++ sc->gpiochip = NULL;
  10451. ++}
  10452. ++
  10453. ++#else /* CONFIG_GPIOLIB */
  10454. ++
  10455. ++static inline void ath9k_register_gpio_chip(struct ath_softc *sc)
  10456. ++{
  10457. ++}
  10458. ++
  10459. ++static inline void ath9k_unregister_gpio_chip(struct ath_softc *sc)
  10460. ++{
  10461. ++}
  10462. ++
  10463. ++#endif /* CONFIG_GPIOLIB */
  10464. +
  10465. + /********************************/
  10466. + /* LED functions */
  10467. + /********************************/
  10468. +
  10469. +-#ifdef CPTCFG_MAC80211_LEDS
  10470. +-
  10471. + static void ath_fill_led_pin(struct ath_softc *sc)
  10472. + {
  10473. + struct ath_hw *ah = sc->sc_ah;
  10474. +@@ -80,6 +202,12 @@ static int ath_add_led(struct ath_softc
  10475. + else
  10476. + ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low);
  10477. +
  10478. ++#ifdef CONFIG_GPIOLIB
  10479. ++ /* If there is GPIO chip configured, reserve LED pin */
  10480. ++ if (sc->gpiochip)
  10481. ++ gpio_request(sc->gpiochip->gchip.base + gpio->gpio, gpio->name);
  10482. ++#endif
  10483. ++
  10484. + return 0;
  10485. + }
  10486. +
  10487. +@@ -136,12 +264,18 @@ void ath_deinit_leds(struct ath_softc *s
  10488. +
  10489. + while (!list_empty(&sc->leds)) {
  10490. + led = list_first_entry(&sc->leds, struct ath_led, list);
  10491. ++#ifdef CONFIG_GPIOLIB
  10492. ++ /* If there is GPIO chip configured, free LED pin */
  10493. ++ if (sc->gpiochip)
  10494. ++ gpio_free(sc->gpiochip->gchip.base + led->gpio->gpio);
  10495. ++#endif
  10496. + list_del(&led->list);
  10497. + ath_led_brightness(&led->cdev, LED_OFF);
  10498. + led_classdev_unregister(&led->cdev);
  10499. + ath9k_hw_gpio_free(sc->sc_ah, led->gpio->gpio);
  10500. + kfree(led);
  10501. + }
  10502. ++ ath9k_unregister_gpio_chip(sc);
  10503. + }
  10504. +
  10505. + void ath_init_leds(struct ath_softc *sc)
  10506. +@@ -158,6 +292,8 @@ void ath_init_leds(struct ath_softc *sc)
  10507. +
  10508. + ath_fill_led_pin(sc);
  10509. +
  10510. ++ ath9k_register_gpio_chip(sc);
  10511. ++
  10512. + if (pdata && pdata->led_name)
  10513. + strncpy(led_name, pdata->led_name, sizeof(led_name));
  10514. + else
  10515. +@@ -178,6 +314,7 @@ void ath_init_leds(struct ath_softc *sc)
  10516. + for (i = 0; i < pdata->num_leds; i++)
  10517. + ath_create_platform_led(sc, &pdata->leds[i]);
  10518. + }
  10519. ++
  10520. + #endif
  10521. +
  10522. + /*******************/
  10523. diff --git a/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch b/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch
  10524. new file mode 100644
  10525. index 0000000..b9d1883
  10526. --- /dev/null
  10527. +++ b/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch
  10528. @@ -0,0 +1,149 @@
  10529. +From: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  10530. +Subject: [PATCH v5 5/8] mac80211: ath9k: enable GPIO buttons
  10531. +
  10532. +Enable platform-defined GPIO button support for ath9k device.
  10533. +Key poller is activated for attached platform buttons.
  10534. +Requires ath9k GPIO chip access.
  10535. +
  10536. +Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  10537. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  10538. +---
  10539. +--- a/drivers/net/wireless/ath/ath9k/ath9k.h
  10540. ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  10541. +@@ -1025,6 +1025,7 @@ struct ath_softc {
  10542. + struct list_head leds;
  10543. + #ifdef CONFIG_GPIOLIB
  10544. + struct ath9k_gpio_chip *gpiochip;
  10545. ++ struct platform_device *btnpdev; /* gpio-keys-polled */
  10546. + #endif
  10547. + #endif
  10548. +
  10549. +--- a/drivers/net/wireless/ath/ath9k/gpio.c
  10550. ++++ b/drivers/net/wireless/ath/ath9k/gpio.c
  10551. +@@ -17,6 +17,8 @@
  10552. + #include "ath9k.h"
  10553. + #include <linux/ath9k_platform.h>
  10554. + #include <linux/gpio.h>
  10555. ++#include <linux/platform_device.h>
  10556. ++#include <linux/gpio_keys.h>
  10557. +
  10558. + #ifdef CPTCFG_MAC80211_LEDS
  10559. +
  10560. +@@ -129,6 +131,64 @@ static void ath9k_unregister_gpio_chip(s
  10561. + sc->gpiochip = NULL;
  10562. + }
  10563. +
  10564. ++/******************/
  10565. ++/* GPIO Buttons */
  10566. ++/******************/
  10567. ++
  10568. ++/* add GPIO buttons */
  10569. ++static void ath9k_init_buttons(struct ath_softc *sc)
  10570. ++{
  10571. ++ struct ath9k_platform_data *pdata = sc->dev->platform_data;
  10572. ++ struct platform_device *pdev;
  10573. ++ struct gpio_keys_platform_data gkpdata;
  10574. ++ struct gpio_keys_button *bt;
  10575. ++ int i;
  10576. ++
  10577. ++ if (!sc->gpiochip)
  10578. ++ return;
  10579. ++
  10580. ++ if (!pdata || !pdata->btns || !pdata->num_btns)
  10581. ++ return;
  10582. ++
  10583. ++ bt = devm_kmemdup(sc->dev, pdata->btns,
  10584. ++ pdata->num_btns * sizeof(struct gpio_keys_button),
  10585. ++ GFP_KERNEL);
  10586. ++ if (!bt)
  10587. ++ return;
  10588. ++
  10589. ++ for (i = 0; i < pdata->num_btns; i++) {
  10590. ++ ath9k_hw_gpio_request_in(sc->sc_ah, pdata->btns[i].gpio,
  10591. ++ "ath9k-gpio");
  10592. ++ bt[i].gpio = sc->gpiochip->gchip.base + pdata->btns[i].gpio;
  10593. ++ }
  10594. ++
  10595. ++ memset(&gkpdata, 0, sizeof(struct gpio_keys_platform_data));
  10596. ++ gkpdata.buttons = bt;
  10597. ++ gkpdata.nbuttons = pdata->num_btns;
  10598. ++ gkpdata.poll_interval = pdata->btn_poll_interval;
  10599. ++
  10600. ++ pdev = platform_device_register_data(sc->dev, "gpio-keys-polled",
  10601. ++ PLATFORM_DEVID_AUTO, &gkpdata,
  10602. ++ sizeof(gkpdata));
  10603. ++ if (!IS_ERR_OR_NULL(pdev))
  10604. ++ sc->btnpdev = pdev;
  10605. ++ else {
  10606. ++ sc->btnpdev = NULL;
  10607. ++ devm_kfree(sc->dev, bt);
  10608. ++ }
  10609. ++}
  10610. ++
  10611. ++/* remove GPIO buttons */
  10612. ++static void ath9k_deinit_buttons(struct ath_softc *sc)
  10613. ++{
  10614. ++ if (!sc->gpiochip || !sc->btnpdev)
  10615. ++ return;
  10616. ++
  10617. ++ platform_device_unregister(sc->btnpdev);
  10618. ++
  10619. ++ sc->btnpdev = NULL;
  10620. ++}
  10621. ++
  10622. + #else /* CONFIG_GPIOLIB */
  10623. +
  10624. + static inline void ath9k_register_gpio_chip(struct ath_softc *sc)
  10625. +@@ -139,6 +199,14 @@ static inline void ath9k_unregister_gpio
  10626. + {
  10627. + }
  10628. +
  10629. ++static inline void ath9k_init_buttons(struct ath_softc *sc)
  10630. ++{
  10631. ++}
  10632. ++
  10633. ++static inline void ath9k_deinit_buttons(struct ath_softc *sc)
  10634. ++{
  10635. ++}
  10636. ++
  10637. + #endif /* CONFIG_GPIOLIB */
  10638. +
  10639. + /********************************/
  10640. +@@ -262,6 +330,7 @@ void ath_deinit_leds(struct ath_softc *s
  10641. + {
  10642. + struct ath_led *led;
  10643. +
  10644. ++ ath9k_deinit_buttons(sc);
  10645. + while (!list_empty(&sc->leds)) {
  10646. + led = list_first_entry(&sc->leds, struct ath_led, list);
  10647. + #ifdef CONFIG_GPIOLIB
  10648. +@@ -293,6 +362,7 @@ void ath_init_leds(struct ath_softc *sc)
  10649. + ath_fill_led_pin(sc);
  10650. +
  10651. + ath9k_register_gpio_chip(sc);
  10652. ++ ath9k_init_buttons(sc);
  10653. +
  10654. + if (pdata && pdata->led_name)
  10655. + strncpy(led_name, pdata->led_name, sizeof(led_name));
  10656. +@@ -308,7 +378,7 @@ void ath_init_leds(struct ath_softc *sc)
  10657. + ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger,
  10658. + !sc->sc_ah->config.led_active_high);
  10659. +
  10660. +- if (!pdata)
  10661. ++ if (!pdata || !pdata->leds || !pdata->num_leds)
  10662. + return;
  10663. +
  10664. + for (i = 0; i < pdata->num_leds; i++)
  10665. +--- a/include/linux/ath9k_platform.h
  10666. ++++ b/include/linux/ath9k_platform.h
  10667. +@@ -50,6 +50,10 @@ struct ath9k_platform_data {
  10668. + int num_leds;
  10669. + const struct gpio_led *leds;
  10670. + const char *led_name;
  10671. ++
  10672. ++ unsigned num_btns;
  10673. ++ const struct gpio_keys_button *btns;
  10674. ++ unsigned btn_poll_interval;
  10675. + };
  10676. +
  10677. + #endif /* _LINUX_ATH9K_PLATFORM_H */
  10678. 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
  10679. index 8245909..db70a33 100644
  10680. --- a/package/kernel/mac80211/patches/600-0002-rt2x00-rt2800lib-introduce-RT2800_HAS_HIGH_SHARED_ME.patch
  10681. +++ b/package/kernel/mac80211/patches/600-0002-rt2x00-rt2800lib-introduce-RT2800_HAS_HIGH_SHARED_ME.patch
  10682. @@ -24,7 +24,7 @@ Changes since v1:
  10683. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  10684. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  10685. -@@ -7722,6 +7722,7 @@ static int rt2800_probe_rt(struct rt2x00
  10686. +@@ -7726,6 +7726,7 @@ static int rt2800_probe_rt(struct rt2x00
  10687. int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev)
  10688. {
  10689. @@ -32,7 +32,7 @@ Changes since v1:
  10690. int retval;
  10691. u32 reg;
  10692. -@@ -7729,6 +7730,9 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  10693. +@@ -7733,6 +7734,9 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  10694. if (retval)
  10695. return retval;
  10696. 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
  10697. index 7abfcd1..a3b62bc 100644
  10698. --- a/package/kernel/mac80211/patches/600-0003-rt2x00-rt2800-serialize-shared-memory-access.patch
  10699. +++ b/package/kernel/mac80211/patches/600-0003-rt2x00-rt2800-serialize-shared-memory-access.patch
  10700. @@ -239,7 +239,7 @@ Changes since v1: ---
  10701. msleep(1);
  10702. /*
  10703. -@@ -7726,6 +7774,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  10704. +@@ -7730,6 +7778,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  10705. int retval;
  10706. u32 reg;
  10707. @@ -248,7 +248,7 @@ Changes since v1: ---
  10708. retval = rt2800_probe_rt(rt2x00dev);
  10709. if (retval)
  10710. return retval;
  10711. -@@ -7809,8 +7859,11 @@ void rt2800_get_key_seq(struct ieee80211
  10712. +@@ -7813,8 +7863,11 @@ void rt2800_get_key_seq(struct ieee80211
  10713. return;
  10714. offset = MAC_IVEIV_ENTRY(key->hw_key_idx);
  10715. 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
  10716. index 02b2acf..f41a160 100644
  10717. --- a/package/kernel/mac80211/patches/600-0005-rt2x00-rt2800lib-add-hw_beacon_count-field-to-struct.patch
  10718. +++ b/package/kernel/mac80211/patches/600-0005-rt2x00-rt2800lib-add-hw_beacon_count-field-to-struct.patch
  10719. @@ -41,7 +41,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  10720. rt2800_clear_beacon_register(rt2x00dev, i);
  10721. if (rt2x00_is_usb(rt2x00dev)) {
  10722. -@@ -7827,6 +7828,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  10723. +@@ -7831,6 +7832,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  10724. if (rt2x00_rt(rt2x00dev, RT3593))
  10725. __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  10726. 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
  10727. index e909272..5099c64 100644
  10728. --- a/package/kernel/mac80211/patches/600-0007-rt2x00-rt2800lib-fix-max-supported-beacon-count-for-.patch
  10729. +++ b/package/kernel/mac80211/patches/600-0007-rt2x00-rt2800lib-fix-max-supported-beacon-count-for-.patch
  10730. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  10731. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  10732. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  10733. -@@ -7852,7 +7852,10 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  10734. +@@ -7856,7 +7856,10 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  10735. if (rt2x00_rt(rt2x00dev, RT3593))
  10736. __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  10737. 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
  10738. index 7fe38e0..a2e7015 100644
  10739. --- a/package/kernel/mac80211/patches/600-0009-rt2x00-rt2800lib-enable-support-for-RT3883.patch
  10740. +++ b/package/kernel/mac80211/patches/600-0009-rt2x00-rt2800lib-enable-support-for-RT3883.patch
  10741. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  10742. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  10743. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  10744. -@@ -7822,6 +7822,7 @@ static int rt2800_probe_rt(struct rt2x00
  10745. +@@ -7826,6 +7826,7 @@ static int rt2800_probe_rt(struct rt2x00
  10746. case RT3390:
  10747. case RT3572:
  10748. case RT3593:
  10749. 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
  10750. index 253a0c0..89bd0ac 100644
  10751. --- a/package/kernel/mac80211/patches/600-0010-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch
  10752. +++ b/package/kernel/mac80211/patches/600-0010-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch
  10753. @@ -98,7 +98,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  10754. static const struct rf_channel rf_vals_5592_xtal20[] = {
  10755. /* Channel, N, K, mod, R */
  10756. {1, 482, 4, 10, 3},
  10757. -@@ -7669,6 +7729,11 @@ static int rt2800_probe_hw_mode(struct r
  10758. +@@ -7673,6 +7733,11 @@ static int rt2800_probe_hw_mode(struct r
  10759. spec->channels = rf_vals_3x;
  10760. break;
  10761. 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
  10762. index f15c22b..b7efc9f 100644
  10763. --- a/package/kernel/mac80211/patches/600-0011-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch
  10764. +++ b/package/kernel/mac80211/patches/600-0011-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch
  10765. @@ -18,7 +18,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  10766. case RF5360:
  10767. case RF5362:
  10768. case RF5370:
  10769. -@@ -7848,6 +7849,7 @@ static int rt2800_probe_hw_mode(struct r
  10770. +@@ -7852,6 +7853,7 @@ static int rt2800_probe_hw_mode(struct r
  10771. case RF3053:
  10772. case RF3070:
  10773. case RF3290:
  10774. 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
  10775. index 6ce224a..220e35f 100644
  10776. --- a/package/kernel/mac80211/patches/600-0026-rt2x00-rt2800lib-use-correct-beacon-count-for-RT3883.patch
  10777. +++ b/package/kernel/mac80211/patches/600-0026-rt2x00-rt2800lib-use-correct-beacon-count-for-RT3883.patch
  10778. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  10779. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  10780. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  10781. -@@ -8403,7 +8403,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  10782. +@@ -8407,7 +8407,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  10783. if (rt2x00_rt(rt2x00dev, RT3593))
  10784. __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  10785. 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
  10786. index 25753af..2ffa5a4 100644
  10787. --- a/package/kernel/mac80211/patches/600-0032-rt2x00-rt2800lib-enable-RT2800_HAS_HIGH_SHARED_MEM-f.patch
  10788. +++ b/package/kernel/mac80211/patches/600-0032-rt2x00-rt2800lib-enable-RT2800_HAS_HIGH_SHARED_MEM-f.patch
  10789. @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  10790. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  10791. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  10792. -@@ -8416,7 +8416,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  10793. +@@ -8420,7 +8420,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  10794. if (retval)
  10795. return retval;
  10796. 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
  10797. index 7a183a4..daa5dc6 100644
  10798. --- a/package/kernel/mac80211/patches/602-rt2x00-introduce-rt2x00_platform_h.patch
  10799. +++ b/package/kernel/mac80211/patches/602-rt2x00-introduce-rt2x00_platform_h.patch
  10800. @@ -22,10 +22,10 @@
  10801. +#endif /* _RT2X00_PLATFORM_H */
  10802. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  10803. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  10804. -@@ -38,6 +38,7 @@
  10805. - #include <linux/kfifo.h>
  10806. +@@ -39,6 +39,7 @@
  10807. #include <linux/hrtimer.h>
  10808. #include <linux/average.h>
  10809. + #include <linux/usb.h>
  10810. +#include <linux/rt2x00_platform.h>
  10811. #include <net/mac80211.h>
  10812. diff --git a/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch b/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
  10813. index bc056cd..8ae5da3 100644
  10814. --- a/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
  10815. +++ b/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
  10816. @@ -1,6 +1,6 @@
  10817. --- a/.local-symbols
  10818. +++ b/.local-symbols
  10819. -@@ -329,6 +329,7 @@ RT2X00_LIB_FIRMWARE=
  10820. +@@ -331,6 +331,7 @@ RT2X00_LIB_FIRMWARE=
  10821. RT2X00_LIB_CRYPTO=
  10822. RT2X00_LIB_LEDS=
  10823. RT2X00_LIB_DEBUGFS=
  10824. @@ -105,7 +105,7 @@
  10825. .drv_init_registers = rt2800mmio_init_registers,
  10826. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  10827. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  10828. -@@ -697,6 +697,7 @@ enum rt2x00_capability_flags {
  10829. +@@ -699,6 +699,7 @@ enum rt2x00_capability_flags {
  10830. REQUIRE_HT_TX_DESC,
  10831. REQUIRE_PS_AUTOWAKE,
  10832. REQUIRE_DELAYED_RFKILL,
  10833. @@ -127,7 +127,7 @@
  10834. DECLARE_KFIFO_PTR(txstatus_fifo, u32);
  10835. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  10836. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  10837. -@@ -1335,6 +1335,10 @@ int rt2x00lib_probe_dev(struct rt2x00_de
  10838. +@@ -1334,6 +1334,10 @@ int rt2x00lib_probe_dev(struct rt2x00_de
  10839. INIT_DELAYED_WORK(&rt2x00dev->autowakeup_work, rt2x00lib_autowakeup);
  10840. INIT_WORK(&rt2x00dev->sleep_work, rt2x00lib_sleep);
  10841. @@ -138,7 +138,7 @@
  10842. /*
  10843. * Let the driver probe the device to detect the capabilities.
  10844. */
  10845. -@@ -1475,6 +1479,11 @@ void rt2x00lib_remove_dev(struct rt2x00_
  10846. +@@ -1477,6 +1481,11 @@ void rt2x00lib_remove_dev(struct rt2x00_
  10847. * Free the driver data.
  10848. */
  10849. kfree(rt2x00dev->drv_data);
  10850. 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
  10851. index d923e05..a2e1faf 100644
  10852. --- a/package/kernel/mac80211/patches/607-rt2x00-allow_disabling_bands_through_platform_data.patch
  10853. +++ b/package/kernel/mac80211/patches/607-rt2x00-allow_disabling_bands_through_platform_data.patch
  10854. @@ -37,7 +37,7 @@
  10855. num_rates += 4;
  10856. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  10857. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  10858. -@@ -405,6 +405,7 @@ struct hw_mode_spec {
  10859. +@@ -406,6 +406,7 @@ struct hw_mode_spec {
  10860. unsigned int supported_bands;
  10861. #define SUPPORT_BAND_2GHZ 0x00000001
  10862. #define SUPPORT_BAND_5GHZ 0x00000002
  10863. 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
  10864. index a645ba1..6704ff8 100644
  10865. --- a/package/kernel/mac80211/patches/608-add_platform_data_mac_addr.patch
  10866. +++ b/package/kernel/mac80211/patches/608-add_platform_data_mac_addr.patch
  10867. @@ -31,7 +31,7 @@
  10868. {
  10869. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  10870. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  10871. -@@ -1414,6 +1414,7 @@ static inline void rt2x00debug_dump_fram
  10872. +@@ -1416,6 +1416,7 @@ static inline void rt2x00debug_dump_fram
  10873. */
  10874. u32 rt2x00lib_get_bssidx(struct rt2x00_dev *rt2x00dev,
  10875. struct ieee80211_vif *vif);
  10876. 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
  10877. index c69d330..9f10fe3 100644
  10878. --- a/package/kernel/mac80211/patches/610-rt2x00-fix-rt3352-ext-pa.patch
  10879. +++ b/package/kernel/mac80211/patches/610-rt2x00-fix-rt3352-ext-pa.patch
  10880. @@ -200,7 +200,7 @@
  10881. * EEPROM frequency
  10882. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  10883. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  10884. -@@ -717,6 +717,8 @@ enum rt2x00_capability_flags {
  10885. +@@ -719,6 +719,8 @@ enum rt2x00_capability_flags {
  10886. CAPABILITY_DOUBLE_ANTENNA,
  10887. CAPABILITY_BT_COEXIST,
  10888. CAPABILITY_VCO_RECALIBRATION,
  10889. 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
  10890. index b44fe90..860fdc0 100644
  10891. --- a/package/kernel/mac80211/patches/611-rt2x00-rf_vals-rt3352-xtal20.patch
  10892. +++ b/package/kernel/mac80211/patches/611-rt2x00-rf_vals-rt3352-xtal20.patch
  10893. @@ -28,7 +28,7 @@
  10894. static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
  10895. {
  10896. struct hw_mode_spec *spec = &rt2x00dev->spec;
  10897. -@@ -8272,7 +8293,10 @@ static int rt2800_probe_hw_mode(struct r
  10898. +@@ -8276,7 +8297,10 @@ static int rt2800_probe_hw_mode(struct r
  10899. case RF5390:
  10900. case RF5392:
  10901. spec->num_channels = 14;
  10902. @@ -40,7 +40,7 @@
  10903. break;
  10904. case RF3052:
  10905. -@@ -8456,6 +8480,19 @@ static int rt2800_probe_rt(struct rt2x00
  10906. +@@ -8460,6 +8484,19 @@ static int rt2800_probe_rt(struct rt2x00
  10907. return 0;
  10908. }
  10909. @@ -60,7 +60,7 @@
  10910. int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev)
  10911. {
  10912. struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
  10913. -@@ -8498,6 +8535,15 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  10914. +@@ -8502,6 +8539,15 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  10915. rt2800_register_write(rt2x00dev, GPIO_CTRL, reg);
  10916. /*
  10917. @@ -78,7 +78,7 @@
  10918. retval = rt2800_probe_hw_mode(rt2x00dev);
  10919. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  10920. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  10921. -@@ -400,6 +400,7 @@ static inline struct rt2x00_intf* vif_to
  10922. +@@ -401,6 +401,7 @@ static inline struct rt2x00_intf* vif_to
  10923. * @channels: Device/chipset specific channel values (See &struct rf_channel).
  10924. * @channels_info: Additional information for channels (See &struct channel_info).
  10925. * @ht: Driver HT Capabilities (See &ieee80211_sta_ht_cap).
  10926. @@ -86,7 +86,7 @@
  10927. */
  10928. struct hw_mode_spec {
  10929. unsigned int supported_bands;
  10930. -@@ -416,6 +417,7 @@ struct hw_mode_spec {
  10931. +@@ -417,6 +418,7 @@ struct hw_mode_spec {
  10932. const struct channel_info *channels_info;
  10933. struct ieee80211_sta_ht_cap ht;
  10934. diff --git a/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch b/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
  10935. index 8e3bd2a..e7b2a8c 100644
  10936. --- a/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
  10937. +++ b/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
  10938. @@ -8,7 +8,7 @@
  10939. #include "rt2x00.h"
  10940. #include "rt2800lib.h"
  10941. -@@ -8482,13 +8483,14 @@ static int rt2800_probe_rt(struct rt2x00
  10942. +@@ -8486,13 +8487,14 @@ static int rt2800_probe_rt(struct rt2x00
  10943. int rt2800_probe_clk(struct rt2x00_dev *rt2x00dev)
  10944. {
  10945. diff --git a/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch b/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch
  10946. index faa5879..44bd8a1 100644
  10947. --- a/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch
  10948. +++ b/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch
  10949. @@ -240,7 +240,7 @@
  10950. case RF5360:
  10951. case RF5362:
  10952. case RF5370:
  10953. -@@ -8287,6 +8398,7 @@ static int rt2800_probe_hw_mode(struct r
  10954. +@@ -8291,6 +8402,7 @@ static int rt2800_probe_hw_mode(struct r
  10955. case RF3290:
  10956. case RF3320:
  10957. case RF3322:
  10958. @@ -248,7 +248,7 @@
  10959. case RF5360:
  10960. case RF5362:
  10961. case RF5370:
  10962. -@@ -8426,6 +8538,7 @@ static int rt2800_probe_hw_mode(struct r
  10963. +@@ -8430,6 +8542,7 @@ static int rt2800_probe_hw_mode(struct r
  10964. case RF3070:
  10965. case RF3290:
  10966. case RF3853:
  10967. @@ -256,7 +256,7 @@
  10968. case RF5360:
  10969. case RF5362:
  10970. case RF5370:
  10971. -@@ -8466,6 +8579,7 @@ static int rt2800_probe_rt(struct rt2x00
  10972. +@@ -8470,6 +8583,7 @@ static int rt2800_probe_rt(struct rt2x00
  10973. case RT3572:
  10974. case RT3593:
  10975. case RT3883:
  10976. @@ -266,7 +266,7 @@
  10977. case RT5592:
  10978. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  10979. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  10980. -@@ -169,6 +169,7 @@ struct rt2x00_chip {
  10981. +@@ -170,6 +170,7 @@ struct rt2x00_chip {
  10982. #define RT3572 0x3572
  10983. #define RT3593 0x3593
  10984. #define RT3883 0x3883 /* WSOC */
  10985. 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
  10986. index 55452b9..dba6033 100644
  10987. --- a/package/kernel/mac80211/patches/620-rt2x00-add-AP+STA-support.patch
  10988. +++ b/package/kernel/mac80211/patches/620-rt2x00-add-AP+STA-support.patch
  10989. @@ -1,6 +1,6 @@
  10990. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  10991. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  10992. -@@ -1284,7 +1284,7 @@ static inline void rt2x00lib_set_if_comb
  10993. +@@ -1283,7 +1283,7 @@ static inline void rt2x00lib_set_if_comb
  10994. */
  10995. if_limit = &rt2x00dev->if_limits_ap;
  10996. if_limit->max = rt2x00dev->ops->max_ap_intf;
  10997. diff --git a/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch b/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
  10998. index fd885cc..02f3053 100644
  10999. --- a/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
  11000. +++ b/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
  11001. @@ -1,6 +1,6 @@
  11002. --- a/drivers/net/wireless/marvell/libertas/cfg.c
  11003. +++ b/drivers/net/wireless/marvell/libertas/cfg.c
  11004. -@@ -2084,6 +2084,8 @@ struct wireless_dev *lbs_cfg_alloc(struc
  11005. +@@ -2122,6 +2122,8 @@ struct wireless_dev *lbs_cfg_alloc(struc
  11006. goto err_wiphy_new;
  11007. }
  11008. diff --git a/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch b/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
  11009. index b67a95f..ad30608 100644
  11010. --- a/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
  11011. +++ b/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
  11012. @@ -1,6 +1,6 @@
  11013. --- a/drivers/net/wireless/marvell/libertas/cfg.c
  11014. +++ b/drivers/net/wireless/marvell/libertas/cfg.c
  11015. -@@ -2174,6 +2174,8 @@ int lbs_cfg_register(struct lbs_private
  11016. +@@ -2212,6 +2212,8 @@ int lbs_cfg_register(struct lbs_private
  11017. wdev->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
  11018. wdev->wiphy->reg_notifier = lbs_reg_notifier;
  11019. diff --git a/package/kernel/mac80211/patches/804-b43-sync-with-bcma.patch b/package/kernel/mac80211/patches/804-b43-sync-with-bcma.patch
  11020. deleted file mode 100644
  11021. index 74cd448..0000000
  11022. --- a/package/kernel/mac80211/patches/804-b43-sync-with-bcma.patch
  11023. +++ /dev/null
  11024. @@ -1,17 +0,0 @@
  11025. ---- a/drivers/net/wireless/broadcom/b43/main.c
  11026. -+++ b/drivers/net/wireless/broadcom/b43/main.c
  11027. -@@ -1215,10 +1215,10 @@ void b43_wireless_core_phy_pll_reset(str
  11028. - case B43_BUS_BCMA:
  11029. - bcma_cc = &dev->dev->bdev->bus->drv_cc;
  11030. -
  11031. -- bcma_cc_write32(bcma_cc, BCMA_CC_CHIPCTL_ADDR, 0);
  11032. -- bcma_cc_mask32(bcma_cc, BCMA_CC_CHIPCTL_DATA, ~0x4);
  11033. -- bcma_cc_set32(bcma_cc, BCMA_CC_CHIPCTL_DATA, 0x4);
  11034. -- bcma_cc_mask32(bcma_cc, BCMA_CC_CHIPCTL_DATA, ~0x4);
  11035. -+ bcma_cc_write32(bcma_cc, BCMA_CC_PMU_CHIPCTL_ADDR, 0);
  11036. -+ bcma_cc_mask32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, ~0x4);
  11037. -+ bcma_cc_set32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, 0x4);
  11038. -+ bcma_cc_mask32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, ~0x4);
  11039. - break;
  11040. - #endif
  11041. - #ifdef CPTCFG_B43_SSB
  11042. diff --git a/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch b/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch
  11043. index 06c731f..f8f555f 100644
  11044. --- a/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch
  11045. +++ b/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch
  11046. @@ -9,7 +9,7 @@
  11047. antenna = b43_antenna_to_phyctl(antenna);
  11048. ctl = b43_shm_read16(dev, B43_SHM_SHARED, B43_SHM_SH_BEACPHYCTL);
  11049. /* We can't send beacons with short preamble. Would get PHY errors. */
  11050. -@@ -3300,8 +3300,8 @@ static int b43_chip_init(struct b43_wlde
  11051. +@@ -3297,8 +3297,8 @@ static int b43_chip_init(struct b43_wlde
  11052. /* Select the antennae */
  11053. if (phy->ops->set_rx_antenna)
  11054. @@ -20,7 +20,7 @@
  11055. if (phy->type == B43_PHYTYPE_B) {
  11056. value16 = b43_read16(dev, 0x005E);
  11057. -@@ -4001,7 +4001,6 @@ static int b43_op_config(struct ieee8021
  11058. +@@ -3998,7 +3998,6 @@ static int b43_op_config(struct ieee8021
  11059. struct b43_wldev *dev = wl->current_dev;
  11060. struct b43_phy *phy = &dev->phy;
  11061. struct ieee80211_conf *conf = &hw->conf;
  11062. @@ -28,7 +28,7 @@
  11063. int err = 0;
  11064. mutex_lock(&wl->mutex);
  11065. -@@ -4044,11 +4043,9 @@ static int b43_op_config(struct ieee8021
  11066. +@@ -4041,11 +4040,9 @@ static int b43_op_config(struct ieee8021
  11067. }
  11068. /* Antennas for RX and management frame TX. */
  11069. @@ -42,7 +42,7 @@
  11070. if (wl->radio_enabled != phy->radio_on) {
  11071. if (wl->radio_enabled) {
  11072. -@@ -5209,6 +5206,47 @@ static int b43_op_get_survey(struct ieee
  11073. +@@ -5189,6 +5186,47 @@ static int b43_op_get_survey(struct ieee
  11074. return 0;
  11075. }
  11076. @@ -90,7 +90,7 @@
  11077. static const struct ieee80211_ops b43_hw_ops = {
  11078. .tx = b43_op_tx,
  11079. .conf_tx = b43_op_conf_tx,
  11080. -@@ -5230,6 +5268,8 @@ static const struct ieee80211_ops b43_hw
  11081. +@@ -5210,6 +5248,8 @@ static const struct ieee80211_ops b43_hw
  11082. .sw_scan_complete = b43_op_sw_scan_complete_notifier,
  11083. .get_survey = b43_op_get_survey,
  11084. .rfkill_poll = b43_rfkill_poll,
  11085. @@ -99,7 +99,7 @@
  11086. };
  11087. /* Hard-reset the chip. Do not call this directly.
  11088. -@@ -5538,6 +5578,8 @@ static int b43_one_core_attach(struct b4
  11089. +@@ -5513,6 +5553,8 @@ static int b43_one_core_attach(struct b4
  11090. if (!wldev)
  11091. goto out;
  11092. @@ -108,7 +108,7 @@
  11093. wldev->use_pio = b43_modparam_pio;
  11094. wldev->dev = dev;
  11095. wldev->wl = wl;
  11096. -@@ -5628,6 +5670,9 @@ static struct b43_wl *b43_wireless_init(
  11097. +@@ -5603,6 +5645,9 @@ static struct b43_wl *b43_wireless_init(
  11098. hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
  11099. 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
  11100. new file mode 100644
  11101. index 0000000..ae571c9
  11102. --- /dev/null
  11103. +++ b/package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch
  11104. @@ -0,0 +1,97 @@
  11105. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  11106. +Date: Mon, 8 Jun 2015 16:11:40 +0200
  11107. +Subject: [PATCH] brcmfmac: register wiphy(s) during module_init
  11108. +MIME-Version: 1.0
  11109. +Content-Type: text/plain; charset=UTF-8
  11110. +Content-Transfer-Encoding: 8bit
  11111. +
  11112. +This is needed by OpenWrt which expects all PHYs to be created after
  11113. +module loads successfully.
  11114. +
  11115. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  11116. +---
  11117. +
  11118. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  11119. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  11120. +@@ -1213,6 +1213,7 @@ int __init brcmf_core_init(void)
  11121. + {
  11122. + if (!schedule_work(&brcmf_driver_work))
  11123. + return -EBUSY;
  11124. ++ flush_work(&brcmf_driver_work);
  11125. +
  11126. + return 0;
  11127. + }
  11128. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  11129. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  11130. +@@ -444,6 +444,7 @@ struct brcmf_fw {
  11131. + u16 bus_nr;
  11132. + void (*done)(struct device *dev, const struct firmware *fw,
  11133. + void *nvram_image, u32 nvram_len);
  11134. ++ struct completion *completion;
  11135. + };
  11136. +
  11137. + static void brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx)
  11138. +@@ -478,6 +479,8 @@ static void brcmf_fw_request_nvram_done(
  11139. + goto fail;
  11140. +
  11141. + fwctx->done(fwctx->dev, fwctx->code, nvram, nvram_length);
  11142. ++ if (fwctx->completion)
  11143. ++ complete(fwctx->completion);
  11144. + kfree(fwctx);
  11145. + return;
  11146. +
  11147. +@@ -485,6 +488,8 @@ fail:
  11148. + brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev));
  11149. + release_firmware(fwctx->code);
  11150. + device_release_driver(fwctx->dev);
  11151. ++ if (fwctx->completion)
  11152. ++ complete(fwctx->completion);
  11153. + kfree(fwctx);
  11154. + }
  11155. +
  11156. +@@ -500,6 +505,8 @@ static void brcmf_fw_request_code_done(c
  11157. + /* only requested code so done here */
  11158. + if (!(fwctx->flags & BRCMF_FW_REQUEST_NVRAM)) {
  11159. + fwctx->done(fwctx->dev, fw, NULL, 0);
  11160. ++ if (fwctx->completion)
  11161. ++ complete(fwctx->completion);
  11162. + kfree(fwctx);
  11163. + return;
  11164. + }
  11165. +@@ -517,6 +524,8 @@ static void brcmf_fw_request_code_done(c
  11166. + fail:
  11167. + brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev));
  11168. + device_release_driver(fwctx->dev);
  11169. ++ if (fwctx->completion)
  11170. ++ complete(fwctx->completion);
  11171. + kfree(fwctx);
  11172. + }
  11173. +
  11174. +@@ -528,6 +537,8 @@ int brcmf_fw_get_firmwares_pcie(struct d
  11175. + u16 domain_nr, u16 bus_nr)
  11176. + {
  11177. + struct brcmf_fw *fwctx;
  11178. ++ struct completion completion;
  11179. ++ int err;
  11180. +
  11181. + brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(dev));
  11182. + if (!fw_cb || !code)
  11183. +@@ -548,9 +559,17 @@ int brcmf_fw_get_firmwares_pcie(struct d
  11184. + fwctx->domain_nr = domain_nr;
  11185. + fwctx->bus_nr = bus_nr;
  11186. +
  11187. +- return request_firmware_nowait(THIS_MODULE, true, code, dev,
  11188. ++ init_completion(&completion);
  11189. ++ fwctx->completion = &completion;
  11190. ++
  11191. ++ err = request_firmware_nowait(THIS_MODULE, true, code, dev,
  11192. + GFP_KERNEL, fwctx,
  11193. + brcmf_fw_request_code_done);
  11194. ++ if (!err)
  11195. ++ wait_for_completion_timeout(fwctx->completion,
  11196. ++ msecs_to_jiffies(5000));
  11197. ++ fwctx->completion = NULL;
  11198. ++ return err;
  11199. + }
  11200. +
  11201. + int brcmf_fw_get_firmwares(struct device *dev, u16 flags,
  11202. 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
  11203. deleted file mode 100644
  11204. index 00181f6..0000000
  11205. --- a/package/kernel/mac80211/patches/861-brcmfmac-register-wiphy-s-during-module_init.patch
  11206. +++ /dev/null
  11207. @@ -1,97 +0,0 @@
  11208. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  11209. -Date: Mon, 8 Jun 2015 16:11:40 +0200
  11210. -Subject: [PATCH] brcmfmac: register wiphy(s) during module_init
  11211. -MIME-Version: 1.0
  11212. -Content-Type: text/plain; charset=UTF-8
  11213. -Content-Transfer-Encoding: 8bit
  11214. -
  11215. -This is needed by OpenWrt which expects all PHYs to be created after
  11216. -module loads successfully.
  11217. -
  11218. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  11219. ----
  11220. -
  11221. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  11222. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  11223. -@@ -1332,6 +1332,7 @@ static int __init brcmfmac_module_init(v
  11224. - #endif
  11225. - if (!schedule_work(&brcmf_driver_work))
  11226. - return -EBUSY;
  11227. -+ flush_work(&brcmf_driver_work);
  11228. -
  11229. - return 0;
  11230. - }
  11231. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  11232. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  11233. -@@ -444,6 +444,7 @@ struct brcmf_fw {
  11234. - u16 bus_nr;
  11235. - void (*done)(struct device *dev, const struct firmware *fw,
  11236. - void *nvram_image, u32 nvram_len);
  11237. -+ struct completion *completion;
  11238. - };
  11239. -
  11240. - static void brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx)
  11241. -@@ -478,6 +479,8 @@ static void brcmf_fw_request_nvram_done(
  11242. - goto fail;
  11243. -
  11244. - fwctx->done(fwctx->dev, fwctx->code, nvram, nvram_length);
  11245. -+ if (fwctx->completion)
  11246. -+ complete(fwctx->completion);
  11247. - kfree(fwctx);
  11248. - return;
  11249. -
  11250. -@@ -485,6 +488,8 @@ fail:
  11251. - brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev));
  11252. - release_firmware(fwctx->code);
  11253. - device_release_driver(fwctx->dev);
  11254. -+ if (fwctx->completion)
  11255. -+ complete(fwctx->completion);
  11256. - kfree(fwctx);
  11257. - }
  11258. -
  11259. -@@ -500,6 +505,8 @@ static void brcmf_fw_request_code_done(c
  11260. - /* only requested code so done here */
  11261. - if (!(fwctx->flags & BRCMF_FW_REQUEST_NVRAM)) {
  11262. - fwctx->done(fwctx->dev, fw, NULL, 0);
  11263. -+ if (fwctx->completion)
  11264. -+ complete(fwctx->completion);
  11265. - kfree(fwctx);
  11266. - return;
  11267. - }
  11268. -@@ -517,6 +524,8 @@ static void brcmf_fw_request_code_done(c
  11269. - fail:
  11270. - brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev));
  11271. - device_release_driver(fwctx->dev);
  11272. -+ if (fwctx->completion)
  11273. -+ complete(fwctx->completion);
  11274. - kfree(fwctx);
  11275. - }
  11276. -
  11277. -@@ -528,6 +537,8 @@ int brcmf_fw_get_firmwares_pcie(struct d
  11278. - u16 domain_nr, u16 bus_nr)
  11279. - {
  11280. - struct brcmf_fw *fwctx;
  11281. -+ struct completion completion;
  11282. -+ int err;
  11283. -
  11284. - brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(dev));
  11285. - if (!fw_cb || !code)
  11286. -@@ -548,9 +559,17 @@ int brcmf_fw_get_firmwares_pcie(struct d
  11287. - fwctx->domain_nr = domain_nr;
  11288. - fwctx->bus_nr = bus_nr;
  11289. -
  11290. -- return request_firmware_nowait(THIS_MODULE, true, code, dev,
  11291. -+ init_completion(&completion);
  11292. -+ fwctx->completion = &completion;
  11293. -+
  11294. -+ err = request_firmware_nowait(THIS_MODULE, true, code, dev,
  11295. - GFP_KERNEL, fwctx,
  11296. - brcmf_fw_request_code_done);
  11297. -+ if (!err)
  11298. -+ wait_for_completion_timeout(fwctx->completion,
  11299. -+ msecs_to_jiffies(5000));
  11300. -+ fwctx->completion = NULL;
  11301. -+ return err;
  11302. - }
  11303. -
  11304. - int brcmf_fw_get_firmwares(struct device *dev, u16 flags,
  11305. 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
  11306. new file mode 100644
  11307. index 0000000..8721155
  11308. --- /dev/null
  11309. +++ b/package/kernel/mac80211/patches/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch
  11310. @@ -0,0 +1,50 @@
  11311. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  11312. +Date: Thu, 9 Jul 2015 00:07:59 +0200
  11313. +Subject: [PATCH] brcmfmac: workaround bug with some inconsistent BSSes state
  11314. +MIME-Version: 1.0
  11315. +Content-Type: text/plain; charset=UTF-8
  11316. +Content-Transfer-Encoding: 8bit
  11317. +
  11318. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  11319. +---
  11320. +
  11321. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  11322. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  11323. +@@ -665,9 +665,37 @@ static struct wireless_dev *brcmf_cfg802
  11324. + u32 *flags,
  11325. + struct vif_params *params)
  11326. + {
  11327. ++ struct net_device *dev;
  11328. + struct wireless_dev *wdev;
  11329. + int err;
  11330. +
  11331. ++ /*
  11332. ++ * There is a bug with in-firmware BSS management. When adding virtual
  11333. ++ * interface brcmfmac first tells firmware to create new BSS and then
  11334. ++ * it creates new struct net_device.
  11335. ++ *
  11336. ++ * If creating/registering netdev(ice) fails, BSS remains in some bugged
  11337. ++ * state. It conflicts with existing BSSes by overtaking their auth
  11338. ++ * requests.
  11339. ++ *
  11340. ++ * It results in one BSS (addresss X) sending beacons and another BSS
  11341. ++ * (address Y) replying to authentication requests. This makes interface
  11342. ++ * unusable as AP.
  11343. ++ *
  11344. ++ * To workaround this bug we may try to guess if register_netdev(ice)
  11345. ++ * will fail. The most obvious case is using interface name that already
  11346. ++ * exists. This is actually quite likely with brcmfmac & some user space
  11347. ++ * scripts as brcmfmac doesn't allow deleting virtual interfaces.
  11348. ++ * So this bug can be triggered even by something trivial like:
  11349. ++ * iw dev wlan0 delete
  11350. ++ * iw phy phy0 interface add wlan0 type __ap
  11351. ++ */
  11352. ++ dev = dev_get_by_name(&init_net, name);
  11353. ++ if (dev) {
  11354. ++ dev_put(dev);
  11355. ++ return ERR_PTR(-ENFILE);
  11356. ++ }
  11357. ++
  11358. + brcmf_dbg(TRACE, "enter: %s type %d\n", name, type);
  11359. + err = brcmf_vif_add_validate(wiphy_to_cfg(wiphy), type);
  11360. + if (err) {
  11361. diff --git a/package/kernel/mac80211/patches/862-brcmfmac-Disable-power-management.patch b/package/kernel/mac80211/patches/862-brcmfmac-Disable-power-management.patch
  11362. new file mode 100644
  11363. index 0000000..f301fe1
  11364. --- /dev/null
  11365. +++ b/package/kernel/mac80211/patches/862-brcmfmac-Disable-power-management.patch
  11366. @@ -0,0 +1,27 @@
  11367. +From 66ae1b1750720a33e29792a177b1e696f4f005fb Mon Sep 17 00:00:00 2001
  11368. +From: Phil Elwell <phil@raspberrypi.org>
  11369. +Date: Wed, 9 Mar 2016 17:25:59 +0000
  11370. +Subject: [PATCH] brcmfmac: Disable power management
  11371. +
  11372. +Disable wireless power saving in the brcmfmac WLAN driver. This is a
  11373. +temporary measure until the connectivity loss resulting from power
  11374. +saving is resolved.
  11375. +
  11376. +Signed-off-by: Phil Elwell <phil@raspberrypi.org>
  11377. +---
  11378. + drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c | 2 ++
  11379. + 1 file changed, 2 insertions(+)
  11380. +
  11381. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  11382. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  11383. +@@ -2783,6 +2783,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip
  11384. + * preference in cfg struct to apply this to
  11385. + * FW later while initializing the dongle
  11386. + */
  11387. ++#if defined(CONFIG_BCM2708) || defined(CONFIG_BCM2709)
  11388. ++ pr_info("power management disabled\n");
  11389. ++ enabled = false;
  11390. ++#endif
  11391. + cfg->pwr_save = enabled;
  11392. + if (!check_vif_up(ifp->vif)) {
  11393. +
  11394. 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
  11395. deleted file mode 100644
  11396. index 4295b4b..0000000
  11397. --- a/package/kernel/mac80211/patches/862-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch
  11398. +++ /dev/null
  11399. @@ -1,50 +0,0 @@
  11400. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  11401. -Date: Thu, 9 Jul 2015 00:07:59 +0200
  11402. -Subject: [PATCH] brcmfmac: workaround bug with some inconsistent BSSes state
  11403. -MIME-Version: 1.0
  11404. -Content-Type: text/plain; charset=UTF-8
  11405. -Content-Transfer-Encoding: 8bit
  11406. -
  11407. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  11408. ----
  11409. -
  11410. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  11411. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  11412. -@@ -615,9 +615,37 @@ static struct wireless_dev *brcmf_cfg802
  11413. - u32 *flags,
  11414. - struct vif_params *params)
  11415. - {
  11416. -+ struct net_device *dev;
  11417. - struct wireless_dev *wdev;
  11418. - int err;
  11419. -
  11420. -+ /*
  11421. -+ * There is a bug with in-firmware BSS management. When adding virtual
  11422. -+ * interface brcmfmac first tells firmware to create new BSS and then
  11423. -+ * it creates new struct net_device.
  11424. -+ *
  11425. -+ * If creating/registering netdev(ice) fails, BSS remains in some bugged
  11426. -+ * state. It conflicts with existing BSSes by overtaking their auth
  11427. -+ * requests.
  11428. -+ *
  11429. -+ * It results in one BSS (addresss X) sending beacons and another BSS
  11430. -+ * (address Y) replying to authentication requests. This makes interface
  11431. -+ * unusable as AP.
  11432. -+ *
  11433. -+ * To workaround this bug we may try to guess if register_netdev(ice)
  11434. -+ * will fail. The most obvious case is using interface name that already
  11435. -+ * exists. This is actually quite likely with brcmfmac & some user space
  11436. -+ * scripts as brcmfmac doesn't allow deleting virtual interfaces.
  11437. -+ * So this bug can be triggered even by something trivial like:
  11438. -+ * iw dev wlan0 delete
  11439. -+ * iw phy phy0 interface add wlan0 type __ap
  11440. -+ */
  11441. -+ dev = dev_get_by_name(&init_net, name);
  11442. -+ if (dev) {
  11443. -+ dev_put(dev);
  11444. -+ return ERR_PTR(-EEXIST);
  11445. -+ }
  11446. -+
  11447. - brcmf_dbg(TRACE, "enter: %s type %d\n", name, type);
  11448. - err = brcmf_vif_add_validate(wiphy_to_cfg(wiphy), type);
  11449. - if (err) {
  11450. 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
  11451. index f2e21ea..be210f2 100644
  11452. --- a/package/kernel/mac80211/patches/910-01-add-support-for-mt7620.patch
  11453. +++ b/package/kernel/mac80211/patches/910-01-add-support-for-mt7620.patch
  11454. @@ -1184,7 +1184,7 @@
  11455. break;
  11456. default:
  11457. rt2x00_err(rt2x00dev, "Invalid RF chipset 0x%04x detected\n",
  11458. -@@ -8423,6 +9363,7 @@ static int rt2800_probe_hw_mode(struct r
  11459. +@@ -8427,6 +9367,7 @@ static int rt2800_probe_hw_mode(struct r
  11460. case RF5372:
  11461. case RF5390:
  11462. case RF5392:
  11463. @@ -1192,7 +1192,7 @@
  11464. spec->num_channels = 14;
  11465. if (spec->clk_is_20mhz)
  11466. spec->channels = rf_vals_xtal20mhz_3x;
  11467. -@@ -8563,6 +9504,7 @@ static int rt2800_probe_hw_mode(struct r
  11468. +@@ -8567,6 +9508,7 @@ static int rt2800_probe_hw_mode(struct r
  11469. case RF5372:
  11470. case RF5390:
  11471. case RF5392:
  11472. diff --git a/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch b/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
  11473. index 8c6d720..e842d61 100644
  11474. --- a/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
  11475. +++ b/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
  11476. @@ -14,7 +14,7 @@ Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
  11477. --- a/drivers/net/wireless/ath/ath10k/core.c
  11478. +++ b/drivers/net/wireless/ath/ath10k/core.c
  11479. -@@ -1914,6 +1914,16 @@ int ath10k_core_register(struct ath10k *
  11480. +@@ -2107,6 +2107,16 @@ int ath10k_core_register(struct ath10k *
  11481. ar->chip_id = chip_id;
  11482. queue_work(ar->workqueue, &ar->register_work);
  11483. 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
  11484. index 281b447..a501b99 100644
  11485. --- a/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch
  11486. +++ b/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch
  11487. @@ -1,6 +1,6 @@
  11488. --- a/drivers/net/wireless/ath/ath10k/mac.c
  11489. +++ b/drivers/net/wireless/ath/ath10k/mac.c
  11490. -@@ -7141,6 +7141,21 @@ struct ath10k_vif *ath10k_get_arvif(stru
  11491. +@@ -7742,6 +7742,21 @@ struct ath10k_vif *ath10k_get_arvif(stru
  11492. return arvif_iter.arvif;
  11493. }
  11494. @@ -22,11 +22,11 @@
  11495. int ath10k_mac_register(struct ath10k *ar)
  11496. {
  11497. static const u32 cipher_suites[] = {
  11498. -@@ -7357,6 +7372,12 @@ int ath10k_mac_register(struct ath10k *a
  11499. +@@ -7975,6 +7990,12 @@ int ath10k_mac_register(struct ath10k *a
  11500. ar->hw->wiphy->cipher_suites = cipher_suites;
  11501. ar->hw->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
  11502. -+#if CPTCFG_MAC80211_LEDS
  11503. ++#ifdef CPTCFG_MAC80211_LEDS
  11504. + ieee80211_create_tpt_led_trigger(ar->hw,
  11505. + IEEE80211_TPT_LEDTRIG_FL_RADIO, ath10k_tpt_blink,
  11506. + ARRAY_SIZE(ath10k_tpt_blink));
  11507. diff --git a/package/kernel/mac80211/patches/936-ath10k_skip_otp_check.patch b/package/kernel/mac80211/patches/936-ath10k_skip_otp_check.patch
  11508. new file mode 100644
  11509. index 0000000..596ef98
  11510. --- /dev/null
  11511. +++ b/package/kernel/mac80211/patches/936-ath10k_skip_otp_check.patch
  11512. @@ -0,0 +1,51 @@
  11513. +--- a/drivers/net/wireless/ath/ath10k/core.c
  11514. ++++ b/drivers/net/wireless/ath/ath10k/core.c
  11515. +@@ -1243,9 +1243,6 @@ static int ath10k_core_fetch_firmware_fi
  11516. + {
  11517. + int ret;
  11518. +
  11519. +- /* calibration file is optional, don't check for any errors */
  11520. +- ath10k_fetch_cal_file(ar);
  11521. +-
  11522. + ar->fw_api = 5;
  11523. + ath10k_dbg(ar, ATH10K_DBG_BOOT, "trying fw api %d\n", ar->fw_api);
  11524. +
  11525. +@@ -1944,7 +1941,7 @@ EXPORT_SYMBOL(ath10k_core_stop);
  11526. + static int ath10k_core_probe_fw(struct ath10k *ar)
  11527. + {
  11528. + struct bmi_target_info target_info;
  11529. +- int ret = 0;
  11530. ++ int calret, ret = 0;
  11531. +
  11532. + ret = ath10k_hif_power_up(ar);
  11533. + if (ret) {
  11534. +@@ -1968,6 +1965,9 @@ static int ath10k_core_probe_fw(struct a
  11535. + goto err_power_down;
  11536. + }
  11537. +
  11538. ++ /* calibration file is optional, don't check for any errors */
  11539. ++ calret = ath10k_fetch_cal_file(ar);
  11540. ++
  11541. + ret = ath10k_core_fetch_firmware_files(ar);
  11542. + if (ret) {
  11543. + ath10k_err(ar, "could not fetch firmware files (%d)\n", ret);
  11544. +@@ -1990,11 +1990,14 @@ static int ath10k_core_probe_fw(struct a
  11545. + "could not load pre cal data: %d\n", ret);
  11546. + }
  11547. +
  11548. +- ret = ath10k_core_get_board_id_from_otp(ar);
  11549. +- if (ret && ret != -EOPNOTSUPP) {
  11550. +- ath10k_err(ar, "failed to get board id from otp: %d\n",
  11551. +- ret);
  11552. +- goto err_free_firmware_files;
  11553. ++ /* otp and board file not needed if calibration data is present */
  11554. ++ if (calret) {
  11555. ++ ret = ath10k_core_get_board_id_from_otp(ar);
  11556. ++ if (ret && ret != -EOPNOTSUPP) {
  11557. ++ ath10k_err(ar, "failed to get board id from otp: %d\n",
  11558. ++ ret);
  11559. ++ goto err_free_firmware_files;
  11560. ++ }
  11561. + }
  11562. +
  11563. + ret = ath10k_core_fetch_board_file(ar);
  11564. diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile
  11565. index e49dd48..90430b9 100644
  11566. --- a/package/kernel/mt76/Makefile
  11567. +++ b/package/kernel/mt76/Makefile
  11568. @@ -1,7 +1,7 @@
  11569. include $(TOPDIR)/rules.mk
  11570. PKG_NAME:=mt76
  11571. -PKG_VERSION:=2016-03-03
  11572. +PKG_VERSION:=2016-07-08
  11573. PKG_RELEASE=1
  11574. PKG_LICENSE:=GPLv2
  11575. @@ -10,23 +10,26 @@ PKG_LICENSE_FILES:=
  11576. PKG_SOURCE_URL:=https://github.com/openwrt/mt76
  11577. PKG_SOURCE_PROTO:=git
  11578. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  11579. -PKG_SOURCE_VERSION:=310d420178c86e253a172413da30ecf479b64251
  11580. +PKG_SOURCE_VERSION:=9226e96c40e9ae19996a262365ce764f7b0b9c4a
  11581. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
  11582. -PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  11583. +PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  11584. PKG_BUILD_PARALLEL:=1
  11585. +STAMP_CONFIGURED_DEPENDS := $(STAGING_DIR)/usr/include/mac80211-backport/backport/autoconf.h
  11586. +
  11587. include $(INCLUDE_DIR)/kernel.mk
  11588. include $(INCLUDE_DIR)/package.mk
  11589. define KernelPackage/mt76
  11590. SUBMENU:=Wireless Drivers
  11591. - TITLE:=MediaTek MT76x2 wireless driver
  11592. - DEPENDS:=+kmod-mac80211 +@DRIVER_11N_SUPPORT @PCI_SUPPORT
  11593. + TITLE:=MediaTek MT76x2/MT7603 wireless driver
  11594. + DEPENDS:=+kmod-mac80211 +@DRIVER_11N_SUPPORT @PCI_SUPPORT @!LINUX_3_18
  11595. FILES:=\
  11596. $(PKG_BUILD_DIR)/mt76.ko \
  11597. - $(PKG_BUILD_DIR)/mt76x2e.ko
  11598. - AUTOLOAD:=$(call AutoLoad,50,mac80211 mt76 mt76x2e)
  11599. + $(PKG_BUILD_DIR)/mt76x2e.ko \
  11600. + $(PKG_BUILD_DIR)/mt7603e.ko
  11601. + AUTOLOAD:=$(call AutoLoad,50,mac80211 mt76 mt76x2e mt7603e)
  11602. endef
  11603. NOSTDINC_FLAGS = \
  11604. @@ -54,6 +57,12 @@ endef
  11605. define KernelPackage/mt76/install
  11606. $(INSTALL_DIR) $(1)/lib/firmware
  11607. cp \
  11608. + $(if $(CONFIG_TARGET_ramips_mt7628) || $(CONFIG_TARGET_ramips_mt7688), \
  11609. + $(PKG_BUILD_DIR)/firmware/mt7628_e1.bin \
  11610. + $(PKG_BUILD_DIR)/firmware/mt7628_e2.bin \
  11611. + ) \
  11612. + $(PKG_BUILD_DIR)/firmware/mt7603_e1.bin \
  11613. + $(PKG_BUILD_DIR)/firmware/mt7603_e2.bin \
  11614. $(PKG_BUILD_DIR)/firmware/mt7662_rom_patch.bin \
  11615. $(PKG_BUILD_DIR)/firmware/mt7662.bin \
  11616. $(1)/lib/firmware
  11617. diff --git a/package/kernel/mwlwifi/Makefile b/package/kernel/mwlwifi/Makefile
  11618. index 091928d..880803e 100644
  11619. --- a/package/kernel/mwlwifi/Makefile
  11620. +++ b/package/kernel/mwlwifi/Makefile
  11621. @@ -8,7 +8,7 @@
  11622. include $(TOPDIR)/rules.mk
  11623. PKG_NAME:=mwlwifi
  11624. -PKG_VERSION:=10.3.0.16-20160105
  11625. +PKG_VERSION:=10.3.0.17-20160617
  11626. PKG_RELEASE=1
  11627. PKG_LICENSE:=ISC
  11628. @@ -17,7 +17,7 @@ PKG_LICENSE_FILES:=
  11629. PKG_SOURCE_URL:=https://github.com/kaloz/mwlwifi
  11630. PKG_SOURCE_PROTO:=git
  11631. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  11632. -PKG_SOURCE_VERSION:=99d3879cc72f2a25d44fb4bee96fd84eca028b04
  11633. +PKG_SOURCE_VERSION:=b7aff3c2839b048407d716d1cb9326122ee401f8
  11634. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
  11635. PKG_MAINTAINER:=Imre Kaloz <kaloz@openwrt.org>
  11636. diff --git a/package/kernel/mwlwifi/patches/100-drop_old_api.patch b/package/kernel/mwlwifi/patches/100-drop_old_api.patch
  11637. deleted file mode 100644
  11638. index d2e149e..0000000
  11639. --- a/package/kernel/mwlwifi/patches/100-drop_old_api.patch
  11640. +++ /dev/null
  11641. @@ -1,92 +0,0 @@
  11642. ---- a/main.c
  11643. -+++ b/main.c
  11644. -@@ -418,11 +418,7 @@ static void mwl_set_ht_caps(struct mwl_p
  11645. - band->ht_cap.cap |= IEEE80211_HT_CAP_SGI_20;
  11646. - band->ht_cap.cap |= IEEE80211_HT_CAP_SGI_40;
  11647. -
  11648. --#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
  11649. -- hw->flags |= IEEE80211_HW_AMPDU_AGGREGATION;
  11650. --#else
  11651. - ieee80211_hw_set(hw, AMPDU_AGGREGATION);
  11652. --#endif
  11653. - band->ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K;
  11654. - band->ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_4;
  11655. -
  11656. -@@ -524,29 +520,16 @@ static int mwl_wl_init(struct mwl_priv *
  11657. - hw->queues = SYSADPT_TX_WMM_QUEUES;
  11658. -
  11659. - /* Set rssi values to dBm */
  11660. --#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
  11661. -- hw->flags |= IEEE80211_HW_SIGNAL_DBM | IEEE80211_HW_HAS_RATE_CONTROL;
  11662. --#else
  11663. - ieee80211_hw_set(hw, SIGNAL_DBM);
  11664. - ieee80211_hw_set(hw, HAS_RATE_CONTROL);
  11665. --#endif
  11666. -
  11667. - /* Ask mac80211 not to trigger PS mode
  11668. - * based on PM bit of incoming frames.
  11669. - */
  11670. --#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
  11671. -- hw->flags |= IEEE80211_HW_AP_LINK_PS;
  11672. --#else
  11673. - ieee80211_hw_set(hw, AP_LINK_PS);
  11674. --#endif
  11675. -
  11676. --#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
  11677. -- hw->flags |= IEEE80211_HW_SUPPORTS_PER_STA_GTK |
  11678. -- IEEE80211_HW_MFP_CAPABLE;
  11679. --#else
  11680. - ieee80211_hw_set(hw, SUPPORTS_PER_STA_GTK);
  11681. - ieee80211_hw_set(hw, MFP_CAPABLE);
  11682. --#endif
  11683. -
  11684. - hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
  11685. -
  11686. ---- a/dev.h
  11687. -+++ b/dev.h
  11688. -@@ -484,10 +484,6 @@ static inline struct mwl_sta *mwl_dev_ge
  11689. - return (struct mwl_sta *)&sta->drv_priv;
  11690. - }
  11691. -
  11692. --#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)
  11693. --#define ether_addr_copy(dst, src) memcpy(dst, src, ETH_ALEN)
  11694. --#endif
  11695. --
  11696. - /* Defined in mac80211.c. */
  11697. - extern const struct ieee80211_ops mwl_mac80211_ops;
  11698. -
  11699. ---- a/mac80211.c
  11700. -+++ b/mac80211.c
  11701. -@@ -572,19 +572,11 @@ static int mwl_mac80211_get_survey(struc
  11702. - return 0;
  11703. - }
  11704. -
  11705. --#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0)
  11706. --static int mwl_mac80211_ampdu_action(struct ieee80211_hw *hw,
  11707. -- struct ieee80211_vif *vif,
  11708. -- enum ieee80211_ampdu_mlme_action action,
  11709. -- struct ieee80211_sta *sta,
  11710. -- u16 tid, u16 *ssn, u8 buf_size)
  11711. --#else
  11712. - static int mwl_mac80211_ampdu_action(struct ieee80211_hw *hw,
  11713. - struct ieee80211_vif *vif,
  11714. - enum ieee80211_ampdu_mlme_action action,
  11715. - struct ieee80211_sta *sta,
  11716. - u16 tid, u16 *ssn, u8 buf_size, bool amsdu)
  11717. --#endif
  11718. - {
  11719. - int rc = 0;
  11720. - struct mwl_priv *priv = hw->priv;
  11721. ---- a/rx.c
  11722. -+++ b/rx.c
  11723. -@@ -232,10 +232,8 @@ static inline void mwl_rx_prepare_status
  11724. - status->flag |= RX_FLAG_VHT;
  11725. - if (bw == RX_RATE_INFO_HT40)
  11726. - status->flag |= RX_FLAG_40MHZ;
  11727. --#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 18, 0)
  11728. - if (bw == RX_RATE_INFO_HT80)
  11729. - status->vht_flag |= RX_VHT_FLAG_80MHZ;
  11730. --#endif
  11731. - if (gi == RX_RATE_INFO_SHORT_INTERVAL)
  11732. - status->flag |= RX_FLAG_SHORT_GI;
  11733. - status->vht_nss = (nss + 1);
  11734. diff --git a/package/kernel/mwlwifi/patches/110-api_sync.patch b/package/kernel/mwlwifi/patches/110-api_sync.patch
  11735. deleted file mode 100644
  11736. index ed3e06a..0000000
  11737. --- a/package/kernel/mwlwifi/patches/110-api_sync.patch
  11738. +++ /dev/null
  11739. @@ -1,19 +0,0 @@
  11740. ---- a/mac80211.c
  11741. -+++ b/mac80211.c
  11742. -@@ -597,10 +597,13 @@ static int mwl_mac80211_get_survey(struc
  11743. -
  11744. - static int mwl_mac80211_ampdu_action(struct ieee80211_hw *hw,
  11745. - struct ieee80211_vif *vif,
  11746. -- enum ieee80211_ampdu_mlme_action action,
  11747. -- struct ieee80211_sta *sta,
  11748. -- u16 tid, u16 *ssn, u8 buf_size, bool amsdu)
  11749. -+ struct ieee80211_ampdu_params *params)
  11750. - {
  11751. -+ enum ieee80211_ampdu_mlme_action action = params->action;
  11752. -+ struct ieee80211_sta *sta = params->sta;
  11753. -+ u16 tid = params->tid;
  11754. -+ u16 *ssn = &params->ssn;
  11755. -+ u8 buf_size = params->buf_size;
  11756. - int rc = 0;
  11757. - struct mwl_priv *priv = hw->priv;
  11758. - struct mwl_ampdu_stream *stream;
  11759. diff --git a/package/network/utils/iw/Makefile b/package/network/utils/iw/Makefile
  11760. index ad82081..d17cbca 100644
  11761. --- a/package/network/utils/iw/Makefile
  11762. +++ b/package/network/utils/iw/Makefile
  11763. @@ -12,10 +12,10 @@ PKG_VERSION:=4.3
  11764. PKG_RELEASE:=1
  11765. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  11766. -PKG_SOURCE_URL:=https://www.kernel.org/pub/software/network/iw
  11767. +PKG_SOURCE_URL:=@KERNEL/software/network/iw
  11768. PKG_MD5SUM:=7adec72e91ebdd9c55429fa34a23a6f5
  11769. -PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  11770. +PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  11771. PKG_LICENSE:=GPL-2.0
  11772. include $(INCLUDE_DIR)/package.mk
  11773. diff --git a/package/network/utils/iw/patches/001-nl80211_h_sync.patch b/package/network/utils/iw/patches/001-nl80211_h_sync.patch
  11774. index 7de2258..e5ea8f7 100644
  11775. --- a/package/network/utils/iw/patches/001-nl80211_h_sync.patch
  11776. +++ b/package/network/utils/iw/patches/001-nl80211_h_sync.patch
  11777. @@ -8,7 +8,17 @@
  11778. *
  11779. * Permission to use, copy, modify, and/or distribute this software for any
  11780. * purpose with or without fee is hereby granted, provided that the above
  11781. -@@ -328,7 +329,15 @@
  11782. +@@ -321,14 +322,24 @@
  11783. + * @NL80211_CMD_GET_SCAN: get scan results
  11784. + * @NL80211_CMD_TRIGGER_SCAN: trigger a new scan with the given parameters
  11785. + * %NL80211_ATTR_TX_NO_CCK_RATE is used to decide whether to send the
  11786. +- * probe requests at CCK rate or not.
  11787. ++ * probe requests at CCK rate or not. %NL80211_ATTR_MAC can be used to
  11788. ++ * specify a BSSID to scan for; if not included, the wildcard BSSID will
  11789. ++ * be used.
  11790. + * @NL80211_CMD_NEW_SCAN_RESULTS: scan notification (as a reply to
  11791. + * NL80211_CMD_GET_SCAN and on the "scan" multicast group)
  11792. + * @NL80211_CMD_SCAN_ABORTED: scan was aborted, for unspecified reasons,
  11793. * partial scan results may be available
  11794. *
  11795. * @NL80211_CMD_START_SCHED_SCAN: start a scheduled scan at certain
  11796. @@ -25,7 +35,82 @@
  11797. * Like with normal scans, if SSIDs (%NL80211_ATTR_SCAN_SSIDS)
  11798. * are passed, they are used in the probe requests. For
  11799. * broadcast, a broadcast SSID must be passed (ie. an empty
  11800. -@@ -1761,6 +1770,22 @@ enum nl80211_commands {
  11801. +@@ -418,7 +429,11 @@
  11802. + * @NL80211_CMD_ASSOCIATE: association request and notification; like
  11803. + * NL80211_CMD_AUTHENTICATE but for Association and Reassociation
  11804. + * (similar to MLME-ASSOCIATE.request, MLME-REASSOCIATE.request,
  11805. +- * MLME-ASSOCIATE.confirm or MLME-REASSOCIATE.confirm primitives).
  11806. ++ * MLME-ASSOCIATE.confirm or MLME-REASSOCIATE.confirm primitives). The
  11807. ++ * %NL80211_ATTR_PREV_BSSID attribute is used to specify whether the
  11808. ++ * request is for the initial association to an ESS (that attribute not
  11809. ++ * included) or for reassociation within the ESS (that attribute is
  11810. ++ * included).
  11811. + * @NL80211_CMD_DEAUTHENTICATE: deauthentication request and notification; like
  11812. + * NL80211_CMD_AUTHENTICATE but for Deauthentication frames (similar to
  11813. + * MLME-DEAUTHENTICATION.request and MLME-DEAUTHENTICATE.indication
  11814. +@@ -468,6 +483,9 @@
  11815. + * set of BSSID,frequency parameters is used (i.e., either the enforcing
  11816. + * %NL80211_ATTR_MAC,%NL80211_ATTR_WIPHY_FREQ or the less strict
  11817. + * %NL80211_ATTR_MAC_HINT and %NL80211_ATTR_WIPHY_FREQ_HINT).
  11818. ++ * %NL80211_ATTR_PREV_BSSID can be used to request a reassociation within
  11819. ++ * the ESS in case the device is already associated and an association with
  11820. ++ * a different BSS is desired.
  11821. + * Background scan period can optionally be
  11822. + * specified in %NL80211_ATTR_BG_SCAN_PERIOD,
  11823. + * if not specified default background scan configuration
  11824. +@@ -811,6 +829,10 @@
  11825. + * as an event to indicate changes for devices with wiphy-specific regdom
  11826. + * management.
  11827. + *
  11828. ++ * @NL80211_CMD_ABORT_SCAN: Stop an ongoing scan. Returns -ENOENT if a scan is
  11829. ++ * not running. The driver indicates the status of the scan through
  11830. ++ * cfg80211_scan_done().
  11831. ++ *
  11832. + * @NL80211_CMD_MAX: highest used command number
  11833. + * @__NL80211_CMD_AFTER_LAST: internal use
  11834. + */
  11835. +@@ -997,6 +1019,8 @@ enum nl80211_commands {
  11836. +
  11837. + NL80211_CMD_WIPHY_REG_CHANGE,
  11838. +
  11839. ++ NL80211_CMD_ABORT_SCAN,
  11840. ++
  11841. + /* add new commands above here */
  11842. +
  11843. + /* used to define NL80211_CMD_MAX below */
  11844. +@@ -1270,8 +1294,11 @@ enum nl80211_commands {
  11845. + * @NL80211_ATTR_RESP_IE: (Re)association response information elements as
  11846. + * sent by peer, for ROAM and successful CONNECT events.
  11847. + *
  11848. +- * @NL80211_ATTR_PREV_BSSID: previous BSSID, to be used by in ASSOCIATE
  11849. +- * commands to specify using a reassociate frame
  11850. ++ * @NL80211_ATTR_PREV_BSSID: previous BSSID, to be used in ASSOCIATE and CONNECT
  11851. ++ * commands to specify a request to reassociate within an ESS, i.e., to use
  11852. ++ * Reassociate Request frame (with the value of this attribute in the
  11853. ++ * Current AP address field) instead of Association Request frame which is
  11854. ++ * used for the initial association to an ESS.
  11855. + *
  11856. + * @NL80211_ATTR_KEY: key information in a nested attribute with
  11857. + * %NL80211_KEY_* sub-attributes
  11858. +@@ -1712,6 +1739,8 @@ enum nl80211_commands {
  11859. + * underlying device supports these minimal RRM features:
  11860. + * %NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES,
  11861. + * %NL80211_FEATURE_QUIET,
  11862. ++ * Or, if global RRM is supported, see:
  11863. ++ * %NL80211_EXT_FEATURE_RRM
  11864. + * If this flag is used, driver must add the Power Capabilities IE to the
  11865. + * association request. In addition, it must also set the RRM capability
  11866. + * flag in the association request's Capability Info field.
  11867. +@@ -1755,12 +1784,44 @@ enum nl80211_commands {
  11868. + * over all channels.
  11869. + *
  11870. + * @NL80211_ATTR_SCHED_SCAN_DELAY: delay before the first cycle of a
  11871. +- * scheduled scan (or a WoWLAN net-detect scan) is started, u32
  11872. +- * in seconds.
  11873. ++ * scheduled scan is started. Or the delay before a WoWLAN
  11874. ++ * net-detect scan is started, counting from the moment the
  11875. ++ * system is suspended. This value is a u32, in seconds.
  11876. +
  11877. * @NL80211_ATTR_REG_INDOOR: flag attribute, if set indicates that the device
  11878. * is operating in an indoor environment.
  11879. *
  11880. @@ -41,6 +126,21 @@
  11881. + * thus it must not specify the number of iterations, only the interval
  11882. + * between scans. The scan plans are executed sequentially.
  11883. + * Each scan plan is a nested attribute of &enum nl80211_sched_scan_plan.
  11884. ++ * @NL80211_ATTR_PBSS: flag attribute. If set it means operate
  11885. ++ * in a PBSS. Specified in %NL80211_CMD_CONNECT to request
  11886. ++ * connecting to a PCP, and in %NL80211_CMD_START_AP to start
  11887. ++ * a PCP instead of AP. Relevant for DMG networks only.
  11888. ++ * @NL80211_ATTR_BSS_SELECT: nested attribute for driver supporting the
  11889. ++ * BSS selection feature. When used with %NL80211_CMD_GET_WIPHY it contains
  11890. ++ * attributes according &enum nl80211_bss_select_attr to indicate what
  11891. ++ * BSS selection behaviours are supported. When used with %NL80211_CMD_CONNECT
  11892. ++ * it contains the behaviour-specific attribute containing the parameters for
  11893. ++ * BSS selection to be done by driver and/or firmware.
  11894. ++ *
  11895. ++ * @NL80211_ATTR_STA_SUPPORT_P2P_PS: whether P2P PS mechanism supported
  11896. ++ * or not. u8, one of the values of &enum nl80211_sta_p2p_ps_status
  11897. ++ *
  11898. ++ * @NL80211_ATTR_PAD: attribute used for padding for 64-bit alignment
  11899. + *
  11900. + * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce
  11901. + * transmit power to stay within regulatory limits. u32, dBi.
  11902. @@ -48,7 +148,7 @@
  11903. * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  11904. * @NL80211_ATTR_MAX: highest attribute number currently defined
  11905. * @__NL80211_ATTR_AFTER_LAST: internal use
  11906. -@@ -2130,6 +2155,13 @@ enum nl80211_attrs {
  11907. +@@ -2130,6 +2191,21 @@ enum nl80211_attrs {
  11908. NL80211_ATTR_REG_INDOOR,
  11909. @@ -57,30 +157,147 @@
  11910. + NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS,
  11911. + NL80211_ATTR_SCHED_SCAN_PLANS,
  11912. +
  11913. ++ NL80211_ATTR_PBSS,
  11914. ++
  11915. ++ NL80211_ATTR_BSS_SELECT,
  11916. ++
  11917. ++ NL80211_ATTR_STA_SUPPORT_P2P_PS,
  11918. ++
  11919. ++ NL80211_ATTR_PAD,
  11920. ++
  11921. + NL80211_ATTR_WIPHY_ANTENNA_GAIN,
  11922. +
  11923. /* add attributes here, update the policy in nl80211.c */
  11924. __NL80211_ATTR_AFTER_LAST,
  11925. -@@ -3364,6 +3396,9 @@ enum nl80211_bss_scan_width {
  11926. +@@ -2273,6 +2349,20 @@ enum nl80211_sta_flags {
  11927. + NL80211_STA_FLAG_MAX = __NL80211_STA_FLAG_AFTER_LAST - 1
  11928. + };
  11929. +
  11930. ++/**
  11931. ++ * enum nl80211_sta_p2p_ps_status - station support of P2P PS
  11932. ++ *
  11933. ++ * @NL80211_P2P_PS_UNSUPPORTED: station doesn't support P2P PS mechanism
  11934. ++ * @@NL80211_P2P_PS_SUPPORTED: station supports P2P PS mechanism
  11935. ++ * @NUM_NL80211_P2P_PS_STATUS: number of values
  11936. ++ */
  11937. ++enum nl80211_sta_p2p_ps_status {
  11938. ++ NL80211_P2P_PS_UNSUPPORTED = 0,
  11939. ++ NL80211_P2P_PS_SUPPORTED,
  11940. ++
  11941. ++ NUM_NL80211_P2P_PS_STATUS,
  11942. ++};
  11943. ++
  11944. + #define NL80211_STA_FLAG_MAX_OLD_API NL80211_STA_FLAG_TDLS_PEER
  11945. +
  11946. + /**
  11947. +@@ -2430,6 +2520,9 @@ enum nl80211_sta_bss_param {
  11948. + * TID+1 and the special TID 16 (i.e. value 17) is used for non-QoS frames;
  11949. + * each one of those is again nested with &enum nl80211_tid_stats
  11950. + * attributes carrying the actual values.
  11951. ++ * @NL80211_STA_INFO_RX_DURATION: aggregate PPDU duration for all frames
  11952. ++ * received from the station (u64, usec)
  11953. ++ * @NL80211_STA_INFO_PAD: attribute used for padding for 64-bit alignment
  11954. + * @__NL80211_STA_INFO_AFTER_LAST: internal
  11955. + * @NL80211_STA_INFO_MAX: highest possible station info attribute
  11956. + */
  11957. +@@ -2466,6 +2559,8 @@ enum nl80211_sta_info {
  11958. + NL80211_STA_INFO_BEACON_RX,
  11959. + NL80211_STA_INFO_BEACON_SIGNAL_AVG,
  11960. + NL80211_STA_INFO_TID_STATS,
  11961. ++ NL80211_STA_INFO_RX_DURATION,
  11962. ++ NL80211_STA_INFO_PAD,
  11963. +
  11964. + /* keep last */
  11965. + __NL80211_STA_INFO_AFTER_LAST,
  11966. +@@ -2482,6 +2577,7 @@ enum nl80211_sta_info {
  11967. + * transmitted MSDUs (not counting the first attempt; u64)
  11968. + * @NL80211_TID_STATS_TX_MSDU_FAILED: number of failed transmitted
  11969. + * MSDUs (u64)
  11970. ++ * @NL80211_TID_STATS_PAD: attribute used for padding for 64-bit alignment
  11971. + * @NUM_NL80211_TID_STATS: number of attributes here
  11972. + * @NL80211_TID_STATS_MAX: highest numbered attribute here
  11973. + */
  11974. +@@ -2491,6 +2587,7 @@ enum nl80211_tid_stats {
  11975. + NL80211_TID_STATS_TX_MSDU,
  11976. + NL80211_TID_STATS_TX_MSDU_RETRIES,
  11977. + NL80211_TID_STATS_TX_MSDU_FAILED,
  11978. ++ NL80211_TID_STATS_PAD,
  11979. +
  11980. + /* keep last */
  11981. + NUM_NL80211_TID_STATS,
  11982. +@@ -2927,6 +3024,7 @@ enum nl80211_user_reg_hint_type {
  11983. + * transmitting data (on channel or globally)
  11984. + * @NL80211_SURVEY_INFO_TIME_SCAN: time the radio spent for scan
  11985. + * (on this channel or globally)
  11986. ++ * @NL80211_SURVEY_INFO_PAD: attribute used for padding for 64-bit alignment
  11987. + * @NL80211_SURVEY_INFO_MAX: highest survey info attribute number
  11988. + * currently defined
  11989. + * @__NL80211_SURVEY_INFO_AFTER_LAST: internal use
  11990. +@@ -2942,6 +3040,7 @@ enum nl80211_survey_info {
  11991. + NL80211_SURVEY_INFO_TIME_RX,
  11992. + NL80211_SURVEY_INFO_TIME_TX,
  11993. + NL80211_SURVEY_INFO_TIME_SCAN,
  11994. ++ NL80211_SURVEY_INFO_PAD,
  11995. +
  11996. + /* keep last */
  11997. + __NL80211_SURVEY_INFO_AFTER_LAST,
  11998. +@@ -3364,6 +3463,10 @@ enum nl80211_bss_scan_width {
  11999. * (not present if no beacon frame has been received yet)
  12000. * @NL80211_BSS_PRESP_DATA: the data in @NL80211_BSS_INFORMATION_ELEMENTS and
  12001. * @NL80211_BSS_TSF is known to be from a probe response (flag attribute)
  12002. + * @NL80211_BSS_LAST_SEEN_BOOTTIME: CLOCK_BOOTTIME timestamp when this entry
  12003. + * was last updated by a received frame. The value is expected to be
  12004. + * accurate to about 10ms. (u64, nanoseconds)
  12005. ++ * @NL80211_BSS_PAD: attribute used for padding for 64-bit alignment
  12006. * @__NL80211_BSS_AFTER_LAST: internal
  12007. * @NL80211_BSS_MAX: highest BSS attribute
  12008. */
  12009. -@@ -3383,6 +3418,7 @@ enum nl80211_bss {
  12010. +@@ -3383,6 +3486,8 @@ enum nl80211_bss {
  12011. NL80211_BSS_CHAN_WIDTH,
  12012. NL80211_BSS_BEACON_TSF,
  12013. NL80211_BSS_PRESP_DATA,
  12014. + NL80211_BSS_LAST_SEEN_BOOTTIME,
  12015. ++ NL80211_BSS_PAD,
  12016. /* keep last */
  12017. __NL80211_BSS_AFTER_LAST,
  12018. -@@ -4589,4 +4625,28 @@ enum nl80211_tdls_peer_capability {
  12019. +@@ -3568,11 +3673,15 @@ enum nl80211_txrate_gi {
  12020. + * @NL80211_BAND_2GHZ: 2.4 GHz ISM band
  12021. + * @NL80211_BAND_5GHZ: around 5 GHz band (4.9 - 5.7 GHz)
  12022. + * @NL80211_BAND_60GHZ: around 60 GHz band (58.32 - 64.80 GHz)
  12023. ++ * @NUM_NL80211_BANDS: number of bands, avoid using this in userspace
  12024. ++ * since newer kernel versions may support more bands
  12025. + */
  12026. + enum nl80211_band {
  12027. + NL80211_BAND_2GHZ,
  12028. + NL80211_BAND_5GHZ,
  12029. + NL80211_BAND_60GHZ,
  12030. ++
  12031. ++ NUM_NL80211_BANDS,
  12032. + };
  12033. +
  12034. + /**
  12035. +@@ -4358,12 +4467,18 @@ enum nl80211_feature_flags {
  12036. + /**
  12037. + * enum nl80211_ext_feature_index - bit index of extended features.
  12038. + * @NL80211_EXT_FEATURE_VHT_IBSS: This driver supports IBSS with VHT datarates.
  12039. ++ * @NL80211_EXT_FEATURE_RRM: This driver supports RRM. When featured, user can
  12040. ++ * can request to use RRM (see %NL80211_ATTR_USE_RRM) with
  12041. ++ * %NL80211_CMD_ASSOCIATE and %NL80211_CMD_CONNECT requests, which will set
  12042. ++ * the ASSOC_REQ_USE_RRM flag in the association request even if
  12043. ++ * NL80211_FEATURE_QUIET is not advertized.
  12044. + *
  12045. + * @NUM_NL80211_EXT_FEATURES: number of extended features.
  12046. + * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
  12047. + */
  12048. + enum nl80211_ext_feature_index {
  12049. + NL80211_EXT_FEATURE_VHT_IBSS,
  12050. ++ NL80211_EXT_FEATURE_RRM,
  12051. +
  12052. + /* add new features before the definition below */
  12053. + NUM_NL80211_EXT_FEATURES,
  12054. +@@ -4589,4 +4704,72 @@ enum nl80211_tdls_peer_capability {
  12055. NL80211_TDLS_PEER_WMM = 1<<2,
  12056. };
  12057. @@ -108,4 +325,48 @@
  12058. + __NL80211_SCHED_SCAN_PLAN_AFTER_LAST - 1
  12059. +};
  12060. +
  12061. ++/**
  12062. ++ * struct nl80211_bss_select_rssi_adjust - RSSI adjustment parameters.
  12063. ++ *
  12064. ++ * @band: band of BSS that must match for RSSI value adjustment.
  12065. ++ * @delta: value used to adjust the RSSI value of matching BSS.
  12066. ++ */
  12067. ++struct nl80211_bss_select_rssi_adjust {
  12068. ++ __u8 band;
  12069. ++ __s8 delta;
  12070. ++} __attribute__((packed));
  12071. ++
  12072. ++/**
  12073. ++ * enum nl80211_bss_select_attr - attributes for bss selection.
  12074. ++ *
  12075. ++ * @__NL80211_BSS_SELECT_ATTR_INVALID: reserved.
  12076. ++ * @NL80211_BSS_SELECT_ATTR_RSSI: Flag indicating only RSSI-based BSS selection
  12077. ++ * is requested.
  12078. ++ * @NL80211_BSS_SELECT_ATTR_BAND_PREF: attribute indicating BSS
  12079. ++ * selection should be done such that the specified band is preferred.
  12080. ++ * When there are multiple BSS-es in the preferred band, the driver
  12081. ++ * shall use RSSI-based BSS selection as a second step. The value of
  12082. ++ * this attribute is according to &enum nl80211_band (u32).
  12083. ++ * @NL80211_BSS_SELECT_ATTR_RSSI_ADJUST: When present the RSSI level for
  12084. ++ * BSS-es in the specified band is to be adjusted before doing
  12085. ++ * RSSI-based BSS selection. The attribute value is a packed structure
  12086. ++ * value as specified by &struct nl80211_bss_select_rssi_adjust.
  12087. ++ * @NL80211_BSS_SELECT_ATTR_MAX: highest bss select attribute number.
  12088. ++ * @__NL80211_BSS_SELECT_ATTR_AFTER_LAST: internal use.
  12089. ++ *
  12090. ++ * One and only one of these attributes are found within %NL80211_ATTR_BSS_SELECT
  12091. ++ * for %NL80211_CMD_CONNECT. It specifies the required BSS selection behaviour
  12092. ++ * which the driver shall use.
  12093. ++ */
  12094. ++enum nl80211_bss_select_attr {
  12095. ++ __NL80211_BSS_SELECT_ATTR_INVALID,
  12096. ++ NL80211_BSS_SELECT_ATTR_RSSI,
  12097. ++ NL80211_BSS_SELECT_ATTR_BAND_PREF,
  12098. ++ NL80211_BSS_SELECT_ATTR_RSSI_ADJUST,
  12099. ++
  12100. ++ /* keep last */
  12101. ++ __NL80211_BSS_SELECT_ATTR_AFTER_LAST,
  12102. ++ NL80211_BSS_SELECT_ATTR_MAX = __NL80211_BSS_SELECT_ATTR_AFTER_LAST - 1
  12103. ++};
  12104. ++
  12105. #endif /* __LINUX_NL80211_H */
  12106. 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
  12107. index 574c490..2cdf360 100644
  12108. --- a/package/network/utils/iw/patches/300-display_interface_TX_power.patch
  12109. +++ b/package/network/utils/iw/patches/300-display_interface_TX_power.patch
  12110. @@ -12,11 +12,9 @@ Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  12111. interface.c | 7 +++++++
  12112. 1 file changed, 7 insertions(+)
  12113. -diff --git a/interface.c b/interface.c
  12114. -index 73ccecd..4f0821d 100644
  12115. --- a/interface.c
  12116. +++ b/interface.c
  12117. -@@ -368,6 +368,13 @@ static int print_iface_handler(struct nl_msg *msg, void *arg)
  12118. +@@ -368,6 +368,13 @@ static int print_iface_handler(struct nl
  12119. printf("\n");
  12120. }
  12121. diff --git a/package/network/utils/iw/patches/301-ibss_add_VHT80.patch b/package/network/utils/iw/patches/301-ibss_add_VHT80.patch
  12122. index 709fbb2..0627bcc 100644
  12123. --- a/package/network/utils/iw/patches/301-ibss_add_VHT80.patch
  12124. +++ b/package/network/utils/iw/patches/301-ibss_add_VHT80.patch
  12125. @@ -14,8 +14,6 @@ Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  12126. ibss.c | 49 +++++++++++++++++++++++++++++++++++++++++--------
  12127. 1 file changed, 41 insertions(+), 8 deletions(-)
  12128. -diff --git a/ibss.c b/ibss.c
  12129. -index 7a0b707..a99a262 100644
  12130. --- a/ibss.c
  12131. +++ b/ibss.c
  12132. @@ -16,6 +16,39 @@
  12133. @@ -58,7 +56,7 @@ index 7a0b707..a99a262 100644
  12134. static int join_ibss(struct nl80211_state *state,
  12135. struct nl_msg *msg,
  12136. int argc, char **argv,
  12137. -@@ -30,12 +63,8 @@ static int join_ibss(struct nl80211_state *state,
  12138. +@@ -30,12 +63,8 @@ static int join_ibss(struct nl80211_stat
  12139. int bintval;
  12140. int i;
  12141. unsigned long freq;
  12142. @@ -73,7 +71,7 @@ index 7a0b707..a99a262 100644
  12143. { .name = "HT20",
  12144. .width = NL80211_CHAN_WIDTH_20,
  12145. .freq1_diff = 0,
  12146. -@@ -60,6 +89,10 @@ static int join_ibss(struct nl80211_state *state,
  12147. +@@ -60,6 +89,10 @@ static int join_ibss(struct nl80211_stat
  12148. .width = NL80211_CHAN_WIDTH_10,
  12149. .freq1_diff = 0,
  12150. .chantype = -1 },
  12151. @@ -84,7 +82,7 @@ index 7a0b707..a99a262 100644
  12152. };
  12153. if (argc < 2)
  12154. -@@ -90,7 +123,7 @@ static int join_ibss(struct nl80211_state *state,
  12155. +@@ -90,7 +123,7 @@ static int join_ibss(struct nl80211_stat
  12156. NLA_PUT_U32(msg, NL80211_ATTR_CHANNEL_WIDTH,
  12157. chanmode_selected->width);
  12158. NLA_PUT_U32(msg, NL80211_ATTR_CENTER_FREQ1,
  12159. 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
  12160. index fc44427..f96d5ea 100644
  12161. --- a/package/network/utils/iw/patches/302-ibss_use_MHz_instead_MHZ.patch
  12162. +++ b/package/network/utils/iw/patches/302-ibss_use_MHz_instead_MHZ.patch
  12163. @@ -7,11 +7,9 @@ Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  12164. ibss.c | 8 ++++----
  12165. 1 file changed, 4 insertions(+), 4 deletions(-)
  12166. -diff --git a/ibss.c b/ibss.c
  12167. -index a99a262..23bda70 100644
  12168. --- a/ibss.c
  12169. +++ b/ibss.c
  12170. -@@ -81,15 +81,15 @@ static int join_ibss(struct nl80211_state *state,
  12171. +@@ -81,15 +81,15 @@ static int join_ibss(struct nl80211_stat
  12172. .width = NL80211_CHAN_WIDTH_20_NOHT,
  12173. .freq1_diff = 0,
  12174. .chantype = NL80211_CHAN_NO_HT },
  12175. diff --git a/package/network/utils/iw/patches/303-mesh_add_VHT80.patch b/package/network/utils/iw/patches/303-mesh_add_VHT80.patch
  12176. index fe8dc21..956b050 100644
  12177. --- a/package/network/utils/iw/patches/303-mesh_add_VHT80.patch
  12178. +++ b/package/network/utils/iw/patches/303-mesh_add_VHT80.patch
  12179. @@ -15,8 +15,6 @@ Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
  12180. util.c | 26 ++++++++++++++++++++++++++
  12181. 4 files changed, 43 insertions(+), 41 deletions(-)
  12182. -diff --git a/ibss.c b/ibss.c
  12183. -index 23bda70..ac06fc5 100644
  12184. --- a/ibss.c
  12185. +++ b/ibss.c
  12186. @@ -16,39 +16,6 @@
  12187. @@ -59,8 +57,6 @@ index 23bda70..ac06fc5 100644
  12188. static int join_ibss(struct nl80211_state *state,
  12189. struct nl_msg *msg,
  12190. int argc, char **argv,
  12191. -diff --git a/iw.h b/iw.h
  12192. -index cef9da8..8e1a37a 100644
  12193. --- a/iw.h
  12194. +++ b/iw.h
  12195. @@ -59,6 +59,13 @@ struct cmd {
  12196. @@ -77,7 +73,7 @@ index cef9da8..8e1a37a 100644
  12197. #define ARRAY_SIZE(ar) (sizeof(ar)/sizeof(ar[0]))
  12198. #define DIV_ROUND_UP(x, y) (((x) + (y - 1)) / (y))
  12199. -@@ -174,6 +181,8 @@ void print_ies(unsigned char *ie, int ielen, bool unknown,
  12200. +@@ -174,6 +181,8 @@ void print_ies(unsigned char *ie, int ie
  12201. void parse_bitrate(struct nlattr *bitrate_attr, char *buf, int buflen);
  12202. void iw_hexdump(const char *prefix, const __u8 *data, size_t len);
  12203. @@ -86,11 +82,9 @@ index cef9da8..8e1a37a 100644
  12204. #define SCHED_SCAN_OPTIONS "interval <in_msecs> [delay <in_secs>] " \
  12205. "[freqs <freq>+] [matches [ssid <ssid>]+]] [active [ssid <ssid>]+|passive] [randomise[=<addr>/<mask>]]"
  12206. int parse_sched_scan(struct nl_msg *msg, int *argc, char ***argv);
  12207. -diff --git a/mesh.c b/mesh.c
  12208. -index 0090530..930d58f 100644
  12209. --- a/mesh.c
  12210. +++ b/mesh.c
  12211. -@@ -439,12 +439,8 @@ static int join_mesh(struct nl80211_state *state,
  12212. +@@ -439,12 +439,8 @@ static int join_mesh(struct nl80211_stat
  12213. int bintval, dtim_period, i, n_rates = 0;
  12214. char *end, *value = NULL, *sptr = NULL;
  12215. unsigned long freq = 0;
  12216. @@ -105,7 +99,7 @@ index 0090530..930d58f 100644
  12217. { .name = "HT20",
  12218. .width = NL80211_CHAN_WIDTH_20,
  12219. .freq1_diff = 0,
  12220. -@@ -461,6 +457,10 @@ static int join_mesh(struct nl80211_state *state,
  12221. +@@ -461,6 +457,10 @@ static int join_mesh(struct nl80211_stat
  12222. .width = NL80211_CHAN_WIDTH_20_NOHT,
  12223. .freq1_diff = 0,
  12224. .chantype = NL80211_CHAN_NO_HT },
  12225. @@ -116,7 +110,7 @@ index 0090530..930d58f 100644
  12226. };
  12227. if (argc < 1)
  12228. -@@ -497,7 +497,7 @@ static int join_mesh(struct nl80211_state *state,
  12229. +@@ -497,7 +497,7 @@ static int join_mesh(struct nl80211_stat
  12230. NLA_PUT_U32(msg, NL80211_ATTR_CHANNEL_WIDTH,
  12231. chanmode_selected->width);
  12232. NLA_PUT_U32(msg, NL80211_ATTR_CENTER_FREQ1,
  12233. @@ -125,7 +119,7 @@ index 0090530..930d58f 100644
  12234. if (chanmode_selected->chantype != -1)
  12235. NLA_PUT_U32(msg,
  12236. NL80211_ATTR_WIPHY_CHANNEL_TYPE,
  12237. -@@ -599,7 +599,7 @@ static int join_mesh(struct nl80211_state *state,
  12238. +@@ -599,7 +599,7 @@ static int join_mesh(struct nl80211_stat
  12239. nla_put_failure:
  12240. return -ENOBUFS;
  12241. }
  12242. @@ -134,11 +128,9 @@ index 0090530..930d58f 100644
  12243. " [basic-rates <rate in Mbps,rate2,...>]], [mcast-rate <rate in Mbps>]"
  12244. " [beacon-interval <time in TUs>] [dtim-period <value>]"
  12245. " [vendor_sync on|off] [<param>=<value>]*",
  12246. -diff --git a/util.c b/util.c
  12247. -index 4efc4c8..d75ffe0 100644
  12248. --- a/util.c
  12249. +++ b/util.c
  12250. -@@ -728,3 +728,29 @@ void iw_hexdump(const char *prefix, const __u8 *buf, size_t size)
  12251. +@@ -728,3 +728,29 @@ void iw_hexdump(const char *prefix, cons
  12252. }
  12253. printf("\n\n");
  12254. }
  12255. 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
  12256. index d382453..20bb06e 100644
  12257. --- a/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.c
  12258. +++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.c
  12259. @@ -39,6 +39,18 @@ __init void ap9x_pci_setup_wmac_led_pin(unsigned wmac, int pin)
  12260. }
  12261. }
  12262. +__init void ap9x_pci_setup_wmac_led_name(unsigned wmac, const char *led_name)
  12263. +{
  12264. + switch (wmac) {
  12265. + case 0:
  12266. + ap9x_wmac0_data.led_name = led_name;
  12267. + break;
  12268. + case 1:
  12269. + ap9x_wmac1_data.led_name = led_name;
  12270. + break;
  12271. + }
  12272. +}
  12273. +
  12274. __init struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac)
  12275. {
  12276. switch (wmac) {
  12277. @@ -81,6 +93,20 @@ __init void ap9x_pci_setup_wmac_leds(unsigned wmac, struct gpio_led *leds,
  12278. }
  12279. }
  12280. +__init void ap9x_pci_setup_wmac_btns(unsigned wmac,
  12281. + struct gpio_keys_button *btns,
  12282. + unsigned num_btns, unsigned poll_interval)
  12283. +{
  12284. + struct ath9k_platform_data *ap9x_wmac_data;
  12285. +
  12286. + if (!(ap9x_wmac_data = ap9x_pci_get_wmac_data(wmac)))
  12287. + return;
  12288. +
  12289. + ap9x_wmac_data->btns = btns;
  12290. + ap9x_wmac_data->num_btns = num_btns;
  12291. + ap9x_wmac_data->btn_poll_interval = poll_interval;
  12292. +}
  12293. +
  12294. static int ap91_pci_plat_dev_init(struct pci_dev *dev)
  12295. {
  12296. switch (PCI_SLOT(dev->devfn)) {
  12297. 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
  12298. index ad288cb..d7c0185 100644
  12299. --- a/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.h
  12300. +++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.h
  12301. @@ -12,6 +12,7 @@
  12302. #define _ATH79_DEV_AP9X_PCI_H
  12303. struct gpio_led;
  12304. +struct gpio_keys_button;
  12305. struct ath9k_platform_data;
  12306. #if defined(CONFIG_ATH79_DEV_AP9X_PCI)
  12307. @@ -19,6 +20,9 @@ void ap9x_pci_setup_wmac_led_pin(unsigned wmac, int pin);
  12308. void ap9x_pci_setup_wmac_gpio(unsigned wmac, u32 mask, u32 val);
  12309. void ap9x_pci_setup_wmac_leds(unsigned wmac, struct gpio_led *leds,
  12310. int num_leds);
  12311. +void ap9x_pci_setup_wmac_led_name(unsigned wmac, const char *led_name);
  12312. +void ap9x_pci_setup_wmac_btns(unsigned wmac, struct gpio_keys_button *btns,
  12313. + unsigned num_btns, unsigned poll_interval);
  12314. struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac);
  12315. void ap91_pci_init(u8 *cal_data, u8 *mac_addr);
  12316. @@ -33,6 +37,12 @@ static inline void ap9x_pci_setup_wmac_gpio(unsigned wmac,
  12317. static inline void ap9x_pci_setup_wmac_leds(unsigned wmac,
  12318. struct gpio_led *leds,
  12319. int num_leds) {}
  12320. +static inline void ap9x_pci_setup_wmac_led_name(unsigned wmac,
  12321. + const char *led_name) {}
  12322. +static inline void ap9x_pci_setup_wmac_btns(unsigned wmac,
  12323. + struct gpio_keys_button *btns,
  12324. + unsigned num_btns,
  12325. + unsigned poll_interval) {}
  12326. static inline struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac)
  12327. {
  12328. return NULL;
  12329. diff --git a/target/linux/generic/files/include/linux/ath9k_platform.h b/target/linux/generic/files/include/linux/ath9k_platform.h
  12330. index 30ce216..2c19f3b 100644
  12331. --- a/target/linux/generic/files/include/linux/ath9k_platform.h
  12332. +++ b/target/linux/generic/files/include/linux/ath9k_platform.h
  12333. @@ -31,6 +31,10 @@ struct ath9k_platform_data {
  12334. u32 gpio_mask;
  12335. u32 gpio_val;
  12336. + u32 bt_active_pin;
  12337. + u32 bt_priority_pin;
  12338. + u32 wlan_active_pin;
  12339. +
  12340. bool endian_check;
  12341. bool is_clk_25mhz;
  12342. bool tx_gain_buffalo;
  12343. @@ -45,6 +49,11 @@ struct ath9k_platform_data {
  12344. int num_leds;
  12345. const struct gpio_led *leds;
  12346. + const char *led_name;
  12347. +
  12348. + unsigned num_btns;
  12349. + const struct gpio_keys_button *btns;
  12350. + unsigned btn_poll_interval;
  12351. };
  12352. #endif /* _LINUX_ATH9K_PLATFORM_H */