0007-mac80211-hostapd-iw-.-update.patch 918 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897
  1. From: Matthias Schiffer <mschiffer@universe-factory.net>
  2. Date: Tue, 11 Oct 2016 02:53:43 +0200
  3. Subject: mac80211, hostapd, iw, ...: update
  4. The following package is updated to
  5. LEDE 6c2651566cce8f5b3a3d3b976439dee2bac5e07e:
  6. * mac80211
  7. The following packages are updated to
  8. LEDE 42f559ed70897a7b74dd3e6293b42e6d2e511eaa:
  9. * acx-mac80211
  10. * ath10k-firmware
  11. * hostapd
  12. * iw
  13. * linux-firmware
  14. * mt76
  15. * mwlwifi
  16. diff --git a/package/firmware/ath10k-firmware/Makefile b/package/firmware/ath10k-firmware/Makefile
  17. index b03d644..624da6a 100644
  18. --- a/package/firmware/ath10k-firmware/Makefile
  19. +++ b/package/firmware/ath10k-firmware/Makefile
  20. @@ -8,7 +8,7 @@
  21. include $(TOPDIR)/rules.mk
  22. PKG_NAME:=ath10k-firmware
  23. -PKG_SOURCE_VERSION:=77f72b5f7dd940386d9e619a17904987759b7186
  24. +PKG_SOURCE_VERSION:=b00eb8d30fbebb6a5047ccacefa8c37e072fca9c
  25. PKG_VERSION:=2014-11-13-$(PKG_SOURCE_VERSION)
  26. PKG_RELEASE:=1
  27. @@ -17,7 +17,7 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  28. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  29. PKG_SOURCE_URL:=https://github.com/kvalo/ath10k-firmware.git
  30. -PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  31. +PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  32. include $(INCLUDE_DIR)/package.mk
  33. @@ -28,14 +28,48 @@ define Package/ath10k-firmware-default
  34. CATEGORY:=Kernel modules
  35. SUBMENU:=$(WMENU)
  36. URL:=$(PKG_SOURCE_URL)
  37. + DEPENDS:=
  38. endef
  39. +define Package/ath10k-firmware-qca9887
  40. +$(Package/ath10k-firmware-default)
  41. + TITLE:=ath10k firmware for QCA9887 devices
  42. +endef
  43. +
  44. +QCA9887_REV:=3cce88e245f2d685e49411c4f80998f94baf67b8
  45. +QCA9887_FIRMWARE_FILE:=firmware-5.bin_10.2.4-1.0-00013
  46. +QCA9887_FIRMWARE_FILE_MD5:=bd9cdcbf49561c7176432a81c29e7e87
  47. +QCA9887_FIRMWARE_FILE_DL:=$(QCA9887_FIRMWARE_FILE).$(QCA9887_FIRMWARE_FILE_MD5)
  48. +QCA9887_BOARD_FILE:=board.bin
  49. +QCA9887_BOARD_FILE_MD5:=ebf3af10160c45373f19e0b8226b02ae
  50. +QCA9887_BOARD_FILE_DL:=$(QCA9887_BOARD_FILE).$(QCA9887_BOARD_FILE_MD5)
  51. +
  52. +define Download/ath10k-qca9887-firmware
  53. + URL:=https://github.com/kvalo/ath10k-firmware/raw/$(QCA9887_REV)/QCA9887/hw1.0/
  54. + URL_FILE:=$(QCA9887_FIRMWARE_FILE)
  55. + FILE:=$(QCA9887_FIRMWARE_FILE_DL)
  56. + MD5SUM:=$(QCA9887_FIRMWARE_FILE_MD5)
  57. +endef
  58. +$(eval $(call Download,ath10k-qca9887-firmware))
  59. +
  60. +define Download/ath10k-qca9887-board
  61. + URL:=https://github.com/kvalo/ath10k-firmware/raw/$(QCA9887_REV)/QCA9887/hw1.0/
  62. + URL_FILE:=$(QCA9887_BOARD_FILE)
  63. + FILE:=$(QCA9887_BOARD_FILE_DL)
  64. + MD5SUM:=$(QCA9887_BOARD_FILE_MD5)
  65. +endef
  66. +$(eval $(call Download,ath10k-qca9887-board))
  67. +
  68. define Package/ath10k-firmware-qca988x
  69. $(Package/ath10k-firmware-default)
  70. + DEFAULT:=PACKAGE_kmod-ath10k
  71. TITLE:=ath10k firmware for QCA988x devices
  72. endef
  73. QCA988X_FIRMWARE_FILE:=firmware-5.bin_10.2.4.97-1
  74. +QCA988X_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-16.1.bin-lede
  75. +QCA99X0_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-7.bin-lede.004
  76. +QCA9984_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-7.bin-lede.004
  77. define Download/ath10k-firmware-qca988x
  78. URL:=https://www.codeaurora.org/cgit/quic/qsdk/oss/firmware/ath10k-firmware/plain/10.2.4/
  79. @@ -44,11 +78,83 @@ define Download/ath10k-firmware-qca988x
  80. endef
  81. $(eval $(call Download,ath10k-firmware-qca988x))
  82. +define Download/ath10k-firmware-qca988x-ct
  83. + URL:=https://www.candelatech.com/downloads/
  84. + FILE:=$(QCA988X_FIRMWARE_FILE_CT)
  85. + MD5SUM:=d7e081e9782936ed544b78994c9133fb
  86. +endef
  87. +$(eval $(call Download,ath10k-firmware-qca988x-ct))
  88. +
  89. +define Download/ath10k-firmware-qca99x0-ct
  90. + URL:=https://www.candelatech.com/downloads/ath10k-10-4/
  91. + FILE:=$(QCA99X0_FIRMWARE_FILE_CT)
  92. + MD5SUM:=809bb9bf8a18ea218a8e1b9ffc0f8447
  93. +endef
  94. +$(eval $(call Download,ath10k-firmware-qca99x0-ct))
  95. +
  96. +define Download/ath10k-firmware-qca9984-ct
  97. + URL:=https://www.candelatech.com/downloads/ath10k-9984-10-4/
  98. + FILE:=$(QCA9984_FIRMWARE_FILE_CT)
  99. + MD5SUM:=924eb8ea30de11299b13e207469a3350
  100. +endef
  101. +$(eval $(call Download,ath10k-firmware-qca9984-ct))
  102. +
  103. define Package/ath10k-firmware-qca99x0
  104. $(Package/ath10k-firmware-default)
  105. TITLE:=ath10k firmware for QCA99x0 devices
  106. endef
  107. +define Package/ath10k-firmware-qca988x-ct
  108. +$(Package/ath10k-firmware-default)
  109. + TITLE:=ath10k CT 10.1 firmware for QCA988x devices
  110. +endef
  111. +
  112. +define Package/ath10k-firmware-qca988x-ct/description
  113. +Alternative ath10k firmware for QCA988X from Candela Technologies.
  114. +Enables IBSS and other features. See:
  115. +http://www.candelatech.com/ath10k-10.1.php
  116. +This firmware will NOT be used unless the standard ath10k-firmware-qca988x
  117. +is un-selected since the driver will try to load firmware-5.bin before
  118. +firmware-2.bin
  119. +endef
  120. +
  121. +define Package/ath10k-firmware-qca99x0-ct/description
  122. +Alternative ath10k firmware for QCA99x0 from Candela Technologies.
  123. +Enables IBSS and other features. See:
  124. +http://www.candelatech.com/ath10k-10.4.php
  125. +This firmware conflicts with the standard 99x0 firmware, so select only
  126. +one.
  127. +endef
  128. +
  129. +define Package/ath10k-firmware-qca9984-ct/description
  130. +Alternative ath10k firmware for QCA9984 from Candela Technologies.
  131. +Enables IBSS and other features. See:
  132. +http://www.candelatech.com/ath10k-10.4-9984.php
  133. +This firmware conflicts with the standard 9984 firmware, so select only
  134. +one.
  135. +endef
  136. +
  137. +define Package/ath10k-firmware-qca99x0/description
  138. +Standard ath10k firmware for QCA99x0 from QCA
  139. +This firmware conflicts with the CT 99x0 firmware, so select only
  140. +one.
  141. +endef
  142. +
  143. +define Package/ath10k-firmware-qca99x0-ct
  144. +$(Package/ath10k-firmware-default)
  145. + TITLE:=ath10k CT 10.4.3 firmware for QCA99x0 devices
  146. +endef
  147. +
  148. +define Package/ath10k-firmware-qca9984-ct
  149. +$(Package/ath10k-firmware-default)
  150. + TITLE:=ath10k CT 10.4.3 firmware for QCA9984 devices
  151. +endef
  152. +
  153. +define Package/ath10k-firmware-qca9984
  154. +$(Package/ath10k-firmware-default)
  155. + TITLE:=ath10k firmware for QCA9984 devices
  156. +endef
  157. +
  158. define Package/ath10k-firmware-qca6174
  159. $(Package/ath10k-firmware-default)
  160. TITLE:=ath10k firmware for QCA6174 devices
  161. @@ -58,8 +164,8 @@ QCA99X0_BOARD_REV:=ddcec9efd245da9365c474f513a855a55f3ac7fe
  162. QCA99X0_BOARD_FILE:=board-2.bin.$(QCA99X0_BOARD_REV)
  163. define Download/qca99x0-board
  164. - URL:=https://www.codeaurora.org/cgit/quic/qsdk/oss/firmware/ath10k-firmware/plain/ath10k/QCA99X0/hw2.0
  165. - URL_FILE:=board-2.bin?id=ddcec9efd245da9365c474f513a855a55f3ac7fe
  166. + URL:=https://source.codeaurora.org/quic/qsdk/oss/firmware/ath10k-firmware/plain/ath10k/QCA99X0/hw2.0
  167. + URL_FILE:=board-2.bin?id=$(QCA99X0_BOARD_REV)
  168. FILE:=$(QCA99X0_BOARD_FILE)
  169. MD5SUM:=a2b3c653c2363a5641200051d6333d0a
  170. endef
  171. @@ -69,6 +175,16 @@ define Build/Compile
  172. endef
  173. +define Package/ath10k-firmware-qca9887/install
  174. + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9887/hw1.0
  175. + $(INSTALL_DATA) \
  176. + $(DL_DIR)/$(QCA9887_FIRMWARE_FILE_DL) \
  177. + $(1)/lib/firmware/ath10k/QCA9887/hw1.0/firmware-5.bin
  178. + $(INSTALL_DATA) \
  179. + $(DL_DIR)/$(QCA9887_BOARD_FILE_DL) \
  180. + $(1)/lib/firmware/ath10k/QCA9887/hw1.0/board.bin
  181. +endef
  182. +
  183. define Package/ath10k-firmware-qca988x/install
  184. $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA988X/hw2.0
  185. $(INSTALL_DATA) \
  186. @@ -79,6 +195,16 @@ define Package/ath10k-firmware-qca988x/install
  187. $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-5.bin
  188. endef
  189. +define Package/ath10k-firmware-qca988x-ct/install
  190. + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA988X/hw2.0
  191. + $(INSTALL_DATA) \
  192. + $(PKG_BUILD_DIR)/QCA988X/board.bin \
  193. + $(1)/lib/firmware/ath10k/QCA988X/hw2.0/
  194. + $(INSTALL_DATA) \
  195. + $(DL_DIR)/$(QCA988X_FIRMWARE_FILE_CT) \
  196. + $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-2.bin
  197. +endef
  198. +
  199. define Package/ath10k-firmware-qca6174/install
  200. $(INSTALL_DIR) $(1)/lib/firmware/ath10k
  201. $(CP) $(PKG_BUILD_DIR)/QCA6174 $(1)/lib/firmware/ath10k/
  202. @@ -97,6 +223,51 @@ define Package/ath10k-firmware-qca99x0/install
  203. $(1)/lib/firmware/ath10k/QCA99X0/hw2.0/firmware-5.bin
  204. endef
  205. +define Package/ath10k-firmware-qca99x0-ct/install
  206. + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA99X0/hw2.0
  207. + $(INSTALL_DATA) \
  208. + $(DL_DIR)/$(QCA99X0_BOARD_FILE) \
  209. + $(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board-2.bin
  210. + $(INSTALL_DATA) \
  211. + $(PKG_BUILD_DIR)/QCA99X0/hw2.0/boardData_AR900B_CUS239_5G_v2_001.bin \
  212. + $(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board.bin
  213. + $(INSTALL_DATA) \
  214. + $(DL_DIR)/$(QCA99X0_FIRMWARE_FILE_CT) \
  215. + $(1)/lib/firmware/ath10k/QCA99X0/hw2.0/firmware-5.bin
  216. +endef
  217. +
  218. +define Package/ath10k-firmware-qca9984/install
  219. + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9984/hw1.0
  220. + ln -s \
  221. + ../../cal-pci-0000:01:00.0.bin \
  222. + $(1)/lib/firmware/ath10k/QCA9984/hw1.0/board.bin
  223. + $(INSTALL_DATA) \
  224. + $(PKG_BUILD_DIR)/QCA9984/hw1.0/board-2.bin \
  225. + $(1)/lib/firmware/ath10k/QCA9984/hw1.0/board-2.bin
  226. + $(INSTALL_DATA) \
  227. + $(PKG_BUILD_DIR)/QCA9984/hw1.0/firmware-5.bin_10.4-3.2-00072 \
  228. + $(1)/lib/firmware/ath10k/QCA9984/hw1.0/firmware-5.bin
  229. +endef
  230. +
  231. +define Package/ath10k-firmware-qca9984-ct/install
  232. + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9984/hw1.0
  233. + ln -s \
  234. + ../../cal-pci-0000:01:00.0.bin \
  235. + $(1)/lib/firmware/ath10k/QCA9984/hw1.0/board.bin
  236. + $(INSTALL_DATA) \
  237. + $(PKG_BUILD_DIR)/QCA9984/hw1.0/board-2.bin \
  238. + $(1)/lib/firmware/ath10k/QCA9984/hw1.0/board-2.bin
  239. + $(INSTALL_DATA) \
  240. + $(DL_DIR)/$(QCA9984_FIRMWARE_FILE_CT) \
  241. + $(1)/lib/firmware/ath10k/QCA9984/hw1.0/firmware-5.bin
  242. +endef
  243. +
  244. +$(eval $(call BuildPackage,ath10k-firmware-qca9887))
  245. $(eval $(call BuildPackage,ath10k-firmware-qca988x))
  246. $(eval $(call BuildPackage,ath10k-firmware-qca99x0))
  247. $(eval $(call BuildPackage,ath10k-firmware-qca6174))
  248. +$(eval $(call BuildPackage,ath10k-firmware-qca9984))
  249. +
  250. +$(eval $(call BuildPackage,ath10k-firmware-qca988x-ct))
  251. +$(eval $(call BuildPackage,ath10k-firmware-qca99x0-ct))
  252. +$(eval $(call BuildPackage,ath10k-firmware-qca9984-ct))
  253. diff --git a/package/firmware/linux-firmware/Makefile b/package/firmware/linux-firmware/Makefile
  254. index 2fcd93b..7a2e977 100644
  255. --- a/package/firmware/linux-firmware/Makefile
  256. +++ b/package/firmware/linux-firmware/Makefile
  257. @@ -16,10 +16,10 @@ PKG_SOURCE_PROTO:=git
  258. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  259. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION)
  260. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
  261. -PKG_SOURCE_URL:=git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
  262. -PKG_MIRROR_MD5SUM:=ca4d289ad9380471cae376fc7dd3660a
  263. +PKG_SOURCE_URL:=https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
  264. +PKG_MIRROR_MD5SUM:=8d44332359de89b1936b4ff608a72614
  265. -PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  266. +PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  267. SCAN_DEPS = *.mk
  268. diff --git a/package/firmware/linux-firmware/realtek.mk b/package/firmware/linux-firmware/realtek.mk
  269. index 0f8b1ce..4229ca0 100644
  270. --- a/package/firmware/linux-firmware/realtek.mk
  271. +++ b/package/firmware/linux-firmware/realtek.mk
  272. @@ -43,8 +43,15 @@ endef
  273. $(eval $(call BuildPackage,rtl8192de-firmware))
  274. Package/rtl8192se-firmware = $(call Package/firmware-default,RealTek RTL8192SE firmware)
  275. -define KernelPackage/rtl8192se/install
  276. +define Package/rtl8192se-firmware/install
  277. $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  278. $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8192sefw.bin $(1)/lib/firmware/rtlwifi
  279. endef
  280. $(eval $(call BuildPackage,rtl8192se-firmware))
  281. +
  282. +Package/rtl8192su-firmware = $(call Package/firmware-default,RealTek RTL8192SU firmware)
  283. +define Package/rtl8192su-firmware/install
  284. + $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  285. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8712u.bin $(1)/lib/firmware/rtlwifi
  286. +endef
  287. +$(eval $(call BuildPackage,rtl8192su-firmware))
  288. diff --git a/package/kernel/acx-mac80211/Makefile b/package/kernel/acx-mac80211/Makefile
  289. index 1820e7a..8fce374 100644
  290. --- a/package/kernel/acx-mac80211/Makefile
  291. +++ b/package/kernel/acx-mac80211/Makefile
  292. @@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk
  293. include $(INCLUDE_DIR)/kernel.mk
  294. PKG_NAME:=acx-mac80211
  295. -PKG_REV:=v20130127
  296. -PKG_VERSION:=20130909
  297. +PKG_REV:=b6fc31491020cb01d2cd1acc170cfa03ced7e726
  298. +PKG_VERSION:=20140216
  299. PKG_RELEASE:=1
  300. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
  301. -PKG_SOURCE_URL:=git://acx100.git.sourceforge.net/gitroot/acx100/acx-mac80211
  302. +PKG_SOURCE_URL:=http://git.code.sf.net/p/acx100/acx-mac80211
  303. PKG_SOURCE_PROTO:=git
  304. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  305. PKG_SOURCE_VERSION:=$(PKG_REV)
  306. @@ -190,7 +190,7 @@ define Build/Compile
  307. CROSS_COMPILE="$(TARGET_CROSS)" \
  308. SUBDIRS="$(PKG_BUILD_DIR)" \
  309. $(PKG_EXTRA_KCONFIG) \
  310. - EXTRA_CFLAGS="$(PKG_EXTRA_CFLAGS) -DCONFIG_ACX_MAC80211_VERSION=\"KERNEL_VERSION(3,14,0)\"" \
  311. + EXTRA_CFLAGS="$(PKG_EXTRA_CFLAGS) -DCONFIG_ACX_MAC80211_VERSION=\"KERNEL_VERSION(4,2,0)\"" \
  312. LINUXINCLUDE="-I$(STAGING_DIR)/usr/include/mac80211-backport/uapi -I$(STAGING_DIR)/usr/include/mac80211-backport \
  313. -I$(STAGING_DIR)/usr/include/mac80211/uapi -I$(STAGING_DIR)/usr/include/mac80211 \
  314. -I$(LINUX_DIR)/include -I$(LINUX_DIR)/include/$(LINUX_UAPI_DIR) \
  315. 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
  316. deleted file mode 100644
  317. index fa4a6be..0000000
  318. --- a/package/kernel/acx-mac80211/patches/001-pci-mem-Fix-3.8-build.patch
  319. +++ /dev/null
  320. @@ -1,129 +0,0 @@
  321. -From 8a0f5890019bf43f4bc95ef0754b062ddfcfa9cd Mon Sep 17 00:00:00 2001
  322. -From: Oliver Winker <oliver@oli1170.net>
  323. -Date: Sun, 10 Mar 2013 21:04:23 +0100
  324. -Subject: [PATCH 1/3] pci, mem: Fix 3.8 build
  325. -
  326. -__devexit and __devinit not used anymore in 3.8
  327. -
  328. -Signed-off-by: Reinhard Karcher <reinhard.karcher@gmx.net>
  329. -Signed-off-by: Oliver Winker <oliver@oli1170.net>
  330. ----
  331. - mem.c | 13 ++++++++++++-
  332. - pci.c | 26 +++++++++++++++++++++++++-
  333. - 2 files changed, 37 insertions(+), 2 deletions(-)
  334. -
  335. ---- a/mem.c
  336. -+++ b/mem.c
  337. -@@ -2216,7 +2216,11 @@ int acx100mem_ioctl_set_phy_amp_bias(str
  338. - * ==================================================
  339. - */
  340. -
  341. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  342. - static int __devinit acxmem_probe(struct platform_device *pdev)
  343. -+#else
  344. -+static int acxmem_probe(struct platform_device *pdev)
  345. -+#endif
  346. - {
  347. - acx_device_t *adev = NULL;
  348. - const char *chip_name;
  349. -@@ -2392,7 +2396,11 @@ static int __devinit acxmem_probe(struct
  350. - * pdev - ptr to PCI device structure containing info about pci
  351. - * configuration
  352. - */
  353. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  354. - static int __devexit acxmem_remove(struct platform_device *pdev)
  355. -+#else
  356. -+static int acxmem_remove(struct platform_device *pdev)
  357. -+#endif
  358. - {
  359. - struct ieee80211_hw *hw = (struct ieee80211_hw *)
  360. - platform_get_drvdata(pdev);
  361. -@@ -2594,8 +2602,11 @@ static struct platform_driver acxmem_dri
  362. - .name = "acx-mem",
  363. - },
  364. - .probe = acxmem_probe,
  365. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  366. - .remove = __devexit_p(acxmem_remove),
  367. --
  368. -+#else
  369. -+ .remove = acxmem_remove,
  370. -+#endif
  371. - #ifdef CONFIG_PM
  372. - .suspend = acxmem_e_suspend,
  373. - .resume = acxmem_e_resume
  374. ---- a/pci.c
  375. -+++ b/pci.c
  376. -@@ -1039,7 +1039,11 @@ int acx100pci_ioctl_set_phy_amp_bias(str
  377. - * id - ptr to the device id entry that matched this device
  378. - */
  379. - #ifdef CONFIG_PCI
  380. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  381. - static int __devinit acxpci_probe(struct pci_dev *pdev,
  382. -+#else
  383. -+static int acxpci_probe(struct pci_dev *pdev,
  384. -+#endif
  385. - const struct pci_device_id *id)
  386. - {
  387. - unsigned long mem_region1 = 0;
  388. -@@ -1292,7 +1296,11 @@ static int __devinit acxpci_probe(struct
  389. - *
  390. - * pdev - ptr to PCI device structure containing info about pci configuration
  391. - */
  392. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  393. - static void __devexit acxpci_remove(struct pci_dev *pdev)
  394. -+#else
  395. -+static void acxpci_remove(struct pci_dev *pdev)
  396. -+#endif
  397. - {
  398. - struct ieee80211_hw *hw
  399. - = (struct ieee80211_hw *) pci_get_drvdata(pdev);
  400. -@@ -1505,7 +1513,11 @@ static struct pci_driver acxpci_driver =
  401. - .name = "acx_pci",
  402. - .id_table = acxpci_id_tbl,
  403. - .probe = acxpci_probe,
  404. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  405. - .remove = __devexit_p(acxpci_remove),
  406. -+#else
  407. -+ .remove = acxpci_remove,
  408. -+#endif
  409. - #ifdef CONFIG_PM
  410. - .suspend = acxpci_e_suspend,
  411. - .resume = acxpci_e_resume
  412. -@@ -1603,8 +1615,12 @@ static struct vlynq_device_id acx_vlynq_
  413. - };
  414. -
  415. -
  416. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  417. - static __devinit int vlynq_probe(struct vlynq_device *vdev,
  418. -- struct vlynq_device_id *id)
  419. -+#else
  420. -+static int vlynq_probe(struct vlynq_device *vdev,
  421. -+#endif
  422. -+ struct vlynq_device_id *id)
  423. - {
  424. - int result = -EIO, i;
  425. - u32 addr;
  426. -@@ -1785,7 +1801,11 @@ static __devinit int vlynq_probe(struct
  427. - return result;
  428. - }
  429. -
  430. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  431. - static __devexit void vlynq_remove(struct vlynq_device *vdev)
  432. -+#else
  433. -+static void vlynq_remove(struct vlynq_device *vdev)
  434. -+#endif
  435. - {
  436. - struct ieee80211_hw *hw = vlynq_get_drvdata(vdev);
  437. - acx_device_t *adev = hw2adev(hw);
  438. -@@ -1851,7 +1871,11 @@ static struct vlynq_driver acxvlynq_driv
  439. - .name = "acx_vlynq",
  440. - .id_table = acx_vlynq_id,
  441. - .probe = vlynq_probe,
  442. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  443. - .remove = __devexit_p(vlynq_remove),
  444. -+#else
  445. -+ .remove = vlynq_remove,
  446. -+#endif
  447. - };
  448. - #endif /* CONFIG_VLYNQ */
  449. -
  450. 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
  451. deleted file mode 100644
  452. index c737844..0000000
  453. --- a/package/kernel/acx-mac80211/patches/003-Fix-3.10-build.patch
  454. +++ /dev/null
  455. @@ -1,31 +0,0 @@
  456. -From 1daf4bfdb072b08f3b4e412bbfa9645f88dc0a01 Mon Sep 17 00:00:00 2001
  457. -From: Oliver Winker <oliver@oli1170.net>
  458. -Date: Tue, 3 Sep 2013 20:36:36 +0200
  459. -Subject: [PATCH 3/3] Fix 3.10 build
  460. -
  461. -Signed-off-by: Reinhard Karcher <reinhard.karcher@gmx.net>
  462. -Signed-off-by: Oliver Winker <oliver@oli1170.net>
  463. ----
  464. - main.c | 7 +++++++
  465. - 1 file changed, 7 insertions(+)
  466. -
  467. ---- a/main.c
  468. -+++ b/main.c
  469. -@@ -682,10 +682,17 @@ int acx_op_config(struct ieee80211_hw *h
  470. -
  471. - if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
  472. - logf1(L_DEBUG, "IEEE80211_CONF_CHANGE_CHANNEL,"
  473. -+#if CONFIG_ACX_MAC80211_VERSION >= KERNEL_VERSION(3, 10, 0)
  474. -+ "channel->hw_value=%i\n", conf->chandef.chan->hw_value);
  475. -+
  476. -+ acx_set_channel(adev, conf->chandef.chan->hw_value,
  477. -+ conf->chandef.chan->center_freq);
  478. -+#else
  479. - "channel->hw_value=%i\n", conf->channel->hw_value);
  480. -
  481. - acx_set_channel(adev, conf->channel->hw_value,
  482. - conf->channel->center_freq);
  483. -+#endif
  484. -
  485. - changed_not_done &= ~IEEE80211_CONF_CHANGE_CHANNEL;
  486. - }
  487. 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
  488. deleted file mode 100644
  489. index 847b573..0000000
  490. --- a/package/kernel/acx-mac80211/patches/004-Fix-3.14-build.patch
  491. +++ /dev/null
  492. @@ -1,22 +0,0 @@
  493. -From d17fcac710e629463591f6bd09d76b66ec591583 Mon Sep 17 00:00:00 2001
  494. -From: Hauke Mehrtens <hauke@hauke-m.de>
  495. -Date: Wed, 5 Feb 2014 20:57:07 +0100
  496. -Subject: [PATCH] Fix 3.14 build
  497. -
  498. -Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
  499. ----
  500. - main.c | 2 ++
  501. - 1 file changed, 2 insertions(+)
  502. -
  503. ---- a/main.c
  504. -+++ b/main.c
  505. -@@ -500,7 +500,9 @@ int acx_init_ieee80211(acx_device_t *ade
  506. - hw->flags &= ~IEEE80211_HW_RX_INCLUDES_FCS;
  507. - hw->queues = 1;
  508. - hw->wiphy->max_scan_ssids = 1;
  509. -+#if CONFIG_ACX_MAC80211_VERSION < KERNEL_VERSION(3, 14, 0)
  510. - hw->channel_change_time = 10000;
  511. -+#endif
  512. -
  513. - /* OW TODO Check if RTS/CTS threshold can be included here */
  514. -
  515. diff --git a/package/kernel/acx-mac80211/patches/300-api_sync.patch b/package/kernel/acx-mac80211/patches/300-api_sync.patch
  516. new file mode 100644
  517. index 0000000..94d6135
  518. --- /dev/null
  519. +++ b/package/kernel/acx-mac80211/patches/300-api_sync.patch
  520. @@ -0,0 +1,83 @@
  521. +--- a/main.c
  522. ++++ b/main.c
  523. +@@ -497,7 +497,7 @@ int acx_free_mechanics(acx_device_t *ade
  524. +
  525. + int acx_init_ieee80211(acx_device_t *adev, struct ieee80211_hw *hw)
  526. + {
  527. +- hw->flags &= ~IEEE80211_HW_RX_INCLUDES_FCS;
  528. ++ __clear_bit(IEEE80211_HW_RX_INCLUDES_FCS, hw->flags);
  529. + hw->queues = 1;
  530. + hw->wiphy->max_scan_ssids = 1;
  531. +
  532. +@@ -525,14 +525,14 @@ int acx_init_ieee80211(acx_device_t *ade
  533. + /* We base signal quality on winlevel approach of previous driver
  534. + * TODO OW 20100615 This should into a common init code
  535. + */
  536. +- hw->flags |= IEEE80211_HW_SIGNAL_UNSPEC;
  537. ++ __set_bit(IEEE80211_HW_SIGNAL_UNSPEC, hw->flags);
  538. + hw->max_signal = 100;
  539. +
  540. + if (IS_ACX100(adev)) {
  541. +- adev->hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
  542. ++ adev->hw->wiphy->bands[NL80211_BAND_2GHZ] =
  543. + &acx100_band_2GHz;
  544. + } else if (IS_ACX111(adev))
  545. +- adev->hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
  546. ++ adev->hw->wiphy->bands[NL80211_BAND_2GHZ] =
  547. + &acx111_band_2GHz;
  548. + else {
  549. + log(L_ANY, "Error: Unknown device");
  550. +@@ -945,8 +945,8 @@ void acx_op_configure_filter(struct ieee
  551. + changed_flags, *total_flags);
  552. +
  553. + /* OWI TODO: Set also FIF_PROBE_REQ ? */
  554. +- *total_flags &= (FIF_PROMISC_IN_BSS | FIF_ALLMULTI | FIF_FCSFAIL
  555. +- | FIF_CONTROL | FIF_OTHER_BSS);
  556. ++ *total_flags &= (FIF_ALLMULTI | FIF_FCSFAIL | FIF_CONTROL
  557. ++ | FIF_OTHER_BSS);
  558. +
  559. + logf1(L_DEBUG, "2: *total_flags=0x%08x\n", *total_flags);
  560. +
  561. +@@ -1045,9 +1045,10 @@ void acx_op_tx(struct ieee80211_hw *hw,
  562. + }
  563. +
  564. + int acx_op_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  565. +- struct cfg80211_scan_request *req)
  566. ++ struct ieee80211_scan_request *hw_req)
  567. + {
  568. + acx_device_t *adev = hw2adev(hw);
  569. ++ struct cfg80211_scan_request *req = &hw_req->req;
  570. + struct sk_buff *skb;
  571. + size_t ssid_len = 0;
  572. + u8 *ssid = NULL;
  573. +@@ -1082,7 +1083,7 @@ int acx_op_hw_scan(struct ieee80211_hw *
  574. + goto out;
  575. + }
  576. + #else
  577. +- skb = ieee80211_probereq_get(adev->hw, adev->vif, ssid, ssid_len,
  578. ++ skb = ieee80211_probereq_get(adev->hw, vif->addr, ssid, ssid_len,
  579. + req->ie_len);
  580. + if (!skb) {
  581. + ret = -ENOMEM;
  582. +--- a/main.h
  583. ++++ b/main.h
  584. +@@ -62,7 +62,7 @@ void acx_op_tx(struct ieee80211_hw *hw,
  585. + #endif
  586. +
  587. + int acx_op_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  588. +- struct cfg80211_scan_request *req);
  589. ++ struct ieee80211_scan_request *req);
  590. +
  591. + int acx_recover_hw(acx_device_t *adev);
  592. +
  593. +--- a/cardsetting.c
  594. ++++ b/cardsetting.c
  595. +@@ -159,7 +159,7 @@ int acx_set_channel(acx_device_t *adev,
  596. + int res = 0;
  597. +
  598. + adev->rx_status.freq = freq;
  599. +- adev->rx_status.band = IEEE80211_BAND_2GHZ;
  600. ++ adev->rx_status.band = NL80211_BAND_2GHZ;
  601. +
  602. + adev->channel = channel;
  603. +
  604. diff --git a/package/kernel/ath10k-ct/Makefile b/package/kernel/ath10k-ct/Makefile
  605. new file mode 100644
  606. index 0000000..bbff8d8
  607. --- /dev/null
  608. +++ b/package/kernel/ath10k-ct/Makefile
  609. @@ -0,0 +1,80 @@
  610. +include $(TOPDIR)/rules.mk
  611. +
  612. +PKG_NAME:=ath10k-ct
  613. +PKG_VERSION:=2016-08-24
  614. +PKG_RELEASE=1
  615. +
  616. +PKG_LICENSE:=GPLv2
  617. +PKG_LICENSE_FILES:=
  618. +
  619. +PKG_SOURCE_URL:=https://github.com/greearb/ath10k-ct.git
  620. +PKG_SOURCE_PROTO:=git
  621. +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  622. +PKG_SOURCE_VERSION:=cd725d5465e1d4476a504794c541afeeba84b479
  623. +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
  624. +
  625. +PKG_MAINTAINER:=Ben Greear <greearb@candelatech.com>
  626. +PKG_BUILD_PARALLEL:=1
  627. +
  628. +STAMP_CONFIGURED_DEPENDS := $(STAGING_DIR)/usr/include/mac80211-backport/backport/autoconf.h
  629. +
  630. +include $(INCLUDE_DIR)/kernel.mk
  631. +include $(INCLUDE_DIR)/package.mk
  632. +
  633. +define KernelPackage/ath10k-ct
  634. + SUBMENU:=Wireless Drivers
  635. + TITLE:=ath10k-ct driver optimized for CT ath10k firmware
  636. + DEPENDS:=+kmod-mac80211 +kmod-ath +@DRIVER_11N_SUPPORT @PCI_SUPPORT +@KERNEL_RELAY
  637. + FILES:=\
  638. + $(PKG_BUILD_DIR)/ath10k/ath10k_pci.ko \
  639. + $(PKG_BUILD_DIR)/ath10k/ath10k_core.ko
  640. + AUTOLOAD:=$(call AutoLoad,50,mac80211 ath ath10k_core ath10k_pci)
  641. +endef
  642. +
  643. +NOSTDINC_FLAGS = \
  644. + -I$(PKG_BUILD_DIR) \
  645. + -I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \
  646. + -I$(STAGING_DIR)/usr/include/mac80211-backport \
  647. + -I$(STAGING_DIR)/usr/include/mac80211/uapi \
  648. + -I$(STAGING_DIR)/usr/include/mac80211 \
  649. + -include backport/autoconf.h \
  650. + -include backport/backport.h
  651. +
  652. +ifdef CONFIG_PACKAGE_MAC80211_MESH
  653. + NOSTDINC_FLAGS += -DCONFIG_MAC80211_MESH
  654. +endif
  655. +
  656. +CT_MAKEDEFS += CONFIG_ATH10K=m CONFIG_ATH10K_PCI=m
  657. +# No AHB support enabled yet. Could conditionally enable it later.
  658. +#CT_MAKEDEFS += CONFIG_ATH10K_AHB=y
  659. +#NOSTDINC_FLAGS += -DCONFIG_ATH10K_AHB
  660. +NOSTDINC_FLAGS += -DSTANDALONE_CT
  661. +
  662. +ifdef CONFIG_PACKAGE_MAC80211_DEBUGFS
  663. + CT_MAKEDEFS += CONFIG_ATH10K_DEBUGFS=y CONFIG_MAC80211_DEBUGFS=y
  664. + NOSTDINC_FLAGS += -DCONFIG_MAC80211_DEBUGFS
  665. + NOSTDINC_FLAGS += -DCONFIG_ATH10K_DEBUGFS
  666. +endif
  667. +
  668. +ifdef CONFIG_PACKAGE_ATH_DEBUG
  669. + NOSTDINC_FLAGS += -DCONFIG_ATH10K_DEBUG
  670. +endif
  671. +
  672. +define Build/Configure
  673. + cp $(STAGING_DIR)/usr/include/mac80211/ath/*.h $(PKG_BUILD_DIR)
  674. +endef
  675. +
  676. +ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
  677. + CT_MAKEDEFS += V=1
  678. +endif
  679. +
  680. +define Build/Compile
  681. + +$(MAKE) $(CT_MAKEDEFS) $(PKG_JOBS) -C "$(LINUX_DIR)" \
  682. + ARCH="$(LINUX_KARCH)" \
  683. + CROSS_COMPILE="$(TARGET_CROSS)" \
  684. + SUBDIRS="$(PKG_BUILD_DIR)/ath10k" \
  685. + NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \
  686. + modules
  687. +endef
  688. +
  689. +$(eval $(call KernelPackage,ath10k-ct))
  690. diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile
  691. index 30da1cf..f2839cd 100644
  692. --- a/package/kernel/mac80211/Makefile
  693. +++ b/package/kernel/mac80211/Makefile
  694. @@ -10,20 +10,21 @@ include $(INCLUDE_DIR)/kernel.mk
  695. PKG_NAME:=mac80211
  696. -PKG_VERSION:=2016-01-10
  697. +PKG_VERSION:=2016-06-20
  698. PKG_RELEASE:=1
  699. PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources
  700. PKG_BACKPORT_VERSION:=
  701. -PKG_MD5SUM:=be5fae2e8d6f7490f9b073374fb895ba
  702. +PKG_MD5SUM:=29c79bdc3928ef5113b17042ebda9237
  703. PKG_SOURCE:=compat-wireless-$(PKG_VERSION)$(PKG_BACKPORT_VERSION).tar.bz2
  704. PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/compat-wireless-$(PKG_VERSION)
  705. PKG_BUILD_PARALLEL:=1
  706. -PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  707. +PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  708. PKG_DRIVERS = \
  709. adm8211 \
  710. + airo \
  711. ath ath5k ath9k ath9k-common ath9k-htc ath10k \
  712. b43 b43legacy \
  713. carl9170 \
  714. @@ -52,6 +53,7 @@ PKG_CONFIG_DEPENDS:= \
  715. $(patsubst %,CONFIG_PACKAGE_kmod-%,$(PKG_DRIVERS)) \
  716. CONFIG_PACKAGE_MAC80211_DEBUGFS \
  717. CONFIG_PACKAGE_MAC80211_MESH \
  718. + CONFIG_PACKAGE_MAC80211_TRACING \
  719. CONFIG_PACKAGE_ATH_DEBUG \
  720. CONFIG_PACKAGE_ATH_DFS \
  721. CONFIG_PACKAGE_B43_DEBUG \
  722. @@ -63,7 +65,12 @@ PKG_CONFIG_DEPENDS:= \
  723. CONFIG_PACKAGE_B43_BUSES_BCMA_AND_SSB \
  724. CONFIG_PACKAGE_B43_BUSES_BCMA \
  725. CONFIG_PACKAGE_B43_BUSES_SSB \
  726. + CONFIG_PACKAGE_BRCM80211_DEBUG \
  727. + CONFIG_PACKAGE_IWLWIFI_DEBUG \
  728. + CONFIG_PACKAGE_IWLWIFI_DEBUGFS \
  729. CONFIG_PACKAGE_RTLWIFI_DEBUG \
  730. + CONFIG_ATH9K_SUPPORT_PCOEM \
  731. + CONFIG_ATH9K_TX99 \
  732. CONFIG_ATH_USER_REGD \
  733. include $(INCLUDE_DIR)/package.mk
  734. @@ -73,7 +80,7 @@ WMENU:=Wireless Drivers
  735. define KernelPackage/mac80211/Default
  736. SUBMENU:=$(WMENU)
  737. URL:=https://wireless.wiki.kernel.org/
  738. - MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  739. + MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  740. endef
  741. define KernelPackage/cfg80211
  742. @@ -92,7 +99,7 @@ endef
  743. define KernelPackage/mac80211
  744. $(call KernelPackage/mac80211/Default)
  745. TITLE:=Linux 802.11 Wireless Networking Stack
  746. - DEPENDS+= +kmod-cfg80211 +hostapd-common +kmod-crypto-core +kmod-crypto-arc4
  747. + DEPENDS+= +kmod-cfg80211 +hostapd-common
  748. KCONFIG:=\
  749. CONFIG_AVERAGE=y
  750. FILES:= $(PKG_BUILD_DIR)/net/mac80211/mac80211.ko
  751. @@ -138,10 +145,23 @@ define KernelPackage/adm8211
  752. AUTOLOAD:=$(call AutoProbe,adm8211)
  753. endef
  754. +define KernelPackage/airo
  755. + $(call KernelPackage/mac80211/Default)
  756. + TITLE:=Cisco Aironet driver
  757. + DEPENDS+=@PCI_SUPPORT +@DRIVER_WEXT_SUPPORT +kmod-cfg80211 @TARGET_x86
  758. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/cisco/airo.ko
  759. + AUTOLOAD:=$(call AutoProbe,airo)
  760. +endef
  761. +
  762. +define KernelPackage/airo/description
  763. + Kernel support for Cisco Aironet cards
  764. +endef
  765. +
  766. define KernelPackage/ath/config
  767. if PACKAGE_kmod-ath
  768. config ATH_USER_REGD
  769. bool "Force Atheros drivers to respect the user's regdomain settings"
  770. + default y
  771. help
  772. Atheros' idea of regulatory handling is that the EEPROM of the card defines
  773. the regulatory limits and the user is only allowed to restrict the settings
  774. @@ -199,6 +219,7 @@ define KernelPackage/ath9k-common
  775. $(call KernelPackage/mac80211/Default)
  776. TITLE:=Atheros 802.11n wireless devices (common code for ath9k and ath9k_htc)
  777. URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
  778. + HIDDEN:=1
  779. DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT +@KERNEL_RELAY
  780. FILES:= \
  781. $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_common.ko \
  782. @@ -226,6 +247,10 @@ define KernelPackage/ath9k/config
  783. bool "Support chips used in PC OEM cards"
  784. depends on PACKAGE_kmod-ath9k
  785. + config ATH9K_TX99
  786. + bool "Enable TX99 support"
  787. + depends on PACKAGE_kmod-ath9k
  788. +
  789. endef
  790. define KernelPackage/ath9k-htc
  791. @@ -247,7 +272,7 @@ define KernelPackage/ath10k
  792. $(call KernelPackage/mac80211/Default)
  793. TITLE:=Atheros 802.11ac wireless cards support
  794. URL:=https://wireless.wiki.kernel.org/en/users/Drivers/ath10k
  795. - DEPENDS+= @PCI_SUPPORT +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT +@KERNEL_RELAY +ath10k-firmware-qca988x
  796. + DEPENDS+= @PCI_SUPPORT +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT +@KERNEL_RELAY
  797. FILES:= \
  798. $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_core.ko \
  799. $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_pci.ko
  800. @@ -673,6 +698,7 @@ define KernelPackage/brcmfmac/config
  801. config BRCMFMAC_SDIO
  802. bool "Enable SDIO bus interface support"
  803. + default y if TARGET_brcm2708
  804. default n
  805. help
  806. Enable support for cards attached to an SDIO bus.
  807. @@ -761,7 +787,7 @@ endef
  808. define KernelPackage/iwlwifi
  809. $(call KernelPackage/mac80211/Default)
  810. - DEPENDS:= +kmod-mac80211 @PCI_SUPPORT +@DRIVER_11N_SUPPORT +iwlwifi-firmware
  811. + DEPENDS:= +kmod-mac80211 @PCI_SUPPORT +@DRIVER_11N_SUPPORT +iwlwifi-firmware @!LINUX_3_18
  812. TITLE:=Intel AGN Wireless support
  813. FILES:= \
  814. $(PKG_BUILD_DIR)/drivers/net/wireless/intel/iwlwifi/iwlwifi.ko \
  815. @@ -870,7 +896,7 @@ endef
  816. define KernelPackage/lib80211
  817. $(call KernelPackage/mac80211/Default)
  818. TITLE:=802.11 Networking stack
  819. - DEPENDS:=+kmod-cfg80211
  820. + DEPENDS:=+kmod-cfg80211 +kmod-crypto-hash
  821. FILES:= \
  822. $(PKG_BUILD_DIR)/net/wireless/lib80211.ko \
  823. $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_wep.ko \
  824. @@ -897,7 +923,7 @@ endef
  825. define KernelPackage/libipw
  826. $(call KernelPackage/mac80211/Default)
  827. TITLE:=libipw for ipw2100 and ipw2200
  828. - DEPENDS:=@PCI_SUPPORT +kmod-crypto-michael-mic +kmod-crypto-core +kmod-crypto-arc4 +kmod-lib80211 +kmod-cfg80211 +@DRIVER_WEXT_SUPPORT @!BIG_ENDIAN
  829. + DEPENDS:=@PCI_SUPPORT +kmod-crypto-michael-mic +kmod-lib80211 +kmod-cfg80211 +@DRIVER_WEXT_SUPPORT @!BIG_ENDIAN
  830. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intel/ipw2x00/libipw.ko
  831. AUTOLOAD:=$(call AutoProbe,libipw)
  832. endef
  833. @@ -978,7 +1004,7 @@ endef
  834. define KernelPackage/libertas-spi
  835. $(call KernelPackage/mac80211/Default)
  836. SUBMENU:=Wireless Drivers
  837. - DEPENDS+= +kmod-cfg80211 +kmod-lib80211 +@DRIVER_WEXT_SUPPORT +libertas-spi-firmware
  838. + DEPENDS+= +kmod-cfg80211 +kmod-lib80211 +@DRIVER_WEXT_SUPPORT @!TARGET_uml +libertas-spi-firmware
  839. KCONFIG := \
  840. CONFIG_SPI=y \
  841. CONFIG_SPI_MASTER=y
  842. @@ -1036,33 +1062,6 @@ define KernelPackage/mwifiex-pcie/description
  843. Kernel modules for Marvell 802.11n/802.11ac PCIe Wireless cards
  844. endef
  845. -
  846. -# Prism54 drivers
  847. -P54PCIFW:=2.13.12.0.arm
  848. -P54USBFW:=2.13.24.0.lm87.arm
  849. -P54SPIFW:=2.13.0.0.a.13.14.arm
  850. -
  851. -define Download/p54usb
  852. - FILE:=$(P54USBFW)
  853. - URL:=http://daemonizer.de/prism54/prism54-fw/fw-usb
  854. - MD5SUM:=8e8ab005a4f8f0123bcdc51bc25b47f6
  855. -endef
  856. -$(eval $(call Download,p54usb))
  857. -
  858. -define Download/p54pci
  859. - FILE:=$(P54PCIFW)
  860. - URL:=http://daemonizer.de/prism54/prism54-fw/fw-softmac
  861. - MD5SUM:=ff7536af2092b1c4b21315bd103ef4c4
  862. -endef
  863. -$(eval $(call Download,p54pci))
  864. -
  865. -define Download/p54spi
  866. - FILE:=$(P54SPIFW)
  867. - URL:=http://daemonizer.de/prism54/prism54-fw/stlc4560
  868. - MD5SUM:=42661f8ecbadd88012807493f596081d
  869. -endef
  870. -$(eval $(call Download,p54spi))
  871. -
  872. define KernelPackage/p54/Default
  873. $(call KernelPackage/mac80211/Default)
  874. TITLE:=Prism54 Drivers
  875. @@ -1082,7 +1081,7 @@ endef
  876. define KernelPackage/p54-pci
  877. $(call KernelPackage/p54/Default)
  878. TITLE+= (PCI)
  879. - DEPENDS+= @PCI_SUPPORT +kmod-p54-common
  880. + DEPENDS+= @PCI_SUPPORT +kmod-p54-common +p54-pci-firmware
  881. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/p54/p54pci.ko
  882. AUTOLOAD:=$(call AutoProbe,p54pci)
  883. endef
  884. @@ -1090,7 +1089,7 @@ endef
  885. define KernelPackage/p54-usb
  886. $(call KernelPackage/p54/Default)
  887. TITLE+= (USB)
  888. - DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-p54-common
  889. + DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-p54-common +p54-usb-firmware
  890. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/p54/p54usb.ko
  891. AUTOLOAD:=$(call AutoProbe,p54usb)
  892. endef
  893. @@ -1098,7 +1097,7 @@ endef
  894. define KernelPackage/p54-spi
  895. $(call KernelPackage/p54/Default)
  896. TITLE+= (SPI)
  897. - DEPENDS+= @TARGET_omap24xx +kmod-p54-common
  898. + DEPENDS+= @TARGET_omap24xx +kmod-p54-common +p54-spi-firmware
  899. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/p54/p54spi.ko
  900. AUTOLOAD:=$(call AutoProbe,p54spi)
  901. endef
  902. @@ -1453,6 +1452,7 @@ config-y:= \
  903. WLAN_VENDOR_ATH \
  904. WLAN_VENDOR_ATMEL \
  905. WLAN_VENDOR_BROADCOM \
  906. + WLAN_VENDOR_CISCO \
  907. WLAN_VENDOR_INTEL \
  908. WLAN_VENDOR_INTERSIL \
  909. WLAN_VENDOR_MARVELL \
  910. @@ -1491,6 +1491,8 @@ endif
  911. config-$(call config_package,lib80211) += LIB80211 LIB80211_CRYPT_WEP LIB80211_CRYPT_CCMP LIB80211_CRYPT_TKIP
  912. +config-$(call config_package,airo) += AIRO
  913. +
  914. config-$(call config_package,ath) += ATH_CARDS ATH_COMMON
  915. config-$(CONFIG_PACKAGE_ATH_DEBUG) += ATH_DEBUG ATH10K_DEBUG
  916. config-$(CONFIG_PACKAGE_ATH_DFS) += ATH9K_DFS_CERTIFIED ATH10K_DFS_CERTIFIED
  917. @@ -1501,6 +1503,7 @@ config-$(CONFIG_TARGET_ar71xx) += ATH9K_AHB
  918. config-$(CONFIG_PCI) += ATH9K_PCI
  919. config-$(CONFIG_ATH_USER_REGD) += ATH_USER_REGD
  920. config-$(CONFIG_ATH9K_SUPPORT_PCOEM) += ATH9K_PCOEM
  921. +config-$(CONFIG_ATH9K_TX99) += ATH9K_TX99
  922. config-$(call config_package,ath9k-htc) += ATH9K_HTC
  923. config-$(call config_package,ath10k) += ATH10K ATH10K_PCI
  924. @@ -1742,21 +1745,6 @@ define KernelPackage/ipw2200/install
  925. $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(IPW2200_NAME)-$(IPW2200_VERSION)/ipw2200*.fw $(1)/lib/firmware
  926. endef
  927. -define KernelPackage/p54-pci/install
  928. - $(INSTALL_DIR) $(1)/lib/firmware
  929. - $(INSTALL_DATA) $(DL_DIR)/$(P54PCIFW) $(1)/lib/firmware/isl3886pci
  930. -endef
  931. -
  932. -define KernelPackage/p54-usb/install
  933. - $(INSTALL_DIR) $(1)/lib/firmware
  934. - $(INSTALL_DATA) $(DL_DIR)/$(P54USBFW) $(1)/lib/firmware/isl3887usb
  935. -endef
  936. -
  937. -define KernelPackage/p54-spi/install
  938. - $(INSTALL_DIR) $(1)/lib/firmware
  939. - $(INSTALL_DATA) $(DL_DIR)/$(P54SPIFW) $(1)/lib/firmware/3826.arm
  940. -endef
  941. -
  942. define KernelPackage/zd1211rw/install
  943. $(INSTALL_DIR) $(1)/lib/firmware/zd1211
  944. $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(ZD1211FW_NAME)/zd1211* $(1)/lib/firmware/zd1211
  945. @@ -1764,6 +1752,7 @@ endef
  946. $(eval $(call KernelPackage,adm8211))
  947. +$(eval $(call KernelPackage,airo))
  948. $(eval $(call KernelPackage,ath))
  949. $(eval $(call KernelPackage,ath10k))
  950. $(eval $(call KernelPackage,ath5k))
  951. diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
  952. index fb2f928..e3d612e 100644
  953. --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
  954. +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
  955. @@ -23,6 +23,7 @@ drv_mac80211_init_device_config() {
  956. config_add_int rxantenna txantenna antenna_gain txpower distance
  957. config_add_boolean noscan ht_coex
  958. config_add_array ht_capab
  959. + config_add_array channels
  960. config_add_boolean \
  961. rxldpc \
  962. short_gi_80 \
  963. @@ -89,6 +90,7 @@ mac80211_hostapd_setup_base() {
  964. json_select config
  965. [ "$auto_channel" -gt 0 ] && channel=acs_survey
  966. + [ "$auto_channel" -gt 0 ] && json_get_values channel_list channels
  967. json_get_vars noscan ht_coex
  968. json_get_values ht_capab_list ht_capab
  969. @@ -218,7 +220,6 @@ mac80211_hostapd_setup_base() {
  970. vht_max_a_mpdu_len_exp:7 \
  971. vht_max_mpdu:11454 \
  972. rx_stbc:4 \
  973. - tx_stbc:4 \
  974. vht_link_adapt:3 \
  975. vht160:2
  976. @@ -230,13 +231,13 @@ mac80211_hostapd_setup_base() {
  977. cap_rx_stbc=$((($vht_cap >> 8) & 7))
  978. [ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc="$rx_stbc"
  979. - ht_cap_mask="$(( ($vht_cap & ~(0x700)) | ($cap_rx_stbc << 8) ))"
  980. + vht_cap="$(( ($vht_cap & ~(0x700)) | ($cap_rx_stbc << 8) ))"
  981. mac80211_add_capabilities vht_capab $vht_cap \
  982. RXLDPC:0x10::$rxldpc \
  983. SHORT-GI-80:0x20::$short_gi_80 \
  984. SHORT-GI-160:0x40::$short_gi_160 \
  985. - TX-STBC-2BY1:0x80::$tx_stbc \
  986. + TX-STBC-2BY1:0x80::$tx_stbc_2by1 \
  987. SU-BEAMFORMER:0x800::$su_beamformer \
  988. SU-BEAMFORMEE:0x1000::$su_beamformee \
  989. MU-BEAMFORMER:0x80000::$mu_beamformer \
  990. @@ -245,10 +246,10 @@ mac80211_hostapd_setup_base() {
  991. HTC-VHT:0x400000::$htc_vht \
  992. RX-ANTENNA-PATTERN:0x10000000::$rx_antenna_pattern \
  993. TX-ANTENNA-PATTERN:0x20000000::$tx_antenna_pattern \
  994. - RX-STBC1:0x700:0x100:1 \
  995. - RX-STBC12:0x700:0x200:1 \
  996. - RX-STBC123:0x700:0x300:1 \
  997. - RX-STBC1234:0x700:0x400:1 \
  998. + RX-STBC-1:0x700:0x100:1 \
  999. + RX-STBC-12:0x700:0x200:1 \
  1000. + RX-STBC-123:0x700:0x300:1 \
  1001. + RX-STBC-1234:0x700:0x400:1 \
  1002. # supported Channel widths
  1003. vht160_hw=0
  1004. @@ -301,6 +302,7 @@ mac80211_hostapd_setup_base() {
  1005. hostapd_prepare_device_config "$hostapd_conf_file" nl80211
  1006. cat >> "$hostapd_conf_file" <<EOF
  1007. ${channel:+channel=$channel}
  1008. +${channel_list:+chanlist=$channel_list}
  1009. ${noscan:+noscan=$noscan}
  1010. $base_cfg
  1011. @@ -391,11 +393,10 @@ mac80211_generate_mac() {
  1012. find_phy() {
  1013. [ -n "$phy" -a -d /sys/class/ieee80211/$phy ] && return 0
  1014. [ -n "$path" ] && {
  1015. - for phy in /sys/devices/$path/ieee80211/phy*; do
  1016. - [ -e "$phy" ] && {
  1017. - phy="${phy##*/}"
  1018. - return 0
  1019. - }
  1020. + for phy in $(ls /sys/class/ieee80211 2>/dev/null); do
  1021. + case "$(readlink -f /sys/class/ieee80211/$phy/device)" in
  1022. + *$path) return 0;;
  1023. + esac
  1024. done
  1025. }
  1026. [ -n "$macaddr" ] && {
  1027. @@ -481,7 +482,7 @@ mac80211_prepare_vif() {
  1028. # All interfaces must have unique mac addresses
  1029. # which can either be explicitly set in the device
  1030. # section, or automatically generated
  1031. - ifconfig "$ifname" hw ether "$macaddr"
  1032. + ip link set dev "$ifname" address "$macaddr"
  1033. fi
  1034. json_select ..
  1035. @@ -496,7 +497,7 @@ mac80211_setup_supplicant() {
  1036. mac80211_setup_adhoc_htmode() {
  1037. case "$htmode" in
  1038. VHT20|HT20) ibss_htmode=HT20;;
  1039. - HT40*|VHT40|VHT80|VHT160)
  1040. + HT40*|VHT40|VHT160)
  1041. case "$hwmode" in
  1042. a)
  1043. case "$(( ($channel / 4) % 2 ))" in
  1044. @@ -520,6 +521,9 @@ mac80211_setup_adhoc_htmode() {
  1045. esac
  1046. [ "$auto_channel" -gt 0 ] && ibss_htmode="HT40+"
  1047. ;;
  1048. + VHT80)
  1049. + ibss_htmode="80MHZ"
  1050. + ;;
  1051. NONE|NOHT)
  1052. ibss_htmode="NOHT"
  1053. ;;
  1054. @@ -580,7 +584,7 @@ mac80211_setup_vif() {
  1055. json_get_vars mode
  1056. json_get_var vif_txpower txpower
  1057. - ifconfig "$ifname" up || {
  1058. + ip link set dev "$ifname" up || {
  1059. wireless_setup_vif_failed IFUP_ERROR
  1060. json_select ..
  1061. return
  1062. @@ -643,7 +647,7 @@ mac80211_interface_cleanup() {
  1063. local phy="$1"
  1064. for wdev in $(list_phy_interfaces "$phy"); do
  1065. - ifconfig "$wdev" down 2>/dev/null
  1066. + ip link set dev "$wdev" down 2>/dev/null
  1067. iw dev "$wdev" del
  1068. done
  1069. }
  1070. diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
  1071. index ea229d6..06f3b8b 100644
  1072. --- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh
  1073. +++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
  1074. @@ -9,11 +9,10 @@ lookup_phy() {
  1075. local devpath
  1076. config_get devpath "$device" path
  1077. [ -n "$devpath" ] && {
  1078. - for _phy in /sys/devices/$devpath/ieee80211/phy*; do
  1079. - [ -e "$_phy" ] && {
  1080. - phy="${_phy##*/}"
  1081. - return
  1082. - }
  1083. + for phy in $(ls /sys/class/ieee80211 2>/dev/null); do
  1084. + case "$(readlink -f /sys/class/ieee80211/$phy/device)" in
  1085. + *$devpath) return;;
  1086. + esac
  1087. done
  1088. }
  1089. @@ -102,6 +101,9 @@ detect_mac80211() {
  1090. fi
  1091. if [ -n "$path" ]; then
  1092. path="${path##/sys/devices/}"
  1093. + case "$path" in
  1094. + platform*/pci*) path="${path##platform/}";;
  1095. + esac
  1096. dev_id=" option path '$path'"
  1097. else
  1098. dev_id=" option macaddr $(cat /sys/class/ieee80211/${dev}/macaddress)"
  1099. 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
  1100. deleted file mode 100644
  1101. index 9adfd8f..0000000
  1102. --- a/package/kernel/mac80211/patches/004-backports-add-skb_free_frag.patch
  1103. +++ /dev/null
  1104. @@ -1,21 +0,0 @@
  1105. -From: Felix Fietkau <nbd@openwrt.org>
  1106. -Date: Thu, 28 Jan 2016 15:16:35 +0100
  1107. -Subject: [PATCH] backports: add skb_free_frag()
  1108. -
  1109. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  1110. ----
  1111. -
  1112. ---- a/backport-include/linux/skbuff.h
  1113. -+++ b/backport-include/linux/skbuff.h
  1114. -@@ -300,4 +300,11 @@ int skb_ensure_writable(struct sk_buff *
  1115. -
  1116. - #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) */
  1117. -
  1118. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
  1119. -+static inline void skb_free_frag(void *data)
  1120. -+{
  1121. -+ put_page(virt_to_head_page(data));
  1122. -+}
  1123. -+#endif
  1124. -+
  1125. - #endif /* __BACKPORT_SKBUFF_H */
  1126. diff --git a/package/kernel/mac80211/patches/004-fix_duplicate_skcipher_backport.patch b/package/kernel/mac80211/patches/004-fix_duplicate_skcipher_backport.patch
  1127. new file mode 100644
  1128. index 0000000..38b3179
  1129. --- /dev/null
  1130. +++ b/package/kernel/mac80211/patches/004-fix_duplicate_skcipher_backport.patch
  1131. @@ -0,0 +1,11 @@
  1132. +--- a/compat/Makefile
  1133. ++++ b/compat/Makefile
  1134. +@@ -35,8 +35,6 @@ compat-$(CPTCFG_KERNEL_4_6) += backport-
  1135. +
  1136. + compat-$(CPTCFG_BPAUTO_BUILD_CRYPTO_CCM) += crypto-ccm.o
  1137. + compat-$(CPTCFG_BPAUTO_CRYPTO_SKCIPHER) += crypto-skcipher.o
  1138. +-skcipher-objs += crypto-skcipher.o
  1139. +-obj-$(CPTCFG_BPAUTO_CRYPTO_SKCIPHER) += skcipher.o
  1140. + compat-$(CPTCFG_BPAUTO_BUILD_WANT_DEV_COREDUMP) += drivers-base-devcoredump.o
  1141. + compat-$(CPTCFG_BPAUTO_RHASHTABLE) += lib-rhashtable.o
  1142. + cordic-objs += lib-cordic.o
  1143. 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
  1144. new file mode 100644
  1145. index 0000000..29bccc1
  1146. --- /dev/null
  1147. +++ b/package/kernel/mac80211/patches/005-backport_skb_get_hash_perturb.patch
  1148. @@ -0,0 +1,22 @@
  1149. +--- a/backport-include/linux/skbuff.h
  1150. ++++ b/backport-include/linux/skbuff.h
  1151. +@@ -305,6 +305,19 @@ static inline void skb_free_frag(void *d
  1152. + {
  1153. + put_page(virt_to_head_page(data));
  1154. + }
  1155. ++
  1156. ++#include <net/flow_keys.h>
  1157. ++#include <linux/jhash.h>
  1158. ++
  1159. ++static inline u32 skb_get_hash_perturb(struct sk_buff *skb, u32 key)
  1160. ++{
  1161. ++ struct flow_keys keys;
  1162. ++
  1163. ++ skb_flow_dissect(skb, &keys);
  1164. ++ return jhash_3words((__force u32)keys.dst,
  1165. ++ (__force u32)keys.src ^ keys.ip_proto,
  1166. ++ (__force u32)keys.ports, key);
  1167. ++}
  1168. + #endif
  1169. +
  1170. + #endif /* __BACKPORT_SKBUFF_H */
  1171. 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
  1172. deleted file mode 100644
  1173. index 9b672a8..0000000
  1174. --- a/package/kernel/mac80211/patches/005-backports-add-napi_alloc_frag.patch
  1175. +++ /dev/null
  1176. @@ -1,20 +0,0 @@
  1177. -From: Felix Fietkau <nbd@openwrt.org>
  1178. -Date: Thu, 28 Jan 2016 15:19:22 +0100
  1179. -Subject: [PATCH] backports: add napi_alloc_frag
  1180. -
  1181. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  1182. ----
  1183. -
  1184. ---- a/backport-include/linux/netdevice.h
  1185. -+++ b/backport-include/linux/netdevice.h
  1186. -@@ -232,6 +232,10 @@ static inline void backport_unregister_n
  1187. - #define unregister_netdevice_many LINUX_BACKPORT(unregister_netdevice_many)
  1188. - #endif
  1189. -
  1190. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
  1191. -+#define napi_alloc_frag netdev_alloc_frag
  1192. -+#endif
  1193. -+
  1194. - /*
  1195. - * Complicated way of saying: We only backport netdev_rss_key stuff on kernels
  1196. - * that either already have net_get_random_once() (>= 3.13) or where we've been
  1197. diff --git a/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch b/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
  1198. index fd1e1cf..8be5fa1 100644
  1199. --- a/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
  1200. +++ b/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
  1201. @@ -1,6 +1,6 @@
  1202. --- a/.local-symbols
  1203. +++ b/.local-symbols
  1204. -@@ -476,44 +476,6 @@ USB_IPHETH=
  1205. +@@ -481,45 +481,6 @@ USB_IPHETH=
  1206. USB_SIERRA_NET=
  1207. USB_VL600=
  1208. USB_NET_CH9200=
  1209. @@ -37,6 +37,7 @@
  1210. -BCMA_DRIVER_PCI=
  1211. -BCMA_DRIVER_PCI_HOSTMODE=
  1212. -BCMA_DRIVER_MIPS=
  1213. +-BCMA_PFLASH=
  1214. -BCMA_SFLASH=
  1215. -BCMA_NFLASH=
  1216. -BCMA_DRIVER_GMAC_CMN=
  1217. @@ -56,7 +57,7 @@
  1218. return (bus->chipco.dev ? bus->chipco.dev : bus->pcicore.dev);
  1219. #else
  1220. return bus->chipco.dev;
  1221. -@@ -4903,7 +4903,7 @@ static int b43_wireless_core_init(struct
  1222. +@@ -4883,7 +4883,7 @@ static int b43_wireless_core_init(struct
  1223. }
  1224. if (sprom->boardflags_lo & B43_BFL_XTAL_NOSLOW)
  1225. hf |= B43_HF_DSCRQ; /* Disable slowclock requests from ucode. */
  1226. diff --git a/package/kernel/mac80211/patches/080-disable_clk_backport.patch b/package/kernel/mac80211/patches/080-disable_clk_backport.patch
  1227. deleted file mode 100644
  1228. index 3765591..0000000
  1229. --- a/package/kernel/mac80211/patches/080-disable_clk_backport.patch
  1230. +++ /dev/null
  1231. @@ -1,20 +0,0 @@
  1232. ---- a/compat/compat-3.6.c
  1233. -+++ b/compat/compat-3.6.c
  1234. -@@ -147,17 +147,3 @@ int sg_alloc_table_from_pages(struct sg_
  1235. - return 0;
  1236. - }
  1237. - EXPORT_SYMBOL_GPL(sg_alloc_table_from_pages);
  1238. --
  1239. --/* whoopsie ! */
  1240. --#ifndef CONFIG_COMMON_CLK
  1241. --int clk_enable(struct clk *clk)
  1242. --{
  1243. -- return 0;
  1244. --}
  1245. --EXPORT_SYMBOL_GPL(clk_enable);
  1246. --
  1247. --void clk_disable(struct clk *clk)
  1248. --{
  1249. --}
  1250. --EXPORT_SYMBOL_GPL(clk_disable);
  1251. --#endif
  1252. diff --git a/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch b/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
  1253. index 02f46c7..fbe22e5 100644
  1254. --- a/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
  1255. +++ b/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
  1256. @@ -309,7 +309,7 @@
  1257. #endif /* AES_GMAC_H */
  1258. --- a/net/mac80211/key.h
  1259. +++ b/net/mac80211/key.h
  1260. -@@ -84,7 +84,7 @@ struct ieee80211_key {
  1261. +@@ -88,7 +88,7 @@ struct ieee80211_key {
  1262. * Management frames.
  1263. */
  1264. u8 rx_pn[IEEE80211_NUM_TIDS + 1][IEEE80211_CCMP_PN_LEN];
  1265. @@ -320,7 +320,7 @@
  1266. struct {
  1267. --- a/net/mac80211/wpa.c
  1268. +++ b/net/mac80211/wpa.c
  1269. -@@ -307,7 +307,8 @@ ieee80211_crypto_tkip_decrypt(struct iee
  1270. +@@ -304,7 +304,8 @@ ieee80211_crypto_tkip_decrypt(struct iee
  1271. }
  1272. @@ -330,7 +330,7 @@
  1273. {
  1274. __le16 mask_fc;
  1275. int a4_included, mgmt;
  1276. -@@ -337,14 +338,8 @@ static void ccmp_special_blocks(struct s
  1277. +@@ -334,14 +335,8 @@ static void ccmp_special_blocks(struct s
  1278. else
  1279. qos_tid = 0;
  1280. @@ -347,7 +347,7 @@
  1281. /* Nonce: Nonce Flags | A2 | PN
  1282. * Nonce Flags: Priority (b0..b3) | Management (b4) | Reserved (b5..b7)
  1283. -@@ -352,6 +347,8 @@ static void ccmp_special_blocks(struct s
  1284. +@@ -349,6 +344,8 @@ static void ccmp_special_blocks(struct s
  1285. b_0[1] = qos_tid | (mgmt << 4);
  1286. memcpy(&b_0[2], hdr->addr2, ETH_ALEN);
  1287. memcpy(&b_0[8], pn, IEEE80211_CCMP_PN_LEN);
  1288. @@ -356,7 +356,7 @@
  1289. /* AAD (extra authenticate-only data) / masked 802.11 header
  1290. * FC | A1 | A2 | A3 | SC | [A4] | [QC] */
  1291. -@@ -463,7 +460,7 @@ static int ccmp_encrypt_skb(struct ieee8
  1292. +@@ -460,7 +457,7 @@ static int ccmp_encrypt_skb(struct ieee8
  1293. return 0;
  1294. pos += IEEE80211_CCMP_HDR_LEN;
  1295. @@ -365,7 +365,7 @@
  1296. ieee80211_aes_ccm_encrypt(key->u.ccmp.tfm, b_0, aad, pos, len,
  1297. skb_put(skb, mic_len), mic_len);
  1298. -@@ -534,7 +531,7 @@ ieee80211_crypto_ccmp_decrypt(struct iee
  1299. +@@ -537,7 +534,7 @@ ieee80211_crypto_ccmp_decrypt(struct iee
  1300. u8 aad[2 * AES_BLOCK_SIZE];
  1301. u8 b_0[AES_BLOCK_SIZE];
  1302. /* hardware didn't decrypt/verify MIC */
  1303. 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
  1304. index d1d9fbd..3ca166f 100644
  1305. --- a/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch
  1306. +++ b/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch
  1307. @@ -2,7 +2,7 @@ Used for AP+STA support in OpenWrt - preserve AP mode keys across STA reconnects
  1308. --- a/net/mac80211/cfg.c
  1309. +++ b/net/mac80211/cfg.c
  1310. -@@ -846,7 +846,6 @@ static int ieee80211_stop_ap(struct wiph
  1311. +@@ -850,7 +850,6 @@ static int ieee80211_stop_ap(struct wiph
  1312. sdata->u.ap.driver_smps_mode = IEEE80211_SMPS_OFF;
  1313. __sta_info_flush(sdata, true);
  1314. diff --git a/package/kernel/mac80211/patches/150-disable_addr_notifier.patch b/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
  1315. index 2855a88..16fab84 100644
  1316. --- a/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
  1317. +++ b/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
  1318. @@ -18,9 +18,9 @@
  1319. static int ieee80211_ifa6_changed(struct notifier_block *nb,
  1320. unsigned long data, void *arg)
  1321. {
  1322. -@@ -1087,14 +1087,14 @@ int ieee80211_register_hw(struct ieee802
  1323. -
  1324. - rtnl_unlock();
  1325. +@@ -1090,14 +1090,14 @@ int ieee80211_register_hw(struct ieee802
  1326. + if (result)
  1327. + goto fail_flows;
  1328. -#ifdef CONFIG_INET
  1329. +#ifdef __disabled__CONFIG_INET
  1330. @@ -35,7 +35,7 @@
  1331. local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed;
  1332. result = register_inet6addr_notifier(&local->ifa6_notifier);
  1333. if (result)
  1334. -@@ -1103,13 +1103,13 @@ int ieee80211_register_hw(struct ieee802
  1335. +@@ -1106,13 +1106,13 @@ int ieee80211_register_hw(struct ieee802
  1336. return 0;
  1337. @@ -51,8 +51,8 @@
  1338. +#if defined(__disabled__CONFIG_INET) || defined(__disabled__CONFIG_IPV6)
  1339. fail_ifa:
  1340. #endif
  1341. - rtnl_lock();
  1342. -@@ -1137,10 +1137,10 @@ void ieee80211_unregister_hw(struct ieee
  1343. + ieee80211_txq_teardown_flows(local);
  1344. +@@ -1142,10 +1142,10 @@ void ieee80211_unregister_hw(struct ieee
  1345. tasklet_kill(&local->tx_pending_tasklet);
  1346. tasklet_kill(&local->tasklet);
  1347. diff --git a/package/kernel/mac80211/patches/210-ap_scan.patch b/package/kernel/mac80211/patches/210-ap_scan.patch
  1348. index a99cbd2..29f05c4 100644
  1349. --- a/package/kernel/mac80211/patches/210-ap_scan.patch
  1350. +++ b/package/kernel/mac80211/patches/210-ap_scan.patch
  1351. @@ -1,6 +1,6 @@
  1352. --- a/net/mac80211/cfg.c
  1353. +++ b/net/mac80211/cfg.c
  1354. -@@ -1999,7 +1999,7 @@ static int ieee80211_scan(struct wiphy *
  1355. +@@ -2008,7 +2008,7 @@ static int ieee80211_scan(struct wiphy *
  1356. * the frames sent while scanning on other channel will be
  1357. * lost)
  1358. */
  1359. diff --git a/package/kernel/mac80211/patches/220-fq_disable_hack.patch b/package/kernel/mac80211/patches/220-fq_disable_hack.patch
  1360. new file mode 100644
  1361. index 0000000..7f420be
  1362. --- /dev/null
  1363. +++ b/package/kernel/mac80211/patches/220-fq_disable_hack.patch
  1364. @@ -0,0 +1,15 @@
  1365. +mac80211 fq has been found to cause a regression in multi-stream TCP
  1366. +performance. Disable it until the cause has been found and fixed
  1367. +
  1368. +--- a/include/net/fq_impl.h
  1369. ++++ b/include/net/fq_impl.h
  1370. +@@ -104,6 +104,9 @@ static struct fq_flow *fq_flow_classify(
  1371. +
  1372. + lockdep_assert_held(&fq->lock);
  1373. +
  1374. ++ /* HACK: disable fq for now until TCP issues are fixed */
  1375. ++ return get_default_func(fq, tin, 0, skb);
  1376. ++
  1377. + hash = skb_get_hash_perturb(skb, fq->perturbation);
  1378. + idx = reciprocal_scale(hash, fq->flows_cnt);
  1379. + flow = &fq->flows[idx];
  1380. 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
  1381. index bddb15a..098bda7 100644
  1382. --- a/package/kernel/mac80211/patches/300-ath9k-force-rx_clear-when-disabling-rx.patch
  1383. +++ b/package/kernel/mac80211/patches/300-ath9k-force-rx_clear-when-disabling-rx.patch
  1384. @@ -3,15 +3,16 @@ Date: Sun, 7 Jun 2015 13:53:35 +0200
  1385. Subject: [PATCH] ath9k: force rx_clear when disabling rx
  1386. This makes stopping Rx more reliable and should reduce the frequency of
  1387. -Rx related DMA stop warnings
  1388. +Rx related DMA stop warnings. Don't use rx_clear in TX99 mode.
  1389. Cc: stable@vger.kernel.org
  1390. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  1391. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  1392. +Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
  1393. ---
  1394. --- a/drivers/net/wireless/ath/ath9k/mac.c
  1395. +++ b/drivers/net/wireless/ath/ath9k/mac.c
  1396. -@@ -677,13 +677,15 @@ void ath9k_hw_startpcureceive(struct ath
  1397. +@@ -677,13 +677,18 @@ void ath9k_hw_startpcureceive(struct ath
  1398. ath9k_ani_reset(ah, is_scanning);
  1399. @@ -24,8 +25,11 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  1400. void ath9k_hw_abortpcurecv(struct ath_hw *ah)
  1401. {
  1402. - REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_ABORT | AR_DIAG_RX_DIS);
  1403. -+ REG_SET_BIT(ah, AR_DIAG_SW,
  1404. -+ AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT | AR_DIAG_FORCE_RX_CLEAR);
  1405. ++ u32 reg = AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT;
  1406. ++
  1407. ++ if (!config_enabled(CPTCFG_ATH9K_TX99))
  1408. ++ reg |= AR_DIAG_FORCE_RX_CLEAR;
  1409. ++ REG_SET_BIT(ah, AR_DIAG_SW, reg);
  1410. ath9k_hw_disable_mib_counters(ah);
  1411. }
  1412. 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
  1413. new file mode 100644
  1414. index 0000000..7caa9be
  1415. --- /dev/null
  1416. +++ b/package/kernel/mac80211/patches/302-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch
  1417. @@ -0,0 +1,37 @@
  1418. +From: Felix Fietkau <nbd@nbd.name>
  1419. +Date: Sat, 14 May 2016 14:51:02 +0200
  1420. +Subject: [PATCH] Revert "ath9k: interpret requested txpower in EIRP
  1421. + domain"
  1422. +
  1423. +This reverts commit 71f5137bf010c6faffab50c0ec15374c59c4a411.
  1424. +---
  1425. +
  1426. +--- a/drivers/net/wireless/ath/ath9k/hw.c
  1427. ++++ b/drivers/net/wireless/ath/ath9k/hw.c
  1428. +@@ -2914,7 +2914,8 @@ void ath9k_hw_apply_txpower(struct ath_h
  1429. + {
  1430. + struct ath_regulatory *reg = ath9k_hw_regulatory(ah);
  1431. + struct ieee80211_channel *channel;
  1432. +- int chan_pwr, new_pwr;
  1433. ++ int chan_pwr, new_pwr, max_gain;
  1434. ++ int ant_gain, ant_reduction = 0;
  1435. +
  1436. + if (!chan)
  1437. + return;
  1438. +@@ -2922,10 +2923,15 @@ void ath9k_hw_apply_txpower(struct ath_h
  1439. + channel = chan->chan;
  1440. + chan_pwr = min_t(int, channel->max_power * 2, MAX_RATE_POWER);
  1441. + new_pwr = min_t(int, chan_pwr, reg->power_limit);
  1442. ++ max_gain = chan_pwr - new_pwr + channel->max_antenna_gain * 2;
  1443. ++
  1444. ++ ant_gain = get_antenna_gain(ah, chan);
  1445. ++ if (ant_gain > max_gain)
  1446. ++ ant_reduction = ant_gain - max_gain;
  1447. +
  1448. + ah->eep_ops->set_txpower(ah, chan,
  1449. + ath9k_regd_get_ctl(reg, chan),
  1450. +- get_antenna_gain(ah, chan), new_pwr, test);
  1451. ++ ant_reduction, new_pwr, test);
  1452. + }
  1453. +
  1454. + void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test)
  1455. 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
  1456. deleted file mode 100644
  1457. index 22b987a..0000000
  1458. --- a/package/kernel/mac80211/patches/302-ath9k_hw-add-low-power-tx-gain-table-for-AR953x.patch
  1459. +++ /dev/null
  1460. @@ -1,95 +0,0 @@
  1461. -From: Felix Fietkau <nbd@openwrt.org>
  1462. -Date: Thu, 14 Jan 2016 03:14:03 +0100
  1463. -Subject: [PATCH] ath9k_hw: add low power tx gain table for AR953x
  1464. -
  1465. -Used in some newer TP-Link AR9533 devices.
  1466. -
  1467. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  1468. ----
  1469. -
  1470. ---- a/drivers/net/wireless/ath/ath9k/ar9003_hw.c
  1471. -+++ b/drivers/net/wireless/ath/ath9k/ar9003_hw.c
  1472. -@@ -698,6 +698,9 @@ static void ar9003_tx_gain_table_mode2(s
  1473. - else if (AR_SREV_9340(ah))
  1474. - INIT_INI_ARRAY(&ah->iniModesTxGain,
  1475. - ar9340Modes_low_ob_db_tx_gain_table_1p0);
  1476. -+ else if (AR_SREV_9531_11(ah))
  1477. -+ INIT_INI_ARRAY(&ah->iniModesTxGain,
  1478. -+ qca953x_1p1_modes_no_xpa_low_power_tx_gain_table);
  1479. - else if (AR_SREV_9485_11_OR_LATER(ah))
  1480. - INIT_INI_ARRAY(&ah->iniModesTxGain,
  1481. - ar9485Modes_low_ob_db_tx_gain_1_1);
  1482. ---- a/drivers/net/wireless/ath/ath9k/ar953x_initvals.h
  1483. -+++ b/drivers/net/wireless/ath/ath9k/ar953x_initvals.h
  1484. -@@ -757,6 +757,71 @@ static const u32 qca953x_1p1_modes_xpa_t
  1485. - {0x00016448, 0x6c927a70},
  1486. - };
  1487. -
  1488. -+static const u32 qca953x_1p1_modes_no_xpa_low_power_tx_gain_table[][2] = {
  1489. -+ /* Addr allmodes */
  1490. -+ {0x0000a2dc, 0xfff55592},
  1491. -+ {0x0000a2e0, 0xfff99924},
  1492. -+ {0x0000a2e4, 0xfffe1e00},
  1493. -+ {0x0000a2e8, 0xffffe000},
  1494. -+ {0x0000a410, 0x000050d6},
  1495. -+ {0x0000a500, 0x00000069},
  1496. -+ {0x0000a504, 0x0400006b},
  1497. -+ {0x0000a508, 0x0800006d},
  1498. -+ {0x0000a50c, 0x0c000269},
  1499. -+ {0x0000a510, 0x1000026b},
  1500. -+ {0x0000a514, 0x1400026d},
  1501. -+ {0x0000a518, 0x18000669},
  1502. -+ {0x0000a51c, 0x1c00066b},
  1503. -+ {0x0000a520, 0x1d000a68},
  1504. -+ {0x0000a524, 0x21000a6a},
  1505. -+ {0x0000a528, 0x25000a6c},
  1506. -+ {0x0000a52c, 0x29000a6e},
  1507. -+ {0x0000a530, 0x2d0012a9},
  1508. -+ {0x0000a534, 0x310012ab},
  1509. -+ {0x0000a538, 0x350012ad},
  1510. -+ {0x0000a53c, 0x39001b0a},
  1511. -+ {0x0000a540, 0x3d001b0c},
  1512. -+ {0x0000a544, 0x41001b0e},
  1513. -+ {0x0000a548, 0x43001bae},
  1514. -+ {0x0000a54c, 0x45001914},
  1515. -+ {0x0000a550, 0x47001916},
  1516. -+ {0x0000a554, 0x49001b96},
  1517. -+ {0x0000a558, 0x49001b96},
  1518. -+ {0x0000a55c, 0x49001b96},
  1519. -+ {0x0000a560, 0x49001b96},
  1520. -+ {0x0000a564, 0x49001b96},
  1521. -+ {0x0000a568, 0x49001b96},
  1522. -+ {0x0000a56c, 0x49001b96},
  1523. -+ {0x0000a570, 0x49001b96},
  1524. -+ {0x0000a574, 0x49001b96},
  1525. -+ {0x0000a578, 0x49001b96},
  1526. -+ {0x0000a57c, 0x49001b96},
  1527. -+ {0x0000a600, 0x00000000},
  1528. -+ {0x0000a604, 0x00000000},
  1529. -+ {0x0000a608, 0x00000000},
  1530. -+ {0x0000a60c, 0x00000000},
  1531. -+ {0x0000a610, 0x00000000},
  1532. -+ {0x0000a614, 0x00000000},
  1533. -+ {0x0000a618, 0x00804201},
  1534. -+ {0x0000a61c, 0x01408201},
  1535. -+ {0x0000a620, 0x01408502},
  1536. -+ {0x0000a624, 0x01408502},
  1537. -+ {0x0000a628, 0x01408502},
  1538. -+ {0x0000a62c, 0x01408502},
  1539. -+ {0x0000a630, 0x01408502},
  1540. -+ {0x0000a634, 0x01408502},
  1541. -+ {0x0000a638, 0x01408502},
  1542. -+ {0x0000a63c, 0x01408502},
  1543. -+ {0x0000b2dc, 0xfff55592},
  1544. -+ {0x0000b2e0, 0xfff99924},
  1545. -+ {0x0000b2e4, 0xfffe1e00},
  1546. -+ {0x0000b2e8, 0xffffe000},
  1547. -+ {0x00016044, 0x044922db},
  1548. -+ {0x00016048, 0x6c927a70},
  1549. -+ {0x00016444, 0x044922db},
  1550. -+ {0x00016448, 0x6c927a70},
  1551. -+};
  1552. -+
  1553. - static const u32 qca953x_2p0_baseband_core[][2] = {
  1554. - /* Addr allmodes */
  1555. - {0x00009800, 0xafe68e30},
  1556. 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
  1557. new file mode 100644
  1558. index 0000000..73accd8
  1559. --- /dev/null
  1560. +++ b/package/kernel/mac80211/patches/303-ath10k-Ensure-txrx-compl-task-is-stopped-when-cleani.patch
  1561. @@ -0,0 +1,21 @@
  1562. +From: Ben Greear <greearb@candelatech.com>
  1563. +Date: Fri, 1 Apr 2016 14:12:08 -0700
  1564. +Subject: [PATCH] ath10k: Ensure txrx-compl-task is stopped when cleaning
  1565. + htt-tx.
  1566. +
  1567. +Otherwise, the txrx-compl-task may access some bad memory?
  1568. +
  1569. +Signed-off-by: Ben Greear <greearb@candelatech.com>
  1570. +---
  1571. +
  1572. +--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
  1573. ++++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
  1574. +@@ -388,6 +388,8 @@ void ath10k_htt_tx_free(struct ath10k_ht
  1575. + {
  1576. + int size;
  1577. +
  1578. ++ tasklet_kill(&htt->txrx_compl_task);
  1579. ++
  1580. + idr_for_each(&htt->pending_tx, ath10k_htt_tx_clean_up_pending, htt->ar);
  1581. + idr_destroy(&htt->pending_tx);
  1582. +
  1583. 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
  1584. deleted file mode 100644
  1585. index 7bb7435..0000000
  1586. --- a/package/kernel/mac80211/patches/303-rt2x00-fix-monitor-mode-regression.patch
  1587. +++ /dev/null
  1588. @@ -1,156 +0,0 @@
  1589. -From: Eli Cooper <elicooper@gmx.com>
  1590. -Date: Thu, 14 Jan 2016 00:07:12 +0800
  1591. -Subject: [PATCH] rt2x00: fix monitor mode regression
  1592. -
  1593. -Since commit df1404650ccbfeb76a84f301f22316be0d00a864 monitor mode for rt2x00
  1594. -has been made effectively useless because the hardware filter is configured to
  1595. -drop packets whose intended recipient is not the device, regardless of the
  1596. -presence of monitor mode interfaces.
  1597. -
  1598. -This patch fixes this regression by adding explicit monitor mode support, and
  1599. -configuring the hardware filter accordingly.
  1600. -
  1601. -Signed-off-by: Eli Cooper <elicooper@gmx.com>
  1602. ----
  1603. -
  1604. ---- a/drivers/net/wireless/ralink/rt2x00/rt2400pci.c
  1605. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2400pci.c
  1606. -@@ -273,8 +273,10 @@ static void rt2400pci_config_filter(stru
  1607. - !(filter_flags & FIF_PLCPFAIL));
  1608. - rt2x00_set_field32(&reg, RXCSR0_DROP_CONTROL,
  1609. - !(filter_flags & FIF_CONTROL));
  1610. -- rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME, 1);
  1611. -+ rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME,
  1612. -+ !rt2x00dev->is_monitoring);
  1613. - rt2x00_set_field32(&reg, RXCSR0_DROP_TODS,
  1614. -+ !rt2x00dev->is_monitoring &&
  1615. - !rt2x00dev->intf_ap_count);
  1616. - rt2x00_set_field32(&reg, RXCSR0_DROP_VERSION_ERROR, 1);
  1617. - rt2x00mmio_register_write(rt2x00dev, RXCSR0, reg);
  1618. ---- a/drivers/net/wireless/ralink/rt2x00/rt2500pci.c
  1619. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2500pci.c
  1620. -@@ -274,8 +274,10 @@ static void rt2500pci_config_filter(stru
  1621. - !(filter_flags & FIF_PLCPFAIL));
  1622. - rt2x00_set_field32(&reg, RXCSR0_DROP_CONTROL,
  1623. - !(filter_flags & FIF_CONTROL));
  1624. -- rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME, 1);
  1625. -+ rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME,
  1626. -+ !rt2x00dev->is_monitoring);
  1627. - rt2x00_set_field32(&reg, RXCSR0_DROP_TODS,
  1628. -+ !rt2x00dev->is_monitoring &&
  1629. - !rt2x00dev->intf_ap_count);
  1630. - rt2x00_set_field32(&reg, RXCSR0_DROP_VERSION_ERROR, 1);
  1631. - rt2x00_set_field32(&reg, RXCSR0_DROP_MCAST,
  1632. ---- a/drivers/net/wireless/ralink/rt2x00/rt2500usb.c
  1633. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2500usb.c
  1634. -@@ -437,8 +437,10 @@ static void rt2500usb_config_filter(stru
  1635. - !(filter_flags & FIF_PLCPFAIL));
  1636. - rt2x00_set_field16(&reg, TXRX_CSR2_DROP_CONTROL,
  1637. - !(filter_flags & FIF_CONTROL));
  1638. -- rt2x00_set_field16(&reg, TXRX_CSR2_DROP_NOT_TO_ME, 1);
  1639. -+ rt2x00_set_field16(&reg, TXRX_CSR2_DROP_NOT_TO_ME,
  1640. -+ !rt2x00dev->is_monitoring);
  1641. - rt2x00_set_field16(&reg, TXRX_CSR2_DROP_TODS,
  1642. -+ !rt2x00dev->is_monitoring &&
  1643. - !rt2x00dev->intf_ap_count);
  1644. - rt2x00_set_field16(&reg, TXRX_CSR2_DROP_VERSION_ERROR, 1);
  1645. - rt2x00_set_field16(&reg, TXRX_CSR2_DROP_MULTICAST,
  1646. ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  1647. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  1648. -@@ -1490,7 +1490,8 @@ void rt2800_config_filter(struct rt2x00_
  1649. - !(filter_flags & FIF_FCSFAIL));
  1650. - rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_PHY_ERROR,
  1651. - !(filter_flags & FIF_PLCPFAIL));
  1652. -- rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_TO_ME, 1);
  1653. -+ rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_TO_ME,
  1654. -+ !rt2x00dev->is_monitoring);
  1655. - rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_MY_BSSD, 0);
  1656. - rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_VER_ERROR, 1);
  1657. - rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_MULTICAST,
  1658. ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  1659. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  1660. -@@ -844,11 +844,13 @@ struct rt2x00_dev {
  1661. - * - Open sta interface count.
  1662. - * - Association count.
  1663. - * - Beaconing enabled count.
  1664. -+ * - Whether the device is monitoring.
  1665. - */
  1666. - unsigned int intf_ap_count;
  1667. - unsigned int intf_sta_count;
  1668. - unsigned int intf_associated;
  1669. - unsigned int intf_beaconing;
  1670. -+ bool is_monitoring;
  1671. -
  1672. - /*
  1673. - * Interface combinations
  1674. ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00config.c
  1675. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00config.c
  1676. -@@ -244,6 +244,16 @@ void rt2x00lib_config(struct rt2x00_dev
  1677. - (ieee80211_flags & IEEE80211_CONF_CHANGE_PS))
  1678. - cancel_delayed_work_sync(&rt2x00dev->autowakeup_work);
  1679. -
  1680. -+ if (ieee80211_flags & IEEE80211_CONF_CHANGE_MONITOR) {
  1681. -+ if (conf->flags & IEEE80211_CONF_MONITOR) {
  1682. -+ rt2x00_dbg(rt2x00dev, "Monitor mode is enabled\n");
  1683. -+ rt2x00dev->is_monitoring = true;
  1684. -+ } else {
  1685. -+ rt2x00_dbg(rt2x00dev, "Monitor mode is disabled\n");
  1686. -+ rt2x00dev->is_monitoring = false;
  1687. -+ }
  1688. -+ }
  1689. -+
  1690. - /*
  1691. - * Start configuration.
  1692. - */
  1693. ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  1694. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  1695. -@@ -1204,6 +1204,7 @@ int rt2x00lib_start(struct rt2x00_dev *r
  1696. - rt2x00dev->intf_ap_count = 0;
  1697. - rt2x00dev->intf_sta_count = 0;
  1698. - rt2x00dev->intf_associated = 0;
  1699. -+ rt2x00dev->is_monitoring = false;
  1700. -
  1701. - /* Enable the radio */
  1702. - retval = rt2x00lib_enable_radio(rt2x00dev);
  1703. ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
  1704. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
  1705. -@@ -385,11 +385,6 @@ void rt2x00mac_configure_filter(struct i
  1706. - *total_flags |= FIF_PSPOLL;
  1707. - }
  1708. -
  1709. -- /*
  1710. -- * Check if there is any work left for us.
  1711. -- */
  1712. -- if (rt2x00dev->packet_filter == *total_flags)
  1713. -- return;
  1714. - rt2x00dev->packet_filter = *total_flags;
  1715. -
  1716. - rt2x00dev->ops->lib->config_filter(rt2x00dev, *total_flags);
  1717. ---- a/drivers/net/wireless/ralink/rt2x00/rt61pci.c
  1718. -+++ b/drivers/net/wireless/ralink/rt2x00/rt61pci.c
  1719. -@@ -530,8 +530,10 @@ static void rt61pci_config_filter(struct
  1720. - !(filter_flags & FIF_PLCPFAIL));
  1721. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_CONTROL,
  1722. - !(filter_flags & (FIF_CONTROL | FIF_PSPOLL)));
  1723. -- rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME, 1);
  1724. -+ rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME,
  1725. -+ !rt2x00dev->is_monitoring);
  1726. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_TO_DS,
  1727. -+ !rt2x00dev->is_monitoring &&
  1728. - !rt2x00dev->intf_ap_count);
  1729. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_VERSION_ERROR, 1);
  1730. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_MULTICAST,
  1731. ---- a/drivers/net/wireless/ralink/rt2x00/rt73usb.c
  1732. -+++ b/drivers/net/wireless/ralink/rt2x00/rt73usb.c
  1733. -@@ -480,8 +480,10 @@ static void rt73usb_config_filter(struct
  1734. - !(filter_flags & FIF_PLCPFAIL));
  1735. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_CONTROL,
  1736. - !(filter_flags & (FIF_CONTROL | FIF_PSPOLL)));
  1737. -- rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME, 1);
  1738. -+ rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME,
  1739. -+ !rt2x00dev->is_monitoring);
  1740. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_TO_DS,
  1741. -+ !rt2x00dev->is_monitoring &&
  1742. - !rt2x00dev->intf_ap_count);
  1743. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_VERSION_ERROR, 1);
  1744. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_MULTICAST,
  1745. 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
  1746. new file mode 100644
  1747. index 0000000..7dec1fb
  1748. --- /dev/null
  1749. +++ b/package/kernel/mac80211/patches/304-ath10k-Ensure-peer_map-references-are-cleaned-up.patch
  1750. @@ -0,0 +1,60 @@
  1751. +From: Ben Greear <greearb@candelatech.com>
  1752. +Date: Fri, 1 Apr 2016 14:12:09 -0700
  1753. +Subject: [PATCH] ath10k: Ensure peer_map references are cleaned up.
  1754. +
  1755. +While debugging OS crashes due to firmware crashes, I enabled
  1756. +kasan, and it noticed that peer objects were being used-after-freed.
  1757. +
  1758. +Looks like there are two places we could be leaving stale references
  1759. +in the peer-map, so clean that up.
  1760. +
  1761. +Signed-off-by: Ben Greear <greearb@candelatech.com>
  1762. +---
  1763. +
  1764. +--- a/drivers/net/wireless/ath/ath10k/mac.c
  1765. ++++ b/drivers/net/wireless/ath/ath10k/mac.c
  1766. +@@ -802,6 +802,7 @@ static void ath10k_peer_cleanup(struct a
  1767. + {
  1768. + struct ath10k_peer *peer, *tmp;
  1769. + int peer_id;
  1770. ++ int i;
  1771. +
  1772. + lockdep_assert_held(&ar->conf_mutex);
  1773. +
  1774. +@@ -818,6 +819,17 @@ static void ath10k_peer_cleanup(struct a
  1775. + ar->peer_map[peer_id] = NULL;
  1776. + }
  1777. +
  1778. ++ /* Double check that peer is properly un-referenced from
  1779. ++ * the peer_map
  1780. ++ */
  1781. ++ for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) {
  1782. ++ if (ar->peer_map[i] == peer) {
  1783. ++ ath10k_warn(ar, "removing stale peer_map entry for %pM (ptr %p idx %d)\n",
  1784. ++ peer->addr, peer, i);
  1785. ++ ar->peer_map[i] = NULL;
  1786. ++ }
  1787. ++ }
  1788. ++
  1789. + list_del(&peer->list);
  1790. + kfree(peer);
  1791. + ar->num_peers--;
  1792. +@@ -828,6 +840,7 @@ static void ath10k_peer_cleanup(struct a
  1793. + static void ath10k_peer_cleanup_all(struct ath10k *ar)
  1794. + {
  1795. + struct ath10k_peer *peer, *tmp;
  1796. ++ int i;
  1797. +
  1798. + lockdep_assert_held(&ar->conf_mutex);
  1799. +
  1800. +@@ -836,6 +849,10 @@ static void ath10k_peer_cleanup_all(stru
  1801. + list_del(&peer->list);
  1802. + kfree(peer);
  1803. + }
  1804. ++
  1805. ++ for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++)
  1806. ++ ar->peer_map[i] = NULL;
  1807. ++
  1808. + spin_unlock_bh(&ar->data_lock);
  1809. +
  1810. + ar->num_peers = 0;
  1811. 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
  1812. deleted file mode 100644
  1813. index 049059a..0000000
  1814. --- a/package/kernel/mac80211/patches/304-ath9k-avoid-ANI-restart-if-no-trigger.patch
  1815. +++ /dev/null
  1816. @@ -1,32 +0,0 @@
  1817. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  1818. -Date: Fri, 15 Jan 2016 18:17:17 +0800
  1819. -Subject: [PATCH] ath9k: avoid ANI restart if no trigger
  1820. -
  1821. -Fixes commit 54da20d83f0e ("ath9k_hw: improve ANI processing and rx desensitizing parameters")
  1822. -
  1823. -Call ath9k_ani_restart() only when the phy error rate reach the
  1824. -ANI immunity threshold. Sync the logic with internal code base.
  1825. -
  1826. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  1827. ----
  1828. -
  1829. ---- a/drivers/net/wireless/ath/ath9k/ani.c
  1830. -+++ b/drivers/net/wireless/ath/ath9k/ani.c
  1831. -@@ -444,14 +444,16 @@ void ath9k_hw_ani_monitor(struct ath_hw
  1832. - ofdmPhyErrRate < ah->config.ofdm_trig_low) {
  1833. - ath9k_hw_ani_lower_immunity(ah);
  1834. - aniState->ofdmsTurn = !aniState->ofdmsTurn;
  1835. -+ ath9k_ani_restart(ah);
  1836. - } else if (ofdmPhyErrRate > ah->config.ofdm_trig_high) {
  1837. - ath9k_hw_ani_ofdm_err_trigger(ah);
  1838. - aniState->ofdmsTurn = false;
  1839. -+ ath9k_ani_restart(ah);
  1840. - } else if (cckPhyErrRate > ah->config.cck_trig_high) {
  1841. - ath9k_hw_ani_cck_err_trigger(ah);
  1842. - aniState->ofdmsTurn = true;
  1843. -+ ath9k_ani_restart(ah);
  1844. - }
  1845. -- ath9k_ani_restart(ah);
  1846. - }
  1847. - }
  1848. - EXPORT_SYMBOL(ath9k_hw_ani_monitor);
  1849. 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
  1850. new file mode 100644
  1851. index 0000000..7248a8c
  1852. --- /dev/null
  1853. +++ b/package/kernel/mac80211/patches/305-ath10k-Clean-up-peer-when-sta-goes-away.patch
  1854. @@ -0,0 +1,32 @@
  1855. +From: Ben Greear <greearb@candelatech.com>
  1856. +Date: Fri, 1 Apr 2016 14:12:11 -0700
  1857. +Subject: [PATCH] ath10k: Clean up peer when sta goes away.
  1858. +
  1859. +If WMI and/or firmware has issues removing the peer object,
  1860. +then we still need to clean up the peer object in the driver.
  1861. +
  1862. +Signed-off-by: Ben Greear <greearb@candelatech.com>
  1863. +---
  1864. +
  1865. +--- a/drivers/net/wireless/ath/ath10k/mac.c
  1866. ++++ b/drivers/net/wireless/ath/ath10k/mac.c
  1867. +@@ -5992,9 +5992,17 @@ static int ath10k_sta_state(struct ieee8
  1868. + continue;
  1869. +
  1870. + if (peer->sta == sta) {
  1871. +- ath10k_warn(ar, "found sta peer %pM entry on vdev %i after it was supposedly removed\n",
  1872. +- sta->addr, arvif->vdev_id);
  1873. ++ ath10k_warn(ar, "found sta peer %pM (ptr %p id %d) entry on vdev %i after it was supposedly removed\n",
  1874. ++ sta->addr, peer, i, arvif->vdev_id);
  1875. + peer->sta = NULL;
  1876. ++
  1877. ++ /* Clean up the peer object as well since we
  1878. ++ * must have failed to do this above.
  1879. ++ */
  1880. ++ list_del(&peer->list);
  1881. ++ ar->peer_map[i] = NULL;
  1882. ++ kfree(peer);
  1883. ++ ar->num_peers--;
  1884. + }
  1885. + }
  1886. + spin_unlock_bh(&ar->data_lock);
  1887. 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
  1888. deleted file mode 100644
  1889. index a1ac67c..0000000
  1890. --- a/package/kernel/mac80211/patches/305-ath9k-clean-up-ANI-per-channel-pointer-checking.patch
  1891. +++ /dev/null
  1892. @@ -1,91 +0,0 @@
  1893. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  1894. -Date: Fri, 15 Jan 2016 18:17:18 +0800
  1895. -Subject: [PATCH] ath9k: clean up ANI per-channel pointer checking
  1896. -
  1897. -commit c24bd3620c50 ("ath9k: Do not maintain ANI state per-channel")
  1898. -removed per-channel handling, the code to check 'curchan' also
  1899. -should be removed as never used.
  1900. -
  1901. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  1902. ----
  1903. -
  1904. ---- a/drivers/net/wireless/ath/ath9k/ani.c
  1905. -+++ b/drivers/net/wireless/ath/ath9k/ani.c
  1906. -@@ -126,12 +126,8 @@ static void ath9k_hw_update_mibstats(str
  1907. -
  1908. - static void ath9k_ani_restart(struct ath_hw *ah)
  1909. - {
  1910. -- struct ar5416AniState *aniState;
  1911. --
  1912. -- if (!ah->curchan)
  1913. -- return;
  1914. -+ struct ar5416AniState *aniState = &ah->ani;
  1915. -
  1916. -- aniState = &ah->ani;
  1917. - aniState->listenTime = 0;
  1918. -
  1919. - ENABLE_REGWRITE_BUFFER(ah);
  1920. -@@ -221,12 +217,7 @@ static void ath9k_hw_set_ofdm_nil(struct
  1921. -
  1922. - static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hw *ah)
  1923. - {
  1924. -- struct ar5416AniState *aniState;
  1925. --
  1926. -- if (!ah->curchan)
  1927. -- return;
  1928. --
  1929. -- aniState = &ah->ani;
  1930. -+ struct ar5416AniState *aniState = &ah->ani;
  1931. -
  1932. - if (aniState->ofdmNoiseImmunityLevel < ATH9K_ANI_OFDM_MAX_LEVEL)
  1933. - ath9k_hw_set_ofdm_nil(ah, aniState->ofdmNoiseImmunityLevel + 1, false);
  1934. -@@ -281,12 +272,7 @@ static void ath9k_hw_set_cck_nil(struct
  1935. -
  1936. - static void ath9k_hw_ani_cck_err_trigger(struct ath_hw *ah)
  1937. - {
  1938. -- struct ar5416AniState *aniState;
  1939. --
  1940. -- if (!ah->curchan)
  1941. -- return;
  1942. --
  1943. -- aniState = &ah->ani;
  1944. -+ struct ar5416AniState *aniState = &ah->ani;
  1945. -
  1946. - if (aniState->cckNoiseImmunityLevel < ATH9K_ANI_CCK_MAX_LEVEL)
  1947. - ath9k_hw_set_cck_nil(ah, aniState->cckNoiseImmunityLevel + 1,
  1948. -@@ -299,9 +285,7 @@ static void ath9k_hw_ani_cck_err_trigger
  1949. - */
  1950. - static void ath9k_hw_ani_lower_immunity(struct ath_hw *ah)
  1951. - {
  1952. -- struct ar5416AniState *aniState;
  1953. --
  1954. -- aniState = &ah->ani;
  1955. -+ struct ar5416AniState *aniState = &ah->ani;
  1956. -
  1957. - /* lower OFDM noise immunity */
  1958. - if (aniState->ofdmNoiseImmunityLevel > 0 &&
  1959. -@@ -329,7 +313,7 @@ void ath9k_ani_reset(struct ath_hw *ah,
  1960. - struct ath_common *common = ath9k_hw_common(ah);
  1961. - int ofdm_nil, cck_nil;
  1962. -
  1963. -- if (!ah->curchan)
  1964. -+ if (!chan)
  1965. - return;
  1966. -
  1967. - BUG_ON(aniState == NULL);
  1968. -@@ -416,14 +400,10 @@ static bool ath9k_hw_ani_read_counters(s
  1969. -
  1970. - void ath9k_hw_ani_monitor(struct ath_hw *ah, struct ath9k_channel *chan)
  1971. - {
  1972. -- struct ar5416AniState *aniState;
  1973. -+ struct ar5416AniState *aniState = &ah->ani;
  1974. - struct ath_common *common = ath9k_hw_common(ah);
  1975. - u32 ofdmPhyErrRate, cckPhyErrRate;
  1976. -
  1977. -- if (!ah->curchan)
  1978. -- return;
  1979. --
  1980. -- aniState = &ah->ani;
  1981. - if (!ath9k_hw_ani_read_counters(ah))
  1982. - return;
  1983. -
  1984. 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
  1985. deleted file mode 100644
  1986. index cf8194a..0000000
  1987. --- a/package/kernel/mac80211/patches/306-ath9k-do-not-reset-while-BB-panic-0x4000409-on-ar956.patch
  1988. +++ /dev/null
  1989. @@ -1,31 +0,0 @@
  1990. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  1991. -Date: Fri, 15 Jan 2016 18:17:19 +0800
  1992. -Subject: [PATCH] ath9k: do not reset while BB panic(0x4000409) on ar9561
  1993. -
  1994. -BB panic(0x4000409) observed while AP enabling/disabling
  1995. -bursting.
  1996. -
  1997. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  1998. ----
  1999. -
  2000. ---- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  2001. -+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  2002. -@@ -2071,7 +2071,8 @@ void ar9003_hw_attach_phy_ops(struct ath
  2003. - * to be disabled.
  2004. - *
  2005. - * 0x04000409: Packet stuck on receive.
  2006. -- * Full chip reset is required for all chips except AR9340.
  2007. -+ * Full chip reset is required for all chips except
  2008. -+ * AR9340, AR9531 and AR9561.
  2009. - */
  2010. -
  2011. - /*
  2012. -@@ -2100,7 +2101,7 @@ bool ar9003_hw_bb_watchdog_check(struct
  2013. - case 0x04000b09:
  2014. - return true;
  2015. - case 0x04000409:
  2016. -- if (AR_SREV_9340(ah) || AR_SREV_9531(ah))
  2017. -+ if (AR_SREV_9340(ah) || AR_SREV_9531(ah) || AR_SREV_9561(ah))
  2018. - return false;
  2019. - else
  2020. - return true;
  2021. 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
  2022. new file mode 100644
  2023. index 0000000..4a8f143
  2024. --- /dev/null
  2025. +++ b/package/kernel/mac80211/patches/306-mac80211-add-hdrlen-to-ieee80211_tx_data.patch
  2026. @@ -0,0 +1,203 @@
  2027. +From: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  2028. +Date: Fri, 19 Feb 2016 11:01:49 +0100
  2029. +Subject: [PATCH] mac80211: add hdrlen to ieee80211_tx_data
  2030. +
  2031. +Add hdrlen to ieee80211_tx_data and use this
  2032. +when wep/ccmd/tkip. This is preparation for
  2033. +aligned4 code.
  2034. +
  2035. +Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  2036. +---
  2037. +
  2038. +--- a/net/mac80211/ieee80211_i.h
  2039. ++++ b/net/mac80211/ieee80211_i.h
  2040. +@@ -173,6 +173,7 @@ struct ieee80211_tx_data {
  2041. + struct ieee80211_tx_rate rate;
  2042. +
  2043. + unsigned int flags;
  2044. ++ unsigned int hdrlen;
  2045. + };
  2046. +
  2047. +
  2048. +--- a/net/mac80211/tx.c
  2049. ++++ b/net/mac80211/tx.c
  2050. +@@ -922,7 +922,7 @@ ieee80211_tx_h_fragment(struct ieee80211
  2051. + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  2052. + struct ieee80211_hdr *hdr = (void *)skb->data;
  2053. + int frag_threshold = tx->local->hw.wiphy->frag_threshold;
  2054. +- int hdrlen;
  2055. ++ int hdrlen = tx->hdrlen;
  2056. + int fragnum;
  2057. +
  2058. + /* no matter what happens, tx->skb moves to tx->skbs */
  2059. +@@ -943,8 +943,6 @@ ieee80211_tx_h_fragment(struct ieee80211
  2060. + if (WARN_ON(info->flags & IEEE80211_TX_CTL_AMPDU))
  2061. + return TX_DROP;
  2062. +
  2063. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2064. +-
  2065. + /* internal error, why isn't DONTFRAG set? */
  2066. + if (WARN_ON(skb->len + FCS_LEN <= frag_threshold))
  2067. + return TX_DROP;
  2068. +@@ -1176,6 +1174,8 @@ ieee80211_tx_prepare(struct ieee80211_su
  2069. +
  2070. + hdr = (struct ieee80211_hdr *) skb->data;
  2071. +
  2072. ++ tx->hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2073. ++
  2074. + if (likely(sta)) {
  2075. + if (!IS_ERR(sta))
  2076. + tx->sta = sta;
  2077. +--- a/net/mac80211/util.c
  2078. ++++ b/net/mac80211/util.c
  2079. +@@ -1226,6 +1226,7 @@ void ieee80211_send_auth(struct ieee8021
  2080. + struct ieee80211_local *local = sdata->local;
  2081. + struct sk_buff *skb;
  2082. + struct ieee80211_mgmt *mgmt;
  2083. ++ unsigned int hdrlen;
  2084. + int err;
  2085. +
  2086. + /* 24 + 6 = header + auth_algo + auth_transaction + status_code */
  2087. +@@ -1250,8 +1251,10 @@ void ieee80211_send_auth(struct ieee8021
  2088. + memcpy(skb_put(skb, extra_len), extra, extra_len);
  2089. +
  2090. + if (auth_alg == WLAN_AUTH_SHARED_KEY && transaction == 3) {
  2091. ++ hdrlen = ieee80211_hdrlen(mgmt->frame_control);
  2092. + mgmt->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
  2093. +- err = ieee80211_wep_encrypt(local, skb, key, key_len, key_idx);
  2094. ++ err = ieee80211_wep_encrypt(local, skb, hdrlen, key,
  2095. ++ key_len, key_idx);
  2096. + WARN_ON(err);
  2097. + }
  2098. +
  2099. +--- a/net/mac80211/wep.c
  2100. ++++ b/net/mac80211/wep.c
  2101. +@@ -89,11 +89,11 @@ static void ieee80211_wep_get_iv(struct
  2102. +
  2103. + static u8 *ieee80211_wep_add_iv(struct ieee80211_local *local,
  2104. + struct sk_buff *skb,
  2105. ++ unsigned int hdrlen,
  2106. + int keylen, int keyidx)
  2107. + {
  2108. + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  2109. + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  2110. +- unsigned int hdrlen;
  2111. + u8 *newhdr;
  2112. +
  2113. + hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
  2114. +@@ -101,7 +101,6 @@ static u8 *ieee80211_wep_add_iv(struct i
  2115. + if (WARN_ON(skb_headroom(skb) < IEEE80211_WEP_IV_LEN))
  2116. + return NULL;
  2117. +
  2118. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2119. + newhdr = skb_push(skb, IEEE80211_WEP_IV_LEN);
  2120. + memmove(newhdr, newhdr + IEEE80211_WEP_IV_LEN, hdrlen);
  2121. +
  2122. +@@ -160,6 +159,7 @@ int ieee80211_wep_encrypt_data(struct cr
  2123. + */
  2124. + int ieee80211_wep_encrypt(struct ieee80211_local *local,
  2125. + struct sk_buff *skb,
  2126. ++ unsigned int hdrlen,
  2127. + const u8 *key, int keylen, int keyidx)
  2128. + {
  2129. + u8 *iv;
  2130. +@@ -169,7 +169,7 @@ int ieee80211_wep_encrypt(struct ieee802
  2131. + if (WARN_ON(skb_tailroom(skb) < IEEE80211_WEP_ICV_LEN))
  2132. + return -1;
  2133. +
  2134. +- iv = ieee80211_wep_add_iv(local, skb, keylen, keyidx);
  2135. ++ iv = ieee80211_wep_add_iv(local, skb, hdrlen, keylen, keyidx);
  2136. + if (!iv)
  2137. + return -1;
  2138. +
  2139. +@@ -306,13 +306,14 @@ static int wep_encrypt_skb(struct ieee80
  2140. + struct ieee80211_key_conf *hw_key = info->control.hw_key;
  2141. +
  2142. + if (!hw_key) {
  2143. +- if (ieee80211_wep_encrypt(tx->local, skb, tx->key->conf.key,
  2144. ++ if (ieee80211_wep_encrypt(tx->local, skb, tx->hdrlen,
  2145. ++ tx->key->conf.key,
  2146. + tx->key->conf.keylen,
  2147. + tx->key->conf.keyidx))
  2148. + return -1;
  2149. + } else if ((hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV) ||
  2150. + (hw_key->flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE)) {
  2151. +- if (!ieee80211_wep_add_iv(tx->local, skb,
  2152. ++ if (!ieee80211_wep_add_iv(tx->local, skb, tx->hdrlen,
  2153. + tx->key->conf.keylen,
  2154. + tx->key->conf.keyidx))
  2155. + return -1;
  2156. +--- a/net/mac80211/wep.h
  2157. ++++ b/net/mac80211/wep.h
  2158. +@@ -22,6 +22,7 @@ int ieee80211_wep_encrypt_data(struct cr
  2159. + size_t klen, u8 *data, size_t data_len);
  2160. + int ieee80211_wep_encrypt(struct ieee80211_local *local,
  2161. + struct sk_buff *skb,
  2162. ++ unsigned int hdrlen,
  2163. + const u8 *key, int keylen, int keyidx);
  2164. + int ieee80211_wep_decrypt_data(struct crypto_cipher *tfm, u8 *rc4key,
  2165. + size_t klen, u8 *data, size_t data_len);
  2166. +--- a/net/mac80211/wpa.c
  2167. ++++ b/net/mac80211/wpa.c
  2168. +@@ -43,7 +43,7 @@ ieee80211_tx_h_michael_mic_add(struct ie
  2169. + skb->len < 24 || !ieee80211_is_data_present(hdr->frame_control))
  2170. + return TX_CONTINUE;
  2171. +
  2172. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2173. ++ hdrlen = tx->hdrlen;
  2174. + if (skb->len < hdrlen)
  2175. + return TX_DROP;
  2176. +
  2177. +@@ -186,7 +186,6 @@ mic_fail_no_key:
  2178. +
  2179. + static int tkip_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
  2180. + {
  2181. +- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
  2182. + struct ieee80211_key *key = tx->key;
  2183. + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  2184. + unsigned int hdrlen;
  2185. +@@ -201,7 +200,7 @@ static int tkip_encrypt_skb(struct ieee8
  2186. + return 0;
  2187. + }
  2188. +
  2189. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2190. ++ hdrlen = tx->hdrlen;
  2191. + len = skb->len - hdrlen;
  2192. +
  2193. + if (info->control.hw_key)
  2194. +@@ -418,7 +417,7 @@ static int ccmp_encrypt_skb(struct ieee8
  2195. + return 0;
  2196. + }
  2197. +
  2198. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2199. ++ hdrlen = tx->hdrlen;
  2200. + len = skb->len - hdrlen;
  2201. +
  2202. + if (info->control.hw_key)
  2203. +@@ -651,7 +650,7 @@ static int gcmp_encrypt_skb(struct ieee8
  2204. + return 0;
  2205. + }
  2206. +
  2207. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2208. ++ hdrlen = tx->hdrlen;
  2209. + len = skb->len - hdrlen;
  2210. +
  2211. + if (info->control.hw_key)
  2212. +@@ -791,7 +790,6 @@ static ieee80211_tx_result
  2213. + ieee80211_crypto_cs_encrypt(struct ieee80211_tx_data *tx,
  2214. + struct sk_buff *skb)
  2215. + {
  2216. +- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  2217. + struct ieee80211_key *key = tx->key;
  2218. + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  2219. + int hdrlen;
  2220. +@@ -807,8 +805,7 @@ ieee80211_crypto_cs_encrypt(struct ieee8
  2221. + pskb_expand_head(skb, iv_len, 0, GFP_ATOMIC)))
  2222. + return TX_DROP;
  2223. +
  2224. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2225. +-
  2226. ++ hdrlen = tx->hdrlen;
  2227. + pos = skb_push(skb, iv_len);
  2228. + memmove(pos, pos + iv_len, hdrlen);
  2229. +
  2230. 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
  2231. deleted file mode 100644
  2232. index 80b781c..0000000
  2233. --- a/package/kernel/mac80211/patches/307-ath9k-fix-inconsistent-use-of-tab-and-space-in-inden.patch
  2234. +++ /dev/null
  2235. @@ -1,27 +0,0 @@
  2236. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  2237. -Date: Fri, 15 Jan 2016 18:17:20 +0800
  2238. -Subject: [PATCH] ath9k: fix inconsistent use of tab and space in
  2239. - indentation
  2240. -
  2241. -Minor changes for indenting.
  2242. -
  2243. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  2244. ----
  2245. -
  2246. ---- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
  2247. -+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
  2248. -@@ -5485,11 +5485,11 @@ unsigned int ar9003_get_paprd_scale_fact
  2249. - AR9300_PAPRD_SCALE_1);
  2250. - else {
  2251. - if (chan->channel >= 5700)
  2252. -- return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt20),
  2253. -- AR9300_PAPRD_SCALE_1);
  2254. -+ return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt20),
  2255. -+ AR9300_PAPRD_SCALE_1);
  2256. - else if (chan->channel >= 5400)
  2257. - return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt40),
  2258. -- AR9300_PAPRD_SCALE_2);
  2259. -+ AR9300_PAPRD_SCALE_2);
  2260. - else
  2261. - return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt40),
  2262. - AR9300_PAPRD_SCALE_1);
  2263. 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
  2264. new file mode 100644
  2265. index 0000000..eeb881e
  2266. --- /dev/null
  2267. +++ b/package/kernel/mac80211/patches/307-mac80211-add-NEED_ALIGNED4_SKBS-hw-flag.patch
  2268. @@ -0,0 +1,235 @@
  2269. +From: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  2270. +Date: Fri, 19 Feb 2016 11:01:50 +0100
  2271. +Subject: [PATCH] mac80211: add NEED_ALIGNED4_SKBS hw flag
  2272. +
  2273. +HW/driver should set NEED_ALIGNED4_SKBS flag in case
  2274. +require aligned skbs to four-byte boundaries.
  2275. +This affect only TX direction.
  2276. +
  2277. +Padding is added after ieee80211_hdr, before IV/LLC.
  2278. +
  2279. +Before we have to do memmove(hdrlen) twice in the
  2280. +dirver. Once before we pass this to HW and next
  2281. +in tx completion (to be sure monitor will report
  2282. +this tx frame correctly).
  2283. +
  2284. +With this patch we can skip this memmove() and save CPU.
  2285. +
  2286. +Currently this was tested with ath9k, both hw/sw crypt for
  2287. +wep/tkip/ccmp.
  2288. +
  2289. +Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  2290. +---
  2291. +
  2292. +--- a/include/net/mac80211.h
  2293. ++++ b/include/net/mac80211.h
  2294. +@@ -2014,6 +2014,9 @@ struct ieee80211_txq {
  2295. + * @IEEE80211_HW_TX_FRAG_LIST: Hardware (or driver) supports sending frag_list
  2296. + * skbs, needed for zero-copy software A-MSDU.
  2297. + *
  2298. ++ * @IEEE80211_HW_NEEDS_ALIGNED4_SKBS: Driver need aligned skbs to four-byte.
  2299. ++ * Padding will be added after ieee80211_hdr, before IV/LLC.
  2300. ++ *
  2301. + * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
  2302. + */
  2303. + enum ieee80211_hw_flags {
  2304. +@@ -2054,6 +2057,7 @@ enum ieee80211_hw_flags {
  2305. + IEEE80211_HW_USES_RSS,
  2306. + IEEE80211_HW_TX_AMSDU,
  2307. + IEEE80211_HW_TX_FRAG_LIST,
  2308. ++ IEEE80211_HW_NEEDS_ALIGNED4_SKBS,
  2309. +
  2310. + /* keep last, obviously */
  2311. + NUM_IEEE80211_HW_FLAGS
  2312. +--- a/net/mac80211/debugfs.c
  2313. ++++ b/net/mac80211/debugfs.c
  2314. +@@ -302,6 +302,7 @@ static const char *hw_flag_names[] = {
  2315. + FLAG(USES_RSS),
  2316. + FLAG(TX_AMSDU),
  2317. + FLAG(TX_FRAG_LIST),
  2318. ++ FLAG(NEEDS_ALIGNED4_SKBS),
  2319. + #undef FLAG
  2320. + };
  2321. +
  2322. +--- a/net/mac80211/ieee80211_i.h
  2323. ++++ b/net/mac80211/ieee80211_i.h
  2324. +@@ -1497,6 +1497,29 @@ ieee80211_have_rx_timestamp(struct ieee8
  2325. + return false;
  2326. + }
  2327. +
  2328. ++static inline unsigned int
  2329. ++ieee80211_hdr_padsize(struct ieee80211_hw *hw, unsigned int hdrlen)
  2330. ++{
  2331. ++ /*
  2332. ++ * While hdrlen is already aligned to two-byte boundaries,
  2333. ++ * simple check with & 2 will return correct padsize.
  2334. ++ */
  2335. ++ if (ieee80211_hw_check(hw, NEEDS_ALIGNED4_SKBS))
  2336. ++ return hdrlen & 2;
  2337. ++ return 0;
  2338. ++}
  2339. ++
  2340. ++static inline unsigned int
  2341. ++ieee80211_padded_hdrlen(struct ieee80211_hw *hw, __le16 fc)
  2342. ++{
  2343. ++ unsigned int hdrlen;
  2344. ++
  2345. ++ hdrlen = ieee80211_hdrlen(fc);
  2346. ++ hdrlen += ieee80211_hdr_padsize(hw, hdrlen);
  2347. ++
  2348. ++ return hdrlen;
  2349. ++}
  2350. ++
  2351. + u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local,
  2352. + struct ieee80211_rx_status *status,
  2353. + unsigned int mpdu_len,
  2354. +--- a/net/mac80211/sta_info.h
  2355. ++++ b/net/mac80211/sta_info.h
  2356. +@@ -279,7 +279,7 @@ struct ieee80211_fast_tx {
  2357. + u8 hdr_len;
  2358. + u8 sa_offs, da_offs, pn_offs;
  2359. + u8 band;
  2360. +- u8 hdr[30 + 2 + IEEE80211_FAST_XMIT_MAX_IV +
  2361. ++ u8 hdr[30 + 2 + 2 + IEEE80211_FAST_XMIT_MAX_IV +
  2362. + sizeof(rfc1042_header)] __aligned(2);
  2363. +
  2364. + struct rcu_head rcu_head;
  2365. +--- a/net/mac80211/status.c
  2366. ++++ b/net/mac80211/status.c
  2367. +@@ -683,9 +683,22 @@ void ieee80211_tx_monitor(struct ieee802
  2368. + struct sk_buff *skb2;
  2369. + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  2370. + struct ieee80211_sub_if_data *sdata;
  2371. ++ struct ieee80211_hdr *hdr = (void *)skb->data;
  2372. + struct net_device *prev_dev = NULL;
  2373. ++ unsigned int hdrlen, padsize;
  2374. + int rtap_len;
  2375. +
  2376. ++ /* Remove padding if was added */
  2377. ++ if (ieee80211_hw_check(&local->hw, NEEDS_ALIGNED4_SKBS)) {
  2378. ++ hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2379. ++ padsize = ieee80211_hdr_padsize(&local->hw, hdrlen);
  2380. ++
  2381. ++ if (padsize && skb->len > hdrlen + padsize) {
  2382. ++ memmove(skb->data + padsize, skb->data, hdrlen);
  2383. ++ skb_pull(skb, padsize);
  2384. ++ }
  2385. ++ }
  2386. ++
  2387. + /* send frame to monitor interfaces now */
  2388. + rtap_len = ieee80211_tx_radiotap_len(info);
  2389. + if (WARN_ON_ONCE(skb_headroom(skb) < rtap_len)) {
  2390. +--- a/net/mac80211/tkip.c
  2391. ++++ b/net/mac80211/tkip.c
  2392. +@@ -201,10 +201,12 @@ void ieee80211_get_tkip_p2k(struct ieee8
  2393. + {
  2394. + struct ieee80211_key *key = (struct ieee80211_key *)
  2395. + container_of(keyconf, struct ieee80211_key, conf);
  2396. ++ struct ieee80211_hw *hw = &key->local->hw;
  2397. + const u8 *tk = &key->conf.key[NL80211_TKIP_DATA_OFFSET_ENCR_KEY];
  2398. + struct tkip_ctx *ctx = &key->u.tkip.tx;
  2399. + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  2400. +- const u8 *data = (u8 *)hdr + ieee80211_hdrlen(hdr->frame_control);
  2401. ++ const u8 *data = (u8 *)hdr + ieee80211_padded_hdrlen(hw,
  2402. ++ hdr->frame_control);
  2403. + u32 iv32 = get_unaligned_le32(&data[4]);
  2404. + u16 iv16 = data[2] | (data[0] << 8);
  2405. +
  2406. +--- a/net/mac80211/tx.c
  2407. ++++ b/net/mac80211/tx.c
  2408. +@@ -1173,8 +1173,7 @@ ieee80211_tx_prepare(struct ieee80211_su
  2409. + info->flags &= ~IEEE80211_TX_INTFL_NEED_TXPROCESSING;
  2410. +
  2411. + hdr = (struct ieee80211_hdr *) skb->data;
  2412. +-
  2413. +- tx->hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2414. ++ tx->hdrlen = ieee80211_padded_hdrlen(&local->hw, hdr->frame_control);
  2415. +
  2416. + if (likely(sta)) {
  2417. + if (!IS_ERR(sta))
  2418. +@@ -2108,7 +2107,7 @@ netdev_tx_t ieee80211_monitor_start_xmit
  2419. + goto fail;
  2420. +
  2421. + hdr = (struct ieee80211_hdr *)(skb->data + len_rthdr);
  2422. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2423. ++ hdrlen = ieee80211_padded_hdrlen(&local->hw, hdr->frame_control);
  2424. +
  2425. + if (skb->len < len_rthdr + hdrlen)
  2426. + goto fail;
  2427. +@@ -2334,7 +2333,7 @@ static struct sk_buff *ieee80211_build_h
  2428. + struct ieee80211_chanctx_conf *chanctx_conf;
  2429. + struct ieee80211_sub_if_data *ap_sdata;
  2430. + enum nl80211_band band;
  2431. +- int ret;
  2432. ++ int padsize, ret;
  2433. +
  2434. + if (IS_ERR(sta))
  2435. + sta = NULL;
  2436. +@@ -2554,6 +2553,9 @@ static struct sk_buff *ieee80211_build_h
  2437. + hdrlen += 2;
  2438. + }
  2439. +
  2440. ++ /* Check aligned4 skb required */
  2441. ++ padsize = ieee80211_hdr_padsize(&sdata->local->hw, hdrlen);
  2442. ++
  2443. + /*
  2444. + * Drop unicast frames to unauthorised stations unless they are
  2445. + * EAPOL frames from the local station.
  2446. +@@ -2640,6 +2642,7 @@ static struct sk_buff *ieee80211_build_h
  2447. + h_pos -= skip_header_bytes;
  2448. +
  2449. + head_need = hdrlen + encaps_len + meshhdrlen - skb_headroom(skb);
  2450. ++ head_need += padsize;
  2451. +
  2452. + /*
  2453. + * So we need to modify the skb header and hence need a copy of
  2454. +@@ -2678,6 +2681,9 @@ static struct sk_buff *ieee80211_build_h
  2455. + }
  2456. + #endif
  2457. +
  2458. ++ if (padsize)
  2459. ++ memset(skb_push(skb, padsize), 0, padsize);
  2460. ++
  2461. + if (ieee80211_is_data_qos(fc)) {
  2462. + __le16 *qos_control;
  2463. +
  2464. +@@ -2691,8 +2697,8 @@ static struct sk_buff *ieee80211_build_h
  2465. + } else
  2466. + memcpy(skb_push(skb, hdrlen), &hdr, hdrlen);
  2467. +
  2468. +- nh_pos += hdrlen;
  2469. +- h_pos += hdrlen;
  2470. ++ nh_pos += hdrlen + padsize;
  2471. ++ h_pos += hdrlen + padsize;
  2472. +
  2473. + /* Update skb pointers to various headers since this modified frame
  2474. + * is going to go through Linux networking code that may potentially
  2475. +@@ -2861,6 +2867,9 @@ void ieee80211_check_fast_xmit(struct st
  2476. + fc |= cpu_to_le16(IEEE80211_STYPE_QOS_DATA);
  2477. + }
  2478. +
  2479. ++ /* Check aligned4 skb required */
  2480. ++ build.hdr_len += ieee80211_hdr_padsize(&local->hw, build.hdr_len);
  2481. ++
  2482. + /* We store the key here so there's no point in using rcu_dereference()
  2483. + * but that's fine because the code that changes the pointers will call
  2484. + * this function after doing so. For a single CPU that would be enough,
  2485. +--- a/net/mac80211/util.c
  2486. ++++ b/net/mac80211/util.c
  2487. +@@ -1224,6 +1224,7 @@ void ieee80211_send_auth(struct ieee8021
  2488. + u32 tx_flags)
  2489. + {
  2490. + struct ieee80211_local *local = sdata->local;
  2491. ++ struct ieee80211_hw *hw = &local->hw;
  2492. + struct sk_buff *skb;
  2493. + struct ieee80211_mgmt *mgmt;
  2494. + unsigned int hdrlen;
  2495. +@@ -1251,7 +1252,7 @@ void ieee80211_send_auth(struct ieee8021
  2496. + memcpy(skb_put(skb, extra_len), extra, extra_len);
  2497. +
  2498. + if (auth_alg == WLAN_AUTH_SHARED_KEY && transaction == 3) {
  2499. +- hdrlen = ieee80211_hdrlen(mgmt->frame_control);
  2500. ++ hdrlen = ieee80211_padded_hdrlen(hw, mgmt->frame_control);
  2501. + mgmt->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
  2502. + err = ieee80211_wep_encrypt(local, skb, hdrlen, key,
  2503. + key_len, key_idx);
  2504. 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
  2505. new file mode 100644
  2506. index 0000000..8590aad
  2507. --- /dev/null
  2508. +++ b/package/kernel/mac80211/patches/308-ath10k-Fix-sending-NULL-Qos-NULL-data-frames-for-QCA.patch
  2509. @@ -0,0 +1,72 @@
  2510. +From: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
  2511. +Date: Thu, 23 Jun 2016 22:10:01 +0530
  2512. +Subject: [PATCH] ath10k: Fix sending NULL/ Qos NULL data frames for
  2513. + QCA99X0 and later
  2514. +
  2515. +For chipsets like QCA99X0, IPQ4019 and later we are not getting proper
  2516. +NULL func status (always acked/successs !!) when hostapd does a
  2517. +PROBE_CLIENT via nullfunc frames when the station is powered off
  2518. +abruptly (inactive timer probes client via null func after the inactive
  2519. +time reaches beyond the threshold). Fix this by disabling the workaround
  2520. +(getting the ACK status of NULL func frames by sending via HTT mgmt-tx
  2521. + path) introduced by the change ("ath10k: fix beacon loss handling ")
  2522. +for QCA99X0 and later chipsets. The normal tx path provides the proper
  2523. +ACK status for NULL data frames. As of now disable this workaround for
  2524. +chipsets QCA99X0 and later, once the 10.1 firmware is obselete we can
  2525. +completely get rid of this workaround for all the chipsets
  2526. +
  2527. +Signed-off-by: Tamizh chelvam <c_traja@qti.qualcomm.com>
  2528. +Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
  2529. +---
  2530. +
  2531. +--- a/drivers/net/wireless/ath/ath10k/core.c
  2532. ++++ b/drivers/net/wireless/ath/ath10k/core.c
  2533. +@@ -181,6 +181,7 @@ static const struct ath10k_hw_params ath
  2534. + .board = QCA99X0_HW_2_0_BOARD_DATA_FILE,
  2535. + .board_size = QCA99X0_BOARD_DATA_SZ,
  2536. + .board_ext_size = QCA99X0_BOARD_EXT_DATA_SZ,
  2537. ++ .disable_null_func_workaround = true,
  2538. + },
  2539. + },
  2540. + {
  2541. +@@ -204,6 +205,7 @@ static const struct ath10k_hw_params ath
  2542. + .board = QCA9984_HW_1_0_BOARD_DATA_FILE,
  2543. + .board_size = QCA99X0_BOARD_DATA_SZ,
  2544. + .board_ext_size = QCA99X0_BOARD_EXT_DATA_SZ,
  2545. ++ .disable_null_func_workaround = true,
  2546. + },
  2547. + },
  2548. + {
  2549. +@@ -262,6 +264,7 @@ static const struct ath10k_hw_params ath
  2550. + .board = QCA4019_HW_1_0_BOARD_DATA_FILE,
  2551. + .board_size = QCA4019_BOARD_DATA_SZ,
  2552. + .board_ext_size = QCA4019_BOARD_EXT_DATA_SZ,
  2553. ++ .disable_null_func_workaround = true,
  2554. + },
  2555. + },
  2556. + };
  2557. +--- a/drivers/net/wireless/ath/ath10k/core.h
  2558. ++++ b/drivers/net/wireless/ath/ath10k/core.h
  2559. +@@ -750,6 +750,12 @@ struct ath10k {
  2560. + const char *board;
  2561. + size_t board_size;
  2562. + size_t board_ext_size;
  2563. ++ /* Workaround of sending NULL data frames via
  2564. ++ * HTT mgmt TX and getting the proper ACK status does
  2565. ++ * not works for chipsets QCA99X0 and later, while
  2566. ++ * Tx data path reports the ACK status properly.
  2567. ++ */
  2568. ++ bool disable_null_func_workaround;
  2569. + } fw;
  2570. + } hw_params;
  2571. +
  2572. +--- a/drivers/net/wireless/ath/ath10k/mac.c
  2573. ++++ b/drivers/net/wireless/ath/ath10k/mac.c
  2574. +@@ -3253,6 +3253,7 @@ ath10k_mac_tx_h_get_txmode(struct ath10k
  2575. + * mode though because AP don't sleep.
  2576. + */
  2577. + if (ar->htt.target_version_major < 3 &&
  2578. ++ !ar->hw_params.fw.disable_null_func_workaround &&
  2579. + (ieee80211_is_nullfunc(fc) || ieee80211_is_qos_nullfunc(fc)) &&
  2580. + !test_bit(ATH10K_FW_FEATURE_HAS_WMI_MGMT_TX,
  2581. + ar->running_fw->fw_file.fw_features))
  2582. 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
  2583. deleted file mode 100644
  2584. index d408866..0000000
  2585. --- a/package/kernel/mac80211/patches/308-ath9k-fix-data-bus-error-on-ar9300-and-ar9580.patch
  2586. +++ /dev/null
  2587. @@ -1,65 +0,0 @@
  2588. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  2589. -Date: Fri, 15 Jan 2016 18:17:21 +0800
  2590. -Subject: [PATCH] ath9k: fix data bus error on ar9300 and ar9580
  2591. -
  2592. -One crash issue be found on ar9300: RTC_RC reg read leads crash, leading
  2593. -the data bus error, due to RTC_RC reg write not happen properly.
  2594. -
  2595. -Warm Reset trigger in continuous beacon stuck for one of the customer for
  2596. -other chip, noticed the MAC was stuck in RTC reset. After analysis noticed
  2597. -DMA did not complete when RTC was put in reset.
  2598. -
  2599. -So, before resetting the MAC need to make sure there are no pending DMA
  2600. -transactions because this reset does not reset all parts of the chip.
  2601. -
  2602. -The 12th and 11th bit of MAC _DMA_CFG register used to do that.
  2603. - 12 cfg_halt_ack 0x0
  2604. - 0 DMA has not yet halted
  2605. - 1 DMA has halted
  2606. - 11 cfg_halt_req 0x0
  2607. - 0 DMA logic operates normally
  2608. - 1 Request DMA logic to stop so software can reset the MAC
  2609. -
  2610. -The Bit [12] of this register indicates when the halt has taken effect or
  2611. -not. the DMA halt IS NOT recoverable; once software sets bit [11] to
  2612. -request a DMA halt, software must wait for bit [12] to be set and reset
  2613. -the MAC.
  2614. -
  2615. -So, the same thing we implemented for ar9580 chip.
  2616. -
  2617. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  2618. ----
  2619. -
  2620. ---- a/drivers/net/wireless/ath/ath9k/hw.c
  2621. -+++ b/drivers/net/wireless/ath/ath9k/hw.c
  2622. -@@ -1368,6 +1368,16 @@ static bool ath9k_hw_set_reset(struct at
  2623. - if (ath9k_hw_mci_is_enabled(ah))
  2624. - ar9003_mci_check_gpm_offset(ah);
  2625. -
  2626. -+ /* DMA HALT added to resolve ar9300 and ar9580 bus error during
  2627. -+ * RTC_RC reg read
  2628. -+ */
  2629. -+ if (AR_SREV_9300(ah) || AR_SREV_9580(ah)) {
  2630. -+ REG_SET_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  2631. -+ ath9k_hw_wait(ah, AR_CFG, AR_CFG_HALT_ACK, AR_CFG_HALT_ACK,
  2632. -+ 20 * AH_WAIT_TIMEOUT);
  2633. -+ REG_CLR_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  2634. -+ }
  2635. -+
  2636. - REG_WRITE(ah, AR_RTC_RC, rst_flags);
  2637. -
  2638. - REGWRITE_BUFFER_FLUSH(ah);
  2639. ---- a/drivers/net/wireless/ath/ath9k/reg.h
  2640. -+++ b/drivers/net/wireless/ath/ath9k/reg.h
  2641. -@@ -34,8 +34,10 @@
  2642. - #define AR_CFG_SWRG 0x00000010
  2643. - #define AR_CFG_AP_ADHOC_INDICATION 0x00000020
  2644. - #define AR_CFG_PHOK 0x00000100
  2645. --#define AR_CFG_CLK_GATE_DIS 0x00000400
  2646. - #define AR_CFG_EEBS 0x00000200
  2647. -+#define AR_CFG_CLK_GATE_DIS 0x00000400
  2648. -+#define AR_CFG_HALT_REQ 0x00000800
  2649. -+#define AR_CFG_HALT_ACK 0x00001000
  2650. - #define AR_CFG_PCI_MASTER_REQ_Q_THRESH 0x00060000
  2651. - #define AR_CFG_PCI_MASTER_REQ_Q_THRESH_S 17
  2652. -
  2653. 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
  2654. deleted file mode 100644
  2655. index d9511c8..0000000
  2656. --- a/package/kernel/mac80211/patches/309-01-brcmfmac-add-missing-include.patch
  2657. +++ /dev/null
  2658. @@ -1,19 +0,0 @@
  2659. -From: Felix Fietkau <nbd@openwrt.org>
  2660. -Date: Fri, 15 Jan 2016 15:59:45 +0100
  2661. -Subject: [PATCH] brcmfmac: add missing include
  2662. -
  2663. -linux/module.h is required for defining module parameters
  2664. -
  2665. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  2666. ----
  2667. -
  2668. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  2669. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  2670. -@@ -17,6 +17,7 @@
  2671. - #include <linux/kernel.h>
  2672. - #include <linux/string.h>
  2673. - #include <linux/netdevice.h>
  2674. -+#include <linux/module.h>
  2675. - #include <brcmu_wifi.h>
  2676. - #include <brcmu_utils.h>
  2677. - #include "core.h"
  2678. 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
  2679. deleted file mode 100644
  2680. index 711e019..0000000
  2681. --- a/package/kernel/mac80211/patches/309-02-brcmfmac-fix-sdio-sg-table-alloc-crash.patch
  2682. +++ /dev/null
  2683. @@ -1,118 +0,0 @@
  2684. -From: Hante Meuleman <meuleman@broadcom.com>
  2685. -Date: Tue, 19 Jan 2016 12:39:24 +0100
  2686. -Subject: [PATCH] brcmfmac: fix sdio sg table alloc crash
  2687. -
  2688. -With commit 7d34b0560567 ("brcmfmac: Move all module parameters to
  2689. -one place") a bug was introduced causing a null pointer exception.
  2690. -This patch fixes the bug by initializing the sg table till after
  2691. -the settings have been initialized.
  2692. -
  2693. -Fixes: 7d34b0560567 ("brcmfmac: Move all module parameters to one place")
  2694. -Reported-by: Marc Zyngier <marc.zyngier@arm.com>
  2695. -Tested-by: Marc Zyngier <marc.zyngier@arm.com>
  2696. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  2697. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  2698. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  2699. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  2700. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  2701. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  2702. ----
  2703. -
  2704. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  2705. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  2706. -@@ -879,11 +879,24 @@ int brcmf_sdiod_abort(struct brcmf_sdio_
  2707. - return 0;
  2708. - }
  2709. -
  2710. --static void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev)
  2711. -+void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev)
  2712. - {
  2713. -+ struct sdio_func *func;
  2714. -+ struct mmc_host *host;
  2715. -+ uint max_blocks;
  2716. - uint nents;
  2717. - int err;
  2718. -
  2719. -+ func = sdiodev->func[2];
  2720. -+ host = func->card->host;
  2721. -+ sdiodev->sg_support = host->max_segs > 1;
  2722. -+ max_blocks = min_t(uint, host->max_blk_count, 511u);
  2723. -+ sdiodev->max_request_size = min_t(uint, host->max_req_size,
  2724. -+ max_blocks * func->cur_blksize);
  2725. -+ sdiodev->max_segment_count = min_t(uint, host->max_segs,
  2726. -+ SG_MAX_SINGLE_ALLOC);
  2727. -+ sdiodev->max_segment_size = host->max_seg_size;
  2728. -+
  2729. - if (!sdiodev->sg_support)
  2730. - return;
  2731. -
  2732. -@@ -1021,9 +1034,6 @@ static void brcmf_sdiod_host_fixup(struc
  2733. -
  2734. - static int brcmf_sdiod_probe(struct brcmf_sdio_dev *sdiodev)
  2735. - {
  2736. -- struct sdio_func *func;
  2737. -- struct mmc_host *host;
  2738. -- uint max_blocks;
  2739. - int ret = 0;
  2740. -
  2741. - sdiodev->num_funcs = 2;
  2742. -@@ -1054,26 +1064,6 @@ static int brcmf_sdiod_probe(struct brcm
  2743. - goto out;
  2744. - }
  2745. -
  2746. -- /*
  2747. -- * determine host related variables after brcmf_sdiod_probe()
  2748. -- * as func->cur_blksize is properly set and F2 init has been
  2749. -- * completed successfully.
  2750. -- */
  2751. -- func = sdiodev->func[2];
  2752. -- host = func->card->host;
  2753. -- sdiodev->sg_support = host->max_segs > 1;
  2754. -- max_blocks = min_t(uint, host->max_blk_count, 511u);
  2755. -- sdiodev->max_request_size = min_t(uint, host->max_req_size,
  2756. -- max_blocks * func->cur_blksize);
  2757. -- sdiodev->max_segment_count = min_t(uint, host->max_segs,
  2758. -- SG_MAX_SINGLE_ALLOC);
  2759. -- sdiodev->max_segment_size = host->max_seg_size;
  2760. --
  2761. -- /* allocate scatter-gather table. sg support
  2762. -- * will be disabled upon allocation failure.
  2763. -- */
  2764. -- brcmf_sdiod_sgtable_alloc(sdiodev);
  2765. --
  2766. - ret = brcmf_sdiod_freezer_attach(sdiodev);
  2767. - if (ret)
  2768. - goto out;
  2769. -@@ -1084,7 +1074,7 @@ static int brcmf_sdiod_probe(struct brcm
  2770. - ret = -ENODEV;
  2771. - goto out;
  2772. - }
  2773. -- brcmf_sdiod_host_fixup(host);
  2774. -+ brcmf_sdiod_host_fixup(sdiodev->func[2]->card->host);
  2775. - out:
  2776. - if (ret)
  2777. - brcmf_sdiod_remove(sdiodev);
  2778. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  2779. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  2780. -@@ -4114,6 +4114,11 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
  2781. - goto fail;
  2782. - }
  2783. -
  2784. -+ /* allocate scatter-gather table. sg support
  2785. -+ * will be disabled upon allocation failure.
  2786. -+ */
  2787. -+ brcmf_sdiod_sgtable_alloc(bus->sdiodev);
  2788. -+
  2789. - /* Query the F2 block size, set roundup accordingly */
  2790. - bus->blocksize = bus->sdiodev->func[2]->cur_blksize;
  2791. - bus->roundup = min(max_roundup, bus->blocksize);
  2792. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
  2793. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
  2794. -@@ -342,6 +342,7 @@ int brcmf_sdiod_ramrw(struct brcmf_sdio_
  2795. -
  2796. - /* Issue an abort to the specified function */
  2797. - int brcmf_sdiod_abort(struct brcmf_sdio_dev *sdiodev, uint fn);
  2798. -+void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev);
  2799. - void brcmf_sdiod_change_state(struct brcmf_sdio_dev *sdiodev,
  2800. - enum brcmf_sdiod_state state);
  2801. - #ifdef CONFIG_PM_SLEEP
  2802. 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
  2803. new file mode 100644
  2804. index 0000000..41c27ca
  2805. --- /dev/null
  2806. +++ b/package/kernel/mac80211/patches/309-cfg80211-fix-proto-in-ieee80211_data_to_8023-for-fra.patch
  2807. @@ -0,0 +1,37 @@
  2808. +From: Felix Fietkau <nbd@nbd.name>
  2809. +Date: Wed, 29 Jun 2016 10:02:32 +0200
  2810. +Subject: [PATCH] cfg80211: fix proto in ieee80211_data_to_8023 for frames
  2811. + without LLC header
  2812. +
  2813. +The PDU length of incoming LLC frames is set to the total skb payload size
  2814. +in __ieee80211_data_to_8023() of net/wireless/util.c which incorrectly
  2815. +includes the length of the IEEE 802.11 header.
  2816. +
  2817. +The resulting LLC frame header has a too large PDU length, causing the
  2818. +llc_fixup_skb() function of net/llc/llc_input.c to reject the incoming
  2819. +skb, effectively breaking STP.
  2820. +
  2821. +Solve the problem by properly substracting the IEEE 802.11 frame header size
  2822. +from the PDU length, allowing the LLC processor to pick up the incoming
  2823. +control messages.
  2824. +
  2825. +Special thanks to Gerry Rozema for tracking down the regression and proposing
  2826. +a suitable patch.
  2827. +
  2828. +Fixes: 2d1c304cb2d5 ("cfg80211: add function for 802.3 conversion with separate output buffer")
  2829. +Cc: stable@vger.kernel.org
  2830. +Reported-by: Gerry Rozema <gerryr@rozeware.com>
  2831. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  2832. +---
  2833. +
  2834. +--- a/net/wireless/util.c
  2835. ++++ b/net/wireless/util.c
  2836. +@@ -509,7 +509,7 @@ static int __ieee80211_data_to_8023(stru
  2837. + * replace EtherType */
  2838. + hdrlen += ETH_ALEN + 2;
  2839. + else
  2840. +- tmp.h_proto = htons(skb->len);
  2841. ++ tmp.h_proto = htons(skb->len - hdrlen);
  2842. +
  2843. + pskb_pull(skb, hdrlen);
  2844. +
  2845. 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
  2846. deleted file mode 100644
  2847. index 287d6e1..0000000
  2848. --- a/package/kernel/mac80211/patches/310-ath9k_hw-ignore-eeprom-magic-mismatch-on-flash-based.patch
  2849. +++ /dev/null
  2850. @@ -1,38 +0,0 @@
  2851. -From: Felix Fietkau <nbd@openwrt.org>
  2852. -Date: Thu, 21 Jan 2016 16:28:44 +0100
  2853. -Subject: [PATCH] ath9k_hw: ignore eeprom magic mismatch on flash based devices
  2854. -
  2855. -Many AR913x based devices (maybe others too) do not have a valid EEPROM
  2856. -magic in their calibration data partition.
  2857. -
  2858. -Fixes: 6fa658fd5ab2 ("ath9k: Simplify and fix eeprom endianness swapping")
  2859. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  2860. ----
  2861. -
  2862. ---- a/drivers/net/wireless/ath/ath9k/eeprom.c
  2863. -+++ b/drivers/net/wireless/ath/ath9k/eeprom.c
  2864. -@@ -150,18 +150,18 @@ int ath9k_hw_nvram_swap_data(struct ath_
  2865. - return -EIO;
  2866. - }
  2867. -
  2868. -- if (magic == AR5416_EEPROM_MAGIC) {
  2869. -- *swap_needed = false;
  2870. -- } else if (swab16(magic) == AR5416_EEPROM_MAGIC) {
  2871. -+ *swap_needed = false;
  2872. -+ if (swab16(magic) == AR5416_EEPROM_MAGIC) {
  2873. - if (ah->ah_flags & AH_NO_EEP_SWAP) {
  2874. - ath_info(common,
  2875. - "Ignoring endianness difference in EEPROM magic bytes.\n");
  2876. --
  2877. -- *swap_needed = false;
  2878. - } else {
  2879. - *swap_needed = true;
  2880. - }
  2881. -- } else {
  2882. -+ } else if (magic != AR5416_EEPROM_MAGIC) {
  2883. -+ if (ath9k_hw_use_flash(ah))
  2884. -+ return 0;
  2885. -+
  2886. - ath_err(common,
  2887. - "Invalid EEPROM Magic (0x%04x).\n", magic);
  2888. - return -EINVAL;
  2889. 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
  2890. new file mode 100644
  2891. index 0000000..25929c9
  2892. --- /dev/null
  2893. +++ b/package/kernel/mac80211/patches/310-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch
  2894. @@ -0,0 +1,81 @@
  2895. +From: Chaitanya T K <chaitanya.mgit@gmail.com>
  2896. +Date: Mon, 27 Jun 2016 15:23:26 +0530
  2897. +Subject: [PATCH] mac80211: minstrel: Enable STBC and LDPC for VHT Rates
  2898. +
  2899. +If peer support reception of STBC and LDPC, enable them for better
  2900. +performance.
  2901. +
  2902. +Signed-off-by: Chaitanya TK <chaitanya.mgit@gmail.com>
  2903. +---
  2904. +
  2905. +--- a/include/linux/ieee80211.h
  2906. ++++ b/include/linux/ieee80211.h
  2907. +@@ -1550,6 +1550,7 @@ struct ieee80211_vht_operation {
  2908. + #define IEEE80211_VHT_CAP_RXSTBC_3 0x00000300
  2909. + #define IEEE80211_VHT_CAP_RXSTBC_4 0x00000400
  2910. + #define IEEE80211_VHT_CAP_RXSTBC_MASK 0x00000700
  2911. ++#define IEEE80211_VHT_CAP_RXSTBC_SHIFT 8
  2912. + #define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800
  2913. + #define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000
  2914. + #define IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT 13
  2915. +--- a/net/mac80211/rc80211_minstrel_ht.c
  2916. ++++ b/net/mac80211/rc80211_minstrel_ht.c
  2917. +@@ -1166,13 +1166,14 @@ minstrel_ht_update_caps(void *priv, stru
  2918. + struct minstrel_ht_sta_priv *msp = priv_sta;
  2919. + struct minstrel_ht_sta *mi = &msp->ht;
  2920. + struct ieee80211_mcs_info *mcs = &sta->ht_cap.mcs;
  2921. +- u16 sta_cap = sta->ht_cap.cap;
  2922. ++ u16 ht_cap = sta->ht_cap.cap;
  2923. + struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap;
  2924. + int use_vht;
  2925. + int n_supported = 0;
  2926. + int ack_dur;
  2927. + int stbc;
  2928. + int i;
  2929. ++ bool ldpc = false;
  2930. +
  2931. + /* fall back to the old minstrel for legacy stations */
  2932. + if (!sta->ht_cap.ht_supported)
  2933. +@@ -1210,16 +1211,24 @@ minstrel_ht_update_caps(void *priv, stru
  2934. + }
  2935. + mi->sample_tries = 4;
  2936. +
  2937. +- /* TODO tx_flags for vht - ATM the RC API is not fine-grained enough */
  2938. + if (!use_vht) {
  2939. +- stbc = (sta_cap & IEEE80211_HT_CAP_RX_STBC) >>
  2940. ++ stbc = (ht_cap & IEEE80211_HT_CAP_RX_STBC) >>
  2941. + IEEE80211_HT_CAP_RX_STBC_SHIFT;
  2942. +- mi->tx_flags |= stbc << IEEE80211_TX_CTL_STBC_SHIFT;
  2943. +
  2944. +- if (sta_cap & IEEE80211_HT_CAP_LDPC_CODING)
  2945. +- mi->tx_flags |= IEEE80211_TX_CTL_LDPC;
  2946. ++ if (ht_cap & IEEE80211_HT_CAP_LDPC_CODING)
  2947. ++ ldpc = true;
  2948. ++ } else {
  2949. ++ stbc = (vht_cap->cap & IEEE80211_VHT_CAP_RXSTBC_MASK) >>
  2950. ++ IEEE80211_VHT_CAP_RXSTBC_SHIFT;
  2951. ++
  2952. ++ if (vht_cap->cap & IEEE80211_VHT_CAP_RXLDPC)
  2953. ++ ldpc = true;
  2954. + }
  2955. +
  2956. ++ mi->tx_flags |= stbc << IEEE80211_TX_CTL_STBC_SHIFT;
  2957. ++ if (ldpc)
  2958. ++ mi->tx_flags |= IEEE80211_TX_CTL_LDPC;
  2959. ++
  2960. + for (i = 0; i < ARRAY_SIZE(mi->groups); i++) {
  2961. + u32 gflags = minstrel_mcs_groups[i].flags;
  2962. + int bw, nss;
  2963. +@@ -1232,10 +1241,10 @@ minstrel_ht_update_caps(void *priv, stru
  2964. +
  2965. + if (gflags & IEEE80211_TX_RC_SHORT_GI) {
  2966. + if (gflags & IEEE80211_TX_RC_40_MHZ_WIDTH) {
  2967. +- if (!(sta_cap & IEEE80211_HT_CAP_SGI_40))
  2968. ++ if (!(ht_cap & IEEE80211_HT_CAP_SGI_40))
  2969. + continue;
  2970. + } else {
  2971. +- if (!(sta_cap & IEEE80211_HT_CAP_SGI_20))
  2972. ++ if (!(ht_cap & IEEE80211_HT_CAP_SGI_20))
  2973. + continue;
  2974. + }
  2975. + }
  2976. 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
  2977. new file mode 100644
  2978. index 0000000..4cf26a6
  2979. --- /dev/null
  2980. +++ b/package/kernel/mac80211/patches/311-ath10k-disable-wake_tx_queue-for-older-devices.patch
  2981. @@ -0,0 +1,73 @@
  2982. +From: Michal Kazior <michal.kazior@tieto.com>
  2983. +Date: Tue, 17 May 2016 14:47:01 +0200
  2984. +Subject: [PATCH] ath10k: disable wake_tx_queue for older devices
  2985. +
  2986. +Some setups suffer performance regressions with
  2987. +current wake_tx_queue implementation.
  2988. +
  2989. +Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
  2990. +---
  2991. +
  2992. +--- a/drivers/net/wireless/ath/ath10k/core.h
  2993. ++++ b/drivers/net/wireless/ath/ath10k/core.h
  2994. +@@ -667,6 +667,7 @@ struct ath10k_fw_components {
  2995. + struct ath10k {
  2996. + struct ath_common ath_common;
  2997. + struct ieee80211_hw *hw;
  2998. ++ struct ieee80211_ops *ops;
  2999. + struct device *dev;
  3000. + u8 mac_addr[ETH_ALEN];
  3001. +
  3002. +--- a/drivers/net/wireless/ath/ath10k/mac.c
  3003. ++++ b/drivers/net/wireless/ath/ath10k/mac.c
  3004. +@@ -7497,21 +7497,32 @@ static const struct ieee80211_channel at
  3005. + struct ath10k *ath10k_mac_create(size_t priv_size)
  3006. + {
  3007. + struct ieee80211_hw *hw;
  3008. ++ struct ieee80211_ops *ops;
  3009. + struct ath10k *ar;
  3010. +
  3011. +- hw = ieee80211_alloc_hw(sizeof(struct ath10k) + priv_size, &ath10k_ops);
  3012. +- if (!hw)
  3013. ++ ops = kmemdup(&ath10k_ops, sizeof(ath10k_ops), GFP_KERNEL);
  3014. ++ if (!ops)
  3015. ++ return NULL;
  3016. ++
  3017. ++ hw = ieee80211_alloc_hw(sizeof(struct ath10k) + priv_size, ops);
  3018. ++ if (!hw) {
  3019. ++ kfree(ops);
  3020. + return NULL;
  3021. ++ }
  3022. +
  3023. + ar = hw->priv;
  3024. + ar->hw = hw;
  3025. ++ ar->ops = ops;
  3026. +
  3027. + return ar;
  3028. + }
  3029. +
  3030. + void ath10k_mac_destroy(struct ath10k *ar)
  3031. + {
  3032. ++ struct ieee80211_ops *ops = ar->ops;
  3033. ++
  3034. + ieee80211_free_hw(ar->hw);
  3035. ++ kfree(ops);
  3036. + }
  3037. +
  3038. + static const struct ieee80211_iface_limit ath10k_if_limits[] = {
  3039. +@@ -7945,6 +7956,15 @@ int ath10k_mac_register(struct ath10k *a
  3040. + ath10k_warn(ar, "failed to initialise DFS pattern detector\n");
  3041. + }
  3042. +
  3043. ++ /* Current wake_tx_queue implementation imposes a significant
  3044. ++ * performance penalty in some setups. The tx scheduling code needs
  3045. ++ * more work anyway so disable the wake_tx_queue unless firmware
  3046. ++ * supports the pull-push mechanism.
  3047. ++ */
  3048. ++ if (!test_bit(ATH10K_FW_FEATURE_PEER_FLOW_CONTROL,
  3049. ++ ar->running_fw->fw_file.fw_features))
  3050. ++ ar->ops->wake_tx_queue = NULL;
  3051. ++
  3052. + ret = ath_regd_init(&ar->ath_common.regulatory, ar->hw->wiphy,
  3053. + ath10k_reg_notifier);
  3054. + if (ret) {
  3055. 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
  3056. deleted file mode 100644
  3057. index 070efa9..0000000
  3058. --- a/package/kernel/mac80211/patches/311-ath9k-do-not-limit-the-number-of-DFS-interfaces-to-1.patch
  3059. +++ /dev/null
  3060. @@ -1,55 +0,0 @@
  3061. -From: Felix Fietkau <nbd@openwrt.org>
  3062. -Date: Fri, 22 Jan 2016 01:05:56 +0100
  3063. -Subject: [PATCH] ath9k: do not limit the number of DFS interfaces to 1
  3064. -
  3065. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  3066. ----
  3067. -
  3068. ---- a/drivers/net/wireless/ath/ath9k/init.c
  3069. -+++ b/drivers/net/wireless/ath/ath9k/init.c
  3070. -@@ -751,14 +751,6 @@ static const struct ieee80211_iface_comb
  3071. -
  3072. - #endif /* CPTCFG_ATH9K_CHANNEL_CONTEXT */
  3073. -
  3074. --static const struct ieee80211_iface_limit if_dfs_limits[] = {
  3075. -- { .max = 1, .types = BIT(NL80211_IFTYPE_AP) |
  3076. --#ifdef CPTCFG_MAC80211_MESH
  3077. -- BIT(NL80211_IFTYPE_MESH_POINT) |
  3078. --#endif
  3079. -- BIT(NL80211_IFTYPE_ADHOC) },
  3080. --};
  3081. --
  3082. - static const struct ieee80211_iface_combination if_comb[] = {
  3083. - {
  3084. - .limits = if_limits,
  3085. -@@ -766,6 +758,11 @@ static const struct ieee80211_iface_comb
  3086. - .max_interfaces = 2048,
  3087. - .num_different_channels = 1,
  3088. - .beacon_int_infra_match = true,
  3089. -+#ifdef CPTCFG_ATH9K_DFS_CERTIFIED
  3090. -+ .radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) |
  3091. -+ BIT(NL80211_CHAN_WIDTH_20) |
  3092. -+ BIT(NL80211_CHAN_WIDTH_40),
  3093. -+#endif
  3094. - },
  3095. - {
  3096. - .limits = wds_limits,
  3097. -@@ -774,18 +771,6 @@ static const struct ieee80211_iface_comb
  3098. - .num_different_channels = 1,
  3099. - .beacon_int_infra_match = true,
  3100. - },
  3101. --#ifdef CPTCFG_ATH9K_DFS_CERTIFIED
  3102. -- {
  3103. -- .limits = if_dfs_limits,
  3104. -- .n_limits = ARRAY_SIZE(if_dfs_limits),
  3105. -- .max_interfaces = 1,
  3106. -- .num_different_channels = 1,
  3107. -- .beacon_int_infra_match = true,
  3108. -- .radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) |
  3109. -- BIT(NL80211_CHAN_WIDTH_20) |
  3110. -- BIT(NL80211_CHAN_WIDTH_40),
  3111. -- }
  3112. --#endif
  3113. - };
  3114. -
  3115. - #ifdef CPTCFG_ATH9K_CHANNEL_CONTEXT
  3116. 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
  3117. new file mode 100644
  3118. index 0000000..df43105
  3119. --- /dev/null
  3120. +++ b/package/kernel/mac80211/patches/312-ath9k-Correct-TSF-adjustment-to-align-the-beacon-tim.patch
  3121. @@ -0,0 +1,45 @@
  3122. +From: Benjamin Berg <benjamin.berg@open-mesh.com>
  3123. +Date: Mon, 4 Jul 2016 14:37:20 +0200
  3124. +Subject: [PATCH] ath9k: Correct TSF adjustment to align the beacon time
  3125. + correctly
  3126. +
  3127. +Beacons were not send out at (timestamp % beacon_time == 0) for interfaces
  3128. +other than the primary one. To send out beacons with the correct timestamp
  3129. +according to 10.1.3.2 of the 802.11 standard the tsf_adjustment has to be
  3130. +set to the negative time difference instead of positive. This way the
  3131. +later beacons get corrected to have a lower (and similar) timestamp with
  3132. +regard to the beacon from slot 0.
  3133. +
  3134. +I am not aware about any issues that have been caused by this.
  3135. +
  3136. +Signed-off-by: Benjamin Berg <benjamin.berg@open-mesh.com>
  3137. +---
  3138. +
  3139. +--- a/drivers/net/wireless/ath/ath9k/beacon.c
  3140. ++++ b/drivers/net/wireless/ath/ath9k/beacon.c
  3141. +@@ -279,17 +279,21 @@ static void ath9k_set_tsfadjust(struct a
  3142. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  3143. + struct ath_vif *avp = (void *)vif->drv_priv;
  3144. + struct ath_beacon_config *cur_conf = &avp->chanctx->beacon;
  3145. +- u32 tsfadjust;
  3146. ++ s64 tsfadjust;
  3147. +
  3148. + if (avp->av_bslot == 0)
  3149. + return;
  3150. +
  3151. ++ /* tsf_adjust is added to the TSF value. We send out the beacon late,
  3152. ++ * so need to adjust the TSF starting point to be later in time (i.e.
  3153. ++ * the theoretical first beacon has a TSF of 0 after correction).
  3154. ++ */
  3155. + tsfadjust = cur_conf->beacon_interval * avp->av_bslot;
  3156. +- tsfadjust = TU_TO_USEC(tsfadjust) / ATH_BCBUF;
  3157. ++ tsfadjust = -TU_TO_USEC(tsfadjust) / ATH_BCBUF;
  3158. + avp->tsf_adjust = cpu_to_le64(tsfadjust);
  3159. +
  3160. +- ath_dbg(common, CONFIG, "tsfadjust is: %llu for bslot: %d\n",
  3161. +- (unsigned long long)tsfadjust, avp->av_bslot);
  3162. ++ ath_dbg(common, CONFIG, "tsfadjust is: %lld for bslot: %d\n",
  3163. ++ (signed long long)tsfadjust, avp->av_bslot);
  3164. + }
  3165. +
  3166. + bool ath9k_csa_is_finished(struct ath_softc *sc, struct ieee80211_vif *vif)
  3167. 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
  3168. deleted file mode 100644
  3169. index 61cafc7..0000000
  3170. --- a/package/kernel/mac80211/patches/312-mac80211-fix-txq-queue-related-crashes.patch
  3171. +++ /dev/null
  3172. @@ -1,27 +0,0 @@
  3173. -From: Michal Kazior <michal.kazior@tieto.com>
  3174. -Date: Thu, 21 Jan 2016 14:23:07 +0100
  3175. -Subject: [PATCH] mac80211: fix txq queue related crashes
  3176. -
  3177. -The driver can access the queue simultanously
  3178. -while mac80211 tears down the interface. Without
  3179. -spinlock protection this could lead to corrupting
  3180. -sk_buff_head and subsequently to an invalid
  3181. -pointer dereference.
  3182. -
  3183. -Fixes: ba8c3d6f16a1 ("mac80211: add an intermediate software queue implementation")
  3184. -Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
  3185. ----
  3186. -
  3187. ---- a/net/mac80211/iface.c
  3188. -+++ b/net/mac80211/iface.c
  3189. -@@ -977,7 +977,10 @@ static void ieee80211_do_stop(struct iee
  3190. - if (sdata->vif.txq) {
  3191. - struct txq_info *txqi = to_txq_info(sdata->vif.txq);
  3192. -
  3193. -+ spin_lock_bh(&txqi->queue.lock);
  3194. - ieee80211_purge_tx_queue(&local->hw, &txqi->queue);
  3195. -+ spin_unlock_bh(&txqi->queue.lock);
  3196. -+
  3197. - atomic_set(&sdata->txqs_len[txqi->txq.ac], 0);
  3198. - }
  3199. -
  3200. 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
  3201. new file mode 100644
  3202. index 0000000..ef0afbe
  3203. --- /dev/null
  3204. +++ b/package/kernel/mac80211/patches/313-ath9k-Handle-channel-context-in-get_-set_-reset_tsf.patch
  3205. @@ -0,0 +1,70 @@
  3206. +From: Benjamin Berg <benjamin.berg@open-mesh.com>
  3207. +Date: Mon, 4 Jul 2016 14:37:21 +0200
  3208. +Subject: [PATCH] ath9k: Handle channel context in get_/set_/reset_tsf
  3209. +
  3210. +The ath9k TSF handling routines need to be aware of the channel context that
  3211. +is being modified. With this change the TSF related values that are stored
  3212. +in each channel context will be correctly tracked and the harware will only
  3213. +be updated if the modified context is currently the active one.
  3214. +
  3215. +Without this change the TSF modifications done using these routines would
  3216. +for example be lost during a hardware reset as done by ath_complete_reset.
  3217. +
  3218. +Signed-off-by: Benjamin Berg <benjamin.berg@open-mesh.com>
  3219. +---
  3220. +
  3221. +--- a/drivers/net/wireless/ath/ath9k/main.c
  3222. ++++ b/drivers/net/wireless/ath/ath9k/main.c
  3223. +@@ -1823,11 +1823,18 @@ static void ath9k_bss_info_changed(struc
  3224. + static u64 ath9k_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
  3225. + {
  3226. + struct ath_softc *sc = hw->priv;
  3227. ++ struct ath_vif *avp = (void *)vif->drv_priv;
  3228. + u64 tsf;
  3229. +
  3230. + mutex_lock(&sc->mutex);
  3231. + ath9k_ps_wakeup(sc);
  3232. +- tsf = ath9k_hw_gettsf64(sc->sc_ah);
  3233. ++ /* Get current TSF either from HW or kernel time. */
  3234. ++ if (sc->cur_chan == avp->chanctx) {
  3235. ++ tsf = ath9k_hw_gettsf64(sc->sc_ah);
  3236. ++ } else {
  3237. ++ tsf = sc->cur_chan->tsf_val +
  3238. ++ ath9k_hw_get_tsf_offset(&sc->cur_chan->tsf_ts, NULL);
  3239. ++ }
  3240. + ath9k_ps_restore(sc);
  3241. + mutex_unlock(&sc->mutex);
  3242. +
  3243. +@@ -1839,10 +1846,14 @@ static void ath9k_set_tsf(struct ieee802
  3244. + u64 tsf)
  3245. + {
  3246. + struct ath_softc *sc = hw->priv;
  3247. ++ struct ath_vif *avp = (void *)vif->drv_priv;
  3248. +
  3249. + mutex_lock(&sc->mutex);
  3250. + ath9k_ps_wakeup(sc);
  3251. +- ath9k_hw_settsf64(sc->sc_ah, tsf);
  3252. ++ getrawmonotonic(&avp->chanctx->tsf_ts);
  3253. ++ if (sc->cur_chan == avp->chanctx)
  3254. ++ ath9k_hw_settsf64(sc->sc_ah, tsf);
  3255. ++ avp->chanctx->tsf_val = tsf;
  3256. + ath9k_ps_restore(sc);
  3257. + mutex_unlock(&sc->mutex);
  3258. + }
  3259. +@@ -1850,11 +1861,15 @@ static void ath9k_set_tsf(struct ieee802
  3260. + static void ath9k_reset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
  3261. + {
  3262. + struct ath_softc *sc = hw->priv;
  3263. ++ struct ath_vif *avp = (void *)vif->drv_priv;
  3264. +
  3265. + mutex_lock(&sc->mutex);
  3266. +
  3267. + ath9k_ps_wakeup(sc);
  3268. +- ath9k_hw_reset_tsf(sc->sc_ah);
  3269. ++ getrawmonotonic(&avp->chanctx->tsf_ts);
  3270. ++ if (sc->cur_chan == avp->chanctx)
  3271. ++ ath9k_hw_reset_tsf(sc->sc_ah);
  3272. ++ avp->chanctx->tsf_val = 0;
  3273. + ath9k_ps_restore(sc);
  3274. +
  3275. + mutex_unlock(&sc->mutex);
  3276. 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
  3277. deleted file mode 100644
  3278. index 844d43b..0000000
  3279. --- a/package/kernel/mac80211/patches/313-mac80211-fix-unnecessary-frame-drops-in-mesh-fwding.patch
  3280. +++ /dev/null
  3281. @@ -1,57 +0,0 @@
  3282. -From: Michal Kazior <michal.kazior@tieto.com>
  3283. -Date: Mon, 25 Jan 2016 14:43:24 +0100
  3284. -Subject: [PATCH] mac80211: fix unnecessary frame drops in mesh fwding
  3285. -
  3286. -The ieee80211_queue_stopped() expects hw queue
  3287. -number but it was given raw WMM AC number instead.
  3288. -
  3289. -This could cause frame drops and problems with
  3290. -traffic in some cases - most notably if driver
  3291. -doesn't map AC numbers to queue numbers 1:1 and
  3292. -uses ieee80211_stop_queues() and
  3293. -ieee80211_wake_queue() only without ever calling
  3294. -ieee80211_wake_queues().
  3295. -
  3296. -On ath10k it was possible to hit this problem in
  3297. -the following case:
  3298. -
  3299. - 1. wlan0 uses queue 0
  3300. - (ath10k maps queues per vif)
  3301. - 2. offchannel uses queue 15
  3302. - 3. queues 1-14 are unused
  3303. - 4. ieee80211_stop_queues()
  3304. - 5. ieee80211_wake_queue(q=0)
  3305. - 6. ieee80211_wake_queue(q=15)
  3306. - (other queues are not woken up because both
  3307. - driver and mac80211 know other queues are
  3308. - unused)
  3309. - 7. ieee80211_rx_h_mesh_fwding()
  3310. - 8. ieee80211_select_queue_80211() returns 2
  3311. - 9. ieee80211_queue_stopped(q=2) returns true
  3312. - 10. frame is dropped (oops!)
  3313. -
  3314. -Fixes: d3c1597b8d1b ("mac80211: fix forwarded mesh frame queue mapping")
  3315. -Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
  3316. ----
  3317. -
  3318. ---- a/net/mac80211/rx.c
  3319. -+++ b/net/mac80211/rx.c
  3320. -@@ -2235,7 +2235,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
  3321. - struct ieee80211_local *local = rx->local;
  3322. - struct ieee80211_sub_if_data *sdata = rx->sdata;
  3323. - struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
  3324. -- u16 q, hdrlen;
  3325. -+ u16 ac, q, hdrlen;
  3326. -
  3327. - hdr = (struct ieee80211_hdr *) skb->data;
  3328. - hdrlen = ieee80211_hdrlen(hdr->frame_control);
  3329. -@@ -2304,7 +2304,8 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
  3330. - ether_addr_equal(sdata->vif.addr, hdr->addr3))
  3331. - return RX_CONTINUE;
  3332. -
  3333. -- q = ieee80211_select_queue_80211(sdata, skb, hdr);
  3334. -+ ac = ieee80211_select_queue_80211(sdata, skb, hdr);
  3335. -+ q = sdata->vif.hw_queue[ac];
  3336. - if (ieee80211_queue_stopped(&local->hw, q)) {
  3337. - IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_congestion);
  3338. - return RX_DROP_MONITOR;
  3339. 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
  3340. new file mode 100644
  3341. index 0000000..e725a8b
  3342. --- /dev/null
  3343. +++ b/package/kernel/mac80211/patches/314-ath9k-Use-tsf-offset-helper-in-ath9k_hw_reset.patch
  3344. @@ -0,0 +1,65 @@
  3345. +From: Benjamin Berg <benjamin.berg@open-mesh.com>
  3346. +Date: Mon, 4 Jul 2016 14:37:22 +0200
  3347. +Subject: [PATCH] ath9k: Use tsf offset helper in ath9k_hw_reset
  3348. +
  3349. +These changes make ath9k_hw_reset more consistent with other places that
  3350. +handle the TSF value by using the same helper routine.
  3351. +
  3352. +A slight improvement is to not assume that a fixed time of 1.5ms has
  3353. +passed for the initval writes when compared to the first write attempt.
  3354. +Instead the TSF value is re-calculated which will yield a higher accuracy
  3355. +of the restored TSF timer.
  3356. +
  3357. +Signed-off-by: Benjamin Berg <benjamin.berg@open-mesh.com>
  3358. +---
  3359. +
  3360. +--- a/drivers/net/wireless/ath/ath9k/hw.c
  3361. ++++ b/drivers/net/wireless/ath/ath9k/hw.c
  3362. +@@ -1832,8 +1832,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  3363. + u32 saveLedState;
  3364. + u32 saveDefAntenna;
  3365. + u32 macStaId1;
  3366. ++ struct timespec tsf_ts;
  3367. ++ u32 tsf_offset;
  3368. + u64 tsf = 0;
  3369. +- s64 usec = 0;
  3370. + int r;
  3371. + bool start_mci_reset = false;
  3372. + bool save_fullsleep = ah->chip_fullsleep;
  3373. +@@ -1877,8 +1878,8 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  3374. + macStaId1 = REG_READ(ah, AR_STA_ID1) & AR_STA_ID1_BASE_RATE_11B;
  3375. +
  3376. + /* Save TSF before chip reset, a cold reset clears it */
  3377. ++ getrawmonotonic(&tsf_ts);
  3378. + tsf = ath9k_hw_gettsf64(ah);
  3379. +- usec = ktime_to_us(ktime_get_raw());
  3380. +
  3381. + saveLedState = REG_READ(ah, AR_CFG_LED) &
  3382. + (AR_CFG_LED_ASSOC_CTL | AR_CFG_LED_MODE_SEL |
  3383. +@@ -1911,8 +1912,8 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  3384. + }
  3385. +
  3386. + /* Restore TSF */
  3387. +- usec = ktime_to_us(ktime_get_raw()) - usec;
  3388. +- ath9k_hw_settsf64(ah, tsf + usec);
  3389. ++ tsf_offset = ath9k_hw_get_tsf_offset(&tsf_ts, NULL);
  3390. ++ ath9k_hw_settsf64(ah, tsf + tsf_offset);
  3391. +
  3392. + if (AR_SREV_9280_20_OR_LATER(ah))
  3393. + REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL, AR_GPIO_JTAG_DISABLE);
  3394. +@@ -1932,12 +1933,11 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  3395. + /*
  3396. + * Some AR91xx SoC devices frequently fail to accept TSF writes
  3397. + * right after the chip reset. When that happens, write a new
  3398. +- * value after the initvals have been applied, with an offset
  3399. +- * based on measured time difference
  3400. ++ * value after the initvals have been applied.
  3401. + */
  3402. + if (AR_SREV_9100(ah) && (ath9k_hw_gettsf64(ah) < tsf)) {
  3403. +- tsf += 1500;
  3404. +- ath9k_hw_settsf64(ah, tsf);
  3405. ++ tsf_offset = ath9k_hw_get_tsf_offset(&tsf_ts, NULL);
  3406. ++ ath9k_hw_settsf64(ah, tsf + tsf_offset);
  3407. + }
  3408. +
  3409. + ath9k_hw_init_mfp(ah);
  3410. 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
  3411. deleted file mode 100644
  3412. index 5b3efbd..0000000
  3413. --- a/package/kernel/mac80211/patches/314-mac80211-Requeue-work-after-scan-complete-for-all-VI.patch
  3414. +++ /dev/null
  3415. @@ -1,103 +0,0 @@
  3416. -From: Sachin Kulkarni <Sachin.Kulkarni@imgtec.com>
  3417. -Date: Tue, 12 Jan 2016 14:30:19 +0530
  3418. -Subject: [PATCH] mac80211: Requeue work after scan complete for all VIF
  3419. - types.
  3420. -
  3421. -During a sw scan ieee80211_iface_work ignores work items for all vifs.
  3422. -However after the scan complete work is requeued only for STA, ADHOC
  3423. -and MESH iftypes.
  3424. -
  3425. -This occasionally results in event processing getting delayed/not
  3426. -processed for iftype AP when it coexists with a STA. This can result
  3427. -in data halt and eventually disconnection on the AP interface.
  3428. -
  3429. -Signed-off-by: Sachin Kulkarni <Sachin.Kulkarni@imgtec.com>
  3430. -Cc: linux-wireless@vger.kernel.org
  3431. -Cc: johannes@sipsolutions.net
  3432. ----
  3433. -
  3434. ---- a/net/mac80211/ibss.c
  3435. -+++ b/net/mac80211/ibss.c
  3436. -@@ -1731,7 +1731,6 @@ void ieee80211_ibss_notify_scan_complete
  3437. - if (sdata->vif.type != NL80211_IFTYPE_ADHOC)
  3438. - continue;
  3439. - sdata->u.ibss.last_scan_completed = jiffies;
  3440. -- ieee80211_queue_work(&local->hw, &sdata->work);
  3441. - }
  3442. - mutex_unlock(&local->iflist_mtx);
  3443. - }
  3444. ---- a/net/mac80211/mesh.c
  3445. -+++ b/net/mac80211/mesh.c
  3446. -@@ -1369,17 +1369,6 @@ out:
  3447. - sdata_unlock(sdata);
  3448. - }
  3449. -
  3450. --void ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local)
  3451. --{
  3452. -- struct ieee80211_sub_if_data *sdata;
  3453. --
  3454. -- rcu_read_lock();
  3455. -- list_for_each_entry_rcu(sdata, &local->interfaces, list)
  3456. -- if (ieee80211_vif_is_mesh(&sdata->vif) &&
  3457. -- ieee80211_sdata_running(sdata))
  3458. -- ieee80211_queue_work(&local->hw, &sdata->work);
  3459. -- rcu_read_unlock();
  3460. --}
  3461. -
  3462. - void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata)
  3463. - {
  3464. ---- a/net/mac80211/mesh.h
  3465. -+++ b/net/mac80211/mesh.h
  3466. -@@ -362,14 +362,10 @@ static inline bool mesh_path_sel_is_hwmp
  3467. - return sdata->u.mesh.mesh_pp_id == IEEE80211_PATH_PROTOCOL_HWMP;
  3468. - }
  3469. -
  3470. --void ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local);
  3471. --
  3472. - void mesh_path_flush_by_iface(struct ieee80211_sub_if_data *sdata);
  3473. - void mesh_sync_adjust_tbtt(struct ieee80211_sub_if_data *sdata);
  3474. - void ieee80211s_stop(void);
  3475. - #else
  3476. --static inline void
  3477. --ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local) {}
  3478. - static inline bool mesh_path_sel_is_hwmp(struct ieee80211_sub_if_data *sdata)
  3479. - { return false; }
  3480. - static inline void mesh_path_flush_by_iface(struct ieee80211_sub_if_data *sdata)
  3481. ---- a/net/mac80211/mlme.c
  3482. -+++ b/net/mac80211/mlme.c
  3483. -@@ -3978,8 +3978,6 @@ static void ieee80211_restart_sta_timer(
  3484. - if (!ieee80211_hw_check(&sdata->local->hw, CONNECTION_MONITOR))
  3485. - ieee80211_queue_work(&sdata->local->hw,
  3486. - &sdata->u.mgd.monitor_work);
  3487. -- /* and do all the other regular work too */
  3488. -- ieee80211_queue_work(&sdata->local->hw, &sdata->work);
  3489. - }
  3490. - }
  3491. -
  3492. ---- a/net/mac80211/scan.c
  3493. -+++ b/net/mac80211/scan.c
  3494. -@@ -314,6 +314,7 @@ static void __ieee80211_scan_completed(s
  3495. - bool was_scanning = local->scanning;
  3496. - struct cfg80211_scan_request *scan_req;
  3497. - struct ieee80211_sub_if_data *scan_sdata;
  3498. -+ struct ieee80211_sub_if_data *sdata;
  3499. -
  3500. - lockdep_assert_held(&local->mtx);
  3501. -
  3502. -@@ -373,7 +374,15 @@ static void __ieee80211_scan_completed(s
  3503. -
  3504. - ieee80211_mlme_notify_scan_completed(local);
  3505. - ieee80211_ibss_notify_scan_completed(local);
  3506. -- ieee80211_mesh_notify_scan_completed(local);
  3507. -+
  3508. -+ /* Requeue all the work that might have been ignored while
  3509. -+ * the scan was in progress
  3510. -+ */
  3511. -+ list_for_each_entry_rcu(sdata, &local->interfaces, list) {
  3512. -+ if (ieee80211_sdata_running(sdata))
  3513. -+ ieee80211_queue_work(&sdata->local->hw, &sdata->work);
  3514. -+ }
  3515. -+
  3516. - if (was_scanning)
  3517. - ieee80211_start_next_roc(local);
  3518. - }
  3519. 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
  3520. new file mode 100644
  3521. index 0000000..c95ab7e
  3522. --- /dev/null
  3523. +++ b/package/kernel/mac80211/patches/315-ath9k-Expose-tsf_adjustment-in-mac80211-tsf-getters-.patch
  3524. @@ -0,0 +1,32 @@
  3525. +From: Benjamin Berg <benjamin.berg@open-mesh.com>
  3526. +Date: Mon, 4 Jul 2016 14:37:23 +0200
  3527. +Subject: [PATCH] ath9k: Expose tsf_adjustment in mac80211 tsf getters and
  3528. + setters.
  3529. +
  3530. +The ath9k driver modifies the TSF for VIFs for the purpose of sending
  3531. +beacons in a staggered fashion. This patch exposes this VIF specific
  3532. +adjustment of the TSF value to mac80211. Without the change the TSF
  3533. +routines handle the hardware TSF value instead of the actual TSF value as
  3534. +seen on the air.
  3535. +
  3536. +Signed-off-by: Benjamin Berg <benjamin.berg@open-mesh.com>
  3537. +---
  3538. +
  3539. +--- a/drivers/net/wireless/ath/ath9k/main.c
  3540. ++++ b/drivers/net/wireless/ath/ath9k/main.c
  3541. +@@ -1835,6 +1835,7 @@ static u64 ath9k_get_tsf(struct ieee8021
  3542. + tsf = sc->cur_chan->tsf_val +
  3543. + ath9k_hw_get_tsf_offset(&sc->cur_chan->tsf_ts, NULL);
  3544. + }
  3545. ++ tsf += le64_to_cpu(avp->tsf_adjust);
  3546. + ath9k_ps_restore(sc);
  3547. + mutex_unlock(&sc->mutex);
  3548. +
  3549. +@@ -1850,6 +1851,7 @@ static void ath9k_set_tsf(struct ieee802
  3550. +
  3551. + mutex_lock(&sc->mutex);
  3552. + ath9k_ps_wakeup(sc);
  3553. ++ tsf -= le64_to_cpu(avp->tsf_adjust);
  3554. + getrawmonotonic(&avp->chanctx->tsf_ts);
  3555. + if (sc->cur_chan == avp->chanctx)
  3556. + ath9k_hw_settsf64(sc->sc_ah, tsf);
  3557. 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
  3558. deleted file mode 100644
  3559. index 52fecb9..0000000
  3560. --- a/package/kernel/mac80211/patches/315-mac80211-fix-ibss-scan-parameters.patch
  3561. +++ /dev/null
  3562. @@ -1,57 +0,0 @@
  3563. -From: Sara Sharon <sara.sharon@intel.com>
  3564. -Date: Mon, 25 Jan 2016 15:46:35 +0200
  3565. -Subject: [PATCH] mac80211: fix ibss scan parameters
  3566. -
  3567. -When joining IBSS a full scan should be initiated in order to search
  3568. -for existing cell, unless the fixed_channel parameter was set.
  3569. -A default channel to create the IBSS on if no cell was found is
  3570. -provided as well.
  3571. -However - a scan is initiated only on the default channel provided
  3572. -regardless of whether ifibss->fixed_channel is set or not, with the
  3573. -obvious result of the cell not joining existing IBSS cell that is
  3574. -on another channel.
  3575. -
  3576. -Fixes: 76bed0f43b27 ("mac80211: IBSS fix scan request")
  3577. -Signed-off-by: Sara Sharon <sara.sharon@intel.com>
  3578. -Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
  3579. ----
  3580. -
  3581. ---- a/net/mac80211/ibss.c
  3582. -+++ b/net/mac80211/ibss.c
  3583. -@@ -7,6 +7,7 @@
  3584. - * Copyright 2007, Michael Wu <flamingice@sourmilk.net>
  3585. - * Copyright 2009, Johannes Berg <johannes@sipsolutions.net>
  3586. - * Copyright 2013-2014 Intel Mobile Communications GmbH
  3587. -+ * Copyright(c) 2016 Intel Deutschland GmbH
  3588. - *
  3589. - * This program is free software; you can redistribute it and/or modify
  3590. - * it under the terms of the GNU General Public License version 2 as
  3591. -@@ -1483,14 +1484,21 @@ static void ieee80211_sta_find_ibss(stru
  3592. -
  3593. - sdata_info(sdata, "Trigger new scan to find an IBSS to join\n");
  3594. -
  3595. -- num = ieee80211_ibss_setup_scan_channels(local->hw.wiphy,
  3596. -- &ifibss->chandef,
  3597. -- channels,
  3598. -- ARRAY_SIZE(channels));
  3599. - scan_width = cfg80211_chandef_to_scan_width(&ifibss->chandef);
  3600. -- ieee80211_request_ibss_scan(sdata, ifibss->ssid,
  3601. -- ifibss->ssid_len, channels, num,
  3602. -- scan_width);
  3603. -+
  3604. -+ if (ifibss->fixed_channel) {
  3605. -+ num = ieee80211_ibss_setup_scan_channels(local->hw.wiphy,
  3606. -+ &ifibss->chandef,
  3607. -+ channels,
  3608. -+ ARRAY_SIZE(channels));
  3609. -+ ieee80211_request_ibss_scan(sdata, ifibss->ssid,
  3610. -+ ifibss->ssid_len, channels,
  3611. -+ num, scan_width);
  3612. -+ } else {
  3613. -+ ieee80211_request_ibss_scan(sdata, ifibss->ssid,
  3614. -+ ifibss->ssid_len, NULL,
  3615. -+ 0, scan_width);
  3616. -+ }
  3617. - } else {
  3618. - int interval = IEEE80211_SCAN_INTERVAL;
  3619. -
  3620. 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
  3621. new file mode 100644
  3622. index 0000000..36aaa10
  3623. --- /dev/null
  3624. +++ b/package/kernel/mac80211/patches/316-ath9k-Remove-some-defined-constants-to-decrease-verb.patch
  3625. @@ -0,0 +1,137 @@
  3626. +From: Benjamin Berg <benjamin.berg@open-mesh.com>
  3627. +Date: Mon, 4 Jul 2016 14:37:24 +0200
  3628. +Subject: [PATCH] ath9k: Remove some #defined constants to decrease
  3629. + verbosity
  3630. +
  3631. +The removed ATH9K_SLOT_TIME_X constants simply map the value in microseconds
  3632. +to the same integer. These constants were not used consistently, so fix the
  3633. +inconsistency issue by replacing all occurances with the integer equivalent.
  3634. +
  3635. +Signed-off-by: Benjamin Berg <benjamin.berg@open-mesh.com>
  3636. +---
  3637. +
  3638. +--- a/drivers/net/wireless/ath/ath9k/beacon.c
  3639. ++++ b/drivers/net/wireless/ath/ath9k/beacon.c
  3640. +@@ -50,7 +50,7 @@ static void ath9k_beaconq_config(struct
  3641. + txq = sc->tx.txq_map[IEEE80211_AC_BE];
  3642. + ath9k_hw_get_txq_props(ah, txq->axq_qnum, &qi_be);
  3643. + qi.tqi_aifs = qi_be.tqi_aifs;
  3644. +- if (ah->slottime == ATH9K_SLOT_TIME_20)
  3645. ++ if (ah->slottime == 20)
  3646. + qi.tqi_cwmin = 2*qi_be.tqi_cwmin;
  3647. + else
  3648. + qi.tqi_cwmin = 4*qi_be.tqi_cwmin;
  3649. +--- a/drivers/net/wireless/ath/ath9k/dynack.c
  3650. ++++ b/drivers/net/wireless/ath/ath9k/dynack.c
  3651. +@@ -280,7 +280,7 @@ EXPORT_SYMBOL(ath_dynack_sample_ack_ts);
  3652. + void ath_dynack_node_init(struct ath_hw *ah, struct ath_node *an)
  3653. + {
  3654. + /* ackto = slottime + sifs + air delay */
  3655. +- u32 ackto = ATH9K_SLOT_TIME_9 + 16 + 64;
  3656. ++ u32 ackto = 9 + 16 + 64;
  3657. + struct ath_dynack *da = &ah->dynack;
  3658. +
  3659. + an->ackto = ackto;
  3660. +@@ -315,7 +315,7 @@ EXPORT_SYMBOL(ath_dynack_node_deinit);
  3661. + void ath_dynack_reset(struct ath_hw *ah)
  3662. + {
  3663. + /* ackto = slottime + sifs + air delay */
  3664. +- u32 ackto = ATH9K_SLOT_TIME_9 + 16 + 64;
  3665. ++ u32 ackto = 9 + 16 + 64;
  3666. + struct ath_dynack *da = &ah->dynack;
  3667. +
  3668. + da->lto = jiffies;
  3669. +--- a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
  3670. ++++ b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
  3671. +@@ -45,7 +45,7 @@ void ath9k_htc_beaconq_config(struct ath
  3672. + * Long slot time : 2x cwmin
  3673. + * Short slot time : 4x cwmin
  3674. + */
  3675. +- if (ah->slottime == ATH9K_SLOT_TIME_20)
  3676. ++ if (ah->slottime == 20)
  3677. + qi.tqi_cwmin = 2*qi_be.tqi_cwmin;
  3678. + else
  3679. + qi.tqi_cwmin = 4*qi_be.tqi_cwmin;
  3680. +--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
  3681. ++++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
  3682. +@@ -678,7 +678,7 @@ static int ath9k_init_priv(struct ath9k_
  3683. +
  3684. + for (i = 0; i < ATH9K_HTC_MAX_BCN_VIF; i++)
  3685. + priv->beacon.bslot[i] = NULL;
  3686. +- priv->beacon.slottime = ATH9K_SLOT_TIME_9;
  3687. ++ priv->beacon.slottime = 9;
  3688. +
  3689. + ath9k_cmn_init_channels_rates(common);
  3690. + ath9k_cmn_init_crypto(ah);
  3691. +--- a/drivers/net/wireless/ath/ath9k/hw.c
  3692. ++++ b/drivers/net/wireless/ath/ath9k/hw.c
  3693. +@@ -454,7 +454,7 @@ static void ath9k_hw_init_defaults(struc
  3694. + if (AR_SREV_9100(ah))
  3695. + ah->sta_id1_defaults |= AR_STA_ID1_AR9100_BA_FIX;
  3696. +
  3697. +- ah->slottime = ATH9K_SLOT_TIME_9;
  3698. ++ ah->slottime = 9;
  3699. + ah->globaltxtimeout = (u32) -1;
  3700. + ah->power_mode = ATH9K_PM_UNDEFINED;
  3701. + ah->htc_reset_init = true;
  3702. +--- a/drivers/net/wireless/ath/ath9k/init.c
  3703. ++++ b/drivers/net/wireless/ath/ath9k/init.c
  3704. +@@ -372,7 +372,7 @@ static void ath9k_init_misc(struct ath_s
  3705. +
  3706. + common->last_rssi = ATH_RSSI_DUMMY_MARKER;
  3707. + memcpy(common->bssidmask, ath_bcast_mac, ETH_ALEN);
  3708. +- sc->beacon.slottime = ATH9K_SLOT_TIME_9;
  3709. ++ sc->beacon.slottime = 9;
  3710. +
  3711. + for (i = 0; i < ARRAY_SIZE(sc->beacon.bslot); i++)
  3712. + sc->beacon.bslot[i] = NULL;
  3713. +--- a/drivers/net/wireless/ath/ath9k/mac.h
  3714. ++++ b/drivers/net/wireless/ath/ath9k/mac.h
  3715. +@@ -65,10 +65,6 @@
  3716. + #define INIT_SSH_RETRY 32
  3717. + #define INIT_SLG_RETRY 32
  3718. +
  3719. +-#define ATH9K_SLOT_TIME_6 6
  3720. +-#define ATH9K_SLOT_TIME_9 9
  3721. +-#define ATH9K_SLOT_TIME_20 20
  3722. +-
  3723. + #define ATH9K_TXERR_XRETRY 0x01
  3724. + #define ATH9K_TXERR_FILT 0x02
  3725. + #define ATH9K_TXERR_FIFO 0x04
  3726. +--- a/drivers/net/wireless/ath/ath9k/main.c
  3727. ++++ b/drivers/net/wireless/ath/ath9k/main.c
  3728. +@@ -926,7 +926,7 @@ static void ath9k_vif_iter(struct ath9k_
  3729. + }
  3730. +
  3731. + if (!vif->bss_conf.use_short_slot)
  3732. +- iter_data->slottime = ATH9K_SLOT_TIME_20;
  3733. ++ iter_data->slottime = 20;
  3734. +
  3735. + switch (vif->type) {
  3736. + case NL80211_IFTYPE_AP:
  3737. +@@ -999,7 +999,7 @@ void ath9k_calculate_iter_data(struct at
  3738. + */
  3739. + memset(iter_data, 0, sizeof(*iter_data));
  3740. + eth_broadcast_addr(iter_data->mask);
  3741. +- iter_data->slottime = ATH9K_SLOT_TIME_9;
  3742. ++ iter_data->slottime = 9;
  3743. +
  3744. + list_for_each_entry(avp, &ctx->vifs, list)
  3745. + ath9k_vif_iter(iter_data, avp->vif->addr, avp->vif);
  3746. +@@ -1061,7 +1061,7 @@ static void ath9k_set_offchannel_state(s
  3747. + ah->opmode = vif->type;
  3748. + ah->imask &= ~ATH9K_INT_SWBA;
  3749. + ah->imask &= ~ATH9K_INT_TSFOOR;
  3750. +- ah->slottime = ATH9K_SLOT_TIME_9;
  3751. ++ ah->slottime = 9;
  3752. +
  3753. + ath_hw_setbssidmask(common);
  3754. + ath9k_hw_setopmode(ah);
  3755. +@@ -1788,6 +1788,7 @@ static void ath9k_bss_info_changed(struc
  3756. + slottime = 9;
  3757. + else
  3758. + slottime = 20;
  3759. ++
  3760. + if (vif->type == NL80211_IFTYPE_AP) {
  3761. + /*
  3762. + * Defer update, so that connected stations can adjust
  3763. 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
  3764. deleted file mode 100644
  3765. index e78df36..0000000
  3766. --- a/package/kernel/mac80211/patches/316-net-mac80211-agg-rx.c-fix-use-of-uninitialised-value.patch
  3767. +++ /dev/null
  3768. @@ -1,50 +0,0 @@
  3769. -From: Chris Bainbridge <chris.bainbridge@gmail.com>
  3770. -Date: Wed, 27 Jan 2016 15:46:18 +0000
  3771. -Subject: [PATCH] net/mac80211/agg-rx.c: fix use of uninitialised values
  3772. -
  3773. -Use kzalloc instead of kmalloc for struct tid_ampdu_rx. Fixes:
  3774. -
  3775. -[ 7.976605] UBSAN: Undefined behaviour in net/mac80211/rx.c:932:29
  3776. -[ 7.976608] load of value 2 is not a valid value for type '_Bool'
  3777. -[ 7.976611] CPU: 3 PID: 1134 Comm: kworker/u16:7 Not tainted 4.5.0-rc1+ #265
  3778. -[ 7.976613] Hardware name: Apple Inc. MacBookPro10,2/Mac-AFD8A9D944EA4843, BIOS MBP102.88Z.0106.B0A.1509130955 09/13/2015
  3779. -[ 7.976616] Workqueue: phy0 rt2x00usb_work_rxdone
  3780. -[ 7.976619] 0000000000000004 ffff880254a7ba50 ffffffff8181d866 0000000000000007
  3781. -[ 7.976622] ffff880254a7ba78 ffff880254a7ba68 ffffffff8188422d ffffffff8379b500
  3782. -[ 7.976626] ffff880254a7bab8 ffffffff81884747 0000000000000202 0000000348620032
  3783. -[ 7.976629] Call Trace:
  3784. -[ 7.976633] [<ffffffff8181d866>] dump_stack+0x45/0x5f
  3785. -[ 7.976637] [<ffffffff8188422d>] ubsan_epilogue+0xd/0x40
  3786. -[ 7.976642] [<ffffffff81884747>] __ubsan_handle_load_invalid_value+0x67/0x70
  3787. -[ 7.976646] [<ffffffff82227b4d>] ieee80211_sta_reorder_release.isra.16+0x5ed/0x730
  3788. -[ 7.976650] [<ffffffff8222ca14>] ieee80211_prepare_and_rx_handle+0xd04/0x1c00
  3789. -[ 7.976654] [<ffffffff81cb27ce>] ? usb_hcd_map_urb_for_dma+0x65e/0x960
  3790. -[ 7.976659] [<ffffffff8222db03>] __ieee80211_rx_handle_packet+0x1f3/0x750
  3791. -[ 7.976663] [<ffffffff8222e4a7>] ieee80211_rx_napi+0x447/0x990
  3792. -[ 7.976667] [<ffffffff81c5fb85>] rt2x00lib_rxdone+0x305/0xbd0
  3793. -[ 7.976670] [<ffffffff811ac23f>] ? dequeue_task_fair+0x64f/0x1de0
  3794. -[ 7.976674] [<ffffffff811a1516>] ? sched_clock_cpu+0xe6/0x150
  3795. -[ 7.976678] [<ffffffff81c6c45c>] rt2x00usb_work_rxdone+0x7c/0x140
  3796. -[ 7.976682] [<ffffffff8117aef6>] process_one_work+0x226/0x860
  3797. -[ 7.976686] [<ffffffff8117b58c>] worker_thread+0x5c/0x680
  3798. -[ 7.976690] [<ffffffff8117b530>] ? process_one_work+0x860/0x860
  3799. -[ 7.976693] [<ffffffff81184f86>] kthread+0xf6/0x150
  3800. -[ 7.976697] [<ffffffff81184e90>] ? kthread_worker_fn+0x310/0x310
  3801. -[ 7.976700] [<ffffffff822a94df>] ret_from_fork+0x3f/0x70
  3802. -[ 7.976703] [<ffffffff81184e90>] ? kthread_worker_fn+0x310/0x310
  3803. -
  3804. -Link: https://lkml.org/lkml/2016/1/26/230
  3805. -Signed-off-by: Chris Bainbridge <chris.bainbridge@gmail.com>
  3806. ----
  3807. -
  3808. ---- a/net/mac80211/agg-rx.c
  3809. -+++ b/net/mac80211/agg-rx.c
  3810. -@@ -327,7 +327,7 @@ void __ieee80211_start_rx_ba_session(str
  3811. - }
  3812. -
  3813. - /* prepare A-MPDU MLME for Rx aggregation */
  3814. -- tid_agg_rx = kmalloc(sizeof(struct tid_ampdu_rx), GFP_KERNEL);
  3815. -+ tid_agg_rx = kzalloc(sizeof(struct tid_ampdu_rx), GFP_KERNEL);
  3816. - if (!tid_agg_rx)
  3817. - goto end;
  3818. -
  3819. 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
  3820. new file mode 100644
  3821. index 0000000..360dfbf
  3822. --- /dev/null
  3823. +++ b/package/kernel/mac80211/patches/317-ath9k-Fix-beacon-configuration-for-addition-removal-.patch
  3824. @@ -0,0 +1,544 @@
  3825. +From: Benjamin Berg <benjamin.berg@open-mesh.com>
  3826. +Date: Mon, 4 Jul 2016 14:37:25 +0200
  3827. +Subject: [PATCH] ath9k: Fix beacon configuration for addition/removal of
  3828. + interfaces
  3829. +
  3830. +This patch fixes some issues with interface reconfiguration. It could
  3831. +for example happen that an AP interface in beacon slot 0 was removed
  3832. +leaving an IBSS station in one of the other slots. When this happens
  3833. +the driver never sends out the beacon as it only tries to send a beacon
  3834. +from slot 0.
  3835. +
  3836. +Appart from that the tracking of required changes to the beacon config is
  3837. +relatively complicated and prone to errors.
  3838. +
  3839. +The approach taken here is to solve reconfiguration issues is to
  3840. +reconfigure the beacons when any interface changes. This means that
  3841. +the complexity of deciding whether an interface change may modify the
  3842. +beacon configuration is gone. It also means that the beacon config will
  3843. +be reliably updated when an interface is removed.
  3844. +
  3845. +The issue that a single non-AP interface might not be in beacon
  3846. +slot 0 and wouldn't be send out is solved by moving it into the
  3847. +first slot. The TSF value in hardware is adjusted accordingly so
  3848. +that the timestamp of the beacons stay consistent.
  3849. +
  3850. +Signed-off-by: Benjamin Berg <benjamin.berg@open-mesh.com>
  3851. +---
  3852. +
  3853. +--- a/drivers/net/wireless/ath/ath9k/ath9k.h
  3854. ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  3855. +@@ -637,6 +637,8 @@ struct ath9k_vif_iter_data {
  3856. + int nwds; /* number of WDS vifs */
  3857. + int nadhocs; /* number of adhoc vifs */
  3858. + int nocbs; /* number of OCB vifs */
  3859. ++ int nbcnvifs; /* number of beaconing vifs */
  3860. ++ struct ieee80211_vif *primary_beacon_vif;
  3861. + struct ieee80211_vif *primary_sta;
  3862. + };
  3863. +
  3864. +@@ -685,10 +687,11 @@ struct ath_beacon {
  3865. + };
  3866. +
  3867. + void ath9k_beacon_tasklet(unsigned long data);
  3868. +-void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif,
  3869. +- u32 changed);
  3870. ++void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *main_vif,
  3871. ++ bool beacons);
  3872. + void ath9k_beacon_assign_slot(struct ath_softc *sc, struct ieee80211_vif *vif);
  3873. + void ath9k_beacon_remove_slot(struct ath_softc *sc, struct ieee80211_vif *vif);
  3874. ++void ath9k_beacon_ensure_primary_slot(struct ath_softc *sc);
  3875. + void ath9k_set_beacon(struct ath_softc *sc);
  3876. + bool ath9k_csa_is_finished(struct ath_softc *sc, struct ieee80211_vif *vif);
  3877. + void ath9k_csa_update(struct ath_softc *sc);
  3878. +--- a/drivers/net/wireless/ath/ath9k/beacon.c
  3879. ++++ b/drivers/net/wireless/ath/ath9k/beacon.c
  3880. +@@ -209,7 +209,6 @@ void ath9k_beacon_assign_slot(struct ath
  3881. + }
  3882. +
  3883. + sc->beacon.bslot[avp->av_bslot] = vif;
  3884. +- sc->nbcnvifs++;
  3885. +
  3886. + ath_dbg(common, CONFIG, "Added interface at beacon slot: %d\n",
  3887. + avp->av_bslot);
  3888. +@@ -220,15 +219,12 @@ void ath9k_beacon_remove_slot(struct ath
  3889. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  3890. + struct ath_vif *avp = (void *)vif->drv_priv;
  3891. + struct ath_buf *bf = avp->av_bcbuf;
  3892. +- struct ath_beacon_config *cur_conf = &sc->cur_chan->beacon;
  3893. +
  3894. + ath_dbg(common, CONFIG, "Removing interface at beacon slot: %d\n",
  3895. + avp->av_bslot);
  3896. +
  3897. + tasklet_disable(&sc->bcon_tasklet);
  3898. +
  3899. +- cur_conf->enable_beacon &= ~BIT(avp->av_bslot);
  3900. +-
  3901. + if (bf && bf->bf_mpdu) {
  3902. + struct sk_buff *skb = bf->bf_mpdu;
  3903. + dma_unmap_single(sc->dev, bf->bf_buf_addr,
  3904. +@@ -240,12 +236,73 @@ void ath9k_beacon_remove_slot(struct ath
  3905. +
  3906. + avp->av_bcbuf = NULL;
  3907. + sc->beacon.bslot[avp->av_bslot] = NULL;
  3908. +- sc->nbcnvifs--;
  3909. + list_add_tail(&bf->list, &sc->beacon.bbuf);
  3910. +
  3911. + tasklet_enable(&sc->bcon_tasklet);
  3912. + }
  3913. +
  3914. ++void ath9k_beacon_ensure_primary_slot(struct ath_softc *sc)
  3915. ++{
  3916. ++ struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  3917. ++ struct ieee80211_vif *vif;
  3918. ++ struct ath_vif *avp;
  3919. ++ s64 tsfadjust;
  3920. ++ u32 offset;
  3921. ++ int first_slot = ATH_BCBUF;
  3922. ++ int slot;
  3923. ++
  3924. ++ tasklet_disable(&sc->bcon_tasklet);
  3925. ++
  3926. ++ /* Find first taken slot. */
  3927. ++ for (slot = 0; slot < ATH_BCBUF; slot++) {
  3928. ++ if (sc->beacon.bslot[slot]) {
  3929. ++ first_slot = slot;
  3930. ++ break;
  3931. ++ }
  3932. ++ }
  3933. ++ if (first_slot == 0)
  3934. ++ goto out;
  3935. ++
  3936. ++ /* Re-enumarate all slots, moving them forward. */
  3937. ++ for (slot = 0; slot < ATH_BCBUF; slot++) {
  3938. ++ if (slot + first_slot < ATH_BCBUF) {
  3939. ++ vif = sc->beacon.bslot[slot + first_slot];
  3940. ++ sc->beacon.bslot[slot] = vif;
  3941. ++
  3942. ++ if (vif) {
  3943. ++ avp = (void *)vif->drv_priv;
  3944. ++ avp->av_bslot = slot;
  3945. ++ }
  3946. ++ } else {
  3947. ++ sc->beacon.bslot[slot] = NULL;
  3948. ++ }
  3949. ++ }
  3950. ++
  3951. ++ vif = sc->beacon.bslot[0];
  3952. ++ if (WARN_ON(!vif))
  3953. ++ goto out;
  3954. ++
  3955. ++ /* Get the tsf_adjust value for the new first slot. */
  3956. ++ avp = (void *)vif->drv_priv;
  3957. ++ tsfadjust = le64_to_cpu(avp->tsf_adjust);
  3958. ++
  3959. ++ ath_dbg(common, CONFIG,
  3960. ++ "Adjusting global TSF after beacon slot reassignment: %lld\n",
  3961. ++ (signed long long)tsfadjust);
  3962. ++
  3963. ++ /* Modify TSF as required and update the HW. */
  3964. ++ avp->chanctx->tsf_val += tsfadjust;
  3965. ++ if (sc->cur_chan == avp->chanctx) {
  3966. ++ offset = ath9k_hw_get_tsf_offset(&avp->chanctx->tsf_ts, NULL);
  3967. ++ ath9k_hw_settsf64(sc->sc_ah, avp->chanctx->tsf_val + offset);
  3968. ++ }
  3969. ++
  3970. ++ /* The slots tsf_adjust will be updated by ath9k_beacon_config later. */
  3971. ++
  3972. ++out:
  3973. ++ tasklet_enable(&sc->bcon_tasklet);
  3974. ++}
  3975. ++
  3976. + static int ath9k_beacon_choose_slot(struct ath_softc *sc)
  3977. + {
  3978. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  3979. +@@ -274,26 +331,33 @@ static int ath9k_beacon_choose_slot(stru
  3980. + return slot;
  3981. + }
  3982. +
  3983. +-static void ath9k_set_tsfadjust(struct ath_softc *sc, struct ieee80211_vif *vif)
  3984. ++static void ath9k_set_tsfadjust(struct ath_softc *sc,
  3985. ++ struct ath_beacon_config *cur_conf)
  3986. + {
  3987. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  3988. +- struct ath_vif *avp = (void *)vif->drv_priv;
  3989. +- struct ath_beacon_config *cur_conf = &avp->chanctx->beacon;
  3990. + s64 tsfadjust;
  3991. ++ int slot;
  3992. +
  3993. +- if (avp->av_bslot == 0)
  3994. +- return;
  3995. ++ for (slot = 0; slot < ATH_BCBUF; slot++) {
  3996. ++ struct ath_vif *avp;
  3997. +
  3998. +- /* tsf_adjust is added to the TSF value. We send out the beacon late,
  3999. +- * so need to adjust the TSF starting point to be later in time (i.e.
  4000. +- * the theoretical first beacon has a TSF of 0 after correction).
  4001. +- */
  4002. +- tsfadjust = cur_conf->beacon_interval * avp->av_bslot;
  4003. +- tsfadjust = -TU_TO_USEC(tsfadjust) / ATH_BCBUF;
  4004. +- avp->tsf_adjust = cpu_to_le64(tsfadjust);
  4005. ++ if (!sc->beacon.bslot[slot])
  4006. ++ continue;
  4007. +
  4008. +- ath_dbg(common, CONFIG, "tsfadjust is: %lld for bslot: %d\n",
  4009. +- (signed long long)tsfadjust, avp->av_bslot);
  4010. ++ avp = (void *)sc->beacon.bslot[slot]->drv_priv;
  4011. ++
  4012. ++ /* tsf_adjust is added to the TSF value. We send out the
  4013. ++ * beacon late, so need to adjust the TSF starting point to be
  4014. ++ * later in time (i.e. the theoretical first beacon has a TSF
  4015. ++ * of 0 after correction).
  4016. ++ */
  4017. ++ tsfadjust = cur_conf->beacon_interval * avp->av_bslot;
  4018. ++ tsfadjust = -TU_TO_USEC(tsfadjust) / ATH_BCBUF;
  4019. ++ avp->tsf_adjust = cpu_to_le64(tsfadjust);
  4020. ++
  4021. ++ ath_dbg(common, CONFIG, "tsfadjust is: %lld for bslot: %d\n",
  4022. ++ (signed long long)tsfadjust, avp->av_bslot);
  4023. ++ }
  4024. + }
  4025. +
  4026. + bool ath9k_csa_is_finished(struct ath_softc *sc, struct ieee80211_vif *vif)
  4027. +@@ -447,20 +511,28 @@ void ath9k_beacon_tasklet(unsigned long
  4028. + * Both nexttbtt and intval have to be in usecs.
  4029. + */
  4030. + static void ath9k_beacon_init(struct ath_softc *sc, u32 nexttbtt,
  4031. +- u32 intval, bool reset_tsf)
  4032. ++ u32 intval)
  4033. + {
  4034. + struct ath_hw *ah = sc->sc_ah;
  4035. +
  4036. + ath9k_hw_disable_interrupts(ah);
  4037. +- if (reset_tsf)
  4038. +- ath9k_hw_reset_tsf(ah);
  4039. + ath9k_beaconq_config(sc);
  4040. + ath9k_hw_beaconinit(ah, nexttbtt, intval);
  4041. ++ ah->imask |= ATH9K_INT_SWBA;
  4042. + sc->beacon.bmisscnt = 0;
  4043. + ath9k_hw_set_interrupts(ah);
  4044. + ath9k_hw_enable_interrupts(ah);
  4045. + }
  4046. +
  4047. ++static void ath9k_beacon_stop(struct ath_softc *sc)
  4048. ++{
  4049. ++ ath9k_hw_disable_interrupts(sc->sc_ah);
  4050. ++ sc->sc_ah->imask &= ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS);
  4051. ++ sc->beacon.bmisscnt = 0;
  4052. ++ ath9k_hw_set_interrupts(sc->sc_ah);
  4053. ++ ath9k_hw_enable_interrupts(sc->sc_ah);
  4054. ++}
  4055. ++
  4056. + /*
  4057. + * For multi-bss ap support beacons are either staggered evenly over N slots or
  4058. + * burst together. For the former arrange for the SWBA to be delivered for each
  4059. +@@ -472,7 +544,7 @@ static void ath9k_beacon_config_ap(struc
  4060. + struct ath_hw *ah = sc->sc_ah;
  4061. +
  4062. + ath9k_cmn_beacon_config_ap(ah, conf, ATH_BCBUF);
  4063. +- ath9k_beacon_init(sc, conf->nexttbtt, conf->intval, false);
  4064. ++ ath9k_beacon_init(sc, conf->nexttbtt, conf->intval);
  4065. + }
  4066. +
  4067. + static void ath9k_beacon_config_sta(struct ath_hw *ah,
  4068. +@@ -501,7 +573,7 @@ static void ath9k_beacon_config_adhoc(st
  4069. +
  4070. + ath9k_cmn_beacon_config_adhoc(ah, conf);
  4071. +
  4072. +- ath9k_beacon_init(sc, conf->nexttbtt, conf->intval, conf->ibss_creator);
  4073. ++ ath9k_beacon_init(sc, conf->nexttbtt, conf->intval);
  4074. +
  4075. + /*
  4076. + * Set the global 'beacon has been configured' flag for the
  4077. +@@ -511,44 +583,6 @@ static void ath9k_beacon_config_adhoc(st
  4078. + set_bit(ATH_OP_BEACONS, &common->op_flags);
  4079. + }
  4080. +
  4081. +-static bool ath9k_allow_beacon_config(struct ath_softc *sc,
  4082. +- struct ieee80211_vif *vif)
  4083. +-{
  4084. +- struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  4085. +- struct ath_vif *avp = (void *)vif->drv_priv;
  4086. +-
  4087. +- if (ath9k_is_chanctx_enabled()) {
  4088. +- /*
  4089. +- * If the VIF is not present in the current channel context,
  4090. +- * then we can't do the usual opmode checks. Allow the
  4091. +- * beacon config for the VIF to be updated in this case and
  4092. +- * return immediately.
  4093. +- */
  4094. +- if (sc->cur_chan != avp->chanctx)
  4095. +- return true;
  4096. +- }
  4097. +-
  4098. +- if (sc->sc_ah->opmode == NL80211_IFTYPE_AP) {
  4099. +- if (vif->type != NL80211_IFTYPE_AP) {
  4100. +- ath_dbg(common, CONFIG,
  4101. +- "An AP interface is already present !\n");
  4102. +- return false;
  4103. +- }
  4104. +- }
  4105. +-
  4106. +- if (sc->sc_ah->opmode == NL80211_IFTYPE_STATION) {
  4107. +- if ((vif->type == NL80211_IFTYPE_STATION) &&
  4108. +- test_bit(ATH_OP_BEACONS, &common->op_flags) &&
  4109. +- vif != sc->cur_chan->primary_sta) {
  4110. +- ath_dbg(common, CONFIG,
  4111. +- "Beacon already configured for a station interface\n");
  4112. +- return false;
  4113. +- }
  4114. +- }
  4115. +-
  4116. +- return true;
  4117. +-}
  4118. +-
  4119. + static void ath9k_cache_beacon_config(struct ath_softc *sc,
  4120. + struct ath_chanctx *ctx,
  4121. + struct ieee80211_bss_conf *bss_conf)
  4122. +@@ -584,87 +618,79 @@ static void ath9k_cache_beacon_config(st
  4123. + if (cur_conf->dtim_period == 0)
  4124. + cur_conf->dtim_period = 1;
  4125. +
  4126. ++ ath9k_set_tsfadjust(sc, cur_conf);
  4127. + }
  4128. +
  4129. +-void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif,
  4130. +- u32 changed)
  4131. ++void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *main_vif,
  4132. ++ bool beacons)
  4133. + {
  4134. +- struct ieee80211_bss_conf *bss_conf = &vif->bss_conf;
  4135. +- struct ath_hw *ah = sc->sc_ah;
  4136. +- struct ath_common *common = ath9k_hw_common(ah);
  4137. +- struct ath_vif *avp = (void *)vif->drv_priv;
  4138. +- struct ath_chanctx *ctx = avp->chanctx;
  4139. ++ struct ath_hw *ah = sc->sc_ah;
  4140. ++ struct ath_common *common = ath9k_hw_common(ah);
  4141. ++ struct ath_vif *avp;
  4142. ++ struct ath_chanctx *ctx;
  4143. + struct ath_beacon_config *cur_conf;
  4144. + unsigned long flags;
  4145. ++ bool enabled;
  4146. + bool skip_beacon = false;
  4147. +
  4148. +- if (!ctx)
  4149. ++ if (!beacons) {
  4150. ++ clear_bit(ATH_OP_BEACONS, &common->op_flags);
  4151. ++ ath9k_beacon_stop(sc);
  4152. + return;
  4153. ++ }
  4154. +
  4155. +- cur_conf = &avp->chanctx->beacon;
  4156. +- if (vif->type == NL80211_IFTYPE_AP)
  4157. +- ath9k_set_tsfadjust(sc, vif);
  4158. +-
  4159. +- if (!ath9k_allow_beacon_config(sc, vif))
  4160. ++ if (WARN_ON(!main_vif))
  4161. + return;
  4162. +
  4163. +- if (vif->type == NL80211_IFTYPE_STATION) {
  4164. +- ath9k_cache_beacon_config(sc, ctx, bss_conf);
  4165. +- if (ctx != sc->cur_chan)
  4166. +- return;
  4167. ++ avp = (void *)main_vif->drv_priv;
  4168. ++ ctx = avp->chanctx;
  4169. ++ cur_conf = &ctx->beacon;
  4170. ++ enabled = cur_conf->enable_beacon;
  4171. ++ cur_conf->enable_beacon = beacons;
  4172. ++
  4173. ++ if (sc->sc_ah->opmode == NL80211_IFTYPE_STATION) {
  4174. ++ ath9k_cache_beacon_config(sc, ctx, &main_vif->bss_conf);
  4175. +
  4176. + ath9k_set_beacon(sc);
  4177. + set_bit(ATH_OP_BEACONS, &common->op_flags);
  4178. + return;
  4179. + }
  4180. +
  4181. +- /*
  4182. +- * Take care of multiple interfaces when
  4183. +- * enabling/disabling SWBA.
  4184. +- */
  4185. +- if (changed & BSS_CHANGED_BEACON_ENABLED) {
  4186. +- bool enabled = cur_conf->enable_beacon;
  4187. +-
  4188. +- if (!bss_conf->enable_beacon) {
  4189. +- cur_conf->enable_beacon &= ~BIT(avp->av_bslot);
  4190. +- } else {
  4191. +- cur_conf->enable_beacon |= BIT(avp->av_bslot);
  4192. +- if (!enabled)
  4193. +- ath9k_cache_beacon_config(sc, ctx, bss_conf);
  4194. +- }
  4195. +- }
  4196. +-
  4197. +- if (ctx != sc->cur_chan)
  4198. +- return;
  4199. ++ /* Update the beacon configuration. */
  4200. ++ ath9k_cache_beacon_config(sc, ctx, &main_vif->bss_conf);
  4201. +
  4202. + /*
  4203. + * Configure the HW beacon registers only when we have a valid
  4204. + * beacon interval.
  4205. + */
  4206. + if (cur_conf->beacon_interval) {
  4207. +- /*
  4208. +- * If we are joining an existing IBSS network, start beaconing
  4209. +- * only after a TSF-sync has taken place. Ensure that this
  4210. +- * happens by setting the appropriate flags.
  4211. ++ /* Special case to sync the TSF when joining an existing IBSS.
  4212. ++ * This is only done if no AP interface is active.
  4213. ++ * Note that mac80211 always resets the TSF when creating a new
  4214. ++ * IBSS interface.
  4215. + */
  4216. +- if ((changed & BSS_CHANGED_IBSS) && !bss_conf->ibss_creator &&
  4217. +- bss_conf->enable_beacon) {
  4218. ++ if (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC &&
  4219. ++ !enabled && beacons && !main_vif->bss_conf.ibss_creator) {
  4220. + spin_lock_irqsave(&sc->sc_pm_lock, flags);
  4221. + sc->ps_flags |= PS_BEACON_SYNC | PS_WAIT_FOR_BEACON;
  4222. + spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
  4223. + skip_beacon = true;
  4224. +- } else {
  4225. +- ath9k_set_beacon(sc);
  4226. + }
  4227. +
  4228. + /*
  4229. + * Do not set the ATH_OP_BEACONS flag for IBSS joiner mode
  4230. + * here, it is done in ath9k_beacon_config_adhoc().
  4231. + */
  4232. +- if (cur_conf->enable_beacon && !skip_beacon)
  4233. ++ if (beacons && !skip_beacon) {
  4234. + set_bit(ATH_OP_BEACONS, &common->op_flags);
  4235. +- else
  4236. ++ ath9k_set_beacon(sc);
  4237. ++ } else {
  4238. + clear_bit(ATH_OP_BEACONS, &common->op_flags);
  4239. ++ ath9k_beacon_stop(sc);
  4240. ++ }
  4241. ++ } else {
  4242. ++ clear_bit(ATH_OP_BEACONS, &common->op_flags);
  4243. ++ ath9k_beacon_stop(sc);
  4244. + }
  4245. + }
  4246. +
  4247. +--- a/drivers/net/wireless/ath/ath9k/common.h
  4248. ++++ b/drivers/net/wireless/ath/ath9k/common.h
  4249. +@@ -50,6 +50,7 @@
  4250. + #define IEEE80211_MS_TO_TU(x) (((x) * 1000) / 1024)
  4251. +
  4252. + struct ath_beacon_config {
  4253. ++ struct ieee80211_vif *main_vif;
  4254. + int beacon_interval;
  4255. + u16 dtim_period;
  4256. + u16 bmiss_timeout;
  4257. +--- a/drivers/net/wireless/ath/ath9k/main.c
  4258. ++++ b/drivers/net/wireless/ath/ath9k/main.c
  4259. +@@ -910,6 +910,22 @@ static bool ath9k_uses_beacons(int type)
  4260. + }
  4261. + }
  4262. +
  4263. ++static void ath9k_vif_iter_set_beacon(struct ath9k_vif_iter_data *iter_data,
  4264. ++ struct ieee80211_vif *vif)
  4265. ++{
  4266. ++ /* Use the first (configured) interface, but prefering AP interfaces. */
  4267. ++ if (!iter_data->primary_beacon_vif) {
  4268. ++ iter_data->primary_beacon_vif = vif;
  4269. ++ } else {
  4270. ++ if (iter_data->primary_beacon_vif->type != NL80211_IFTYPE_AP &&
  4271. ++ vif->type == NL80211_IFTYPE_AP)
  4272. ++ iter_data->primary_beacon_vif = vif;
  4273. ++ }
  4274. ++
  4275. ++ iter_data->beacons = true;
  4276. ++ iter_data->nbcnvifs += 1;
  4277. ++}
  4278. ++
  4279. + static void ath9k_vif_iter(struct ath9k_vif_iter_data *iter_data,
  4280. + u8 *mac, struct ieee80211_vif *vif)
  4281. + {
  4282. +@@ -931,6 +947,8 @@ static void ath9k_vif_iter(struct ath9k_
  4283. + switch (vif->type) {
  4284. + case NL80211_IFTYPE_AP:
  4285. + iter_data->naps++;
  4286. ++ if (vif->bss_conf.enable_beacon)
  4287. ++ ath9k_vif_iter_set_beacon(iter_data, vif);
  4288. + break;
  4289. + case NL80211_IFTYPE_STATION:
  4290. + iter_data->nstations++;
  4291. +@@ -943,12 +961,12 @@ static void ath9k_vif_iter(struct ath9k_
  4292. + case NL80211_IFTYPE_ADHOC:
  4293. + iter_data->nadhocs++;
  4294. + if (vif->bss_conf.enable_beacon)
  4295. +- iter_data->beacons = true;
  4296. ++ ath9k_vif_iter_set_beacon(iter_data, vif);
  4297. + break;
  4298. + case NL80211_IFTYPE_MESH_POINT:
  4299. + iter_data->nmeshes++;
  4300. + if (vif->bss_conf.enable_beacon)
  4301. +- iter_data->beacons = true;
  4302. ++ ath9k_vif_iter_set_beacon(iter_data, vif);
  4303. + break;
  4304. + case NL80211_IFTYPE_WDS:
  4305. + iter_data->nwds++;
  4306. +@@ -1081,7 +1099,6 @@ void ath9k_calculate_summary_state(struc
  4307. + struct ath_hw *ah = sc->sc_ah;
  4308. + struct ath_common *common = ath9k_hw_common(ah);
  4309. + struct ath9k_vif_iter_data iter_data;
  4310. +- struct ath_beacon_config *cur_conf;
  4311. +
  4312. + ath_chanctx_check_active(sc, ctx);
  4313. +
  4314. +@@ -1103,13 +1120,12 @@ void ath9k_calculate_summary_state(struc
  4315. + ath_hw_setbssidmask(common);
  4316. +
  4317. + if (iter_data.naps > 0) {
  4318. +- cur_conf = &ctx->beacon;
  4319. + ath9k_hw_set_tsfadjust(ah, true);
  4320. + ah->opmode = NL80211_IFTYPE_AP;
  4321. +- if (cur_conf->enable_beacon)
  4322. +- iter_data.beacons = true;
  4323. + } else {
  4324. + ath9k_hw_set_tsfadjust(ah, false);
  4325. ++ if (iter_data.beacons)
  4326. ++ ath9k_beacon_ensure_primary_slot(sc);
  4327. +
  4328. + if (iter_data.nmeshes)
  4329. + ah->opmode = NL80211_IFTYPE_MESH_POINT;
  4330. +@@ -1134,7 +1150,6 @@ void ath9k_calculate_summary_state(struc
  4331. + ctx->switch_after_beacon = true;
  4332. + }
  4333. +
  4334. +- ah->imask &= ~ATH9K_INT_SWBA;
  4335. + if (ah->opmode == NL80211_IFTYPE_STATION) {
  4336. + bool changed = (iter_data.primary_sta != ctx->primary_sta);
  4337. +
  4338. +@@ -1151,16 +1166,12 @@ void ath9k_calculate_summary_state(struc
  4339. + if (ath9k_hw_mci_is_enabled(sc->sc_ah))
  4340. + ath9k_mci_update_wlan_channels(sc, true);
  4341. + }
  4342. +- } else if (iter_data.beacons) {
  4343. +- ah->imask |= ATH9K_INT_SWBA;
  4344. + }
  4345. ++ sc->nbcnvifs = iter_data.nbcnvifs;
  4346. ++ ath9k_beacon_config(sc, iter_data.primary_beacon_vif,
  4347. ++ iter_data.beacons);
  4348. + ath9k_hw_set_interrupts(ah);
  4349. +
  4350. +- if (iter_data.beacons)
  4351. +- set_bit(ATH_OP_BEACONS, &common->op_flags);
  4352. +- else
  4353. +- clear_bit(ATH_OP_BEACONS, &common->op_flags);
  4354. +-
  4355. + if (ah->slottime != iter_data.slottime) {
  4356. + ah->slottime = iter_data.slottime;
  4357. + ath9k_hw_init_global_settings(ah);
  4358. +@@ -1777,9 +1788,7 @@ static void ath9k_bss_info_changed(struc
  4359. + if ((changed & BSS_CHANGED_BEACON_ENABLED) ||
  4360. + (changed & BSS_CHANGED_BEACON_INT) ||
  4361. + (changed & BSS_CHANGED_BEACON_INFO)) {
  4362. +- ath9k_beacon_config(sc, vif, changed);
  4363. +- if (changed & BSS_CHANGED_BEACON_ENABLED)
  4364. +- ath9k_calculate_summary_state(sc, avp->chanctx);
  4365. ++ ath9k_calculate_summary_state(sc, avp->chanctx);
  4366. + }
  4367. +
  4368. + if ((avp->chanctx == sc->cur_chan) &&
  4369. 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
  4370. deleted file mode 100644
  4371. index 5bf53b9..0000000
  4372. --- a/package/kernel/mac80211/patches/317-mac80211-minstrel_ht-fix-out-of-bound-in-minstrel_ht.patch
  4373. +++ /dev/null
  4374. @@ -1,45 +0,0 @@
  4375. -From: Konstantin Khlebnikov <koct9i@gmail.com>
  4376. -Date: Fri, 29 Jan 2016 11:35:12 +0300
  4377. -Subject: [PATCH] mac80211: minstrel_ht: fix out-of-bound in
  4378. - minstrel_ht_set_best_prob_rate
  4379. -
  4380. -Patch fixes this splat
  4381. -
  4382. -BUG: KASAN: slab-out-of-bounds in minstrel_ht_update_stats.isra.7+0x6e1/0x9e0
  4383. -[mac80211] at addr ffff8800cee640f4 Read of size 4 by task swapper/3/0
  4384. -
  4385. -Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>
  4386. -Link: http://lkml.kernel.org/r/CALYGNiNyJhSaVnE35qS6UCGaSb2Dx1_i5HcRavuOX14oTz2P+w@mail.gmail.com
  4387. ----
  4388. -
  4389. ---- a/net/mac80211/rc80211_minstrel_ht.c
  4390. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  4391. -@@ -414,15 +414,16 @@ minstrel_ht_set_best_prob_rate(struct mi
  4392. - (max_tp_group != MINSTREL_CCK_GROUP))
  4393. - return;
  4394. -
  4395. -+ max_gpr_group = mg->max_group_prob_rate / MCS_GROUP_RATES;
  4396. -+ max_gpr_idx = mg->max_group_prob_rate % MCS_GROUP_RATES;
  4397. -+ max_gpr_prob = mi->groups[max_gpr_group].rates[max_gpr_idx].prob_ewma;
  4398. -+
  4399. - if (mrs->prob_ewma > MINSTREL_FRAC(75, 100)) {
  4400. - cur_tp_avg = minstrel_ht_get_tp_avg(mi, cur_group, cur_idx,
  4401. - mrs->prob_ewma);
  4402. - if (cur_tp_avg > tmp_tp_avg)
  4403. - mi->max_prob_rate = index;
  4404. -
  4405. -- max_gpr_group = mg->max_group_prob_rate / MCS_GROUP_RATES;
  4406. -- max_gpr_idx = mg->max_group_prob_rate % MCS_GROUP_RATES;
  4407. -- max_gpr_prob = mi->groups[max_gpr_group].rates[max_gpr_idx].prob_ewma;
  4408. - max_gpr_tp_avg = minstrel_ht_get_tp_avg(mi, max_gpr_group,
  4409. - max_gpr_idx,
  4410. - max_gpr_prob);
  4411. -@@ -431,7 +432,7 @@ minstrel_ht_set_best_prob_rate(struct mi
  4412. - } else {
  4413. - if (mrs->prob_ewma > tmp_prob)
  4414. - mi->max_prob_rate = index;
  4415. -- if (mrs->prob_ewma > mg->rates[mg->max_group_prob_rate].prob_ewma)
  4416. -+ if (mrs->prob_ewma > max_gpr_prob)
  4417. - mg->max_group_prob_rate = index;
  4418. - }
  4419. - }
  4420. 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
  4421. new file mode 100644
  4422. index 0000000..d946ecc
  4423. --- /dev/null
  4424. +++ b/package/kernel/mac80211/patches/318-brcmfmac-slightly-simplify-building-interface-combin.patch
  4425. @@ -0,0 +1,108 @@
  4426. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4427. +Date: Tue, 7 Jun 2016 21:10:18 +0200
  4428. +Subject: [PATCH] brcmfmac: slightly simplify building interface combinations
  4429. +MIME-Version: 1.0
  4430. +Content-Type: text/plain; charset=UTF-8
  4431. +Content-Transfer-Encoding: 8bit
  4432. +
  4433. +This change reorders some operations in brcmf_setup_ifmodes in hope to
  4434. +make it simpler:
  4435. +1) It allocates arrays right before filling them. This way it's easier
  4436. + to follow requested array length as it's immediately followed by
  4437. + code filling it. It's easier to check e.g. why we need 4 entries for
  4438. + P2P. Other than that it deduplicates some checks (e.g. for P2P).
  4439. +2) It reorders code to first prepare limits and then define a new combo.
  4440. + Previously this was mixed (e.g. we were setting num of channels
  4441. + before preparing limits).
  4442. +3) It modifies mbss code to use i variable just like other combos do.
  4443. +
  4444. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4445. +Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  4446. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4447. +---
  4448. +
  4449. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  4450. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  4451. +@@ -6284,29 +6284,15 @@ static int brcmf_setup_ifmodes(struct wi
  4452. + if (!combo)
  4453. + goto err;
  4454. +
  4455. +- c0_limits = kcalloc(p2p ? 3 : 2, sizeof(*c0_limits), GFP_KERNEL);
  4456. +- if (!c0_limits)
  4457. +- goto err;
  4458. +-
  4459. +- if (p2p) {
  4460. +- p2p_limits = kcalloc(4, sizeof(*p2p_limits), GFP_KERNEL);
  4461. +- if (!p2p_limits)
  4462. +- goto err;
  4463. +- }
  4464. +-
  4465. +- if (mbss) {
  4466. +- mbss_limits = kcalloc(1, sizeof(*mbss_limits), GFP_KERNEL);
  4467. +- if (!mbss_limits)
  4468. +- goto err;
  4469. +- }
  4470. +-
  4471. + wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
  4472. + BIT(NL80211_IFTYPE_ADHOC) |
  4473. + BIT(NL80211_IFTYPE_AP);
  4474. +
  4475. + c = 0;
  4476. + i = 0;
  4477. +- combo[c].num_different_channels = 1;
  4478. ++ c0_limits = kcalloc(p2p ? 3 : 2, sizeof(*c0_limits), GFP_KERNEL);
  4479. ++ if (!c0_limits)
  4480. ++ goto err;
  4481. + c0_limits[i].max = 1;
  4482. + c0_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  4483. + if (p2p) {
  4484. +@@ -6324,6 +6310,7 @@ static int brcmf_setup_ifmodes(struct wi
  4485. + c0_limits[i].max = 1;
  4486. + c0_limits[i++].types = BIT(NL80211_IFTYPE_AP);
  4487. + }
  4488. ++ combo[c].num_different_channels = 1;
  4489. + combo[c].max_interfaces = i;
  4490. + combo[c].n_limits = i;
  4491. + combo[c].limits = c0_limits;
  4492. +@@ -6331,7 +6318,9 @@ static int brcmf_setup_ifmodes(struct wi
  4493. + if (p2p) {
  4494. + c++;
  4495. + i = 0;
  4496. +- combo[c].num_different_channels = 1;
  4497. ++ p2p_limits = kcalloc(4, sizeof(*p2p_limits), GFP_KERNEL);
  4498. ++ if (!p2p_limits)
  4499. ++ goto err;
  4500. + p2p_limits[i].max = 1;
  4501. + p2p_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  4502. + p2p_limits[i].max = 1;
  4503. +@@ -6340,6 +6329,7 @@ static int brcmf_setup_ifmodes(struct wi
  4504. + p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT);
  4505. + p2p_limits[i].max = 1;
  4506. + p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  4507. ++ combo[c].num_different_channels = 1;
  4508. + combo[c].max_interfaces = i;
  4509. + combo[c].n_limits = i;
  4510. + combo[c].limits = p2p_limits;
  4511. +@@ -6347,14 +6337,19 @@ static int brcmf_setup_ifmodes(struct wi
  4512. +
  4513. + if (mbss) {
  4514. + c++;
  4515. ++ i = 0;
  4516. ++ mbss_limits = kcalloc(1, sizeof(*mbss_limits), GFP_KERNEL);
  4517. ++ if (!mbss_limits)
  4518. ++ goto err;
  4519. ++ mbss_limits[i].max = 4;
  4520. ++ mbss_limits[i++].types = BIT(NL80211_IFTYPE_AP);
  4521. + combo[c].beacon_int_infra_match = true;
  4522. + combo[c].num_different_channels = 1;
  4523. +- mbss_limits[0].max = 4;
  4524. +- mbss_limits[0].types = BIT(NL80211_IFTYPE_AP);
  4525. + combo[c].max_interfaces = 4;
  4526. +- combo[c].n_limits = 1;
  4527. ++ combo[c].n_limits = i;
  4528. + combo[c].limits = mbss_limits;
  4529. + }
  4530. ++
  4531. + wiphy->n_iface_combinations = n_combos;
  4532. + wiphy->iface_combinations = combo;
  4533. + return 0;
  4534. 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
  4535. deleted file mode 100644
  4536. index 655dc4b..0000000
  4537. --- a/package/kernel/mac80211/patches/318-mac80211-move-A-MSDU-skb_linearize-call-to-ieee80211.patch
  4538. +++ /dev/null
  4539. @@ -1,35 +0,0 @@
  4540. -From: Felix Fietkau <nbd@openwrt.org>
  4541. -Date: Tue, 2 Feb 2016 14:39:08 +0100
  4542. -Subject: [PATCH] mac80211: move A-MSDU skb_linearize call to
  4543. - ieee80211_amsdu_to_8023s
  4544. -
  4545. -Prepararation for zero-copy A-MSDU support with page fragment SKBs
  4546. -
  4547. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  4548. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  4549. ----
  4550. -
  4551. ---- a/net/mac80211/rx.c
  4552. -+++ b/net/mac80211/rx.c
  4553. -@@ -2203,9 +2203,6 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx
  4554. - skb->dev = dev;
  4555. - __skb_queue_head_init(&frame_list);
  4556. -
  4557. -- if (skb_linearize(skb))
  4558. -- return RX_DROP_UNUSABLE;
  4559. --
  4560. - ieee80211_amsdu_to_8023s(skb, &frame_list, dev->dev_addr,
  4561. - rx->sdata->vif.type,
  4562. - rx->local->hw.extra_tx_headroom, true);
  4563. ---- a/net/wireless/util.c
  4564. -+++ b/net/wireless/util.c
  4565. -@@ -657,6 +657,9 @@ void ieee80211_amsdu_to_8023s(struct sk_
  4566. - int remaining, err;
  4567. - u8 dst[ETH_ALEN], src[ETH_ALEN];
  4568. -
  4569. -+ if (skb_linearize(skb))
  4570. -+ goto out;
  4571. -+
  4572. - if (has_80211_header) {
  4573. - err = ieee80211_data_to_8023(skb, addr, iftype);
  4574. - if (err)
  4575. 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
  4576. new file mode 100644
  4577. index 0000000..073d012
  4578. --- /dev/null
  4579. +++ b/package/kernel/mac80211/patches/319-0001-brcmfmac-fix-lockup-when-removing-P2P-interface-afte.patch
  4580. @@ -0,0 +1,154 @@
  4581. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4582. +Date: Fri, 17 Jun 2016 12:29:21 +0200
  4583. +Subject: [PATCH] brcmfmac: fix lockup when removing P2P interface after
  4584. + event timeout
  4585. +MIME-Version: 1.0
  4586. +Content-Type: text/plain; charset=UTF-8
  4587. +Content-Transfer-Encoding: 8bit
  4588. +
  4589. +Removing P2P interface is handled by sending a proper request to the
  4590. +firmware. On success firmware triggers an event and driver's handler
  4591. +removes a matching interface.
  4592. +
  4593. +However on event timeout we remove interface directly from the cfg80211
  4594. +callback. Current code doesn't handle this case correctly as it always
  4595. +assumes rtnl to be unlocked.
  4596. +
  4597. +Fix it by adding an extra rtnl_locked parameter to functions and calling
  4598. +unregister_netdevice when needed.
  4599. +
  4600. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4601. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4602. +---
  4603. +
  4604. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  4605. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  4606. +@@ -548,12 +548,16 @@ fail:
  4607. + return -EBADE;
  4608. + }
  4609. +
  4610. +-static void brcmf_net_detach(struct net_device *ndev)
  4611. ++static void brcmf_net_detach(struct net_device *ndev, bool rtnl_locked)
  4612. + {
  4613. +- if (ndev->reg_state == NETREG_REGISTERED)
  4614. +- unregister_netdev(ndev);
  4615. +- else
  4616. ++ if (ndev->reg_state == NETREG_REGISTERED) {
  4617. ++ if (rtnl_locked)
  4618. ++ unregister_netdevice(ndev);
  4619. ++ else
  4620. ++ unregister_netdev(ndev);
  4621. ++ } else {
  4622. + brcmf_cfg80211_free_netdev(ndev);
  4623. ++ }
  4624. + }
  4625. +
  4626. + void brcmf_net_setcarrier(struct brcmf_if *ifp, bool on)
  4627. +@@ -651,7 +655,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  4628. + brcmf_err("ERROR: netdev:%s already exists\n",
  4629. + ifp->ndev->name);
  4630. + netif_stop_queue(ifp->ndev);
  4631. +- brcmf_net_detach(ifp->ndev);
  4632. ++ brcmf_net_detach(ifp->ndev, false);
  4633. + drvr->iflist[bsscfgidx] = NULL;
  4634. + } else {
  4635. + brcmf_dbg(INFO, "netdev:%s ignore IF event\n",
  4636. +@@ -699,7 +703,8 @@ struct brcmf_if *brcmf_add_if(struct brc
  4637. + return ifp;
  4638. + }
  4639. +
  4640. +-static void brcmf_del_if(struct brcmf_pub *drvr, s32 bsscfgidx)
  4641. ++static void brcmf_del_if(struct brcmf_pub *drvr, s32 bsscfgidx,
  4642. ++ bool rtnl_locked)
  4643. + {
  4644. + struct brcmf_if *ifp;
  4645. +
  4646. +@@ -729,7 +734,7 @@ static void brcmf_del_if(struct brcmf_pu
  4647. + cancel_work_sync(&ifp->multicast_work);
  4648. + cancel_work_sync(&ifp->ndoffload_work);
  4649. + }
  4650. +- brcmf_net_detach(ifp->ndev);
  4651. ++ brcmf_net_detach(ifp->ndev, rtnl_locked);
  4652. + } else {
  4653. + /* Only p2p device interfaces which get dynamically created
  4654. + * end up here. In this case the p2p module should be informed
  4655. +@@ -743,14 +748,14 @@ static void brcmf_del_if(struct brcmf_pu
  4656. + }
  4657. + }
  4658. +
  4659. +-void brcmf_remove_interface(struct brcmf_if *ifp)
  4660. ++void brcmf_remove_interface(struct brcmf_if *ifp, bool rtnl_locked)
  4661. + {
  4662. + if (!ifp || WARN_ON(ifp->drvr->iflist[ifp->bsscfgidx] != ifp))
  4663. + return;
  4664. + brcmf_dbg(TRACE, "Enter, bsscfgidx=%d, ifidx=%d\n", ifp->bsscfgidx,
  4665. + ifp->ifidx);
  4666. + brcmf_fws_del_interface(ifp);
  4667. +- brcmf_del_if(ifp->drvr, ifp->bsscfgidx);
  4668. ++ brcmf_del_if(ifp->drvr, ifp->bsscfgidx, rtnl_locked);
  4669. + }
  4670. +
  4671. + #ifdef CONFIG_INET
  4672. +@@ -1057,9 +1062,9 @@ fail:
  4673. + brcmf_fws_deinit(drvr);
  4674. + }
  4675. + if (ifp)
  4676. +- brcmf_net_detach(ifp->ndev);
  4677. ++ brcmf_net_detach(ifp->ndev, false);
  4678. + if (p2p_ifp)
  4679. +- brcmf_net_detach(p2p_ifp->ndev);
  4680. ++ brcmf_net_detach(p2p_ifp->ndev, false);
  4681. + drvr->iflist[0] = NULL;
  4682. + drvr->iflist[1] = NULL;
  4683. + if (drvr->settings->ignore_probe_fail)
  4684. +@@ -1128,7 +1133,7 @@ void brcmf_detach(struct device *dev)
  4685. +
  4686. + /* make sure primary interface removed last */
  4687. + for (i = BRCMF_MAX_IFS-1; i > -1; i--)
  4688. +- brcmf_remove_interface(drvr->iflist[i]);
  4689. ++ brcmf_remove_interface(drvr->iflist[i], false);
  4690. +
  4691. + brcmf_cfg80211_detach(drvr->config);
  4692. +
  4693. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  4694. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  4695. +@@ -216,7 +216,7 @@ struct brcmf_if *brcmf_get_ifp(struct br
  4696. + int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  4697. + struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
  4698. + bool is_p2pdev, char *name, u8 *mac_addr);
  4699. +-void brcmf_remove_interface(struct brcmf_if *ifp);
  4700. ++void brcmf_remove_interface(struct brcmf_if *ifp, bool rtnl_locked);
  4701. + void brcmf_txflowblock_if(struct brcmf_if *ifp,
  4702. + enum brcmf_netif_stop_reason reason, bool state);
  4703. + void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
  4704. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  4705. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  4706. +@@ -183,7 +183,7 @@ static void brcmf_fweh_handle_if_event(s
  4707. + err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data);
  4708. +
  4709. + if (ifp && ifevent->action == BRCMF_E_IF_DEL)
  4710. +- brcmf_remove_interface(ifp);
  4711. ++ brcmf_remove_interface(ifp, false);
  4712. + }
  4713. +
  4714. + /**
  4715. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  4716. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  4717. +@@ -2289,7 +2289,7 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  4718. + err = 0;
  4719. + }
  4720. + if (err)
  4721. +- brcmf_remove_interface(vif->ifp);
  4722. ++ brcmf_remove_interface(vif->ifp, true);
  4723. +
  4724. + brcmf_cfg80211_arm_vif_event(cfg, NULL);
  4725. + if (vif->wdev.iftype != NL80211_IFTYPE_P2P_DEVICE)
  4726. +@@ -2395,7 +2395,7 @@ void brcmf_p2p_detach(struct brcmf_p2p_i
  4727. + if (vif != NULL) {
  4728. + brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  4729. + brcmf_p2p_deinit_discovery(p2p);
  4730. +- brcmf_remove_interface(vif->ifp);
  4731. ++ brcmf_remove_interface(vif->ifp, false);
  4732. + }
  4733. + /* just set it all to zero */
  4734. + memset(p2p, 0, sizeof(*p2p));
  4735. 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
  4736. new file mode 100644
  4737. index 0000000..6d3f3c6
  4738. --- /dev/null
  4739. +++ b/package/kernel/mac80211/patches/319-0002-brcmfmac-use-const-char-for-interface-name-in-brcmf_.patch
  4740. @@ -0,0 +1,40 @@
  4741. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4742. +Date: Fri, 17 Jun 2016 12:48:44 +0200
  4743. +Subject: [PATCH] brcmfmac: use const char * for interface name in
  4744. + brcmf_add_if
  4745. +MIME-Version: 1.0
  4746. +Content-Type: text/plain; charset=UTF-8
  4747. +Content-Transfer-Encoding: 8bit
  4748. +
  4749. +This function can work just fine with const pointer, it only calls
  4750. +alloc_netdev which take const as well. Moreover it makes this function
  4751. +more flexible as some cfg80211 callback may provide const char * as
  4752. +well, e.g. add_virtual_intf. This will be needed for more advanced
  4753. +interface management.
  4754. +
  4755. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4756. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4757. +---
  4758. +
  4759. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  4760. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  4761. +@@ -638,7 +638,7 @@ fail:
  4762. + }
  4763. +
  4764. + struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
  4765. +- bool is_p2pdev, char *name, u8 *mac_addr)
  4766. ++ bool is_p2pdev, const char *name, u8 *mac_addr)
  4767. + {
  4768. + struct brcmf_if *ifp;
  4769. + struct net_device *ndev;
  4770. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  4771. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  4772. +@@ -215,7 +215,7 @@ char *brcmf_ifname(struct brcmf_if *ifp)
  4773. + struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx);
  4774. + int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  4775. + struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
  4776. +- bool is_p2pdev, char *name, u8 *mac_addr);
  4777. ++ bool is_p2pdev, const char *name, u8 *mac_addr);
  4778. + void brcmf_remove_interface(struct brcmf_if *ifp, bool rtnl_locked);
  4779. + void brcmf_txflowblock_if(struct brcmf_if *ifp,
  4780. + enum brcmf_netif_stop_reason reason, bool state);
  4781. 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
  4782. new file mode 100644
  4783. index 0000000..eeda766
  4784. --- /dev/null
  4785. +++ b/package/kernel/mac80211/patches/319-0003-brcmfmac-include-also-core.h-header-in-cfg80211.h.patch
  4786. @@ -0,0 +1,33 @@
  4787. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4788. +Date: Sat, 18 Jun 2016 18:49:38 +0200
  4789. +Subject: [PATCH] brcmfmac: include also core.h header in cfg80211.h
  4790. +MIME-Version: 1.0
  4791. +Content-Type: text/plain; charset=UTF-8
  4792. +Content-Transfer-Encoding: 8bit
  4793. +
  4794. +This header provides two inline functions using struct brcmf_if so we
  4795. +need core.h to avoid:
  4796. +
  4797. +drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h: In function ‘ndev_to_prof’:
  4798. +drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h:368:13: error: dereferencing pointer to incomplete type
  4799. + return &ifp->vif->profile;
  4800. + ^
  4801. +drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h: In function ‘ndev_to_vif’:
  4802. +drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h:374:12: error: dereferencing pointer to incomplete type
  4803. + return ifp->vif;
  4804. + ^
  4805. +
  4806. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4807. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4808. +---
  4809. +
  4810. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  4811. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  4812. +@@ -20,6 +20,7 @@
  4813. + /* for brcmu_d11inf */
  4814. + #include <brcmu_d11.h>
  4815. +
  4816. ++#include "core.h"
  4817. + #include "fwil_types.h"
  4818. + #include "p2p.h"
  4819. +
  4820. 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
  4821. new file mode 100644
  4822. index 0000000..3819248
  4823. --- /dev/null
  4824. +++ b/package/kernel/mac80211/patches/319-0004-brcmfmac-add-missing-break-when-deleting-P2P_DEVICE.patch
  4825. @@ -0,0 +1,27 @@
  4826. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4827. +Date: Sun, 19 Jun 2016 01:55:57 +0200
  4828. +Subject: [PATCH] brcmfmac: add missing break when deleting P2P_DEVICE
  4829. +MIME-Version: 1.0
  4830. +Content-Type: text/plain; charset=UTF-8
  4831. +Content-Transfer-Encoding: 8bit
  4832. +
  4833. +We obviously don't want to fall through in that switch. With this change
  4834. +1) We wait for event (triggered by p2p_disc) as expected
  4835. +2) We remove interface manually on timeout
  4836. +3) We return 0 on success instead of -ENOTSUPP
  4837. +
  4838. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4839. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4840. +---
  4841. +
  4842. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  4843. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  4844. +@@ -2263,6 +2263,8 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  4845. + return 0;
  4846. + brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  4847. + brcmf_p2p_deinit_discovery(p2p);
  4848. ++ break;
  4849. ++
  4850. + default:
  4851. + return -ENOTSUPP;
  4852. + }
  4853. 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
  4854. new file mode 100644
  4855. index 0000000..12d7eb4
  4856. --- /dev/null
  4857. +++ b/package/kernel/mac80211/patches/319-0005-brcmfmac-delete-interface-directly-in-code-that-sent.patch
  4858. @@ -0,0 +1,75 @@
  4859. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4860. +Date: Wed, 29 Jun 2016 21:54:26 +0200
  4861. +Subject: [PATCH] brcmfmac: delete interface directly in code that sent fw
  4862. + request
  4863. +MIME-Version: 1.0
  4864. +Content-Type: text/plain; charset=UTF-8
  4865. +Content-Transfer-Encoding: 8bit
  4866. +
  4867. +So far when receiving event about in-firmware-interface removal our
  4868. +event worker was notifying listener and afterwards it was removing Linux
  4869. +interface.
  4870. +
  4871. +First of all it was resulting in slightly unexpected order. The listener
  4872. +(del_virtual_intf callback) was (usually) returning with success before
  4873. +we even called unregister_netdev(ice).
  4874. +
  4875. +Please note this couldn't be simply fixed by changing order of calls in
  4876. +brcmf_fweh_handle_if_event as unregistering interface earlier could free
  4877. +struct brcmf_if.
  4878. +
  4879. +Another problem of current implementation are possible lockups. Focus on
  4880. +the time slot between calling event handler and removing Linux
  4881. +interface. During that time original caller may leave (unlocking rtnl
  4882. +semaphore) *and* another call to the same code may be done (locking it
  4883. +again). If that happens our event handler will stuck at removing Linux
  4884. +interface, it won't handle another event and will block process holding
  4885. +rtnl lock.
  4886. +
  4887. +This can be simply solved by unregistering interface in a proper
  4888. +callback, right after receiving confirmation event from firmware. This
  4889. +only required modifying worker to don't unregister on its own if there
  4890. +is someone waiting for the event.
  4891. +
  4892. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4893. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4894. +---
  4895. +
  4896. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  4897. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  4898. +@@ -18,6 +18,7 @@
  4899. + #include "brcmu_wifi.h"
  4900. + #include "brcmu_utils.h"
  4901. +
  4902. ++#include "cfg80211.h"
  4903. + #include "core.h"
  4904. + #include "debug.h"
  4905. + #include "tracepoint.h"
  4906. +@@ -182,8 +183,13 @@ static void brcmf_fweh_handle_if_event(s
  4907. +
  4908. + err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data);
  4909. +
  4910. +- if (ifp && ifevent->action == BRCMF_E_IF_DEL)
  4911. +- brcmf_remove_interface(ifp, false);
  4912. ++ if (ifp && ifevent->action == BRCMF_E_IF_DEL) {
  4913. ++ bool armed = brcmf_cfg80211_vif_event_armed(drvr->config);
  4914. ++
  4915. ++ /* Default handling in case no-one waits for this event */
  4916. ++ if (!armed)
  4917. ++ brcmf_remove_interface(ifp, false);
  4918. ++ }
  4919. + }
  4920. +
  4921. + /**
  4922. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  4923. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  4924. +@@ -2290,8 +2290,7 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  4925. + else
  4926. + err = 0;
  4927. + }
  4928. +- if (err)
  4929. +- brcmf_remove_interface(vif->ifp, true);
  4930. ++ brcmf_remove_interface(vif->ifp, true);
  4931. +
  4932. + brcmf_cfg80211_arm_vif_event(cfg, NULL);
  4933. + if (vif->wdev.iftype != NL80211_IFTYPE_P2P_DEVICE)
  4934. 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
  4935. new file mode 100644
  4936. index 0000000..2f7165e
  4937. --- /dev/null
  4938. +++ b/package/kernel/mac80211/patches/319-0006-brcmfmac-support-removing-AP-interfaces-with-interfa.patch
  4939. @@ -0,0 +1,84 @@
  4940. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4941. +Date: Wed, 29 Jun 2016 21:54:27 +0200
  4942. +Subject: [PATCH] brcmfmac: support removing AP interfaces with
  4943. + "interface_remove"
  4944. +MIME-Version: 1.0
  4945. +Content-Type: text/plain; charset=UTF-8
  4946. +Content-Transfer-Encoding: 8bit
  4947. +
  4948. +New firmwares (e.g. 10.10.69.36 for BCM4366) support "interface_remove"
  4949. +for removing interfaces. Try to use this method on cfg80211 request. In
  4950. +case of older firmwares (e.g. 7.35.177.56 for BCM43602 as I tested) this
  4951. +will just result in firmware rejecting command and this won't change any
  4952. +behavior.
  4953. +
  4954. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4955. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4956. +---
  4957. +
  4958. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  4959. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  4960. +@@ -785,12 +785,48 @@ s32 brcmf_notify_escan_complete(struct b
  4961. + return err;
  4962. + }
  4963. +
  4964. ++static int brcmf_cfg80211_del_ap_iface(struct wiphy *wiphy,
  4965. ++ struct wireless_dev *wdev)
  4966. ++{
  4967. ++ struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy);
  4968. ++ struct net_device *ndev = wdev->netdev;
  4969. ++ struct brcmf_if *ifp = netdev_priv(ndev);
  4970. ++ int ret;
  4971. ++ int err;
  4972. ++
  4973. ++ brcmf_cfg80211_arm_vif_event(cfg, ifp->vif);
  4974. ++
  4975. ++ err = brcmf_fil_bsscfg_data_set(ifp, "interface_remove", NULL, 0);
  4976. ++ if (err) {
  4977. ++ brcmf_err("interface_remove failed %d\n", err);
  4978. ++ goto err_unarm;
  4979. ++ }
  4980. ++
  4981. ++ /* wait for firmware event */
  4982. ++ ret = brcmf_cfg80211_wait_vif_event(cfg, BRCMF_E_IF_DEL,
  4983. ++ BRCMF_VIF_EVENT_TIMEOUT);
  4984. ++ if (!ret) {
  4985. ++ brcmf_err("timeout occurred\n");
  4986. ++ err = -EIO;
  4987. ++ goto err_unarm;
  4988. ++ }
  4989. ++
  4990. ++ brcmf_remove_interface(ifp, true);
  4991. ++
  4992. ++err_unarm:
  4993. ++ brcmf_cfg80211_arm_vif_event(cfg, NULL);
  4994. ++ return err;
  4995. ++}
  4996. ++
  4997. + static
  4998. + int brcmf_cfg80211_del_iface(struct wiphy *wiphy, struct wireless_dev *wdev)
  4999. + {
  5000. + struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy);
  5001. + struct net_device *ndev = wdev->netdev;
  5002. +
  5003. ++ if (ndev && ndev == cfg_to_ndev(cfg))
  5004. ++ return -ENOTSUPP;
  5005. ++
  5006. + /* vif event pending in firmware */
  5007. + if (brcmf_cfg80211_vif_event_armed(cfg))
  5008. + return -EBUSY;
  5009. +@@ -807,12 +843,13 @@ int brcmf_cfg80211_del_iface(struct wiph
  5010. + switch (wdev->iftype) {
  5011. + case NL80211_IFTYPE_ADHOC:
  5012. + case NL80211_IFTYPE_STATION:
  5013. +- case NL80211_IFTYPE_AP:
  5014. + case NL80211_IFTYPE_AP_VLAN:
  5015. + case NL80211_IFTYPE_WDS:
  5016. + case NL80211_IFTYPE_MONITOR:
  5017. + case NL80211_IFTYPE_MESH_POINT:
  5018. + return -EOPNOTSUPP;
  5019. ++ case NL80211_IFTYPE_AP:
  5020. ++ return brcmf_cfg80211_del_ap_iface(wiphy, wdev);
  5021. + case NL80211_IFTYPE_P2P_CLIENT:
  5022. + case NL80211_IFTYPE_P2P_GO:
  5023. + case NL80211_IFTYPE_P2P_DEVICE:
  5024. 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
  5025. deleted file mode 100644
  5026. index b646ab3..0000000
  5027. --- a/package/kernel/mac80211/patches/319-cfg80211-add-function-for-802.3-conversion-with-sepa.patch
  5028. +++ /dev/null
  5029. @@ -1,186 +0,0 @@
  5030. -From: Felix Fietkau <nbd@openwrt.org>
  5031. -Date: Tue, 2 Feb 2016 14:39:09 +0100
  5032. -Subject: [PATCH] cfg80211: add function for 802.3 conversion with separate
  5033. - output buffer
  5034. -
  5035. -Use skb_copy_bits in preparation for allowing fragmented skbs
  5036. -
  5037. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  5038. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  5039. ----
  5040. -
  5041. ---- a/net/wireless/util.c
  5042. -+++ b/net/wireless/util.c
  5043. -@@ -393,9 +393,9 @@ unsigned int ieee80211_get_hdrlen_from_s
  5044. - }
  5045. - EXPORT_SYMBOL(ieee80211_get_hdrlen_from_skb);
  5046. -
  5047. --unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr)
  5048. -+static unsigned int __ieee80211_get_mesh_hdrlen(u8 flags)
  5049. - {
  5050. -- int ae = meshhdr->flags & MESH_FLAGS_AE;
  5051. -+ int ae = flags & MESH_FLAGS_AE;
  5052. - /* 802.11-2012, 8.2.4.7.3 */
  5053. - switch (ae) {
  5054. - default:
  5055. -@@ -407,21 +407,31 @@ unsigned int ieee80211_get_mesh_hdrlen(s
  5056. - return 18;
  5057. - }
  5058. - }
  5059. -+
  5060. -+unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr)
  5061. -+{
  5062. -+ return __ieee80211_get_mesh_hdrlen(meshhdr->flags);
  5063. -+}
  5064. - EXPORT_SYMBOL(ieee80211_get_mesh_hdrlen);
  5065. -
  5066. --int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
  5067. -- enum nl80211_iftype iftype)
  5068. -+static int __ieee80211_data_to_8023(struct sk_buff *skb, struct ethhdr *ehdr,
  5069. -+ const u8 *addr, enum nl80211_iftype iftype)
  5070. - {
  5071. - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
  5072. -- u16 hdrlen, ethertype;
  5073. -- u8 *payload;
  5074. -- u8 dst[ETH_ALEN];
  5075. -- u8 src[ETH_ALEN] __aligned(2);
  5076. -+ struct {
  5077. -+ u8 hdr[ETH_ALEN] __aligned(2);
  5078. -+ __be16 proto;
  5079. -+ } payload;
  5080. -+ struct ethhdr tmp;
  5081. -+ u16 hdrlen;
  5082. -+ u8 mesh_flags = 0;
  5083. -
  5084. - if (unlikely(!ieee80211_is_data_present(hdr->frame_control)))
  5085. - return -1;
  5086. -
  5087. - hdrlen = ieee80211_hdrlen(hdr->frame_control);
  5088. -+ if (skb->len < hdrlen + 8)
  5089. -+ return -1;
  5090. -
  5091. - /* convert IEEE 802.11 header + possible LLC headers into Ethernet
  5092. - * header
  5093. -@@ -432,8 +442,11 @@ int ieee80211_data_to_8023(struct sk_buf
  5094. - * 1 0 BSSID SA DA n/a
  5095. - * 1 1 RA TA DA SA
  5096. - */
  5097. -- memcpy(dst, ieee80211_get_DA(hdr), ETH_ALEN);
  5098. -- memcpy(src, ieee80211_get_SA(hdr), ETH_ALEN);
  5099. -+ memcpy(tmp.h_dest, ieee80211_get_DA(hdr), ETH_ALEN);
  5100. -+ memcpy(tmp.h_source, ieee80211_get_SA(hdr), ETH_ALEN);
  5101. -+
  5102. -+ if (iftype == NL80211_IFTYPE_MESH_POINT)
  5103. -+ skb_copy_bits(skb, hdrlen, &mesh_flags, 1);
  5104. -
  5105. - switch (hdr->frame_control &
  5106. - cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) {
  5107. -@@ -450,44 +463,31 @@ int ieee80211_data_to_8023(struct sk_buf
  5108. - iftype != NL80211_IFTYPE_STATION))
  5109. - return -1;
  5110. - if (iftype == NL80211_IFTYPE_MESH_POINT) {
  5111. -- struct ieee80211s_hdr *meshdr =
  5112. -- (struct ieee80211s_hdr *) (skb->data + hdrlen);
  5113. -- /* make sure meshdr->flags is on the linear part */
  5114. -- if (!pskb_may_pull(skb, hdrlen + 1))
  5115. -- return -1;
  5116. -- if (meshdr->flags & MESH_FLAGS_AE_A4)
  5117. -+ if (mesh_flags & MESH_FLAGS_AE_A4)
  5118. - return -1;
  5119. -- if (meshdr->flags & MESH_FLAGS_AE_A5_A6) {
  5120. -+ if (mesh_flags & MESH_FLAGS_AE_A5_A6) {
  5121. - skb_copy_bits(skb, hdrlen +
  5122. - offsetof(struct ieee80211s_hdr, eaddr1),
  5123. -- dst, ETH_ALEN);
  5124. -- skb_copy_bits(skb, hdrlen +
  5125. -- offsetof(struct ieee80211s_hdr, eaddr2),
  5126. -- src, ETH_ALEN);
  5127. -+ tmp.h_dest, 2 * ETH_ALEN);
  5128. - }
  5129. -- hdrlen += ieee80211_get_mesh_hdrlen(meshdr);
  5130. -+ hdrlen += __ieee80211_get_mesh_hdrlen(mesh_flags);
  5131. - }
  5132. - break;
  5133. - case cpu_to_le16(IEEE80211_FCTL_FROMDS):
  5134. - if ((iftype != NL80211_IFTYPE_STATION &&
  5135. - iftype != NL80211_IFTYPE_P2P_CLIENT &&
  5136. - iftype != NL80211_IFTYPE_MESH_POINT) ||
  5137. -- (is_multicast_ether_addr(dst) &&
  5138. -- ether_addr_equal(src, addr)))
  5139. -+ (is_multicast_ether_addr(tmp.h_dest) &&
  5140. -+ ether_addr_equal(tmp.h_source, addr)))
  5141. - return -1;
  5142. - if (iftype == NL80211_IFTYPE_MESH_POINT) {
  5143. -- struct ieee80211s_hdr *meshdr =
  5144. -- (struct ieee80211s_hdr *) (skb->data + hdrlen);
  5145. -- /* make sure meshdr->flags is on the linear part */
  5146. -- if (!pskb_may_pull(skb, hdrlen + 1))
  5147. -- return -1;
  5148. -- if (meshdr->flags & MESH_FLAGS_AE_A5_A6)
  5149. -+ if (mesh_flags & MESH_FLAGS_AE_A5_A6)
  5150. - return -1;
  5151. -- if (meshdr->flags & MESH_FLAGS_AE_A4)
  5152. -+ if (mesh_flags & MESH_FLAGS_AE_A4)
  5153. - skb_copy_bits(skb, hdrlen +
  5154. - offsetof(struct ieee80211s_hdr, eaddr1),
  5155. -- src, ETH_ALEN);
  5156. -- hdrlen += ieee80211_get_mesh_hdrlen(meshdr);
  5157. -+ tmp.h_source, ETH_ALEN);
  5158. -+ hdrlen += __ieee80211_get_mesh_hdrlen(mesh_flags);
  5159. - }
  5160. - break;
  5161. - case cpu_to_le16(0):
  5162. -@@ -498,33 +498,33 @@ int ieee80211_data_to_8023(struct sk_buf
  5163. - break;
  5164. - }
  5165. -
  5166. -- if (!pskb_may_pull(skb, hdrlen + 8))
  5167. -- return -1;
  5168. --
  5169. -- payload = skb->data + hdrlen;
  5170. -- ethertype = (payload[6] << 8) | payload[7];
  5171. -+ skb_copy_bits(skb, hdrlen, &payload, sizeof(payload));
  5172. -+ tmp.h_proto = payload.proto;
  5173. -
  5174. -- if (likely((ether_addr_equal(payload, rfc1042_header) &&
  5175. -- ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) ||
  5176. -- ether_addr_equal(payload, bridge_tunnel_header))) {
  5177. -+ if (likely((ether_addr_equal(payload.hdr, rfc1042_header) &&
  5178. -+ tmp.h_proto != htons(ETH_P_AARP) &&
  5179. -+ tmp.h_proto != htons(ETH_P_IPX)) ||
  5180. -+ ether_addr_equal(payload.hdr, bridge_tunnel_header)))
  5181. - /* remove RFC1042 or Bridge-Tunnel encapsulation and
  5182. - * replace EtherType */
  5183. -- skb_pull(skb, hdrlen + 6);
  5184. -- memcpy(skb_push(skb, ETH_ALEN), src, ETH_ALEN);
  5185. -- memcpy(skb_push(skb, ETH_ALEN), dst, ETH_ALEN);
  5186. -- } else {
  5187. -- struct ethhdr *ehdr;
  5188. -- __be16 len;
  5189. -+ hdrlen += ETH_ALEN + 2;
  5190. -+ else
  5191. -+ tmp.h_proto = htons(skb->len);
  5192. -
  5193. -- skb_pull(skb, hdrlen);
  5194. -- len = htons(skb->len);
  5195. -+ pskb_pull(skb, hdrlen);
  5196. -+
  5197. -+ if (!ehdr)
  5198. - ehdr = (struct ethhdr *) skb_push(skb, sizeof(struct ethhdr));
  5199. -- memcpy(ehdr->h_dest, dst, ETH_ALEN);
  5200. -- memcpy(ehdr->h_source, src, ETH_ALEN);
  5201. -- ehdr->h_proto = len;
  5202. -- }
  5203. -+ memcpy(ehdr, &tmp, sizeof(tmp));
  5204. -+
  5205. - return 0;
  5206. - }
  5207. -+
  5208. -+int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
  5209. -+ enum nl80211_iftype iftype)
  5210. -+{
  5211. -+ return __ieee80211_data_to_8023(skb, NULL, addr, iftype);
  5212. -+}
  5213. - EXPORT_SYMBOL(ieee80211_data_to_8023);
  5214. -
  5215. - int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr,
  5216. diff --git a/package/kernel/mac80211/patches/320-ath9k-Switch-to-using-mac80211-intermediate-software.patch b/package/kernel/mac80211/patches/320-ath9k-Switch-to-using-mac80211-intermediate-software.patch
  5217. new file mode 100644
  5218. index 0000000..f8b8f86
  5219. --- /dev/null
  5220. +++ b/package/kernel/mac80211/patches/320-ath9k-Switch-to-using-mac80211-intermediate-software.patch
  5221. @@ -0,0 +1,871 @@
  5222. +From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= <toke@toke.dk>
  5223. +Date: Wed, 6 Jul 2016 21:34:17 +0200
  5224. +Subject: [PATCH] ath9k: Switch to using mac80211 intermediate software queues.
  5225. +MIME-Version: 1.0
  5226. +Content-Type: text/plain; charset=UTF-8
  5227. +Content-Transfer-Encoding: 8bit
  5228. +
  5229. +This switches ath9k over to using the mac80211 intermediate software
  5230. +queueing mechanism for data packets. It removes the queueing inside the
  5231. +driver, except for the retry queue, and instead pulls from mac80211 when
  5232. +a packet is needed. The retry queue is used to store a packet that was
  5233. +pulled but can't be sent immediately.
  5234. +
  5235. +The old code path in ath_tx_start that would queue packets has been
  5236. +removed completely, as has the qlen limit tunables (since there's no
  5237. +longer a queue in the driver to limit).
  5238. +
  5239. +Based on Tim's original patch set, but reworked quite thoroughly.
  5240. +
  5241. +Cc: Tim Shepard <shep@alum.mit.edu>
  5242. +Cc: Felix Fietkau <nbd@nbd.name>
  5243. +Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
  5244. +---
  5245. +
  5246. +--- a/drivers/net/wireless/ath/ath9k/ath9k.h
  5247. ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  5248. +@@ -91,7 +91,6 @@ int ath_descdma_setup(struct ath_softc *
  5249. + #define ATH_RXBUF 512
  5250. + #define ATH_TXBUF 512
  5251. + #define ATH_TXBUF_RESERVE 5
  5252. +-#define ATH_MAX_QDEPTH (ATH_TXBUF / 4 - ATH_TXBUF_RESERVE)
  5253. + #define ATH_TXMAXTRY 13
  5254. + #define ATH_MAX_SW_RETRIES 30
  5255. +
  5256. +@@ -145,7 +144,9 @@ int ath_descdma_setup(struct ath_softc *
  5257. + #define BAW_WITHIN(_start, _bawsz, _seqno) \
  5258. + ((((_seqno) - (_start)) & 4095) < (_bawsz))
  5259. +
  5260. +-#define ATH_AN_2_TID(_an, _tidno) (&(_an)->tid[(_tidno)])
  5261. ++#define ATH_STA_2_TID(_sta, _tidno) ((struct ath_atx_tid *)(_sta)->txq[_tidno]->drv_priv)
  5262. ++#define ATH_VIF_2_TID(_vif) ((struct ath_atx_tid *)(_vif)->txq->drv_priv)
  5263. ++#define ATH_AN_2_TID(_an, _tidno) ((_an)->sta ? ATH_STA_2_TID((_an)->sta, _tidno) : ATH_VIF_2_TID((_an)->vif))
  5264. +
  5265. + #define IS_HT_RATE(rate) (rate & 0x80)
  5266. + #define IS_CCK_RATE(rate) ((rate >= 0x18) && (rate <= 0x1e))
  5267. +@@ -164,7 +165,6 @@ struct ath_txq {
  5268. + spinlock_t axq_lock;
  5269. + u32 axq_depth;
  5270. + u32 axq_ampdu_depth;
  5271. +- bool stopped;
  5272. + bool axq_tx_inprogress;
  5273. + struct list_head txq_fifo[ATH_TXFIFO_DEPTH];
  5274. + u8 txq_headidx;
  5275. +@@ -232,7 +232,6 @@ struct ath_buf {
  5276. +
  5277. + struct ath_atx_tid {
  5278. + struct list_head list;
  5279. +- struct sk_buff_head buf_q;
  5280. + struct sk_buff_head retry_q;
  5281. + struct ath_node *an;
  5282. + struct ath_txq *txq;
  5283. +@@ -247,13 +246,13 @@ struct ath_atx_tid {
  5284. + s8 bar_index;
  5285. + bool active;
  5286. + bool clear_ps_filter;
  5287. ++ bool has_queued;
  5288. + };
  5289. +
  5290. + struct ath_node {
  5291. + struct ath_softc *sc;
  5292. + struct ieee80211_sta *sta; /* station struct we're part of */
  5293. + struct ieee80211_vif *vif; /* interface with which we're associated */
  5294. +- struct ath_atx_tid tid[IEEE80211_NUM_TIDS];
  5295. +
  5296. + u16 maxampdu;
  5297. + u8 mpdudensity;
  5298. +@@ -276,7 +275,6 @@ struct ath_tx_control {
  5299. + struct ath_node *an;
  5300. + struct ieee80211_sta *sta;
  5301. + u8 paprd;
  5302. +- bool force_channel;
  5303. + };
  5304. +
  5305. +
  5306. +@@ -293,7 +291,6 @@ struct ath_tx {
  5307. + struct ath_descdma txdma;
  5308. + struct ath_txq *txq_map[IEEE80211_NUM_ACS];
  5309. + struct ath_txq *uapsdq;
  5310. +- u32 txq_max_pending[IEEE80211_NUM_ACS];
  5311. + u16 max_aggr_framelen[IEEE80211_NUM_ACS][4][32];
  5312. + };
  5313. +
  5314. +@@ -585,6 +582,7 @@ void ath9k_release_buffered_frames(struc
  5315. + u16 tids, int nframes,
  5316. + enum ieee80211_frame_release_type reason,
  5317. + bool more_data);
  5318. ++void ath9k_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *queue);
  5319. +
  5320. + /********/
  5321. + /* VIFs */
  5322. +--- a/drivers/net/wireless/ath/ath9k/channel.c
  5323. ++++ b/drivers/net/wireless/ath/ath9k/channel.c
  5324. +@@ -1007,7 +1007,6 @@ static void ath_scan_send_probe(struct a
  5325. + goto error;
  5326. +
  5327. + txctl.txq = sc->tx.txq_map[IEEE80211_AC_VO];
  5328. +- txctl.force_channel = true;
  5329. + if (ath_tx_start(sc->hw, skb, &txctl))
  5330. + goto error;
  5331. +
  5332. +@@ -1130,7 +1129,6 @@ ath_chanctx_send_vif_ps_frame(struct ath
  5333. + memset(&txctl, 0, sizeof(txctl));
  5334. + txctl.txq = sc->tx.txq_map[IEEE80211_AC_VO];
  5335. + txctl.sta = sta;
  5336. +- txctl.force_channel = true;
  5337. + if (ath_tx_start(sc->hw, skb, &txctl)) {
  5338. + ieee80211_free_txskb(sc->hw, skb);
  5339. + return false;
  5340. +--- a/drivers/net/wireless/ath/ath9k/debug.c
  5341. ++++ b/drivers/net/wireless/ath/ath9k/debug.c
  5342. +@@ -600,7 +600,6 @@ static int read_file_xmit(struct seq_fil
  5343. + PR("MPDUs XRetried: ", xretries);
  5344. + PR("Aggregates: ", a_aggr);
  5345. + PR("AMPDUs Queued HW:", a_queued_hw);
  5346. +- PR("AMPDUs Queued SW:", a_queued_sw);
  5347. + PR("AMPDUs Completed:", a_completed);
  5348. + PR("AMPDUs Retried: ", a_retries);
  5349. + PR("AMPDUs XRetried: ", a_xretries);
  5350. +@@ -629,8 +628,7 @@ static void print_queue(struct ath_softc
  5351. + seq_printf(file, "%s: %d ", "qnum", txq->axq_qnum);
  5352. + seq_printf(file, "%s: %2d ", "qdepth", txq->axq_depth);
  5353. + seq_printf(file, "%s: %2d ", "ampdu-depth", txq->axq_ampdu_depth);
  5354. +- seq_printf(file, "%s: %3d ", "pending", txq->pending_frames);
  5355. +- seq_printf(file, "%s: %d\n", "stopped", txq->stopped);
  5356. ++ seq_printf(file, "%s: %3d\n", "pending", txq->pending_frames);
  5357. +
  5358. + ath_txq_unlock(sc, txq);
  5359. + }
  5360. +@@ -1208,7 +1206,6 @@ static const char ath9k_gstrings_stats[]
  5361. + AMKSTR(d_tx_mpdu_xretries),
  5362. + AMKSTR(d_tx_aggregates),
  5363. + AMKSTR(d_tx_ampdus_queued_hw),
  5364. +- AMKSTR(d_tx_ampdus_queued_sw),
  5365. + AMKSTR(d_tx_ampdus_completed),
  5366. + AMKSTR(d_tx_ampdu_retries),
  5367. + AMKSTR(d_tx_ampdu_xretries),
  5368. +@@ -1288,7 +1285,6 @@ void ath9k_get_et_stats(struct ieee80211
  5369. + AWDATA(xretries);
  5370. + AWDATA(a_aggr);
  5371. + AWDATA(a_queued_hw);
  5372. +- AWDATA(a_queued_sw);
  5373. + AWDATA(a_completed);
  5374. + AWDATA(a_retries);
  5375. + AWDATA(a_xretries);
  5376. +@@ -1346,14 +1342,6 @@ int ath9k_init_debug(struct ath_hw *ah)
  5377. + read_file_xmit);
  5378. + debugfs_create_devm_seqfile(sc->dev, "queues", sc->debug.debugfs_phy,
  5379. + read_file_queues);
  5380. +- debugfs_create_u32("qlen_bk", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
  5381. +- &sc->tx.txq_max_pending[IEEE80211_AC_BK]);
  5382. +- debugfs_create_u32("qlen_be", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
  5383. +- &sc->tx.txq_max_pending[IEEE80211_AC_BE]);
  5384. +- debugfs_create_u32("qlen_vi", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
  5385. +- &sc->tx.txq_max_pending[IEEE80211_AC_VI]);
  5386. +- debugfs_create_u32("qlen_vo", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
  5387. +- &sc->tx.txq_max_pending[IEEE80211_AC_VO]);
  5388. + debugfs_create_devm_seqfile(sc->dev, "misc", sc->debug.debugfs_phy,
  5389. + read_file_misc);
  5390. + debugfs_create_devm_seqfile(sc->dev, "reset", sc->debug.debugfs_phy,
  5391. +--- a/drivers/net/wireless/ath/ath9k/debug.h
  5392. ++++ b/drivers/net/wireless/ath/ath9k/debug.h
  5393. +@@ -147,7 +147,6 @@ struct ath_interrupt_stats {
  5394. + * @completed: Total MPDUs (non-aggr) completed
  5395. + * @a_aggr: Total no. of aggregates queued
  5396. + * @a_queued_hw: Total AMPDUs queued to hardware
  5397. +- * @a_queued_sw: Total AMPDUs queued to software queues
  5398. + * @a_completed: Total AMPDUs completed
  5399. + * @a_retries: No. of AMPDUs retried (SW)
  5400. + * @a_xretries: No. of AMPDUs dropped due to xretries
  5401. +@@ -174,7 +173,6 @@ struct ath_tx_stats {
  5402. + u32 xretries;
  5403. + u32 a_aggr;
  5404. + u32 a_queued_hw;
  5405. +- u32 a_queued_sw;
  5406. + u32 a_completed;
  5407. + u32 a_retries;
  5408. + u32 a_xretries;
  5409. +--- a/drivers/net/wireless/ath/ath9k/debug_sta.c
  5410. ++++ b/drivers/net/wireless/ath/ath9k/debug_sta.c
  5411. +@@ -52,8 +52,8 @@ static ssize_t read_file_node_aggr(struc
  5412. + "TID", "SEQ_START", "SEQ_NEXT", "BAW_SIZE",
  5413. + "BAW_HEAD", "BAW_TAIL", "BAR_IDX", "SCHED", "PAUSED");
  5414. +
  5415. +- for (tidno = 0, tid = &an->tid[tidno];
  5416. +- tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
  5417. ++ for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) {
  5418. ++ tid = ATH_STA_2_TID(an->sta, tidno);
  5419. + txq = tid->txq;
  5420. + ath_txq_lock(sc, txq);
  5421. + if (tid->active) {
  5422. +--- a/drivers/net/wireless/ath/ath9k/init.c
  5423. ++++ b/drivers/net/wireless/ath/ath9k/init.c
  5424. +@@ -358,7 +358,6 @@ static int ath9k_init_queues(struct ath_
  5425. + for (i = 0; i < IEEE80211_NUM_ACS; i++) {
  5426. + sc->tx.txq_map[i] = ath_txq_setup(sc, ATH9K_TX_QUEUE_DATA, i);
  5427. + sc->tx.txq_map[i]->mac80211_qnum = i;
  5428. +- sc->tx.txq_max_pending[i] = ATH_MAX_QDEPTH;
  5429. + }
  5430. + return 0;
  5431. + }
  5432. +@@ -873,6 +872,7 @@ static void ath9k_set_hw_capab(struct at
  5433. + hw->max_rate_tries = 10;
  5434. + hw->sta_data_size = sizeof(struct ath_node);
  5435. + hw->vif_data_size = sizeof(struct ath_vif);
  5436. ++ hw->txq_data_size = sizeof(struct ath_atx_tid);
  5437. + hw->extra_tx_headroom = 4;
  5438. +
  5439. + hw->wiphy->available_antennas_rx = BIT(ah->caps.max_rxchains) - 1;
  5440. +--- a/drivers/net/wireless/ath/ath9k/main.c
  5441. ++++ b/drivers/net/wireless/ath/ath9k/main.c
  5442. +@@ -2695,4 +2695,5 @@ struct ieee80211_ops ath9k_ops = {
  5443. + .sw_scan_start = ath9k_sw_scan_start,
  5444. + .sw_scan_complete = ath9k_sw_scan_complete,
  5445. + .get_txpower = ath9k_get_txpower,
  5446. ++ .wake_tx_queue = ath9k_wake_tx_queue,
  5447. + };
  5448. +--- a/drivers/net/wireless/ath/ath9k/xmit.c
  5449. ++++ b/drivers/net/wireless/ath/ath9k/xmit.c
  5450. +@@ -65,6 +65,8 @@ static struct ath_buf *ath_tx_setup_buff
  5451. + struct ath_txq *txq,
  5452. + struct ath_atx_tid *tid,
  5453. + struct sk_buff *skb);
  5454. ++static int ath_tx_prepare(struct ieee80211_hw *hw, struct sk_buff *skb,
  5455. ++ struct ath_tx_control *txctl);
  5456. +
  5457. + enum {
  5458. + MCS_HT20,
  5459. +@@ -118,6 +120,26 @@ static void ath_tx_queue_tid(struct ath_
  5460. + list_add_tail(&tid->list, list);
  5461. + }
  5462. +
  5463. ++void ath9k_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *queue)
  5464. ++{
  5465. ++ struct ath_softc *sc = hw->priv;
  5466. ++ struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  5467. ++ struct ath_atx_tid *tid = (struct ath_atx_tid *) queue->drv_priv;
  5468. ++ struct ath_txq *txq = tid->txq;
  5469. ++
  5470. ++ ath_dbg(common, QUEUE, "Waking TX queue: %pM (%d)\n",
  5471. ++ queue->sta ? queue->sta->addr : queue->vif->addr,
  5472. ++ tid->tidno);
  5473. ++
  5474. ++ ath_txq_lock(sc, txq);
  5475. ++
  5476. ++ tid->has_queued = true;
  5477. ++ ath_tx_queue_tid(sc, txq, tid);
  5478. ++ ath_txq_schedule(sc, txq);
  5479. ++
  5480. ++ ath_txq_unlock(sc, txq);
  5481. ++}
  5482. ++
  5483. + static struct ath_frame_info *get_frame_info(struct sk_buff *skb)
  5484. + {
  5485. + struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
  5486. +@@ -160,7 +182,6 @@ static void ath_set_rates(struct ieee802
  5487. + static void ath_txq_skb_done(struct ath_softc *sc, struct ath_txq *txq,
  5488. + struct sk_buff *skb)
  5489. + {
  5490. +- struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  5491. + struct ath_frame_info *fi = get_frame_info(skb);
  5492. + int q = fi->txq;
  5493. +
  5494. +@@ -171,14 +192,6 @@ static void ath_txq_skb_done(struct ath_
  5495. + if (WARN_ON(--txq->pending_frames < 0))
  5496. + txq->pending_frames = 0;
  5497. +
  5498. +- if (txq->stopped &&
  5499. +- txq->pending_frames < sc->tx.txq_max_pending[q]) {
  5500. +- if (ath9k_is_chanctx_enabled())
  5501. +- ieee80211_wake_queue(sc->hw, info->hw_queue);
  5502. +- else
  5503. +- ieee80211_wake_queue(sc->hw, q);
  5504. +- txq->stopped = false;
  5505. +- }
  5506. + }
  5507. +
  5508. + static struct ath_atx_tid *
  5509. +@@ -188,9 +201,47 @@ ath_get_skb_tid(struct ath_softc *sc, st
  5510. + return ATH_AN_2_TID(an, tidno);
  5511. + }
  5512. +
  5513. ++static struct sk_buff *
  5514. ++ath_tid_pull(struct ath_atx_tid *tid)
  5515. ++{
  5516. ++ struct ath_softc *sc = tid->an->sc;
  5517. ++ struct ieee80211_hw *hw = sc->hw;
  5518. ++ struct ath_tx_control txctl = {
  5519. ++ .txq = tid->txq,
  5520. ++ .sta = tid->an->sta,
  5521. ++ };
  5522. ++ struct sk_buff *skb;
  5523. ++ struct ath_frame_info *fi;
  5524. ++ int q;
  5525. ++
  5526. ++ if (!tid->has_queued)
  5527. ++ return NULL;
  5528. ++
  5529. ++ skb = ieee80211_tx_dequeue(hw, container_of((void*)tid, struct ieee80211_txq, drv_priv));
  5530. ++ if (!skb) {
  5531. ++ tid->has_queued = false;
  5532. ++ return NULL;
  5533. ++ }
  5534. ++
  5535. ++ if (ath_tx_prepare(hw, skb, &txctl)) {
  5536. ++ ieee80211_free_txskb(hw, skb);
  5537. ++ return NULL;
  5538. ++ }
  5539. ++
  5540. ++ q = skb_get_queue_mapping(skb);
  5541. ++ if (tid->txq == sc->tx.txq_map[q]) {
  5542. ++ fi = get_frame_info(skb);
  5543. ++ fi->txq = q;
  5544. ++ ++tid->txq->pending_frames;
  5545. ++ }
  5546. ++
  5547. ++ return skb;
  5548. ++ }
  5549. ++
  5550. ++
  5551. + static bool ath_tid_has_buffered(struct ath_atx_tid *tid)
  5552. + {
  5553. +- return !skb_queue_empty(&tid->buf_q) || !skb_queue_empty(&tid->retry_q);
  5554. ++ return !skb_queue_empty(&tid->retry_q) || tid->has_queued;
  5555. + }
  5556. +
  5557. + static struct sk_buff *ath_tid_dequeue(struct ath_atx_tid *tid)
  5558. +@@ -199,46 +250,11 @@ static struct sk_buff *ath_tid_dequeue(s
  5559. +
  5560. + skb = __skb_dequeue(&tid->retry_q);
  5561. + if (!skb)
  5562. +- skb = __skb_dequeue(&tid->buf_q);
  5563. ++ skb = ath_tid_pull(tid);
  5564. +
  5565. + return skb;
  5566. + }
  5567. +
  5568. +-/*
  5569. +- * ath_tx_tid_change_state:
  5570. +- * - clears a-mpdu flag of previous session
  5571. +- * - force sequence number allocation to fix next BlockAck Window
  5572. +- */
  5573. +-static void
  5574. +-ath_tx_tid_change_state(struct ath_softc *sc, struct ath_atx_tid *tid)
  5575. +-{
  5576. +- struct ath_txq *txq = tid->txq;
  5577. +- struct ieee80211_tx_info *tx_info;
  5578. +- struct sk_buff *skb, *tskb;
  5579. +- struct ath_buf *bf;
  5580. +- struct ath_frame_info *fi;
  5581. +-
  5582. +- skb_queue_walk_safe(&tid->buf_q, skb, tskb) {
  5583. +- fi = get_frame_info(skb);
  5584. +- bf = fi->bf;
  5585. +-
  5586. +- tx_info = IEEE80211_SKB_CB(skb);
  5587. +- tx_info->flags &= ~IEEE80211_TX_CTL_AMPDU;
  5588. +-
  5589. +- if (bf)
  5590. +- continue;
  5591. +-
  5592. +- bf = ath_tx_setup_buffer(sc, txq, tid, skb);
  5593. +- if (!bf) {
  5594. +- __skb_unlink(skb, &tid->buf_q);
  5595. +- ath_txq_skb_done(sc, txq, skb);
  5596. +- ieee80211_free_txskb(sc->hw, skb);
  5597. +- continue;
  5598. +- }
  5599. +- }
  5600. +-
  5601. +-}
  5602. +-
  5603. + static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
  5604. + {
  5605. + struct ath_txq *txq = tid->txq;
  5606. +@@ -873,20 +889,16 @@ static int ath_compute_num_delims(struct
  5607. +
  5608. + static struct ath_buf *
  5609. + ath_tx_get_tid_subframe(struct ath_softc *sc, struct ath_txq *txq,
  5610. +- struct ath_atx_tid *tid, struct sk_buff_head **q)
  5611. ++ struct ath_atx_tid *tid)
  5612. + {
  5613. + struct ieee80211_tx_info *tx_info;
  5614. + struct ath_frame_info *fi;
  5615. +- struct sk_buff *skb;
  5616. ++ struct sk_buff *skb, *first_skb = NULL;
  5617. + struct ath_buf *bf;
  5618. + u16 seqno;
  5619. +
  5620. + while (1) {
  5621. +- *q = &tid->retry_q;
  5622. +- if (skb_queue_empty(*q))
  5623. +- *q = &tid->buf_q;
  5624. +-
  5625. +- skb = skb_peek(*q);
  5626. ++ skb = ath_tid_dequeue(tid);
  5627. + if (!skb)
  5628. + break;
  5629. +
  5630. +@@ -898,7 +910,6 @@ ath_tx_get_tid_subframe(struct ath_softc
  5631. + bf->bf_state.stale = false;
  5632. +
  5633. + if (!bf) {
  5634. +- __skb_unlink(skb, *q);
  5635. + ath_txq_skb_done(sc, txq, skb);
  5636. + ieee80211_free_txskb(sc->hw, skb);
  5637. + continue;
  5638. +@@ -927,8 +938,19 @@ ath_tx_get_tid_subframe(struct ath_softc
  5639. + seqno = bf->bf_state.seqno;
  5640. +
  5641. + /* do not step over block-ack window */
  5642. +- if (!BAW_WITHIN(tid->seq_start, tid->baw_size, seqno))
  5643. ++ if (!BAW_WITHIN(tid->seq_start, tid->baw_size, seqno)) {
  5644. ++ __skb_queue_tail(&tid->retry_q, skb);
  5645. ++
  5646. ++ /* If there are other skbs in the retry q, they are
  5647. ++ * probably within the BAW, so loop immediately to get
  5648. ++ * one of them. Otherwise the queue can get stuck. */
  5649. ++ if (!skb_queue_is_first(&tid->retry_q, skb) && skb != first_skb) {
  5650. ++ if(!first_skb) /* infinite loop prevention */
  5651. ++ first_skb = skb;
  5652. ++ continue;
  5653. ++ }
  5654. + break;
  5655. ++ }
  5656. +
  5657. + if (tid->bar_index > ATH_BA_INDEX(tid->seq_start, seqno)) {
  5658. + struct ath_tx_status ts = {};
  5659. +@@ -936,7 +958,6 @@ ath_tx_get_tid_subframe(struct ath_softc
  5660. +
  5661. + INIT_LIST_HEAD(&bf_head);
  5662. + list_add(&bf->list, &bf_head);
  5663. +- __skb_unlink(skb, *q);
  5664. + ath_tx_update_baw(sc, tid, seqno);
  5665. + ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0);
  5666. + continue;
  5667. +@@ -948,11 +969,10 @@ ath_tx_get_tid_subframe(struct ath_softc
  5668. + return NULL;
  5669. + }
  5670. +
  5671. +-static bool
  5672. ++static int
  5673. + ath_tx_form_aggr(struct ath_softc *sc, struct ath_txq *txq,
  5674. + struct ath_atx_tid *tid, struct list_head *bf_q,
  5675. +- struct ath_buf *bf_first, struct sk_buff_head *tid_q,
  5676. +- int *aggr_len)
  5677. ++ struct ath_buf *bf_first)
  5678. + {
  5679. + #define PADBYTES(_len) ((4 - ((_len) % 4)) % 4)
  5680. + struct ath_buf *bf = bf_first, *bf_prev = NULL;
  5681. +@@ -962,12 +982,13 @@ ath_tx_form_aggr(struct ath_softc *sc, s
  5682. + struct ieee80211_tx_info *tx_info;
  5683. + struct ath_frame_info *fi;
  5684. + struct sk_buff *skb;
  5685. +- bool closed = false;
  5686. ++
  5687. +
  5688. + bf = bf_first;
  5689. + aggr_limit = ath_lookup_rate(sc, bf, tid);
  5690. +
  5691. +- do {
  5692. ++ while (bf)
  5693. ++ {
  5694. + skb = bf->bf_mpdu;
  5695. + fi = get_frame_info(skb);
  5696. +
  5697. +@@ -976,12 +997,12 @@ ath_tx_form_aggr(struct ath_softc *sc, s
  5698. + if (nframes) {
  5699. + if (aggr_limit < al + bpad + al_delta ||
  5700. + ath_lookup_legacy(bf) || nframes >= h_baw)
  5701. +- break;
  5702. ++ goto stop;
  5703. +
  5704. + tx_info = IEEE80211_SKB_CB(bf->bf_mpdu);
  5705. + if ((tx_info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE) ||
  5706. + !(tx_info->flags & IEEE80211_TX_CTL_AMPDU))
  5707. +- break;
  5708. ++ goto stop;
  5709. + }
  5710. +
  5711. + /* add padding for previous frame to aggregation length */
  5712. +@@ -1003,20 +1024,18 @@ ath_tx_form_aggr(struct ath_softc *sc, s
  5713. + ath_tx_addto_baw(sc, tid, bf);
  5714. + bf->bf_state.ndelim = ndelim;
  5715. +
  5716. +- __skb_unlink(skb, tid_q);
  5717. + list_add_tail(&bf->list, bf_q);
  5718. + if (bf_prev)
  5719. + bf_prev->bf_next = bf;
  5720. +
  5721. + bf_prev = bf;
  5722. +
  5723. +- bf = ath_tx_get_tid_subframe(sc, txq, tid, &tid_q);
  5724. +- if (!bf) {
  5725. +- closed = true;
  5726. +- break;
  5727. +- }
  5728. +- } while (ath_tid_has_buffered(tid));
  5729. +-
  5730. ++ bf = ath_tx_get_tid_subframe(sc, txq, tid);
  5731. ++ }
  5732. ++ goto finish;
  5733. ++stop:
  5734. ++ __skb_queue_tail(&tid->retry_q, bf->bf_mpdu);
  5735. ++finish:
  5736. + bf = bf_first;
  5737. + bf->bf_lastbf = bf_prev;
  5738. +
  5739. +@@ -1027,9 +1046,7 @@ ath_tx_form_aggr(struct ath_softc *sc, s
  5740. + TX_STAT_INC(txq->axq_qnum, a_aggr);
  5741. + }
  5742. +
  5743. +- *aggr_len = al;
  5744. +-
  5745. +- return closed;
  5746. ++ return al;
  5747. + #undef PADBYTES
  5748. + }
  5749. +
  5750. +@@ -1406,18 +1423,15 @@ static void ath_tx_fill_desc(struct ath_
  5751. + static void
  5752. + ath_tx_form_burst(struct ath_softc *sc, struct ath_txq *txq,
  5753. + struct ath_atx_tid *tid, struct list_head *bf_q,
  5754. +- struct ath_buf *bf_first, struct sk_buff_head *tid_q)
  5755. ++ struct ath_buf *bf_first)
  5756. + {
  5757. + struct ath_buf *bf = bf_first, *bf_prev = NULL;
  5758. +- struct sk_buff *skb;
  5759. + int nframes = 0;
  5760. +
  5761. + do {
  5762. + struct ieee80211_tx_info *tx_info;
  5763. +- skb = bf->bf_mpdu;
  5764. +
  5765. + nframes++;
  5766. +- __skb_unlink(skb, tid_q);
  5767. + list_add_tail(&bf->list, bf_q);
  5768. + if (bf_prev)
  5769. + bf_prev->bf_next = bf;
  5770. +@@ -1426,13 +1440,15 @@ ath_tx_form_burst(struct ath_softc *sc,
  5771. + if (nframes >= 2)
  5772. + break;
  5773. +
  5774. +- bf = ath_tx_get_tid_subframe(sc, txq, tid, &tid_q);
  5775. ++ bf = ath_tx_get_tid_subframe(sc, txq, tid);
  5776. + if (!bf)
  5777. + break;
  5778. +
  5779. + tx_info = IEEE80211_SKB_CB(bf->bf_mpdu);
  5780. +- if (tx_info->flags & IEEE80211_TX_CTL_AMPDU)
  5781. ++ if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) {
  5782. ++ __skb_queue_tail(&tid->retry_q, bf->bf_mpdu);
  5783. + break;
  5784. ++ }
  5785. +
  5786. + ath_set_rates(tid->an->vif, tid->an->sta, bf, false);
  5787. + } while (1);
  5788. +@@ -1443,34 +1459,33 @@ static bool ath_tx_sched_aggr(struct ath
  5789. + {
  5790. + struct ath_buf *bf;
  5791. + struct ieee80211_tx_info *tx_info;
  5792. +- struct sk_buff_head *tid_q;
  5793. + struct list_head bf_q;
  5794. + int aggr_len = 0;
  5795. +- bool aggr, last = true;
  5796. ++ bool aggr;
  5797. +
  5798. + if (!ath_tid_has_buffered(tid))
  5799. + return false;
  5800. +
  5801. + INIT_LIST_HEAD(&bf_q);
  5802. +
  5803. +- bf = ath_tx_get_tid_subframe(sc, txq, tid, &tid_q);
  5804. ++ bf = ath_tx_get_tid_subframe(sc, txq, tid);
  5805. + if (!bf)
  5806. + return false;
  5807. +
  5808. + tx_info = IEEE80211_SKB_CB(bf->bf_mpdu);
  5809. + aggr = !!(tx_info->flags & IEEE80211_TX_CTL_AMPDU);
  5810. + if ((aggr && txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH) ||
  5811. +- (!aggr && txq->axq_depth >= ATH_NON_AGGR_MIN_QDEPTH)) {
  5812. ++ (!aggr && txq->axq_depth >= ATH_NON_AGGR_MIN_QDEPTH)) {
  5813. ++ __skb_queue_tail(&tid->retry_q, bf->bf_mpdu);
  5814. + *stop = true;
  5815. + return false;
  5816. + }
  5817. +
  5818. + ath_set_rates(tid->an->vif, tid->an->sta, bf, false);
  5819. + if (aggr)
  5820. +- last = ath_tx_form_aggr(sc, txq, tid, &bf_q, bf,
  5821. +- tid_q, &aggr_len);
  5822. ++ aggr_len = ath_tx_form_aggr(sc, txq, tid, &bf_q, bf);
  5823. + else
  5824. +- ath_tx_form_burst(sc, txq, tid, &bf_q, bf, tid_q);
  5825. ++ ath_tx_form_burst(sc, txq, tid, &bf_q, bf);
  5826. +
  5827. + if (list_empty(&bf_q))
  5828. + return false;
  5829. +@@ -1513,9 +1528,6 @@ int ath_tx_aggr_start(struct ath_softc *
  5830. + an->mpdudensity = density;
  5831. + }
  5832. +
  5833. +- /* force sequence number allocation for pending frames */
  5834. +- ath_tx_tid_change_state(sc, txtid);
  5835. +-
  5836. + txtid->active = true;
  5837. + *ssn = txtid->seq_start = txtid->seq_next;
  5838. + txtid->bar_index = -1;
  5839. +@@ -1540,7 +1552,6 @@ void ath_tx_aggr_stop(struct ath_softc *
  5840. + ath_txq_lock(sc, txq);
  5841. + txtid->active = false;
  5842. + ath_tx_flush_tid(sc, txtid);
  5843. +- ath_tx_tid_change_state(sc, txtid);
  5844. + ath_txq_unlock_complete(sc, txq);
  5845. + }
  5846. +
  5847. +@@ -1550,14 +1561,12 @@ void ath_tx_aggr_sleep(struct ieee80211_
  5848. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  5849. + struct ath_atx_tid *tid;
  5850. + struct ath_txq *txq;
  5851. +- bool buffered;
  5852. + int tidno;
  5853. +
  5854. + ath_dbg(common, XMIT, "%s called\n", __func__);
  5855. +
  5856. +- for (tidno = 0, tid = &an->tid[tidno];
  5857. +- tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
  5858. +-
  5859. ++ for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) {
  5860. ++ tid = ATH_AN_2_TID(an, tidno);
  5861. + txq = tid->txq;
  5862. +
  5863. + ath_txq_lock(sc, txq);
  5864. +@@ -1567,13 +1576,12 @@ void ath_tx_aggr_sleep(struct ieee80211_
  5865. + continue;
  5866. + }
  5867. +
  5868. +- buffered = ath_tid_has_buffered(tid);
  5869. ++ if (!skb_queue_empty(&tid->retry_q))
  5870. ++ ieee80211_sta_set_buffered(sta, tid->tidno, true);
  5871. +
  5872. + list_del_init(&tid->list);
  5873. +
  5874. + ath_txq_unlock(sc, txq);
  5875. +-
  5876. +- ieee80211_sta_set_buffered(sta, tidno, buffered);
  5877. + }
  5878. + }
  5879. +
  5880. +@@ -1586,19 +1594,16 @@ void ath_tx_aggr_wakeup(struct ath_softc
  5881. +
  5882. + ath_dbg(common, XMIT, "%s called\n", __func__);
  5883. +
  5884. +- for (tidno = 0, tid = &an->tid[tidno];
  5885. +- tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
  5886. +-
  5887. ++ for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) {
  5888. ++ tid = ATH_AN_2_TID(an, tidno);
  5889. + txq = tid->txq;
  5890. +
  5891. + ath_txq_lock(sc, txq);
  5892. + tid->clear_ps_filter = true;
  5893. +-
  5894. + if (ath_tid_has_buffered(tid)) {
  5895. + ath_tx_queue_tid(sc, txq, tid);
  5896. + ath_txq_schedule(sc, txq);
  5897. + }
  5898. +-
  5899. + ath_txq_unlock_complete(sc, txq);
  5900. + }
  5901. + }
  5902. +@@ -1621,11 +1626,6 @@ void ath_tx_aggr_resume(struct ath_softc
  5903. +
  5904. + tid->baw_size = IEEE80211_MIN_AMPDU_BUF << sta->ht_cap.ampdu_factor;
  5905. +
  5906. +- if (ath_tid_has_buffered(tid)) {
  5907. +- ath_tx_queue_tid(sc, txq, tid);
  5908. +- ath_txq_schedule(sc, txq);
  5909. +- }
  5910. +-
  5911. + ath_txq_unlock_complete(sc, txq);
  5912. + }
  5913. +
  5914. +@@ -1641,7 +1641,6 @@ void ath9k_release_buffered_frames(struc
  5915. + struct ieee80211_tx_info *info;
  5916. + struct list_head bf_q;
  5917. + struct ath_buf *bf_tail = NULL, *bf;
  5918. +- struct sk_buff_head *tid_q;
  5919. + int sent = 0;
  5920. + int i;
  5921. +
  5922. +@@ -1656,11 +1655,10 @@ void ath9k_release_buffered_frames(struc
  5923. +
  5924. + ath_txq_lock(sc, tid->txq);
  5925. + while (nframes > 0) {
  5926. +- bf = ath_tx_get_tid_subframe(sc, sc->tx.uapsdq, tid, &tid_q);
  5927. ++ bf = ath_tx_get_tid_subframe(sc, sc->tx.uapsdq, tid);
  5928. + if (!bf)
  5929. + break;
  5930. +
  5931. +- __skb_unlink(bf->bf_mpdu, tid_q);
  5932. + list_add_tail(&bf->list, &bf_q);
  5933. + ath_set_rates(tid->an->vif, tid->an->sta, bf, true);
  5934. + if (bf_isampdu(bf)) {
  5935. +@@ -1675,7 +1673,7 @@ void ath9k_release_buffered_frames(struc
  5936. + sent++;
  5937. + TX_STAT_INC(txq->axq_qnum, a_queued_hw);
  5938. +
  5939. +- if (an->sta && !ath_tid_has_buffered(tid))
  5940. ++ if (an->sta && skb_queue_empty(&tid->retry_q))
  5941. + ieee80211_sta_set_buffered(an->sta, i, false);
  5942. + }
  5943. + ath_txq_unlock_complete(sc, tid->txq);
  5944. +@@ -1902,13 +1900,7 @@ bool ath_drain_all_txq(struct ath_softc
  5945. + if (!ATH_TXQ_SETUP(sc, i))
  5946. + continue;
  5947. +
  5948. +- /*
  5949. +- * The caller will resume queues with ieee80211_wake_queues.
  5950. +- * Mark the queue as not stopped to prevent ath_tx_complete
  5951. +- * from waking the queue too early.
  5952. +- */
  5953. + txq = &sc->tx.txq[i];
  5954. +- txq->stopped = false;
  5955. + ath_draintxq(sc, txq);
  5956. + }
  5957. +
  5958. +@@ -2308,15 +2300,12 @@ int ath_tx_start(struct ieee80211_hw *hw
  5959. + struct ath_txq *txq = txctl->txq;
  5960. + struct ath_atx_tid *tid = NULL;
  5961. + struct ath_buf *bf;
  5962. +- bool queue, ps_resp;
  5963. ++ bool ps_resp;
  5964. + int q, ret;
  5965. +
  5966. + if (vif)
  5967. + avp = (void *)vif->drv_priv;
  5968. +
  5969. +- if (info->flags & IEEE80211_TX_CTL_TX_OFFCHAN)
  5970. +- txctl->force_channel = true;
  5971. +-
  5972. + ps_resp = !!(info->control.flags & IEEE80211_TX_CTRL_PS_RESPONSE);
  5973. +
  5974. + ret = ath_tx_prepare(hw, skb, txctl);
  5975. +@@ -2331,63 +2320,13 @@ int ath_tx_start(struct ieee80211_hw *hw
  5976. +
  5977. + q = skb_get_queue_mapping(skb);
  5978. +
  5979. ++ if (ps_resp)
  5980. ++ txq = sc->tx.uapsdq;
  5981. ++
  5982. + ath_txq_lock(sc, txq);
  5983. + if (txq == sc->tx.txq_map[q]) {
  5984. + fi->txq = q;
  5985. +- if (++txq->pending_frames > sc->tx.txq_max_pending[q] &&
  5986. +- !txq->stopped) {
  5987. +- if (ath9k_is_chanctx_enabled())
  5988. +- ieee80211_stop_queue(sc->hw, info->hw_queue);
  5989. +- else
  5990. +- ieee80211_stop_queue(sc->hw, q);
  5991. +- txq->stopped = true;
  5992. +- }
  5993. +- }
  5994. +-
  5995. +- queue = ieee80211_is_data_present(hdr->frame_control);
  5996. +-
  5997. +- /* If chanctx, queue all null frames while NOA could be there */
  5998. +- if (ath9k_is_chanctx_enabled() &&
  5999. +- ieee80211_is_nullfunc(hdr->frame_control) &&
  6000. +- !txctl->force_channel)
  6001. +- queue = true;
  6002. +-
  6003. +- /* Force queueing of all frames that belong to a virtual interface on
  6004. +- * a different channel context, to ensure that they are sent on the
  6005. +- * correct channel.
  6006. +- */
  6007. +- if (((avp && avp->chanctx != sc->cur_chan) ||
  6008. +- sc->cur_chan->stopped) && !txctl->force_channel) {
  6009. +- if (!txctl->an)
  6010. +- txctl->an = &avp->mcast_node;
  6011. +- queue = true;
  6012. +- ps_resp = false;
  6013. +- }
  6014. +-
  6015. +- if (txctl->an && queue)
  6016. +- tid = ath_get_skb_tid(sc, txctl->an, skb);
  6017. +-
  6018. +- if (ps_resp) {
  6019. +- ath_txq_unlock(sc, txq);
  6020. +- txq = sc->tx.uapsdq;
  6021. +- ath_txq_lock(sc, txq);
  6022. +- } else if (txctl->an && queue) {
  6023. +- WARN_ON(tid->txq != txctl->txq);
  6024. +-
  6025. +- if (info->flags & IEEE80211_TX_CTL_CLEAR_PS_FILT)
  6026. +- tid->clear_ps_filter = true;
  6027. +-
  6028. +- /*
  6029. +- * Add this frame to software queue for scheduling later
  6030. +- * for aggregation.
  6031. +- */
  6032. +- TX_STAT_INC(txq->axq_qnum, a_queued_sw);
  6033. +- __skb_queue_tail(&tid->buf_q, skb);
  6034. +- if (!txctl->an->sleeping)
  6035. +- ath_tx_queue_tid(sc, txq, tid);
  6036. +-
  6037. +- ath_txq_schedule(sc, txq);
  6038. +- goto out;
  6039. ++ ++txq->pending_frames;
  6040. + }
  6041. +
  6042. + bf = ath_tx_setup_buffer(sc, txq, tid, skb);
  6043. +@@ -2871,9 +2810,8 @@ void ath_tx_node_init(struct ath_softc *
  6044. + struct ath_atx_tid *tid;
  6045. + int tidno, acno;
  6046. +
  6047. +- for (tidno = 0, tid = &an->tid[tidno];
  6048. +- tidno < IEEE80211_NUM_TIDS;
  6049. +- tidno++, tid++) {
  6050. ++ for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) {
  6051. ++ tid = ATH_AN_2_TID(an, tidno);
  6052. + tid->an = an;
  6053. + tid->tidno = tidno;
  6054. + tid->seq_start = tid->seq_next = 0;
  6055. +@@ -2881,11 +2819,14 @@ void ath_tx_node_init(struct ath_softc *
  6056. + tid->baw_head = tid->baw_tail = 0;
  6057. + tid->active = false;
  6058. + tid->clear_ps_filter = true;
  6059. +- __skb_queue_head_init(&tid->buf_q);
  6060. ++ tid->has_queued = false;
  6061. + __skb_queue_head_init(&tid->retry_q);
  6062. + INIT_LIST_HEAD(&tid->list);
  6063. + acno = TID_TO_WME_AC(tidno);
  6064. + tid->txq = sc->tx.txq_map[acno];
  6065. ++
  6066. ++ if (!an->sta)
  6067. ++ break; /* just one multicast ath_atx_tid */
  6068. + }
  6069. + }
  6070. +
  6071. +@@ -2895,9 +2836,8 @@ void ath_tx_node_cleanup(struct ath_soft
  6072. + struct ath_txq *txq;
  6073. + int tidno;
  6074. +
  6075. +- for (tidno = 0, tid = &an->tid[tidno];
  6076. +- tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
  6077. +-
  6078. ++ for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) {
  6079. ++ tid = ATH_AN_2_TID(an, tidno);
  6080. + txq = tid->txq;
  6081. +
  6082. + ath_txq_lock(sc, txq);
  6083. +@@ -2909,6 +2849,9 @@ void ath_tx_node_cleanup(struct ath_soft
  6084. + tid->active = false;
  6085. +
  6086. + ath_txq_unlock(sc, txq);
  6087. ++
  6088. ++ if (!an->sta)
  6089. ++ break; /* just one multicast ath_atx_tid */
  6090. + }
  6091. + }
  6092. +
  6093. 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
  6094. deleted file mode 100644
  6095. index 2eeed22..0000000
  6096. --- a/package/kernel/mac80211/patches/320-cfg80211-add-support-for-non-linear-skbs-in-ieee8021.patch
  6097. +++ /dev/null
  6098. @@ -1,159 +0,0 @@
  6099. -From: Felix Fietkau <nbd@openwrt.org>
  6100. -Date: Tue, 2 Feb 2016 14:39:10 +0100
  6101. -Subject: [PATCH] cfg80211: add support for non-linear skbs in
  6102. - ieee80211_amsdu_to_8023s
  6103. -
  6104. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  6105. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  6106. ----
  6107. -
  6108. ---- a/net/wireless/util.c
  6109. -+++ b/net/wireless/util.c
  6110. -@@ -644,73 +644,75 @@ int ieee80211_data_from_8023(struct sk_b
  6111. - }
  6112. - EXPORT_SYMBOL(ieee80211_data_from_8023);
  6113. -
  6114. -+static struct sk_buff *
  6115. -+__ieee80211_amsdu_copy(struct sk_buff *skb, unsigned int hlen,
  6116. -+ int offset, int len)
  6117. -+{
  6118. -+ struct sk_buff *frame;
  6119. -+
  6120. -+ if (skb->len - offset < len)
  6121. -+ return NULL;
  6122. -+
  6123. -+ /*
  6124. -+ * Allocate and reserve two bytes more for payload
  6125. -+ * alignment since sizeof(struct ethhdr) is 14.
  6126. -+ */
  6127. -+ frame = dev_alloc_skb(hlen + sizeof(struct ethhdr) + 2 + len);
  6128. -+
  6129. -+ skb_reserve(frame, hlen + sizeof(struct ethhdr) + 2);
  6130. -+ skb_copy_bits(skb, offset, skb_put(frame, len), len);
  6131. -+
  6132. -+ return frame;
  6133. -+}
  6134. -
  6135. - void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
  6136. - const u8 *addr, enum nl80211_iftype iftype,
  6137. - const unsigned int extra_headroom,
  6138. - bool has_80211_header)
  6139. - {
  6140. -+ unsigned int hlen = ALIGN(extra_headroom, 4);
  6141. - struct sk_buff *frame = NULL;
  6142. - u16 ethertype;
  6143. - u8 *payload;
  6144. -- const struct ethhdr *eth;
  6145. -- int remaining, err;
  6146. -- u8 dst[ETH_ALEN], src[ETH_ALEN];
  6147. --
  6148. -- if (skb_linearize(skb))
  6149. -- goto out;
  6150. -+ int offset = 0, remaining, err;
  6151. -+ struct ethhdr eth;
  6152. -+ bool reuse_skb = true;
  6153. -+ bool last = false;
  6154. -
  6155. - if (has_80211_header) {
  6156. -- err = ieee80211_data_to_8023(skb, addr, iftype);
  6157. -+ err = __ieee80211_data_to_8023(skb, &eth, addr, iftype);
  6158. - if (err)
  6159. - goto out;
  6160. --
  6161. -- /* skip the wrapping header */
  6162. -- eth = (struct ethhdr *) skb_pull(skb, sizeof(struct ethhdr));
  6163. -- if (!eth)
  6164. -- goto out;
  6165. -- } else {
  6166. -- eth = (struct ethhdr *) skb->data;
  6167. - }
  6168. -
  6169. -- while (skb != frame) {
  6170. -+ while (!last) {
  6171. -+ unsigned int subframe_len;
  6172. -+ int len;
  6173. - u8 padding;
  6174. -- __be16 len = eth->h_proto;
  6175. -- unsigned int subframe_len = sizeof(struct ethhdr) + ntohs(len);
  6176. --
  6177. -- remaining = skb->len;
  6178. -- memcpy(dst, eth->h_dest, ETH_ALEN);
  6179. -- memcpy(src, eth->h_source, ETH_ALEN);
  6180. -
  6181. -+ skb_copy_bits(skb, offset, &eth, sizeof(eth));
  6182. -+ len = ntohs(eth.h_proto);
  6183. -+ subframe_len = sizeof(struct ethhdr) + len;
  6184. - padding = (4 - subframe_len) & 0x3;
  6185. -+
  6186. - /* the last MSDU has no padding */
  6187. -+ remaining = skb->len - offset;
  6188. - if (subframe_len > remaining)
  6189. - goto purge;
  6190. -
  6191. -- skb_pull(skb, sizeof(struct ethhdr));
  6192. -+ offset += sizeof(struct ethhdr);
  6193. - /* reuse skb for the last subframe */
  6194. -- if (remaining <= subframe_len + padding)
  6195. -+ last = remaining <= subframe_len + padding;
  6196. -+ if (!skb_is_nonlinear(skb) && last) {
  6197. -+ skb_pull(skb, offset);
  6198. - frame = skb;
  6199. -- else {
  6200. -- unsigned int hlen = ALIGN(extra_headroom, 4);
  6201. -- /*
  6202. -- * Allocate and reserve two bytes more for payload
  6203. -- * alignment since sizeof(struct ethhdr) is 14.
  6204. -- */
  6205. -- frame = dev_alloc_skb(hlen + subframe_len + 2);
  6206. -+ reuse_skb = true;
  6207. -+ } else {
  6208. -+ frame = __ieee80211_amsdu_copy(skb, hlen, offset, len);
  6209. - if (!frame)
  6210. - goto purge;
  6211. -
  6212. -- skb_reserve(frame, hlen + sizeof(struct ethhdr) + 2);
  6213. -- memcpy(skb_put(frame, ntohs(len)), skb->data,
  6214. -- ntohs(len));
  6215. --
  6216. -- eth = (struct ethhdr *)skb_pull(skb, ntohs(len) +
  6217. -- padding);
  6218. -- if (!eth) {
  6219. -- dev_kfree_skb(frame);
  6220. -- goto purge;
  6221. -- }
  6222. -+ offset += len + padding;
  6223. - }
  6224. -
  6225. - skb_reset_network_header(frame);
  6226. -@@ -719,24 +721,20 @@ void ieee80211_amsdu_to_8023s(struct sk_
  6227. -
  6228. - payload = frame->data;
  6229. - ethertype = (payload[6] << 8) | payload[7];
  6230. --
  6231. - if (likely((ether_addr_equal(payload, rfc1042_header) &&
  6232. - ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) ||
  6233. - ether_addr_equal(payload, bridge_tunnel_header))) {
  6234. -- /* remove RFC1042 or Bridge-Tunnel
  6235. -- * encapsulation and replace EtherType */
  6236. -- skb_pull(frame, 6);
  6237. -- memcpy(skb_push(frame, ETH_ALEN), src, ETH_ALEN);
  6238. -- memcpy(skb_push(frame, ETH_ALEN), dst, ETH_ALEN);
  6239. -- } else {
  6240. -- memcpy(skb_push(frame, sizeof(__be16)), &len,
  6241. -- sizeof(__be16));
  6242. -- memcpy(skb_push(frame, ETH_ALEN), src, ETH_ALEN);
  6243. -- memcpy(skb_push(frame, ETH_ALEN), dst, ETH_ALEN);
  6244. -+ eth.h_proto = htons(ethertype);
  6245. -+ skb_pull(frame, ETH_ALEN + 2);
  6246. - }
  6247. -+
  6248. -+ memcpy(skb_push(frame, sizeof(eth)), &eth, sizeof(eth));
  6249. - __skb_queue_tail(list, frame);
  6250. - }
  6251. -
  6252. -+ if (!reuse_skb)
  6253. -+ dev_kfree_skb(skb);
  6254. -+
  6255. - return;
  6256. -
  6257. - purge:
  6258. 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
  6259. new file mode 100644
  6260. index 0000000..9caa76d
  6261. --- /dev/null
  6262. +++ b/package/kernel/mac80211/patches/321-ath9k_hw-reset-AHB-WMAC-interface-on-AR91xx.patch
  6263. @@ -0,0 +1,25 @@
  6264. +From: Felix Fietkau <nbd@nbd.name>
  6265. +Date: Sat, 9 Jul 2016 15:25:24 +0200
  6266. +Subject: [PATCH] ath9k_hw: reset AHB-WMAC interface on AR91xx
  6267. +
  6268. +Should fix a few stability issues
  6269. +
  6270. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  6271. +---
  6272. +
  6273. +--- a/drivers/net/wireless/ath/ath9k/hw.c
  6274. ++++ b/drivers/net/wireless/ath/ath9k/hw.c
  6275. +@@ -1398,8 +1398,12 @@ static bool ath9k_hw_set_reset(struct at
  6276. + if (!AR_SREV_9100(ah))
  6277. + REG_WRITE(ah, AR_RC, 0);
  6278. +
  6279. +- if (AR_SREV_9100(ah))
  6280. ++ if (AR_SREV_9100(ah)) {
  6281. ++ /* Reset the AHB-WMAC interface */
  6282. ++ if (ah->external_reset)
  6283. ++ ah->external_reset();
  6284. + udelay(50);
  6285. ++ }
  6286. +
  6287. + return true;
  6288. + }
  6289. 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
  6290. deleted file mode 100644
  6291. index c4155a1..0000000
  6292. --- a/package/kernel/mac80211/patches/321-mac80211-Parse-legacy-and-HT-rate-in-injected-frames.patch
  6293. +++ /dev/null
  6294. @@ -1,155 +0,0 @@
  6295. -From: Sven Eckelmann <sven@narfation.org>
  6296. -Date: Tue, 26 Jan 2016 17:11:13 +0100
  6297. -Subject: [PATCH] mac80211: Parse legacy and HT rate in injected frames
  6298. -
  6299. -Drivers/devices without their own rate control algorithm can get the
  6300. -information what rates they should use from either the radiotap header of
  6301. -injected frames or from the rate control algorithm. But the parsing of the
  6302. -legacy rate information from the radiotap header was removed in commit
  6303. -e6a9854b05c1 ("mac80211/drivers: rewrite the rate control API").
  6304. -
  6305. -The removal of this feature heavily reduced the usefulness of frame
  6306. -injection when wanting to simulate specific transmission behavior. Having
  6307. -rate parsing together with MCS rates and retry support allows a fine
  6308. -grained selection of the tx behavior of injected frames for these kind of
  6309. -tests.
  6310. -
  6311. -Signed-off-by: Sven Eckelmann <sven@narfation.org>
  6312. -Cc: Simon Wunderlich <sw@simonwunderlich.de>
  6313. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  6314. ----
  6315. -
  6316. ---- a/include/net/mac80211.h
  6317. -+++ b/include/net/mac80211.h
  6318. -@@ -708,12 +708,14 @@ enum mac80211_tx_info_flags {
  6319. - * protocol frame (e.g. EAP)
  6320. - * @IEEE80211_TX_CTRL_PS_RESPONSE: This frame is a response to a poll
  6321. - * frame (PS-Poll or uAPSD).
  6322. -+ * @IEEE80211_TX_CTRL_RATE_INJECT: This frame is injected with rate information
  6323. - *
  6324. - * These flags are used in tx_info->control.flags.
  6325. - */
  6326. - enum mac80211_tx_control_flags {
  6327. - IEEE80211_TX_CTRL_PORT_CTRL_PROTO = BIT(0),
  6328. - IEEE80211_TX_CTRL_PS_RESPONSE = BIT(1),
  6329. -+ IEEE80211_TX_CTRL_RATE_INJECT = BIT(2),
  6330. - };
  6331. -
  6332. - /*
  6333. ---- a/net/mac80211/tx.c
  6334. -+++ b/net/mac80211/tx.c
  6335. -@@ -710,6 +710,10 @@ ieee80211_tx_h_rate_ctrl(struct ieee8021
  6336. -
  6337. - info->control.short_preamble = txrc.short_preamble;
  6338. -
  6339. -+ /* don't ask rate control when rate already injected via radiotap */
  6340. -+ if (info->control.flags & IEEE80211_TX_CTRL_RATE_INJECT)
  6341. -+ return TX_CONTINUE;
  6342. -+
  6343. - if (tx->sta)
  6344. - assoc = test_sta_flag(tx->sta, WLAN_STA_ASSOC);
  6345. -
  6346. -@@ -1665,15 +1669,24 @@ void ieee80211_xmit(struct ieee80211_sub
  6347. - ieee80211_tx(sdata, sta, skb, false);
  6348. - }
  6349. -
  6350. --static bool ieee80211_parse_tx_radiotap(struct sk_buff *skb)
  6351. -+static bool ieee80211_parse_tx_radiotap(struct ieee80211_local *local,
  6352. -+ struct sk_buff *skb)
  6353. - {
  6354. - struct ieee80211_radiotap_iterator iterator;
  6355. - struct ieee80211_radiotap_header *rthdr =
  6356. - (struct ieee80211_radiotap_header *) skb->data;
  6357. - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  6358. -+ struct ieee80211_supported_band *sband =
  6359. -+ local->hw.wiphy->bands[info->band];
  6360. - int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len,
  6361. - NULL);
  6362. - u16 txflags;
  6363. -+ u16 rate = 0;
  6364. -+ bool rate_found = false;
  6365. -+ u8 rate_retries = 0;
  6366. -+ u16 rate_flags = 0;
  6367. -+ u8 mcs_known, mcs_flags;
  6368. -+ int i;
  6369. -
  6370. - info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT |
  6371. - IEEE80211_TX_CTL_DONTFRAG;
  6372. -@@ -1724,6 +1737,35 @@ static bool ieee80211_parse_tx_radiotap(
  6373. - info->flags |= IEEE80211_TX_CTL_NO_ACK;
  6374. - break;
  6375. -
  6376. -+ case IEEE80211_RADIOTAP_RATE:
  6377. -+ rate = *iterator.this_arg;
  6378. -+ rate_flags = 0;
  6379. -+ rate_found = true;
  6380. -+ break;
  6381. -+
  6382. -+ case IEEE80211_RADIOTAP_DATA_RETRIES:
  6383. -+ rate_retries = *iterator.this_arg;
  6384. -+ break;
  6385. -+
  6386. -+ case IEEE80211_RADIOTAP_MCS:
  6387. -+ mcs_known = iterator.this_arg[0];
  6388. -+ mcs_flags = iterator.this_arg[1];
  6389. -+ if (!(mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_MCS))
  6390. -+ break;
  6391. -+
  6392. -+ rate_found = true;
  6393. -+ rate = iterator.this_arg[2];
  6394. -+ rate_flags = IEEE80211_TX_RC_MCS;
  6395. -+
  6396. -+ if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_GI &&
  6397. -+ mcs_flags & IEEE80211_RADIOTAP_MCS_SGI)
  6398. -+ rate_flags |= IEEE80211_TX_RC_SHORT_GI;
  6399. -+
  6400. -+ if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_BW &&
  6401. -+ mcs_flags & IEEE80211_RADIOTAP_MCS_BW_40)
  6402. -+ rate_flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
  6403. -+ break;
  6404. -+
  6405. - /*
  6406. - * Please update the file
  6407. - * Documentation/networking/mac80211-injection.txt
  6408. -@@ -1738,6 +1780,32 @@ static bool ieee80211_parse_tx_radiotap(
  6409. - if (ret != -ENOENT) /* ie, if we didn't simply run out of fields */
  6410. - return false;
  6411. -
  6412. -+ if (rate_found) {
  6413. -+ info->control.flags |= IEEE80211_TX_CTRL_RATE_INJECT;
  6414. -+
  6415. -+ for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) {
  6416. -+ info->control.rates[i].idx = -1;
  6417. -+ info->control.rates[i].flags = 0;
  6418. -+ info->control.rates[i].count = 0;
  6419. -+ }
  6420. -+
  6421. -+ if (rate_flags & IEEE80211_TX_RC_MCS) {
  6422. -+ info->control.rates[0].idx = rate;
  6423. -+ } else {
  6424. -+ for (i = 0; i < sband->n_bitrates; i++) {
  6425. -+ if (rate * 5 != sband->bitrates[i].bitrate)
  6426. -+ continue;
  6427. -+
  6428. -+ info->control.rates[0].idx = i;
  6429. -+ break;
  6430. -+ }
  6431. -+ }
  6432. -+
  6433. -+ info->control.rates[0].flags = rate_flags;
  6434. -+ info->control.rates[0].count = min_t(u8, rate_retries + 1,
  6435. -+ local->hw.max_rate_tries);
  6436. -+ }
  6437. -+
  6438. - /*
  6439. - * remove the radiotap header
  6440. - * iterator->_max_length was sanity-checked against
  6441. -@@ -1819,7 +1887,7 @@ netdev_tx_t ieee80211_monitor_start_xmit
  6442. - IEEE80211_TX_CTL_INJECTED;
  6443. -
  6444. - /* process and remove the injection radiotap header */
  6445. -- if (!ieee80211_parse_tx_radiotap(skb))
  6446. -+ if (!ieee80211_parse_tx_radiotap(local, skb))
  6447. - goto fail;
  6448. -
  6449. - rcu_read_lock();
  6450. 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
  6451. new file mode 100644
  6452. index 0000000..5d4e849
  6453. --- /dev/null
  6454. +++ b/package/kernel/mac80211/patches/322-ath9k_hw-issue-external-reset-for-QCA9550.patch
  6455. @@ -0,0 +1,125 @@
  6456. +From: Felix Fietkau <nbd@nbd.name>
  6457. +Date: Sat, 9 Jul 2016 15:26:44 +0200
  6458. +Subject: [PATCH] ath9k_hw: issue external reset for QCA9550
  6459. +
  6460. +The RTC interface on the SoC needs to be reset along with the rest of
  6461. +the WMAC.
  6462. +
  6463. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  6464. +---
  6465. +
  6466. +--- a/drivers/net/wireless/ath/ath9k/hw.c
  6467. ++++ b/drivers/net/wireless/ath/ath9k/hw.c
  6468. +@@ -1275,39 +1275,56 @@ void ath9k_hw_get_delta_slope_vals(struc
  6469. + *coef_exponent = coef_exp - 16;
  6470. + }
  6471. +
  6472. +-/* AR9330 WAR:
  6473. +- * call external reset function to reset WMAC if:
  6474. +- * - doing a cold reset
  6475. +- * - we have pending frames in the TX queues.
  6476. +- */
  6477. +-static bool ath9k_hw_ar9330_reset_war(struct ath_hw *ah, int type)
  6478. ++static bool ath9k_hw_need_external_reset(struct ath_hw *ah, int type)
  6479. + {
  6480. +- int i, npend = 0;
  6481. ++ int i;
  6482. +
  6483. +- for (i = 0; i < AR_NUM_QCU; i++) {
  6484. +- npend = ath9k_hw_numtxpending(ah, i);
  6485. +- if (npend)
  6486. +- break;
  6487. ++ if (type == ATH9K_RESET_COLD)
  6488. ++ return true;
  6489. ++
  6490. ++ if (AR_SREV_9550(ah))
  6491. ++ return true;
  6492. ++
  6493. ++ /* AR9330 WAR:
  6494. ++ * call external reset function to reset WMAC if:
  6495. ++ * - doing a cold reset
  6496. ++ * - we have pending frames in the TX queues.
  6497. ++ */
  6498. ++ if (AR_SREV_9330(ah)) {
  6499. ++ for (i = 0; i < AR_NUM_QCU; i++) {
  6500. ++ if (ath9k_hw_numtxpending(ah, i))
  6501. ++ return true;
  6502. ++ }
  6503. + }
  6504. +
  6505. +- if (ah->external_reset &&
  6506. +- (npend || type == ATH9K_RESET_COLD)) {
  6507. +- int reset_err = 0;
  6508. ++ return false;
  6509. ++}
  6510. +
  6511. +- ath_dbg(ath9k_hw_common(ah), RESET,
  6512. +- "reset MAC via external reset\n");
  6513. ++static bool ath9k_hw_external_reset(struct ath_hw *ah, int type)
  6514. ++{
  6515. ++ int err;
  6516. +
  6517. +- reset_err = ah->external_reset();
  6518. +- if (reset_err) {
  6519. +- ath_err(ath9k_hw_common(ah),
  6520. +- "External reset failed, err=%d\n",
  6521. +- reset_err);
  6522. +- return false;
  6523. +- }
  6524. ++ if (!ah->external_reset || !ath9k_hw_need_external_reset(ah, type))
  6525. ++ return true;
  6526. +
  6527. +- REG_WRITE(ah, AR_RTC_RESET, 1);
  6528. ++ ath_dbg(ath9k_hw_common(ah), RESET,
  6529. ++ "reset MAC via external reset\n");
  6530. ++
  6531. ++ err = ah->external_reset();
  6532. ++ if (err) {
  6533. ++ ath_err(ath9k_hw_common(ah),
  6534. ++ "External reset failed, err=%d\n", err);
  6535. ++ return false;
  6536. ++ }
  6537. ++
  6538. ++ if (AR_SREV_9550(ah)) {
  6539. ++ REG_WRITE(ah, AR_RTC_RESET, 0);
  6540. ++ udelay(10);
  6541. + }
  6542. +
  6543. ++ REG_WRITE(ah, AR_RTC_RESET, 1);
  6544. ++ udelay(10);
  6545. ++
  6546. + return true;
  6547. + }
  6548. +
  6549. +@@ -1360,24 +1377,23 @@ static bool ath9k_hw_set_reset(struct at
  6550. + rst_flags |= AR_RTC_RC_MAC_COLD;
  6551. + }
  6552. +
  6553. +- if (AR_SREV_9330(ah)) {
  6554. +- if (!ath9k_hw_ar9330_reset_war(ah, type))
  6555. +- return false;
  6556. +- }
  6557. +-
  6558. + if (ath9k_hw_mci_is_enabled(ah))
  6559. + ar9003_mci_check_gpm_offset(ah);
  6560. +
  6561. + /* DMA HALT added to resolve ar9300 and ar9580 bus error during
  6562. +- * RTC_RC reg read
  6563. ++ * RTC_RC reg read. Also needed for AR9550 external reset
  6564. + */
  6565. +- if (AR_SREV_9300(ah) || AR_SREV_9580(ah)) {
  6566. ++ if (AR_SREV_9300(ah) || AR_SREV_9580(ah) || AR_SREV_9550(ah)) {
  6567. + REG_SET_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  6568. + ath9k_hw_wait(ah, AR_CFG, AR_CFG_HALT_ACK, AR_CFG_HALT_ACK,
  6569. + 20 * AH_WAIT_TIMEOUT);
  6570. +- REG_CLR_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  6571. + }
  6572. +
  6573. ++ ath9k_hw_external_reset(ah, type);
  6574. ++
  6575. ++ if (AR_SREV_9300(ah) || AR_SREV_9580(ah))
  6576. ++ REG_CLR_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  6577. ++
  6578. + REG_WRITE(ah, AR_RTC_RC, rst_flags);
  6579. +
  6580. + REGWRITE_BUFFER_FLUSH(ah);
  6581. 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
  6582. deleted file mode 100644
  6583. index e7bfb9c..0000000
  6584. --- a/package/kernel/mac80211/patches/322-mac80211-add-A-MSDU-tx-support.patch
  6585. +++ /dev/null
  6586. @@ -1,317 +0,0 @@
  6587. -From: Felix Fietkau <nbd@openwrt.org>
  6588. -Date: Fri, 5 Feb 2016 01:38:51 +0100
  6589. -Subject: [PATCH] mac80211: add A-MSDU tx support
  6590. -
  6591. -Requires software tx queueing support. frag_list support (for zero-copy)
  6592. -is optional.
  6593. -
  6594. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  6595. ----
  6596. -
  6597. ---- a/include/net/mac80211.h
  6598. -+++ b/include/net/mac80211.h
  6599. -@@ -709,6 +709,7 @@ enum mac80211_tx_info_flags {
  6600. - * @IEEE80211_TX_CTRL_PS_RESPONSE: This frame is a response to a poll
  6601. - * frame (PS-Poll or uAPSD).
  6602. - * @IEEE80211_TX_CTRL_RATE_INJECT: This frame is injected with rate information
  6603. -+ * @IEEE80211_TX_CTRL_AMSDU: This frame is an A-MSDU frame
  6604. - *
  6605. - * These flags are used in tx_info->control.flags.
  6606. - */
  6607. -@@ -716,6 +717,7 @@ enum mac80211_tx_control_flags {
  6608. - IEEE80211_TX_CTRL_PORT_CTRL_PROTO = BIT(0),
  6609. - IEEE80211_TX_CTRL_PS_RESPONSE = BIT(1),
  6610. - IEEE80211_TX_CTRL_RATE_INJECT = BIT(2),
  6611. -+ IEEE80211_TX_CTRL_AMSDU = BIT(3),
  6612. - };
  6613. -
  6614. - /*
  6615. -@@ -1728,6 +1730,7 @@ struct ieee80211_sta_rates {
  6616. - * size is min(max_amsdu_len, 7935) bytes.
  6617. - * Both additional HT limits must be enforced by the low level driver.
  6618. - * This is defined by the spec (IEEE 802.11-2012 section 8.3.2.2 NOTE 2).
  6619. -+ * @max_rc_amsdu_len: Maximum A-MSDU size in bytes recommended by rate control.
  6620. - * @txq: per-TID data TX queues (if driver uses the TXQ abstraction)
  6621. - */
  6622. - struct ieee80211_sta {
  6623. -@@ -1748,6 +1751,7 @@ struct ieee80211_sta {
  6624. - bool mfp;
  6625. - u8 max_amsdu_subframes;
  6626. - u16 max_amsdu_len;
  6627. -+ u16 max_rc_amsdu_len;
  6628. -
  6629. - struct ieee80211_txq *txq[IEEE80211_NUM_TIDS];
  6630. -
  6631. -@@ -1961,6 +1965,15 @@ struct ieee80211_txq {
  6632. - * order and does not need to manage its own reorder buffer or BA session
  6633. - * timeout.
  6634. - *
  6635. -+ * @IEEE80211_HW_TX_AMSDU: Hardware (or driver) supports software aggregated
  6636. -+ * A-MSDU frames. Requires software tx queueing and fast-xmit support.
  6637. -+ * When not using minstrel/minstrel_ht rate control, the driver should
  6638. -+ * limit the maximum A-MSDU size based on the current tx rate by setting
  6639. -+ * max_rc_amsdu_len in struct ieee80211_sta.
  6640. -+ *
  6641. -+ * @IEEE80211_HW_TX_FRAG_LIST: Hardware (or driver) supports sending frag_list
  6642. -+ * skbs, needed for zero-copy software A-MSDU.
  6643. -+ *
  6644. - * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
  6645. - */
  6646. - enum ieee80211_hw_flags {
  6647. -@@ -1998,6 +2011,8 @@ enum ieee80211_hw_flags {
  6648. - IEEE80211_HW_BEACON_TX_STATUS,
  6649. - IEEE80211_HW_NEEDS_UNIQUE_STA_ADDR,
  6650. - IEEE80211_HW_SUPPORTS_REORDERING_BUFFER,
  6651. -+ IEEE80211_HW_TX_AMSDU,
  6652. -+ IEEE80211_HW_TX_FRAG_LIST,
  6653. -
  6654. - /* keep last, obviously */
  6655. - NUM_IEEE80211_HW_FLAGS
  6656. -@@ -2070,6 +2085,9 @@ enum ieee80211_hw_flags {
  6657. - * size is smaller (an example is LinkSys WRT120N with FW v1.0.07
  6658. - * build 002 Jun 18 2012).
  6659. - *
  6660. -+ * @max_tx_fragments: maximum number of tx buffers per (A)-MSDU, sum
  6661. -+ * of 1 + skb_shinfo(skb)->nr_frags for each skb in the frag_list.
  6662. -+ *
  6663. - * @offchannel_tx_hw_queue: HW queue ID to use for offchannel TX
  6664. - * (if %IEEE80211_HW_QUEUE_CONTROL is set)
  6665. - *
  6666. -@@ -2124,6 +2142,7 @@ struct ieee80211_hw {
  6667. - u8 max_rate_tries;
  6668. - u8 max_rx_aggregation_subframes;
  6669. - u8 max_tx_aggregation_subframes;
  6670. -+ u8 max_tx_fragments;
  6671. - u8 offchannel_tx_hw_queue;
  6672. - u8 radiotap_mcs_details;
  6673. - u16 radiotap_vht_details;
  6674. ---- a/net/mac80211/agg-tx.c
  6675. -+++ b/net/mac80211/agg-tx.c
  6676. -@@ -935,6 +935,7 @@ void ieee80211_process_addba_resp(struct
  6677. - size_t len)
  6678. - {
  6679. - struct tid_ampdu_tx *tid_tx;
  6680. -+ struct ieee80211_txq *txq;
  6681. - u16 capab, tid;
  6682. - u8 buf_size;
  6683. - bool amsdu;
  6684. -@@ -945,6 +946,10 @@ void ieee80211_process_addba_resp(struct
  6685. - buf_size = (capab & IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK) >> 6;
  6686. - buf_size = min(buf_size, local->hw.max_tx_aggregation_subframes);
  6687. -
  6688. -+ txq = sta->sta.txq[tid];
  6689. -+ if (!amsdu && txq)
  6690. -+ set_bit(IEEE80211_TXQ_NO_AMSDU, &to_txq_info(txq)->flags);
  6691. -+
  6692. - mutex_lock(&sta->ampdu_mlme.mtx);
  6693. -
  6694. - tid_tx = rcu_dereference_protected_tid_tx(sta, tid);
  6695. ---- a/net/mac80211/debugfs.c
  6696. -+++ b/net/mac80211/debugfs.c
  6697. -@@ -127,6 +127,8 @@ static const char *hw_flag_names[NUM_IEE
  6698. - FLAG(BEACON_TX_STATUS),
  6699. - FLAG(NEEDS_UNIQUE_STA_ADDR),
  6700. - FLAG(SUPPORTS_REORDERING_BUFFER),
  6701. -+ FLAG(TX_AMSDU),
  6702. -+ FLAG(TX_FRAG_LIST),
  6703. -
  6704. - /* keep last for the build bug below */
  6705. - (void *)0x1
  6706. ---- a/net/mac80211/ieee80211_i.h
  6707. -+++ b/net/mac80211/ieee80211_i.h
  6708. -@@ -799,6 +799,7 @@ struct mac80211_qos_map {
  6709. - enum txq_info_flags {
  6710. - IEEE80211_TXQ_STOP,
  6711. - IEEE80211_TXQ_AMPDU,
  6712. -+ IEEE80211_TXQ_NO_AMSDU,
  6713. - };
  6714. -
  6715. - struct txq_info {
  6716. ---- a/net/mac80211/tx.c
  6717. -+++ b/net/mac80211/tx.c
  6718. -@@ -1318,6 +1318,10 @@ struct sk_buff *ieee80211_tx_dequeue(str
  6719. - out:
  6720. - spin_unlock_bh(&txqi->queue.lock);
  6721. -
  6722. -+ if (skb && skb_has_frag_list(skb) &&
  6723. -+ !ieee80211_hw_check(&local->hw, TX_FRAG_LIST))
  6724. -+ skb_linearize(skb);
  6725. -+
  6726. - return skb;
  6727. - }
  6728. - EXPORT_SYMBOL(ieee80211_tx_dequeue);
  6729. -@@ -2757,6 +2761,163 @@ void ieee80211_clear_fast_xmit(struct st
  6730. - kfree_rcu(fast_tx, rcu_head);
  6731. - }
  6732. -
  6733. -+static bool ieee80211_amsdu_realloc_pad(struct ieee80211_local *local,
  6734. -+ struct sk_buff *skb, int headroom,
  6735. -+ int *subframe_len)
  6736. -+{
  6737. -+ int amsdu_len = *subframe_len + sizeof(struct ethhdr);
  6738. -+ int padding = (4 - amsdu_len) & 3;
  6739. -+
  6740. -+ if (skb_headroom(skb) < headroom || skb_tailroom(skb) < padding) {
  6741. -+ I802_DEBUG_INC(local->tx_expand_skb_head);
  6742. -+
  6743. -+ if (pskb_expand_head(skb, headroom, padding, GFP_ATOMIC)) {
  6744. -+ wiphy_debug(local->hw.wiphy,
  6745. -+ "failed to reallocate TX buffer\n");
  6746. -+ return false;
  6747. -+ }
  6748. -+ }
  6749. -+
  6750. -+ if (padding) {
  6751. -+ *subframe_len += padding;
  6752. -+ memset(skb_put(skb, padding), 0, padding);
  6753. -+ }
  6754. -+
  6755. -+ return true;
  6756. -+}
  6757. -+
  6758. -+static bool ieee80211_amsdu_prepare_head(struct ieee80211_sub_if_data *sdata,
  6759. -+ struct ieee80211_fast_tx *fast_tx,
  6760. -+ struct sk_buff *skb)
  6761. -+{
  6762. -+ struct ieee80211_local *local = sdata->local;
  6763. -+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  6764. -+ struct ieee80211_hdr *hdr;
  6765. -+ struct ethhdr amsdu_hdr;
  6766. -+ int hdr_len = fast_tx->hdr_len - sizeof(rfc1042_header);
  6767. -+ int subframe_len = skb->len - hdr_len;
  6768. -+ void *data;
  6769. -+ u8 *qc;
  6770. -+
  6771. -+ if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE)
  6772. -+ return false;
  6773. -+
  6774. -+ if (info->control.flags & IEEE80211_TX_CTRL_AMSDU)
  6775. -+ return true;
  6776. -+
  6777. -+ if (!ieee80211_amsdu_realloc_pad(local, skb, sizeof(amsdu_hdr),
  6778. -+ &subframe_len))
  6779. -+ return false;
  6780. -+
  6781. -+ amsdu_hdr.h_proto = cpu_to_be16(subframe_len);
  6782. -+ memcpy(amsdu_hdr.h_source, skb->data + fast_tx->sa_offs, ETH_ALEN);
  6783. -+ memcpy(amsdu_hdr.h_dest, skb->data + fast_tx->da_offs, ETH_ALEN);
  6784. -+
  6785. -+ data = skb_push(skb, sizeof(amsdu_hdr));
  6786. -+ memmove(data, data + sizeof(amsdu_hdr), hdr_len);
  6787. -+ memcpy(data + hdr_len, &amsdu_hdr, sizeof(amsdu_hdr));
  6788. -+
  6789. -+ hdr = data;
  6790. -+ qc = ieee80211_get_qos_ctl(hdr);
  6791. -+ *qc |= IEEE80211_QOS_CTL_A_MSDU_PRESENT;
  6792. -+
  6793. -+ info->control.flags |= IEEE80211_TX_CTRL_AMSDU;
  6794. -+
  6795. -+ return true;
  6796. -+}
  6797. -+
  6798. -+static bool ieee80211_amsdu_aggregate(struct ieee80211_sub_if_data *sdata,
  6799. -+ struct sta_info *sta,
  6800. -+ struct ieee80211_fast_tx *fast_tx,
  6801. -+ struct sk_buff *skb)
  6802. -+{
  6803. -+ struct ieee80211_local *local = sdata->local;
  6804. -+ u8 tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK;
  6805. -+ struct ieee80211_txq *txq = sta->sta.txq[tid];
  6806. -+ struct txq_info *txqi;
  6807. -+ struct sk_buff **frag_tail, *head;
  6808. -+ int subframe_len = skb->len - ETH_ALEN;
  6809. -+ u8 max_subframes = sta->sta.max_amsdu_subframes;
  6810. -+ int max_frags = local->hw.max_tx_fragments;
  6811. -+ int max_amsdu_len = sta->sta.max_amsdu_len;
  6812. -+ __be16 len;
  6813. -+ void *data;
  6814. -+ bool ret = false;
  6815. -+ int n = 1, nfrags;
  6816. -+
  6817. -+ if (!ieee80211_hw_check(&local->hw, TX_AMSDU))
  6818. -+ return false;
  6819. -+
  6820. -+ if (!txq)
  6821. -+ return false;
  6822. -+
  6823. -+ txqi = to_txq_info(txq);
  6824. -+ if (test_bit(IEEE80211_TXQ_NO_AMSDU, &txqi->flags))
  6825. -+ return false;
  6826. -+
  6827. -+ if (sta->sta.max_rc_amsdu_len)
  6828. -+ max_amsdu_len = min_t(int, max_amsdu_len,
  6829. -+ sta->sta.max_rc_amsdu_len);
  6830. -+
  6831. -+ spin_lock_bh(&txqi->queue.lock);
  6832. -+
  6833. -+ head = skb_peek_tail(&txqi->queue);
  6834. -+ if (!head)
  6835. -+ goto out;
  6836. -+
  6837. -+ if (skb->len + head->len > max_amsdu_len)
  6838. -+ goto out;
  6839. -+
  6840. -+ /*
  6841. -+ * HT A-MPDU limits maximum MPDU size to 4095 bytes. Since aggregation
  6842. -+ * sessions are started/stopped without txq flush, use the limit here
  6843. -+ * to avoid having to de-aggregate later.
  6844. -+ */
  6845. -+ if (skb->len + head->len > 4095 &&
  6846. -+ !sta->sta.vht_cap.vht_supported)
  6847. -+ goto out;
  6848. -+
  6849. -+ if (!ieee80211_amsdu_prepare_head(sdata, fast_tx, head))
  6850. -+ goto out;
  6851. -+
  6852. -+ nfrags = 1 + skb_shinfo(skb)->nr_frags;
  6853. -+ nfrags += 1 + skb_shinfo(head)->nr_frags;
  6854. -+ frag_tail = &skb_shinfo(head)->frag_list;
  6855. -+ while (*frag_tail) {
  6856. -+ nfrags += 1 + skb_shinfo(*frag_tail)->nr_frags;
  6857. -+ frag_tail = &(*frag_tail)->next;
  6858. -+ n++;
  6859. -+ }
  6860. -+
  6861. -+ if (max_subframes && n > max_subframes)
  6862. -+ goto out;
  6863. -+
  6864. -+ if (max_frags && nfrags > max_frags)
  6865. -+ goto out;
  6866. -+
  6867. -+ if (!ieee80211_amsdu_realloc_pad(local, skb, sizeof(rfc1042_header) + 2,
  6868. -+ &subframe_len))
  6869. -+ return false;
  6870. -+
  6871. -+ ret = true;
  6872. -+ data = skb_push(skb, ETH_ALEN + 2);
  6873. -+ memmove(data, data + ETH_ALEN + 2, 2 * ETH_ALEN);
  6874. -+
  6875. -+ data += 2 * ETH_ALEN;
  6876. -+ len = cpu_to_be16(subframe_len);
  6877. -+ memcpy(data, &len, 2);
  6878. -+ memcpy(data + 2, rfc1042_header, sizeof(rfc1042_header));
  6879. -+
  6880. -+ head->len += skb->len;
  6881. -+ head->data_len += skb->len;
  6882. -+ *frag_tail = skb;
  6883. -+
  6884. -+out:
  6885. -+ spin_unlock_bh(&txqi->queue.lock);
  6886. -+
  6887. -+ return ret;
  6888. -+}
  6889. -+
  6890. - static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata,
  6891. - struct net_device *dev, struct sta_info *sta,
  6892. - struct ieee80211_fast_tx *fast_tx,
  6893. -@@ -2811,6 +2972,10 @@ static bool ieee80211_xmit_fast(struct i
  6894. -
  6895. - ieee80211_tx_stats(dev, skb->len + extra_head);
  6896. -
  6897. -+ if ((hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) &&
  6898. -+ ieee80211_amsdu_aggregate(sdata, sta, fast_tx, skb))
  6899. -+ return true;
  6900. -+
  6901. - /* will not be crypto-handled beyond what we do here, so use false
  6902. - * as the may-encrypt argument for the resize to not account for
  6903. - * more room than we already have in 'extra_head'
  6904. 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
  6905. deleted file mode 100644
  6906. index 9277b2c..0000000
  6907. --- a/package/kernel/mac80211/patches/323-0000-brcmfmac-fix-setting-primary-channel-for-80-MHz-widt.patch
  6908. +++ /dev/null
  6909. @@ -1,64 +0,0 @@
  6910. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  6911. -Date: Wed, 20 Jan 2016 16:46:04 +0100
  6912. -Subject: [PATCH] brcmfmac: fix setting primary channel for 80 MHz width
  6913. -MIME-Version: 1.0
  6914. -Content-Type: text/plain; charset=UTF-8
  6915. -Content-Transfer-Encoding: 8bit
  6916. -
  6917. -First of all it changes the way we calculate primary channel offset. If
  6918. -we use e.g. 80 MHz channel with primary frequency 5180 MHz (which means
  6919. -center frequency is 5210 MHz) it makes sense to calculate primary offset
  6920. -as -30 MHz.
  6921. -Then it fixes values we compare primary_offset with. We were comparing
  6922. -offset in MHz against -2 or 2 which was resulting in picking a wrong
  6923. -primary channel.
  6924. -
  6925. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  6926. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6927. ----
  6928. -
  6929. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  6930. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  6931. -@@ -247,7 +247,7 @@ static u16 chandef_to_chanspec(struct br
  6932. - brcmf_dbg(TRACE, "chandef: control %d center %d width %d\n",
  6933. - ch->chan->center_freq, ch->center_freq1, ch->width);
  6934. - ch_inf.chnum = ieee80211_frequency_to_channel(ch->center_freq1);
  6935. -- primary_offset = ch->center_freq1 - ch->chan->center_freq;
  6936. -+ primary_offset = ch->chan->center_freq - ch->center_freq1;
  6937. - switch (ch->width) {
  6938. - case NL80211_CHAN_WIDTH_20:
  6939. - case NL80211_CHAN_WIDTH_20_NOHT:
  6940. -@@ -256,24 +256,21 @@ static u16 chandef_to_chanspec(struct br
  6941. - break;
  6942. - case NL80211_CHAN_WIDTH_40:
  6943. - ch_inf.bw = BRCMU_CHAN_BW_40;
  6944. -- if (primary_offset < 0)
  6945. -+ if (primary_offset > 0)
  6946. - ch_inf.sb = BRCMU_CHAN_SB_U;
  6947. - else
  6948. - ch_inf.sb = BRCMU_CHAN_SB_L;
  6949. - break;
  6950. - case NL80211_CHAN_WIDTH_80:
  6951. - ch_inf.bw = BRCMU_CHAN_BW_80;
  6952. -- if (primary_offset < 0) {
  6953. -- if (primary_offset < -CH_10MHZ_APART)
  6954. -- ch_inf.sb = BRCMU_CHAN_SB_UU;
  6955. -- else
  6956. -- ch_inf.sb = BRCMU_CHAN_SB_UL;
  6957. -- } else {
  6958. -- if (primary_offset > CH_10MHZ_APART)
  6959. -- ch_inf.sb = BRCMU_CHAN_SB_LL;
  6960. -- else
  6961. -- ch_inf.sb = BRCMU_CHAN_SB_LU;
  6962. -- }
  6963. -+ if (primary_offset == -30)
  6964. -+ ch_inf.sb = BRCMU_CHAN_SB_LL;
  6965. -+ else if (primary_offset == -10)
  6966. -+ ch_inf.sb = BRCMU_CHAN_SB_LU;
  6967. -+ else if (primary_offset == 10)
  6968. -+ ch_inf.sb = BRCMU_CHAN_SB_UL;
  6969. -+ else
  6970. -+ ch_inf.sb = BRCMU_CHAN_SB_UU;
  6971. - break;
  6972. - case NL80211_CHAN_WIDTH_80P80:
  6973. - case NL80211_CHAN_WIDTH_160:
  6974. 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
  6975. deleted file mode 100644
  6976. index d7018da..0000000
  6977. --- a/package/kernel/mac80211/patches/323-0001-brcmfmac-analyze-descriptors-of-current-component-on.patch
  6978. +++ /dev/null
  6979. @@ -1,51 +0,0 @@
  6980. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  6981. -Date: Tue, 26 Jan 2016 17:57:01 +0100
  6982. -Subject: [PATCH] brcmfmac: analyze descriptors of current component only
  6983. -MIME-Version: 1.0
  6984. -Content-Type: text/plain; charset=UTF-8
  6985. -Content-Transfer-Encoding: 8bit
  6986. -
  6987. -So far we were looking for address descriptors without a check for
  6988. -crossing current component border. In case of dealing with unsupported
  6989. -descriptor or descriptor missing at all the code would incorrectly get
  6990. -data from another component.
  6991. -
  6992. -Consider this binary-described component from BCM4366 EROM:
  6993. -4bf83b01 TAG==CI CID==0x83b
  6994. -20080201 TAG==CI PORTS==0+1 WRAPPERS==0+1
  6995. -18400035 TAG==ADDR SZ_SZD TYPE_SLAVE
  6996. -00050000
  6997. -18107085 TAG==ADDR SZ_4K TYPE_SWRAP
  6998. -
  6999. -Driver was assigning invalid base address to this core:
  7000. -brcmfmac: [6 ] core 0x83b:32 base 0x18109000 wrap 0x18107000
  7001. -which came from totally different component defined in EROM:
  7002. -43b36701 TAG==CI CID==0x367
  7003. -00000201 TAG==CI PORTS==0+1 WRAPPERS==0+0
  7004. -18109005 TAG==ADDR SZ_4K TYPE_SLAVE
  7005. -
  7006. -This change will also allow us to support components without wrapper
  7007. -address in the future.
  7008. -
  7009. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  7010. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  7011. ----
  7012. -
  7013. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  7014. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  7015. -@@ -803,7 +803,14 @@ static int brcmf_chip_dmp_get_regaddr(st
  7016. - *eromaddr -= 4;
  7017. - return -EFAULT;
  7018. - }
  7019. -- } while (desc != DMP_DESC_ADDRESS);
  7020. -+ } while (desc != DMP_DESC_ADDRESS &&
  7021. -+ desc != DMP_DESC_COMPONENT);
  7022. -+
  7023. -+ /* stop if we crossed current component border */
  7024. -+ if (desc == DMP_DESC_COMPONENT) {
  7025. -+ *eromaddr -= 4;
  7026. -+ return 0;
  7027. -+ }
  7028. -
  7029. - /* skip upper 32-bit address descriptor */
  7030. - if (val & DMP_DESC_ADDRSIZE_GT32)
  7031. 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
  7032. deleted file mode 100644
  7033. index 045ab49..0000000
  7034. --- a/package/kernel/mac80211/patches/323-0002-brcmfmac-allow-storing-PMU-core-without-wrapper-addr.patch
  7035. +++ /dev/null
  7036. @@ -1,28 +0,0 @@
  7037. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  7038. -Date: Tue, 26 Jan 2016 17:57:02 +0100
  7039. -Subject: [PATCH] brcmfmac: allow storing PMU core without wrapper address
  7040. -MIME-Version: 1.0
  7041. -Content-Type: text/plain; charset=UTF-8
  7042. -Content-Transfer-Encoding: 8bit
  7043. -
  7044. -Separated PMU core can be found in new devices and should be used for
  7045. -accessing PMU registers (which were routed through ChipCommon so far).
  7046. -This core is one of exceptions that doesn't have or need wrapper address
  7047. -to be still safely accessible.
  7048. -
  7049. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  7050. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  7051. ----
  7052. -
  7053. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  7054. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  7055. -@@ -883,7 +883,8 @@ int brcmf_chip_dmp_erom_scan(struct brcm
  7056. - rev = (val & DMP_COMP_REVISION) >> DMP_COMP_REVISION_S;
  7057. -
  7058. - /* need core with ports */
  7059. -- if (nmw + nsw == 0)
  7060. -+ if (nmw + nsw == 0 &&
  7061. -+ id != BCMA_CORE_PMU)
  7062. - continue;
  7063. -
  7064. - /* try to obtain register address info */
  7065. 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
  7066. deleted file mode 100644
  7067. index 7b7ba4f..0000000
  7068. --- a/package/kernel/mac80211/patches/323-0003-brcmfmac-read-extended-capabilities-of-ChipCommon-co.patch
  7069. +++ /dev/null
  7070. @@ -1,43 +0,0 @@
  7071. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  7072. -Date: Tue, 26 Jan 2016 17:57:03 +0100
  7073. -Subject: [PATCH] brcmfmac: read extended capabilities of ChipCommon core
  7074. -MIME-Version: 1.0
  7075. -Content-Type: text/plain; charset=UTF-8
  7076. -Content-Transfer-Encoding: 8bit
  7077. -
  7078. -This is an extra bitfield with info about some present hardware.
  7079. -
  7080. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  7081. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  7082. ----
  7083. -
  7084. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  7085. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  7086. -@@ -1025,6 +1025,9 @@ static int brcmf_chip_setup(struct brcmf
  7087. - /* get chipcommon capabilites */
  7088. - pub->cc_caps = chip->ops->read32(chip->ctx,
  7089. - CORE_CC_REG(base, capabilities));
  7090. -+ pub->cc_caps_ext = chip->ops->read32(chip->ctx,
  7091. -+ CORE_CC_REG(base,
  7092. -+ capabilities_ext));
  7093. -
  7094. - /* get pmu caps & rev */
  7095. - if (pub->cc_caps & CC_CAP_PMU) {
  7096. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
  7097. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
  7098. -@@ -27,6 +27,7 @@
  7099. - * @chip: chip identifier.
  7100. - * @chiprev: chip revision.
  7101. - * @cc_caps: chipcommon core capabilities.
  7102. -+ * @cc_caps_ext: chipcommon core extended capabilities.
  7103. - * @pmucaps: PMU capabilities.
  7104. - * @pmurev: PMU revision.
  7105. - * @rambase: RAM base address (only applicable for ARM CR4 chips).
  7106. -@@ -38,6 +39,7 @@ struct brcmf_chip {
  7107. - u32 chip;
  7108. - u32 chiprev;
  7109. - u32 cc_caps;
  7110. -+ u32 cc_caps_ext;
  7111. - u32 pmucaps;
  7112. - u32 pmurev;
  7113. - u32 rambase;
  7114. 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
  7115. deleted file mode 100644
  7116. index 2af6fd9..0000000
  7117. --- a/package/kernel/mac80211/patches/323-0004-brcmfmac-access-PMU-registers-using-standalone-PMU-c.patch
  7118. +++ /dev/null
  7119. @@ -1,148 +0,0 @@
  7120. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  7121. -Date: Tue, 26 Jan 2016 17:57:04 +0100
  7122. -Subject: [PATCH] brcmfmac: access PMU registers using standalone PMU core if
  7123. - available
  7124. -MIME-Version: 1.0
  7125. -Content-Type: text/plain; charset=UTF-8
  7126. -Content-Transfer-Encoding: 8bit
  7127. -
  7128. -On recent Broadcom chipsets PMU is present as separated core and it
  7129. -can't be accessed using ChipCommon anymore as it fails with e.g.:
  7130. -[ 18.198412] Unhandled fault: imprecise external abort (0x1406) at 0xb6da200f
  7131. -
  7132. -Add a new helper function that will return a proper core that should be
  7133. -used for accessing PMU registers.
  7134. -
  7135. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  7136. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  7137. ----
  7138. -
  7139. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  7140. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  7141. -@@ -1014,6 +1014,7 @@ static int brcmf_chip_setup(struct brcmf
  7142. - {
  7143. - struct brcmf_chip *pub;
  7144. - struct brcmf_core_priv *cc;
  7145. -+ struct brcmf_core *pmu;
  7146. - u32 base;
  7147. - u32 val;
  7148. - int ret = 0;
  7149. -@@ -1030,9 +1031,10 @@ static int brcmf_chip_setup(struct brcmf
  7150. - capabilities_ext));
  7151. -
  7152. - /* get pmu caps & rev */
  7153. -+ pmu = brcmf_chip_get_pmu(pub); /* after reading cc_caps_ext */
  7154. - if (pub->cc_caps & CC_CAP_PMU) {
  7155. - val = chip->ops->read32(chip->ctx,
  7156. -- CORE_CC_REG(base, pmucapabilities));
  7157. -+ CORE_CC_REG(pmu->base, pmucapabilities));
  7158. - pub->pmurev = val & PCAP_REV_MASK;
  7159. - pub->pmucaps = val;
  7160. - }
  7161. -@@ -1131,6 +1133,23 @@ struct brcmf_core *brcmf_chip_get_chipco
  7162. - return &cc->pub;
  7163. - }
  7164. -
  7165. -+struct brcmf_core *brcmf_chip_get_pmu(struct brcmf_chip *pub)
  7166. -+{
  7167. -+ struct brcmf_core *cc = brcmf_chip_get_chipcommon(pub);
  7168. -+ struct brcmf_core *pmu;
  7169. -+
  7170. -+ /* See if there is separated PMU core available */
  7171. -+ if (cc->rev >= 35 &&
  7172. -+ pub->cc_caps_ext & BCMA_CC_CAP_EXT_AOB_PRESENT) {
  7173. -+ pmu = brcmf_chip_get_core(pub, BCMA_CORE_PMU);
  7174. -+ if (pmu)
  7175. -+ return pmu;
  7176. -+ }
  7177. -+
  7178. -+ /* Fallback to ChipCommon core for older hardware */
  7179. -+ return cc;
  7180. -+}
  7181. -+
  7182. - bool brcmf_chip_iscoreup(struct brcmf_core *pub)
  7183. - {
  7184. - struct brcmf_core_priv *core;
  7185. -@@ -1301,6 +1320,7 @@ bool brcmf_chip_sr_capable(struct brcmf_
  7186. - {
  7187. - u32 base, addr, reg, pmu_cc3_mask = ~0;
  7188. - struct brcmf_chip_priv *chip;
  7189. -+ struct brcmf_core *pmu = brcmf_chip_get_pmu(pub);
  7190. -
  7191. - brcmf_dbg(TRACE, "Enter\n");
  7192. -
  7193. -@@ -1320,9 +1340,9 @@ bool brcmf_chip_sr_capable(struct brcmf_
  7194. - case BRCM_CC_4335_CHIP_ID:
  7195. - case BRCM_CC_4339_CHIP_ID:
  7196. - /* read PMU chipcontrol register 3 */
  7197. -- addr = CORE_CC_REG(base, chipcontrol_addr);
  7198. -+ addr = CORE_CC_REG(pmu->base, chipcontrol_addr);
  7199. - chip->ops->write32(chip->ctx, addr, 3);
  7200. -- addr = CORE_CC_REG(base, chipcontrol_data);
  7201. -+ addr = CORE_CC_REG(pmu->base, chipcontrol_data);
  7202. - reg = chip->ops->read32(chip->ctx, addr);
  7203. - return (reg & pmu_cc3_mask) != 0;
  7204. - case BRCM_CC_43430_CHIP_ID:
  7205. -@@ -1330,12 +1350,12 @@ bool brcmf_chip_sr_capable(struct brcmf_
  7206. - reg = chip->ops->read32(chip->ctx, addr);
  7207. - return reg != 0;
  7208. - default:
  7209. -- addr = CORE_CC_REG(base, pmucapabilities_ext);
  7210. -+ addr = CORE_CC_REG(pmu->base, pmucapabilities_ext);
  7211. - reg = chip->ops->read32(chip->ctx, addr);
  7212. - if ((reg & PCAPEXT_SR_SUPPORTED_MASK) == 0)
  7213. - return false;
  7214. -
  7215. -- addr = CORE_CC_REG(base, retention_ctl);
  7216. -+ addr = CORE_CC_REG(pmu->base, retention_ctl);
  7217. - reg = chip->ops->read32(chip->ctx, addr);
  7218. - return (reg & (PMU_RCTL_MACPHY_DISABLE_MASK |
  7219. - PMU_RCTL_LOGIC_DISABLE_MASK)) == 0;
  7220. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
  7221. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
  7222. -@@ -85,6 +85,7 @@ struct brcmf_chip *brcmf_chip_attach(voi
  7223. - void brcmf_chip_detach(struct brcmf_chip *chip);
  7224. - struct brcmf_core *brcmf_chip_get_core(struct brcmf_chip *chip, u16 coreid);
  7225. - struct brcmf_core *brcmf_chip_get_chipcommon(struct brcmf_chip *chip);
  7226. -+struct brcmf_core *brcmf_chip_get_pmu(struct brcmf_chip *pub);
  7227. - bool brcmf_chip_iscoreup(struct brcmf_core *core);
  7228. - void brcmf_chip_coredisable(struct brcmf_core *core, u32 prereset, u32 reset);
  7229. - void brcmf_chip_resetcore(struct brcmf_core *core, u32 prereset, u32 reset,
  7230. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  7231. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  7232. -@@ -3615,7 +3615,6 @@ brcmf_sdio_drivestrengthinit(struct brcm
  7233. - const struct sdiod_drive_str *str_tab = NULL;
  7234. - u32 str_mask;
  7235. - u32 str_shift;
  7236. -- u32 base;
  7237. - u32 i;
  7238. - u32 drivestrength_sel = 0;
  7239. - u32 cc_data_temp;
  7240. -@@ -3658,14 +3657,15 @@ brcmf_sdio_drivestrengthinit(struct brcm
  7241. - }
  7242. -
  7243. - if (str_tab != NULL) {
  7244. -+ struct brcmf_core *pmu = brcmf_chip_get_pmu(ci);
  7245. -+
  7246. - for (i = 0; str_tab[i].strength != 0; i++) {
  7247. - if (drivestrength >= str_tab[i].strength) {
  7248. - drivestrength_sel = str_tab[i].sel;
  7249. - break;
  7250. - }
  7251. - }
  7252. -- base = brcmf_chip_get_chipcommon(ci)->base;
  7253. -- addr = CORE_CC_REG(base, chipcontrol_addr);
  7254. -+ addr = CORE_CC_REG(pmu->base, chipcontrol_addr);
  7255. - brcmf_sdiod_regwl(sdiodev, addr, 1, NULL);
  7256. - cc_data_temp = brcmf_sdiod_regrl(sdiodev, addr, NULL);
  7257. - cc_data_temp &= ~str_mask;
  7258. -@@ -3835,8 +3835,7 @@ brcmf_sdio_probe_attach(struct brcmf_sdi
  7259. - goto fail;
  7260. -
  7261. - /* set PMUControl so a backplane reset does PMU state reload */
  7262. -- reg_addr = CORE_CC_REG(brcmf_chip_get_chipcommon(bus->ci)->base,
  7263. -- pmucontrol);
  7264. -+ reg_addr = CORE_CC_REG(brcmf_chip_get_pmu(bus->ci)->base, pmucontrol);
  7265. - reg_val = brcmf_sdiod_regrl(bus->sdiodev, reg_addr, &err);
  7266. - if (err)
  7267. - goto fail;
  7268. 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
  7269. deleted file mode 100644
  7270. index 35887fc..0000000
  7271. --- a/package/kernel/mac80211/patches/323-0005-brcmfmac-add-support-for-14e4-4365-PCI-ID-with-BCM43.patch
  7272. +++ /dev/null
  7273. @@ -1,38 +0,0 @@
  7274. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  7275. -Date: Tue, 26 Jan 2016 17:57:05 +0100
  7276. -Subject: [PATCH] brcmfmac: add support for 14e4:4365 PCI ID with BCM4366
  7277. - chipset
  7278. -MIME-Version: 1.0
  7279. -Content-Type: text/plain; charset=UTF-8
  7280. -Content-Transfer-Encoding: 8bit
  7281. -
  7282. -On Broadcom ARM routers BCM4366 cards are available with 14e4:4365 ID.
  7283. -Unfortunately this ID was already used by Broadcom for cards with
  7284. -BCM43142, a totally different chipset requiring SoftMAC driver. To avoid
  7285. -a conflict between brcmfmac and bcma use more specific ID entry with
  7286. -subvendor and subdevice specified.
  7287. -
  7288. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  7289. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  7290. ----
  7291. -
  7292. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  7293. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  7294. -@@ -1951,6 +1951,9 @@ static const struct dev_pm_ops brcmf_pci
  7295. -
  7296. - #define BRCMF_PCIE_DEVICE(dev_id) { BRCM_PCIE_VENDOR_ID_BROADCOM, dev_id,\
  7297. - PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_NETWORK_OTHER << 8, 0xffff00, 0 }
  7298. -+#define BRCMF_PCIE_DEVICE_SUB(dev_id, subvend, subdev) { \
  7299. -+ BRCM_PCIE_VENDOR_ID_BROADCOM, dev_id,\
  7300. -+ subvend, subdev, PCI_CLASS_NETWORK_OTHER << 8, 0xffff00, 0 }
  7301. -
  7302. - static struct pci_device_id brcmf_pcie_devid_table[] = {
  7303. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4350_DEVICE_ID),
  7304. -@@ -1966,6 +1969,7 @@ static struct pci_device_id brcmf_pcie_d
  7305. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_DEVICE_ID),
  7306. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_2G_DEVICE_ID),
  7307. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_5G_DEVICE_ID),
  7308. -+ BRCMF_PCIE_DEVICE_SUB(0x4365, BRCM_PCIE_VENDOR_ID_BROADCOM, 0x4365),
  7309. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_DEVICE_ID),
  7310. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_2G_DEVICE_ID),
  7311. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_5G_DEVICE_ID),
  7312. 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
  7313. new file mode 100644
  7314. index 0000000..59ac29b
  7315. --- /dev/null
  7316. +++ b/package/kernel/mac80211/patches/323-ath9k-Fix-programming-of-minCCA-power-threshold.patch
  7317. @@ -0,0 +1,26 @@
  7318. +From: Sven Eckelmann <sven@narfation.org>
  7319. +Date: Fri, 17 Jun 2016 11:58:20 +0200
  7320. +Subject: [PATCH] ath9k: Fix programming of minCCA power threshold
  7321. +
  7322. +The function ar9003_hw_apply_minccapwr_thresh takes as second parameter not
  7323. +a pointer to the channel but a boolean value describing whether the channel
  7324. +is 2.4GHz or not. This broke (according to the origin commit) the ETSI
  7325. +regulatory compliance on 5GHz channels.
  7326. +
  7327. +Fixes: 3533bf6b15a0 ("ath9k: Fix regulatory compliance")
  7328. +Signed-off-by: Sven Eckelmann <sven@narfation.org>
  7329. +Cc: Simon Wunderlich <sw@simonwunderlich.de>
  7330. +Cc: Sujith Manoharan <c_manoha@qca.qualcomm.com>
  7331. +---
  7332. +
  7333. +--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
  7334. ++++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
  7335. +@@ -4175,7 +4175,7 @@ static void ath9k_hw_ar9300_set_board_va
  7336. + if (!AR_SREV_9330(ah) && !AR_SREV_9340(ah) && !AR_SREV_9531(ah))
  7337. + ar9003_hw_internal_regulator_apply(ah);
  7338. + ar9003_hw_apply_tuning_caps(ah);
  7339. +- ar9003_hw_apply_minccapwr_thresh(ah, chan);
  7340. ++ ar9003_hw_apply_minccapwr_thresh(ah, is2ghz);
  7341. + ar9003_hw_txend_to_xpa_off_apply(ah, is2ghz);
  7342. + ar9003_hw_thermometer_apply(ah);
  7343. + ar9003_hw_thermo_cal_apply(ah);
  7344. 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
  7345. new file mode 100644
  7346. index 0000000..b6f4868
  7347. --- /dev/null
  7348. +++ b/package/kernel/mac80211/patches/324-ath9k_hw-fix-spectral-scan-on-AR9285-and-newer.patch
  7349. @@ -0,0 +1,86 @@
  7350. +From: Felix Fietkau <nbd@nbd.name>
  7351. +Date: Mon, 11 Jul 2016 10:34:37 +0200
  7352. +Subject: [PATCH] ath9k_hw: fix spectral scan on AR9285 and newer
  7353. +
  7354. +The register layout of AR_PHY_SPECTRAL_SCAN has changed, only AR9280
  7355. +uses the old layout
  7356. +
  7357. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  7358. +---
  7359. +
  7360. +--- a/drivers/net/wireless/ath/ath9k/ar9002_phy.c
  7361. ++++ b/drivers/net/wireless/ath/ath9k/ar9002_phy.c
  7362. +@@ -476,6 +476,7 @@ static void ar9002_hw_set_bt_ant_diversi
  7363. + static void ar9002_hw_spectral_scan_config(struct ath_hw *ah,
  7364. + struct ath_spec_scan *param)
  7365. + {
  7366. ++ u32 repeat_bit;
  7367. + u8 count;
  7368. +
  7369. + if (!param->enabled) {
  7370. +@@ -486,12 +487,15 @@ static void ar9002_hw_spectral_scan_conf
  7371. + REG_SET_BIT(ah, AR_PHY_RADAR_0, AR_PHY_RADAR_0_FFT_ENA);
  7372. + REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN, AR_PHY_SPECTRAL_SCAN_ENABLE);
  7373. +
  7374. ++ if (AR_SREV_9280(ah))
  7375. ++ repeat_bit = AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT;
  7376. ++ else
  7377. ++ repeat_bit = AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_KIWI;
  7378. ++
  7379. + if (param->short_repeat)
  7380. +- REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN,
  7381. +- AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT);
  7382. ++ REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN, repeat_bit);
  7383. + else
  7384. +- REG_CLR_BIT(ah, AR_PHY_SPECTRAL_SCAN,
  7385. +- AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT);
  7386. ++ REG_CLR_BIT(ah, AR_PHY_SPECTRAL_SCAN, repeat_bit);
  7387. +
  7388. + /* on AR92xx, the highest bit of count will make the the chip send
  7389. + * spectral samples endlessly. Check if this really was intended,
  7390. +@@ -499,15 +503,25 @@ static void ar9002_hw_spectral_scan_conf
  7391. + */
  7392. + count = param->count;
  7393. + if (param->endless) {
  7394. +- if (AR_SREV_9271(ah))
  7395. +- count = 0;
  7396. +- else
  7397. ++ if (AR_SREV_9280(ah))
  7398. + count = 0x80;
  7399. ++ else
  7400. ++ count = 0;
  7401. + } else if (count & 0x80)
  7402. + count = 0x7f;
  7403. ++ else if (!count)
  7404. ++ count = 1;
  7405. ++
  7406. ++ if (AR_SREV_9280(ah)) {
  7407. ++ REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN,
  7408. ++ AR_PHY_SPECTRAL_SCAN_COUNT, count);
  7409. ++ } else {
  7410. ++ REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN,
  7411. ++ AR_PHY_SPECTRAL_SCAN_COUNT_KIWI, count);
  7412. ++ REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN,
  7413. ++ AR_PHY_SPECTRAL_SCAN_PHYERR_MASK_SELECT);
  7414. ++ }
  7415. +
  7416. +- REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN,
  7417. +- AR_PHY_SPECTRAL_SCAN_COUNT, count);
  7418. + REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN,
  7419. + AR_PHY_SPECTRAL_SCAN_PERIOD, param->period);
  7420. + REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN,
  7421. +--- a/drivers/net/wireless/ath/ath9k/ar9002_phy.h
  7422. ++++ b/drivers/net/wireless/ath/ath9k/ar9002_phy.h
  7423. +@@ -177,8 +177,11 @@
  7424. + #define AR_PHY_SPECTRAL_SCAN_PERIOD_S 8
  7425. + #define AR_PHY_SPECTRAL_SCAN_COUNT 0x00FF0000 /* Number of reports, reg 68, bits 16-23*/
  7426. + #define AR_PHY_SPECTRAL_SCAN_COUNT_S 16
  7427. ++#define AR_PHY_SPECTRAL_SCAN_COUNT_KIWI 0x0FFF0000 /* Number of reports, reg 68, bits 16-27*/
  7428. ++#define AR_PHY_SPECTRAL_SCAN_COUNT_KIWI_S 16
  7429. + #define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT 0x01000000 /* Short repeat, reg 68, bit 24*/
  7430. +-#define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_S 24 /* Short repeat, reg 68, bit 24*/
  7431. ++#define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_KIWI 0x10000000 /* Short repeat, reg 68, bit 28*/
  7432. ++#define AR_PHY_SPECTRAL_SCAN_PHYERR_MASK_SELECT 0x40000000
  7433. +
  7434. + #define AR_PHY_RX_DELAY 0x9914
  7435. + #define AR_PHY_SEARCH_START_DELAY 0x9918
  7436. 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
  7437. deleted file mode 100644
  7438. index 6ce60f1..0000000
  7439. --- a/package/kernel/mac80211/patches/324-brcmfmac-treat-NULL-character-in-NVRAM-as-separator.patch
  7440. +++ /dev/null
  7441. @@ -1,32 +0,0 @@
  7442. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  7443. -Date: Sun, 31 Jan 2016 12:14:34 +0100
  7444. -Subject: [PATCH] brcmfmac: treat NULL character in NVRAM as separator
  7445. -MIME-Version: 1.0
  7446. -Content-Type: text/plain; charset=UTF-8
  7447. -Content-Transfer-Encoding: 8bit
  7448. -
  7449. -Platform NVRAM (stored on a flash partition) has entries separated by a
  7450. -NULL (\0) char. Our parsing code switches from VALUE state to IDLE
  7451. -whenever it meets a NULL (\0). When that happens our IDLE handler should
  7452. -simply consume it and analyze whatever is placed ahead.
  7453. -
  7454. -This fixes harmless warnings spamming debugging output:
  7455. -[ 155.165624] brcmfmac: brcmf_nvram_handle_idle warning: ln=1:col=20: ignoring invalid character
  7456. -[ 155.180806] brcmfmac: brcmf_nvram_handle_idle warning: ln=1:col=44: ignoring invalid character
  7457. -[ 155.195971] brcmfmac: brcmf_nvram_handle_idle warning: ln=1:col=63: ignoring invalid character
  7458. -
  7459. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  7460. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  7461. ----
  7462. -
  7463. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  7464. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  7465. -@@ -93,7 +93,7 @@ static enum nvram_parser_state brcmf_nvr
  7466. - c = nvp->data[nvp->pos];
  7467. - if (c == '\n')
  7468. - return COMMENT;
  7469. -- if (is_whitespace(c))
  7470. -+ if (is_whitespace(c) || c == '\0')
  7471. - goto proceed;
  7472. - if (c == '#')
  7473. - return COMMENT;
  7474. 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
  7475. new file mode 100644
  7476. index 0000000..6685f33
  7477. --- /dev/null
  7478. +++ b/package/kernel/mac80211/patches/325-ath9k_hw-fix-duplicate-and-partially-wrong-definitio.patch
  7479. @@ -0,0 +1,57 @@
  7480. +From: Felix Fietkau <nbd@nbd.name>
  7481. +Date: Mon, 11 Jul 2016 11:31:39 +0200
  7482. +Subject: [PATCH] ath9k_hw: fix duplicate (and partially wrong) definition
  7483. + of AR_CH0_THERM
  7484. +
  7485. +AR_PHY_65NM_CH0_THERM and AR_CH0_THERM were supposed to refer to the
  7486. +same register, however they had different SREV checks.
  7487. +
  7488. +Remove the duplicate and use the checks. Since there were other SREV
  7489. +checks present in the only place that uses this, this will probaby not
  7490. +affect runtime behavior.
  7491. +
  7492. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  7493. +---
  7494. +
  7495. +--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.h
  7496. ++++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.h
  7497. +@@ -689,13 +689,6 @@
  7498. + #define AR_CH0_TOP_XPABIASLVL (AR_SREV_9550(ah) ? 0x3c0 : 0x300)
  7499. + #define AR_CH0_TOP_XPABIASLVL_S (AR_SREV_9550(ah) ? 6 : 8)
  7500. +
  7501. +-#define AR_CH0_THERM (AR_SREV_9300(ah) ? 0x16290 : \
  7502. +- ((AR_SREV_9485(ah) ? 0x1628c : 0x16294)))
  7503. +-#define AR_CH0_THERM_XPABIASLVL_MSB 0x3
  7504. +-#define AR_CH0_THERM_XPABIASLVL_MSB_S 0
  7505. +-#define AR_CH0_THERM_XPASHORT2GND 0x4
  7506. +-#define AR_CH0_THERM_XPASHORT2GND_S 2
  7507. +-
  7508. + #define AR_SWITCH_TABLE_COM_ALL (0xffff)
  7509. + #define AR_SWITCH_TABLE_COM_ALL_S (0)
  7510. + #define AR_SWITCH_TABLE_COM_AR9462_ALL (0xffffff)
  7511. +@@ -712,15 +705,17 @@
  7512. + #define AR_SWITCH_TABLE_ALL (0xfff)
  7513. + #define AR_SWITCH_TABLE_ALL_S (0)
  7514. +
  7515. +-#define AR_PHY_65NM_CH0_THERM (AR_SREV_9300(ah) ? 0x16290 :\
  7516. +- ((AR_SREV_9462(ah) || AR_SREV_9565(ah)) ? 0x16294 : 0x1628c))
  7517. ++#define AR_CH0_THERM (AR_SREV_9300(ah) ? 0x16290 :\
  7518. ++ ((AR_SREV_9462(ah) || AR_SREV_9565(ah)) ? 0x16294 : 0x1628c))
  7519. ++#define AR_CH0_THERM_XPABIASLVL_MSB 0x3
  7520. ++#define AR_CH0_THERM_XPABIASLVL_MSB_S 0
  7521. ++#define AR_CH0_THERM_XPASHORT2GND 0x4
  7522. ++#define AR_CH0_THERM_XPASHORT2GND_S 2
  7523. +
  7524. +-#define AR_PHY_65NM_CH0_THERM_LOCAL 0x80000000
  7525. +-#define AR_PHY_65NM_CH0_THERM_LOCAL_S 31
  7526. +-#define AR_PHY_65NM_CH0_THERM_START 0x20000000
  7527. +-#define AR_PHY_65NM_CH0_THERM_START_S 29
  7528. +-#define AR_PHY_65NM_CH0_THERM_SAR_ADC_OUT 0x0000ff00
  7529. +-#define AR_PHY_65NM_CH0_THERM_SAR_ADC_OUT_S 8
  7530. ++#define AR_CH0_THERM_LOCAL 0x80000000
  7531. ++#define AR_CH0_THERM_START 0x20000000
  7532. ++#define AR_CH0_THERM_SAR_ADC_OUT 0x0000ff00
  7533. ++#define AR_CH0_THERM_SAR_ADC_OUT_S 8
  7534. +
  7535. + #define AR_CH0_TOP2 (AR_SREV_9300(ah) ? 0x1628c : \
  7536. + (AR_SREV_9462(ah) ? 0x16290 : 0x16284))
  7537. 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
  7538. deleted file mode 100644
  7539. index 012dea1..0000000
  7540. --- a/package/kernel/mac80211/patches/325-brcmfmac-sdio-Increase-the-default-timeouts-a-bit.patch
  7541. +++ /dev/null
  7542. @@ -1,41 +0,0 @@
  7543. -From: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
  7544. -Date: Mon, 25 Jan 2016 11:47:29 +0100
  7545. -Subject: [PATCH] brcmfmac: sdio: Increase the default timeouts a bit
  7546. -
  7547. -On a Radxa Rock2 board with a Ampak AP6335 (Broadcom 4339 core) it seems
  7548. -the card responds very quickly most of the time, unfortunately during
  7549. -initialisation it sometimes seems to take just a bit over 2 seconds to
  7550. -respond.
  7551. -
  7552. -This results intialization failing with message like:
  7553. - brcmf_c_preinit_dcmds: Retreiving cur_etheraddr failed, -52
  7554. - brcmf_bus_start: failed: -52
  7555. - brcmf_sdio_firmware_callback: dongle is not responding
  7556. -
  7557. -Increasing the timeout to allow for a bit more headroom allows the
  7558. -card to initialize reliably.
  7559. -
  7560. -A quick search online after diagnosing/fixing this showed that Google
  7561. -has a similar patch in their ChromeOS tree, so this doesn't seem
  7562. -specific to the board I'm using.
  7563. -
  7564. -Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
  7565. -Reviewed-by: Julian Calaby <julian.calaby@gmail.com>
  7566. -Acked-by: Arend van Spriel <arend@broadcom.com>
  7567. -Reviewed-by: Douglas Anderson <dianders@chromium.org>
  7568. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  7569. ----
  7570. -
  7571. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  7572. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  7573. -@@ -45,8 +45,8 @@
  7574. - #include "chip.h"
  7575. - #include "firmware.h"
  7576. -
  7577. --#define DCMD_RESP_TIMEOUT msecs_to_jiffies(2000)
  7578. --#define CTL_DONE_TIMEOUT msecs_to_jiffies(2000)
  7579. -+#define DCMD_RESP_TIMEOUT msecs_to_jiffies(2500)
  7580. -+#define CTL_DONE_TIMEOUT msecs_to_jiffies(2500)
  7581. -
  7582. - #ifdef DEBUG
  7583. -
  7584. 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
  7585. deleted file mode 100644
  7586. index 71f7a40..0000000
  7587. --- a/package/kernel/mac80211/patches/326-ath9k-make-NF-load-complete-quickly-and-reliably.patch
  7588. +++ /dev/null
  7589. @@ -1,87 +0,0 @@
  7590. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  7591. -Date: Fri, 5 Feb 2016 09:45:50 +0800
  7592. -Subject: [PATCH] ath9k: make NF load complete quickly and reliably
  7593. -
  7594. -Make NF load complete quickly and reliably. NF load execution
  7595. -is delayed by HW to end of frame if frame Rx or Tx is ongoing.
  7596. -Increasing timeout to max frame duration. If NF cal is ongoing
  7597. -before NF load, stop it before load, and restart it afterwards.
  7598. -
  7599. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  7600. ----
  7601. -
  7602. ---- a/drivers/net/wireless/ath/ath9k/calib.c
  7603. -+++ b/drivers/net/wireless/ath/ath9k/calib.c
  7604. -@@ -241,6 +241,7 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  7605. - u8 chainmask = (ah->rxchainmask << 3) | ah->rxchainmask;
  7606. - struct ath_common *common = ath9k_hw_common(ah);
  7607. - s16 default_nf = ath9k_hw_get_default_nf(ah, chan);
  7608. -+ u32 bb_agc_ctl = REG_READ(ah, AR_PHY_AGC_CONTROL);
  7609. -
  7610. - if (ah->caldata)
  7611. - h = ah->caldata->nfCalHist;
  7612. -@@ -264,6 +265,16 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  7613. - }
  7614. -
  7615. - /*
  7616. -+ * stop NF cal if ongoing to ensure NF load completes immediately
  7617. -+ * (or after end rx/tx frame if ongoing)
  7618. -+ */
  7619. -+ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_NF) {
  7620. -+ REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF);
  7621. -+ REG_RMW_BUFFER_FLUSH(ah);
  7622. -+ ENABLE_REG_RMW_BUFFER(ah);
  7623. -+ }
  7624. -+
  7625. -+ /*
  7626. - * Load software filtered NF value into baseband internal minCCApwr
  7627. - * variable.
  7628. - */
  7629. -@@ -276,18 +287,33 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  7630. -
  7631. - /*
  7632. - * Wait for load to complete, should be fast, a few 10s of us.
  7633. -- * The max delay was changed from an original 250us to 10000us
  7634. -- * since 250us often results in NF load timeout and causes deaf
  7635. -- * condition during stress testing 12/12/2009
  7636. -+ * The max delay was changed from an original 250us to 22.2 msec.
  7637. -+ * This would increase timeout to the longest possible frame
  7638. -+ * (11n max length 22.1 msec)
  7639. - */
  7640. -- for (j = 0; j < 10000; j++) {
  7641. -+ for (j = 0; j < 22200; j++) {
  7642. - if ((REG_READ(ah, AR_PHY_AGC_CONTROL) &
  7643. -- AR_PHY_AGC_CONTROL_NF) == 0)
  7644. -+ AR_PHY_AGC_CONTROL_NF) == 0)
  7645. - break;
  7646. - udelay(10);
  7647. - }
  7648. -
  7649. - /*
  7650. -+ * Restart NF so it can continue.
  7651. -+ */
  7652. -+ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_NF) {
  7653. -+ ENABLE_REG_RMW_BUFFER(ah);
  7654. -+ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_ENABLE_NF)
  7655. -+ REG_SET_BIT(ah, AR_PHY_AGC_CONTROL,
  7656. -+ AR_PHY_AGC_CONTROL_ENABLE_NF);
  7657. -+ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_NO_UPDATE_NF)
  7658. -+ REG_SET_BIT(ah, AR_PHY_AGC_CONTROL,
  7659. -+ AR_PHY_AGC_CONTROL_NO_UPDATE_NF);
  7660. -+ REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF);
  7661. -+ REG_RMW_BUFFER_FLUSH(ah);
  7662. -+ }
  7663. -+
  7664. -+ /*
  7665. - * We timed out waiting for the noisefloor to load, probably due to an
  7666. - * in-progress rx. Simply return here and allow the load plenty of time
  7667. - * to complete before the next calibration interval. We need to avoid
  7668. -@@ -296,7 +322,7 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  7669. - * here, the baseband nf cal will just be capped by our present
  7670. - * noisefloor until the next calibration timer.
  7671. - */
  7672. -- if (j == 10000) {
  7673. -+ if (j == 22200) {
  7674. - ath_dbg(common, ANY,
  7675. - "Timeout while waiting for nf to load: AR_PHY_AGC_CONTROL=0x%x\n",
  7676. - REG_READ(ah, AR_PHY_AGC_CONTROL));
  7677. 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
  7678. new file mode 100644
  7679. index 0000000..999d993
  7680. --- /dev/null
  7681. +++ b/package/kernel/mac80211/patches/326-ath9k_hw-simplify-ar9003_hw_per_calibration.patch
  7682. @@ -0,0 +1,88 @@
  7683. +From: Felix Fietkau <nbd@nbd.name>
  7684. +Date: Mon, 11 Jul 2016 11:34:47 +0200
  7685. +Subject: [PATCH] ath9k_hw: simplify ar9003_hw_per_calibration
  7686. +
  7687. +Reduce indentation, use a variable to save a few pointer dereferences
  7688. +
  7689. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  7690. +---
  7691. +
  7692. +--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  7693. ++++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  7694. +@@ -75,50 +75,49 @@ static bool ar9003_hw_per_calibration(st
  7695. + struct ath9k_cal_list *currCal)
  7696. + {
  7697. + struct ath9k_hw_cal_data *caldata = ah->caldata;
  7698. +- /* Cal is assumed not done until explicitly set below */
  7699. +- bool iscaldone = false;
  7700. ++ const struct ath9k_percal_data *cur_caldata = currCal->calData;
  7701. +
  7702. + /* Calibration in progress. */
  7703. + if (currCal->calState == CAL_RUNNING) {
  7704. + /* Check to see if it has finished. */
  7705. +- if (!(REG_READ(ah, AR_PHY_TIMING4) & AR_PHY_TIMING4_DO_CAL)) {
  7706. +- /*
  7707. +- * Accumulate cal measures for active chains
  7708. +- */
  7709. +- currCal->calData->calCollect(ah);
  7710. +- ah->cal_samples++;
  7711. ++ if (REG_READ(ah, AR_PHY_TIMING4) & AR_PHY_TIMING4_DO_CAL)
  7712. ++ return false;
  7713. +
  7714. +- if (ah->cal_samples >=
  7715. +- currCal->calData->calNumSamples) {
  7716. +- unsigned int i, numChains = 0;
  7717. +- for (i = 0; i < AR9300_MAX_CHAINS; i++) {
  7718. +- if (rxchainmask & (1 << i))
  7719. +- numChains++;
  7720. +- }
  7721. ++ /*
  7722. ++ * Accumulate cal measures for active chains
  7723. ++ */
  7724. ++ cur_caldata->calCollect(ah);
  7725. ++ ah->cal_samples++;
  7726. +
  7727. +- /*
  7728. +- * Process accumulated data
  7729. +- */
  7730. +- currCal->calData->calPostProc(ah, numChains);
  7731. ++ if (ah->cal_samples >= cur_caldata->calNumSamples) {
  7732. ++ unsigned int i, numChains = 0;
  7733. ++ for (i = 0; i < AR9300_MAX_CHAINS; i++) {
  7734. ++ if (rxchainmask & (1 << i))
  7735. ++ numChains++;
  7736. ++ }
  7737. +
  7738. +- /* Calibration has finished. */
  7739. +- caldata->CalValid |= currCal->calData->calType;
  7740. +- currCal->calState = CAL_DONE;
  7741. +- iscaldone = true;
  7742. +- } else {
  7743. ++ /*
  7744. ++ * Process accumulated data
  7745. ++ */
  7746. ++ cur_caldata->calPostProc(ah, numChains);
  7747. ++
  7748. ++ /* Calibration has finished. */
  7749. ++ caldata->CalValid |= cur_caldata->calType;
  7750. ++ currCal->calState = CAL_DONE;
  7751. ++ return true;
  7752. ++ } else {
  7753. + /*
  7754. + * Set-up collection of another sub-sample until we
  7755. + * get desired number
  7756. + */
  7757. + ar9003_hw_setup_calibration(ah, currCal);
  7758. +- }
  7759. + }
  7760. +- } else if (!(caldata->CalValid & currCal->calData->calType)) {
  7761. ++ } else if (!(caldata->CalValid & cur_caldata->calType)) {
  7762. + /* If current cal is marked invalid in channel, kick it off */
  7763. + ath9k_hw_reset_calibration(ah, currCal);
  7764. + }
  7765. +
  7766. +- return iscaldone;
  7767. ++ return false;
  7768. + }
  7769. +
  7770. + static int ar9003_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan,
  7771. 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
  7772. new file mode 100644
  7773. index 0000000..b7f3823
  7774. --- /dev/null
  7775. +++ b/package/kernel/mac80211/patches/327-ath9k_hw-get-rid-of-some-duplicate-code-in-calibrati.patch
  7776. @@ -0,0 +1,94 @@
  7777. +From: Felix Fietkau <nbd@nbd.name>
  7778. +Date: Mon, 11 Jul 2016 11:35:20 +0200
  7779. +Subject: [PATCH] ath9k_hw: get rid of some duplicate code in calibration
  7780. + init
  7781. +
  7782. +Remove a misleading debug message as well
  7783. +
  7784. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  7785. +---
  7786. +
  7787. +--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  7788. ++++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  7789. +@@ -1373,6 +1373,26 @@ static void ar9003_hw_cl_cal_post_proc(s
  7790. + }
  7791. + }
  7792. +
  7793. ++static void ar9003_hw_init_cal_common(struct ath_hw *ah)
  7794. ++{
  7795. ++ struct ath9k_hw_cal_data *caldata = ah->caldata;
  7796. ++
  7797. ++ /* Initialize list pointers */
  7798. ++ ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL;
  7799. ++
  7800. ++ INIT_CAL(&ah->iq_caldata);
  7801. ++ INSERT_CAL(ah, &ah->iq_caldata);
  7802. ++
  7803. ++ /* Initialize current pointer to first element in list */
  7804. ++ ah->cal_list_curr = ah->cal_list;
  7805. ++
  7806. ++ if (ah->cal_list_curr)
  7807. ++ ath9k_hw_reset_calibration(ah, ah->cal_list_curr);
  7808. ++
  7809. ++ if (caldata)
  7810. ++ caldata->CalValid = 0;
  7811. ++}
  7812. ++
  7813. + static bool ar9003_hw_init_cal_pcoem(struct ath_hw *ah,
  7814. + struct ath9k_channel *chan)
  7815. + {
  7816. +@@ -1532,21 +1552,7 @@ skip_tx_iqcal:
  7817. + /* Revert chainmask to runtime parameters */
  7818. + ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask);
  7819. +
  7820. +- /* Initialize list pointers */
  7821. +- ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL;
  7822. +-
  7823. +- INIT_CAL(&ah->iq_caldata);
  7824. +- INSERT_CAL(ah, &ah->iq_caldata);
  7825. +- ath_dbg(common, CALIBRATE, "enabling IQ Calibration\n");
  7826. +-
  7827. +- /* Initialize current pointer to first element in list */
  7828. +- ah->cal_list_curr = ah->cal_list;
  7829. +-
  7830. +- if (ah->cal_list_curr)
  7831. +- ath9k_hw_reset_calibration(ah, ah->cal_list_curr);
  7832. +-
  7833. +- if (caldata)
  7834. +- caldata->CalValid = 0;
  7835. ++ ar9003_hw_init_cal_common(ah);
  7836. +
  7837. + return true;
  7838. + }
  7839. +@@ -1577,8 +1583,6 @@ static bool do_ar9003_agc_cal(struct ath
  7840. + static bool ar9003_hw_init_cal_soc(struct ath_hw *ah,
  7841. + struct ath9k_channel *chan)
  7842. + {
  7843. +- struct ath_common *common = ath9k_hw_common(ah);
  7844. +- struct ath9k_hw_cal_data *caldata = ah->caldata;
  7845. + bool txiqcal_done = false;
  7846. + bool status = true;
  7847. + bool run_agc_cal = false, sep_iq_cal = false;
  7848. +@@ -1676,21 +1680,7 @@ skip_tx_iqcal:
  7849. + /* Revert chainmask to runtime parameters */
  7850. + ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask);
  7851. +
  7852. +- /* Initialize list pointers */
  7853. +- ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL;
  7854. +-
  7855. +- INIT_CAL(&ah->iq_caldata);
  7856. +- INSERT_CAL(ah, &ah->iq_caldata);
  7857. +- ath_dbg(common, CALIBRATE, "enabling IQ Calibration\n");
  7858. +-
  7859. +- /* Initialize current pointer to first element in list */
  7860. +- ah->cal_list_curr = ah->cal_list;
  7861. +-
  7862. +- if (ah->cal_list_curr)
  7863. +- ath9k_hw_reset_calibration(ah, ah->cal_list_curr);
  7864. +-
  7865. +- if (caldata)
  7866. +- caldata->CalValid = 0;
  7867. ++ ar9003_hw_init_cal_common(ah);
  7868. +
  7869. + return true;
  7870. + }
  7871. 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
  7872. deleted file mode 100644
  7873. index f7f9df9..0000000
  7874. --- a/package/kernel/mac80211/patches/327-mac80211-Remove-MPP-table-entries-with-MPath.patch
  7875. +++ /dev/null
  7876. @@ -1,54 +0,0 @@
  7877. -From: Henning Rogge <hrogge@gmail.com>
  7878. -Date: Wed, 3 Feb 2016 13:58:36 +0100
  7879. -Subject: [PATCH] mac80211: Remove MPP table entries with MPath
  7880. -
  7881. -Make the mesh_path_del() function remove all mpp table entries
  7882. -that are proxied by the removed mesh path.
  7883. -
  7884. -Acked-by: Bob Copeland <me@bobcopeland.com>
  7885. -Signed-off-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
  7886. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  7887. ----
  7888. -
  7889. ---- a/net/mac80211/mesh_pathtbl.c
  7890. -+++ b/net/mac80211/mesh_pathtbl.c
  7891. -@@ -835,6 +835,29 @@ void mesh_path_flush_by_nexthop(struct s
  7892. - rcu_read_unlock();
  7893. - }
  7894. -
  7895. -+static void mpp_flush_by_proxy(struct ieee80211_sub_if_data *sdata,
  7896. -+ const u8 *proxy)
  7897. -+{
  7898. -+ struct mesh_table *tbl;
  7899. -+ struct mesh_path *mpp;
  7900. -+ struct mpath_node *node;
  7901. -+ int i;
  7902. -+
  7903. -+ rcu_read_lock();
  7904. -+ read_lock_bh(&pathtbl_resize_lock);
  7905. -+ tbl = resize_dereference_mpp_paths();
  7906. -+ for_each_mesh_entry(tbl, node, i) {
  7907. -+ mpp = node->mpath;
  7908. -+ if (ether_addr_equal(mpp->mpp, proxy)) {
  7909. -+ spin_lock(&tbl->hashwlock[i]);
  7910. -+ __mesh_path_del(tbl, node);
  7911. -+ spin_unlock(&tbl->hashwlock[i]);
  7912. -+ }
  7913. -+ }
  7914. -+ read_unlock_bh(&pathtbl_resize_lock);
  7915. -+ rcu_read_unlock();
  7916. -+}
  7917. -+
  7918. - static void table_flush_by_iface(struct mesh_table *tbl,
  7919. - struct ieee80211_sub_if_data *sdata)
  7920. - {
  7921. -@@ -892,6 +915,9 @@ int mesh_path_del(struct ieee80211_sub_i
  7922. - int hash_idx;
  7923. - int err = 0;
  7924. -
  7925. -+ /* flush relevant mpp entries first */
  7926. -+ mpp_flush_by_proxy(sdata, addr);
  7927. -+
  7928. - read_lock_bh(&pathtbl_resize_lock);
  7929. - tbl = resize_dereference_mesh_paths();
  7930. - hash_idx = mesh_table_hash(addr, sdata, tbl);
  7931. 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
  7932. new file mode 100644
  7933. index 0000000..cff32ad
  7934. --- /dev/null
  7935. +++ b/package/kernel/mac80211/patches/328-ath9k_hw-implement-temperature-compensation-support-.patch
  7936. @@ -0,0 +1,97 @@
  7937. +From: Felix Fietkau <nbd@nbd.name>
  7938. +Date: Mon, 11 Jul 2016 11:35:55 +0200
  7939. +Subject: [PATCH] ath9k_hw: implement temperature compensation support for
  7940. + AR9003+
  7941. +
  7942. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  7943. +---
  7944. +
  7945. +--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  7946. ++++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  7947. +@@ -33,6 +33,7 @@ struct coeff {
  7948. +
  7949. + enum ar9003_cal_types {
  7950. + IQ_MISMATCH_CAL = BIT(0),
  7951. ++ TEMP_COMP_CAL = BIT(1),
  7952. + };
  7953. +
  7954. + static void ar9003_hw_setup_calibration(struct ath_hw *ah,
  7955. +@@ -58,6 +59,12 @@ static void ar9003_hw_setup_calibration(
  7956. + /* Kick-off cal */
  7957. + REG_SET_BIT(ah, AR_PHY_TIMING4, AR_PHY_TIMING4_DO_CAL);
  7958. + break;
  7959. ++ case TEMP_COMP_CAL:
  7960. ++ ath_dbg(common, CALIBRATE,
  7961. ++ "starting Temperature Compensation Calibration\n");
  7962. ++ REG_SET_BIT(ah, AR_CH0_THERM, AR_CH0_THERM_LOCAL);
  7963. ++ REG_SET_BIT(ah, AR_CH0_THERM, AR_CH0_THERM_START);
  7964. ++ break;
  7965. + default:
  7966. + ath_err(common, "Invalid calibration type\n");
  7967. + break;
  7968. +@@ -86,7 +93,8 @@ static bool ar9003_hw_per_calibration(st
  7969. + /*
  7970. + * Accumulate cal measures for active chains
  7971. + */
  7972. +- cur_caldata->calCollect(ah);
  7973. ++ if (cur_caldata->calCollect)
  7974. ++ cur_caldata->calCollect(ah);
  7975. + ah->cal_samples++;
  7976. +
  7977. + if (ah->cal_samples >= cur_caldata->calNumSamples) {
  7978. +@@ -99,7 +107,8 @@ static bool ar9003_hw_per_calibration(st
  7979. + /*
  7980. + * Process accumulated data
  7981. + */
  7982. +- cur_caldata->calPostProc(ah, numChains);
  7983. ++ if (cur_caldata->calPostProc)
  7984. ++ cur_caldata->calPostProc(ah, numChains);
  7985. +
  7986. + /* Calibration has finished. */
  7987. + caldata->CalValid |= cur_caldata->calType;
  7988. +@@ -314,9 +323,16 @@ static const struct ath9k_percal_data iq
  7989. + ar9003_hw_iqcalibrate
  7990. + };
  7991. +
  7992. ++static const struct ath9k_percal_data temp_cal_single_sample = {
  7993. ++ TEMP_COMP_CAL,
  7994. ++ MIN_CAL_SAMPLES,
  7995. ++ PER_MAX_LOG_COUNT,
  7996. ++};
  7997. ++
  7998. + static void ar9003_hw_init_cal_settings(struct ath_hw *ah)
  7999. + {
  8000. + ah->iq_caldata.calData = &iq_cal_single_sample;
  8001. ++ ah->temp_caldata.calData = &temp_cal_single_sample;
  8002. +
  8003. + if (AR_SREV_9300_20_OR_LATER(ah)) {
  8004. + ah->enabled_cals |= TX_IQ_CAL;
  8005. +@@ -324,7 +340,7 @@ static void ar9003_hw_init_cal_settings(
  8006. + ah->enabled_cals |= TX_IQ_ON_AGC_CAL;
  8007. + }
  8008. +
  8009. +- ah->supp_cals = IQ_MISMATCH_CAL;
  8010. ++ ah->supp_cals = IQ_MISMATCH_CAL | TEMP_COMP_CAL;
  8011. + }
  8012. +
  8013. + #define OFF_UPPER_LT 24
  8014. +@@ -1383,6 +1399,9 @@ static void ar9003_hw_init_cal_common(st
  8015. + INIT_CAL(&ah->iq_caldata);
  8016. + INSERT_CAL(ah, &ah->iq_caldata);
  8017. +
  8018. ++ INIT_CAL(&ah->temp_caldata);
  8019. ++ INSERT_CAL(ah, &ah->temp_caldata);
  8020. ++
  8021. + /* Initialize current pointer to first element in list */
  8022. + ah->cal_list_curr = ah->cal_list;
  8023. +
  8024. +--- a/drivers/net/wireless/ath/ath9k/hw.h
  8025. ++++ b/drivers/net/wireless/ath/ath9k/hw.h
  8026. +@@ -830,6 +830,7 @@ struct ath_hw {
  8027. + /* Calibration */
  8028. + u32 supp_cals;
  8029. + struct ath9k_cal_list iq_caldata;
  8030. ++ struct ath9k_cal_list temp_caldata;
  8031. + struct ath9k_cal_list adcgain_caldata;
  8032. + struct ath9k_cal_list adcdc_caldata;
  8033. + struct ath9k_cal_list *cal_list;
  8034. 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
  8035. deleted file mode 100644
  8036. index 740993c..0000000
  8037. --- a/package/kernel/mac80211/patches/328-mac80211-let-unused-MPP-table-entries-timeout.patch
  8038. +++ /dev/null
  8039. @@ -1,104 +0,0 @@
  8040. -From: Henning Rogge <hrogge@gmail.com>
  8041. -Date: Wed, 3 Feb 2016 13:58:37 +0100
  8042. -Subject: [PATCH] mac80211: let unused MPP table entries timeout
  8043. -
  8044. -Remember the last time when a mpp table entry is used for
  8045. -rx or tx and remove them after MESH_PATH_EXPIRE time.
  8046. -
  8047. -Acked-by: Bob Copeland <me@bobcopeland.com>
  8048. -Signed-off-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
  8049. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  8050. ----
  8051. -
  8052. ---- a/net/mac80211/mesh_pathtbl.c
  8053. -+++ b/net/mac80211/mesh_pathtbl.c
  8054. -@@ -942,6 +942,46 @@ enddel:
  8055. - }
  8056. -
  8057. - /**
  8058. -+ * mpp_path_del - delete a mesh proxy path from the table
  8059. -+ *
  8060. -+ * @addr: addr address (ETH_ALEN length)
  8061. -+ * @sdata: local subif
  8062. -+ *
  8063. -+ * Returns: 0 if successful
  8064. -+ */
  8065. -+static int mpp_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr)
  8066. -+{
  8067. -+ struct mesh_table *tbl;
  8068. -+ struct mesh_path *mpath;
  8069. -+ struct mpath_node *node;
  8070. -+ struct hlist_head *bucket;
  8071. -+ int hash_idx;
  8072. -+ int err = 0;
  8073. -+
  8074. -+ read_lock_bh(&pathtbl_resize_lock);
  8075. -+ tbl = resize_dereference_mpp_paths();
  8076. -+ hash_idx = mesh_table_hash(addr, sdata, tbl);
  8077. -+ bucket = &tbl->hash_buckets[hash_idx];
  8078. -+
  8079. -+ spin_lock(&tbl->hashwlock[hash_idx]);
  8080. -+ hlist_for_each_entry(node, bucket, list) {
  8081. -+ mpath = node->mpath;
  8082. -+ if (mpath->sdata == sdata &&
  8083. -+ ether_addr_equal(addr, mpath->dst)) {
  8084. -+ __mesh_path_del(tbl, node);
  8085. -+ goto enddel;
  8086. -+ }
  8087. -+ }
  8088. -+
  8089. -+ err = -ENXIO;
  8090. -+enddel:
  8091. -+ mesh_paths_generation++;
  8092. -+ spin_unlock(&tbl->hashwlock[hash_idx]);
  8093. -+ read_unlock_bh(&pathtbl_resize_lock);
  8094. -+ return err;
  8095. -+}
  8096. -+
  8097. -+/**
  8098. - * mesh_path_tx_pending - sends pending frames in a mesh path queue
  8099. - *
  8100. - * @mpath: mesh path to activate
  8101. -@@ -1157,6 +1197,17 @@ void mesh_path_expire(struct ieee80211_s
  8102. - time_after(jiffies, mpath->exp_time + MESH_PATH_EXPIRE))
  8103. - mesh_path_del(mpath->sdata, mpath->dst);
  8104. - }
  8105. -+
  8106. -+ tbl = rcu_dereference(mpp_paths);
  8107. -+ for_each_mesh_entry(tbl, node, i) {
  8108. -+ if (node->mpath->sdata != sdata)
  8109. -+ continue;
  8110. -+ mpath = node->mpath;
  8111. -+ if ((!(mpath->flags & MESH_PATH_FIXED)) &&
  8112. -+ time_after(jiffies, mpath->exp_time + MESH_PATH_EXPIRE))
  8113. -+ mpp_path_del(mpath->sdata, mpath->dst);
  8114. -+ }
  8115. -+
  8116. - rcu_read_unlock();
  8117. - }
  8118. -
  8119. ---- a/net/mac80211/rx.c
  8120. -+++ b/net/mac80211/rx.c
  8121. -@@ -2291,6 +2291,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
  8122. - spin_lock_bh(&mppath->state_lock);
  8123. - if (!ether_addr_equal(mppath->mpp, mpp_addr))
  8124. - memcpy(mppath->mpp, mpp_addr, ETH_ALEN);
  8125. -+ mppath->exp_time = jiffies;
  8126. - spin_unlock_bh(&mppath->state_lock);
  8127. - }
  8128. - rcu_read_unlock();
  8129. ---- a/net/mac80211/tx.c
  8130. -+++ b/net/mac80211/tx.c
  8131. -@@ -2171,8 +2171,11 @@ static struct sk_buff *ieee80211_build_h
  8132. - mpp_lookup = true;
  8133. - }
  8134. -
  8135. -- if (mpp_lookup)
  8136. -+ if (mpp_lookup) {
  8137. - mppath = mpp_path_lookup(sdata, skb->data);
  8138. -+ if (mppath)
  8139. -+ mppath->exp_time = jiffies;
  8140. -+ }
  8141. -
  8142. - if (mppath && mpath)
  8143. - mesh_path_del(mpath->sdata, mpath->dst);
  8144. 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
  8145. deleted file mode 100644
  8146. index 0c36b1d..0000000
  8147. --- a/package/kernel/mac80211/patches/329-mac80211-Unify-mesh-and-mpp-path-removal-function.patch
  8148. +++ /dev/null
  8149. @@ -1,143 +0,0 @@
  8150. -From: Henning Rogge <hrogge@gmail.com>
  8151. -Date: Wed, 3 Feb 2016 13:58:38 +0100
  8152. -Subject: [PATCH] mac80211: Unify mesh and mpp path removal function
  8153. -
  8154. -mpp_path_del() and mesh_path_del() are mostly the same function.
  8155. -Move common code into a new static function.
  8156. -
  8157. -Acked-by: Bob Copeland <me@bobcopeland.com>
  8158. -Signed-off-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
  8159. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  8160. ----
  8161. -
  8162. ---- a/net/mac80211/mesh_pathtbl.c
  8163. -+++ b/net/mac80211/mesh_pathtbl.c
  8164. -@@ -55,16 +55,21 @@ int mpp_paths_generation;
  8165. - static DEFINE_RWLOCK(pathtbl_resize_lock);
  8166. -
  8167. -
  8168. -+static inline struct mesh_table *resize_dereference_paths(
  8169. -+ struct mesh_table __rcu *table)
  8170. -+{
  8171. -+ return rcu_dereference_protected(table,
  8172. -+ lockdep_is_held(&pathtbl_resize_lock));
  8173. -+}
  8174. -+
  8175. - static inline struct mesh_table *resize_dereference_mesh_paths(void)
  8176. - {
  8177. -- return rcu_dereference_protected(mesh_paths,
  8178. -- lockdep_is_held(&pathtbl_resize_lock));
  8179. -+ return resize_dereference_paths(mesh_paths);
  8180. - }
  8181. -
  8182. - static inline struct mesh_table *resize_dereference_mpp_paths(void)
  8183. - {
  8184. -- return rcu_dereference_protected(mpp_paths,
  8185. -- lockdep_is_held(&pathtbl_resize_lock));
  8186. -+ return resize_dereference_paths(mpp_paths);
  8187. - }
  8188. -
  8189. - /*
  8190. -@@ -899,14 +904,17 @@ void mesh_path_flush_by_iface(struct iee
  8191. - }
  8192. -
  8193. - /**
  8194. -- * mesh_path_del - delete a mesh path from the table
  8195. -+ * table_path_del - delete a path from the mesh or mpp table
  8196. - *
  8197. -- * @addr: dst address (ETH_ALEN length)
  8198. -+ * @tbl: mesh or mpp path table
  8199. - * @sdata: local subif
  8200. -+ * @addr: dst address (ETH_ALEN length)
  8201. - *
  8202. - * Returns: 0 if successful
  8203. - */
  8204. --int mesh_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr)
  8205. -+static int table_path_del(struct mesh_table __rcu *rcu_tbl,
  8206. -+ struct ieee80211_sub_if_data *sdata,
  8207. -+ const u8 *addr)
  8208. - {
  8209. - struct mesh_table *tbl;
  8210. - struct mesh_path *mpath;
  8211. -@@ -915,11 +923,7 @@ int mesh_path_del(struct ieee80211_sub_i
  8212. - int hash_idx;
  8213. - int err = 0;
  8214. -
  8215. -- /* flush relevant mpp entries first */
  8216. -- mpp_flush_by_proxy(sdata, addr);
  8217. --
  8218. -- read_lock_bh(&pathtbl_resize_lock);
  8219. -- tbl = resize_dereference_mesh_paths();
  8220. -+ tbl = resize_dereference_paths(rcu_tbl);
  8221. - hash_idx = mesh_table_hash(addr, sdata, tbl);
  8222. - bucket = &tbl->hash_buckets[hash_idx];
  8223. -
  8224. -@@ -935,9 +939,30 @@ int mesh_path_del(struct ieee80211_sub_i
  8225. -
  8226. - err = -ENXIO;
  8227. - enddel:
  8228. -- mesh_paths_generation++;
  8229. - spin_unlock(&tbl->hashwlock[hash_idx]);
  8230. -+ return err;
  8231. -+}
  8232. -+
  8233. -+/**
  8234. -+ * mesh_path_del - delete a mesh path from the table
  8235. -+ *
  8236. -+ * @addr: dst address (ETH_ALEN length)
  8237. -+ * @sdata: local subif
  8238. -+ *
  8239. -+ * Returns: 0 if successful
  8240. -+ */
  8241. -+int mesh_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr)
  8242. -+{
  8243. -+ int err = 0;
  8244. -+
  8245. -+ /* flush relevant mpp entries first */
  8246. -+ mpp_flush_by_proxy(sdata, addr);
  8247. -+
  8248. -+ read_lock_bh(&pathtbl_resize_lock);
  8249. -+ err = table_path_del(mesh_paths, sdata, addr);
  8250. -+ mesh_paths_generation++;
  8251. - read_unlock_bh(&pathtbl_resize_lock);
  8252. -+
  8253. - return err;
  8254. - }
  8255. -
  8256. -@@ -951,33 +976,13 @@ enddel:
  8257. - */
  8258. - static int mpp_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr)
  8259. - {
  8260. -- struct mesh_table *tbl;
  8261. -- struct mesh_path *mpath;
  8262. -- struct mpath_node *node;
  8263. -- struct hlist_head *bucket;
  8264. -- int hash_idx;
  8265. - int err = 0;
  8266. -
  8267. - read_lock_bh(&pathtbl_resize_lock);
  8268. -- tbl = resize_dereference_mpp_paths();
  8269. -- hash_idx = mesh_table_hash(addr, sdata, tbl);
  8270. -- bucket = &tbl->hash_buckets[hash_idx];
  8271. --
  8272. -- spin_lock(&tbl->hashwlock[hash_idx]);
  8273. -- hlist_for_each_entry(node, bucket, list) {
  8274. -- mpath = node->mpath;
  8275. -- if (mpath->sdata == sdata &&
  8276. -- ether_addr_equal(addr, mpath->dst)) {
  8277. -- __mesh_path_del(tbl, node);
  8278. -- goto enddel;
  8279. -- }
  8280. -- }
  8281. --
  8282. -- err = -ENXIO;
  8283. --enddel:
  8284. -- mesh_paths_generation++;
  8285. -- spin_unlock(&tbl->hashwlock[hash_idx]);
  8286. -+ err = table_path_del(mpp_paths, sdata, addr);
  8287. -+ mpp_paths_generation++;
  8288. - read_unlock_bh(&pathtbl_resize_lock);
  8289. -+
  8290. - return err;
  8291. - }
  8292. -
  8293. 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
  8294. new file mode 100644
  8295. index 0000000..38e541c
  8296. --- /dev/null
  8297. +++ b/package/kernel/mac80211/patches/329-mac80211-fix-check-for-buffered-powersave-frames-wit.patch
  8298. @@ -0,0 +1,21 @@
  8299. +From: Felix Fietkau <nbd@nbd.name>
  8300. +Date: Mon, 11 Jul 2016 15:07:06 +0200
  8301. +Subject: [PATCH] mac80211: fix check for buffered powersave frames with txq
  8302. +
  8303. +The logic was inverted here, set the bit if frames are pending.
  8304. +
  8305. +Fixes: ba8c3d6f16a1 ("mac80211: add an intermediate software queue implementation")
  8306. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  8307. +---
  8308. +
  8309. +--- a/net/mac80211/rx.c
  8310. ++++ b/net/mac80211/rx.c
  8311. +@@ -1268,7 +1268,7 @@ static void sta_ps_start(struct sta_info
  8312. + for (tid = 0; tid < ARRAY_SIZE(sta->sta.txq); tid++) {
  8313. + struct txq_info *txqi = to_txq_info(sta->sta.txq[tid]);
  8314. +
  8315. +- if (!txqi->tin.backlog_packets)
  8316. ++ if (txqi->tin.backlog_packets)
  8317. + set_bit(tid, &sta->txq_buffered_tids);
  8318. + else
  8319. + clear_bit(tid, &sta->txq_buffered_tids);
  8320. 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
  8321. new file mode 100644
  8322. index 0000000..a6031b9
  8323. --- /dev/null
  8324. +++ b/package/kernel/mac80211/patches/330-ath10k-fix-rx-status-reporting-for-A-MSDU-subframes.patch
  8325. @@ -0,0 +1,36 @@
  8326. +From: Felix Fietkau <nbd@nbd.name>
  8327. +Date: Sun, 17 Jul 2016 12:49:59 +0200
  8328. +Subject: [PATCH] ath10k: fix rx status reporting for A-MSDU subframes
  8329. +
  8330. +Patch by Nagarajan, Ashok Raj <arnagara@qti.qualcomm.com>
  8331. +
  8332. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  8333. +---
  8334. +
  8335. +--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
  8336. ++++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
  8337. +@@ -1525,7 +1525,7 @@ static void ath10k_htt_rx_h_filter(struc
  8338. + static int ath10k_htt_rx_handle_amsdu(struct ath10k_htt *htt)
  8339. + {
  8340. + struct ath10k *ar = htt->ar;
  8341. +- static struct ieee80211_rx_status rx_status;
  8342. ++ struct ieee80211_rx_status *rx_status = &htt->rx_status;
  8343. + struct sk_buff_head amsdu;
  8344. + int ret;
  8345. +
  8346. +@@ -1549,11 +1549,11 @@ static int ath10k_htt_rx_handle_amsdu(st
  8347. + return ret;
  8348. + }
  8349. +
  8350. +- ath10k_htt_rx_h_ppdu(ar, &amsdu, &rx_status, 0xffff);
  8351. ++ ath10k_htt_rx_h_ppdu(ar, &amsdu, rx_status, 0xffff);
  8352. + ath10k_htt_rx_h_unchain(ar, &amsdu, ret > 0);
  8353. +- ath10k_htt_rx_h_filter(ar, &amsdu, &rx_status);
  8354. +- ath10k_htt_rx_h_mpdu(ar, &amsdu, &rx_status);
  8355. +- ath10k_htt_rx_h_deliver(ar, &amsdu, &rx_status);
  8356. ++ ath10k_htt_rx_h_filter(ar, &amsdu, rx_status);
  8357. ++ ath10k_htt_rx_h_mpdu(ar, &amsdu, rx_status);
  8358. ++ ath10k_htt_rx_h_deliver(ar, &amsdu, rx_status);
  8359. +
  8360. + return 0;
  8361. + }
  8362. 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
  8363. deleted file mode 100644
  8364. index 4dc6d66..0000000
  8365. --- a/package/kernel/mac80211/patches/330-mac80211-minstrel-Change-expected-throughput-unit-ba.patch
  8366. +++ /dev/null
  8367. @@ -1,51 +0,0 @@
  8368. -From: Sven Eckelmann <sven.eckelmann@open-mesh.com>
  8369. -Date: Tue, 2 Feb 2016 08:12:26 +0100
  8370. -Subject: [PATCH] mac80211: minstrel: Change expected throughput unit back to
  8371. - Kbps
  8372. -
  8373. -The change from cur_tp to the function
  8374. -minstrel_get_tp_avg/minstrel_ht_get_tp_avg changed the unit used for the
  8375. -current throughput. For example in minstrel_ht the correct
  8376. -conversion between them would be:
  8377. -
  8378. - mrs->cur_tp / 10 == minstrel_ht_get_tp_avg(..).
  8379. -
  8380. -This factor 10 must also be included in the calculation of
  8381. -minstrel_get_expected_throughput and minstrel_ht_get_expected_throughput to
  8382. -return values with the unit [Kbps] instead of [10Kbps]. Otherwise routing
  8383. -algorithms like B.A.T.M.A.N. V will make incorrect decision based on these
  8384. -values. Its kernel based implementation expects expected_throughput always
  8385. -to have the unit [Kbps] and not sometimes [10Kbps] and sometimes [Kbps].
  8386. -
  8387. -The same requirement has iw or olsrdv2's nl80211 based statistics module
  8388. -which retrieve the same data via NL80211_STA_INFO_TX_BITRATE.
  8389. -
  8390. -Cc: stable@vger.kernel.org
  8391. -Fixes: 6a27b2c40b48 ("mac80211: restructure per-rate throughput calculation into function")
  8392. -Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
  8393. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  8394. ----
  8395. -
  8396. ---- a/net/mac80211/rc80211_minstrel.c
  8397. -+++ b/net/mac80211/rc80211_minstrel.c
  8398. -@@ -711,7 +711,7 @@ static u32 minstrel_get_expected_through
  8399. - * computing cur_tp
  8400. - */
  8401. - tmp_mrs = &mi->r[idx].stats;
  8402. -- tmp_cur_tp = minstrel_get_tp_avg(&mi->r[idx], tmp_mrs->prob_ewma);
  8403. -+ tmp_cur_tp = minstrel_get_tp_avg(&mi->r[idx], tmp_mrs->prob_ewma) * 10;
  8404. - tmp_cur_tp = tmp_cur_tp * 1200 * 8 / 1024;
  8405. -
  8406. - return tmp_cur_tp;
  8407. ---- a/net/mac80211/rc80211_minstrel_ht.c
  8408. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  8409. -@@ -1335,7 +1335,8 @@ static u32 minstrel_ht_get_expected_thro
  8410. - prob = mi->groups[i].rates[j].prob_ewma;
  8411. -
  8412. - /* convert tp_avg from pkt per second in kbps */
  8413. -- tp_avg = minstrel_ht_get_tp_avg(mi, i, j, prob) * AVG_PKT_SIZE * 8 / 1024;
  8414. -+ tp_avg = minstrel_ht_get_tp_avg(mi, i, j, prob) * 10;
  8415. -+ tp_avg = tp_avg * AVG_PKT_SIZE * 8 / 1024;
  8416. -
  8417. - return tp_avg;
  8418. - }
  8419. 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
  8420. deleted file mode 100644
  8421. index 1fd016f..0000000
  8422. --- a/package/kernel/mac80211/patches/331-brcmfmac-Increase-nr-of-supported-flowrings.patch
  8423. +++ /dev/null
  8424. @@ -1,307 +0,0 @@
  8425. -From: Hante Meuleman <meuleman@broadcom.com>
  8426. -Date: Sun, 7 Feb 2016 18:08:24 +0100
  8427. -Subject: [PATCH] brcmfmac: Increase nr of supported flowrings.
  8428. -MIME-Version: 1.0
  8429. -Content-Type: text/plain; charset=UTF-8
  8430. -Content-Transfer-Encoding: 8bit
  8431. -
  8432. -New generation devices have firmware which has more than 256 flowrings.
  8433. -E.g. following debugging message comes from 14e4:4365 BCM4366:
  8434. -[ 194.606245] brcmfmac: brcmf_pcie_init_ringbuffers Nr of flowrings is 264
  8435. -
  8436. -At various code places (related to flowrings) we were using u8 which
  8437. -could lead to storing wrong number or infinite loops when indexing with
  8438. -this type. This issue was quite easy to spot in brcmf_flowring_detach
  8439. -where it led to infinite loop e.g. on failed initialization.
  8440. -
  8441. -This patch switches code to proper types and increases the maximum
  8442. -number of supported flowrings to 512.
  8443. -
  8444. -Originally this change was sent in September 2015, but back it was
  8445. -causing a regression on BCM43602 resulting in:
  8446. -Unable to handle kernel NULL pointer dereference at virtual address ...
  8447. -
  8448. -The reason for this regression was missing update (s/u8/u16) of struct
  8449. -brcmf_flowring_ring. This problem was handled in 9f64df9 ("brcmfmac: Fix
  8450. -bug in flowring management."). Starting with that it's safe to apply
  8451. -this original patch as it doesn't cause a regression anymore.
  8452. -
  8453. -This patch fixes an infinite loop on BCM4366 which is supported since
  8454. -4.4 so it makes sense to apply it to stable 4.4+.
  8455. -
  8456. -Cc: <stable@vger.kernel.org> # 4.4+
  8457. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  8458. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  8459. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  8460. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  8461. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  8462. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  8463. ----
  8464. -
  8465. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c
  8466. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c
  8467. -@@ -32,7 +32,7 @@
  8468. - #define BRCMF_FLOWRING_LOW (BRCMF_FLOWRING_HIGH - 256)
  8469. - #define BRCMF_FLOWRING_INVALID_IFIDX 0xff
  8470. -
  8471. --#define BRCMF_FLOWRING_HASH_AP(da, fifo, ifidx) (da[5] + fifo + ifidx * 16)
  8472. -+#define BRCMF_FLOWRING_HASH_AP(da, fifo, ifidx) (da[5] * 2 + fifo + ifidx * 16)
  8473. - #define BRCMF_FLOWRING_HASH_STA(fifo, ifidx) (fifo + ifidx * 16)
  8474. -
  8475. - static const u8 brcmf_flowring_prio2fifo[] = {
  8476. -@@ -68,7 +68,7 @@ u32 brcmf_flowring_lookup(struct brcmf_f
  8477. - u8 prio, u8 ifidx)
  8478. - {
  8479. - struct brcmf_flowring_hash *hash;
  8480. -- u8 hash_idx;
  8481. -+ u16 hash_idx;
  8482. - u32 i;
  8483. - bool found;
  8484. - bool sta;
  8485. -@@ -88,6 +88,7 @@ u32 brcmf_flowring_lookup(struct brcmf_f
  8486. - }
  8487. - hash_idx = sta ? BRCMF_FLOWRING_HASH_STA(fifo, ifidx) :
  8488. - BRCMF_FLOWRING_HASH_AP(mac, fifo, ifidx);
  8489. -+ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1);
  8490. - found = false;
  8491. - hash = flow->hash;
  8492. - for (i = 0; i < BRCMF_FLOWRING_HASHSIZE; i++) {
  8493. -@@ -98,6 +99,7 @@ u32 brcmf_flowring_lookup(struct brcmf_f
  8494. - break;
  8495. - }
  8496. - hash_idx++;
  8497. -+ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1);
  8498. - }
  8499. - if (found)
  8500. - return hash[hash_idx].flowid;
  8501. -@@ -111,7 +113,7 @@ u32 brcmf_flowring_create(struct brcmf_f
  8502. - {
  8503. - struct brcmf_flowring_ring *ring;
  8504. - struct brcmf_flowring_hash *hash;
  8505. -- u8 hash_idx;
  8506. -+ u16 hash_idx;
  8507. - u32 i;
  8508. - bool found;
  8509. - u8 fifo;
  8510. -@@ -131,6 +133,7 @@ u32 brcmf_flowring_create(struct brcmf_f
  8511. - }
  8512. - hash_idx = sta ? BRCMF_FLOWRING_HASH_STA(fifo, ifidx) :
  8513. - BRCMF_FLOWRING_HASH_AP(mac, fifo, ifidx);
  8514. -+ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1);
  8515. - found = false;
  8516. - hash = flow->hash;
  8517. - for (i = 0; i < BRCMF_FLOWRING_HASHSIZE; i++) {
  8518. -@@ -140,6 +143,7 @@ u32 brcmf_flowring_create(struct brcmf_f
  8519. - break;
  8520. - }
  8521. - hash_idx++;
  8522. -+ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1);
  8523. - }
  8524. - if (found) {
  8525. - for (i = 0; i < flow->nrofrings; i++) {
  8526. -@@ -169,7 +173,7 @@ u32 brcmf_flowring_create(struct brcmf_f
  8527. - }
  8528. -
  8529. -
  8530. --u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u8 flowid)
  8531. -+u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u16 flowid)
  8532. - {
  8533. - struct brcmf_flowring_ring *ring;
  8534. -
  8535. -@@ -179,7 +183,7 @@ u8 brcmf_flowring_tid(struct brcmf_flowr
  8536. - }
  8537. -
  8538. -
  8539. --static void brcmf_flowring_block(struct brcmf_flowring *flow, u8 flowid,
  8540. -+static void brcmf_flowring_block(struct brcmf_flowring *flow, u16 flowid,
  8541. - bool blocked)
  8542. - {
  8543. - struct brcmf_flowring_ring *ring;
  8544. -@@ -228,10 +232,10 @@ static void brcmf_flowring_block(struct
  8545. - }
  8546. -
  8547. -
  8548. --void brcmf_flowring_delete(struct brcmf_flowring *flow, u8 flowid)
  8549. -+void brcmf_flowring_delete(struct brcmf_flowring *flow, u16 flowid)
  8550. - {
  8551. - struct brcmf_flowring_ring *ring;
  8552. -- u8 hash_idx;
  8553. -+ u16 hash_idx;
  8554. - struct sk_buff *skb;
  8555. -
  8556. - ring = flow->rings[flowid];
  8557. -@@ -253,7 +257,7 @@ void brcmf_flowring_delete(struct brcmf_
  8558. - }
  8559. -
  8560. -
  8561. --u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  8562. -+u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u16 flowid,
  8563. - struct sk_buff *skb)
  8564. - {
  8565. - struct brcmf_flowring_ring *ring;
  8566. -@@ -279,7 +283,7 @@ u32 brcmf_flowring_enqueue(struct brcmf_
  8567. - }
  8568. -
  8569. -
  8570. --struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u8 flowid)
  8571. -+struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u16 flowid)
  8572. - {
  8573. - struct brcmf_flowring_ring *ring;
  8574. - struct sk_buff *skb;
  8575. -@@ -300,7 +304,7 @@ struct sk_buff *brcmf_flowring_dequeue(s
  8576. - }
  8577. -
  8578. -
  8579. --void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u8 flowid,
  8580. -+void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u16 flowid,
  8581. - struct sk_buff *skb)
  8582. - {
  8583. - struct brcmf_flowring_ring *ring;
  8584. -@@ -311,7 +315,7 @@ void brcmf_flowring_reinsert(struct brcm
  8585. - }
  8586. -
  8587. -
  8588. --u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u8 flowid)
  8589. -+u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u16 flowid)
  8590. - {
  8591. - struct brcmf_flowring_ring *ring;
  8592. -
  8593. -@@ -326,7 +330,7 @@ u32 brcmf_flowring_qlen(struct brcmf_flo
  8594. - }
  8595. -
  8596. -
  8597. --void brcmf_flowring_open(struct brcmf_flowring *flow, u8 flowid)
  8598. -+void brcmf_flowring_open(struct brcmf_flowring *flow, u16 flowid)
  8599. - {
  8600. - struct brcmf_flowring_ring *ring;
  8601. -
  8602. -@@ -340,10 +344,10 @@ void brcmf_flowring_open(struct brcmf_fl
  8603. - }
  8604. -
  8605. -
  8606. --u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u8 flowid)
  8607. -+u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u16 flowid)
  8608. - {
  8609. - struct brcmf_flowring_ring *ring;
  8610. -- u8 hash_idx;
  8611. -+ u16 hash_idx;
  8612. -
  8613. - ring = flow->rings[flowid];
  8614. - hash_idx = ring->hash_id;
  8615. -@@ -384,7 +388,7 @@ void brcmf_flowring_detach(struct brcmf_
  8616. - struct brcmf_pub *drvr = bus_if->drvr;
  8617. - struct brcmf_flowring_tdls_entry *search;
  8618. - struct brcmf_flowring_tdls_entry *remove;
  8619. -- u8 flowid;
  8620. -+ u16 flowid;
  8621. -
  8622. - for (flowid = 0; flowid < flow->nrofrings; flowid++) {
  8623. - if (flow->rings[flowid])
  8624. -@@ -408,7 +412,7 @@ void brcmf_flowring_configure_addr_mode(
  8625. - struct brcmf_bus *bus_if = dev_get_drvdata(flow->dev);
  8626. - struct brcmf_pub *drvr = bus_if->drvr;
  8627. - u32 i;
  8628. -- u8 flowid;
  8629. -+ u16 flowid;
  8630. -
  8631. - if (flow->addr_mode[ifidx] != addr_mode) {
  8632. - for (i = 0; i < ARRAY_SIZE(flow->hash); i++) {
  8633. -@@ -434,7 +438,7 @@ void brcmf_flowring_delete_peer(struct b
  8634. - struct brcmf_flowring_tdls_entry *prev;
  8635. - struct brcmf_flowring_tdls_entry *search;
  8636. - u32 i;
  8637. -- u8 flowid;
  8638. -+ u16 flowid;
  8639. - bool sta;
  8640. -
  8641. - sta = (flow->addr_mode[ifidx] == ADDR_INDIRECT);
  8642. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.h
  8643. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.h
  8644. -@@ -16,7 +16,7 @@
  8645. - #define BRCMFMAC_FLOWRING_H
  8646. -
  8647. -
  8648. --#define BRCMF_FLOWRING_HASHSIZE 256
  8649. -+#define BRCMF_FLOWRING_HASHSIZE 512 /* has to be 2^x */
  8650. - #define BRCMF_FLOWRING_INVALID_ID 0xFFFFFFFF
  8651. -
  8652. -
  8653. -@@ -24,7 +24,7 @@ struct brcmf_flowring_hash {
  8654. - u8 mac[ETH_ALEN];
  8655. - u8 fifo;
  8656. - u8 ifidx;
  8657. -- u8 flowid;
  8658. -+ u16 flowid;
  8659. - };
  8660. -
  8661. - enum ring_status {
  8662. -@@ -61,16 +61,16 @@ u32 brcmf_flowring_lookup(struct brcmf_f
  8663. - u8 prio, u8 ifidx);
  8664. - u32 brcmf_flowring_create(struct brcmf_flowring *flow, u8 da[ETH_ALEN],
  8665. - u8 prio, u8 ifidx);
  8666. --void brcmf_flowring_delete(struct brcmf_flowring *flow, u8 flowid);
  8667. --void brcmf_flowring_open(struct brcmf_flowring *flow, u8 flowid);
  8668. --u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u8 flowid);
  8669. --u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  8670. -+void brcmf_flowring_delete(struct brcmf_flowring *flow, u16 flowid);
  8671. -+void brcmf_flowring_open(struct brcmf_flowring *flow, u16 flowid);
  8672. -+u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u16 flowid);
  8673. -+u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u16 flowid,
  8674. - struct sk_buff *skb);
  8675. --struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u8 flowid);
  8676. --void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u8 flowid,
  8677. -+struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u16 flowid);
  8678. -+void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u16 flowid,
  8679. - struct sk_buff *skb);
  8680. --u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u8 flowid);
  8681. --u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u8 flowid);
  8682. -+u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u16 flowid);
  8683. -+u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u16 flowid);
  8684. - struct brcmf_flowring *brcmf_flowring_attach(struct device *dev, u16 nrofrings);
  8685. - void brcmf_flowring_detach(struct brcmf_flowring *flow);
  8686. - void brcmf_flowring_configure_addr_mode(struct brcmf_flowring *flow, int ifidx,
  8687. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  8688. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  8689. -@@ -677,7 +677,7 @@ static u32 brcmf_msgbuf_flowring_create(
  8690. - }
  8691. -
  8692. -
  8693. --static void brcmf_msgbuf_txflow(struct brcmf_msgbuf *msgbuf, u8 flowid)
  8694. -+static void brcmf_msgbuf_txflow(struct brcmf_msgbuf *msgbuf, u16 flowid)
  8695. - {
  8696. - struct brcmf_flowring *flow = msgbuf->flow;
  8697. - struct brcmf_commonring *commonring;
  8698. -@@ -1310,7 +1310,7 @@ int brcmf_proto_msgbuf_rx_trigger(struct
  8699. - }
  8700. -
  8701. -
  8702. --void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u8 flowid)
  8703. -+void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u16 flowid)
  8704. - {
  8705. - struct brcmf_msgbuf *msgbuf = (struct brcmf_msgbuf *)drvr->proto->pd;
  8706. - struct msgbuf_tx_flowring_delete_req *delete;
  8707. -@@ -1415,6 +1415,13 @@ int brcmf_proto_msgbuf_attach(struct brc
  8708. - u32 count;
  8709. -
  8710. - if_msgbuf = drvr->bus_if->msgbuf;
  8711. -+
  8712. -+ if (if_msgbuf->nrof_flowrings >= BRCMF_FLOWRING_HASHSIZE) {
  8713. -+ brcmf_err("driver not configured for this many flowrings %d\n",
  8714. -+ if_msgbuf->nrof_flowrings);
  8715. -+ if_msgbuf->nrof_flowrings = BRCMF_FLOWRING_HASHSIZE - 1;
  8716. -+ }
  8717. -+
  8718. - msgbuf = kzalloc(sizeof(*msgbuf), GFP_KERNEL);
  8719. - if (!msgbuf)
  8720. - goto fail;
  8721. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.h
  8722. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.h
  8723. -@@ -33,7 +33,7 @@
  8724. -
  8725. -
  8726. - int brcmf_proto_msgbuf_rx_trigger(struct device *dev);
  8727. --void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u8 flowid);
  8728. -+void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u16 flowid);
  8729. - int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr);
  8730. - void brcmf_proto_msgbuf_detach(struct brcmf_pub *drvr);
  8731. - #else
  8732. 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
  8733. deleted file mode 100644
  8734. index e414f23..0000000
  8735. --- a/package/kernel/mac80211/patches/332-cfg80211-fix-faulty-variable-initialization-in-ieee8.patch
  8736. +++ /dev/null
  8737. @@ -1,22 +0,0 @@
  8738. -From: Felix Fietkau <nbd@openwrt.org>
  8739. -Date: Mon, 8 Feb 2016 14:24:36 +0100
  8740. -Subject: [PATCH] cfg80211: fix faulty variable initialization in
  8741. - ieee80211_amsdu_to_8023s
  8742. -
  8743. -reuse_skb is set to true if the code decides to use the last segment.
  8744. -Fixes a memory leak
  8745. -
  8746. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  8747. ----
  8748. -
  8749. ---- a/net/wireless/util.c
  8750. -+++ b/net/wireless/util.c
  8751. -@@ -676,7 +676,7 @@ void ieee80211_amsdu_to_8023s(struct sk_
  8752. - u8 *payload;
  8753. - int offset = 0, remaining, err;
  8754. - struct ethhdr eth;
  8755. -- bool reuse_skb = true;
  8756. -+ bool reuse_skb = false;
  8757. - bool last = false;
  8758. -
  8759. - if (has_80211_header) {
  8760. 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
  8761. deleted file mode 100644
  8762. index 6e2d0cf..0000000
  8763. --- a/package/kernel/mac80211/patches/333-cfg80211-reuse-existing-page-fragments-in-A-MSDU-rx.patch
  8764. +++ /dev/null
  8765. @@ -1,132 +0,0 @@
  8766. -From: Felix Fietkau <nbd@openwrt.org>
  8767. -Date: Mon, 8 Feb 2016 14:33:19 +0100
  8768. -Subject: [PATCH] cfg80211: reuse existing page fragments in A-MSDU rx
  8769. -
  8770. -This massively reduces data copying and thus improves rx performance
  8771. -
  8772. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  8773. ----
  8774. -
  8775. ---- a/net/wireless/util.c
  8776. -+++ b/net/wireless/util.c
  8777. -@@ -644,23 +644,93 @@ int ieee80211_data_from_8023(struct sk_b
  8778. - }
  8779. - EXPORT_SYMBOL(ieee80211_data_from_8023);
  8780. -
  8781. -+static void
  8782. -+__frame_add_frag(struct sk_buff *skb, struct page *page,
  8783. -+ void *ptr, int len, int size)
  8784. -+{
  8785. -+ struct skb_shared_info *sh = skb_shinfo(skb);
  8786. -+ int page_offset;
  8787. -+
  8788. -+ atomic_inc(&page->_count);
  8789. -+ page_offset = ptr - page_address(page);
  8790. -+ skb_add_rx_frag(skb, sh->nr_frags, page, page_offset, len, size);
  8791. -+}
  8792. -+
  8793. -+static void
  8794. -+__ieee80211_amsdu_copy_frag(struct sk_buff *skb, struct sk_buff *frame,
  8795. -+ int offset, int len)
  8796. -+{
  8797. -+ struct skb_shared_info *sh = skb_shinfo(skb);
  8798. -+ const skb_frag_t *frag = &sh->frags[-1];
  8799. -+ struct page *frag_page;
  8800. -+ void *frag_ptr;
  8801. -+ int frag_len, frag_size;
  8802. -+ int head_size = skb->len - skb->data_len;
  8803. -+ int cur_len;
  8804. -+
  8805. -+ frag_page = virt_to_head_page(skb->head);
  8806. -+ frag_ptr = skb->data;
  8807. -+ frag_size = head_size;
  8808. -+
  8809. -+ while (offset >= frag_size) {
  8810. -+ offset -= frag_size;
  8811. -+ frag++;
  8812. -+ frag_page = skb_frag_page(frag);
  8813. -+ frag_ptr = skb_frag_address(frag);
  8814. -+ frag_size = skb_frag_size(frag);
  8815. -+ }
  8816. -+
  8817. -+ frag_ptr += offset;
  8818. -+ frag_len = frag_size - offset;
  8819. -+
  8820. -+ cur_len = min(len, frag_len);
  8821. -+
  8822. -+ __frame_add_frag(frame, frag_page, frag_ptr, cur_len, frag_size);
  8823. -+ len -= cur_len;
  8824. -+
  8825. -+ while (len > 0) {
  8826. -+ frag++;
  8827. -+ frag_len = skb_frag_size(frag);
  8828. -+ cur_len = min(len, frag_len);
  8829. -+ __frame_add_frag(frame, skb_frag_page(frag),
  8830. -+ skb_frag_address(frag), cur_len, frag_len);
  8831. -+ len -= cur_len;
  8832. -+ }
  8833. -+}
  8834. -+
  8835. - static struct sk_buff *
  8836. - __ieee80211_amsdu_copy(struct sk_buff *skb, unsigned int hlen,
  8837. -- int offset, int len)
  8838. -+ int offset, int len, bool reuse_frag)
  8839. - {
  8840. - struct sk_buff *frame;
  8841. -+ int cur_len = len;
  8842. -
  8843. - if (skb->len - offset < len)
  8844. - return NULL;
  8845. -
  8846. - /*
  8847. -+ * When reusing framents, copy some data to the head to simplify
  8848. -+ * ethernet header handling and speed up protocol header processing
  8849. -+ * in the stack later.
  8850. -+ */
  8851. -+ if (reuse_frag)
  8852. -+ cur_len = min_t(int, len, 32);
  8853. -+
  8854. -+ /*
  8855. - * Allocate and reserve two bytes more for payload
  8856. - * alignment since sizeof(struct ethhdr) is 14.
  8857. - */
  8858. -- frame = dev_alloc_skb(hlen + sizeof(struct ethhdr) + 2 + len);
  8859. -+ frame = dev_alloc_skb(hlen + sizeof(struct ethhdr) + 2 + cur_len);
  8860. -
  8861. - skb_reserve(frame, hlen + sizeof(struct ethhdr) + 2);
  8862. -- skb_copy_bits(skb, offset, skb_put(frame, len), len);
  8863. -+ skb_copy_bits(skb, offset, skb_put(frame, cur_len), cur_len);
  8864. -+
  8865. -+ len -= cur_len;
  8866. -+ if (!len)
  8867. -+ return frame;
  8868. -+
  8869. -+ offset += cur_len;
  8870. -+ __ieee80211_amsdu_copy_frag(skb, frame, offset, len);
  8871. -
  8872. - return frame;
  8873. - }
  8874. -@@ -676,6 +746,7 @@ void ieee80211_amsdu_to_8023s(struct sk_
  8875. - u8 *payload;
  8876. - int offset = 0, remaining, err;
  8877. - struct ethhdr eth;
  8878. -+ bool reuse_frag = skb->head_frag && !skb_has_frag_list(skb);
  8879. - bool reuse_skb = false;
  8880. - bool last = false;
  8881. -
  8882. -@@ -703,12 +774,13 @@ void ieee80211_amsdu_to_8023s(struct sk_
  8883. - offset += sizeof(struct ethhdr);
  8884. - /* reuse skb for the last subframe */
  8885. - last = remaining <= subframe_len + padding;
  8886. -- if (!skb_is_nonlinear(skb) && last) {
  8887. -+ if (!skb_is_nonlinear(skb) && !reuse_frag && last) {
  8888. - skb_pull(skb, offset);
  8889. - frame = skb;
  8890. - reuse_skb = true;
  8891. - } else {
  8892. -- frame = __ieee80211_amsdu_copy(skb, hlen, offset, len);
  8893. -+ frame = __ieee80211_amsdu_copy(skb, hlen, offset, len,
  8894. -+ reuse_frag);
  8895. - if (!frame)
  8896. - goto purge;
  8897. -
  8898. 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
  8899. deleted file mode 100644
  8900. index f8f4f09..0000000
  8901. --- a/package/kernel/mac80211/patches/334-mac80211-fix-wiphy-supported_band-access.patch
  8902. +++ /dev/null
  8903. @@ -1,36 +0,0 @@
  8904. -From: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  8905. -Date: Wed, 10 Feb 2016 16:08:17 +0100
  8906. -Subject: [PATCH] mac80211: fix wiphy supported_band access
  8907. -
  8908. -Fix wiphy supported_band access in tx radiotap parsing. In particular,
  8909. -info->band is always set to 0 (IEEE80211_BAND_2GHZ) since it has not
  8910. -assigned yet. This cause a kernel crash on 5GHz only devices.
  8911. -Move ieee80211_parse_tx_radiotap() after info->band assignment
  8912. -
  8913. -Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  8914. ----
  8915. -
  8916. ---- a/net/mac80211/tx.c
  8917. -+++ b/net/mac80211/tx.c
  8918. -@@ -1890,10 +1890,6 @@ netdev_tx_t ieee80211_monitor_start_xmit
  8919. - info->flags = IEEE80211_TX_CTL_REQ_TX_STATUS |
  8920. - IEEE80211_TX_CTL_INJECTED;
  8921. -
  8922. -- /* process and remove the injection radiotap header */
  8923. -- if (!ieee80211_parse_tx_radiotap(local, skb))
  8924. -- goto fail;
  8925. --
  8926. - rcu_read_lock();
  8927. -
  8928. - /*
  8929. -@@ -1955,6 +1951,10 @@ netdev_tx_t ieee80211_monitor_start_xmit
  8930. - goto fail_rcu;
  8931. -
  8932. - info->band = chandef->chan->band;
  8933. -+ /* process and remove the injection radiotap header */
  8934. -+ if (!ieee80211_parse_tx_radiotap(local, skb))
  8935. -+ goto fail_rcu;
  8936. -+
  8937. - ieee80211_xmit(sdata, NULL, skb);
  8938. - rcu_read_unlock();
  8939. -
  8940. 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
  8941. deleted file mode 100644
  8942. index acaacf7..0000000
  8943. --- a/package/kernel/mac80211/patches/335-mac80211-minstrel_ht-set-A-MSDU-tx-limits-based-on-s.patch
  8944. +++ /dev/null
  8945. @@ -1,61 +0,0 @@
  8946. -From: Felix Fietkau <nbd@openwrt.org>
  8947. -Date: Thu, 18 Feb 2016 19:30:05 +0100
  8948. -Subject: [PATCH] mac80211: minstrel_ht: set A-MSDU tx limits based on selected
  8949. - max_prob_rate
  8950. -
  8951. -Prevents excessive A-MSDU aggregation at low data rates or bad
  8952. -conditions.
  8953. -
  8954. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  8955. ----
  8956. -
  8957. ---- a/net/mac80211/rc80211_minstrel_ht.c
  8958. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  8959. -@@ -883,6 +883,39 @@ minstrel_ht_set_rate(struct minstrel_pri
  8960. - ratetbl->rate[offset].flags = flags;
  8961. - }
  8962. -
  8963. -+static int
  8964. -+minstrel_ht_get_max_amsdu_len(struct minstrel_ht_sta *mi)
  8965. -+{
  8966. -+ int group = mi->max_prob_rate / MCS_GROUP_RATES;
  8967. -+ const struct mcs_group *g = &minstrel_mcs_groups[group];
  8968. -+ int rate = mi->max_prob_rate % MCS_GROUP_RATES;
  8969. -+
  8970. -+ /* Disable A-MSDU if max_prob_rate is bad */
  8971. -+ if (mi->groups[group].rates[rate].prob_ewma < MINSTREL_FRAC(50, 100))
  8972. -+ return 1;
  8973. -+
  8974. -+ /* If the rate is slower than single-stream MCS1, make A-MSDU limit small */
  8975. -+ if (g->duration[rate] > MCS_DURATION(1, 0, 52))
  8976. -+ return 500;
  8977. -+
  8978. -+ /*
  8979. -+ * If the rate is slower than single-stream MCS4, limit A-MSDU to usual
  8980. -+ * data packet size
  8981. -+ */
  8982. -+ if (g->duration[rate] > MCS_DURATION(1, 0, 104))
  8983. -+ return 1500;
  8984. -+
  8985. -+ /*
  8986. -+ * If the rate is slower than single-stream MCS7, limit A-MSDU to twice
  8987. -+ * the usual data packet size
  8988. -+ */
  8989. -+ if (g->duration[rate] > MCS_DURATION(1, 0, 260))
  8990. -+ return 3000;
  8991. -+
  8992. -+ /* unlimited */
  8993. -+ return 0;
  8994. -+}
  8995. -+
  8996. - static void
  8997. - minstrel_ht_update_rates(struct minstrel_priv *mp, struct minstrel_ht_sta *mi)
  8998. - {
  8999. -@@ -907,6 +940,7 @@ minstrel_ht_update_rates(struct minstrel
  9000. - minstrel_ht_set_rate(mp, mi, rates, i++, mi->max_prob_rate);
  9001. - }
  9002. -
  9003. -+ mi->sta->max_rc_amsdu_len = minstrel_ht_get_max_amsdu_len(mi);
  9004. - rates->rate[i].idx = -1;
  9005. - rate_control_set_rates(mp->hw, mi->sta, rates);
  9006. - }
  9007. 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
  9008. deleted file mode 100644
  9009. index 32a2ad6..0000000
  9010. --- a/package/kernel/mac80211/patches/336-mac80211-minstrel_ht-set-default-tx-aggregation-time.patch
  9011. +++ /dev/null
  9012. @@ -1,31 +0,0 @@
  9013. -From: Felix Fietkau <nbd@openwrt.org>
  9014. -Date: Thu, 18 Feb 2016 19:45:33 +0100
  9015. -Subject: [PATCH] mac80211: minstrel_ht: set default tx aggregation timeout to
  9016. - 0
  9017. -
  9018. -The value 5000 was put here with the addition of the timeout field to
  9019. -ieee80211_start_tx_ba_session. It was originally added in mac80211 to
  9020. -save resources for drivers like iwlwifi, which only supports a limited
  9021. -number of concurrent aggregation sessions.
  9022. -
  9023. -Since iwlwifi does not use minstrel_ht and other drivers don't need
  9024. -this, 0 is a better default - especially since there have been
  9025. -recent reports of aggregation setup related issues reproduced with
  9026. -ath9k. This should improve stability without causing any adverse
  9027. -effects.
  9028. -
  9029. -Cc: stable@vger.kernel.org
  9030. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  9031. ----
  9032. -
  9033. ---- a/net/mac80211/rc80211_minstrel_ht.c
  9034. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  9035. -@@ -692,7 +692,7 @@ minstrel_aggr_check(struct ieee80211_sta
  9036. - if (likely(sta->ampdu_mlme.tid_tx[tid]))
  9037. - return;
  9038. -
  9039. -- ieee80211_start_tx_ba_session(pubsta, tid, 5000);
  9040. -+ ieee80211_start_tx_ba_session(pubsta, tid, 0);
  9041. - }
  9042. -
  9043. - static void
  9044. 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
  9045. deleted file mode 100644
  9046. index 229351b..0000000
  9047. --- a/package/kernel/mac80211/patches/337-mac80211-minstrel_ht-fix-a-logic-error-in-RTS-CTS-ha.patch
  9048. +++ /dev/null
  9049. @@ -1,26 +0,0 @@
  9050. -From: Felix Fietkau <nbd@openwrt.org>
  9051. -Date: Wed, 24 Feb 2016 12:03:13 +0100
  9052. -Subject: [PATCH] mac80211: minstrel_ht: fix a logic error in RTS/CTS handling
  9053. -MIME-Version: 1.0
  9054. -Content-Type: text/plain; charset=UTF-8
  9055. -Content-Transfer-Encoding: 8bit
  9056. -
  9057. -RTS/CTS needs to be enabled if the rate is a fallback rate *or* if it's
  9058. -a dual-stream rate and the sta is in dynamic SMPS mode.
  9059. -
  9060. -Fixes: a3ebb4e1b763 ("mac80211: minstrel_ht: handle peers in dynamic SMPS")
  9061. -Reported-by: Matías Richart <mrichart@fing.edu.uy>
  9062. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  9063. ----
  9064. -
  9065. ---- a/net/mac80211/rc80211_minstrel_ht.c
  9066. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  9067. -@@ -872,7 +872,7 @@ minstrel_ht_set_rate(struct minstrel_pri
  9068. - * - if station is in dynamic SMPS (and streams > 1)
  9069. - * - for fallback rates, to increase chances of getting through
  9070. - */
  9071. -- if (offset > 0 &&
  9072. -+ if (offset > 0 ||
  9073. - (mi->sta->smps_mode == IEEE80211_SMPS_DYNAMIC &&
  9074. - group->streams > 1)) {
  9075. - ratetbl->rate[offset].count = ratetbl->rate[offset].count_rts;
  9076. 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
  9077. deleted file mode 100644
  9078. index 56cd94a..0000000
  9079. --- a/package/kernel/mac80211/patches/338-mac80211-Fix-Public-Action-frame-RX-in-AP-mode.patch
  9080. +++ /dev/null
  9081. @@ -1,35 +0,0 @@
  9082. -From: Jouni Malinen <jouni@qca.qualcomm.com>
  9083. -Date: Tue, 1 Mar 2016 00:29:00 +0200
  9084. -Subject: [PATCH] mac80211: Fix Public Action frame RX in AP mode
  9085. -
  9086. -Public Action frames use special rules for how the BSSID field (Address
  9087. -3) is set. A wildcard BSSID is used in cases where the transmitter and
  9088. -recipient are not members of the same BSS. As such, we need to accept
  9089. -Public Action frames with wildcard BSSID.
  9090. -
  9091. -Commit db8e17324553 ("mac80211: ignore frames between TDLS peers when
  9092. -operating as AP") added a rule that drops Action frames to TDLS-peers
  9093. -based on an Action frame having different DA (Address 1) and BSSID
  9094. -(Address 3) values. This is not correct since it misses the possibility
  9095. -of BSSID being a wildcard BSSID in which case the Address 1 would not
  9096. -necessarily match.
  9097. -
  9098. -Fix this by allowing mac80211 to accept wildcard BSSID in an Action
  9099. -frame when in AP mode.
  9100. -
  9101. -Fixes: db8e17324553 ("mac80211: ignore frames between TDLS peers when operating as AP")
  9102. -Cc: stable@vger.kernel.org
  9103. -Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
  9104. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  9105. ----
  9106. -
  9107. ---- a/net/mac80211/rx.c
  9108. -+++ b/net/mac80211/rx.c
  9109. -@@ -3374,6 +3374,7 @@ static bool ieee80211_accept_frame(struc
  9110. - return false;
  9111. - /* ignore action frames to TDLS-peers */
  9112. - if (ieee80211_is_action(hdr->frame_control) &&
  9113. -+ !is_broadcast_ether_addr(bssid) &&
  9114. - !ether_addr_equal(bssid, hdr->addr1))
  9115. - return false;
  9116. - }
  9117. 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
  9118. deleted file mode 100644
  9119. index 15d6cd0..0000000
  9120. --- a/package/kernel/mac80211/patches/339-cfg80211-add-radiotap-VHT-info-to-rtap_namespace_siz.patch
  9121. +++ /dev/null
  9122. @@ -1,21 +0,0 @@
  9123. -From: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  9124. -Date: Fri, 19 Feb 2016 11:43:04 +0100
  9125. -Subject: [PATCH] cfg80211: add radiotap VHT info to rtap_namespace_sizes
  9126. -
  9127. -Add IEEE80211_RADIOTAP_VHT entry to rtap_namespace_sizes array in order to
  9128. -define alignment and size of VHT info in tx radiotap
  9129. -
  9130. -Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  9131. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  9132. ----
  9133. -
  9134. ---- a/net/wireless/radiotap.c
  9135. -+++ b/net/wireless/radiotap.c
  9136. -@@ -43,6 +43,7 @@ static const struct radiotap_align_size
  9137. - [IEEE80211_RADIOTAP_DATA_RETRIES] = { .align = 1, .size = 1, },
  9138. - [IEEE80211_RADIOTAP_MCS] = { .align = 1, .size = 3, },
  9139. - [IEEE80211_RADIOTAP_AMPDU_STATUS] = { .align = 4, .size = 8, },
  9140. -+ [IEEE80211_RADIOTAP_VHT] = { .align = 2, .size = 12, },
  9141. - /*
  9142. - * add more here as they are defined in radiotap.h
  9143. - */
  9144. 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
  9145. deleted file mode 100644
  9146. index de1b386..0000000
  9147. --- a/package/kernel/mac80211/patches/340-mac80211-fix-parsing-of-40Mhz-in-injected-radiotap-h.patch
  9148. +++ /dev/null
  9149. @@ -1,36 +0,0 @@
  9150. -From: Sven Eckelmann <sven@narfation.org>
  9151. -Date: Wed, 24 Feb 2016 16:25:49 +0100
  9152. -Subject: [PATCH] mac80211: fix parsing of 40Mhz in injected radiotap
  9153. - header
  9154. -
  9155. -The MCS bandwidth part of the radiotap header is 2 bits wide. The full 2
  9156. -bit have to compared against IEEE80211_RADIOTAP_MCS_BW_40 and not only if
  9157. -the first bit is set. Otherwise IEEE80211_RADIOTAP_MCS_BW_40 can be
  9158. -confused with IEEE80211_RADIOTAP_MCS_BW_20U.
  9159. -
  9160. -Fixes: 5ec3aed9ba4c ("mac80211: Parse legacy and HT rate in injected frames")
  9161. -Signed-off-by: Sven Eckelmann <sven@narfation.org>
  9162. ----
  9163. -
  9164. ---- a/net/mac80211/tx.c
  9165. -+++ b/net/mac80211/tx.c
  9166. -@@ -1689,7 +1689,7 @@ static bool ieee80211_parse_tx_radiotap(
  9167. - bool rate_found = false;
  9168. - u8 rate_retries = 0;
  9169. - u16 rate_flags = 0;
  9170. -- u8 mcs_known, mcs_flags;
  9171. -+ u8 mcs_known, mcs_flags, mcs_bw;
  9172. - int i;
  9173. -
  9174. - info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT |
  9175. -@@ -1765,8 +1765,9 @@ static bool ieee80211_parse_tx_radiotap(
  9176. - mcs_flags & IEEE80211_RADIOTAP_MCS_SGI)
  9177. - rate_flags |= IEEE80211_TX_RC_SHORT_GI;
  9178. -
  9179. -+ mcs_bw = mcs_flags & IEEE80211_RADIOTAP_MCS_BW_MASK;
  9180. - if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_BW &&
  9181. -- mcs_flags & IEEE80211_RADIOTAP_MCS_BW_40)
  9182. -+ mcs_bw == IEEE80211_RADIOTAP_MCS_BW_40)
  9183. - rate_flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
  9184. - break;
  9185. -
  9186. 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
  9187. deleted file mode 100644
  9188. index ac1f251..0000000
  9189. --- a/package/kernel/mac80211/patches/341-mac80211-parse-VHT-info-in-injected-frames.patch
  9190. +++ /dev/null
  9191. @@ -1,65 +0,0 @@
  9192. -From: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  9193. -Date: Tue, 23 Feb 2016 15:43:35 +0100
  9194. -Subject: [PATCH] mac80211: parse VHT info in injected frames
  9195. -
  9196. -Add VHT radiotap parsing support to ieee80211_parse_tx_radiotap().
  9197. -That capability has been tested using a d-link dir-860l rev b1 running
  9198. -OpenWrt trunk and mt76 driver
  9199. -
  9200. -Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  9201. ----
  9202. -
  9203. ---- a/net/mac80211/tx.c
  9204. -+++ b/net/mac80211/tx.c
  9205. -@@ -1690,6 +1690,8 @@ static bool ieee80211_parse_tx_radiotap(
  9206. - u8 rate_retries = 0;
  9207. - u16 rate_flags = 0;
  9208. - u8 mcs_known, mcs_flags, mcs_bw;
  9209. -+ u16 vht_known;
  9210. -+ u8 vht_mcs = 0, vht_nss = 0;
  9211. - int i;
  9212. -
  9213. - info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT |
  9214. -@@ -1771,6 +1773,32 @@ static bool ieee80211_parse_tx_radiotap(
  9215. - rate_flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
  9216. - break;
  9217. -
  9218. -+ case IEEE80211_RADIOTAP_VHT:
  9219. -+ vht_known = get_unaligned_le16(iterator.this_arg);
  9220. -+ rate_found = true;
  9221. -+
  9222. -+ rate_flags = IEEE80211_TX_RC_VHT_MCS;
  9223. -+ if ((vht_known & IEEE80211_RADIOTAP_VHT_KNOWN_GI) &&
  9224. -+ (iterator.this_arg[2] &
  9225. -+ IEEE80211_RADIOTAP_VHT_FLAG_SGI))
  9226. -+ rate_flags |= IEEE80211_TX_RC_SHORT_GI;
  9227. -+ if (vht_known &
  9228. -+ IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH) {
  9229. -+ if (iterator.this_arg[3] == 1)
  9230. -+ rate_flags |=
  9231. -+ IEEE80211_TX_RC_40_MHZ_WIDTH;
  9232. -+ else if (iterator.this_arg[3] == 4)
  9233. -+ rate_flags |=
  9234. -+ IEEE80211_TX_RC_80_MHZ_WIDTH;
  9235. -+ else if (iterator.this_arg[3] == 11)
  9236. -+ rate_flags |=
  9237. -+ IEEE80211_TX_RC_160_MHZ_WIDTH;
  9238. -+ }
  9239. -+
  9240. -+ vht_mcs = iterator.this_arg[4] >> 4;
  9241. -+ vht_nss = iterator.this_arg[4] & 0xF;
  9242. -+ break;
  9243. -+
  9244. - /*
  9245. - * Please update the file
  9246. - * Documentation/networking/mac80211-injection.txt
  9247. -@@ -1796,6 +1824,9 @@ static bool ieee80211_parse_tx_radiotap(
  9248. -
  9249. - if (rate_flags & IEEE80211_TX_RC_MCS) {
  9250. - info->control.rates[0].idx = rate;
  9251. -+ } else if (rate_flags & IEEE80211_TX_RC_VHT_MCS) {
  9252. -+ ieee80211_rate_set_vht(info->control.rates, vht_mcs,
  9253. -+ vht_nss);
  9254. - } else {
  9255. - for (i = 0; i < sband->n_bitrates; i++) {
  9256. - if (rate * 5 != sband->bitrates[i].bitrate)
  9257. 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
  9258. deleted file mode 100644
  9259. index d7452c2..0000000
  9260. --- a/package/kernel/mac80211/patches/342-mac80211-do-not-pass-injected-frames-without-a-valid.patch
  9261. +++ /dev/null
  9262. @@ -1,23 +0,0 @@
  9263. -From: Felix Fietkau <nbd@openwrt.org>
  9264. -Date: Wed, 2 Mar 2016 15:51:40 +0100
  9265. -Subject: [PATCH] mac80211: do not pass injected frames without a valid rate to
  9266. - the driver
  9267. -
  9268. -Fall back to rate control if the requested bitrate was not found.
  9269. -
  9270. -Fixes: dfdfc2beb0dd ("mac80211: Parse legacy and HT rate in injected frames")
  9271. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  9272. ----
  9273. -
  9274. ---- a/net/mac80211/tx.c
  9275. -+++ b/net/mac80211/tx.c
  9276. -@@ -1837,6 +1837,9 @@ static bool ieee80211_parse_tx_radiotap(
  9277. - }
  9278. - }
  9279. -
  9280. -+ if (info->control.rates[0].idx < 0)
  9281. -+ info->control.flags &= ~IEEE80211_TX_CTRL_RATE_INJECT;
  9282. -+
  9283. - info->control.rates[0].flags = rate_flags;
  9284. - info->control.rates[0].count = min_t(u8, rate_retries + 1,
  9285. - local->hw.max_rate_tries);
  9286. 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
  9287. deleted file mode 100644
  9288. index 55ff817..0000000
  9289. --- a/package/kernel/mac80211/patches/343-mac80211-minstrel_ht-improve-sample-rate-skip-logic.patch
  9290. +++ /dev/null
  9291. @@ -1,77 +0,0 @@
  9292. -From: Felix Fietkau <nbd@openwrt.org>
  9293. -Date: Thu, 3 Mar 2016 23:20:06 +0100
  9294. -Subject: [PATCH] mac80211: minstrel_ht: improve sample rate skip logic
  9295. -
  9296. -There were a few issues that were slowing down the process of finding
  9297. -the optimal rate, especially on devices with multi-rate retry
  9298. -limitations:
  9299. -
  9300. -When max_tp_rate[0] was slower than max_tp_rate[1], the code did not
  9301. -sample max_tp_rate[1], which would often allow it to switch places with
  9302. -max_tp_rate[0] (e.g. if only the first sampling attempts were bad, but the
  9303. -rate is otherwise good).
  9304. -
  9305. -Also, sample attempts of rates between max_tp_rate[0] and [1] were being
  9306. -ignored in this case, because the code only checked if the rate was
  9307. -slower than [1].
  9308. -
  9309. -Fix this by checking against the fastest / second fastest max_tp_rate
  9310. -instead of assuming a specific order between the two.
  9311. -
  9312. -In my tests this patch significantly reduces the time until minstrel_ht
  9313. -finds the optimal rate right after assoc
  9314. -
  9315. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  9316. ----
  9317. -
  9318. ---- a/net/mac80211/rc80211_minstrel_ht.c
  9319. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  9320. -@@ -958,6 +958,7 @@ minstrel_get_sample_rate(struct minstrel
  9321. - struct minstrel_rate_stats *mrs;
  9322. - struct minstrel_mcs_group_data *mg;
  9323. - unsigned int sample_dur, sample_group, cur_max_tp_streams;
  9324. -+ int tp_rate1, tp_rate2;
  9325. - int sample_idx = 0;
  9326. -
  9327. - if (mi->sample_wait > 0) {
  9328. -@@ -979,14 +980,22 @@ minstrel_get_sample_rate(struct minstrel
  9329. - mrs = &mg->rates[sample_idx];
  9330. - sample_idx += sample_group * MCS_GROUP_RATES;
  9331. -
  9332. -+ /* Set tp_rate1, tp_rate2 to the highest / second highest max_tp_rate */
  9333. -+ if (minstrel_get_duration(mi->max_tp_rate[0]) >
  9334. -+ minstrel_get_duration(mi->max_tp_rate[1])) {
  9335. -+ tp_rate1 = mi->max_tp_rate[1];
  9336. -+ tp_rate2 = mi->max_tp_rate[0];
  9337. -+ } else {
  9338. -+ tp_rate1 = mi->max_tp_rate[0];
  9339. -+ tp_rate2 = mi->max_tp_rate[1];
  9340. -+ }
  9341. -+
  9342. - /*
  9343. - * Sampling might add some overhead (RTS, no aggregation)
  9344. -- * to the frame. Hence, don't use sampling for the currently
  9345. -- * used rates.
  9346. -+ * to the frame. Hence, don't use sampling for the highest currently
  9347. -+ * used highest throughput or probability rate.
  9348. - */
  9349. -- if (sample_idx == mi->max_tp_rate[0] ||
  9350. -- sample_idx == mi->max_tp_rate[1] ||
  9351. -- sample_idx == mi->max_prob_rate)
  9352. -+ if (sample_idx == mi->max_tp_rate[0] || sample_idx == mi->max_prob_rate)
  9353. - return -1;
  9354. -
  9355. - /*
  9356. -@@ -1001,10 +1010,10 @@ minstrel_get_sample_rate(struct minstrel
  9357. - * if the link is working perfectly.
  9358. - */
  9359. -
  9360. -- cur_max_tp_streams = minstrel_mcs_groups[mi->max_tp_rate[0] /
  9361. -+ cur_max_tp_streams = minstrel_mcs_groups[tp_rate1 /
  9362. - MCS_GROUP_RATES].streams;
  9363. - sample_dur = minstrel_get_duration(sample_idx);
  9364. -- if (sample_dur >= minstrel_get_duration(mi->max_tp_rate[1]) &&
  9365. -+ if (sample_dur >= minstrel_get_duration(tp_rate2) &&
  9366. - (cur_max_tp_streams - 1 <
  9367. - minstrel_mcs_groups[sample_group].streams ||
  9368. - sample_dur >= minstrel_get_duration(mi->max_prob_rate))) {
  9369. diff --git a/package/kernel/mac80211/patches/344-0001-brcmfmac-change-function-name-for-brcmf_cfg80211_wai.patch b/package/kernel/mac80211/patches/344-0001-brcmfmac-change-function-name-for-brcmf_cfg80211_wai.patch
  9370. deleted file mode 100644
  9371. index e3427de..0000000
  9372. --- a/package/kernel/mac80211/patches/344-0001-brcmfmac-change-function-name-for-brcmf_cfg80211_wai.patch
  9373. +++ /dev/null
  9374. @@ -1,99 +0,0 @@
  9375. -From: Arend van Spriel <arend@broadcom.com>
  9376. -Date: Wed, 17 Feb 2016 11:26:50 +0100
  9377. -Subject: [PATCH] brcmfmac: change function name for
  9378. - brcmf_cfg80211_wait_vif_event_timeout()
  9379. -
  9380. -Dropping the '_timeout' from the function name as the fact that a timeout
  9381. -value is passed makes it obvious a timeout is used. Also helps to keep code
  9382. -lines a bit shorter and easier to stick to 80 char boundary.
  9383. -
  9384. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  9385. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  9386. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  9387. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9388. ----
  9389. -
  9390. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  9391. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  9392. -@@ -564,8 +564,8 @@ struct wireless_dev *brcmf_ap_add_vif(st
  9393. - }
  9394. -
  9395. - /* wait for firmware event */
  9396. -- err = brcmf_cfg80211_wait_vif_event_timeout(cfg, BRCMF_E_IF_ADD,
  9397. -- BRCMF_VIF_EVENT_TIMEOUT);
  9398. -+ err = brcmf_cfg80211_wait_vif_event(cfg, BRCMF_E_IF_ADD,
  9399. -+ BRCMF_VIF_EVENT_TIMEOUT);
  9400. - brcmf_cfg80211_arm_vif_event(cfg, NULL);
  9401. - if (!err) {
  9402. - brcmf_err("timeout occurred\n");
  9403. -@@ -6395,8 +6395,9 @@ bool brcmf_cfg80211_vif_event_armed(stru
  9404. -
  9405. - return armed;
  9406. - }
  9407. --int brcmf_cfg80211_wait_vif_event_timeout(struct brcmf_cfg80211_info *cfg,
  9408. -- u8 action, ulong timeout)
  9409. -+
  9410. -+int brcmf_cfg80211_wait_vif_event(struct brcmf_cfg80211_info *cfg,
  9411. -+ u8 action, ulong timeout)
  9412. - {
  9413. - struct brcmf_cfg80211_vif_event *event = &cfg->vif_event;
  9414. -
  9415. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  9416. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  9417. -@@ -402,8 +402,8 @@ bool brcmf_get_vif_state_any(struct brcm
  9418. - void brcmf_cfg80211_arm_vif_event(struct brcmf_cfg80211_info *cfg,
  9419. - struct brcmf_cfg80211_vif *vif);
  9420. - bool brcmf_cfg80211_vif_event_armed(struct brcmf_cfg80211_info *cfg);
  9421. --int brcmf_cfg80211_wait_vif_event_timeout(struct brcmf_cfg80211_info *cfg,
  9422. -- u8 action, ulong timeout);
  9423. -+int brcmf_cfg80211_wait_vif_event(struct brcmf_cfg80211_info *cfg,
  9424. -+ u8 action, ulong timeout);
  9425. - s32 brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg,
  9426. - struct brcmf_if *ifp, bool aborted,
  9427. - bool fw_abort);
  9428. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  9429. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  9430. -@@ -1988,8 +1988,8 @@ int brcmf_p2p_ifchange(struct brcmf_cfg8
  9431. - brcmf_cfg80211_arm_vif_event(cfg, NULL);
  9432. - return err;
  9433. - }
  9434. -- err = brcmf_cfg80211_wait_vif_event_timeout(cfg, BRCMF_E_IF_CHANGE,
  9435. -- BRCMF_VIF_EVENT_TIMEOUT);
  9436. -+ err = brcmf_cfg80211_wait_vif_event(cfg, BRCMF_E_IF_CHANGE,
  9437. -+ BRCMF_VIF_EVENT_TIMEOUT);
  9438. - brcmf_cfg80211_arm_vif_event(cfg, NULL);
  9439. - if (!err) {
  9440. - brcmf_err("No BRCMF_E_IF_CHANGE event received\n");
  9441. -@@ -2090,8 +2090,8 @@ static struct wireless_dev *brcmf_p2p_cr
  9442. - }
  9443. -
  9444. - /* wait for firmware event */
  9445. -- err = brcmf_cfg80211_wait_vif_event_timeout(p2p->cfg, BRCMF_E_IF_ADD,
  9446. -- BRCMF_VIF_EVENT_TIMEOUT);
  9447. -+ err = brcmf_cfg80211_wait_vif_event(p2p->cfg, BRCMF_E_IF_ADD,
  9448. -+ BRCMF_VIF_EVENT_TIMEOUT);
  9449. - brcmf_cfg80211_arm_vif_event(p2p->cfg, NULL);
  9450. - brcmf_fweh_p2pdev_setup(pri_ifp, false);
  9451. - if (!err) {
  9452. -@@ -2180,8 +2180,8 @@ struct wireless_dev *brcmf_p2p_add_vif(s
  9453. - }
  9454. -
  9455. - /* wait for firmware event */
  9456. -- err = brcmf_cfg80211_wait_vif_event_timeout(cfg, BRCMF_E_IF_ADD,
  9457. -- BRCMF_VIF_EVENT_TIMEOUT);
  9458. -+ err = brcmf_cfg80211_wait_vif_event(cfg, BRCMF_E_IF_ADD,
  9459. -+ BRCMF_VIF_EVENT_TIMEOUT);
  9460. - brcmf_cfg80211_arm_vif_event(cfg, NULL);
  9461. - if (!err) {
  9462. - brcmf_err("timeout occurred\n");
  9463. -@@ -2274,8 +2274,8 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  9464. - }
  9465. - if (!err) {
  9466. - /* wait for firmware event */
  9467. -- err = brcmf_cfg80211_wait_vif_event_timeout(cfg, BRCMF_E_IF_DEL,
  9468. -- BRCMF_VIF_EVENT_TIMEOUT);
  9469. -+ err = brcmf_cfg80211_wait_vif_event(cfg, BRCMF_E_IF_DEL,
  9470. -+ BRCMF_VIF_EVENT_TIMEOUT);
  9471. - if (!err)
  9472. - err = -EIO;
  9473. - else
  9474. diff --git a/package/kernel/mac80211/patches/344-0002-brcmfmac-Limit-memory-allocs-to-64K.patch b/package/kernel/mac80211/patches/344-0002-brcmfmac-Limit-memory-allocs-to-64K.patch
  9475. deleted file mode 100644
  9476. index 9c336f7..0000000
  9477. --- a/package/kernel/mac80211/patches/344-0002-brcmfmac-Limit-memory-allocs-to-64K.patch
  9478. +++ /dev/null
  9479. @@ -1,127 +0,0 @@
  9480. -From: Hante Meuleman <meuleman@broadcom.com>
  9481. -Date: Wed, 17 Feb 2016 11:26:51 +0100
  9482. -Subject: [PATCH] brcmfmac: Limit memory allocs to <64K
  9483. -
  9484. -Some systems have problems with allocating memory allocation larger
  9485. -then 64K. Often on unload/load or suspend/resume a failure is
  9486. -reported: Could not allocate wiphy device. This patch makes the
  9487. -escan intermediate storage buf dynamically allocated, and smaller
  9488. -than 64K.
  9489. -
  9490. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  9491. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  9492. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  9493. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  9494. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  9495. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9496. ----
  9497. -
  9498. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  9499. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  9500. -@@ -1125,7 +1125,7 @@ brcmf_cfg80211_escan(struct wiphy *wiphy
  9501. -
  9502. - /* Arm scan timeout timer */
  9503. - mod_timer(&cfg->escan_timeout, jiffies +
  9504. -- WL_ESCAN_TIMER_INTERVAL_MS * HZ / 1000);
  9505. -+ BRCMF_ESCAN_TIMER_INTERVAL_MS * HZ / 1000);
  9506. -
  9507. - return 0;
  9508. -
  9509. -@@ -3020,7 +3020,7 @@ brcmf_cfg80211_escan_handler(struct brcm
  9510. -
  9511. - list = (struct brcmf_scan_results *)
  9512. - cfg->escan_info.escan_buf;
  9513. -- if (bi_length > WL_ESCAN_BUF_SIZE - list->buflen) {
  9514. -+ if (bi_length > BRCMF_ESCAN_BUF_SIZE - list->buflen) {
  9515. - brcmf_err("Buffer is too small: ignoring\n");
  9516. - goto exit;
  9517. - }
  9518. -@@ -3033,8 +3033,8 @@ brcmf_cfg80211_escan_handler(struct brcm
  9519. - bss_info_le))
  9520. - goto exit;
  9521. - }
  9522. -- memcpy(&(cfg->escan_info.escan_buf[list->buflen]),
  9523. -- bss_info_le, bi_length);
  9524. -+ memcpy(&cfg->escan_info.escan_buf[list->buflen], bss_info_le,
  9525. -+ bi_length);
  9526. - list->version = le32_to_cpu(bss_info_le->version);
  9527. - list->buflen += bi_length;
  9528. - list->count++;
  9529. -@@ -5402,14 +5402,14 @@ static void brcmf_deinit_priv_mem(struct
  9530. - {
  9531. - kfree(cfg->conf);
  9532. - cfg->conf = NULL;
  9533. -- kfree(cfg->escan_ioctl_buf);
  9534. -- cfg->escan_ioctl_buf = NULL;
  9535. - kfree(cfg->extra_buf);
  9536. - cfg->extra_buf = NULL;
  9537. - kfree(cfg->wowl.nd);
  9538. - cfg->wowl.nd = NULL;
  9539. - kfree(cfg->wowl.nd_info);
  9540. - cfg->wowl.nd_info = NULL;
  9541. -+ kfree(cfg->escan_info.escan_buf);
  9542. -+ cfg->escan_info.escan_buf = NULL;
  9543. - }
  9544. -
  9545. - static s32 brcmf_init_priv_mem(struct brcmf_cfg80211_info *cfg)
  9546. -@@ -5417,9 +5417,6 @@ static s32 brcmf_init_priv_mem(struct br
  9547. - cfg->conf = kzalloc(sizeof(*cfg->conf), GFP_KERNEL);
  9548. - if (!cfg->conf)
  9549. - goto init_priv_mem_out;
  9550. -- cfg->escan_ioctl_buf = kzalloc(BRCMF_DCMD_MEDLEN, GFP_KERNEL);
  9551. -- if (!cfg->escan_ioctl_buf)
  9552. -- goto init_priv_mem_out;
  9553. - cfg->extra_buf = kzalloc(WL_EXTRA_BUF_MAX, GFP_KERNEL);
  9554. - if (!cfg->extra_buf)
  9555. - goto init_priv_mem_out;
  9556. -@@ -5431,6 +5428,9 @@ static s32 brcmf_init_priv_mem(struct br
  9557. - GFP_KERNEL);
  9558. - if (!cfg->wowl.nd_info)
  9559. - goto init_priv_mem_out;
  9560. -+ cfg->escan_info.escan_buf = kzalloc(BRCMF_ESCAN_BUF_SIZE, GFP_KERNEL);
  9561. -+ if (!cfg->escan_info.escan_buf)
  9562. -+ goto init_priv_mem_out;
  9563. -
  9564. - return 0;
  9565. -
  9566. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  9567. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  9568. -@@ -28,8 +28,11 @@
  9569. - #define WL_ROAM_TRIGGER_LEVEL -75
  9570. - #define WL_ROAM_DELTA 20
  9571. -
  9572. --#define WL_ESCAN_BUF_SIZE (1024 * 64)
  9573. --#define WL_ESCAN_TIMER_INTERVAL_MS 10000 /* E-Scan timeout */
  9574. -+/* Keep BRCMF_ESCAN_BUF_SIZE below 64K (65536). Allocing over 64K can be
  9575. -+ * problematic on some systems and should be avoided.
  9576. -+ */
  9577. -+#define BRCMF_ESCAN_BUF_SIZE 65000
  9578. -+#define BRCMF_ESCAN_TIMER_INTERVAL_MS 10000 /* E-Scan timeout */
  9579. -
  9580. - #define WL_ESCAN_ACTION_START 1
  9581. - #define WL_ESCAN_ACTION_CONTINUE 2
  9582. -@@ -205,7 +208,7 @@ enum wl_escan_state {
  9583. -
  9584. - struct escan_info {
  9585. - u32 escan_state;
  9586. -- u8 escan_buf[WL_ESCAN_BUF_SIZE];
  9587. -+ u8 *escan_buf;
  9588. - struct wiphy *wiphy;
  9589. - struct brcmf_if *ifp;
  9590. - s32 (*run)(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp,
  9591. -@@ -278,7 +281,6 @@ struct brcmf_cfg80211_wowl {
  9592. - * @escan_info: escan information.
  9593. - * @escan_timeout: Timer for catch scan timeout.
  9594. - * @escan_timeout_work: scan timeout worker.
  9595. -- * @escan_ioctl_buf: dongle command buffer for escan commands.
  9596. - * @vif_list: linked list of vif instances.
  9597. - * @vif_cnt: number of vif instances.
  9598. - * @vif_event: vif event signalling.
  9599. -@@ -309,7 +311,6 @@ struct brcmf_cfg80211_info {
  9600. - struct escan_info escan_info;
  9601. - struct timer_list escan_timeout;
  9602. - struct work_struct escan_timeout_work;
  9603. -- u8 *escan_ioctl_buf;
  9604. - struct list_head vif_list;
  9605. - struct brcmf_cfg80211_vif_event vif_event;
  9606. - struct completion vif_disabled;
  9607. diff --git a/package/kernel/mac80211/patches/344-0003-brcmfmac-check-for-wowl-support-before-enumerating-f.patch b/package/kernel/mac80211/patches/344-0003-brcmfmac-check-for-wowl-support-before-enumerating-f.patch
  9608. deleted file mode 100644
  9609. index ee3d9f3..0000000
  9610. --- a/package/kernel/mac80211/patches/344-0003-brcmfmac-check-for-wowl-support-before-enumerating-f.patch
  9611. +++ /dev/null
  9612. @@ -1,29 +0,0 @@
  9613. -From: Franky Lin <frankyl@broadcom.com>
  9614. -Date: Wed, 17 Feb 2016 11:26:52 +0100
  9615. -Subject: [PATCH] brcmfmac: check for wowl support before enumerating feature
  9616. - flag
  9617. -
  9618. -In some cases wiphy->wowlan could be NULL if firmware doesn't have the
  9619. -support. Driver should check for support before walking down the feature
  9620. -flags.
  9621. -
  9622. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  9623. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  9624. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  9625. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  9626. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  9627. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9628. ----
  9629. -
  9630. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  9631. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  9632. -@@ -6594,7 +6594,8 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  9633. - if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_SCAN_RANDOM_MAC)) {
  9634. - wiphy->features |= NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR;
  9635. - #ifdef CONFIG_PM
  9636. -- if (wiphy->wowlan->flags & WIPHY_WOWLAN_NET_DETECT)
  9637. -+ if (wiphy->wowlan &&
  9638. -+ wiphy->wowlan->flags & WIPHY_WOWLAN_NET_DETECT)
  9639. - wiphy->features |= NL80211_FEATURE_ND_RANDOM_MAC_ADDR;
  9640. - #endif
  9641. - }
  9642. diff --git a/package/kernel/mac80211/patches/344-0004-brcmfmac-Configure-country-code-using-device-specifi.patch b/package/kernel/mac80211/patches/344-0004-brcmfmac-Configure-country-code-using-device-specifi.patch
  9643. deleted file mode 100644
  9644. index c52cac8..0000000
  9645. --- a/package/kernel/mac80211/patches/344-0004-brcmfmac-Configure-country-code-using-device-specifi.patch
  9646. +++ /dev/null
  9647. @@ -1,214 +0,0 @@
  9648. -From: Hante Meuleman <meuleman@broadcom.com>
  9649. -Date: Wed, 17 Feb 2016 11:26:53 +0100
  9650. -Subject: [PATCH] brcmfmac: Configure country code using device specific
  9651. - settings
  9652. -
  9653. -Country code configuration in a device is a device specific
  9654. -operation. For this the country code as specified by reg notifier
  9655. -(iso3166 alpha2) needs to be translated to a device specific
  9656. -country locale and revision number. This patch adds this
  9657. -translation and puts a placeholder in the device specific settings
  9658. -where the translation table can be stored. Additional patches will
  9659. -be needed to read these tables from for example device platform
  9660. -data.
  9661. -
  9662. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  9663. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  9664. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  9665. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  9666. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  9667. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9668. ----
  9669. -
  9670. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  9671. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  9672. -@@ -6405,28 +6405,85 @@ int brcmf_cfg80211_wait_vif_event(struct
  9673. - vif_event_equals(event, action), timeout);
  9674. - }
  9675. -
  9676. -+static s32 brcmf_translate_country_code(struct brcmf_pub *drvr, char alpha2[2],
  9677. -+ struct brcmf_fil_country_le *ccreq)
  9678. -+{
  9679. -+ struct cc_translate *country_codes;
  9680. -+ struct cc_entry *cc;
  9681. -+ s32 found_index;
  9682. -+ int i;
  9683. -+
  9684. -+ country_codes = drvr->settings->country_codes;
  9685. -+ if (!country_codes) {
  9686. -+ brcmf_dbg(TRACE, "No country codes configured for device\n");
  9687. -+ return -EINVAL;
  9688. -+ }
  9689. -+
  9690. -+ if ((alpha2[0] == ccreq->country_abbrev[0]) &&
  9691. -+ (alpha2[1] == ccreq->country_abbrev[1])) {
  9692. -+ brcmf_dbg(TRACE, "Country code already set\n");
  9693. -+ return -EAGAIN;
  9694. -+ }
  9695. -+
  9696. -+ found_index = -1;
  9697. -+ for (i = 0; i < country_codes->table_size; i++) {
  9698. -+ cc = &country_codes->table[i];
  9699. -+ if ((cc->iso3166[0] == '\0') && (found_index == -1))
  9700. -+ found_index = i;
  9701. -+ if ((cc->iso3166[0] == alpha2[0]) &&
  9702. -+ (cc->iso3166[1] == alpha2[1])) {
  9703. -+ found_index = i;
  9704. -+ break;
  9705. -+ }
  9706. -+ }
  9707. -+ if (found_index == -1) {
  9708. -+ brcmf_dbg(TRACE, "No country code match found\n");
  9709. -+ return -EINVAL;
  9710. -+ }
  9711. -+ memset(ccreq, 0, sizeof(*ccreq));
  9712. -+ ccreq->rev = cpu_to_le32(country_codes->table[found_index].rev);
  9713. -+ memcpy(ccreq->ccode, country_codes->table[found_index].cc,
  9714. -+ BRCMF_COUNTRY_BUF_SZ);
  9715. -+ ccreq->country_abbrev[0] = alpha2[0];
  9716. -+ ccreq->country_abbrev[1] = alpha2[1];
  9717. -+ ccreq->country_abbrev[2] = 0;
  9718. -+
  9719. -+ return 0;
  9720. -+}
  9721. -+
  9722. - static void brcmf_cfg80211_reg_notifier(struct wiphy *wiphy,
  9723. - struct regulatory_request *req)
  9724. - {
  9725. - struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy);
  9726. - struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg));
  9727. - struct brcmf_fil_country_le ccreq;
  9728. -+ s32 err;
  9729. - int i;
  9730. -
  9731. -- brcmf_dbg(TRACE, "enter: initiator=%d, alpha=%c%c\n", req->initiator,
  9732. -- req->alpha2[0], req->alpha2[1]);
  9733. --
  9734. - /* ignore non-ISO3166 country codes */
  9735. - for (i = 0; i < sizeof(req->alpha2); i++)
  9736. - if (req->alpha2[i] < 'A' || req->alpha2[i] > 'Z') {
  9737. -- brcmf_err("not a ISO3166 code\n");
  9738. -+ brcmf_err("not a ISO3166 code (0x%02x 0x%02x)\n",
  9739. -+ req->alpha2[0], req->alpha2[1]);
  9740. - return;
  9741. - }
  9742. -- memset(&ccreq, 0, sizeof(ccreq));
  9743. -- ccreq.rev = cpu_to_le32(-1);
  9744. -- memcpy(ccreq.ccode, req->alpha2, sizeof(req->alpha2));
  9745. -- if (brcmf_fil_iovar_data_set(ifp, "country", &ccreq, sizeof(ccreq))) {
  9746. -- brcmf_err("firmware rejected country setting\n");
  9747. -+
  9748. -+ brcmf_dbg(TRACE, "Enter: initiator=%d, alpha=%c%c\n", req->initiator,
  9749. -+ req->alpha2[0], req->alpha2[1]);
  9750. -+
  9751. -+ err = brcmf_fil_iovar_data_get(ifp, "country", &ccreq, sizeof(ccreq));
  9752. -+ if (err) {
  9753. -+ brcmf_err("Country code iovar returned err = %d\n", err);
  9754. -+ return;
  9755. -+ }
  9756. -+
  9757. -+ err = brcmf_translate_country_code(ifp->drvr, req->alpha2, &ccreq);
  9758. -+ if (err)
  9759. -+ return;
  9760. -+
  9761. -+ err = brcmf_fil_iovar_data_set(ifp, "country", &ccreq, sizeof(ccreq));
  9762. -+ if (err) {
  9763. -+ brcmf_err("Firmware rejected country setting\n");
  9764. - return;
  9765. - }
  9766. - brcmf_setup_wiphybands(wiphy);
  9767. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  9768. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  9769. -@@ -230,10 +230,8 @@ void brcmf_mp_attach(void)
  9770. - int brcmf_mp_device_attach(struct brcmf_pub *drvr)
  9771. - {
  9772. - drvr->settings = kzalloc(sizeof(*drvr->settings), GFP_ATOMIC);
  9773. -- if (!drvr->settings) {
  9774. -- brcmf_err("Failed to alloca storage space for settings\n");
  9775. -+ if (!drvr->settings)
  9776. - return -ENOMEM;
  9777. -- }
  9778. -
  9779. - drvr->settings->sdiod_txglomsz = brcmf_sdiod_txglomsz;
  9780. - drvr->settings->p2p_enable = !!brcmf_p2p_enable;
  9781. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
  9782. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
  9783. -@@ -15,6 +15,8 @@
  9784. - #ifndef BRCMFMAC_COMMON_H
  9785. - #define BRCMFMAC_COMMON_H
  9786. -
  9787. -+#include "fwil_types.h"
  9788. -+
  9789. - extern const u8 ALLFFMAC[ETH_ALEN];
  9790. -
  9791. - #define BRCMF_FW_ALTPATH_LEN 256
  9792. -@@ -39,6 +41,33 @@ struct brcmf_mp_global_t {
  9793. - extern struct brcmf_mp_global_t brcmf_mp_global;
  9794. -
  9795. - /**
  9796. -+ * struct cc_entry - Struct for translating user space country code (iso3166) to
  9797. -+ * firmware country code and revision.
  9798. -+ *
  9799. -+ * @iso3166: iso3166 alpha 2 country code string.
  9800. -+ * @cc: firmware country code string.
  9801. -+ * @rev: firmware country code revision.
  9802. -+ */
  9803. -+struct cc_entry {
  9804. -+ char iso3166[BRCMF_COUNTRY_BUF_SZ];
  9805. -+ char cc[BRCMF_COUNTRY_BUF_SZ];
  9806. -+ s32 rev;
  9807. -+};
  9808. -+
  9809. -+/**
  9810. -+ * struct cc_translate - Struct for translating country codes as set by user
  9811. -+ * space to a country code and rev which can be used by
  9812. -+ * firmware.
  9813. -+ *
  9814. -+ * @table_size: number of entries in table (> 0)
  9815. -+ * @table: dynamic array of 1 or more elements with translation information.
  9816. -+ */
  9817. -+struct cc_translate {
  9818. -+ int table_size;
  9819. -+ struct cc_entry table[0];
  9820. -+};
  9821. -+
  9822. -+/**
  9823. - * struct brcmf_mp_device - Device module paramaters.
  9824. - *
  9825. - * @sdiod_txglomsz: SDIO txglom size.
  9826. -@@ -47,6 +76,7 @@ extern struct brcmf_mp_global_t brcmf_mp
  9827. - * @feature_disable: Feature_disable bitmask.
  9828. - * @fcmode: FWS flow control.
  9829. - * @roamoff: Firmware roaming off?
  9830. -+ * @country_codes: If available, pointer to struct for translating country codes
  9831. - */
  9832. - struct brcmf_mp_device {
  9833. - int sdiod_txglomsz;
  9834. -@@ -56,6 +86,7 @@ struct brcmf_mp_device {
  9835. - int fcmode;
  9836. - bool roamoff;
  9837. - bool ignore_probe_fail;
  9838. -+ struct cc_translate *country_codes;
  9839. - };
  9840. -
  9841. - void brcmf_mp_attach(void);
  9842. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h
  9843. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h
  9844. -@@ -134,6 +134,8 @@
  9845. - #define BRCMF_PFN_MAC_OUI_ONLY BIT(0)
  9846. - #define BRCMF_PFN_SET_MAC_UNASSOC BIT(1)
  9847. -
  9848. -+#define BRCMF_MCSSET_LEN 16
  9849. -+
  9850. - /* join preference types for join_pref iovar */
  9851. - enum brcmf_join_pref_types {
  9852. - BRCMF_JOIN_PREF_RSSI = 1,
  9853. -@@ -279,7 +281,7 @@ struct brcmf_bss_info_le {
  9854. - __le32 reserved32[1]; /* Reserved for expansion of BSS properties */
  9855. - u8 flags; /* flags */
  9856. - u8 reserved[3]; /* Reserved for expansion of BSS properties */
  9857. -- u8 basic_mcs[MCSSET_LEN]; /* 802.11N BSS required MCS set */
  9858. -+ u8 basic_mcs[BRCMF_MCSSET_LEN]; /* 802.11N BSS required MCS set */
  9859. -
  9860. - __le16 ie_offset; /* offset at which IEs start, from beginning */
  9861. - __le32 ie_length; /* byte length of Information Elements */
  9862. diff --git a/package/kernel/mac80211/patches/344-0005-brcmfmac-Add-length-checks-on-firmware-events.patch b/package/kernel/mac80211/patches/344-0005-brcmfmac-Add-length-checks-on-firmware-events.patch
  9863. deleted file mode 100644
  9864. index 3e2e350..0000000
  9865. --- a/package/kernel/mac80211/patches/344-0005-brcmfmac-Add-length-checks-on-firmware-events.patch
  9866. +++ /dev/null
  9867. @@ -1,283 +0,0 @@
  9868. -From: Hante Meuleman <meuleman@broadcom.com>
  9869. -Date: Wed, 17 Feb 2016 11:26:54 +0100
  9870. -Subject: [PATCH] brcmfmac: Add length checks on firmware events
  9871. -
  9872. -Add additional length checks on firmware events to create more
  9873. -robust code.
  9874. -
  9875. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  9876. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  9877. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  9878. -Reviewed-by: Lei Zhang <leizh@broadcom.com>
  9879. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  9880. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  9881. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9882. ----
  9883. -
  9884. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  9885. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  9886. -@@ -3092,6 +3092,11 @@ brcmf_notify_sched_scan_results(struct b
  9887. -
  9888. - brcmf_dbg(SCAN, "Enter\n");
  9889. -
  9890. -+ if (e->datalen < (sizeof(*pfn_result) + sizeof(*netinfo))) {
  9891. -+ brcmf_dbg(SCAN, "Event data to small. Ignore\n");
  9892. -+ return 0;
  9893. -+ }
  9894. -+
  9895. - if (e->event_code == BRCMF_E_PFN_NET_LOST) {
  9896. - brcmf_dbg(SCAN, "PFN NET LOST event. Do Nothing\n");
  9897. - return 0;
  9898. -@@ -3415,6 +3420,11 @@ brcmf_wowl_nd_results(struct brcmf_if *i
  9899. -
  9900. - brcmf_dbg(SCAN, "Enter\n");
  9901. -
  9902. -+ if (e->datalen < (sizeof(*pfn_result) + sizeof(*netinfo))) {
  9903. -+ brcmf_dbg(SCAN, "Event data to small. Ignore\n");
  9904. -+ return 0;
  9905. -+ }
  9906. -+
  9907. - pfn_result = (struct brcmf_pno_scanresults_le *)data;
  9908. -
  9909. - if (e->event_code == BRCMF_E_PFN_NET_LOST) {
  9910. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  9911. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  9912. -@@ -26,50 +26,6 @@
  9913. - #include "fwil.h"
  9914. -
  9915. - /**
  9916. -- * struct brcm_ethhdr - broadcom specific ether header.
  9917. -- *
  9918. -- * @subtype: subtype for this packet.
  9919. -- * @length: TODO: length of appended data.
  9920. -- * @version: version indication.
  9921. -- * @oui: OUI of this packet.
  9922. -- * @usr_subtype: subtype for this OUI.
  9923. -- */
  9924. --struct brcm_ethhdr {
  9925. -- __be16 subtype;
  9926. -- __be16 length;
  9927. -- u8 version;
  9928. -- u8 oui[3];
  9929. -- __be16 usr_subtype;
  9930. --} __packed;
  9931. --
  9932. --struct brcmf_event_msg_be {
  9933. -- __be16 version;
  9934. -- __be16 flags;
  9935. -- __be32 event_type;
  9936. -- __be32 status;
  9937. -- __be32 reason;
  9938. -- __be32 auth_type;
  9939. -- __be32 datalen;
  9940. -- u8 addr[ETH_ALEN];
  9941. -- char ifname[IFNAMSIZ];
  9942. -- u8 ifidx;
  9943. -- u8 bsscfgidx;
  9944. --} __packed;
  9945. --
  9946. --/**
  9947. -- * struct brcmf_event - contents of broadcom event packet.
  9948. -- *
  9949. -- * @eth: standard ether header.
  9950. -- * @hdr: broadcom specific ether header.
  9951. -- * @msg: common part of the actual event message.
  9952. -- */
  9953. --struct brcmf_event {
  9954. -- struct ethhdr eth;
  9955. -- struct brcm_ethhdr hdr;
  9956. -- struct brcmf_event_msg_be msg;
  9957. --} __packed;
  9958. --
  9959. --/**
  9960. - * struct brcmf_fweh_queue_item - event item on event queue.
  9961. - *
  9962. - * @q: list element for queuing.
  9963. -@@ -85,6 +41,7 @@ struct brcmf_fweh_queue_item {
  9964. - u8 ifidx;
  9965. - u8 ifaddr[ETH_ALEN];
  9966. - struct brcmf_event_msg_be emsg;
  9967. -+ u32 datalen;
  9968. - u8 data[0];
  9969. - };
  9970. -
  9971. -@@ -294,6 +251,11 @@ static void brcmf_fweh_event_worker(stru
  9972. - brcmf_dbg_hex_dump(BRCMF_EVENT_ON(), event->data,
  9973. - min_t(u32, emsg.datalen, 64),
  9974. - "event payload, len=%d\n", emsg.datalen);
  9975. -+ if (emsg.datalen > event->datalen) {
  9976. -+ brcmf_err("event invalid length header=%d, msg=%d\n",
  9977. -+ event->datalen, emsg.datalen);
  9978. -+ goto event_free;
  9979. -+ }
  9980. -
  9981. - /* special handling of interface event */
  9982. - if (event->code == BRCMF_E_IF) {
  9983. -@@ -439,7 +401,8 @@ int brcmf_fweh_activate_events(struct br
  9984. - * dispatch the event to a registered handler (using worker).
  9985. - */
  9986. - void brcmf_fweh_process_event(struct brcmf_pub *drvr,
  9987. -- struct brcmf_event *event_packet)
  9988. -+ struct brcmf_event *event_packet,
  9989. -+ u32 packet_len)
  9990. - {
  9991. - enum brcmf_fweh_event_code code;
  9992. - struct brcmf_fweh_info *fweh = &drvr->fweh;
  9993. -@@ -459,6 +422,9 @@ void brcmf_fweh_process_event(struct brc
  9994. - if (code != BRCMF_E_IF && !fweh->evt_handler[code])
  9995. - return;
  9996. -
  9997. -+ if (datalen > BRCMF_DCMD_MAXLEN)
  9998. -+ return;
  9999. -+
  10000. - if (in_interrupt())
  10001. - alloc_flag = GFP_ATOMIC;
  10002. -
  10003. -@@ -472,6 +438,7 @@ void brcmf_fweh_process_event(struct brc
  10004. - /* use memcpy to get aligned event message */
  10005. - memcpy(&event->emsg, &event_packet->msg, sizeof(event->emsg));
  10006. - memcpy(event->data, data, datalen);
  10007. -+ event->datalen = datalen;
  10008. - memcpy(event->ifaddr, event_packet->eth.h_dest, ETH_ALEN);
  10009. -
  10010. - brcmf_fweh_queue_event(fweh, event);
  10011. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h
  10012. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h
  10013. -@@ -27,7 +27,6 @@
  10014. - struct brcmf_pub;
  10015. - struct brcmf_if;
  10016. - struct brcmf_cfg80211_info;
  10017. --struct brcmf_event;
  10018. -
  10019. - /* list of firmware events */
  10020. - #define BRCMF_FWEH_EVENT_ENUM_DEFLIST \
  10021. -@@ -180,13 +179,55 @@ enum brcmf_fweh_event_code {
  10022. - /**
  10023. - * definitions for event packet validation.
  10024. - */
  10025. --#define BRCMF_EVENT_OUI_OFFSET 19
  10026. --#define BRCM_OUI "\x00\x10\x18"
  10027. --#define DOT11_OUI_LEN 3
  10028. --#define BCMILCP_BCM_SUBTYPE_EVENT 1
  10029. -+#define BRCM_OUI "\x00\x10\x18"
  10030. -+#define BCMILCP_BCM_SUBTYPE_EVENT 1
  10031. -
  10032. -
  10033. - /**
  10034. -+ * struct brcm_ethhdr - broadcom specific ether header.
  10035. -+ *
  10036. -+ * @subtype: subtype for this packet.
  10037. -+ * @length: TODO: length of appended data.
  10038. -+ * @version: version indication.
  10039. -+ * @oui: OUI of this packet.
  10040. -+ * @usr_subtype: subtype for this OUI.
  10041. -+ */
  10042. -+struct brcm_ethhdr {
  10043. -+ __be16 subtype;
  10044. -+ __be16 length;
  10045. -+ u8 version;
  10046. -+ u8 oui[3];
  10047. -+ __be16 usr_subtype;
  10048. -+} __packed;
  10049. -+
  10050. -+struct brcmf_event_msg_be {
  10051. -+ __be16 version;
  10052. -+ __be16 flags;
  10053. -+ __be32 event_type;
  10054. -+ __be32 status;
  10055. -+ __be32 reason;
  10056. -+ __be32 auth_type;
  10057. -+ __be32 datalen;
  10058. -+ u8 addr[ETH_ALEN];
  10059. -+ char ifname[IFNAMSIZ];
  10060. -+ u8 ifidx;
  10061. -+ u8 bsscfgidx;
  10062. -+} __packed;
  10063. -+
  10064. -+/**
  10065. -+ * struct brcmf_event - contents of broadcom event packet.
  10066. -+ *
  10067. -+ * @eth: standard ether header.
  10068. -+ * @hdr: broadcom specific ether header.
  10069. -+ * @msg: common part of the actual event message.
  10070. -+ */
  10071. -+struct brcmf_event {
  10072. -+ struct ethhdr eth;
  10073. -+ struct brcm_ethhdr hdr;
  10074. -+ struct brcmf_event_msg_be msg;
  10075. -+} __packed;
  10076. -+
  10077. -+/**
  10078. - * struct brcmf_event_msg - firmware event message.
  10079. - *
  10080. - * @version: version information.
  10081. -@@ -256,34 +297,35 @@ void brcmf_fweh_unregister(struct brcmf_
  10082. - enum brcmf_fweh_event_code code);
  10083. - int brcmf_fweh_activate_events(struct brcmf_if *ifp);
  10084. - void brcmf_fweh_process_event(struct brcmf_pub *drvr,
  10085. -- struct brcmf_event *event_packet);
  10086. -+ struct brcmf_event *event_packet,
  10087. -+ u32 packet_len);
  10088. - void brcmf_fweh_p2pdev_setup(struct brcmf_if *ifp, bool ongoing);
  10089. -
  10090. - static inline void brcmf_fweh_process_skb(struct brcmf_pub *drvr,
  10091. - struct sk_buff *skb)
  10092. - {
  10093. - struct brcmf_event *event_packet;
  10094. -- u8 *data;
  10095. - u16 usr_stype;
  10096. -
  10097. - /* only process events when protocol matches */
  10098. - if (skb->protocol != cpu_to_be16(ETH_P_LINK_CTL))
  10099. - return;
  10100. -
  10101. -+ if ((skb->len + ETH_HLEN) < sizeof(*event_packet))
  10102. -+ return;
  10103. -+
  10104. - /* check for BRCM oui match */
  10105. - event_packet = (struct brcmf_event *)skb_mac_header(skb);
  10106. -- data = (u8 *)event_packet;
  10107. -- data += BRCMF_EVENT_OUI_OFFSET;
  10108. -- if (memcmp(BRCM_OUI, data, DOT11_OUI_LEN))
  10109. -+ if (memcmp(BRCM_OUI, &event_packet->hdr.oui[0],
  10110. -+ sizeof(event_packet->hdr.oui)))
  10111. - return;
  10112. -
  10113. - /* final match on usr_subtype */
  10114. -- data += DOT11_OUI_LEN;
  10115. -- usr_stype = get_unaligned_be16(data);
  10116. -+ usr_stype = get_unaligned_be16(&event_packet->hdr.usr_subtype);
  10117. - if (usr_stype != BCMILCP_BCM_SUBTYPE_EVENT)
  10118. - return;
  10119. -
  10120. -- brcmf_fweh_process_event(drvr, event_packet);
  10121. -+ brcmf_fweh_process_event(drvr, event_packet, skb->len + ETH_HLEN);
  10122. - }
  10123. -
  10124. - #endif /* FWEH_H_ */
  10125. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  10126. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  10127. -@@ -1361,6 +1361,11 @@ int brcmf_p2p_notify_action_frame_rx(str
  10128. - u16 mgmt_type;
  10129. - u8 action;
  10130. -
  10131. -+ if (e->datalen < sizeof(*rxframe)) {
  10132. -+ brcmf_dbg(SCAN, "Event data to small. Ignore\n");
  10133. -+ return 0;
  10134. -+ }
  10135. -+
  10136. - ch.chspec = be16_to_cpu(rxframe->chanspec);
  10137. - cfg->d11inf.decchspec(&ch);
  10138. - /* Check if wpa_supplicant has registered for this frame */
  10139. -@@ -1858,6 +1863,11 @@ s32 brcmf_p2p_notify_rx_mgmt_p2p_probere
  10140. - brcmf_dbg(INFO, "Enter: event %d reason %d\n", e->event_code,
  10141. - e->reason);
  10142. -
  10143. -+ if (e->datalen < sizeof(*rxframe)) {
  10144. -+ brcmf_dbg(SCAN, "Event data to small. Ignore\n");
  10145. -+ return 0;
  10146. -+ }
  10147. -+
  10148. - ch.chspec = be16_to_cpu(rxframe->chanspec);
  10149. - cfg->d11inf.decchspec(&ch);
  10150. -
  10151. diff --git a/package/kernel/mac80211/patches/344-0006-brcmfmac-add-neighbor-discovery-offload-ip-address-t.patch b/package/kernel/mac80211/patches/344-0006-brcmfmac-add-neighbor-discovery-offload-ip-address-t.patch
  10152. deleted file mode 100644
  10153. index 888ad5b..0000000
  10154. --- a/package/kernel/mac80211/patches/344-0006-brcmfmac-add-neighbor-discovery-offload-ip-address-t.patch
  10155. +++ /dev/null
  10156. @@ -1,333 +0,0 @@
  10157. -From: Franky Lin <frankyl@broadcom.com>
  10158. -Date: Wed, 17 Feb 2016 11:26:55 +0100
  10159. -Subject: [PATCH] brcmfmac: add neighbor discovery offload ip address table
  10160. - configuration
  10161. -
  10162. -Configure ipv6 address for neighbor discovery offload ip table in
  10163. -firmware obtained through ipv6 address notification callback.
  10164. -
  10165. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  10166. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10167. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  10168. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10169. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10170. ----
  10171. -
  10172. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  10173. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  10174. -@@ -456,7 +456,7 @@ send_key_to_dongle(struct brcmf_if *ifp,
  10175. - }
  10176. -
  10177. - static s32
  10178. --brcmf_configure_arp_offload(struct brcmf_if *ifp, bool enable)
  10179. -+brcmf_configure_arp_nd_offload(struct brcmf_if *ifp, bool enable)
  10180. - {
  10181. - s32 err;
  10182. - u32 mode;
  10183. -@@ -484,6 +484,15 @@ brcmf_configure_arp_offload(struct brcmf
  10184. - enable, mode);
  10185. - }
  10186. -
  10187. -+ err = brcmf_fil_iovar_int_set(ifp, "ndoe", enable);
  10188. -+ if (err) {
  10189. -+ brcmf_dbg(TRACE, "failed to configure (%d) ND offload err = %d\n",
  10190. -+ enable, err);
  10191. -+ err = 0;
  10192. -+ } else
  10193. -+ brcmf_dbg(TRACE, "successfully configured (%d) ND offload to 0x%x\n",
  10194. -+ enable, mode);
  10195. -+
  10196. - return err;
  10197. - }
  10198. -
  10199. -@@ -3543,7 +3552,7 @@ static s32 brcmf_cfg80211_resume(struct
  10200. - brcmf_report_wowl_wakeind(wiphy, ifp);
  10201. - brcmf_fil_iovar_int_set(ifp, "wowl_clear", 0);
  10202. - brcmf_config_wowl_pattern(ifp, "clr", NULL, 0, NULL, 0);
  10203. -- brcmf_configure_arp_offload(ifp, true);
  10204. -+ brcmf_configure_arp_nd_offload(ifp, true);
  10205. - brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM,
  10206. - cfg->wowl.pre_pmmode);
  10207. - cfg->wowl.active = false;
  10208. -@@ -3567,7 +3576,7 @@ static void brcmf_configure_wowl(struct
  10209. -
  10210. - brcmf_dbg(TRACE, "Suspend, wowl config.\n");
  10211. -
  10212. -- brcmf_configure_arp_offload(ifp, false);
  10213. -+ brcmf_configure_arp_nd_offload(ifp, false);
  10214. - brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_PM, &cfg->wowl.pre_pmmode);
  10215. - brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM, PM_MAX);
  10216. -
  10217. -@@ -4336,7 +4345,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  10218. -
  10219. - if (!mbss) {
  10220. - brcmf_set_mpc(ifp, 0);
  10221. -- brcmf_configure_arp_offload(ifp, false);
  10222. -+ brcmf_configure_arp_nd_offload(ifp, false);
  10223. - }
  10224. -
  10225. - /* find the RSN_IE */
  10226. -@@ -4482,7 +4491,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  10227. - exit:
  10228. - if ((err) && (!mbss)) {
  10229. - brcmf_set_mpc(ifp, 1);
  10230. -- brcmf_configure_arp_offload(ifp, true);
  10231. -+ brcmf_configure_arp_nd_offload(ifp, true);
  10232. - }
  10233. - return err;
  10234. - }
  10235. -@@ -4540,7 +4549,7 @@ static int brcmf_cfg80211_stop_ap(struct
  10236. - brcmf_err("bss_enable config failed %d\n", err);
  10237. - }
  10238. - brcmf_set_mpc(ifp, 1);
  10239. -- brcmf_configure_arp_offload(ifp, true);
  10240. -+ brcmf_configure_arp_nd_offload(ifp, true);
  10241. - clear_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state);
  10242. - brcmf_net_setcarrier(ifp, false);
  10243. -
  10244. -@@ -6287,7 +6296,7 @@ static s32 brcmf_config_dongle(struct br
  10245. - if (err)
  10246. - goto default_conf_out;
  10247. -
  10248. -- brcmf_configure_arp_offload(ifp, true);
  10249. -+ brcmf_configure_arp_nd_offload(ifp, true);
  10250. -
  10251. - cfg->dongle_up = true;
  10252. - default_conf_out:
  10253. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  10254. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  10255. -@@ -20,6 +20,8 @@
  10256. - #include <linux/inetdevice.h>
  10257. - #include <net/cfg80211.h>
  10258. - #include <net/rtnetlink.h>
  10259. -+#include <net/addrconf.h>
  10260. -+#include <net/ipv6.h>
  10261. - #include <brcmu_utils.h>
  10262. - #include <brcmu_wifi.h>
  10263. -
  10264. -@@ -172,6 +174,35 @@ _brcmf_set_mac_address(struct work_struc
  10265. - }
  10266. - }
  10267. -
  10268. -+#if IS_ENABLED(CONFIG_IPV6)
  10269. -+static void _brcmf_update_ndtable(struct work_struct *work)
  10270. -+{
  10271. -+ struct brcmf_if *ifp;
  10272. -+ int i, ret;
  10273. -+
  10274. -+ ifp = container_of(work, struct brcmf_if, ndoffload_work);
  10275. -+
  10276. -+ /* clear the table in firmware */
  10277. -+ ret = brcmf_fil_iovar_data_set(ifp, "nd_hostip_clear", NULL, 0);
  10278. -+ if (ret) {
  10279. -+ brcmf_dbg(TRACE, "fail to clear nd ip table err:%d\n", ret);
  10280. -+ return;
  10281. -+ }
  10282. -+
  10283. -+ for (i = 0; i < ifp->ipv6addr_idx; i++) {
  10284. -+ ret = brcmf_fil_iovar_data_set(ifp, "nd_hostip",
  10285. -+ &ifp->ipv6_addr_tbl[i],
  10286. -+ sizeof(struct in6_addr));
  10287. -+ if (ret)
  10288. -+ brcmf_err("add nd ip err %d\n", ret);
  10289. -+ }
  10290. -+}
  10291. -+#else
  10292. -+static void _brcmf_update_ndtable(struct work_struct *work)
  10293. -+{
  10294. -+}
  10295. -+#endif
  10296. -+
  10297. - static int brcmf_netdev_set_mac_address(struct net_device *ndev, void *addr)
  10298. - {
  10299. - struct brcmf_if *ifp = netdev_priv(ndev);
  10300. -@@ -685,6 +716,7 @@ int brcmf_net_attach(struct brcmf_if *if
  10301. -
  10302. - INIT_WORK(&ifp->setmacaddr_work, _brcmf_set_mac_address);
  10303. - INIT_WORK(&ifp->multicast_work, _brcmf_set_multicast_list);
  10304. -+ INIT_WORK(&ifp->ndoffload_work, _brcmf_update_ndtable);
  10305. -
  10306. - if (rtnl_locked)
  10307. - err = register_netdevice(ndev);
  10308. -@@ -884,6 +916,7 @@ static void brcmf_del_if(struct brcmf_pu
  10309. - if (ifp->ndev->netdev_ops == &brcmf_netdev_ops_pri) {
  10310. - cancel_work_sync(&ifp->setmacaddr_work);
  10311. - cancel_work_sync(&ifp->multicast_work);
  10312. -+ cancel_work_sync(&ifp->ndoffload_work);
  10313. - }
  10314. - brcmf_net_detach(ifp->ndev);
  10315. - } else {
  10316. -@@ -1025,6 +1058,56 @@ static int brcmf_inetaddr_changed(struct
  10317. - }
  10318. - #endif
  10319. -
  10320. -+#if IS_ENABLED(CONFIG_IPV6)
  10321. -+static int brcmf_inet6addr_changed(struct notifier_block *nb,
  10322. -+ unsigned long action, void *data)
  10323. -+{
  10324. -+ struct brcmf_pub *drvr = container_of(nb, struct brcmf_pub,
  10325. -+ inet6addr_notifier);
  10326. -+ struct inet6_ifaddr *ifa = data;
  10327. -+ struct brcmf_if *ifp;
  10328. -+ int i;
  10329. -+ struct in6_addr *table;
  10330. -+
  10331. -+ /* Only handle primary interface */
  10332. -+ ifp = drvr->iflist[0];
  10333. -+ if (!ifp)
  10334. -+ return NOTIFY_DONE;
  10335. -+ if (ifp->ndev != ifa->idev->dev)
  10336. -+ return NOTIFY_DONE;
  10337. -+
  10338. -+ table = ifp->ipv6_addr_tbl;
  10339. -+ for (i = 0; i < NDOL_MAX_ENTRIES; i++)
  10340. -+ if (ipv6_addr_equal(&ifa->addr, &table[i]))
  10341. -+ break;
  10342. -+
  10343. -+ switch (action) {
  10344. -+ case NETDEV_UP:
  10345. -+ if (i == NDOL_MAX_ENTRIES) {
  10346. -+ if (ifp->ipv6addr_idx < NDOL_MAX_ENTRIES) {
  10347. -+ table[ifp->ipv6addr_idx++] = ifa->addr;
  10348. -+ } else {
  10349. -+ for (i = 0; i < NDOL_MAX_ENTRIES - 1; i++)
  10350. -+ table[i] = table[i + 1];
  10351. -+ table[NDOL_MAX_ENTRIES - 1] = ifa->addr;
  10352. -+ }
  10353. -+ }
  10354. -+ break;
  10355. -+ case NETDEV_DOWN:
  10356. -+ if (i < NDOL_MAX_ENTRIES)
  10357. -+ for (; i < ifp->ipv6addr_idx; i++)
  10358. -+ table[i] = table[i + 1];
  10359. -+ break;
  10360. -+ default:
  10361. -+ break;
  10362. -+ }
  10363. -+
  10364. -+ schedule_work(&ifp->ndoffload_work);
  10365. -+
  10366. -+ return NOTIFY_OK;
  10367. -+}
  10368. -+#endif
  10369. -+
  10370. - int brcmf_attach(struct device *dev)
  10371. - {
  10372. - struct brcmf_pub *drvr = NULL;
  10373. -@@ -1164,30 +1247,41 @@ int brcmf_bus_start(struct device *dev)
  10374. - #ifdef CONFIG_INET
  10375. - drvr->inetaddr_notifier.notifier_call = brcmf_inetaddr_changed;
  10376. - ret = register_inetaddr_notifier(&drvr->inetaddr_notifier);
  10377. -+ if (ret)
  10378. -+ goto fail;
  10379. -+
  10380. -+#if IS_ENABLED(CONFIG_IPV6)
  10381. -+ drvr->inet6addr_notifier.notifier_call = brcmf_inet6addr_changed;
  10382. -+ ret = register_inet6addr_notifier(&drvr->inet6addr_notifier);
  10383. -+ if (ret) {
  10384. -+ unregister_inetaddr_notifier(&drvr->inetaddr_notifier);
  10385. -+ goto fail;
  10386. -+ }
  10387. - #endif
  10388. -+#endif /* CONFIG_INET */
  10389. -+
  10390. -+ return 0;
  10391. -
  10392. - fail:
  10393. -- if (ret < 0) {
  10394. -- brcmf_err("failed: %d\n", ret);
  10395. -- if (drvr->config) {
  10396. -- brcmf_cfg80211_detach(drvr->config);
  10397. -- drvr->config = NULL;
  10398. -- }
  10399. -- if (drvr->fws) {
  10400. -- brcmf_fws_del_interface(ifp);
  10401. -- brcmf_fws_deinit(drvr);
  10402. -- }
  10403. -- if (ifp)
  10404. -- brcmf_net_detach(ifp->ndev);
  10405. -- if (p2p_ifp)
  10406. -- brcmf_net_detach(p2p_ifp->ndev);
  10407. -- drvr->iflist[0] = NULL;
  10408. -- drvr->iflist[1] = NULL;
  10409. -- if (brcmf_ignoring_probe_fail(drvr))
  10410. -- ret = 0;
  10411. -- return ret;
  10412. -+ brcmf_err("failed: %d\n", ret);
  10413. -+ if (drvr->config) {
  10414. -+ brcmf_cfg80211_detach(drvr->config);
  10415. -+ drvr->config = NULL;
  10416. -+ }
  10417. -+ if (drvr->fws) {
  10418. -+ brcmf_fws_del_interface(ifp);
  10419. -+ brcmf_fws_deinit(drvr);
  10420. - }
  10421. -- return 0;
  10422. -+ if (ifp)
  10423. -+ brcmf_net_detach(ifp->ndev);
  10424. -+ if (p2p_ifp)
  10425. -+ brcmf_net_detach(p2p_ifp->ndev);
  10426. -+ drvr->iflist[0] = NULL;
  10427. -+ drvr->iflist[1] = NULL;
  10428. -+ if (brcmf_ignoring_probe_fail(drvr))
  10429. -+ ret = 0;
  10430. -+
  10431. -+ return ret;
  10432. - }
  10433. -
  10434. - void brcmf_bus_add_txhdrlen(struct device *dev, uint len)
  10435. -@@ -1237,6 +1331,10 @@ void brcmf_detach(struct device *dev)
  10436. - unregister_inetaddr_notifier(&drvr->inetaddr_notifier);
  10437. - #endif
  10438. -
  10439. -+#if IS_ENABLED(CONFIG_IPV6)
  10440. -+ unregister_inet6addr_notifier(&drvr->inet6addr_notifier);
  10441. -+#endif
  10442. -+
  10443. - /* stop firmware event handling */
  10444. - brcmf_fweh_detach(drvr);
  10445. - if (drvr->config)
  10446. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  10447. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  10448. -@@ -48,6 +48,8 @@
  10449. - */
  10450. - #define BRCMF_DRIVER_FIRMWARE_VERSION_LEN 32
  10451. -
  10452. -+#define NDOL_MAX_ENTRIES 8
  10453. -+
  10454. - /**
  10455. - * struct brcmf_ampdu_rx_reorder - AMPDU receive reorder info
  10456. - *
  10457. -@@ -143,6 +145,7 @@ struct brcmf_pub {
  10458. - #endif
  10459. -
  10460. - struct notifier_block inetaddr_notifier;
  10461. -+ struct notifier_block inet6addr_notifier;
  10462. - struct brcmf_mp_device *settings;
  10463. - };
  10464. -
  10465. -@@ -175,6 +178,7 @@ enum brcmf_netif_stop_reason {
  10466. - * @stats: interface specific network statistics.
  10467. - * @setmacaddr_work: worker object for setting mac address.
  10468. - * @multicast_work: worker object for multicast provisioning.
  10469. -+ * @ndoffload_work: worker object for neighbor discovery offload configuration.
  10470. - * @fws_desc: interface specific firmware-signalling descriptor.
  10471. - * @ifidx: interface index in device firmware.
  10472. - * @bsscfgidx: index of bss associated with this interface.
  10473. -@@ -191,6 +195,7 @@ struct brcmf_if {
  10474. - struct net_device_stats stats;
  10475. - struct work_struct setmacaddr_work;
  10476. - struct work_struct multicast_work;
  10477. -+ struct work_struct ndoffload_work;
  10478. - struct brcmf_fws_mac_descriptor *fws_desc;
  10479. - int ifidx;
  10480. - s32 bsscfgidx;
  10481. -@@ -199,6 +204,8 @@ struct brcmf_if {
  10482. - spinlock_t netif_stop_lock;
  10483. - atomic_t pend_8021x_cnt;
  10484. - wait_queue_head_t pend_8021x_wait;
  10485. -+ struct in6_addr ipv6_addr_tbl[NDOL_MAX_ENTRIES];
  10486. -+ u8 ipv6addr_idx;
  10487. - };
  10488. -
  10489. - struct brcmf_skb_reorder_data {
  10490. diff --git a/package/kernel/mac80211/patches/344-0007-brcmfmac-check-return-for-ARP-ip-setting-iovar.patch b/package/kernel/mac80211/patches/344-0007-brcmfmac-check-return-for-ARP-ip-setting-iovar.patch
  10491. deleted file mode 100644
  10492. index 68de8ed..0000000
  10493. --- a/package/kernel/mac80211/patches/344-0007-brcmfmac-check-return-for-ARP-ip-setting-iovar.patch
  10494. +++ /dev/null
  10495. @@ -1,38 +0,0 @@
  10496. -From: Franky Lin <frankyl@broadcom.com>
  10497. -Date: Wed, 17 Feb 2016 11:26:56 +0100
  10498. -Subject: [PATCH] brcmfmac: check return for ARP ip setting iovar
  10499. -
  10500. -The return value of iovar set function should be saved and checked.
  10501. -
  10502. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10503. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  10504. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  10505. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10506. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10507. ----
  10508. -
  10509. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  10510. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  10511. -@@ -1039,14 +1039,14 @@ static int brcmf_inetaddr_changed(struct
  10512. - return NOTIFY_OK;
  10513. - }
  10514. - for (i = 0; i < ARPOL_MAX_ENTRIES; i++) {
  10515. -- if (addr_table[i] != 0) {
  10516. -- brcmf_fil_iovar_data_set(ifp,
  10517. -- "arp_hostip", &addr_table[i],
  10518. -- sizeof(addr_table[i]));
  10519. -- if (ret)
  10520. -- brcmf_err("add arp ip err %d\n",
  10521. -- ret);
  10522. -- }
  10523. -+ if (addr_table[i] == 0)
  10524. -+ continue;
  10525. -+ ret = brcmf_fil_iovar_data_set(ifp, "arp_hostip",
  10526. -+ &addr_table[i],
  10527. -+ sizeof(addr_table[i]));
  10528. -+ if (ret)
  10529. -+ brcmf_err("add arp ip err %d\n",
  10530. -+ ret);
  10531. - }
  10532. - }
  10533. - break;
  10534. 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
  10535. deleted file mode 100644
  10536. index 3de0f64..0000000
  10537. --- a/package/kernel/mac80211/patches/344-0008-brcmfmac-use-device-memsize-config-from-fw-if-define.patch
  10538. +++ /dev/null
  10539. @@ -1,73 +0,0 @@
  10540. -From: Hante Meuleman <meuleman@broadcom.com>
  10541. -Date: Wed, 17 Feb 2016 11:26:57 +0100
  10542. -Subject: [PATCH] brcmfmac: use device memsize config from fw if defined
  10543. -
  10544. -Newer type pcie devices have memory which get shared between fw and
  10545. -hw. The division of this memory is done firmware compile time. As a
  10546. -result the ramsize as used by driver needs to be adjusted for this.
  10547. -This is done by reading the memory size from the firmware.
  10548. -
  10549. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  10550. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  10551. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10552. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  10553. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10554. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10555. ----
  10556. -
  10557. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  10558. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  10559. -@@ -207,6 +207,10 @@ static struct brcmf_firmware_mapping brc
  10560. - #define BRCMF_PCIE_CFGREG_REG_BAR3_CONFIG 0x4F4
  10561. - #define BRCMF_PCIE_LINK_STATUS_CTRL_ASPM_ENAB 3
  10562. -
  10563. -+/* Magic number at a magic location to find RAM size */
  10564. -+#define BRCMF_RAMSIZE_MAGIC 0x534d4152 /* SMAR */
  10565. -+#define BRCMF_RAMSIZE_OFFSET 0x6c
  10566. -+
  10567. -
  10568. - struct brcmf_pcie_console {
  10569. - u32 base_addr;
  10570. -@@ -1412,6 +1416,28 @@ static const struct brcmf_bus_ops brcmf_
  10571. - };
  10572. -
  10573. -
  10574. -+static void
  10575. -+brcmf_pcie_adjust_ramsize(struct brcmf_pciedev_info *devinfo, u8 *data,
  10576. -+ u32 data_len)
  10577. -+{
  10578. -+ __le32 *field;
  10579. -+ u32 newsize;
  10580. -+
  10581. -+ if (data_len < BRCMF_RAMSIZE_OFFSET + 8)
  10582. -+ return;
  10583. -+
  10584. -+ field = (__le32 *)&data[BRCMF_RAMSIZE_OFFSET];
  10585. -+ if (le32_to_cpup(field) != BRCMF_RAMSIZE_MAGIC)
  10586. -+ return;
  10587. -+ field++;
  10588. -+ newsize = le32_to_cpup(field);
  10589. -+
  10590. -+ brcmf_dbg(PCIE, "Found ramsize info in FW, adjusting to 0x%x\n",
  10591. -+ newsize);
  10592. -+ devinfo->ci->ramsize = newsize;
  10593. -+}
  10594. -+
  10595. -+
  10596. - static int
  10597. - brcmf_pcie_init_share_ram_info(struct brcmf_pciedev_info *devinfo,
  10598. - u32 sharedram_addr)
  10599. -@@ -1694,6 +1720,13 @@ static void brcmf_pcie_setup(struct devi
  10600. -
  10601. - brcmf_pcie_attach(devinfo);
  10602. -
  10603. -+ /* Some of the firmwares have the size of the memory of the device
  10604. -+ * defined inside the firmware. This is because part of the memory in
  10605. -+ * the device is shared and the devision is determined by FW. Parse
  10606. -+ * the firmware and adjust the chip memory size now.
  10607. -+ */
  10608. -+ brcmf_pcie_adjust_ramsize(devinfo, (u8 *)fw->data, fw->size);
  10609. -+
  10610. - ret = brcmf_pcie_download_fw_nvram(devinfo, fw, nvram, nvram_len);
  10611. - if (ret)
  10612. - goto fail;
  10613. 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
  10614. deleted file mode 100644
  10615. index ca03ffe..0000000
  10616. --- a/package/kernel/mac80211/patches/344-0009-brcmfmac-use-bar1-window-size-as-provided-by-pci-sub.patch
  10617. +++ /dev/null
  10618. @@ -1,58 +0,0 @@
  10619. -From: Hante Meuleman <meuleman@broadcom.com>
  10620. -Date: Wed, 17 Feb 2016 11:26:58 +0100
  10621. -Subject: [PATCH] brcmfmac: use bar1 window size as provided by pci subsystem
  10622. -
  10623. -The PCIE bar1 window size is specified by chip. Currently the
  10624. -ioremap of bar1 was using a define which always matched the size
  10625. -of bar1, but newer chips can have a different bar1 sizes. With
  10626. -this patch the ioremap will be called with the by chip provided
  10627. -window size.
  10628. -
  10629. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  10630. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  10631. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10632. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  10633. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10634. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10635. ----
  10636. -
  10637. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  10638. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  10639. -@@ -72,7 +72,6 @@ static struct brcmf_firmware_mapping brc
  10640. -
  10641. - #define BRCMF_PCIE_FW_UP_TIMEOUT 2000 /* msec */
  10642. -
  10643. --#define BRCMF_PCIE_TCM_MAP_SIZE (4096 * 1024)
  10644. - #define BRCMF_PCIE_REG_MAP_SIZE (32 * 1024)
  10645. -
  10646. - /* backplane addres space accessed by BAR0 */
  10647. -@@ -252,7 +251,6 @@ struct brcmf_pciedev_info {
  10648. - char nvram_name[BRCMF_FW_NAME_LEN];
  10649. - void __iomem *regs;
  10650. - void __iomem *tcm;
  10651. -- u32 tcm_size;
  10652. - u32 ram_base;
  10653. - u32 ram_size;
  10654. - struct brcmf_chip *ci;
  10655. -@@ -1592,8 +1590,7 @@ static int brcmf_pcie_get_resource(struc
  10656. - }
  10657. -
  10658. - devinfo->regs = ioremap_nocache(bar0_addr, BRCMF_PCIE_REG_MAP_SIZE);
  10659. -- devinfo->tcm = ioremap_nocache(bar1_addr, BRCMF_PCIE_TCM_MAP_SIZE);
  10660. -- devinfo->tcm_size = BRCMF_PCIE_TCM_MAP_SIZE;
  10661. -+ devinfo->tcm = ioremap_nocache(bar1_addr, bar1_size);
  10662. -
  10663. - if (!devinfo->regs || !devinfo->tcm) {
  10664. - brcmf_err("ioremap() failed (%p,%p)\n", devinfo->regs,
  10665. -@@ -1602,8 +1599,9 @@ static int brcmf_pcie_get_resource(struc
  10666. - }
  10667. - brcmf_dbg(PCIE, "Phys addr : reg space = %p base addr %#016llx\n",
  10668. - devinfo->regs, (unsigned long long)bar0_addr);
  10669. -- brcmf_dbg(PCIE, "Phys addr : mem space = %p base addr %#016llx\n",
  10670. -- devinfo->tcm, (unsigned long long)bar1_addr);
  10671. -+ brcmf_dbg(PCIE, "Phys addr : mem space = %p base addr %#016llx size 0x%x\n",
  10672. -+ devinfo->tcm, (unsigned long long)bar1_addr,
  10673. -+ (unsigned int)bar1_size);
  10674. -
  10675. - return 0;
  10676. - }
  10677. 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
  10678. deleted file mode 100644
  10679. index e4a8f30..0000000
  10680. --- a/package/kernel/mac80211/patches/344-0010-brcmfmac-add-support-for-the-PCIE-4366c0-chip.patch
  10681. +++ /dev/null
  10682. @@ -1,34 +0,0 @@
  10683. -From: Hante Meuleman <meuleman@broadcom.com>
  10684. -Date: Wed, 17 Feb 2016 11:26:59 +0100
  10685. -Subject: [PATCH] brcmfmac: add support for the PCIE 4366c0 chip
  10686. -
  10687. -A newer version of the 4366 PCIE chip has been released. Add
  10688. -support for this version of the chip.
  10689. -
  10690. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  10691. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10692. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  10693. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10694. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10695. ----
  10696. -
  10697. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  10698. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  10699. -@@ -53,6 +53,7 @@ BRCMF_FW_NVRAM_DEF(4358, "brcmfmac4358-p
  10700. - BRCMF_FW_NVRAM_DEF(4359, "brcmfmac4359-pcie.bin", "brcmfmac4359-pcie.txt");
  10701. - BRCMF_FW_NVRAM_DEF(4365B, "brcmfmac4365b-pcie.bin", "brcmfmac4365b-pcie.txt");
  10702. - BRCMF_FW_NVRAM_DEF(4366B, "brcmfmac4366b-pcie.bin", "brcmfmac4366b-pcie.txt");
  10703. -+BRCMF_FW_NVRAM_DEF(4366C, "brcmfmac4366c-pcie.bin", "brcmfmac4366c-pcie.txt");
  10704. - BRCMF_FW_NVRAM_DEF(4371, "brcmfmac4371-pcie.bin", "brcmfmac4371-pcie.txt");
  10705. -
  10706. - static struct brcmf_firmware_mapping brcmf_pcie_fwnames[] = {
  10707. -@@ -66,7 +67,8 @@ static struct brcmf_firmware_mapping brc
  10708. - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4358_CHIP_ID, 0xFFFFFFFF, 4358),
  10709. - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4359_CHIP_ID, 0xFFFFFFFF, 4359),
  10710. - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4365_CHIP_ID, 0xFFFFFFFF, 4365B),
  10711. -- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4366_CHIP_ID, 0xFFFFFFFF, 4366B),
  10712. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4366_CHIP_ID, 0x0000000F, 4366B),
  10713. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4366_CHIP_ID, 0xFFFFFFF0, 4366C),
  10714. - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4371_CHIP_ID, 0xFFFFFFFF, 4371),
  10715. - };
  10716. -
  10717. diff --git a/package/kernel/mac80211/patches/344-0011-brcmfmac-remove-pcie-gen1-support.patch b/package/kernel/mac80211/patches/344-0011-brcmfmac-remove-pcie-gen1-support.patch
  10718. deleted file mode 100644
  10719. index f99f6db..0000000
  10720. --- a/package/kernel/mac80211/patches/344-0011-brcmfmac-remove-pcie-gen1-support.patch
  10721. +++ /dev/null
  10722. @@ -1,221 +0,0 @@
  10723. -From: Hante Meuleman <meuleman@broadcom.com>
  10724. -Date: Wed, 17 Feb 2016 11:27:00 +0100
  10725. -Subject: [PATCH] brcmfmac: remove pcie gen1 support
  10726. -
  10727. -The PCIE bus driver supports older gen1 (v1) chips, but there is no
  10728. -actual device which is using this older pcie core which is supported
  10729. -by brcmfmac. Remove all gen1 related code.
  10730. -
  10731. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  10732. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  10733. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10734. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  10735. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10736. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10737. ----
  10738. -
  10739. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  10740. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  10741. -@@ -100,9 +100,6 @@ static struct brcmf_firmware_mapping brc
  10742. - #define BRCMF_PCIE_PCIE2REG_CONFIGDATA 0x124
  10743. - #define BRCMF_PCIE_PCIE2REG_H2D_MAILBOX 0x140
  10744. -
  10745. --#define BRCMF_PCIE_GENREV1 1
  10746. --#define BRCMF_PCIE_GENREV2 2
  10747. --
  10748. - #define BRCMF_PCIE2_INTA 0x01
  10749. - #define BRCMF_PCIE2_INTB 0x02
  10750. -
  10751. -@@ -257,9 +254,7 @@ struct brcmf_pciedev_info {
  10752. - u32 ram_size;
  10753. - struct brcmf_chip *ci;
  10754. - u32 coreid;
  10755. -- u32 generic_corerev;
  10756. - struct brcmf_pcie_shared_info shared;
  10757. -- void (*ringbell)(struct brcmf_pciedev_info *devinfo);
  10758. - wait_queue_head_t mbdata_resp_wait;
  10759. - bool mbdata_completed;
  10760. - bool irq_allocated;
  10761. -@@ -746,68 +741,22 @@ static void brcmf_pcie_bus_console_read(
  10762. - }
  10763. -
  10764. -
  10765. --static __used void brcmf_pcie_ringbell_v1(struct brcmf_pciedev_info *devinfo)
  10766. --{
  10767. -- u32 reg_value;
  10768. --
  10769. -- brcmf_dbg(PCIE, "RING !\n");
  10770. -- reg_value = brcmf_pcie_read_reg32(devinfo,
  10771. -- BRCMF_PCIE_PCIE2REG_MAILBOXINT);
  10772. -- reg_value |= BRCMF_PCIE2_INTB;
  10773. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT,
  10774. -- reg_value);
  10775. --}
  10776. --
  10777. --
  10778. --static void brcmf_pcie_ringbell_v2(struct brcmf_pciedev_info *devinfo)
  10779. --{
  10780. -- brcmf_dbg(PCIE, "RING !\n");
  10781. -- /* Any arbitrary value will do, lets use 1 */
  10782. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_H2D_MAILBOX, 1);
  10783. --}
  10784. --
  10785. --
  10786. - static void brcmf_pcie_intr_disable(struct brcmf_pciedev_info *devinfo)
  10787. - {
  10788. -- if (devinfo->generic_corerev == BRCMF_PCIE_GENREV1)
  10789. -- pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_INTMASK,
  10790. -- 0);
  10791. -- else
  10792. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXMASK,
  10793. -- 0);
  10794. -+ brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXMASK, 0);
  10795. - }
  10796. -
  10797. -
  10798. - static void brcmf_pcie_intr_enable(struct brcmf_pciedev_info *devinfo)
  10799. - {
  10800. -- if (devinfo->generic_corerev == BRCMF_PCIE_GENREV1)
  10801. -- pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_INTMASK,
  10802. -- BRCMF_PCIE_INT_DEF);
  10803. -- else
  10804. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXMASK,
  10805. -- BRCMF_PCIE_MB_INT_D2H_DB |
  10806. -- BRCMF_PCIE_MB_INT_FN0_0 |
  10807. -- BRCMF_PCIE_MB_INT_FN0_1);
  10808. -+ brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXMASK,
  10809. -+ BRCMF_PCIE_MB_INT_D2H_DB |
  10810. -+ BRCMF_PCIE_MB_INT_FN0_0 |
  10811. -+ BRCMF_PCIE_MB_INT_FN0_1);
  10812. - }
  10813. -
  10814. -
  10815. --static irqreturn_t brcmf_pcie_quick_check_isr_v1(int irq, void *arg)
  10816. --{
  10817. -- struct brcmf_pciedev_info *devinfo = (struct brcmf_pciedev_info *)arg;
  10818. -- u32 status;
  10819. --
  10820. -- status = 0;
  10821. -- pci_read_config_dword(devinfo->pdev, BRCMF_PCIE_REG_INTSTATUS, &status);
  10822. -- if (status) {
  10823. -- brcmf_pcie_intr_disable(devinfo);
  10824. -- brcmf_dbg(PCIE, "Enter\n");
  10825. -- return IRQ_WAKE_THREAD;
  10826. -- }
  10827. -- return IRQ_NONE;
  10828. --}
  10829. --
  10830. --
  10831. --static irqreturn_t brcmf_pcie_quick_check_isr_v2(int irq, void *arg)
  10832. -+static irqreturn_t brcmf_pcie_quick_check_isr(int irq, void *arg)
  10833. - {
  10834. - struct brcmf_pciedev_info *devinfo = (struct brcmf_pciedev_info *)arg;
  10835. -
  10836. -@@ -820,29 +769,7 @@ static irqreturn_t brcmf_pcie_quick_chec
  10837. - }
  10838. -
  10839. -
  10840. --static irqreturn_t brcmf_pcie_isr_thread_v1(int irq, void *arg)
  10841. --{
  10842. -- struct brcmf_pciedev_info *devinfo = (struct brcmf_pciedev_info *)arg;
  10843. -- const struct pci_dev *pdev = devinfo->pdev;
  10844. -- u32 status;
  10845. --
  10846. -- devinfo->in_irq = true;
  10847. -- status = 0;
  10848. -- pci_read_config_dword(pdev, BRCMF_PCIE_REG_INTSTATUS, &status);
  10849. -- brcmf_dbg(PCIE, "Enter %x\n", status);
  10850. -- if (status) {
  10851. -- pci_write_config_dword(pdev, BRCMF_PCIE_REG_INTSTATUS, status);
  10852. -- if (devinfo->state == BRCMFMAC_PCIE_STATE_UP)
  10853. -- brcmf_proto_msgbuf_rx_trigger(&devinfo->pdev->dev);
  10854. -- }
  10855. -- if (devinfo->state == BRCMFMAC_PCIE_STATE_UP)
  10856. -- brcmf_pcie_intr_enable(devinfo);
  10857. -- devinfo->in_irq = false;
  10858. -- return IRQ_HANDLED;
  10859. --}
  10860. --
  10861. --
  10862. --static irqreturn_t brcmf_pcie_isr_thread_v2(int irq, void *arg)
  10863. -+static irqreturn_t brcmf_pcie_isr_thread(int irq, void *arg)
  10864. - {
  10865. - struct brcmf_pciedev_info *devinfo = (struct brcmf_pciedev_info *)arg;
  10866. - u32 status;
  10867. -@@ -879,28 +806,14 @@ static int brcmf_pcie_request_irq(struct
  10868. - brcmf_pcie_intr_disable(devinfo);
  10869. -
  10870. - brcmf_dbg(PCIE, "Enter\n");
  10871. -- /* is it a v1 or v2 implementation */
  10872. -+
  10873. - pci_enable_msi(pdev);
  10874. -- if (devinfo->generic_corerev == BRCMF_PCIE_GENREV1) {
  10875. -- if (request_threaded_irq(pdev->irq,
  10876. -- brcmf_pcie_quick_check_isr_v1,
  10877. -- brcmf_pcie_isr_thread_v1,
  10878. -- IRQF_SHARED, "brcmf_pcie_intr",
  10879. -- devinfo)) {
  10880. -- pci_disable_msi(pdev);
  10881. -- brcmf_err("Failed to request IRQ %d\n", pdev->irq);
  10882. -- return -EIO;
  10883. -- }
  10884. -- } else {
  10885. -- if (request_threaded_irq(pdev->irq,
  10886. -- brcmf_pcie_quick_check_isr_v2,
  10887. -- brcmf_pcie_isr_thread_v2,
  10888. -- IRQF_SHARED, "brcmf_pcie_intr",
  10889. -- devinfo)) {
  10890. -- pci_disable_msi(pdev);
  10891. -- brcmf_err("Failed to request IRQ %d\n", pdev->irq);
  10892. -- return -EIO;
  10893. -- }
  10894. -+ if (request_threaded_irq(pdev->irq, brcmf_pcie_quick_check_isr,
  10895. -+ brcmf_pcie_isr_thread, IRQF_SHARED,
  10896. -+ "brcmf_pcie_intr", devinfo)) {
  10897. -+ pci_disable_msi(pdev);
  10898. -+ brcmf_err("Failed to request IRQ %d\n", pdev->irq);
  10899. -+ return -EIO;
  10900. - }
  10901. - devinfo->irq_allocated = true;
  10902. - return 0;
  10903. -@@ -931,16 +844,9 @@ static void brcmf_pcie_release_irq(struc
  10904. - if (devinfo->in_irq)
  10905. - brcmf_err("Still in IRQ (processing) !!!\n");
  10906. -
  10907. -- if (devinfo->generic_corerev == BRCMF_PCIE_GENREV1) {
  10908. -- status = 0;
  10909. -- pci_read_config_dword(pdev, BRCMF_PCIE_REG_INTSTATUS, &status);
  10910. -- pci_write_config_dword(pdev, BRCMF_PCIE_REG_INTSTATUS, status);
  10911. -- } else {
  10912. -- status = brcmf_pcie_read_reg32(devinfo,
  10913. -- BRCMF_PCIE_PCIE2REG_MAILBOXINT);
  10914. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT,
  10915. -- status);
  10916. -- }
  10917. -+ status = brcmf_pcie_read_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT);
  10918. -+ brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT, status);
  10919. -+
  10920. - devinfo->irq_allocated = false;
  10921. - }
  10922. -
  10923. -@@ -989,7 +895,9 @@ static int brcmf_pcie_ring_mb_ring_bell(
  10924. - if (devinfo->state != BRCMFMAC_PCIE_STATE_UP)
  10925. - return -EIO;
  10926. -
  10927. -- devinfo->ringbell(devinfo);
  10928. -+ brcmf_dbg(PCIE, "RING !\n");
  10929. -+ /* Any arbitrary value will do, lets use 1 */
  10930. -+ brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_H2D_MAILBOX, 1);
  10931. -
  10932. - return 0;
  10933. - }
  10934. -@@ -1503,9 +1411,6 @@ static int brcmf_pcie_download_fw_nvram(
  10935. - u32 address;
  10936. - u32 resetintr;
  10937. -
  10938. -- devinfo->ringbell = brcmf_pcie_ringbell_v2;
  10939. -- devinfo->generic_corerev = BRCMF_PCIE_GENREV2;
  10940. --
  10941. - brcmf_dbg(PCIE, "Halt ARM.\n");
  10942. - err = brcmf_pcie_enter_download_state(devinfo);
  10943. - if (err)
  10944. 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
  10945. deleted file mode 100644
  10946. index 4adfc2d..0000000
  10947. --- a/package/kernel/mac80211/patches/344-0012-brcmfmac-increase-timeout-for-tx-eapol.patch
  10948. +++ /dev/null
  10949. @@ -1,30 +0,0 @@
  10950. -From: Hante Meuleman <meuleman@broadcom.com>
  10951. -Date: Wed, 17 Feb 2016 11:27:01 +0100
  10952. -Subject: [PATCH] brcmfmac: increase timeout for tx eapol
  10953. -
  10954. -When keys get set and updated this has to happen after eapol got
  10955. -transmitted (without key or old key) before the key can be updated.
  10956. -To make sure the order of sending eapol and configuring key is done
  10957. -correctly a timeout for tx of eapol is applied. This timeout is set
  10958. -to 50 msec, which is not always enough. Especially in AP mode and
  10959. -key updates the timeout may need to be much longer because client(s)
  10960. -can be in powersave. Increase the timeout from 50 to 950 msec.
  10961. -
  10962. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  10963. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10964. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  10965. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10966. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10967. ----
  10968. -
  10969. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  10970. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  10971. -@@ -42,7 +42,7 @@ MODULE_AUTHOR("Broadcom Corporation");
  10972. - MODULE_DESCRIPTION("Broadcom 802.11 wireless LAN fullmac driver.");
  10973. - MODULE_LICENSE("Dual BSD/GPL");
  10974. -
  10975. --#define MAX_WAIT_FOR_8021X_TX msecs_to_jiffies(50)
  10976. -+#define MAX_WAIT_FOR_8021X_TX msecs_to_jiffies(950)
  10977. -
  10978. - /* AMPDU rx reordering definitions */
  10979. - #define BRCMF_RXREORDER_FLOWID_OFFSET 0
  10980. diff --git a/package/kernel/mac80211/patches/344-0013-brcmfmac-move-module-init-and-exit-to-common.patch b/package/kernel/mac80211/patches/344-0013-brcmfmac-move-module-init-and-exit-to-common.patch
  10981. deleted file mode 100644
  10982. index bd62781..0000000
  10983. --- a/package/kernel/mac80211/patches/344-0013-brcmfmac-move-module-init-and-exit-to-common.patch
  10984. +++ /dev/null
  10985. @@ -1,135 +0,0 @@
  10986. -From: Hante Meuleman <meuleman@broadcom.com>
  10987. -Date: Wed, 17 Feb 2016 11:27:02 +0100
  10988. -Subject: [PATCH] brcmfmac: move module init and exit to common
  10989. -
  10990. -In preparation of module parameters for all devices the module init
  10991. -and exit routines are moved to the common file.
  10992. -
  10993. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  10994. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  10995. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10996. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  10997. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10998. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10999. ----
  11000. -
  11001. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  11002. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  11003. -@@ -28,6 +28,10 @@
  11004. - #include "tracepoint.h"
  11005. - #include "common.h"
  11006. -
  11007. -+MODULE_AUTHOR("Broadcom Corporation");
  11008. -+MODULE_DESCRIPTION("Broadcom 802.11 wireless LAN fullmac driver.");
  11009. -+MODULE_LICENSE("Dual BSD/GPL");
  11010. -+
  11011. - const u8 ALLFFMAC[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
  11012. -
  11013. - #define BRCMF_DEFAULT_SCAN_CHANNEL_TIME 40
  11014. -@@ -221,7 +225,7 @@ void __brcmf_dbg(u32 level, const char *
  11015. - }
  11016. - #endif
  11017. -
  11018. --void brcmf_mp_attach(void)
  11019. -+static void brcmf_mp_attach(void)
  11020. - {
  11021. - strlcpy(brcmf_mp_global.firmware_path, brcmf_firmware_path,
  11022. - BRCMF_FW_ALTPATH_LEN);
  11023. -@@ -249,3 +253,33 @@ void brcmf_mp_device_detach(struct brcmf
  11024. - kfree(drvr->settings);
  11025. - }
  11026. -
  11027. -+static int __init brcmfmac_module_init(void)
  11028. -+{
  11029. -+ int err;
  11030. -+
  11031. -+ /* Initialize debug system first */
  11032. -+ brcmf_debugfs_init();
  11033. -+
  11034. -+#ifdef CPTCFG_BRCMFMAC_SDIO
  11035. -+ brcmf_sdio_init();
  11036. -+#endif
  11037. -+ /* Initialize global module paramaters */
  11038. -+ brcmf_mp_attach();
  11039. -+
  11040. -+ /* Continue the initialization by registering the different busses */
  11041. -+ err = brcmf_core_init();
  11042. -+ if (err)
  11043. -+ brcmf_debugfs_exit();
  11044. -+
  11045. -+ return err;
  11046. -+}
  11047. -+
  11048. -+static void __exit brcmfmac_module_exit(void)
  11049. -+{
  11050. -+ brcmf_core_exit();
  11051. -+ brcmf_debugfs_exit();
  11052. -+}
  11053. -+
  11054. -+module_init(brcmfmac_module_init);
  11055. -+module_exit(brcmfmac_module_exit);
  11056. -+
  11057. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
  11058. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
  11059. -@@ -89,7 +89,6 @@ struct brcmf_mp_device {
  11060. - struct cc_translate *country_codes;
  11061. - };
  11062. -
  11063. --void brcmf_mp_attach(void);
  11064. - int brcmf_mp_device_attach(struct brcmf_pub *drvr);
  11065. - void brcmf_mp_device_detach(struct brcmf_pub *drvr);
  11066. - #ifdef DEBUG
  11067. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  11068. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  11069. -@@ -38,10 +38,6 @@
  11070. - #include "pcie.h"
  11071. - #include "common.h"
  11072. -
  11073. --MODULE_AUTHOR("Broadcom Corporation");
  11074. --MODULE_DESCRIPTION("Broadcom 802.11 wireless LAN fullmac driver.");
  11075. --MODULE_LICENSE("Dual BSD/GPL");
  11076. --
  11077. - #define MAX_WAIT_FOR_8021X_TX msecs_to_jiffies(950)
  11078. -
  11079. - /* AMPDU rx reordering definitions */
  11080. -@@ -1422,19 +1418,15 @@ static void brcmf_driver_register(struct
  11081. - }
  11082. - static DECLARE_WORK(brcmf_driver_work, brcmf_driver_register);
  11083. -
  11084. --static int __init brcmfmac_module_init(void)
  11085. -+int __init brcmf_core_init(void)
  11086. - {
  11087. -- brcmf_debugfs_init();
  11088. --#ifdef CPTCFG_BRCMFMAC_SDIO
  11089. -- brcmf_sdio_init();
  11090. --#endif
  11091. - if (!schedule_work(&brcmf_driver_work))
  11092. - return -EBUSY;
  11093. -
  11094. - return 0;
  11095. - }
  11096. -
  11097. --static void __exit brcmfmac_module_exit(void)
  11098. -+void __exit brcmf_core_exit(void)
  11099. - {
  11100. - cancel_work_sync(&brcmf_driver_work);
  11101. -
  11102. -@@ -1447,8 +1439,5 @@ static void __exit brcmfmac_module_exit(
  11103. - #ifdef CPTCFG_BRCMFMAC_PCIE
  11104. - brcmf_pcie_exit();
  11105. - #endif
  11106. -- brcmf_debugfs_exit();
  11107. - }
  11108. -
  11109. --module_init(brcmfmac_module_init);
  11110. --module_exit(brcmfmac_module_exit);
  11111. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  11112. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  11113. -@@ -227,5 +227,7 @@ void brcmf_txflowblock_if(struct brcmf_i
  11114. - void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
  11115. - void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb);
  11116. - void brcmf_net_setcarrier(struct brcmf_if *ifp, bool on);
  11117. -+int __init brcmf_core_init(void);
  11118. -+void __exit brcmf_core_exit(void);
  11119. -
  11120. - #endif /* BRCMFMAC_CORE_H */
  11121. diff --git a/package/kernel/mac80211/patches/344-0014-brcmfmac-add-wowl-gtk-rekeying-offload-support.patch b/package/kernel/mac80211/patches/344-0014-brcmfmac-add-wowl-gtk-rekeying-offload-support.patch
  11122. deleted file mode 100644
  11123. index 577ca8e..0000000
  11124. --- a/package/kernel/mac80211/patches/344-0014-brcmfmac-add-wowl-gtk-rekeying-offload-support.patch
  11125. +++ /dev/null
  11126. @@ -1,260 +0,0 @@
  11127. -From: Hante Meuleman <meuleman@broadcom.com>
  11128. -Date: Wed, 17 Feb 2016 11:27:03 +0100
  11129. -Subject: [PATCH] brcmfmac: add wowl gtk rekeying offload support
  11130. -
  11131. -This patch adds support for gtk rekeying offload and for gtk
  11132. -rekeying failure during wowl mode.
  11133. -
  11134. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  11135. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  11136. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11137. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  11138. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11139. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11140. ----
  11141. -
  11142. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  11143. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  11144. -@@ -3526,6 +3526,10 @@ static void brcmf_report_wowl_wakeind(st
  11145. - else
  11146. - wakeup_data.net_detect = cfg->wowl.nd_info;
  11147. - }
  11148. -+ if (wakeind & BRCMF_WOWL_GTK_FAILURE) {
  11149. -+ brcmf_dbg(INFO, "WOWL Wake indicator: BRCMF_WOWL_GTK_FAILURE\n");
  11150. -+ wakeup_data.gtk_rekey_failure = true;
  11151. -+ }
  11152. - } else {
  11153. - wakeup = NULL;
  11154. - }
  11155. -@@ -3607,6 +3611,8 @@ static void brcmf_configure_wowl(struct
  11156. - brcmf_fweh_register(cfg->pub, BRCMF_E_PFN_NET_FOUND,
  11157. - brcmf_wowl_nd_results);
  11158. - }
  11159. -+ if (wowl->gtk_rekey_failure)
  11160. -+ wowl_config |= BRCMF_WOWL_GTK_FAILURE;
  11161. - if (!test_bit(BRCMF_VIF_STATUS_CONNECTED, &ifp->vif->sme_state))
  11162. - wowl_config |= BRCMF_WOWL_UNASSOC;
  11163. -
  11164. -@@ -4874,7 +4880,32 @@ static int brcmf_cfg80211_tdls_oper(stru
  11165. - return ret;
  11166. - }
  11167. -
  11168. --static struct cfg80211_ops wl_cfg80211_ops = {
  11169. -+#ifdef CONFIG_PM
  11170. -+static int
  11171. -+brcmf_cfg80211_set_rekey_data(struct wiphy *wiphy, struct net_device *ndev,
  11172. -+ struct cfg80211_gtk_rekey_data *gtk)
  11173. -+{
  11174. -+ struct brcmf_if *ifp = netdev_priv(ndev);
  11175. -+ struct brcmf_gtk_keyinfo_le gtk_le;
  11176. -+ int ret;
  11177. -+
  11178. -+ brcmf_dbg(TRACE, "Enter, bssidx=%d\n", ifp->bsscfgidx);
  11179. -+
  11180. -+ memcpy(gtk_le.kck, gtk->kck, sizeof(gtk_le.kck));
  11181. -+ memcpy(gtk_le.kek, gtk->kek, sizeof(gtk_le.kek));
  11182. -+ memcpy(gtk_le.replay_counter, gtk->replay_ctr,
  11183. -+ sizeof(gtk_le.replay_counter));
  11184. -+
  11185. -+ ret = brcmf_fil_iovar_data_set(ifp, "gtk_key_info", &gtk_le,
  11186. -+ sizeof(gtk_le));
  11187. -+ if (ret < 0)
  11188. -+ brcmf_err("gtk_key_info iovar failed: ret=%d\n", ret);
  11189. -+
  11190. -+ return ret;
  11191. -+}
  11192. -+#endif
  11193. -+
  11194. -+static struct cfg80211_ops brcmf_cfg80211_ops = {
  11195. - .add_virtual_intf = brcmf_cfg80211_add_iface,
  11196. - .del_virtual_intf = brcmf_cfg80211_del_iface,
  11197. - .change_virtual_intf = brcmf_cfg80211_change_iface,
  11198. -@@ -6139,19 +6170,18 @@ static void brcmf_wiphy_wowl_params(stru
  11199. - {
  11200. - #ifdef CONFIG_PM
  11201. - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
  11202. -- s32 err;
  11203. -- u32 wowl_cap;
  11204. -
  11205. - if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_PNO)) {
  11206. -- err = brcmf_fil_iovar_int_get(ifp, "wowl_cap", &wowl_cap);
  11207. -- if (!err) {
  11208. -- if (wowl_cap & BRCMF_WOWL_PFN_FOUND) {
  11209. -- brcmf_wowlan_support.flags |=
  11210. -- WIPHY_WOWLAN_NET_DETECT;
  11211. -- init_waitqueue_head(&cfg->wowl.nd_data_wait);
  11212. -- }
  11213. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL_ND)) {
  11214. -+ brcmf_wowlan_support.flags |= WIPHY_WOWLAN_NET_DETECT;
  11215. -+ init_waitqueue_head(&cfg->wowl.nd_data_wait);
  11216. - }
  11217. - }
  11218. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL_GTK)) {
  11219. -+ brcmf_wowlan_support.flags |= WIPHY_WOWLAN_SUPPORTS_GTK_REKEY;
  11220. -+ brcmf_wowlan_support.flags |= WIPHY_WOWLAN_GTK_REKEY_FAILURE;
  11221. -+ }
  11222. -+
  11223. - wiphy->wowlan = &brcmf_wowlan_support;
  11224. - #endif
  11225. - }
  11226. -@@ -6538,6 +6568,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  11227. - struct net_device *ndev = brcmf_get_ifp(drvr, 0)->ndev;
  11228. - struct brcmf_cfg80211_info *cfg;
  11229. - struct wiphy *wiphy;
  11230. -+ struct cfg80211_ops *ops;
  11231. - struct brcmf_cfg80211_vif *vif;
  11232. - struct brcmf_if *ifp;
  11233. - s32 err = 0;
  11234. -@@ -6549,8 +6580,17 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  11235. - return NULL;
  11236. - }
  11237. -
  11238. -+ ops = kzalloc(sizeof(*ops), GFP_KERNEL);
  11239. -+ if (!ops)
  11240. -+ return NULL;
  11241. -+
  11242. -+ memcpy(ops, &brcmf_cfg80211_ops, sizeof(*ops));
  11243. - ifp = netdev_priv(ndev);
  11244. -- wiphy = wiphy_new(&wl_cfg80211_ops, sizeof(struct brcmf_cfg80211_info));
  11245. -+#ifdef CONFIG_PM
  11246. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL_GTK))
  11247. -+ ops->set_rekey_data = brcmf_cfg80211_set_rekey_data;
  11248. -+#endif
  11249. -+ wiphy = wiphy_new(ops, sizeof(struct brcmf_cfg80211_info));
  11250. - if (!wiphy) {
  11251. - brcmf_err("Could not allocate wiphy device\n");
  11252. - return NULL;
  11253. -@@ -6560,6 +6600,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  11254. -
  11255. - cfg = wiphy_priv(wiphy);
  11256. - cfg->wiphy = wiphy;
  11257. -+ cfg->ops = ops;
  11258. - cfg->pub = drvr;
  11259. - init_vif_event(&cfg->vif_event);
  11260. - INIT_LIST_HEAD(&cfg->vif_list);
  11261. -@@ -6686,6 +6727,7 @@ priv_out:
  11262. - ifp->vif = NULL;
  11263. - wiphy_out:
  11264. - brcmf_free_wiphy(wiphy);
  11265. -+ kfree(ops);
  11266. - return NULL;
  11267. - }
  11268. -
  11269. -@@ -6696,6 +6738,7 @@ void brcmf_cfg80211_detach(struct brcmf_
  11270. -
  11271. - brcmf_btcoex_detach(cfg);
  11272. - wiphy_unregister(cfg->wiphy);
  11273. -+ kfree(cfg->ops);
  11274. - wl_deinit_priv(cfg);
  11275. - brcmf_free_wiphy(cfg->wiphy);
  11276. - }
  11277. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  11278. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  11279. -@@ -256,6 +256,7 @@ struct brcmf_cfg80211_wowl {
  11280. - * struct brcmf_cfg80211_info - dongle private data of cfg80211 interface
  11281. - *
  11282. - * @wiphy: wiphy object for cfg80211 interface.
  11283. -+ * @ops: pointer to copy of ops as registered with wiphy object.
  11284. - * @conf: dongle configuration.
  11285. - * @p2p: peer-to-peer specific information.
  11286. - * @btcoex: Bluetooth coexistence information.
  11287. -@@ -288,6 +289,7 @@ struct brcmf_cfg80211_wowl {
  11288. - */
  11289. - struct brcmf_cfg80211_info {
  11290. - struct wiphy *wiphy;
  11291. -+ struct cfg80211_ops *ops;
  11292. - struct brcmf_cfg80211_conf *conf;
  11293. - struct brcmf_p2p_info p2p;
  11294. - struct brcmf_btcoex_info *btcoex;
  11295. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
  11296. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
  11297. -@@ -136,6 +136,7 @@ void brcmf_feat_attach(struct brcmf_pub
  11298. - {
  11299. - struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
  11300. - struct brcmf_pno_macaddr_le pfn_mac;
  11301. -+ u32 wowl_cap;
  11302. - s32 err;
  11303. -
  11304. - brcmf_feat_firmware_capabilities(ifp);
  11305. -@@ -143,6 +144,17 @@ void brcmf_feat_attach(struct brcmf_pub
  11306. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_PNO, "pfn");
  11307. - if (drvr->bus_if->wowl_supported)
  11308. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_WOWL, "wowl");
  11309. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL)) {
  11310. -+ err = brcmf_fil_iovar_int_get(ifp, "wowl_cap", &wowl_cap);
  11311. -+ if (!err) {
  11312. -+ if (wowl_cap & BRCMF_WOWL_PFN_FOUND)
  11313. -+ ifp->drvr->feat_flags |=
  11314. -+ BIT(BRCMF_FEAT_WOWL_ND);
  11315. -+ if (wowl_cap & BRCMF_WOWL_GTK_FAILURE)
  11316. -+ ifp->drvr->feat_flags |=
  11317. -+ BIT(BRCMF_FEAT_WOWL_GTK);
  11318. -+ }
  11319. -+ }
  11320. - /* MBSS does not work for 43362 */
  11321. - if (drvr->bus_if->chip == BRCM_CC_43362_CHIP_ID)
  11322. - ifp->drvr->feat_flags &= ~BIT(BRCMF_FEAT_MBSS);
  11323. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h
  11324. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h
  11325. -@@ -27,6 +27,8 @@
  11326. - * RSDB: Real Simultaneous Dual Band
  11327. - * TDLS: Tunneled Direct Link Setup
  11328. - * SCAN_RANDOM_MAC: Random MAC during (net detect) scheduled scan.
  11329. -+ * WOWL_ND: WOWL net detect (PNO)
  11330. -+ * WOWL_GTK: (WOWL) GTK rekeying offload
  11331. - */
  11332. - #define BRCMF_FEAT_LIST \
  11333. - BRCMF_FEAT_DEF(MBSS) \
  11334. -@@ -36,7 +38,9 @@
  11335. - BRCMF_FEAT_DEF(P2P) \
  11336. - BRCMF_FEAT_DEF(RSDB) \
  11337. - BRCMF_FEAT_DEF(TDLS) \
  11338. -- BRCMF_FEAT_DEF(SCAN_RANDOM_MAC)
  11339. -+ BRCMF_FEAT_DEF(SCAN_RANDOM_MAC) \
  11340. -+ BRCMF_FEAT_DEF(WOWL_ND) \
  11341. -+ BRCMF_FEAT_DEF(WOWL_GTK)
  11342. -
  11343. - /*
  11344. - * Quirks:
  11345. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h
  11346. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h
  11347. -@@ -111,7 +111,9 @@
  11348. - /* Wakeup if received matched secured pattern: */
  11349. - #define BRCMF_WOWL_SECURE (1 << 25)
  11350. - /* Wakeup on finding preferred network */
  11351. --#define BRCMF_WOWL_PFN_FOUND (1 << 26)
  11352. -+#define BRCMF_WOWL_PFN_FOUND (1 << 27)
  11353. -+/* Wakeup on receiving pairwise key EAP packets: */
  11354. -+#define WIPHY_WOWL_EAP_PK (1 << 28)
  11355. - /* Link Down indication in WoWL mode: */
  11356. - #define BRCMF_WOWL_LINKDOWN (1 << 31)
  11357. -
  11358. -@@ -136,6 +138,10 @@
  11359. -
  11360. - #define BRCMF_MCSSET_LEN 16
  11361. -
  11362. -+#define BRCMF_RSN_KCK_LENGTH 16
  11363. -+#define BRCMF_RSN_KEK_LENGTH 16
  11364. -+#define BRCMF_RSN_REPLAY_LEN 8
  11365. -+
  11366. - /* join preference types for join_pref iovar */
  11367. - enum brcmf_join_pref_types {
  11368. - BRCMF_JOIN_PREF_RSSI = 1,
  11369. -@@ -789,4 +795,17 @@ struct brcmf_pktcnt_le {
  11370. - __le32 rx_ocast_good_pkt;
  11371. - };
  11372. -
  11373. -+/**
  11374. -+ * struct brcmf_gtk_keyinfo_le - GTP rekey data
  11375. -+ *
  11376. -+ * @kck: key confirmation key.
  11377. -+ * @kek: key encryption key.
  11378. -+ * @replay_counter: replay counter.
  11379. -+ */
  11380. -+struct brcmf_gtk_keyinfo_le {
  11381. -+ u8 kck[BRCMF_RSN_KCK_LENGTH];
  11382. -+ u8 kek[BRCMF_RSN_KEK_LENGTH];
  11383. -+ u8 replay_counter[BRCMF_RSN_REPLAY_LEN];
  11384. -+};
  11385. -+
  11386. - #endif /* FWIL_TYPES_H_ */
  11387. diff --git a/package/kernel/mac80211/patches/344-0015-brcmfmac-move-platform-data-retrieval-code-to-common.patch b/package/kernel/mac80211/patches/344-0015-brcmfmac-move-platform-data-retrieval-code-to-common.patch
  11388. deleted file mode 100644
  11389. index 2685238..0000000
  11390. --- a/package/kernel/mac80211/patches/344-0015-brcmfmac-move-platform-data-retrieval-code-to-common.patch
  11391. +++ /dev/null
  11392. @@ -1,385 +0,0 @@
  11393. -From: Hante Meuleman <meuleman@broadcom.com>
  11394. -Date: Wed, 17 Feb 2016 11:27:04 +0100
  11395. -Subject: [PATCH] brcmfmac: move platform data retrieval code to common
  11396. -
  11397. -In preparation of module parameters for all devices the module
  11398. -platform data retrieval is moved from sdio to common. It is still
  11399. -only used for sdio devices.
  11400. -
  11401. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  11402. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  11403. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11404. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  11405. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11406. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11407. ----
  11408. -
  11409. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  11410. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  11411. -@@ -27,8 +27,6 @@
  11412. - #include <linux/mmc/sdio_func.h>
  11413. - #include <linux/mmc/card.h>
  11414. - #include <linux/mmc/host.h>
  11415. --#include <linux/platform_device.h>
  11416. --#include <linux/platform_data/brcmfmac-sdio.h>
  11417. - #include <linux/pm_runtime.h>
  11418. - #include <linux/suspend.h>
  11419. - #include <linux/errno.h>
  11420. -@@ -46,7 +44,6 @@
  11421. - #include "bus.h"
  11422. - #include "debug.h"
  11423. - #include "sdio.h"
  11424. --#include "of.h"
  11425. - #include "core.h"
  11426. - #include "common.h"
  11427. -
  11428. -@@ -106,18 +103,18 @@ static void brcmf_sdiod_dummy_irqhandler
  11429. -
  11430. - int brcmf_sdiod_intr_register(struct brcmf_sdio_dev *sdiodev)
  11431. - {
  11432. -+ struct brcmfmac_sdio_platform_data *pdata;
  11433. - int ret = 0;
  11434. - u8 data;
  11435. - u32 addr, gpiocontrol;
  11436. - unsigned long flags;
  11437. -
  11438. -- if ((sdiodev->pdata) && (sdiodev->pdata->oob_irq_supported)) {
  11439. -+ pdata = sdiodev->pdata;
  11440. -+ if ((pdata) && (pdata->oob_irq_supported)) {
  11441. - brcmf_dbg(SDIO, "Enter, register OOB IRQ %d\n",
  11442. -- sdiodev->pdata->oob_irq_nr);
  11443. -- ret = request_irq(sdiodev->pdata->oob_irq_nr,
  11444. -- brcmf_sdiod_oob_irqhandler,
  11445. -- sdiodev->pdata->oob_irq_flags,
  11446. -- "brcmf_oob_intr",
  11447. -+ pdata->oob_irq_nr);
  11448. -+ ret = request_irq(pdata->oob_irq_nr, brcmf_sdiod_oob_irqhandler,
  11449. -+ pdata->oob_irq_flags, "brcmf_oob_intr",
  11450. - &sdiodev->func[1]->dev);
  11451. - if (ret != 0) {
  11452. - brcmf_err("request_irq failed %d\n", ret);
  11453. -@@ -129,7 +126,7 @@ int brcmf_sdiod_intr_register(struct brc
  11454. - sdiodev->irq_en = true;
  11455. - spin_unlock_irqrestore(&sdiodev->irq_en_lock, flags);
  11456. -
  11457. -- ret = enable_irq_wake(sdiodev->pdata->oob_irq_nr);
  11458. -+ ret = enable_irq_wake(pdata->oob_irq_nr);
  11459. - if (ret != 0) {
  11460. - brcmf_err("enable_irq_wake failed %d\n", ret);
  11461. - return ret;
  11462. -@@ -158,7 +155,7 @@ int brcmf_sdiod_intr_register(struct brc
  11463. -
  11464. - /* redirect, configure and enable io for interrupt signal */
  11465. - data = SDIO_SEPINT_MASK | SDIO_SEPINT_OE;
  11466. -- if (sdiodev->pdata->oob_irq_flags & IRQF_TRIGGER_HIGH)
  11467. -+ if (pdata->oob_irq_flags & IRQF_TRIGGER_HIGH)
  11468. - data |= SDIO_SEPINT_ACT_HI;
  11469. - brcmf_sdiod_regwb(sdiodev, SDIO_CCCR_BRCM_SEPINT, data, &ret);
  11470. -
  11471. -@@ -176,9 +173,12 @@ int brcmf_sdiod_intr_register(struct brc
  11472. -
  11473. - int brcmf_sdiod_intr_unregister(struct brcmf_sdio_dev *sdiodev)
  11474. - {
  11475. -+ struct brcmfmac_sdio_platform_data *pdata;
  11476. -+
  11477. - brcmf_dbg(SDIO, "Entering\n");
  11478. -
  11479. -- if ((sdiodev->pdata) && (sdiodev->pdata->oob_irq_supported)) {
  11480. -+ pdata = sdiodev->pdata;
  11481. -+ if ((pdata) && (pdata->oob_irq_supported)) {
  11482. - sdio_claim_host(sdiodev->func[1]);
  11483. - brcmf_sdiod_regwb(sdiodev, SDIO_CCCR_BRCM_SEPINT, 0, NULL);
  11484. - brcmf_sdiod_regwb(sdiodev, SDIO_CCCR_IENx, 0, NULL);
  11485. -@@ -187,11 +187,10 @@ int brcmf_sdiod_intr_unregister(struct b
  11486. - if (sdiodev->oob_irq_requested) {
  11487. - sdiodev->oob_irq_requested = false;
  11488. - if (sdiodev->irq_wake) {
  11489. -- disable_irq_wake(sdiodev->pdata->oob_irq_nr);
  11490. -+ disable_irq_wake(pdata->oob_irq_nr);
  11491. - sdiodev->irq_wake = false;
  11492. - }
  11493. -- free_irq(sdiodev->pdata->oob_irq_nr,
  11494. -- &sdiodev->func[1]->dev);
  11495. -+ free_irq(pdata->oob_irq_nr, &sdiodev->func[1]->dev);
  11496. - sdiodev->irq_en = false;
  11497. - }
  11498. - } else {
  11499. -@@ -1103,8 +1102,6 @@ static const struct sdio_device_id brcmf
  11500. - };
  11501. - MODULE_DEVICE_TABLE(sdio, brcmf_sdmmc_ids);
  11502. -
  11503. --static struct brcmfmac_sdio_platform_data *brcmfmac_sdio_pdata;
  11504. --
  11505. -
  11506. - static void brcmf_sdiod_acpi_set_power_manageable(struct device *dev,
  11507. - int val)
  11508. -@@ -1167,10 +1164,7 @@ static int brcmf_ops_sdio_probe(struct s
  11509. - dev_set_drvdata(&func->dev, bus_if);
  11510. - dev_set_drvdata(&sdiodev->func[1]->dev, bus_if);
  11511. - sdiodev->dev = &sdiodev->func[1]->dev;
  11512. -- sdiodev->pdata = brcmfmac_sdio_pdata;
  11513. --
  11514. -- if (!sdiodev->pdata)
  11515. -- brcmf_of_probe(sdiodev);
  11516. -+ sdiodev->pdata = brcmf_get_module_param(sdiodev->dev);
  11517. -
  11518. - #ifdef CONFIG_PM_SLEEP
  11519. - /* wowl can be supported when KEEP_POWER is true and (WAKE_SDIO_IRQ
  11520. -@@ -1296,7 +1290,7 @@ static const struct dev_pm_ops brcmf_sdi
  11521. - static struct sdio_driver brcmf_sdmmc_driver = {
  11522. - .probe = brcmf_ops_sdio_probe,
  11523. - .remove = brcmf_ops_sdio_remove,
  11524. -- .name = BRCMFMAC_SDIO_PDATA_NAME,
  11525. -+ .name = KBUILD_MODNAME,
  11526. - .id_table = brcmf_sdmmc_ids,
  11527. - .drv = {
  11528. - .owner = THIS_MODULE,
  11529. -@@ -1306,37 +1300,6 @@ static struct sdio_driver brcmf_sdmmc_dr
  11530. - },
  11531. - };
  11532. -
  11533. --static int __init brcmf_sdio_pd_probe(struct platform_device *pdev)
  11534. --{
  11535. -- brcmf_dbg(SDIO, "Enter\n");
  11536. --
  11537. -- brcmfmac_sdio_pdata = dev_get_platdata(&pdev->dev);
  11538. --
  11539. -- if (brcmfmac_sdio_pdata->power_on)
  11540. -- brcmfmac_sdio_pdata->power_on();
  11541. --
  11542. -- return 0;
  11543. --}
  11544. --
  11545. --static int brcmf_sdio_pd_remove(struct platform_device *pdev)
  11546. --{
  11547. -- brcmf_dbg(SDIO, "Enter\n");
  11548. --
  11549. -- if (brcmfmac_sdio_pdata->power_off)
  11550. -- brcmfmac_sdio_pdata->power_off();
  11551. --
  11552. -- sdio_unregister_driver(&brcmf_sdmmc_driver);
  11553. --
  11554. -- return 0;
  11555. --}
  11556. --
  11557. --static struct platform_driver brcmf_sdio_pd = {
  11558. -- .remove = brcmf_sdio_pd_remove,
  11559. -- .driver = {
  11560. -- .name = BRCMFMAC_SDIO_PDATA_NAME,
  11561. -- }
  11562. --};
  11563. --
  11564. - void brcmf_sdio_register(void)
  11565. - {
  11566. - int ret;
  11567. -@@ -1350,19 +1313,6 @@ void brcmf_sdio_exit(void)
  11568. - {
  11569. - brcmf_dbg(SDIO, "Enter\n");
  11570. -
  11571. -- if (brcmfmac_sdio_pdata)
  11572. -- platform_driver_unregister(&brcmf_sdio_pd);
  11573. -- else
  11574. -- sdio_unregister_driver(&brcmf_sdmmc_driver);
  11575. -+ sdio_unregister_driver(&brcmf_sdmmc_driver);
  11576. - }
  11577. -
  11578. --void __init brcmf_sdio_init(void)
  11579. --{
  11580. -- int ret;
  11581. --
  11582. -- brcmf_dbg(SDIO, "Enter\n");
  11583. --
  11584. -- ret = platform_driver_probe(&brcmf_sdio_pd, brcmf_sdio_pd_probe);
  11585. -- if (ret == -ENODEV)
  11586. -- brcmf_dbg(SDIO, "No platform data available.\n");
  11587. --}
  11588. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  11589. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  11590. -@@ -27,6 +27,7 @@
  11591. - #include "fwil_types.h"
  11592. - #include "tracepoint.h"
  11593. - #include "common.h"
  11594. -+#include "of.h"
  11595. -
  11596. - MODULE_AUTHOR("Broadcom Corporation");
  11597. - MODULE_DESCRIPTION("Broadcom 802.11 wireless LAN fullmac driver.");
  11598. -@@ -79,6 +80,7 @@ module_param_named(ignore_probe_fail, br
  11599. - MODULE_PARM_DESC(ignore_probe_fail, "always succeed probe for debugging");
  11600. - #endif
  11601. -
  11602. -+static struct brcmfmac_sdio_platform_data *brcmfmac_pdata;
  11603. - struct brcmf_mp_global_t brcmf_mp_global;
  11604. -
  11605. - int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
  11606. -@@ -231,6 +233,13 @@ static void brcmf_mp_attach(void)
  11607. - BRCMF_FW_ALTPATH_LEN);
  11608. - }
  11609. -
  11610. -+struct brcmfmac_sdio_platform_data *brcmf_get_module_param(struct device *dev)
  11611. -+{
  11612. -+ if (!brcmfmac_pdata)
  11613. -+ brcmf_of_probe(dev, &brcmfmac_pdata);
  11614. -+ return brcmfmac_pdata;
  11615. -+}
  11616. -+
  11617. - int brcmf_mp_device_attach(struct brcmf_pub *drvr)
  11618. - {
  11619. - drvr->settings = kzalloc(sizeof(*drvr->settings), GFP_ATOMIC);
  11620. -@@ -253,6 +262,35 @@ void brcmf_mp_device_detach(struct brcmf
  11621. - kfree(drvr->settings);
  11622. - }
  11623. -
  11624. -+static int __init brcmf_common_pd_probe(struct platform_device *pdev)
  11625. -+{
  11626. -+ brcmf_dbg(INFO, "Enter\n");
  11627. -+
  11628. -+ brcmfmac_pdata = dev_get_platdata(&pdev->dev);
  11629. -+
  11630. -+ if (brcmfmac_pdata->power_on)
  11631. -+ brcmfmac_pdata->power_on();
  11632. -+
  11633. -+ return 0;
  11634. -+}
  11635. -+
  11636. -+static int brcmf_common_pd_remove(struct platform_device *pdev)
  11637. -+{
  11638. -+ brcmf_dbg(INFO, "Enter\n");
  11639. -+
  11640. -+ if (brcmfmac_pdata->power_off)
  11641. -+ brcmfmac_pdata->power_off();
  11642. -+
  11643. -+ return 0;
  11644. -+}
  11645. -+
  11646. -+static struct platform_driver brcmf_pd = {
  11647. -+ .remove = brcmf_common_pd_remove,
  11648. -+ .driver = {
  11649. -+ .name = BRCMFMAC_SDIO_PDATA_NAME,
  11650. -+ }
  11651. -+};
  11652. -+
  11653. - static int __init brcmfmac_module_init(void)
  11654. - {
  11655. - int err;
  11656. -@@ -260,16 +298,21 @@ static int __init brcmfmac_module_init(v
  11657. - /* Initialize debug system first */
  11658. - brcmf_debugfs_init();
  11659. -
  11660. --#ifdef CPTCFG_BRCMFMAC_SDIO
  11661. -- brcmf_sdio_init();
  11662. --#endif
  11663. -+ /* Get the platform data (if available) for our devices */
  11664. -+ err = platform_driver_probe(&brcmf_pd, brcmf_common_pd_probe);
  11665. -+ if (err == -ENODEV)
  11666. -+ brcmf_dbg(INFO, "No platform data available.\n");
  11667. -+
  11668. - /* Initialize global module paramaters */
  11669. - brcmf_mp_attach();
  11670. -
  11671. - /* Continue the initialization by registering the different busses */
  11672. - err = brcmf_core_init();
  11673. -- if (err)
  11674. -+ if (err) {
  11675. - brcmf_debugfs_exit();
  11676. -+ if (brcmfmac_pdata)
  11677. -+ platform_driver_unregister(&brcmf_pd);
  11678. -+ }
  11679. -
  11680. - return err;
  11681. - }
  11682. -@@ -277,6 +320,8 @@ static int __init brcmfmac_module_init(v
  11683. - static void __exit brcmfmac_module_exit(void)
  11684. - {
  11685. - brcmf_core_exit();
  11686. -+ if (brcmfmac_pdata)
  11687. -+ platform_driver_unregister(&brcmf_pd);
  11688. - brcmf_debugfs_exit();
  11689. - }
  11690. -
  11691. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
  11692. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
  11693. -@@ -15,6 +15,8 @@
  11694. - #ifndef BRCMFMAC_COMMON_H
  11695. - #define BRCMFMAC_COMMON_H
  11696. -
  11697. -+#include <linux/platform_device.h>
  11698. -+#include <linux/platform_data/brcmfmac-sdio.h>
  11699. - #include "fwil_types.h"
  11700. -
  11701. - extern const u8 ALLFFMAC[ETH_ALEN];
  11702. -@@ -89,6 +91,7 @@ struct brcmf_mp_device {
  11703. - struct cc_translate *country_codes;
  11704. - };
  11705. -
  11706. -+struct brcmfmac_sdio_platform_data *brcmf_get_module_param(struct device *dev);
  11707. - int brcmf_mp_device_attach(struct brcmf_pub *drvr);
  11708. - void brcmf_mp_device_detach(struct brcmf_pub *drvr);
  11709. - #ifdef DEBUG
  11710. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
  11711. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
  11712. -@@ -16,17 +16,16 @@
  11713. - #include <linux/init.h>
  11714. - #include <linux/of.h>
  11715. - #include <linux/of_irq.h>
  11716. --#include <linux/mmc/card.h>
  11717. --#include <linux/platform_data/brcmfmac-sdio.h>
  11718. --#include <linux/mmc/sdio_func.h>
  11719. -
  11720. - #include <defs.h>
  11721. - #include "debug.h"
  11722. --#include "sdio.h"
  11723. -+#include "core.h"
  11724. -+#include "common.h"
  11725. -+#include "of.h"
  11726. -
  11727. --void brcmf_of_probe(struct brcmf_sdio_dev *sdiodev)
  11728. -+void
  11729. -+brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_platform_data **sdio)
  11730. - {
  11731. -- struct device *dev = sdiodev->dev;
  11732. - struct device_node *np = dev->of_node;
  11733. - int irq;
  11734. - u32 irqf;
  11735. -@@ -35,12 +34,12 @@ void brcmf_of_probe(struct brcmf_sdio_de
  11736. - if (!np || !of_device_is_compatible(np, "brcm,bcm4329-fmac"))
  11737. - return;
  11738. -
  11739. -- sdiodev->pdata = devm_kzalloc(dev, sizeof(*sdiodev->pdata), GFP_KERNEL);
  11740. -- if (!sdiodev->pdata)
  11741. -+ *sdio = devm_kzalloc(dev, sizeof(*sdio), GFP_KERNEL);
  11742. -+ if (!(*sdio))
  11743. - return;
  11744. -
  11745. - if (of_property_read_u32(np, "brcm,drive-strength", &val) == 0)
  11746. -- sdiodev->pdata->drive_strength = val;
  11747. -+ (*sdio)->drive_strength = val;
  11748. -
  11749. - /* make sure there are interrupts defined in the node */
  11750. - if (!of_find_property(np, "interrupts", NULL))
  11751. -@@ -53,7 +52,7 @@ void brcmf_of_probe(struct brcmf_sdio_de
  11752. - }
  11753. - irqf = irqd_get_trigger_type(irq_get_irq_data(irq));
  11754. -
  11755. -- sdiodev->pdata->oob_irq_supported = true;
  11756. -- sdiodev->pdata->oob_irq_nr = irq;
  11757. -- sdiodev->pdata->oob_irq_flags = irqf;
  11758. -+ (*sdio)->oob_irq_supported = true;
  11759. -+ (*sdio)->oob_irq_nr = irq;
  11760. -+ (*sdio)->oob_irq_flags = irqf;
  11761. - }
  11762. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.h
  11763. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.h
  11764. -@@ -14,9 +14,11 @@
  11765. - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  11766. - */
  11767. - #ifdef CONFIG_OF
  11768. --void brcmf_of_probe(struct brcmf_sdio_dev *sdiodev);
  11769. -+void
  11770. -+brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_platform_data **sdio);
  11771. - #else
  11772. --static void brcmf_of_probe(struct brcmf_sdio_dev *sdiodev)
  11773. -+static void brcmf_of_probe(struct device *dev,
  11774. -+ struct brcmfmac_sdio_platform_data **sdio)
  11775. - {
  11776. - }
  11777. - #endif /* CONFIG_OF */
  11778. diff --git a/package/kernel/mac80211/patches/344-0016-brcmfmac-keep-ARP-and-ND-offload-enabled-during-WOWL.patch b/package/kernel/mac80211/patches/344-0016-brcmfmac-keep-ARP-and-ND-offload-enabled-during-WOWL.patch
  11779. deleted file mode 100644
  11780. index 4e789cf..0000000
  11781. --- a/package/kernel/mac80211/patches/344-0016-brcmfmac-keep-ARP-and-ND-offload-enabled-during-WOWL.patch
  11782. +++ /dev/null
  11783. @@ -1,69 +0,0 @@
  11784. -From: Hante Meuleman <meuleman@broadcom.com>
  11785. -Date: Wed, 17 Feb 2016 11:27:05 +0100
  11786. -Subject: [PATCH] brcmfmac: keep ARP and ND offload enabled during WOWL
  11787. -
  11788. -Currently ARP and ND (IPv6 Neigbor Discovery) offload get disabled
  11789. -on entering suspend. However when firmwares support the wowl_cap
  11790. -iovar then these offload routines can be kept enabled as they
  11791. -will work during WOWL as well.
  11792. -
  11793. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  11794. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  11795. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11796. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  11797. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11798. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11799. ----
  11800. -
  11801. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  11802. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  11803. -@@ -3556,7 +3556,8 @@ static s32 brcmf_cfg80211_resume(struct
  11804. - brcmf_report_wowl_wakeind(wiphy, ifp);
  11805. - brcmf_fil_iovar_int_set(ifp, "wowl_clear", 0);
  11806. - brcmf_config_wowl_pattern(ifp, "clr", NULL, 0, NULL, 0);
  11807. -- brcmf_configure_arp_nd_offload(ifp, true);
  11808. -+ if (!brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL_ARP_ND))
  11809. -+ brcmf_configure_arp_nd_offload(ifp, true);
  11810. - brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM,
  11811. - cfg->wowl.pre_pmmode);
  11812. - cfg->wowl.active = false;
  11813. -@@ -3580,7 +3581,8 @@ static void brcmf_configure_wowl(struct
  11814. -
  11815. - brcmf_dbg(TRACE, "Suspend, wowl config.\n");
  11816. -
  11817. -- brcmf_configure_arp_nd_offload(ifp, false);
  11818. -+ if (!brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL_ARP_ND))
  11819. -+ brcmf_configure_arp_nd_offload(ifp, false);
  11820. - brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_PM, &cfg->wowl.pre_pmmode);
  11821. - brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM, PM_MAX);
  11822. -
  11823. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
  11824. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
  11825. -@@ -147,6 +147,7 @@ void brcmf_feat_attach(struct brcmf_pub
  11826. - if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL)) {
  11827. - err = brcmf_fil_iovar_int_get(ifp, "wowl_cap", &wowl_cap);
  11828. - if (!err) {
  11829. -+ ifp->drvr->feat_flags |= BIT(BRCMF_FEAT_WOWL_ARP_ND);
  11830. - if (wowl_cap & BRCMF_WOWL_PFN_FOUND)
  11831. - ifp->drvr->feat_flags |=
  11832. - BIT(BRCMF_FEAT_WOWL_ND);
  11833. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h
  11834. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h
  11835. -@@ -29,6 +29,7 @@
  11836. - * SCAN_RANDOM_MAC: Random MAC during (net detect) scheduled scan.
  11837. - * WOWL_ND: WOWL net detect (PNO)
  11838. - * WOWL_GTK: (WOWL) GTK rekeying offload
  11839. -+ * WOWL_ARP_ND: ARP and Neighbor Discovery offload support during WOWL.
  11840. - */
  11841. - #define BRCMF_FEAT_LIST \
  11842. - BRCMF_FEAT_DEF(MBSS) \
  11843. -@@ -40,7 +41,8 @@
  11844. - BRCMF_FEAT_DEF(TDLS) \
  11845. - BRCMF_FEAT_DEF(SCAN_RANDOM_MAC) \
  11846. - BRCMF_FEAT_DEF(WOWL_ND) \
  11847. -- BRCMF_FEAT_DEF(WOWL_GTK)
  11848. -+ BRCMF_FEAT_DEF(WOWL_GTK) \
  11849. -+ BRCMF_FEAT_DEF(WOWL_ARP_ND)
  11850. -
  11851. - /*
  11852. - * Quirks:
  11853. diff --git a/package/kernel/mac80211/patches/344-0017-brcmfmac-switch-to-new-platform-data.patch b/package/kernel/mac80211/patches/344-0017-brcmfmac-switch-to-new-platform-data.patch
  11854. deleted file mode 100644
  11855. index 37b6855..0000000
  11856. --- a/package/kernel/mac80211/patches/344-0017-brcmfmac-switch-to-new-platform-data.patch
  11857. +++ /dev/null
  11858. @@ -1,734 +0,0 @@
  11859. -From: Hante Meuleman <meuleman@broadcom.com>
  11860. -Date: Wed, 17 Feb 2016 11:27:07 +0100
  11861. -Subject: [PATCH] brcmfmac: switch to new platform data
  11862. -
  11863. -Platform data is only available for sdio. With this patch a new
  11864. -platform data structure is being used which allows for platform
  11865. -data for any device and configurable per device. This patch only
  11866. -switches to the new structure and adds support for SDIO devices.
  11867. -
  11868. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  11869. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  11870. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11871. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  11872. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11873. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11874. ----
  11875. -
  11876. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  11877. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  11878. -@@ -103,7 +103,7 @@ static void brcmf_sdiod_dummy_irqhandler
  11879. -
  11880. - int brcmf_sdiod_intr_register(struct brcmf_sdio_dev *sdiodev)
  11881. - {
  11882. -- struct brcmfmac_sdio_platform_data *pdata;
  11883. -+ struct brcmfmac_sdio_pd *pdata;
  11884. - int ret = 0;
  11885. - u8 data;
  11886. - u32 addr, gpiocontrol;
  11887. -@@ -173,7 +173,7 @@ int brcmf_sdiod_intr_register(struct brc
  11888. -
  11889. - int brcmf_sdiod_intr_unregister(struct brcmf_sdio_dev *sdiodev)
  11890. - {
  11891. -- struct brcmfmac_sdio_platform_data *pdata;
  11892. -+ struct brcmfmac_sdio_pd *pdata;
  11893. -
  11894. - brcmf_dbg(SDIO, "Entering\n");
  11895. -
  11896. -@@ -1164,17 +1164,6 @@ static int brcmf_ops_sdio_probe(struct s
  11897. - dev_set_drvdata(&func->dev, bus_if);
  11898. - dev_set_drvdata(&sdiodev->func[1]->dev, bus_if);
  11899. - sdiodev->dev = &sdiodev->func[1]->dev;
  11900. -- sdiodev->pdata = brcmf_get_module_param(sdiodev->dev);
  11901. --
  11902. --#ifdef CONFIG_PM_SLEEP
  11903. -- /* wowl can be supported when KEEP_POWER is true and (WAKE_SDIO_IRQ
  11904. -- * is true or when platform data OOB irq is true).
  11905. -- */
  11906. -- if ((sdio_get_host_pm_caps(sdiodev->func[1]) & MMC_PM_KEEP_POWER) &&
  11907. -- ((sdio_get_host_pm_caps(sdiodev->func[1]) & MMC_PM_WAKE_SDIO_IRQ) ||
  11908. -- (sdiodev->pdata && sdiodev->pdata->oob_irq_supported)))
  11909. -- bus_if->wowl_supported = true;
  11910. --#endif
  11911. -
  11912. - brcmf_sdiod_change_state(sdiodev, BRCMF_SDIOD_DOWN);
  11913. -
  11914. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  11915. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  11916. -@@ -6459,8 +6459,8 @@ int brcmf_cfg80211_wait_vif_event(struct
  11917. - static s32 brcmf_translate_country_code(struct brcmf_pub *drvr, char alpha2[2],
  11918. - struct brcmf_fil_country_le *ccreq)
  11919. - {
  11920. -- struct cc_translate *country_codes;
  11921. -- struct cc_entry *cc;
  11922. -+ struct brcmfmac_pd_cc *country_codes;
  11923. -+ struct brcmfmac_pd_cc_entry *cc;
  11924. - s32 found_index;
  11925. - int i;
  11926. -
  11927. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  11928. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  11929. -@@ -80,7 +80,7 @@ module_param_named(ignore_probe_fail, br
  11930. - MODULE_PARM_DESC(ignore_probe_fail, "always succeed probe for debugging");
  11931. - #endif
  11932. -
  11933. --static struct brcmfmac_sdio_platform_data *brcmfmac_pdata;
  11934. -+static struct brcmfmac_platform_data *brcmfmac_pdata;
  11935. - struct brcmf_mp_global_t brcmf_mp_global;
  11936. -
  11937. - int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
  11938. -@@ -229,15 +229,46 @@ void __brcmf_dbg(u32 level, const char *
  11939. -
  11940. - static void brcmf_mp_attach(void)
  11941. - {
  11942. -+ /* If module param firmware path is set then this will always be used,
  11943. -+ * if not set then if available use the platform data version. To make
  11944. -+ * sure it gets initialized at all, always copy the module param version
  11945. -+ */
  11946. - strlcpy(brcmf_mp_global.firmware_path, brcmf_firmware_path,
  11947. - BRCMF_FW_ALTPATH_LEN);
  11948. -+ if ((brcmfmac_pdata) && (brcmfmac_pdata->fw_alternative_path) &&
  11949. -+ (brcmf_mp_global.firmware_path[0] == '\0')) {
  11950. -+ strlcpy(brcmf_mp_global.firmware_path,
  11951. -+ brcmfmac_pdata->fw_alternative_path,
  11952. -+ BRCMF_FW_ALTPATH_LEN);
  11953. -+ }
  11954. - }
  11955. -
  11956. --struct brcmfmac_sdio_platform_data *brcmf_get_module_param(struct device *dev)
  11957. --{
  11958. -- if (!brcmfmac_pdata)
  11959. -- brcmf_of_probe(dev, &brcmfmac_pdata);
  11960. -- return brcmfmac_pdata;
  11961. -+struct brcmfmac_sdio_pd *brcmf_get_module_param(struct device *dev,
  11962. -+ enum brcmf_bus_type bus_type,
  11963. -+ u32 chip, u32 chiprev)
  11964. -+{
  11965. -+ struct brcmfmac_sdio_pd *pdata;
  11966. -+ struct brcmfmac_pd_device *device_pd;
  11967. -+ int i;
  11968. -+
  11969. -+ if (brcmfmac_pdata) {
  11970. -+ for (i = 0; i < brcmfmac_pdata->device_count; i++) {
  11971. -+ device_pd = &brcmfmac_pdata->devices[i];
  11972. -+ if ((device_pd->bus_type == bus_type) &&
  11973. -+ (device_pd->id == chip) &&
  11974. -+ ((device_pd->rev == chiprev) ||
  11975. -+ (device_pd->rev == -1))) {
  11976. -+ brcmf_dbg(INFO, "Platform data for device found\n");
  11977. -+ if (device_pd->bus_type == BRCMF_BUSTYPE_SDIO)
  11978. -+ return &device_pd->bus.sdio;
  11979. -+ break;
  11980. -+ }
  11981. -+ }
  11982. -+ }
  11983. -+ pdata = NULL;
  11984. -+ brcmf_of_probe(dev, &pdata);
  11985. -+
  11986. -+ return pdata;
  11987. - }
  11988. -
  11989. - int brcmf_mp_device_attach(struct brcmf_pub *drvr)
  11990. -@@ -287,7 +318,7 @@ static int brcmf_common_pd_remove(struct
  11991. - static struct platform_driver brcmf_pd = {
  11992. - .remove = brcmf_common_pd_remove,
  11993. - .driver = {
  11994. -- .name = BRCMFMAC_SDIO_PDATA_NAME,
  11995. -+ .name = BRCMFMAC_PDATA_NAME,
  11996. - }
  11997. - };
  11998. -
  11999. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
  12000. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
  12001. -@@ -16,7 +16,7 @@
  12002. - #define BRCMFMAC_COMMON_H
  12003. -
  12004. - #include <linux/platform_device.h>
  12005. --#include <linux/platform_data/brcmfmac-sdio.h>
  12006. -+#include <linux/platform_data/brcmfmac.h>
  12007. - #include "fwil_types.h"
  12008. -
  12009. - extern const u8 ALLFFMAC[ETH_ALEN];
  12010. -@@ -43,33 +43,6 @@ struct brcmf_mp_global_t {
  12011. - extern struct brcmf_mp_global_t brcmf_mp_global;
  12012. -
  12013. - /**
  12014. -- * struct cc_entry - Struct for translating user space country code (iso3166) to
  12015. -- * firmware country code and revision.
  12016. -- *
  12017. -- * @iso3166: iso3166 alpha 2 country code string.
  12018. -- * @cc: firmware country code string.
  12019. -- * @rev: firmware country code revision.
  12020. -- */
  12021. --struct cc_entry {
  12022. -- char iso3166[BRCMF_COUNTRY_BUF_SZ];
  12023. -- char cc[BRCMF_COUNTRY_BUF_SZ];
  12024. -- s32 rev;
  12025. --};
  12026. --
  12027. --/**
  12028. -- * struct cc_translate - Struct for translating country codes as set by user
  12029. -- * space to a country code and rev which can be used by
  12030. -- * firmware.
  12031. -- *
  12032. -- * @table_size: number of entries in table (> 0)
  12033. -- * @table: dynamic array of 1 or more elements with translation information.
  12034. -- */
  12035. --struct cc_translate {
  12036. -- int table_size;
  12037. -- struct cc_entry table[0];
  12038. --};
  12039. --
  12040. --/**
  12041. - * struct brcmf_mp_device - Device module paramaters.
  12042. - *
  12043. - * @sdiod_txglomsz: SDIO txglom size.
  12044. -@@ -88,10 +61,12 @@ struct brcmf_mp_device {
  12045. - int fcmode;
  12046. - bool roamoff;
  12047. - bool ignore_probe_fail;
  12048. -- struct cc_translate *country_codes;
  12049. -+ struct brcmfmac_pd_cc *country_codes;
  12050. - };
  12051. -
  12052. --struct brcmfmac_sdio_platform_data *brcmf_get_module_param(struct device *dev);
  12053. -+struct brcmfmac_sdio_pd *brcmf_get_module_param(struct device *dev,
  12054. -+ enum brcmf_bus_type bus_type,
  12055. -+ u32 chip, u32 chiprev);
  12056. - int brcmf_mp_device_attach(struct brcmf_pub *drvr);
  12057. - void brcmf_mp_device_detach(struct brcmf_pub *drvr);
  12058. - #ifdef DEBUG
  12059. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
  12060. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
  12061. -@@ -23,8 +23,7 @@
  12062. - #include "common.h"
  12063. - #include "of.h"
  12064. -
  12065. --void
  12066. --brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_platform_data **sdio)
  12067. -+void brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_pd **sdio)
  12068. - {
  12069. - struct device_node *np = dev->of_node;
  12070. - int irq;
  12071. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.h
  12072. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.h
  12073. -@@ -15,10 +15,9 @@
  12074. - */
  12075. - #ifdef CONFIG_OF
  12076. - void
  12077. --brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_platform_data **sdio);
  12078. -+brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_pd **sdio);
  12079. - #else
  12080. --static void brcmf_of_probe(struct device *dev,
  12081. -- struct brcmfmac_sdio_platform_data **sdio)
  12082. -+static void brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_pd **sdio)
  12083. - {
  12084. - }
  12085. - #endif /* CONFIG_OF */
  12086. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  12087. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  12088. -@@ -33,8 +33,6 @@
  12089. - #include <linux/bcma/bcma.h>
  12090. - #include <linux/debugfs.h>
  12091. - #include <linux/vmalloc.h>
  12092. --#include <linux/platform_data/brcmfmac-sdio.h>
  12093. --#include <linux/moduleparam.h>
  12094. - #include <asm/unaligned.h>
  12095. - #include <defs.h>
  12096. - #include <brcmu_wifi.h>
  12097. -@@ -44,6 +42,8 @@
  12098. - #include "sdio.h"
  12099. - #include "chip.h"
  12100. - #include "firmware.h"
  12101. -+#include "core.h"
  12102. -+#include "common.h"
  12103. -
  12104. - #define DCMD_RESP_TIMEOUT msecs_to_jiffies(2500)
  12105. - #define CTL_DONE_TIMEOUT msecs_to_jiffies(2500)
  12106. -@@ -3775,26 +3775,28 @@ static const struct brcmf_buscore_ops br
  12107. - static bool
  12108. - brcmf_sdio_probe_attach(struct brcmf_sdio *bus)
  12109. - {
  12110. -+ struct brcmf_sdio_dev *sdiodev;
  12111. - u8 clkctl = 0;
  12112. - int err = 0;
  12113. - int reg_addr;
  12114. - u32 reg_val;
  12115. - u32 drivestrength;
  12116. -
  12117. -- sdio_claim_host(bus->sdiodev->func[1]);
  12118. -+ sdiodev = bus->sdiodev;
  12119. -+ sdio_claim_host(sdiodev->func[1]);
  12120. -
  12121. - pr_debug("F1 signature read @0x18000000=0x%4x\n",
  12122. -- brcmf_sdiod_regrl(bus->sdiodev, SI_ENUM_BASE, NULL));
  12123. -+ brcmf_sdiod_regrl(sdiodev, SI_ENUM_BASE, NULL));
  12124. -
  12125. - /*
  12126. - * Force PLL off until brcmf_chip_attach()
  12127. - * programs PLL control regs
  12128. - */
  12129. -
  12130. -- brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR,
  12131. -+ brcmf_sdiod_regwb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR,
  12132. - BRCMF_INIT_CLKCTL1, &err);
  12133. - if (!err)
  12134. -- clkctl = brcmf_sdiod_regrb(bus->sdiodev,
  12135. -+ clkctl = brcmf_sdiod_regrb(sdiodev,
  12136. - SBSDIO_FUNC1_CHIPCLKCSR, &err);
  12137. -
  12138. - if (err || ((clkctl & ~SBSDIO_AVBITS) != BRCMF_INIT_CLKCTL1)) {
  12139. -@@ -3803,50 +3805,77 @@ brcmf_sdio_probe_attach(struct brcmf_sdi
  12140. - goto fail;
  12141. - }
  12142. -
  12143. -- bus->ci = brcmf_chip_attach(bus->sdiodev, &brcmf_sdio_buscore_ops);
  12144. -+ bus->ci = brcmf_chip_attach(sdiodev, &brcmf_sdio_buscore_ops);
  12145. - if (IS_ERR(bus->ci)) {
  12146. - brcmf_err("brcmf_chip_attach failed!\n");
  12147. - bus->ci = NULL;
  12148. - goto fail;
  12149. - }
  12150. -+ sdiodev->pdata = brcmf_get_module_param(sdiodev->dev,
  12151. -+ BRCMF_BUSTYPE_SDIO,
  12152. -+ bus->ci->chip,
  12153. -+ bus->ci->chiprev);
  12154. -+ /* platform specific configuration:
  12155. -+ * alignments must be at least 4 bytes for ADMA
  12156. -+ */
  12157. -+ bus->head_align = ALIGNMENT;
  12158. -+ bus->sgentry_align = ALIGNMENT;
  12159. -+ if (sdiodev->pdata) {
  12160. -+ if (sdiodev->pdata->sd_head_align > ALIGNMENT)
  12161. -+ bus->head_align = sdiodev->pdata->sd_head_align;
  12162. -+ if (sdiodev->pdata->sd_sgentry_align > ALIGNMENT)
  12163. -+ bus->sgentry_align = sdiodev->pdata->sd_sgentry_align;
  12164. -+ }
  12165. -+ /* allocate scatter-gather table. sg support
  12166. -+ * will be disabled upon allocation failure.
  12167. -+ */
  12168. -+ brcmf_sdiod_sgtable_alloc(sdiodev);
  12169. -+
  12170. -+#ifdef CONFIG_PM_SLEEP
  12171. -+ /* wowl can be supported when KEEP_POWER is true and (WAKE_SDIO_IRQ
  12172. -+ * is true or when platform data OOB irq is true).
  12173. -+ */
  12174. -+ if ((sdio_get_host_pm_caps(sdiodev->func[1]) & MMC_PM_KEEP_POWER) &&
  12175. -+ ((sdio_get_host_pm_caps(sdiodev->func[1]) & MMC_PM_WAKE_SDIO_IRQ) ||
  12176. -+ (sdiodev->pdata && sdiodev->pdata->oob_irq_supported)))
  12177. -+ sdiodev->bus_if->wowl_supported = true;
  12178. -+#endif
  12179. -
  12180. - if (brcmf_sdio_kso_init(bus)) {
  12181. - brcmf_err("error enabling KSO\n");
  12182. - goto fail;
  12183. - }
  12184. -
  12185. -- if ((bus->sdiodev->pdata) && (bus->sdiodev->pdata->drive_strength))
  12186. -- drivestrength = bus->sdiodev->pdata->drive_strength;
  12187. -+ if ((sdiodev->pdata) && (sdiodev->pdata->drive_strength))
  12188. -+ drivestrength = sdiodev->pdata->drive_strength;
  12189. - else
  12190. - drivestrength = DEFAULT_SDIO_DRIVE_STRENGTH;
  12191. -- brcmf_sdio_drivestrengthinit(bus->sdiodev, bus->ci, drivestrength);
  12192. -+ brcmf_sdio_drivestrengthinit(sdiodev, bus->ci, drivestrength);
  12193. -
  12194. - /* Set card control so an SDIO card reset does a WLAN backplane reset */
  12195. -- reg_val = brcmf_sdiod_regrb(bus->sdiodev,
  12196. -- SDIO_CCCR_BRCM_CARDCTRL, &err);
  12197. -+ reg_val = brcmf_sdiod_regrb(sdiodev, SDIO_CCCR_BRCM_CARDCTRL, &err);
  12198. - if (err)
  12199. - goto fail;
  12200. -
  12201. - reg_val |= SDIO_CCCR_BRCM_CARDCTRL_WLANRESET;
  12202. -
  12203. -- brcmf_sdiod_regwb(bus->sdiodev,
  12204. -- SDIO_CCCR_BRCM_CARDCTRL, reg_val, &err);
  12205. -+ brcmf_sdiod_regwb(sdiodev, SDIO_CCCR_BRCM_CARDCTRL, reg_val, &err);
  12206. - if (err)
  12207. - goto fail;
  12208. -
  12209. - /* set PMUControl so a backplane reset does PMU state reload */
  12210. - reg_addr = CORE_CC_REG(brcmf_chip_get_pmu(bus->ci)->base, pmucontrol);
  12211. -- reg_val = brcmf_sdiod_regrl(bus->sdiodev, reg_addr, &err);
  12212. -+ reg_val = brcmf_sdiod_regrl(sdiodev, reg_addr, &err);
  12213. - if (err)
  12214. - goto fail;
  12215. -
  12216. - reg_val |= (BCMA_CC_PMU_CTL_RES_RELOAD << BCMA_CC_PMU_CTL_RES_SHIFT);
  12217. -
  12218. -- brcmf_sdiod_regwl(bus->sdiodev, reg_addr, reg_val, &err);
  12219. -+ brcmf_sdiod_regwl(sdiodev, reg_addr, reg_val, &err);
  12220. - if (err)
  12221. - goto fail;
  12222. -
  12223. -- sdio_release_host(bus->sdiodev->func[1]);
  12224. -+ sdio_release_host(sdiodev->func[1]);
  12225. -
  12226. - brcmu_pktq_init(&bus->txq, (PRIOMASK + 1), TXQLEN);
  12227. -
  12228. -@@ -3867,7 +3896,7 @@ brcmf_sdio_probe_attach(struct brcmf_sdi
  12229. - return true;
  12230. -
  12231. - fail:
  12232. -- sdio_release_host(bus->sdiodev->func[1]);
  12233. -+ sdio_release_host(sdiodev->func[1]);
  12234. - return false;
  12235. - }
  12236. -
  12237. -@@ -4045,18 +4074,6 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
  12238. - bus->txminmax = BRCMF_TXMINMAX;
  12239. - bus->tx_seq = SDPCM_SEQ_WRAP - 1;
  12240. -
  12241. -- /* platform specific configuration:
  12242. -- * alignments must be at least 4 bytes for ADMA
  12243. -- */
  12244. -- bus->head_align = ALIGNMENT;
  12245. -- bus->sgentry_align = ALIGNMENT;
  12246. -- if (sdiodev->pdata) {
  12247. -- if (sdiodev->pdata->sd_head_align > ALIGNMENT)
  12248. -- bus->head_align = sdiodev->pdata->sd_head_align;
  12249. -- if (sdiodev->pdata->sd_sgentry_align > ALIGNMENT)
  12250. -- bus->sgentry_align = sdiodev->pdata->sd_sgentry_align;
  12251. -- }
  12252. --
  12253. - /* single-threaded workqueue */
  12254. - wq = alloc_ordered_workqueue("brcmf_wq/%s", WQ_MEM_RECLAIM,
  12255. - dev_name(&sdiodev->func[1]->dev));
  12256. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
  12257. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
  12258. -@@ -184,7 +184,7 @@ struct brcmf_sdio_dev {
  12259. - struct brcmf_sdio *bus;
  12260. - struct device *dev;
  12261. - struct brcmf_bus *bus_if;
  12262. -- struct brcmfmac_sdio_platform_data *pdata;
  12263. -+ struct brcmfmac_sdio_pd *pdata;
  12264. - bool oob_irq_requested;
  12265. - bool irq_en; /* irq enable flags */
  12266. - spinlock_t irq_en_lock;
  12267. ---- a/include/linux/platform_data/brcmfmac-sdio.h
  12268. -+++ /dev/null
  12269. -@@ -1,135 +0,0 @@
  12270. --/*
  12271. -- * Copyright (c) 2013 Broadcom Corporation
  12272. -- *
  12273. -- * Permission to use, copy, modify, and/or distribute this software for any
  12274. -- * purpose with or without fee is hereby granted, provided that the above
  12275. -- * copyright notice and this permission notice appear in all copies.
  12276. -- *
  12277. -- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  12278. -- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  12279. -- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
  12280. -- * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12281. -- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  12282. -- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  12283. -- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  12284. -- */
  12285. --
  12286. --#ifndef _LINUX_BRCMFMAC_PLATFORM_H
  12287. --#define _LINUX_BRCMFMAC_PLATFORM_H
  12288. --
  12289. --/*
  12290. -- * Platform specific driver functions and data. Through the platform specific
  12291. -- * device data functions can be provided to help the brcmfmac driver to
  12292. -- * operate with the device in combination with the used platform.
  12293. -- *
  12294. -- * Use the platform data in the following (similar) way:
  12295. -- *
  12296. -- *
  12297. --#include <brcmfmac_platform.h>
  12298. --
  12299. --
  12300. --static void brcmfmac_power_on(void)
  12301. --{
  12302. --}
  12303. --
  12304. --static void brcmfmac_power_off(void)
  12305. --{
  12306. --}
  12307. --
  12308. --static void brcmfmac_reset(void)
  12309. --{
  12310. --}
  12311. --
  12312. --static struct brcmfmac_sdio_platform_data brcmfmac_sdio_pdata = {
  12313. -- .power_on = brcmfmac_power_on,
  12314. -- .power_off = brcmfmac_power_off,
  12315. -- .reset = brcmfmac_reset
  12316. --};
  12317. --
  12318. --static struct platform_device brcmfmac_device = {
  12319. -- .name = BRCMFMAC_SDIO_PDATA_NAME,
  12320. -- .id = PLATFORM_DEVID_NONE,
  12321. -- .dev.platform_data = &brcmfmac_sdio_pdata
  12322. --};
  12323. --
  12324. --void __init brcmfmac_init_pdata(void)
  12325. --{
  12326. -- brcmfmac_sdio_pdata.oob_irq_supported = true;
  12327. -- brcmfmac_sdio_pdata.oob_irq_nr = gpio_to_irq(GPIO_BRCMF_SDIO_OOB);
  12328. -- brcmfmac_sdio_pdata.oob_irq_flags = IORESOURCE_IRQ |
  12329. -- IORESOURCE_IRQ_HIGHLEVEL;
  12330. -- platform_device_register(&brcmfmac_device);
  12331. --}
  12332. -- *
  12333. -- *
  12334. -- * Note: the brcmfmac can be loaded as module or be statically built-in into
  12335. -- * the kernel. If built-in then do note that it uses module_init (and
  12336. -- * module_exit) routines which equal device_initcall. So if you intend to
  12337. -- * create a module with the platform specific data for the brcmfmac and have
  12338. -- * it built-in to the kernel then use a higher initcall then device_initcall
  12339. -- * (see init.h). If this is not done then brcmfmac will load without problems
  12340. -- * but will not pickup the platform data.
  12341. -- *
  12342. -- * When the driver does not "detect" platform driver data then it will continue
  12343. -- * without reporting anything and just assume there is no data needed. Which is
  12344. -- * probably true for most platforms.
  12345. -- *
  12346. -- * Explanation of the platform_data fields:
  12347. -- *
  12348. -- * drive_strength: is the preferred drive_strength to be used for the SDIO
  12349. -- * pins. If 0 then a default value will be used. This is the target drive
  12350. -- * strength, the exact drive strength which will be used depends on the
  12351. -- * capabilities of the device.
  12352. -- *
  12353. -- * oob_irq_supported: does the board have support for OOB interrupts. SDIO
  12354. -- * in-band interrupts are relatively slow and for having less overhead on
  12355. -- * interrupt processing an out of band interrupt can be used. If the HW
  12356. -- * supports this then enable this by setting this field to true and configure
  12357. -- * the oob related fields.
  12358. -- *
  12359. -- * oob_irq_nr, oob_irq_flags: the OOB interrupt information. The values are
  12360. -- * used for registering the irq using request_irq function.
  12361. -- *
  12362. -- * broken_sg_support: flag for broken sg list support of SDIO host controller.
  12363. -- * Set this to true if the SDIO host controller has higher align requirement
  12364. -- * than 32 bytes for each scatterlist item.
  12365. -- *
  12366. -- * sd_head_align: alignment requirement for start of data buffer
  12367. -- *
  12368. -- * sd_sgentry_align: length alignment requirement for each sg entry
  12369. -- *
  12370. -- * power_on: This function is called by the brcmfmac when the module gets
  12371. -- * loaded. This can be particularly useful for low power devices. The platform
  12372. -- * spcific routine may for example decide to power up the complete device.
  12373. -- * If there is no use-case for this function then provide NULL.
  12374. -- *
  12375. -- * power_off: This function is called by the brcmfmac when the module gets
  12376. -- * unloaded. At this point the device can be powered down or otherwise be reset.
  12377. -- * So if an actual power_off is not supported but reset is then reset the device
  12378. -- * when this function gets called. This can be particularly useful for low power
  12379. -- * devices. If there is no use-case for this function (either power-down or
  12380. -- * reset) then provide NULL.
  12381. -- *
  12382. -- * reset: This function can get called if the device communication broke down.
  12383. -- * This functionality is particularly useful in case of SDIO type devices. It is
  12384. -- * possible to reset a dongle via sdio data interface, but it requires that
  12385. -- * this is fully functional. This function is chip/module specific and this
  12386. -- * function should return only after the complete reset has completed.
  12387. -- */
  12388. --
  12389. --#define BRCMFMAC_SDIO_PDATA_NAME "brcmfmac_sdio"
  12390. --
  12391. --struct brcmfmac_sdio_platform_data {
  12392. -- unsigned int drive_strength;
  12393. -- bool oob_irq_supported;
  12394. -- unsigned int oob_irq_nr;
  12395. -- unsigned long oob_irq_flags;
  12396. -- bool broken_sg_support;
  12397. -- unsigned short sd_head_align;
  12398. -- unsigned short sd_sgentry_align;
  12399. -- void (*power_on)(void);
  12400. -- void (*power_off)(void);
  12401. -- void (*reset)(void);
  12402. --};
  12403. --
  12404. --#endif /* _LINUX_BRCMFMAC_PLATFORM_H */
  12405. ---- /dev/null
  12406. -+++ b/include/linux/platform_data/brcmfmac.h
  12407. -@@ -0,0 +1,185 @@
  12408. -+/*
  12409. -+ * Copyright (c) 201 Broadcom Corporation
  12410. -+ *
  12411. -+ * Permission to use, copy, modify, and/or distribute this software for any
  12412. -+ * purpose with or without fee is hereby granted, provided that the above
  12413. -+ * copyright notice and this permission notice appear in all copies.
  12414. -+ *
  12415. -+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  12416. -+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  12417. -+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
  12418. -+ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12419. -+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  12420. -+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  12421. -+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  12422. -+ */
  12423. -+
  12424. -+#ifndef _LINUX_BRCMFMAC_PLATFORM_H
  12425. -+#define _LINUX_BRCMFMAC_PLATFORM_H
  12426. -+
  12427. -+
  12428. -+#define BRCMFMAC_PDATA_NAME "brcmfmac"
  12429. -+
  12430. -+#define BRCMFMAC_COUNTRY_BUF_SZ 4
  12431. -+
  12432. -+
  12433. -+/*
  12434. -+ * Platform specific driver functions and data. Through the platform specific
  12435. -+ * device data functions and data can be provided to help the brcmfmac driver to
  12436. -+ * operate with the device in combination with the used platform.
  12437. -+ */
  12438. -+
  12439. -+
  12440. -+/**
  12441. -+ * Note: the brcmfmac can be loaded as module or be statically built-in into
  12442. -+ * the kernel. If built-in then do note that it uses module_init (and
  12443. -+ * module_exit) routines which equal device_initcall. So if you intend to
  12444. -+ * create a module with the platform specific data for the brcmfmac and have
  12445. -+ * it built-in to the kernel then use a higher initcall then device_initcall
  12446. -+ * (see init.h). If this is not done then brcmfmac will load without problems
  12447. -+ * but will not pickup the platform data.
  12448. -+ *
  12449. -+ * When the driver does not "detect" platform driver data then it will continue
  12450. -+ * without reporting anything and just assume there is no data needed. Which is
  12451. -+ * probably true for most platforms.
  12452. -+ */
  12453. -+
  12454. -+/**
  12455. -+ * enum brcmf_bus_type - Bus type identifier. Currently SDIO, USB and PCIE are
  12456. -+ * supported.
  12457. -+ */
  12458. -+enum brcmf_bus_type {
  12459. -+ BRCMF_BUSTYPE_SDIO,
  12460. -+ BRCMF_BUSTYPE_USB,
  12461. -+ BRCMF_BUSTYPE_PCIE
  12462. -+};
  12463. -+
  12464. -+
  12465. -+/**
  12466. -+ * struct brcmfmac_sdio_pd - SDIO Device specific platform data.
  12467. -+ *
  12468. -+ * @txglomsz: SDIO txglom size. Use 0 if default of driver is to be
  12469. -+ * used.
  12470. -+ * @drive_strength: is the preferred drive_strength to be used for the SDIO
  12471. -+ * pins. If 0 then a default value will be used. This is
  12472. -+ * the target drive strength, the exact drive strength
  12473. -+ * which will be used depends on the capabilities of the
  12474. -+ * device.
  12475. -+ * @oob_irq_supported: does the board have support for OOB interrupts. SDIO
  12476. -+ * in-band interrupts are relatively slow and for having
  12477. -+ * less overhead on interrupt processing an out of band
  12478. -+ * interrupt can be used. If the HW supports this then
  12479. -+ * enable this by setting this field to true and configure
  12480. -+ * the oob related fields.
  12481. -+ * @oob_irq_nr,
  12482. -+ * @oob_irq_flags: the OOB interrupt information. The values are used for
  12483. -+ * registering the irq using request_irq function.
  12484. -+ * @broken_sg_support: flag for broken sg list support of SDIO host controller.
  12485. -+ * Set this to true if the SDIO host controller has higher
  12486. -+ * align requirement than 32 bytes for each scatterlist
  12487. -+ * item.
  12488. -+ * @sd_head_align: alignment requirement for start of data buffer.
  12489. -+ * @sd_sgentry_align: length alignment requirement for each sg entry.
  12490. -+ * @reset: This function can get called if the device communication
  12491. -+ * broke down. This functionality is particularly useful in
  12492. -+ * case of SDIO type devices. It is possible to reset a
  12493. -+ * dongle via sdio data interface, but it requires that
  12494. -+ * this is fully functional. This function is chip/module
  12495. -+ * specific and this function should return only after the
  12496. -+ * complete reset has completed.
  12497. -+ */
  12498. -+struct brcmfmac_sdio_pd {
  12499. -+ int txglomsz;
  12500. -+ unsigned int drive_strength;
  12501. -+ bool oob_irq_supported;
  12502. -+ unsigned int oob_irq_nr;
  12503. -+ unsigned long oob_irq_flags;
  12504. -+ bool broken_sg_support;
  12505. -+ unsigned short sd_head_align;
  12506. -+ unsigned short sd_sgentry_align;
  12507. -+ void (*reset)(void);
  12508. -+};
  12509. -+
  12510. -+/**
  12511. -+ * struct brcmfmac_pd_cc_entry - Struct for translating user space country code
  12512. -+ * (iso3166) to firmware country code and
  12513. -+ * revision.
  12514. -+ *
  12515. -+ * @iso3166: iso3166 alpha 2 country code string.
  12516. -+ * @cc: firmware country code string.
  12517. -+ * @rev: firmware country code revision.
  12518. -+ */
  12519. -+struct brcmfmac_pd_cc_entry {
  12520. -+ char iso3166[BRCMFMAC_COUNTRY_BUF_SZ];
  12521. -+ char cc[BRCMFMAC_COUNTRY_BUF_SZ];
  12522. -+ s32 rev;
  12523. -+};
  12524. -+
  12525. -+/**
  12526. -+ * struct brcmfmac_pd_cc - Struct for translating country codes as set by user
  12527. -+ * space to a country code and rev which can be used by
  12528. -+ * firmware.
  12529. -+ *
  12530. -+ * @table_size: number of entries in table (> 0)
  12531. -+ * @table: array of 1 or more elements with translation information.
  12532. -+ */
  12533. -+struct brcmfmac_pd_cc {
  12534. -+ int table_size;
  12535. -+ struct brcmfmac_pd_cc_entry table[0];
  12536. -+};
  12537. -+
  12538. -+/**
  12539. -+ * struct brcmfmac_pd_device - Device specific platform data. (id/rev/bus_type)
  12540. -+ * is the unique identifier of the device.
  12541. -+ *
  12542. -+ * @id: ID of the device for which this data is. In case of SDIO
  12543. -+ * or PCIE this is the chipid as identified by chip.c In
  12544. -+ * case of USB this is the chipid as identified by the
  12545. -+ * device query.
  12546. -+ * @rev: chip revision, see id.
  12547. -+ * @bus_type: The type of bus. Some chipid/rev exist for different bus
  12548. -+ * types. Each bus type has its own set of settings.
  12549. -+ * @feature_disable: Bitmask of features to disable (override), See feature.c
  12550. -+ * in brcmfmac for details.
  12551. -+ * @country_codes: If available, pointer to struct for translating country
  12552. -+ * codes.
  12553. -+ * @bus: Bus specific (union) device settings. Currently only
  12554. -+ * SDIO.
  12555. -+ */
  12556. -+struct brcmfmac_pd_device {
  12557. -+ unsigned int id;
  12558. -+ unsigned int rev;
  12559. -+ enum brcmf_bus_type bus_type;
  12560. -+ unsigned int feature_disable;
  12561. -+ struct brcmfmac_pd_cc *country_codes;
  12562. -+ union {
  12563. -+ struct brcmfmac_sdio_pd sdio;
  12564. -+ } bus;
  12565. -+};
  12566. -+
  12567. -+/**
  12568. -+ * struct brcmfmac_platform_data - BRCMFMAC specific platform data.
  12569. -+ *
  12570. -+ * @power_on: This function is called by the brcmfmac driver when the module
  12571. -+ * gets loaded. This can be particularly useful for low power
  12572. -+ * devices. The platform spcific routine may for example decide to
  12573. -+ * power up the complete device. If there is no use-case for this
  12574. -+ * function then provide NULL.
  12575. -+ * @power_off: This function is called by the brcmfmac when the module gets
  12576. -+ * unloaded. At this point the devices can be powered down or
  12577. -+ * otherwise be reset. So if an actual power_off is not supported
  12578. -+ * but reset is supported by the devices then reset the devices
  12579. -+ * when this function gets called. This can be particularly useful
  12580. -+ * for low power devices. If there is no use-case for this
  12581. -+ * function then provide NULL.
  12582. -+ */
  12583. -+struct brcmfmac_platform_data {
  12584. -+ void (*power_on)(void);
  12585. -+ void (*power_off)(void);
  12586. -+ char *fw_alternative_path;
  12587. -+ int device_count;
  12588. -+ struct brcmfmac_pd_device devices[0];
  12589. -+};
  12590. -+
  12591. -+
  12592. -+#endif /* _LINUX_BRCMFMAC_PLATFORM_H */
  12593. diff --git a/package/kernel/mac80211/patches/344-0018-brcmfmac-merge-platform-data-and-module-paramaters.patch b/package/kernel/mac80211/patches/344-0018-brcmfmac-merge-platform-data-and-module-paramaters.patch
  12594. deleted file mode 100644
  12595. index 34341d7..0000000
  12596. --- a/package/kernel/mac80211/patches/344-0018-brcmfmac-merge-platform-data-and-module-paramaters.patch
  12597. +++ /dev/null
  12598. @@ -1,607 +0,0 @@
  12599. -From: Hante Meuleman <meuleman@broadcom.com>
  12600. -Date: Wed, 17 Feb 2016 11:27:08 +0100
  12601. -Subject: [PATCH] brcmfmac: merge platform data and module paramaters
  12602. -
  12603. -Merge module parameters and platform data in one struct. This is the
  12604. -last step to move to the new platform data per device. Now parameters
  12605. -of platform data will be merged with module parameters per device.
  12606. -
  12607. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  12608. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  12609. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  12610. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  12611. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  12612. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12613. ----
  12614. -
  12615. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  12616. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  12617. -@@ -109,8 +109,8 @@ int brcmf_sdiod_intr_register(struct brc
  12618. - u32 addr, gpiocontrol;
  12619. - unsigned long flags;
  12620. -
  12621. -- pdata = sdiodev->pdata;
  12622. -- if ((pdata) && (pdata->oob_irq_supported)) {
  12623. -+ pdata = &sdiodev->settings->bus.sdio;
  12624. -+ if (pdata->oob_irq_supported) {
  12625. - brcmf_dbg(SDIO, "Enter, register OOB IRQ %d\n",
  12626. - pdata->oob_irq_nr);
  12627. - ret = request_irq(pdata->oob_irq_nr, brcmf_sdiod_oob_irqhandler,
  12628. -@@ -177,8 +177,8 @@ int brcmf_sdiod_intr_unregister(struct b
  12629. -
  12630. - brcmf_dbg(SDIO, "Entering\n");
  12631. -
  12632. -- pdata = sdiodev->pdata;
  12633. -- if ((pdata) && (pdata->oob_irq_supported)) {
  12634. -+ pdata = &sdiodev->settings->bus.sdio;
  12635. -+ if (pdata->oob_irq_supported) {
  12636. - sdio_claim_host(sdiodev->func[1]);
  12637. - brcmf_sdiod_regwb(sdiodev, SDIO_CCCR_BRCM_SEPINT, 0, NULL);
  12638. - brcmf_sdiod_regwb(sdiodev, SDIO_CCCR_IENx, 0, NULL);
  12639. -@@ -522,7 +522,7 @@ static int brcmf_sdiod_sglist_rw(struct
  12640. - target_list = pktlist;
  12641. - /* for host with broken sg support, prepare a page aligned list */
  12642. - __skb_queue_head_init(&local_list);
  12643. -- if (sdiodev->pdata && sdiodev->pdata->broken_sg_support && !write) {
  12644. -+ if (!write && sdiodev->settings->bus.sdio.broken_sg_support) {
  12645. - req_sz = 0;
  12646. - skb_queue_walk(pktlist, pkt_next)
  12647. - req_sz += pkt_next->len;
  12648. -@@ -629,7 +629,7 @@ static int brcmf_sdiod_sglist_rw(struct
  12649. - }
  12650. - }
  12651. -
  12652. -- if (sdiodev->pdata && sdiodev->pdata->broken_sg_support && !write) {
  12653. -+ if (!write && sdiodev->settings->bus.sdio.broken_sg_support) {
  12654. - local_pkt_next = local_list.next;
  12655. - orig_offset = 0;
  12656. - skb_queue_walk(pktlist, pkt_next) {
  12657. -@@ -900,7 +900,7 @@ void brcmf_sdiod_sgtable_alloc(struct br
  12658. - return;
  12659. -
  12660. - nents = max_t(uint, BRCMF_DEFAULT_RXGLOM_SIZE,
  12661. -- sdiodev->bus_if->drvr->settings->sdiod_txglomsz);
  12662. -+ sdiodev->settings->bus.sdio.txglomsz);
  12663. - nents += (nents >> 4) + 1;
  12664. -
  12665. - WARN_ON(nents > sdiodev->max_segment_count);
  12666. -@@ -912,7 +912,7 @@ void brcmf_sdiod_sgtable_alloc(struct br
  12667. - sdiodev->sg_support = false;
  12668. - }
  12669. -
  12670. -- sdiodev->txglomsz = sdiodev->bus_if->drvr->settings->sdiod_txglomsz;
  12671. -+ sdiodev->txglomsz = sdiodev->settings->bus.sdio.txglomsz;
  12672. - }
  12673. -
  12674. - #ifdef CONFIG_PM_SLEEP
  12675. -@@ -1246,8 +1246,8 @@ static int brcmf_ops_sdio_suspend(struct
  12676. -
  12677. - sdio_flags = MMC_PM_KEEP_POWER;
  12678. - if (sdiodev->wowl_enabled) {
  12679. -- if (sdiodev->pdata->oob_irq_supported)
  12680. -- enable_irq_wake(sdiodev->pdata->oob_irq_nr);
  12681. -+ if (sdiodev->settings->bus.sdio.oob_irq_supported)
  12682. -+ enable_irq_wake(sdiodev->settings->bus.sdio.oob_irq_nr);
  12683. - else
  12684. - sdio_flags |= MMC_PM_WAKE_SDIO_IRQ;
  12685. - }
  12686. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
  12687. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
  12688. -@@ -43,6 +43,8 @@ enum brcmf_bus_protocol_type {
  12689. - BRCMF_PROTO_MSGBUF
  12690. - };
  12691. -
  12692. -+struct brcmf_mp_device;
  12693. -+
  12694. - struct brcmf_bus_dcmd {
  12695. - char *name;
  12696. - char *param;
  12697. -@@ -217,7 +219,7 @@ bool brcmf_c_prec_enq(struct device *dev
  12698. - void brcmf_rx_frame(struct device *dev, struct sk_buff *rxp);
  12699. -
  12700. - /* Indication from bus module regarding presence/insertion of dongle. */
  12701. --int brcmf_attach(struct device *dev);
  12702. -+int brcmf_attach(struct device *dev, struct brcmf_mp_device *settings);
  12703. - /* Indication from bus module regarding removal/absence of dongle */
  12704. - void brcmf_detach(struct device *dev);
  12705. - /* Indication from bus module that dongle should be reset */
  12706. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  12707. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  12708. -@@ -243,14 +243,35 @@ static void brcmf_mp_attach(void)
  12709. - }
  12710. - }
  12711. -
  12712. --struct brcmfmac_sdio_pd *brcmf_get_module_param(struct device *dev,
  12713. -- enum brcmf_bus_type bus_type,
  12714. -- u32 chip, u32 chiprev)
  12715. -+struct brcmf_mp_device *brcmf_get_module_param(struct device *dev,
  12716. -+ enum brcmf_bus_type bus_type,
  12717. -+ u32 chip, u32 chiprev)
  12718. - {
  12719. -- struct brcmfmac_sdio_pd *pdata;
  12720. -+ struct brcmf_mp_device *settings;
  12721. - struct brcmfmac_pd_device *device_pd;
  12722. -+ bool found;
  12723. - int i;
  12724. -
  12725. -+ brcmf_dbg(INFO, "Enter, bus=%d, chip=%d, rev=%d\n", bus_type, chip,
  12726. -+ chiprev);
  12727. -+ settings = kzalloc(sizeof(*settings), GFP_ATOMIC);
  12728. -+ if (!settings)
  12729. -+ return NULL;
  12730. -+
  12731. -+ /* start by using the module paramaters */
  12732. -+ settings->p2p_enable = !!brcmf_p2p_enable;
  12733. -+ settings->feature_disable = brcmf_feature_disable;
  12734. -+ settings->fcmode = brcmf_fcmode;
  12735. -+ settings->roamoff = !!brcmf_roamoff;
  12736. -+#ifdef DEBUG
  12737. -+ settings->ignore_probe_fail = !!brcmf_ignore_probe_fail;
  12738. -+#endif
  12739. -+
  12740. -+ if (bus_type == BRCMF_BUSTYPE_SDIO)
  12741. -+ settings->bus.sdio.txglomsz = brcmf_sdiod_txglomsz;
  12742. -+
  12743. -+ /* See if there is any device specific platform data configured */
  12744. -+ found = false;
  12745. - if (brcmfmac_pdata) {
  12746. - for (i = 0; i < brcmfmac_pdata->device_count; i++) {
  12747. - device_pd = &brcmfmac_pdata->devices[i];
  12748. -@@ -259,38 +280,29 @@ struct brcmfmac_sdio_pd *brcmf_get_modul
  12749. - ((device_pd->rev == chiprev) ||
  12750. - (device_pd->rev == -1))) {
  12751. - brcmf_dbg(INFO, "Platform data for device found\n");
  12752. -+ settings->country_codes =
  12753. -+ device_pd->country_codes;
  12754. - if (device_pd->bus_type == BRCMF_BUSTYPE_SDIO)
  12755. -- return &device_pd->bus.sdio;
  12756. -+ memcpy(&settings->bus.sdio,
  12757. -+ &device_pd->bus.sdio,
  12758. -+ sizeof(settings->bus.sdio));
  12759. -+ found = true;
  12760. - break;
  12761. - }
  12762. - }
  12763. - }
  12764. -- pdata = NULL;
  12765. -- brcmf_of_probe(dev, &pdata);
  12766. --
  12767. -- return pdata;
  12768. --}
  12769. --
  12770. --int brcmf_mp_device_attach(struct brcmf_pub *drvr)
  12771. --{
  12772. -- drvr->settings = kzalloc(sizeof(*drvr->settings), GFP_ATOMIC);
  12773. -- if (!drvr->settings)
  12774. -- return -ENOMEM;
  12775. --
  12776. -- drvr->settings->sdiod_txglomsz = brcmf_sdiod_txglomsz;
  12777. -- drvr->settings->p2p_enable = !!brcmf_p2p_enable;
  12778. -- drvr->settings->feature_disable = brcmf_feature_disable;
  12779. -- drvr->settings->fcmode = brcmf_fcmode;
  12780. -- drvr->settings->roamoff = !!brcmf_roamoff;
  12781. --#ifdef DEBUG
  12782. -- drvr->settings->ignore_probe_fail = !!brcmf_ignore_probe_fail;
  12783. --#endif
  12784. -- return 0;
  12785. -+ if ((bus_type == BRCMF_BUSTYPE_SDIO) && (!found)) {
  12786. -+ /* No platform data for this device. In case of SDIO try OF
  12787. -+ * (Open Firwmare) Device Tree.
  12788. -+ */
  12789. -+ brcmf_of_probe(dev, &settings->bus.sdio);
  12790. -+ }
  12791. -+ return settings;
  12792. - }
  12793. -
  12794. --void brcmf_mp_device_detach(struct brcmf_pub *drvr)
  12795. -+void brcmf_release_module_param(struct brcmf_mp_device *module_param)
  12796. - {
  12797. -- kfree(drvr->settings);
  12798. -+ kfree(module_param);
  12799. - }
  12800. -
  12801. - static int __init brcmf_common_pd_probe(struct platform_device *pdev)
  12802. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
  12803. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
  12804. -@@ -45,41 +45,30 @@ extern struct brcmf_mp_global_t brcmf_mp
  12805. - /**
  12806. - * struct brcmf_mp_device - Device module paramaters.
  12807. - *
  12808. -- * @sdiod_txglomsz: SDIO txglom size.
  12809. -- * @joinboost_5g_rssi: 5g rssi booost for preferred join selection.
  12810. - * @p2p_enable: Legacy P2P0 enable (old wpa_supplicant).
  12811. - * @feature_disable: Feature_disable bitmask.
  12812. - * @fcmode: FWS flow control.
  12813. - * @roamoff: Firmware roaming off?
  12814. -+ * @ignore_probe_fail: Ignore probe failure.
  12815. - * @country_codes: If available, pointer to struct for translating country codes
  12816. -+ * @bus: Bus specific platform data. Only SDIO at the mmoment.
  12817. - */
  12818. - struct brcmf_mp_device {
  12819. -- int sdiod_txglomsz;
  12820. -- int joinboost_5g_rssi;
  12821. -- bool p2p_enable;
  12822. -- int feature_disable;
  12823. -- int fcmode;
  12824. -- bool roamoff;
  12825. -- bool ignore_probe_fail;
  12826. -+ bool p2p_enable;
  12827. -+ unsigned int feature_disable;
  12828. -+ int fcmode;
  12829. -+ bool roamoff;
  12830. -+ bool ignore_probe_fail;
  12831. - struct brcmfmac_pd_cc *country_codes;
  12832. -+ union {
  12833. -+ struct brcmfmac_sdio_pd sdio;
  12834. -+ } bus;
  12835. - };
  12836. -
  12837. --struct brcmfmac_sdio_pd *brcmf_get_module_param(struct device *dev,
  12838. -- enum brcmf_bus_type bus_type,
  12839. -- u32 chip, u32 chiprev);
  12840. --int brcmf_mp_device_attach(struct brcmf_pub *drvr);
  12841. --void brcmf_mp_device_detach(struct brcmf_pub *drvr);
  12842. --#ifdef DEBUG
  12843. --static inline bool brcmf_ignoring_probe_fail(struct brcmf_pub *drvr)
  12844. --{
  12845. -- return drvr->settings->ignore_probe_fail;
  12846. --}
  12847. --#else
  12848. --static inline bool brcmf_ignoring_probe_fail(struct brcmf_pub *drvr)
  12849. --{
  12850. -- return false;
  12851. --}
  12852. --#endif
  12853. -+struct brcmf_mp_device *brcmf_get_module_param(struct device *dev,
  12854. -+ enum brcmf_bus_type bus_type,
  12855. -+ u32 chip, u32 chiprev);
  12856. -+void brcmf_release_module_param(struct brcmf_mp_device *module_param);
  12857. -
  12858. - /* Sets dongle media info (drv_version, mac address). */
  12859. - int brcmf_c_preinit_dcmds(struct brcmf_if *ifp);
  12860. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  12861. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  12862. -@@ -1104,7 +1104,7 @@ static int brcmf_inet6addr_changed(struc
  12863. - }
  12864. - #endif
  12865. -
  12866. --int brcmf_attach(struct device *dev)
  12867. -+int brcmf_attach(struct device *dev, struct brcmf_mp_device *settings)
  12868. - {
  12869. - struct brcmf_pub *drvr = NULL;
  12870. - int ret = 0;
  12871. -@@ -1126,10 +1126,7 @@ int brcmf_attach(struct device *dev)
  12872. - drvr->hdrlen = 0;
  12873. - drvr->bus_if = dev_get_drvdata(dev);
  12874. - drvr->bus_if->drvr = drvr;
  12875. --
  12876. -- /* Initialize device specific settings */
  12877. -- if (brcmf_mp_device_attach(drvr))
  12878. -- goto fail;
  12879. -+ drvr->settings = settings;
  12880. -
  12881. - /* attach debug facilities */
  12882. - brcmf_debug_attach(drvr);
  12883. -@@ -1274,7 +1271,7 @@ fail:
  12884. - brcmf_net_detach(p2p_ifp->ndev);
  12885. - drvr->iflist[0] = NULL;
  12886. - drvr->iflist[1] = NULL;
  12887. -- if (brcmf_ignoring_probe_fail(drvr))
  12888. -+ if (drvr->settings->ignore_probe_fail)
  12889. - ret = 0;
  12890. -
  12891. - return ret;
  12892. -@@ -1350,8 +1347,6 @@ void brcmf_detach(struct device *dev)
  12893. -
  12894. - brcmf_proto_detach(drvr);
  12895. -
  12896. -- brcmf_mp_device_detach(drvr);
  12897. --
  12898. - brcmf_debug_detach(drvr);
  12899. - bus_if->drvr = NULL;
  12900. - kfree(drvr);
  12901. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
  12902. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
  12903. -@@ -23,7 +23,7 @@
  12904. - #include "common.h"
  12905. - #include "of.h"
  12906. -
  12907. --void brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_pd **sdio)
  12908. -+void brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_pd *sdio)
  12909. - {
  12910. - struct device_node *np = dev->of_node;
  12911. - int irq;
  12912. -@@ -33,12 +33,8 @@ void brcmf_of_probe(struct device *dev,
  12913. - if (!np || !of_device_is_compatible(np, "brcm,bcm4329-fmac"))
  12914. - return;
  12915. -
  12916. -- *sdio = devm_kzalloc(dev, sizeof(*sdio), GFP_KERNEL);
  12917. -- if (!(*sdio))
  12918. -- return;
  12919. --
  12920. - if (of_property_read_u32(np, "brcm,drive-strength", &val) == 0)
  12921. -- (*sdio)->drive_strength = val;
  12922. -+ sdio->drive_strength = val;
  12923. -
  12924. - /* make sure there are interrupts defined in the node */
  12925. - if (!of_find_property(np, "interrupts", NULL))
  12926. -@@ -51,7 +47,7 @@ void brcmf_of_probe(struct device *dev,
  12927. - }
  12928. - irqf = irqd_get_trigger_type(irq_get_irq_data(irq));
  12929. -
  12930. -- (*sdio)->oob_irq_supported = true;
  12931. -- (*sdio)->oob_irq_nr = irq;
  12932. -- (*sdio)->oob_irq_flags = irqf;
  12933. -+ sdio->oob_irq_supported = true;
  12934. -+ sdio->oob_irq_nr = irq;
  12935. -+ sdio->oob_irq_flags = irqf;
  12936. - }
  12937. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.h
  12938. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.h
  12939. -@@ -14,10 +14,9 @@
  12940. - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  12941. - */
  12942. - #ifdef CONFIG_OF
  12943. --void
  12944. --brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_pd **sdio);
  12945. -+void brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_pd *sdio);
  12946. - #else
  12947. --static void brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_pd **sdio)
  12948. -+static void brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_pd *sdio)
  12949. - {
  12950. - }
  12951. - #endif /* CONFIG_OF */
  12952. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  12953. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  12954. -@@ -37,6 +37,8 @@
  12955. - #include "pcie.h"
  12956. - #include "firmware.h"
  12957. - #include "chip.h"
  12958. -+#include "core.h"
  12959. -+#include "common.h"
  12960. -
  12961. -
  12962. - enum brcmf_pcie_state {
  12963. -@@ -266,6 +268,7 @@ struct brcmf_pciedev_info {
  12964. - u16 (*read_ptr)(struct brcmf_pciedev_info *devinfo, u32 mem_offset);
  12965. - void (*write_ptr)(struct brcmf_pciedev_info *devinfo, u32 mem_offset,
  12966. - u16 value);
  12967. -+ struct brcmf_mp_device *settings;
  12968. - };
  12969. -
  12970. - struct brcmf_pcie_ringbuf {
  12971. -@@ -1525,16 +1528,16 @@ static void brcmf_pcie_release_resource(
  12972. - }
  12973. -
  12974. -
  12975. --static int brcmf_pcie_attach_bus(struct device *dev)
  12976. -+static int brcmf_pcie_attach_bus(struct brcmf_pciedev_info *devinfo)
  12977. - {
  12978. - int ret;
  12979. -
  12980. - /* Attach to the common driver interface */
  12981. -- ret = brcmf_attach(dev);
  12982. -+ ret = brcmf_attach(&devinfo->pdev->dev, devinfo->settings);
  12983. - if (ret) {
  12984. - brcmf_err("brcmf_attach failed\n");
  12985. - } else {
  12986. -- ret = brcmf_bus_start(dev);
  12987. -+ ret = brcmf_bus_start(&devinfo->pdev->dev);
  12988. - if (ret)
  12989. - brcmf_err("dongle is not responding\n");
  12990. - }
  12991. -@@ -1672,7 +1675,7 @@ static void brcmf_pcie_setup(struct devi
  12992. - init_waitqueue_head(&devinfo->mbdata_resp_wait);
  12993. -
  12994. - brcmf_pcie_intr_enable(devinfo);
  12995. -- if (brcmf_pcie_attach_bus(bus->dev) == 0)
  12996. -+ if (brcmf_pcie_attach_bus(devinfo) == 0)
  12997. - return;
  12998. -
  12999. - brcmf_pcie_bus_console_read(devinfo);
  13000. -@@ -1716,6 +1719,15 @@ brcmf_pcie_probe(struct pci_dev *pdev, c
  13001. - goto fail;
  13002. - }
  13003. -
  13004. -+ devinfo->settings = brcmf_get_module_param(&devinfo->pdev->dev,
  13005. -+ BRCMF_BUSTYPE_PCIE,
  13006. -+ devinfo->ci->chip,
  13007. -+ devinfo->ci->chiprev);
  13008. -+ if (!devinfo->settings) {
  13009. -+ ret = -ENOMEM;
  13010. -+ goto fail;
  13011. -+ }
  13012. -+
  13013. - bus = kzalloc(sizeof(*bus), GFP_KERNEL);
  13014. - if (!bus) {
  13015. - ret = -ENOMEM;
  13016. -@@ -1760,6 +1772,8 @@ fail:
  13017. - brcmf_pcie_release_resource(devinfo);
  13018. - if (devinfo->ci)
  13019. - brcmf_chip_detach(devinfo->ci);
  13020. -+ if (devinfo->settings)
  13021. -+ brcmf_release_module_param(devinfo->settings);
  13022. - kfree(pcie_bus_dev);
  13023. - kfree(devinfo);
  13024. - return ret;
  13025. -@@ -1799,6 +1813,8 @@ brcmf_pcie_remove(struct pci_dev *pdev)
  13026. -
  13027. - if (devinfo->ci)
  13028. - brcmf_chip_detach(devinfo->ci);
  13029. -+ if (devinfo->settings)
  13030. -+ brcmf_release_module_param(devinfo->settings);
  13031. -
  13032. - kfree(devinfo);
  13033. - dev_set_drvdata(&pdev->dev, NULL);
  13034. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  13035. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  13036. -@@ -2442,15 +2442,17 @@ static void brcmf_sdio_bus_stop(struct d
  13037. -
  13038. - static inline void brcmf_sdio_clrintr(struct brcmf_sdio *bus)
  13039. - {
  13040. -+ struct brcmf_sdio_dev *sdiodev;
  13041. - unsigned long flags;
  13042. -
  13043. -- if (bus->sdiodev->oob_irq_requested) {
  13044. -- spin_lock_irqsave(&bus->sdiodev->irq_en_lock, flags);
  13045. -- if (!bus->sdiodev->irq_en && !atomic_read(&bus->ipend)) {
  13046. -- enable_irq(bus->sdiodev->pdata->oob_irq_nr);
  13047. -- bus->sdiodev->irq_en = true;
  13048. -+ sdiodev = bus->sdiodev;
  13049. -+ if (sdiodev->oob_irq_requested) {
  13050. -+ spin_lock_irqsave(&sdiodev->irq_en_lock, flags);
  13051. -+ if (!sdiodev->irq_en && !atomic_read(&bus->ipend)) {
  13052. -+ enable_irq(sdiodev->settings->bus.sdio.oob_irq_nr);
  13053. -+ sdiodev->irq_en = true;
  13054. - }
  13055. -- spin_unlock_irqrestore(&bus->sdiodev->irq_en_lock, flags);
  13056. -+ spin_unlock_irqrestore(&sdiodev->irq_en_lock, flags);
  13057. - }
  13058. - }
  13059. -
  13060. -@@ -3394,9 +3396,7 @@ static int brcmf_sdio_bus_preinit(struct
  13061. - sizeof(u32));
  13062. - } else {
  13063. - /* otherwise, set txglomalign */
  13064. -- value = 4;
  13065. -- if (sdiodev->pdata)
  13066. -- value = sdiodev->pdata->sd_sgentry_align;
  13067. -+ value = sdiodev->settings->bus.sdio.sd_sgentry_align;
  13068. - /* SDIO ADMA requires at least 32 bit alignment */
  13069. - value = max_t(u32, value, 4);
  13070. - err = brcmf_iovar_data_set(dev, "bus:txglomalign", &value,
  13071. -@@ -3811,21 +3811,25 @@ brcmf_sdio_probe_attach(struct brcmf_sdi
  13072. - bus->ci = NULL;
  13073. - goto fail;
  13074. - }
  13075. -- sdiodev->pdata = brcmf_get_module_param(sdiodev->dev,
  13076. -+ sdiodev->settings = brcmf_get_module_param(sdiodev->dev,
  13077. - BRCMF_BUSTYPE_SDIO,
  13078. - bus->ci->chip,
  13079. - bus->ci->chiprev);
  13080. -+ if (!sdiodev->settings) {
  13081. -+ brcmf_err("Failed to get device parameters\n");
  13082. -+ goto fail;
  13083. -+ }
  13084. - /* platform specific configuration:
  13085. - * alignments must be at least 4 bytes for ADMA
  13086. - */
  13087. - bus->head_align = ALIGNMENT;
  13088. - bus->sgentry_align = ALIGNMENT;
  13089. -- if (sdiodev->pdata) {
  13090. -- if (sdiodev->pdata->sd_head_align > ALIGNMENT)
  13091. -- bus->head_align = sdiodev->pdata->sd_head_align;
  13092. -- if (sdiodev->pdata->sd_sgentry_align > ALIGNMENT)
  13093. -- bus->sgentry_align = sdiodev->pdata->sd_sgentry_align;
  13094. -- }
  13095. -+ if (sdiodev->settings->bus.sdio.sd_head_align > ALIGNMENT)
  13096. -+ bus->head_align = sdiodev->settings->bus.sdio.sd_head_align;
  13097. -+ if (sdiodev->settings->bus.sdio.sd_sgentry_align > ALIGNMENT)
  13098. -+ bus->sgentry_align =
  13099. -+ sdiodev->settings->bus.sdio.sd_sgentry_align;
  13100. -+
  13101. - /* allocate scatter-gather table. sg support
  13102. - * will be disabled upon allocation failure.
  13103. - */
  13104. -@@ -3837,7 +3841,7 @@ brcmf_sdio_probe_attach(struct brcmf_sdi
  13105. - */
  13106. - if ((sdio_get_host_pm_caps(sdiodev->func[1]) & MMC_PM_KEEP_POWER) &&
  13107. - ((sdio_get_host_pm_caps(sdiodev->func[1]) & MMC_PM_WAKE_SDIO_IRQ) ||
  13108. -- (sdiodev->pdata && sdiodev->pdata->oob_irq_supported)))
  13109. -+ (sdiodev->settings->bus.sdio.oob_irq_supported)))
  13110. - sdiodev->bus_if->wowl_supported = true;
  13111. - #endif
  13112. -
  13113. -@@ -3846,8 +3850,8 @@ brcmf_sdio_probe_attach(struct brcmf_sdi
  13114. - goto fail;
  13115. - }
  13116. -
  13117. -- if ((sdiodev->pdata) && (sdiodev->pdata->drive_strength))
  13118. -- drivestrength = sdiodev->pdata->drive_strength;
  13119. -+ if (sdiodev->settings->bus.sdio.drive_strength)
  13120. -+ drivestrength = sdiodev->settings->bus.sdio.drive_strength;
  13121. - else
  13122. - drivestrength = DEFAULT_SDIO_DRIVE_STRENGTH;
  13123. - brcmf_sdio_drivestrengthinit(sdiodev, bus->ci, drivestrength);
  13124. -@@ -4124,7 +4128,7 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
  13125. - bus->tx_hdrlen = SDPCM_HWHDR_LEN + SDPCM_SWHDR_LEN;
  13126. -
  13127. - /* Attach to the common layer, reserve hdr space */
  13128. -- ret = brcmf_attach(bus->sdiodev->dev);
  13129. -+ ret = brcmf_attach(bus->sdiodev->dev, bus->sdiodev->settings);
  13130. - if (ret != 0) {
  13131. - brcmf_err("brcmf_attach failed\n");
  13132. - goto fail;
  13133. -@@ -4228,6 +4232,8 @@ void brcmf_sdio_remove(struct brcmf_sdio
  13134. - }
  13135. - brcmf_chip_detach(bus->ci);
  13136. - }
  13137. -+ if (bus->sdiodev->settings)
  13138. -+ brcmf_release_module_param(bus->sdiodev->settings);
  13139. -
  13140. - kfree(bus->rxbuf);
  13141. - kfree(bus->hdrbuf);
  13142. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
  13143. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
  13144. -@@ -184,7 +184,7 @@ struct brcmf_sdio_dev {
  13145. - struct brcmf_sdio *bus;
  13146. - struct device *dev;
  13147. - struct brcmf_bus *bus_if;
  13148. -- struct brcmfmac_sdio_pd *pdata;
  13149. -+ struct brcmf_mp_device *settings;
  13150. - bool oob_irq_requested;
  13151. - bool irq_en; /* irq enable flags */
  13152. - spinlock_t irq_en_lock;
  13153. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
  13154. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
  13155. -@@ -27,6 +27,8 @@
  13156. - #include "debug.h"
  13157. - #include "firmware.h"
  13158. - #include "usb.h"
  13159. -+#include "core.h"
  13160. -+#include "common.h"
  13161. -
  13162. -
  13163. - #define IOCTL_RESP_TIMEOUT msecs_to_jiffies(2000)
  13164. -@@ -171,6 +173,7 @@ struct brcmf_usbdev_info {
  13165. - struct urb *bulk_urb; /* used for FW download */
  13166. -
  13167. - bool wowl_enabled;
  13168. -+ struct brcmf_mp_device *settings;
  13169. - };
  13170. -
  13171. - static void brcmf_usb_rx_refill(struct brcmf_usbdev_info *devinfo,
  13172. -@@ -1027,6 +1030,9 @@ static void brcmf_usb_detach(struct brcm
  13173. -
  13174. - kfree(devinfo->tx_reqs);
  13175. - kfree(devinfo->rx_reqs);
  13176. -+
  13177. -+ if (devinfo->settings)
  13178. -+ brcmf_release_module_param(devinfo->settings);
  13179. - }
  13180. -
  13181. -
  13182. -@@ -1136,7 +1142,7 @@ static int brcmf_usb_bus_setup(struct br
  13183. - int ret;
  13184. -
  13185. - /* Attach to the common driver interface */
  13186. -- ret = brcmf_attach(devinfo->dev);
  13187. -+ ret = brcmf_attach(devinfo->dev, devinfo->settings);
  13188. - if (ret) {
  13189. - brcmf_err("brcmf_attach failed\n");
  13190. - return ret;
  13191. -@@ -1223,6 +1229,14 @@ static int brcmf_usb_probe_cb(struct brc
  13192. - bus->wowl_supported = true;
  13193. - #endif
  13194. -
  13195. -+ devinfo->settings = brcmf_get_module_param(bus->dev, BRCMF_BUSTYPE_USB,
  13196. -+ bus_pub->devid,
  13197. -+ bus_pub->chiprev);
  13198. -+ if (!devinfo->settings) {
  13199. -+ ret = -ENOMEM;
  13200. -+ goto fail;
  13201. -+ }
  13202. -+
  13203. - if (!brcmf_usb_dlneeded(devinfo)) {
  13204. - ret = brcmf_usb_bus_setup(devinfo);
  13205. - if (ret)
  13206. diff --git a/package/kernel/mac80211/patches/344-0019-brcmfmac-integrate-add_keyext-in-add_key.patch b/package/kernel/mac80211/patches/344-0019-brcmfmac-integrate-add_keyext-in-add_key.patch
  13207. deleted file mode 100644
  13208. index eb680fc..0000000
  13209. --- a/package/kernel/mac80211/patches/344-0019-brcmfmac-integrate-add_keyext-in-add_key.patch
  13210. +++ /dev/null
  13211. @@ -1,227 +0,0 @@
  13212. -From: Hante Meuleman <hante.meuleman@broadcom.com>
  13213. -Date: Wed, 17 Feb 2016 11:27:09 +0100
  13214. -Subject: [PATCH] brcmfmac: integrate add_keyext in add_key
  13215. -
  13216. -brcmf_add_keyext is called when a key is configured for a specific
  13217. -mac address. This function is very similar to the calling function
  13218. -brcmf_add_key. Integrate this function and also use existing del_key
  13219. -function in case key is to be cleared.
  13220. -
  13221. -Reviewed-by: Arend Van Spriel <arend.van@broadcom.com>
  13222. -Reviewed-by: Franky (Zhenhui) Lin <franky.lin@broadcom.com>
  13223. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  13224. -Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
  13225. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  13226. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13227. ----
  13228. -
  13229. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  13230. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  13231. -@@ -2073,84 +2073,34 @@ done:
  13232. - }
  13233. -
  13234. - static s32
  13235. --brcmf_add_keyext(struct wiphy *wiphy, struct net_device *ndev,
  13236. -- u8 key_idx, const u8 *mac_addr, struct key_params *params)
  13237. -+brcmf_cfg80211_del_key(struct wiphy *wiphy, struct net_device *ndev,
  13238. -+ u8 key_idx, bool pairwise, const u8 *mac_addr)
  13239. - {
  13240. - struct brcmf_if *ifp = netdev_priv(ndev);
  13241. - struct brcmf_wsec_key key;
  13242. - s32 err = 0;
  13243. -- u8 keybuf[8];
  13244. -+
  13245. -+ brcmf_dbg(TRACE, "Enter\n");
  13246. -+ if (!check_vif_up(ifp->vif))
  13247. -+ return -EIO;
  13248. -+
  13249. -+ if (key_idx >= BRCMF_MAX_DEFAULT_KEYS) {
  13250. -+ /* we ignore this key index in this case */
  13251. -+ return -EINVAL;
  13252. -+ }
  13253. -
  13254. - memset(&key, 0, sizeof(key));
  13255. -- key.index = (u32) key_idx;
  13256. -- /* Instead of bcast for ea address for default wep keys,
  13257. -- driver needs it to be Null */
  13258. -- if (!is_multicast_ether_addr(mac_addr))
  13259. -- memcpy((char *)&key.ea, (void *)mac_addr, ETH_ALEN);
  13260. -- key.len = (u32) params->key_len;
  13261. -- /* check for key index change */
  13262. -- if (key.len == 0) {
  13263. -- /* key delete */
  13264. -- err = send_key_to_dongle(ifp, &key);
  13265. -- if (err)
  13266. -- brcmf_err("key delete error (%d)\n", err);
  13267. -- } else {
  13268. -- if (key.len > sizeof(key.data)) {
  13269. -- brcmf_err("Invalid key length (%d)\n", key.len);
  13270. -- return -EINVAL;
  13271. -- }
  13272. -
  13273. -- brcmf_dbg(CONN, "Setting the key index %d\n", key.index);
  13274. -- memcpy(key.data, params->key, key.len);
  13275. -+ key.index = (u32)key_idx;
  13276. -+ key.flags = BRCMF_PRIMARY_KEY;
  13277. -+ key.algo = CRYPTO_ALGO_OFF;
  13278. -
  13279. -- if (!brcmf_is_apmode(ifp->vif) &&
  13280. -- (params->cipher == WLAN_CIPHER_SUITE_TKIP)) {
  13281. -- brcmf_dbg(CONN, "Swapping RX/TX MIC key\n");
  13282. -- memcpy(keybuf, &key.data[24], sizeof(keybuf));
  13283. -- memcpy(&key.data[24], &key.data[16], sizeof(keybuf));
  13284. -- memcpy(&key.data[16], keybuf, sizeof(keybuf));
  13285. -- }
  13286. -+ brcmf_dbg(CONN, "key index (%d)\n", key_idx);
  13287. -
  13288. -- /* if IW_ENCODE_EXT_RX_SEQ_VALID set */
  13289. -- if (params->seq && params->seq_len == 6) {
  13290. -- /* rx iv */
  13291. -- u8 *ivptr;
  13292. -- ivptr = (u8 *) params->seq;
  13293. -- key.rxiv.hi = (ivptr[5] << 24) | (ivptr[4] << 16) |
  13294. -- (ivptr[3] << 8) | ivptr[2];
  13295. -- key.rxiv.lo = (ivptr[1] << 8) | ivptr[0];
  13296. -- key.iv_initialized = true;
  13297. -- }
  13298. -+ /* Set the new key/index */
  13299. -+ err = send_key_to_dongle(ifp, &key);
  13300. -
  13301. -- switch (params->cipher) {
  13302. -- case WLAN_CIPHER_SUITE_WEP40:
  13303. -- key.algo = CRYPTO_ALGO_WEP1;
  13304. -- brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_WEP40\n");
  13305. -- break;
  13306. -- case WLAN_CIPHER_SUITE_WEP104:
  13307. -- key.algo = CRYPTO_ALGO_WEP128;
  13308. -- brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_WEP104\n");
  13309. -- break;
  13310. -- case WLAN_CIPHER_SUITE_TKIP:
  13311. -- key.algo = CRYPTO_ALGO_TKIP;
  13312. -- brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_TKIP\n");
  13313. -- break;
  13314. -- case WLAN_CIPHER_SUITE_AES_CMAC:
  13315. -- key.algo = CRYPTO_ALGO_AES_CCM;
  13316. -- brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_AES_CMAC\n");
  13317. -- break;
  13318. -- case WLAN_CIPHER_SUITE_CCMP:
  13319. -- key.algo = CRYPTO_ALGO_AES_CCM;
  13320. -- brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_CCMP\n");
  13321. -- break;
  13322. -- default:
  13323. -- brcmf_err("Invalid cipher (0x%x)\n", params->cipher);
  13324. -- return -EINVAL;
  13325. -- }
  13326. -- err = send_key_to_dongle(ifp, &key);
  13327. -- if (err)
  13328. -- brcmf_err("wsec_key error (%d)\n", err);
  13329. -- }
  13330. -+ brcmf_dbg(TRACE, "Exit\n");
  13331. - return err;
  13332. - }
  13333. -
  13334. -@@ -2163,8 +2113,9 @@ brcmf_cfg80211_add_key(struct wiphy *wip
  13335. - struct brcmf_wsec_key *key;
  13336. - s32 val;
  13337. - s32 wsec;
  13338. -- s32 err = 0;
  13339. -+ s32 err;
  13340. - u8 keybuf[8];
  13341. -+ bool ext_key;
  13342. -
  13343. - brcmf_dbg(TRACE, "Enter\n");
  13344. - brcmf_dbg(CONN, "key index (%d)\n", key_idx);
  13345. -@@ -2177,27 +2128,32 @@ brcmf_cfg80211_add_key(struct wiphy *wip
  13346. - return -EINVAL;
  13347. - }
  13348. -
  13349. -- if (mac_addr &&
  13350. -- (params->cipher != WLAN_CIPHER_SUITE_WEP40) &&
  13351. -- (params->cipher != WLAN_CIPHER_SUITE_WEP104)) {
  13352. -- brcmf_dbg(TRACE, "Exit");
  13353. -- return brcmf_add_keyext(wiphy, ndev, key_idx, mac_addr, params);
  13354. -- }
  13355. --
  13356. -- key = &ifp->vif->profile.key[key_idx];
  13357. -- memset(key, 0, sizeof(*key));
  13358. -+ if (params->key_len == 0)
  13359. -+ return brcmf_cfg80211_del_key(wiphy, ndev, key_idx, pairwise,
  13360. -+ mac_addr);
  13361. -
  13362. - if (params->key_len > sizeof(key->data)) {
  13363. - brcmf_err("Too long key length (%u)\n", params->key_len);
  13364. -- err = -EINVAL;
  13365. -- goto done;
  13366. -+ return -EINVAL;
  13367. -+ }
  13368. -+
  13369. -+ ext_key = false;
  13370. -+ if (mac_addr && (params->cipher != WLAN_CIPHER_SUITE_WEP40) &&
  13371. -+ (params->cipher != WLAN_CIPHER_SUITE_WEP104)) {
  13372. -+ brcmf_dbg(TRACE, "Ext key, mac %pM", mac_addr);
  13373. -+ ext_key = true;
  13374. - }
  13375. -+
  13376. -+ key = &ifp->vif->profile.key[key_idx];
  13377. -+ memset(key, 0, sizeof(*key));
  13378. -+ if ((ext_key) && (!is_multicast_ether_addr(mac_addr)))
  13379. -+ memcpy((char *)&key->ea, (void *)mac_addr, ETH_ALEN);
  13380. - key->len = params->key_len;
  13381. - key->index = key_idx;
  13382. --
  13383. - memcpy(key->data, params->key, key->len);
  13384. -+ if (!ext_key)
  13385. -+ key->flags = BRCMF_PRIMARY_KEY;
  13386. -
  13387. -- key->flags = BRCMF_PRIMARY_KEY;
  13388. - switch (params->cipher) {
  13389. - case WLAN_CIPHER_SUITE_WEP40:
  13390. - key->algo = CRYPTO_ALGO_WEP1;
  13391. -@@ -2237,7 +2193,7 @@ brcmf_cfg80211_add_key(struct wiphy *wip
  13392. - }
  13393. -
  13394. - err = send_key_to_dongle(ifp, key);
  13395. -- if (err)
  13396. -+ if (ext_key || err)
  13397. - goto done;
  13398. -
  13399. - err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
  13400. -@@ -2256,38 +2212,6 @@ done:
  13401. - brcmf_dbg(TRACE, "Exit\n");
  13402. - return err;
  13403. - }
  13404. --
  13405. --static s32
  13406. --brcmf_cfg80211_del_key(struct wiphy *wiphy, struct net_device *ndev,
  13407. -- u8 key_idx, bool pairwise, const u8 *mac_addr)
  13408. --{
  13409. -- struct brcmf_if *ifp = netdev_priv(ndev);
  13410. -- struct brcmf_wsec_key key;
  13411. -- s32 err = 0;
  13412. --
  13413. -- brcmf_dbg(TRACE, "Enter\n");
  13414. -- if (!check_vif_up(ifp->vif))
  13415. -- return -EIO;
  13416. --
  13417. -- if (key_idx >= BRCMF_MAX_DEFAULT_KEYS) {
  13418. -- /* we ignore this key index in this case */
  13419. -- return -EINVAL;
  13420. -- }
  13421. --
  13422. -- memset(&key, 0, sizeof(key));
  13423. --
  13424. -- key.index = (u32) key_idx;
  13425. -- key.flags = BRCMF_PRIMARY_KEY;
  13426. -- key.algo = CRYPTO_ALGO_OFF;
  13427. --
  13428. -- brcmf_dbg(CONN, "key index (%d)\n", key_idx);
  13429. --
  13430. -- /* Set the new key/index */
  13431. -- err = send_key_to_dongle(ifp, &key);
  13432. --
  13433. -- brcmf_dbg(TRACE, "Exit\n");
  13434. -- return err;
  13435. --}
  13436. -
  13437. - static s32
  13438. - brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev,
  13439. diff --git a/package/kernel/mac80211/patches/344-0020-brcmfmac-add-802.11w-management-frame-protection-sup.patch b/package/kernel/mac80211/patches/344-0020-brcmfmac-add-802.11w-management-frame-protection-sup.patch
  13440. deleted file mode 100644
  13441. index c20d40c..0000000
  13442. --- a/package/kernel/mac80211/patches/344-0020-brcmfmac-add-802.11w-management-frame-protection-sup.patch
  13443. +++ /dev/null
  13444. @@ -1,509 +0,0 @@
  13445. -From: Hante Meuleman <hante.meuleman@broadcom.com>
  13446. -Date: Wed, 17 Feb 2016 11:27:10 +0100
  13447. -Subject: [PATCH] brcmfmac: add 802.11w management frame protection support
  13448. -
  13449. -Add full support for both AP and STA for management frame protection.
  13450. -
  13451. -Reviewed-by: Arend Van Spriel <arend.van@broadcom.com>
  13452. -Reviewed-by: Franky (Zhenhui) Lin <franky.lin@broadcom.com>
  13453. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  13454. -Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
  13455. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  13456. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13457. ----
  13458. -
  13459. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  13460. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  13461. -@@ -72,8 +72,13 @@
  13462. - #define RSN_AKM_NONE 0 /* None (IBSS) */
  13463. - #define RSN_AKM_UNSPECIFIED 1 /* Over 802.1x */
  13464. - #define RSN_AKM_PSK 2 /* Pre-shared Key */
  13465. -+#define RSN_AKM_SHA256_1X 5 /* SHA256, 802.1X */
  13466. -+#define RSN_AKM_SHA256_PSK 6 /* SHA256, Pre-shared Key */
  13467. - #define RSN_CAP_LEN 2 /* Length of RSN capabilities */
  13468. --#define RSN_CAP_PTK_REPLAY_CNTR_MASK 0x000C
  13469. -+#define RSN_CAP_PTK_REPLAY_CNTR_MASK (BIT(2) | BIT(3))
  13470. -+#define RSN_CAP_MFPR_MASK BIT(6)
  13471. -+#define RSN_CAP_MFPC_MASK BIT(7)
  13472. -+#define RSN_PMKID_COUNT_LEN 2
  13473. -
  13474. - #define VNDR_IE_CMD_LEN 4 /* length of the set command
  13475. - * string :"add", "del" (+ NUL)
  13476. -@@ -211,12 +216,19 @@ static const struct ieee80211_regdomain
  13477. - REG_RULE(5470-10, 5850+10, 80, 6, 20, 0), }
  13478. - };
  13479. -
  13480. --static const u32 __wl_cipher_suites[] = {
  13481. -+/* Note: brcmf_cipher_suites is an array of int defining which cipher suites
  13482. -+ * are supported. A pointer to this array and the number of entries is passed
  13483. -+ * on to upper layers. AES_CMAC defines whether or not the driver supports MFP.
  13484. -+ * So the cipher suite AES_CMAC has to be the last one in the array, and when
  13485. -+ * device does not support MFP then the number of suites will be decreased by 1
  13486. -+ */
  13487. -+static const u32 brcmf_cipher_suites[] = {
  13488. - WLAN_CIPHER_SUITE_WEP40,
  13489. - WLAN_CIPHER_SUITE_WEP104,
  13490. - WLAN_CIPHER_SUITE_TKIP,
  13491. - WLAN_CIPHER_SUITE_CCMP,
  13492. -- WLAN_CIPHER_SUITE_AES_CMAC,
  13493. -+ /* Keep as last entry: */
  13494. -+ WLAN_CIPHER_SUITE_AES_CMAC
  13495. - };
  13496. -
  13497. - /* Vendor specific ie. id = 221, oui and type defines exact ie */
  13498. -@@ -1533,7 +1545,7 @@ static s32 brcmf_set_auth_type(struct ne
  13499. -
  13500. - static s32
  13501. - brcmf_set_wsec_mode(struct net_device *ndev,
  13502. -- struct cfg80211_connect_params *sme, bool mfp)
  13503. -+ struct cfg80211_connect_params *sme)
  13504. - {
  13505. - struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
  13506. - struct brcmf_cfg80211_security *sec;
  13507. -@@ -1592,10 +1604,7 @@ brcmf_set_wsec_mode(struct net_device *n
  13508. - sme->privacy)
  13509. - pval = AES_ENABLED;
  13510. -
  13511. -- if (mfp)
  13512. -- wsec = pval | gval | MFP_CAPABLE;
  13513. -- else
  13514. -- wsec = pval | gval;
  13515. -+ wsec = pval | gval;
  13516. - err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "wsec", wsec);
  13517. - if (err) {
  13518. - brcmf_err("error (%d)\n", err);
  13519. -@@ -1612,56 +1621,100 @@ brcmf_set_wsec_mode(struct net_device *n
  13520. - static s32
  13521. - brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme)
  13522. - {
  13523. -- struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
  13524. -- struct brcmf_cfg80211_security *sec;
  13525. -- s32 val = 0;
  13526. -- s32 err = 0;
  13527. -+ struct brcmf_if *ifp = netdev_priv(ndev);
  13528. -+ s32 val;
  13529. -+ s32 err;
  13530. -+ const struct brcmf_tlv *rsn_ie;
  13531. -+ const u8 *ie;
  13532. -+ u32 ie_len;
  13533. -+ u32 offset;
  13534. -+ u16 rsn_cap;
  13535. -+ u32 mfp;
  13536. -+ u16 count;
  13537. -
  13538. -- if (sme->crypto.n_akm_suites) {
  13539. -- err = brcmf_fil_bsscfg_int_get(netdev_priv(ndev),
  13540. -- "wpa_auth", &val);
  13541. -- if (err) {
  13542. -- brcmf_err("could not get wpa_auth (%d)\n", err);
  13543. -- return err;
  13544. -+ if (!sme->crypto.n_akm_suites)
  13545. -+ return 0;
  13546. -+
  13547. -+ err = brcmf_fil_bsscfg_int_get(netdev_priv(ndev), "wpa_auth", &val);
  13548. -+ if (err) {
  13549. -+ brcmf_err("could not get wpa_auth (%d)\n", err);
  13550. -+ return err;
  13551. -+ }
  13552. -+ if (val & (WPA_AUTH_PSK | WPA_AUTH_UNSPECIFIED)) {
  13553. -+ switch (sme->crypto.akm_suites[0]) {
  13554. -+ case WLAN_AKM_SUITE_8021X:
  13555. -+ val = WPA_AUTH_UNSPECIFIED;
  13556. -+ break;
  13557. -+ case WLAN_AKM_SUITE_PSK:
  13558. -+ val = WPA_AUTH_PSK;
  13559. -+ break;
  13560. -+ default:
  13561. -+ brcmf_err("invalid cipher group (%d)\n",
  13562. -+ sme->crypto.cipher_group);
  13563. -+ return -EINVAL;
  13564. - }
  13565. -- if (val & (WPA_AUTH_PSK | WPA_AUTH_UNSPECIFIED)) {
  13566. -- switch (sme->crypto.akm_suites[0]) {
  13567. -- case WLAN_AKM_SUITE_8021X:
  13568. -- val = WPA_AUTH_UNSPECIFIED;
  13569. -- break;
  13570. -- case WLAN_AKM_SUITE_PSK:
  13571. -- val = WPA_AUTH_PSK;
  13572. -- break;
  13573. -- default:
  13574. -- brcmf_err("invalid cipher group (%d)\n",
  13575. -- sme->crypto.cipher_group);
  13576. -- return -EINVAL;
  13577. -- }
  13578. -- } else if (val & (WPA2_AUTH_PSK | WPA2_AUTH_UNSPECIFIED)) {
  13579. -- switch (sme->crypto.akm_suites[0]) {
  13580. -- case WLAN_AKM_SUITE_8021X:
  13581. -- val = WPA2_AUTH_UNSPECIFIED;
  13582. -- break;
  13583. -- case WLAN_AKM_SUITE_PSK:
  13584. -- val = WPA2_AUTH_PSK;
  13585. -- break;
  13586. -- default:
  13587. -- brcmf_err("invalid cipher group (%d)\n",
  13588. -- sme->crypto.cipher_group);
  13589. -- return -EINVAL;
  13590. -- }
  13591. -+ } else if (val & (WPA2_AUTH_PSK | WPA2_AUTH_UNSPECIFIED)) {
  13592. -+ switch (sme->crypto.akm_suites[0]) {
  13593. -+ case WLAN_AKM_SUITE_8021X:
  13594. -+ val = WPA2_AUTH_UNSPECIFIED;
  13595. -+ break;
  13596. -+ case WLAN_AKM_SUITE_8021X_SHA256:
  13597. -+ val = WPA2_AUTH_1X_SHA256;
  13598. -+ break;
  13599. -+ case WLAN_AKM_SUITE_PSK_SHA256:
  13600. -+ val = WPA2_AUTH_PSK_SHA256;
  13601. -+ break;
  13602. -+ case WLAN_AKM_SUITE_PSK:
  13603. -+ val = WPA2_AUTH_PSK;
  13604. -+ break;
  13605. -+ default:
  13606. -+ brcmf_err("invalid cipher group (%d)\n",
  13607. -+ sme->crypto.cipher_group);
  13608. -+ return -EINVAL;
  13609. - }
  13610. -+ }
  13611. -
  13612. -- brcmf_dbg(CONN, "setting wpa_auth to %d\n", val);
  13613. -- err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev),
  13614. -- "wpa_auth", val);
  13615. -- if (err) {
  13616. -- brcmf_err("could not set wpa_auth (%d)\n", err);
  13617. -- return err;
  13618. -- }
  13619. -+ if (!brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MFP))
  13620. -+ goto skip_mfp_config;
  13621. -+ /* The MFP mode (1 or 2) needs to be determined, parse IEs. The
  13622. -+ * IE will not be verified, just a quick search for MFP config
  13623. -+ */
  13624. -+ rsn_ie = brcmf_parse_tlvs((const u8 *)sme->ie, sme->ie_len,
  13625. -+ WLAN_EID_RSN);
  13626. -+ if (!rsn_ie)
  13627. -+ goto skip_mfp_config;
  13628. -+ ie = (const u8 *)rsn_ie;
  13629. -+ ie_len = rsn_ie->len + TLV_HDR_LEN;
  13630. -+ /* Skip unicast suite */
  13631. -+ offset = TLV_HDR_LEN + WPA_IE_VERSION_LEN + WPA_IE_MIN_OUI_LEN;
  13632. -+ if (offset + WPA_IE_SUITE_COUNT_LEN >= ie_len)
  13633. -+ goto skip_mfp_config;
  13634. -+ /* Skip multicast suite */
  13635. -+ count = ie[offset] + (ie[offset + 1] << 8);
  13636. -+ offset += WPA_IE_SUITE_COUNT_LEN + (count * WPA_IE_MIN_OUI_LEN);
  13637. -+ if (offset + WPA_IE_SUITE_COUNT_LEN >= ie_len)
  13638. -+ goto skip_mfp_config;
  13639. -+ /* Skip auth key management suite(s) */
  13640. -+ count = ie[offset] + (ie[offset + 1] << 8);
  13641. -+ offset += WPA_IE_SUITE_COUNT_LEN + (count * WPA_IE_MIN_OUI_LEN);
  13642. -+ if (offset + WPA_IE_SUITE_COUNT_LEN > ie_len)
  13643. -+ goto skip_mfp_config;
  13644. -+ /* Ready to read capabilities */
  13645. -+ mfp = BRCMF_MFP_NONE;
  13646. -+ rsn_cap = ie[offset] + (ie[offset + 1] << 8);
  13647. -+ if (rsn_cap & RSN_CAP_MFPR_MASK)
  13648. -+ mfp = BRCMF_MFP_REQUIRED;
  13649. -+ else if (rsn_cap & RSN_CAP_MFPC_MASK)
  13650. -+ mfp = BRCMF_MFP_CAPABLE;
  13651. -+ brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "mfp", mfp);
  13652. -+
  13653. -+skip_mfp_config:
  13654. -+ brcmf_dbg(CONN, "setting wpa_auth to %d\n", val);
  13655. -+ err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "wpa_auth", val);
  13656. -+ if (err) {
  13657. -+ brcmf_err("could not set wpa_auth (%d)\n", err);
  13658. -+ return err;
  13659. - }
  13660. -- sec = &profile->sec;
  13661. -- sec->wpa_auth = sme->crypto.akm_suites[0];
  13662. -
  13663. - return err;
  13664. - }
  13665. -@@ -1827,7 +1880,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
  13666. - goto done;
  13667. - }
  13668. -
  13669. -- err = brcmf_set_wsec_mode(ndev, sme, sme->mfp == NL80211_MFP_REQUIRED);
  13670. -+ err = brcmf_set_wsec_mode(ndev, sme);
  13671. - if (err) {
  13672. - brcmf_err("wl_set_set_cipher failed (%d)\n", err);
  13673. - goto done;
  13674. -@@ -2077,10 +2130,12 @@ brcmf_cfg80211_del_key(struct wiphy *wip
  13675. - u8 key_idx, bool pairwise, const u8 *mac_addr)
  13676. - {
  13677. - struct brcmf_if *ifp = netdev_priv(ndev);
  13678. -- struct brcmf_wsec_key key;
  13679. -- s32 err = 0;
  13680. -+ struct brcmf_wsec_key *key;
  13681. -+ s32 err;
  13682. -
  13683. - brcmf_dbg(TRACE, "Enter\n");
  13684. -+ brcmf_dbg(CONN, "key index (%d)\n", key_idx);
  13685. -+
  13686. - if (!check_vif_up(ifp->vif))
  13687. - return -EIO;
  13688. -
  13689. -@@ -2089,16 +2144,19 @@ brcmf_cfg80211_del_key(struct wiphy *wip
  13690. - return -EINVAL;
  13691. - }
  13692. -
  13693. -- memset(&key, 0, sizeof(key));
  13694. -+ key = &ifp->vif->profile.key[key_idx];
  13695. -
  13696. -- key.index = (u32)key_idx;
  13697. -- key.flags = BRCMF_PRIMARY_KEY;
  13698. -- key.algo = CRYPTO_ALGO_OFF;
  13699. -+ if (key->algo == CRYPTO_ALGO_OFF) {
  13700. -+ brcmf_dbg(CONN, "Ignore clearing of (never configured) key\n");
  13701. -+ return -EINVAL;
  13702. -+ }
  13703. -
  13704. -- brcmf_dbg(CONN, "key index (%d)\n", key_idx);
  13705. -+ memset(key, 0, sizeof(*key));
  13706. -+ key->index = (u32)key_idx;
  13707. -+ key->flags = BRCMF_PRIMARY_KEY;
  13708. -
  13709. -- /* Set the new key/index */
  13710. -- err = send_key_to_dongle(ifp, &key);
  13711. -+ /* Clear the key/index */
  13712. -+ err = send_key_to_dongle(ifp, key);
  13713. -
  13714. - brcmf_dbg(TRACE, "Exit\n");
  13715. - return err;
  13716. -@@ -2106,8 +2164,8 @@ brcmf_cfg80211_del_key(struct wiphy *wip
  13717. -
  13718. - static s32
  13719. - brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,
  13720. -- u8 key_idx, bool pairwise, const u8 *mac_addr,
  13721. -- struct key_params *params)
  13722. -+ u8 key_idx, bool pairwise, const u8 *mac_addr,
  13723. -+ struct key_params *params)
  13724. - {
  13725. - struct brcmf_if *ifp = netdev_priv(ndev);
  13726. - struct brcmf_wsec_key *key;
  13727. -@@ -2214,9 +2272,10 @@ done:
  13728. - }
  13729. -
  13730. - static s32
  13731. --brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev,
  13732. -- u8 key_idx, bool pairwise, const u8 *mac_addr, void *cookie,
  13733. -- void (*callback) (void *cookie, struct key_params * params))
  13734. -+brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev, u8 key_idx,
  13735. -+ bool pairwise, const u8 *mac_addr, void *cookie,
  13736. -+ void (*callback)(void *cookie,
  13737. -+ struct key_params *params))
  13738. - {
  13739. - struct key_params params;
  13740. - struct brcmf_if *ifp = netdev_priv(ndev);
  13741. -@@ -2268,8 +2327,15 @@ done:
  13742. -
  13743. - static s32
  13744. - brcmf_cfg80211_config_default_mgmt_key(struct wiphy *wiphy,
  13745. -- struct net_device *ndev, u8 key_idx)
  13746. -+ struct net_device *ndev, u8 key_idx)
  13747. - {
  13748. -+ struct brcmf_if *ifp = netdev_priv(ndev);
  13749. -+
  13750. -+ brcmf_dbg(TRACE, "Enter key_idx %d\n", key_idx);
  13751. -+
  13752. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MFP))
  13753. -+ return 0;
  13754. -+
  13755. - brcmf_dbg(INFO, "Not supported\n");
  13756. -
  13757. - return -EOPNOTSUPP;
  13758. -@@ -3769,7 +3835,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
  13759. - u32 auth = 0; /* d11 open authentication */
  13760. - u16 count;
  13761. - s32 err = 0;
  13762. -- s32 len = 0;
  13763. -+ s32 len;
  13764. - u32 i;
  13765. - u32 wsec;
  13766. - u32 pval = 0;
  13767. -@@ -3779,6 +3845,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
  13768. - u8 *data;
  13769. - u16 rsn_cap;
  13770. - u32 wme_bss_disable;
  13771. -+ u32 mfp;
  13772. -
  13773. - brcmf_dbg(TRACE, "Enter\n");
  13774. - if (wpa_ie == NULL)
  13775. -@@ -3893,19 +3960,53 @@ brcmf_configure_wpaie(struct brcmf_if *i
  13776. - is_rsn_ie ? (wpa_auth |= WPA2_AUTH_PSK) :
  13777. - (wpa_auth |= WPA_AUTH_PSK);
  13778. - break;
  13779. -+ case RSN_AKM_SHA256_PSK:
  13780. -+ brcmf_dbg(TRACE, "RSN_AKM_MFP_PSK\n");
  13781. -+ wpa_auth |= WPA2_AUTH_PSK_SHA256;
  13782. -+ break;
  13783. -+ case RSN_AKM_SHA256_1X:
  13784. -+ brcmf_dbg(TRACE, "RSN_AKM_MFP_1X\n");
  13785. -+ wpa_auth |= WPA2_AUTH_1X_SHA256;
  13786. -+ break;
  13787. - default:
  13788. - brcmf_err("Ivalid key mgmt info\n");
  13789. - }
  13790. - offset++;
  13791. - }
  13792. -
  13793. -+ mfp = BRCMF_MFP_NONE;
  13794. - if (is_rsn_ie) {
  13795. - wme_bss_disable = 1;
  13796. - if ((offset + RSN_CAP_LEN) <= len) {
  13797. - rsn_cap = data[offset] + (data[offset + 1] << 8);
  13798. - if (rsn_cap & RSN_CAP_PTK_REPLAY_CNTR_MASK)
  13799. - wme_bss_disable = 0;
  13800. -+ if (rsn_cap & RSN_CAP_MFPR_MASK) {
  13801. -+ brcmf_dbg(TRACE, "MFP Required\n");
  13802. -+ mfp = BRCMF_MFP_REQUIRED;
  13803. -+ /* Firmware only supports mfp required in
  13804. -+ * combination with WPA2_AUTH_PSK_SHA256 or
  13805. -+ * WPA2_AUTH_1X_SHA256.
  13806. -+ */
  13807. -+ if (!(wpa_auth & (WPA2_AUTH_PSK_SHA256 |
  13808. -+ WPA2_AUTH_1X_SHA256))) {
  13809. -+ err = -EINVAL;
  13810. -+ goto exit;
  13811. -+ }
  13812. -+ /* Firmware has requirement that WPA2_AUTH_PSK/
  13813. -+ * WPA2_AUTH_UNSPECIFIED be set, if SHA256 OUI
  13814. -+ * is to be included in the rsn ie.
  13815. -+ */
  13816. -+ if (wpa_auth & WPA2_AUTH_PSK_SHA256)
  13817. -+ wpa_auth |= WPA2_AUTH_PSK;
  13818. -+ else if (wpa_auth & WPA2_AUTH_1X_SHA256)
  13819. -+ wpa_auth |= WPA2_AUTH_UNSPECIFIED;
  13820. -+ } else if (rsn_cap & RSN_CAP_MFPC_MASK) {
  13821. -+ brcmf_dbg(TRACE, "MFP Capable\n");
  13822. -+ mfp = BRCMF_MFP_CAPABLE;
  13823. -+ }
  13824. - }
  13825. -+ offset += RSN_CAP_LEN;
  13826. - /* set wme_bss_disable to sync RSN Capabilities */
  13827. - err = brcmf_fil_bsscfg_int_set(ifp, "wme_bss_disable",
  13828. - wme_bss_disable);
  13829. -@@ -3913,6 +4014,21 @@ brcmf_configure_wpaie(struct brcmf_if *i
  13830. - brcmf_err("wme_bss_disable error %d\n", err);
  13831. - goto exit;
  13832. - }
  13833. -+
  13834. -+ /* Skip PMKID cnt as it is know to be 0 for AP. */
  13835. -+ offset += RSN_PMKID_COUNT_LEN;
  13836. -+
  13837. -+ /* See if there is BIP wpa suite left for MFP */
  13838. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MFP) &&
  13839. -+ ((offset + WPA_IE_MIN_OUI_LEN) <= len)) {
  13840. -+ err = brcmf_fil_bsscfg_data_set(ifp, "bip",
  13841. -+ &data[offset],
  13842. -+ WPA_IE_MIN_OUI_LEN);
  13843. -+ if (err < 0) {
  13844. -+ brcmf_err("bip error %d\n", err);
  13845. -+ goto exit;
  13846. -+ }
  13847. -+ }
  13848. - }
  13849. - /* FOR WPS , set SES_OW_ENABLED */
  13850. - wsec = (pval | gval | SES_OW_ENABLED);
  13851. -@@ -3929,6 +4045,16 @@ brcmf_configure_wpaie(struct brcmf_if *i
  13852. - brcmf_err("wsec error %d\n", err);
  13853. - goto exit;
  13854. - }
  13855. -+ /* Configure MFP, this needs to go after wsec otherwise the wsec command
  13856. -+ * will overwrite the values set by MFP
  13857. -+ */
  13858. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MFP)) {
  13859. -+ err = brcmf_fil_bsscfg_int_set(ifp, "mfp", mfp);
  13860. -+ if (err < 0) {
  13861. -+ brcmf_err("mfp error %d\n", err);
  13862. -+ goto exit;
  13863. -+ }
  13864. -+ }
  13865. - /* set upper-layer auth */
  13866. - err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", wpa_auth);
  13867. - if (err < 0) {
  13868. -@@ -6149,8 +6275,10 @@ static int brcmf_setup_wiphy(struct wiph
  13869. - wiphy->n_addresses = i;
  13870. -
  13871. - wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
  13872. -- wiphy->cipher_suites = __wl_cipher_suites;
  13873. -- wiphy->n_cipher_suites = ARRAY_SIZE(__wl_cipher_suites);
  13874. -+ wiphy->cipher_suites = brcmf_cipher_suites;
  13875. -+ wiphy->n_cipher_suites = ARRAY_SIZE(brcmf_cipher_suites);
  13876. -+ if (!brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MFP))
  13877. -+ wiphy->n_cipher_suites--;
  13878. - wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT |
  13879. - WIPHY_FLAG_OFFCHAN_TX |
  13880. - WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
  13881. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  13882. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  13883. -@@ -72,7 +72,7 @@
  13884. -
  13885. - #define BRCMF_VNDR_IE_P2PAF_SHIFT 12
  13886. -
  13887. --#define BRCMF_MAX_DEFAULT_KEYS 4
  13888. -+#define BRCMF_MAX_DEFAULT_KEYS 6
  13889. -
  13890. - /* beacon loss timeout defaults */
  13891. - #define BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_ON 2
  13892. -@@ -107,7 +107,6 @@ struct brcmf_cfg80211_security {
  13893. - u32 auth_type;
  13894. - u32 cipher_pairwise;
  13895. - u32 cipher_group;
  13896. -- u32 wpa_auth;
  13897. - };
  13898. -
  13899. - /**
  13900. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
  13901. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
  13902. -@@ -161,6 +161,7 @@ void brcmf_feat_attach(struct brcmf_pub
  13903. - ifp->drvr->feat_flags &= ~BIT(BRCMF_FEAT_MBSS);
  13904. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_RSDB, "rsdb_mode");
  13905. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_TDLS, "tdls_enable");
  13906. -+ brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_MFP, "mfp");
  13907. -
  13908. - pfn_mac.version = BRCMF_PFN_MACADDR_CFG_VER;
  13909. - err = brcmf_fil_iovar_data_get(ifp, "pfn_macaddr", &pfn_mac,
  13910. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h
  13911. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h
  13912. -@@ -30,6 +30,7 @@
  13913. - * WOWL_ND: WOWL net detect (PNO)
  13914. - * WOWL_GTK: (WOWL) GTK rekeying offload
  13915. - * WOWL_ARP_ND: ARP and Neighbor Discovery offload support during WOWL.
  13916. -+ * MFP: 802.11w Management Frame Protection.
  13917. - */
  13918. - #define BRCMF_FEAT_LIST \
  13919. - BRCMF_FEAT_DEF(MBSS) \
  13920. -@@ -42,7 +43,8 @@
  13921. - BRCMF_FEAT_DEF(SCAN_RANDOM_MAC) \
  13922. - BRCMF_FEAT_DEF(WOWL_ND) \
  13923. - BRCMF_FEAT_DEF(WOWL_GTK) \
  13924. -- BRCMF_FEAT_DEF(WOWL_ARP_ND)
  13925. -+ BRCMF_FEAT_DEF(WOWL_ARP_ND) \
  13926. -+ BRCMF_FEAT_DEF(MFP)
  13927. -
  13928. - /*
  13929. - * Quirks:
  13930. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h
  13931. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h
  13932. -@@ -142,6 +142,10 @@
  13933. - #define BRCMF_RSN_KEK_LENGTH 16
  13934. - #define BRCMF_RSN_REPLAY_LEN 8
  13935. -
  13936. -+#define BRCMF_MFP_NONE 0
  13937. -+#define BRCMF_MFP_CAPABLE 1
  13938. -+#define BRCMF_MFP_REQUIRED 2
  13939. -+
  13940. - /* join preference types for join_pref iovar */
  13941. - enum brcmf_join_pref_types {
  13942. - BRCMF_JOIN_PREF_RSSI = 1,
  13943. ---- a/drivers/net/wireless/broadcom/brcm80211/include/brcmu_wifi.h
  13944. -+++ b/drivers/net/wireless/broadcom/brcm80211/include/brcmu_wifi.h
  13945. -@@ -236,6 +236,8 @@ static inline bool ac_bitmap_tst(u8 bitm
  13946. - #define WPA2_AUTH_RESERVED3 0x0200
  13947. - #define WPA2_AUTH_RESERVED4 0x0400
  13948. - #define WPA2_AUTH_RESERVED5 0x0800
  13949. -+#define WPA2_AUTH_1X_SHA256 0x1000 /* 1X with SHA256 key derivation */
  13950. -+#define WPA2_AUTH_PSK_SHA256 0x8000 /* PSK with SHA256 key derivation */
  13951. -
  13952. - #define DOT11_DEFAULT_RTS_LEN 2347
  13953. - #define DOT11_DEFAULT_FRAG_LEN 2346
  13954. diff --git a/package/kernel/mac80211/patches/345-brcmfmac-Remove-waitqueue_active-check.patch b/package/kernel/mac80211/patches/345-brcmfmac-Remove-waitqueue_active-check.patch
  13955. deleted file mode 100644
  13956. index 39f4383..0000000
  13957. --- a/package/kernel/mac80211/patches/345-brcmfmac-Remove-waitqueue_active-check.patch
  13958. +++ /dev/null
  13959. @@ -1,54 +0,0 @@
  13960. -From: Hui Wang <hui.wang@canonical.com>
  13961. -Date: Wed, 9 Mar 2016 15:25:26 +0800
  13962. -Subject: [PATCH] brcmfmac: Remove waitqueue_active check
  13963. -
  13964. -We met a problem of pm_suspend when repeated closing/opening the lid
  13965. -on a Lenovo laptop (1/20 reproduce rate), below is the log:
  13966. -
  13967. -[ 199.735876] PM: Entering mem sleep
  13968. -[ 199.750516] e1000e: EEE TX LPI TIMER: 00000011
  13969. -[ 199.856638] Trying to free nonexistent resource <000000000000d000-000000000000d0ff>
  13970. -[ 201.753566] brcmfmac: brcmf_pcie_suspend: Timeout on response for entering D3 substate
  13971. -[ 201.753581] pci_legacy_suspend(): brcmf_pcie_suspend+0x0/0x1f0 [brcmfmac] returns -5
  13972. -[ 201.753585] dpm_run_callback(): pci_pm_suspend+0x0/0x160 returns -5
  13973. -[ 201.753589] PM: Device 0000:04:00.0 failed to suspend async: error -5
  13974. -
  13975. -Through debugging, we found when problem happens, it is not the device
  13976. -fails to enter D3, but the signal D3_ACK comes too early to pass the
  13977. -waitqueue_active() check.
  13978. -
  13979. -Just like this:
  13980. -brcmf_pcie_send_mb_data(devinfo, BRCMF_H2D_HOST_D3_INFORM);
  13981. -// signal is triggered here
  13982. -wait_event_timeout(devinfo->mbdata_resp_wait, devinfo->mbdata_completed,
  13983. - BRCMF_PCIE_MBDATA_TIMEOUT);
  13984. -
  13985. -So far I think it is safe to remove waitqueue_active check since there
  13986. -is only one place to trigger this signal (sending
  13987. -BRCMF_H2D_HOST_D3_INFORM). And it is not a problem calling wake_up
  13988. -event earlier than calling wait_event.
  13989. -
  13990. -Cc: Brett Rudley <brudley@broadcom.com>
  13991. -Cc: Hante Meuleman <meuleman@broadcom.com>
  13992. -Cc: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  13993. -Cc: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  13994. -Cc: Arend van Spriel <arend@broadcom.com>
  13995. -Signed-off-by: Hui Wang <hui.wang@canonical.com>
  13996. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13997. ----
  13998. -
  13999. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  14000. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  14001. -@@ -677,10 +677,8 @@ static void brcmf_pcie_handle_mb_data(st
  14002. - brcmf_dbg(PCIE, "D2H_MB_DATA: DEEP SLEEP EXIT\n");
  14003. - if (dtoh_mb_data & BRCMF_D2H_DEV_D3_ACK) {
  14004. - brcmf_dbg(PCIE, "D2H_MB_DATA: D3 ACK\n");
  14005. -- if (waitqueue_active(&devinfo->mbdata_resp_wait)) {
  14006. -- devinfo->mbdata_completed = true;
  14007. -- wake_up(&devinfo->mbdata_resp_wait);
  14008. -- }
  14009. -+ devinfo->mbdata_completed = true;
  14010. -+ wake_up(&devinfo->mbdata_resp_wait);
  14011. - }
  14012. - }
  14013. -
  14014. diff --git a/package/kernel/mac80211/patches/346-brcmfmac-uninitialized-ret-variable.patch b/package/kernel/mac80211/patches/346-brcmfmac-uninitialized-ret-variable.patch
  14015. deleted file mode 100644
  14016. index 3c9ed42..0000000
  14017. --- a/package/kernel/mac80211/patches/346-brcmfmac-uninitialized-ret-variable.patch
  14018. +++ /dev/null
  14019. @@ -1,21 +0,0 @@
  14020. -From: Dan Carpenter <dan.carpenter@oracle.com>
  14021. -Date: Tue, 15 Mar 2016 10:06:10 +0300
  14022. -Subject: [PATCH] brcmfmac: uninitialized "ret" variable
  14023. -
  14024. -There is an error path where "ret" isn't initialized.
  14025. -
  14026. -Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
  14027. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14028. ----
  14029. -
  14030. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  14031. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  14032. -@@ -250,7 +250,7 @@ static int brcmf_sdiod_request_data(stru
  14033. - u32 addr, u8 regsz, void *data, bool write)
  14034. - {
  14035. - struct sdio_func *func;
  14036. -- int ret;
  14037. -+ int ret = -EINVAL;
  14038. -
  14039. - brcmf_dbg(SDIO, "rw=%d, func=%d, addr=0x%05x, nbytes=%d\n",
  14040. - write, fn, addr, regsz);
  14041. diff --git a/package/kernel/mac80211/patches/347-brcmfmac-sdio-remove-unused-variable-retry_limit.patch b/package/kernel/mac80211/patches/347-brcmfmac-sdio-remove-unused-variable-retry_limit.patch
  14042. deleted file mode 100644
  14043. index d1deb6e..0000000
  14044. --- a/package/kernel/mac80211/patches/347-brcmfmac-sdio-remove-unused-variable-retry_limit.patch
  14045. +++ /dev/null
  14046. @@ -1,24 +0,0 @@
  14047. -From: Colin Ian King <colin.king@canonical.com>
  14048. -Date: Sun, 20 Mar 2016 17:34:52 +0000
  14049. -Subject: [PATCH] brcmfmac: sdio: remove unused variable retry_limit
  14050. -
  14051. -retry_limit has never been used during the life of this driver, so
  14052. -we may as well remove it as it is redundant.
  14053. -
  14054. -Signed-off-by: Colin Ian King <colin.king@canonical.com>
  14055. -Reviewed-by: Julian Calaby <julian.calaby@gmail.com>
  14056. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14057. ----
  14058. -
  14059. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  14060. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  14061. -@@ -535,9 +535,6 @@ static int qcount[NUMPRIO];
  14062. -
  14063. - #define RETRYCHAN(chan) ((chan) == SDPCM_EVENT_CHANNEL)
  14064. -
  14065. --/* Retry count for register access failures */
  14066. --static const uint retry_limit = 2;
  14067. --
  14068. - /* Limit on rounding up frames */
  14069. - static const uint max_roundup = 512;
  14070. -
  14071. diff --git a/package/kernel/mac80211/patches/348-brcmfmac-Delete-unnecessary-variable-initialisation.patch b/package/kernel/mac80211/patches/348-brcmfmac-Delete-unnecessary-variable-initialisation.patch
  14072. deleted file mode 100644
  14073. index d399b26..0000000
  14074. --- a/package/kernel/mac80211/patches/348-brcmfmac-Delete-unnecessary-variable-initialisation.patch
  14075. +++ /dev/null
  14076. @@ -1,26 +0,0 @@
  14077. -From: Markus Elfring <elfring@users.sourceforge.net>
  14078. -Date: Fri, 18 Mar 2016 13:23:24 +1100
  14079. -Subject: [PATCH] brcmfmac: Delete unnecessary variable initialisation
  14080. -
  14081. -In brcmf_sdio_download_firmware(), bcmerror is set by the call to
  14082. -brcmf_sdio_download_code_file(), before it's checked in the following
  14083. -line.
  14084. -
  14085. -Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
  14086. -Acked-by: Arend van Spriel <arend@broadcom.com>
  14087. -[Rewrote commit message]
  14088. -Signed-off-by: Julian Calaby <julian.calaby@gmail.com>
  14089. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14090. ----
  14091. -
  14092. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  14093. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  14094. -@@ -3258,7 +3258,7 @@ static int brcmf_sdio_download_firmware(
  14095. - const struct firmware *fw,
  14096. - void *nvram, u32 nvlen)
  14097. - {
  14098. -- int bcmerror = -EFAULT;
  14099. -+ int bcmerror;
  14100. - u32 rstvec;
  14101. -
  14102. - sdio_claim_host(bus->sdiodev->func[1]);
  14103. diff --git a/package/kernel/mac80211/patches/349-0001-brcmfmac-clear-eventmask-array-before-using-it.patch b/package/kernel/mac80211/patches/349-0001-brcmfmac-clear-eventmask-array-before-using-it.patch
  14104. deleted file mode 100644
  14105. index 0acb4fa..0000000
  14106. --- a/package/kernel/mac80211/patches/349-0001-brcmfmac-clear-eventmask-array-before-using-it.patch
  14107. +++ /dev/null
  14108. @@ -1,27 +0,0 @@
  14109. -From: Hante Meuleman <hante.meuleman@broadcom.com>
  14110. -Date: Mon, 11 Apr 2016 11:35:21 +0200
  14111. -Subject: [PATCH] brcmfmac: clear eventmask array before using it
  14112. -
  14113. -When the event_msgs iovar is set an array is used to configure the
  14114. -enabled events. This arrays needs to nulled before configuring
  14115. -otherwise unhandled events will be enabled. This solves a problem
  14116. -where in case of wowl the host got woken by an incorrectly enabled
  14117. -event.
  14118. -
  14119. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  14120. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  14121. -Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
  14122. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14123. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14124. ----
  14125. -
  14126. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  14127. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  14128. -@@ -371,6 +371,7 @@ int brcmf_fweh_activate_events(struct br
  14129. - int i, err;
  14130. - s8 eventmask[BRCMF_EVENTING_MASK_LEN];
  14131. -
  14132. -+ memset(eventmask, 0, sizeof(eventmask));
  14133. - for (i = 0; i < BRCMF_E_LAST; i++) {
  14134. - if (ifp->drvr->fweh.evt_handler[i]) {
  14135. - brcmf_dbg(EVENT, "enable event %s\n",
  14136. diff --git a/package/kernel/mac80211/patches/349-0002-brcmfmac-fix-clearing-wowl-wake-indicators.patch b/package/kernel/mac80211/patches/349-0002-brcmfmac-fix-clearing-wowl-wake-indicators.patch
  14137. deleted file mode 100644
  14138. index 8d30678..0000000
  14139. --- a/package/kernel/mac80211/patches/349-0002-brcmfmac-fix-clearing-wowl-wake-indicators.patch
  14140. +++ /dev/null
  14141. @@ -1,27 +0,0 @@
  14142. -From: Hante Meuleman <hante.meuleman@broadcom.com>
  14143. -Date: Mon, 11 Apr 2016 11:35:22 +0200
  14144. -Subject: [PATCH] brcmfmac: fix clearing wowl wake indicators
  14145. -
  14146. -Newer firmwares require the usage of the wowl wakeind struct as size
  14147. -for the iovar to clear the wake indicators. Older firmwares do not
  14148. -care, so change the used size.
  14149. -
  14150. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  14151. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  14152. -Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
  14153. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14154. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14155. ----
  14156. -
  14157. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  14158. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  14159. -@@ -3608,7 +3608,8 @@ static void brcmf_configure_wowl(struct
  14160. - if (!test_bit(BRCMF_VIF_STATUS_CONNECTED, &ifp->vif->sme_state))
  14161. - wowl_config |= BRCMF_WOWL_UNASSOC;
  14162. -
  14163. -- brcmf_fil_iovar_data_set(ifp, "wowl_wakeind", "clear", strlen("clear"));
  14164. -+ brcmf_fil_iovar_data_set(ifp, "wowl_wakeind", "clear",
  14165. -+ sizeof(struct brcmf_wowl_wakeind_le));
  14166. - brcmf_fil_iovar_int_set(ifp, "wowl", wowl_config);
  14167. - brcmf_fil_iovar_int_set(ifp, "wowl_activate", 1);
  14168. - brcmf_bus_wowl_config(cfg->pub->bus_if, true);
  14169. diff --git a/package/kernel/mac80211/patches/349-0003-brcmfmac-insert-default-boardrev-in-nvram-data-if-mi.patch b/package/kernel/mac80211/patches/349-0003-brcmfmac-insert-default-boardrev-in-nvram-data-if-mi.patch
  14170. deleted file mode 100644
  14171. index f293401..0000000
  14172. --- a/package/kernel/mac80211/patches/349-0003-brcmfmac-insert-default-boardrev-in-nvram-data-if-mi.patch
  14173. +++ /dev/null
  14174. @@ -1,114 +0,0 @@
  14175. -From: Hante Meuleman <hante.meuleman@broadcom.com>
  14176. -Date: Mon, 11 Apr 2016 11:35:23 +0200
  14177. -Subject: [PATCH] brcmfmac: insert default boardrev in nvram data if
  14178. - missing
  14179. -
  14180. -Some nvram files/stores come without the boardrev information,
  14181. -but firmware requires this to be set. When not found in nvram then
  14182. -add a default boardrev string to the nvram data.
  14183. -
  14184. -Reported-by: Rafal Milecki <zajec5@gmail.com>
  14185. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  14186. -Reviewed-by: Franky (Zhenhui) Lin <franky.lin@broadcom.com>
  14187. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  14188. -Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
  14189. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14190. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14191. ----
  14192. -
  14193. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  14194. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  14195. -@@ -29,6 +29,7 @@
  14196. - #define BRCMF_FW_MAX_NVRAM_SIZE 64000
  14197. - #define BRCMF_FW_NVRAM_DEVPATH_LEN 19 /* devpath0=pcie/1/4/ */
  14198. - #define BRCMF_FW_NVRAM_PCIEDEV_LEN 10 /* pcie/1/4/ + \0 */
  14199. -+#define BRCMF_FW_DEFAULT_BOARDREV "boardrev=0xff"
  14200. -
  14201. - enum nvram_parser_state {
  14202. - IDLE,
  14203. -@@ -51,6 +52,7 @@ enum nvram_parser_state {
  14204. - * @entry: start position of key,value entry.
  14205. - * @multi_dev_v1: detect pcie multi device v1 (compressed).
  14206. - * @multi_dev_v2: detect pcie multi device v2.
  14207. -+ * @boardrev_found: nvram contains boardrev information.
  14208. - */
  14209. - struct nvram_parser {
  14210. - enum nvram_parser_state state;
  14211. -@@ -63,6 +65,7 @@ struct nvram_parser {
  14212. - u32 entry;
  14213. - bool multi_dev_v1;
  14214. - bool multi_dev_v2;
  14215. -+ bool boardrev_found;
  14216. - };
  14217. -
  14218. - /**
  14219. -@@ -125,6 +128,8 @@ static enum nvram_parser_state brcmf_nvr
  14220. - nvp->multi_dev_v1 = true;
  14221. - if (strncmp(&nvp->data[nvp->entry], "pcie/", 5) == 0)
  14222. - nvp->multi_dev_v2 = true;
  14223. -+ if (strncmp(&nvp->data[nvp->entry], "boardrev", 8) == 0)
  14224. -+ nvp->boardrev_found = true;
  14225. - } else if (!is_nvram_char(c) || c == ' ') {
  14226. - brcmf_dbg(INFO, "warning: ln=%d:col=%d: '=' expected, skip invalid key entry\n",
  14227. - nvp->line, nvp->column);
  14228. -@@ -284,6 +289,8 @@ static void brcmf_fw_strip_multi_v1(stru
  14229. - while (i < nvp->nvram_len) {
  14230. - if ((nvp->nvram[i] - '0' == id) && (nvp->nvram[i + 1] == ':')) {
  14231. - i += 2;
  14232. -+ if (strncmp(&nvp->nvram[i], "boardrev", 8) == 0)
  14233. -+ nvp->boardrev_found = true;
  14234. - while (nvp->nvram[i] != 0) {
  14235. - nvram[j] = nvp->nvram[i];
  14236. - i++;
  14237. -@@ -335,6 +342,8 @@ static void brcmf_fw_strip_multi_v2(stru
  14238. - while (i < nvp->nvram_len - len) {
  14239. - if (strncmp(&nvp->nvram[i], prefix, len) == 0) {
  14240. - i += len;
  14241. -+ if (strncmp(&nvp->nvram[i], "boardrev", 8) == 0)
  14242. -+ nvp->boardrev_found = true;
  14243. - while (nvp->nvram[i] != 0) {
  14244. - nvram[j] = nvp->nvram[i];
  14245. - i++;
  14246. -@@ -356,6 +365,18 @@ fail:
  14247. - nvp->nvram_len = 0;
  14248. - }
  14249. -
  14250. -+static void brcmf_fw_add_defaults(struct nvram_parser *nvp)
  14251. -+{
  14252. -+ if (nvp->boardrev_found)
  14253. -+ return;
  14254. -+
  14255. -+ memcpy(&nvp->nvram[nvp->nvram_len], &BRCMF_FW_DEFAULT_BOARDREV,
  14256. -+ strlen(BRCMF_FW_DEFAULT_BOARDREV));
  14257. -+ nvp->nvram_len += strlen(BRCMF_FW_DEFAULT_BOARDREV);
  14258. -+ nvp->nvram[nvp->nvram_len] = '\0';
  14259. -+ nvp->nvram_len++;
  14260. -+}
  14261. -+
  14262. - /* brcmf_nvram_strip :Takes a buffer of "<var>=<value>\n" lines read from a fil
  14263. - * and ending in a NUL. Removes carriage returns, empty lines, comment lines,
  14264. - * and converts newlines to NULs. Shortens buffer as needed and pads with NULs.
  14265. -@@ -377,16 +398,21 @@ static void *brcmf_fw_nvram_strip(const
  14266. - if (nvp.state == END)
  14267. - break;
  14268. - }
  14269. -- if (nvp.multi_dev_v1)
  14270. -+ if (nvp.multi_dev_v1) {
  14271. -+ nvp.boardrev_found = false;
  14272. - brcmf_fw_strip_multi_v1(&nvp, domain_nr, bus_nr);
  14273. -- else if (nvp.multi_dev_v2)
  14274. -+ } else if (nvp.multi_dev_v2) {
  14275. -+ nvp.boardrev_found = false;
  14276. - brcmf_fw_strip_multi_v2(&nvp, domain_nr, bus_nr);
  14277. -+ }
  14278. -
  14279. - if (nvp.nvram_len == 0) {
  14280. - kfree(nvp.nvram);
  14281. - return NULL;
  14282. - }
  14283. -
  14284. -+ brcmf_fw_add_defaults(&nvp);
  14285. -+
  14286. - pad = nvp.nvram_len;
  14287. - *new_length = roundup(nvp.nvram_len + 1, 4);
  14288. - while (pad != *new_length) {
  14289. diff --git a/package/kernel/mac80211/patches/349-0004-brcmfmac-fix-p2p-scan-abort-null-pointer-exception.patch b/package/kernel/mac80211/patches/349-0004-brcmfmac-fix-p2p-scan-abort-null-pointer-exception.patch
  14290. deleted file mode 100644
  14291. index ed0c83f..0000000
  14292. --- a/package/kernel/mac80211/patches/349-0004-brcmfmac-fix-p2p-scan-abort-null-pointer-exception.patch
  14293. +++ /dev/null
  14294. @@ -1,29 +0,0 @@
  14295. -From: Hante Meuleman <hante.meuleman@broadcom.com>
  14296. -Date: Mon, 11 Apr 2016 11:35:24 +0200
  14297. -Subject: [PATCH] brcmfmac: fix p2p scan abort null pointer exception
  14298. -
  14299. -When p2p connection setup is performed without having ever done an
  14300. -escan a null pointer exception can occur. This is because the ifp
  14301. -to abort scanning is taken from escan struct while it was never
  14302. -initialized. Fix this by using the primary ifp for scan abort. The
  14303. -abort should still be performed and all scan related commands are
  14304. -performed on primary ifp.
  14305. -
  14306. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  14307. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  14308. -Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
  14309. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14310. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14311. ----
  14312. -
  14313. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  14314. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  14315. -@@ -1266,7 +1266,7 @@ static void
  14316. - brcmf_p2p_stop_wait_next_action_frame(struct brcmf_cfg80211_info *cfg)
  14317. - {
  14318. - struct brcmf_p2p_info *p2p = &cfg->p2p;
  14319. -- struct brcmf_if *ifp = cfg->escan_info.ifp;
  14320. -+ struct brcmf_if *ifp = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif->ifp;
  14321. -
  14322. - if (test_bit(BRCMF_P2P_STATUS_SENDING_ACT_FRAME, &p2p->status) &&
  14323. - (test_bit(BRCMF_P2P_STATUS_ACTION_TX_COMPLETED, &p2p->status) ||
  14324. diff --git a/package/kernel/mac80211/patches/349-0005-brcmfmac-screening-firmware-event-packet.patch b/package/kernel/mac80211/patches/349-0005-brcmfmac-screening-firmware-event-packet.patch
  14325. deleted file mode 100644
  14326. index 4d26404..0000000
  14327. --- a/package/kernel/mac80211/patches/349-0005-brcmfmac-screening-firmware-event-packet.patch
  14328. +++ /dev/null
  14329. @@ -1,297 +0,0 @@
  14330. -From: Franky Lin <franky.lin@broadcom.com>
  14331. -Date: Mon, 11 Apr 2016 11:35:25 +0200
  14332. -Subject: [PATCH] brcmfmac: screening firmware event packet
  14333. -
  14334. -Firmware uses asynchronized events as a communication method to the
  14335. -host. The event packets are marked as ETH_P_LINK_CTL protocol type. For
  14336. -SDIO and PCIe bus, this kind of packets are delivered through virtual
  14337. -event channel not data channel. This patch adds a screening logic to
  14338. -make sure the event handler only processes the events coming from the
  14339. -correct channel.
  14340. -
  14341. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  14342. -Signed-off-by: Franky Lin <franky.lin@broadcom.com>
  14343. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14344. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14345. ----
  14346. -
  14347. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
  14348. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
  14349. -@@ -216,7 +216,9 @@ bool brcmf_c_prec_enq(struct device *dev
  14350. - int prec);
  14351. -
  14352. - /* Receive frame for delivery to OS. Callee disposes of rxp. */
  14353. --void brcmf_rx_frame(struct device *dev, struct sk_buff *rxp);
  14354. -+void brcmf_rx_frame(struct device *dev, struct sk_buff *rxp, bool handle_evnt);
  14355. -+/* Receive async event packet from firmware. Callee disposes of rxp. */
  14356. -+void brcmf_rx_event(struct device *dev, struct sk_buff *rxp);
  14357. -
  14358. - /* Indication from bus module regarding presence/insertion of dongle. */
  14359. - int brcmf_attach(struct device *dev, struct brcmf_mp_device *settings);
  14360. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  14361. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  14362. -@@ -311,16 +311,17 @@ void brcmf_txflowblock(struct device *de
  14363. - brcmf_fws_bus_blocked(drvr, state);
  14364. - }
  14365. -
  14366. --void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb)
  14367. -+void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb,
  14368. -+ bool handle_event)
  14369. - {
  14370. -- skb->dev = ifp->ndev;
  14371. -- skb->protocol = eth_type_trans(skb, skb->dev);
  14372. -+ skb->protocol = eth_type_trans(skb, ifp->ndev);
  14373. -
  14374. - if (skb->pkt_type == PACKET_MULTICAST)
  14375. - ifp->stats.multicast++;
  14376. -
  14377. - /* Process special event packets */
  14378. -- brcmf_fweh_process_skb(ifp->drvr, skb);
  14379. -+ if (handle_event)
  14380. -+ brcmf_fweh_process_skb(ifp->drvr, skb);
  14381. -
  14382. - if (!(ifp->ndev->flags & IFF_UP)) {
  14383. - brcmu_pkt_buf_free_skb(skb);
  14384. -@@ -381,7 +382,7 @@ static void brcmf_rxreorder_process_info
  14385. - /* validate flags and flow id */
  14386. - if (flags == 0xFF) {
  14387. - brcmf_err("invalid flags...so ignore this packet\n");
  14388. -- brcmf_netif_rx(ifp, pkt);
  14389. -+ brcmf_netif_rx(ifp, pkt, false);
  14390. - return;
  14391. - }
  14392. -
  14393. -@@ -393,7 +394,7 @@ static void brcmf_rxreorder_process_info
  14394. - if (rfi == NULL) {
  14395. - brcmf_dbg(INFO, "received flags to cleanup, but no flow (%d) yet\n",
  14396. - flow_id);
  14397. -- brcmf_netif_rx(ifp, pkt);
  14398. -+ brcmf_netif_rx(ifp, pkt, false);
  14399. - return;
  14400. - }
  14401. -
  14402. -@@ -418,7 +419,7 @@ static void brcmf_rxreorder_process_info
  14403. - rfi = kzalloc(buf_size, GFP_ATOMIC);
  14404. - if (rfi == NULL) {
  14405. - brcmf_err("failed to alloc buffer\n");
  14406. -- brcmf_netif_rx(ifp, pkt);
  14407. -+ brcmf_netif_rx(ifp, pkt, false);
  14408. - return;
  14409. - }
  14410. -
  14411. -@@ -532,11 +533,11 @@ static void brcmf_rxreorder_process_info
  14412. - netif_rx:
  14413. - skb_queue_walk_safe(&reorder_list, pkt, pnext) {
  14414. - __skb_unlink(pkt, &reorder_list);
  14415. -- brcmf_netif_rx(ifp, pkt);
  14416. -+ brcmf_netif_rx(ifp, pkt, false);
  14417. - }
  14418. - }
  14419. -
  14420. --void brcmf_rx_frame(struct device *dev, struct sk_buff *skb)
  14421. -+void brcmf_rx_frame(struct device *dev, struct sk_buff *skb, bool handle_evnt)
  14422. - {
  14423. - struct brcmf_if *ifp;
  14424. - struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  14425. -@@ -560,7 +561,32 @@ void brcmf_rx_frame(struct device *dev,
  14426. - if (rd->reorder)
  14427. - brcmf_rxreorder_process_info(ifp, rd->reorder, skb);
  14428. - else
  14429. -- brcmf_netif_rx(ifp, skb);
  14430. -+ brcmf_netif_rx(ifp, skb, handle_evnt);
  14431. -+}
  14432. -+
  14433. -+void brcmf_rx_event(struct device *dev, struct sk_buff *skb)
  14434. -+{
  14435. -+ struct brcmf_if *ifp;
  14436. -+ struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  14437. -+ struct brcmf_pub *drvr = bus_if->drvr;
  14438. -+ int ret;
  14439. -+
  14440. -+ brcmf_dbg(EVENT, "Enter: %s: rxp=%p\n", dev_name(dev), skb);
  14441. -+
  14442. -+ /* process and remove protocol-specific header */
  14443. -+ ret = brcmf_proto_hdrpull(drvr, true, skb, &ifp);
  14444. -+
  14445. -+ if (ret || !ifp || !ifp->ndev) {
  14446. -+ if (ret != -ENODATA && ifp)
  14447. -+ ifp->stats.rx_errors++;
  14448. -+ brcmu_pkt_buf_free_skb(skb);
  14449. -+ return;
  14450. -+ }
  14451. -+
  14452. -+ skb->protocol = eth_type_trans(skb, ifp->ndev);
  14453. -+
  14454. -+ brcmf_fweh_process_skb(ifp->drvr, skb);
  14455. -+ brcmu_pkt_buf_free_skb(skb);
  14456. - }
  14457. -
  14458. - void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success)
  14459. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  14460. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  14461. -@@ -225,7 +225,8 @@ int brcmf_get_next_free_bsscfgidx(struct
  14462. - void brcmf_txflowblock_if(struct brcmf_if *ifp,
  14463. - enum brcmf_netif_stop_reason reason, bool state);
  14464. - void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
  14465. --void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb);
  14466. -+void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb,
  14467. -+ bool handle_event);
  14468. - void brcmf_net_setcarrier(struct brcmf_if *ifp, bool on);
  14469. - int __init brcmf_core_init(void);
  14470. - void __exit brcmf_core_exit(void);
  14471. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  14472. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  14473. -@@ -20,6 +20,7 @@
  14474. -
  14475. - #include <linux/types.h>
  14476. - #include <linux/netdevice.h>
  14477. -+#include <linux/etherdevice.h>
  14478. -
  14479. - #include <brcmu_utils.h>
  14480. - #include <brcmu_wifi.h>
  14481. -@@ -1075,28 +1076,13 @@ static void brcmf_msgbuf_rxbuf_event_pos
  14482. - }
  14483. -
  14484. -
  14485. --static void
  14486. --brcmf_msgbuf_rx_skb(struct brcmf_msgbuf *msgbuf, struct sk_buff *skb,
  14487. -- u8 ifidx)
  14488. --{
  14489. -- struct brcmf_if *ifp;
  14490. --
  14491. -- ifp = brcmf_get_ifp(msgbuf->drvr, ifidx);
  14492. -- if (!ifp || !ifp->ndev) {
  14493. -- brcmf_err("Received pkt for invalid ifidx %d\n", ifidx);
  14494. -- brcmu_pkt_buf_free_skb(skb);
  14495. -- return;
  14496. -- }
  14497. -- brcmf_netif_rx(ifp, skb);
  14498. --}
  14499. --
  14500. --
  14501. - static void brcmf_msgbuf_process_event(struct brcmf_msgbuf *msgbuf, void *buf)
  14502. - {
  14503. - struct msgbuf_rx_event *event;
  14504. - u32 idx;
  14505. - u16 buflen;
  14506. - struct sk_buff *skb;
  14507. -+ struct brcmf_if *ifp;
  14508. -
  14509. - event = (struct msgbuf_rx_event *)buf;
  14510. - idx = le32_to_cpu(event->msg.request_id);
  14511. -@@ -1116,7 +1102,19 @@ static void brcmf_msgbuf_process_event(s
  14512. -
  14513. - skb_trim(skb, buflen);
  14514. -
  14515. -- brcmf_msgbuf_rx_skb(msgbuf, skb, event->msg.ifidx);
  14516. -+ ifp = brcmf_get_ifp(msgbuf->drvr, event->msg.ifidx);
  14517. -+ if (!ifp || !ifp->ndev) {
  14518. -+ brcmf_err("Received pkt for invalid ifidx %d\n",
  14519. -+ event->msg.ifidx);
  14520. -+ goto exit;
  14521. -+ }
  14522. -+
  14523. -+ skb->protocol = eth_type_trans(skb, ifp->ndev);
  14524. -+
  14525. -+ brcmf_fweh_process_skb(ifp->drvr, skb);
  14526. -+
  14527. -+exit:
  14528. -+ brcmu_pkt_buf_free_skb(skb);
  14529. - }
  14530. -
  14531. -
  14532. -@@ -1128,6 +1126,7 @@ brcmf_msgbuf_process_rx_complete(struct
  14533. - u16 data_offset;
  14534. - u16 buflen;
  14535. - u32 idx;
  14536. -+ struct brcmf_if *ifp;
  14537. -
  14538. - brcmf_msgbuf_update_rxbufpost_count(msgbuf, 1);
  14539. -
  14540. -@@ -1148,7 +1147,14 @@ brcmf_msgbuf_process_rx_complete(struct
  14541. -
  14542. - skb_trim(skb, buflen);
  14543. -
  14544. -- brcmf_msgbuf_rx_skb(msgbuf, skb, rx_complete->msg.ifidx);
  14545. -+ ifp = brcmf_get_ifp(msgbuf->drvr, rx_complete->msg.ifidx);
  14546. -+ if (!ifp || !ifp->ndev) {
  14547. -+ brcmf_err("Received pkt for invalid ifidx %d\n",
  14548. -+ rx_complete->msg.ifidx);
  14549. -+ brcmu_pkt_buf_free_skb(skb);
  14550. -+ return;
  14551. -+ }
  14552. -+ brcmf_netif_rx(ifp, skb, false);
  14553. - }
  14554. -
  14555. -
  14556. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  14557. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  14558. -@@ -1294,6 +1294,17 @@ static inline u8 brcmf_sdio_getdatoffset
  14559. - return (u8)((hdrvalue & SDPCM_DOFFSET_MASK) >> SDPCM_DOFFSET_SHIFT);
  14560. - }
  14561. -
  14562. -+static inline bool brcmf_sdio_fromevntchan(u8 *swheader)
  14563. -+{
  14564. -+ u32 hdrvalue;
  14565. -+ u8 ret;
  14566. -+
  14567. -+ hdrvalue = *(u32 *)swheader;
  14568. -+ ret = (u8)((hdrvalue & SDPCM_CHANNEL_MASK) >> SDPCM_CHANNEL_SHIFT);
  14569. -+
  14570. -+ return (ret == SDPCM_EVENT_CHANNEL);
  14571. -+}
  14572. -+
  14573. - static int brcmf_sdio_hdparse(struct brcmf_sdio *bus, u8 *header,
  14574. - struct brcmf_sdio_hdrinfo *rd,
  14575. - enum brcmf_sdio_frmtype type)
  14576. -@@ -1641,7 +1652,11 @@ static u8 brcmf_sdio_rxglom(struct brcmf
  14577. - pfirst->len, pfirst->next,
  14578. - pfirst->prev);
  14579. - skb_unlink(pfirst, &bus->glom);
  14580. -- brcmf_rx_frame(bus->sdiodev->dev, pfirst);
  14581. -+ if (brcmf_sdio_fromevntchan(pfirst->data))
  14582. -+ brcmf_rx_event(bus->sdiodev->dev, pfirst);
  14583. -+ else
  14584. -+ brcmf_rx_frame(bus->sdiodev->dev, pfirst,
  14585. -+ false);
  14586. - bus->sdcnt.rxglompkts++;
  14587. - }
  14588. -
  14589. -@@ -1967,18 +1982,19 @@ static uint brcmf_sdio_readframes(struct
  14590. - __skb_trim(pkt, rd->len);
  14591. - skb_pull(pkt, rd->dat_offset);
  14592. -
  14593. -+ if (pkt->len == 0)
  14594. -+ brcmu_pkt_buf_free_skb(pkt);
  14595. -+ else if (rd->channel == SDPCM_EVENT_CHANNEL)
  14596. -+ brcmf_rx_event(bus->sdiodev->dev, pkt);
  14597. -+ else
  14598. -+ brcmf_rx_frame(bus->sdiodev->dev, pkt,
  14599. -+ false);
  14600. -+
  14601. - /* prepare the descriptor for the next read */
  14602. - rd->len = rd->len_nxtfrm << 4;
  14603. - rd->len_nxtfrm = 0;
  14604. - /* treat all packet as event if we don't know */
  14605. - rd->channel = SDPCM_EVENT_CHANNEL;
  14606. --
  14607. -- if (pkt->len == 0) {
  14608. -- brcmu_pkt_buf_free_skb(pkt);
  14609. -- continue;
  14610. -- }
  14611. --
  14612. -- brcmf_rx_frame(bus->sdiodev->dev, pkt);
  14613. - }
  14614. -
  14615. - rxcount = maxframes - rxleft;
  14616. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
  14617. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
  14618. -@@ -514,7 +514,7 @@ static void brcmf_usb_rx_complete(struct
  14619. -
  14620. - if (devinfo->bus_pub.state == BRCMFMAC_USB_STATE_UP) {
  14621. - skb_put(skb, urb->actual_length);
  14622. -- brcmf_rx_frame(devinfo->dev, skb);
  14623. -+ brcmf_rx_frame(devinfo->dev, skb, true);
  14624. - brcmf_usb_rx_refill(devinfo, req);
  14625. - } else {
  14626. - brcmu_pkt_buf_free_skb(skb);
  14627. diff --git a/package/kernel/mac80211/patches/349-0006-brcmfmac-cleanup-ampdu-rx-host-reorder-code.patch b/package/kernel/mac80211/patches/349-0006-brcmfmac-cleanup-ampdu-rx-host-reorder-code.patch
  14628. deleted file mode 100644
  14629. index 33b263d..0000000
  14630. --- a/package/kernel/mac80211/patches/349-0006-brcmfmac-cleanup-ampdu-rx-host-reorder-code.patch
  14631. +++ /dev/null
  14632. @@ -1,585 +0,0 @@
  14633. -From: Arend van Spriel <arend@broadcom.com>
  14634. -Date: Mon, 11 Apr 2016 11:35:26 +0200
  14635. -Subject: [PATCH] brcmfmac: cleanup ampdu-rx host reorder code
  14636. -
  14637. -The code for ampdu-rx host reorder is related to the firmware signalling
  14638. -supported in BCDC protocol. This change moves the code to fwsignal module.
  14639. -
  14640. -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  14641. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  14642. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  14643. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14644. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14645. ----
  14646. -
  14647. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
  14648. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
  14649. -@@ -351,6 +351,12 @@ brcmf_proto_bcdc_add_tdls_peer(struct br
  14650. - {
  14651. - }
  14652. -
  14653. -+static void brcmf_proto_bcdc_rxreorder(struct brcmf_if *ifp,
  14654. -+ struct sk_buff *skb)
  14655. -+{
  14656. -+ brcmf_fws_rxreorder(ifp, skb);
  14657. -+}
  14658. -+
  14659. - int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr)
  14660. - {
  14661. - struct brcmf_bcdc *bcdc;
  14662. -@@ -372,6 +378,7 @@ int brcmf_proto_bcdc_attach(struct brcmf
  14663. - drvr->proto->configure_addr_mode = brcmf_proto_bcdc_configure_addr_mode;
  14664. - drvr->proto->delete_peer = brcmf_proto_bcdc_delete_peer;
  14665. - drvr->proto->add_tdls_peer = brcmf_proto_bcdc_add_tdls_peer;
  14666. -+ drvr->proto->rxreorder = brcmf_proto_bcdc_rxreorder;
  14667. - drvr->proto->pd = bcdc;
  14668. -
  14669. - drvr->hdrlen += BCDC_HEADER_LEN + BRCMF_PROT_FW_SIGNAL_MAX_TXBYTES;
  14670. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  14671. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  14672. -@@ -40,19 +40,6 @@
  14673. -
  14674. - #define MAX_WAIT_FOR_8021X_TX msecs_to_jiffies(950)
  14675. -
  14676. --/* AMPDU rx reordering definitions */
  14677. --#define BRCMF_RXREORDER_FLOWID_OFFSET 0
  14678. --#define BRCMF_RXREORDER_MAXIDX_OFFSET 2
  14679. --#define BRCMF_RXREORDER_FLAGS_OFFSET 4
  14680. --#define BRCMF_RXREORDER_CURIDX_OFFSET 6
  14681. --#define BRCMF_RXREORDER_EXPIDX_OFFSET 8
  14682. --
  14683. --#define BRCMF_RXREORDER_DEL_FLOW 0x01
  14684. --#define BRCMF_RXREORDER_FLUSH_ALL 0x02
  14685. --#define BRCMF_RXREORDER_CURIDX_VALID 0x04
  14686. --#define BRCMF_RXREORDER_EXPIDX_VALID 0x08
  14687. --#define BRCMF_RXREORDER_NEW_HOLE 0x10
  14688. --
  14689. - #define BRCMF_BSSIDX_INVALID -1
  14690. -
  14691. - char *brcmf_ifname(struct brcmf_if *ifp)
  14692. -@@ -342,207 +329,11 @@ void brcmf_netif_rx(struct brcmf_if *ifp
  14693. - netif_rx_ni(skb);
  14694. - }
  14695. -
  14696. --static void brcmf_rxreorder_get_skb_list(struct brcmf_ampdu_rx_reorder *rfi,
  14697. -- u8 start, u8 end,
  14698. -- struct sk_buff_head *skb_list)
  14699. --{
  14700. -- /* initialize return list */
  14701. -- __skb_queue_head_init(skb_list);
  14702. --
  14703. -- if (rfi->pend_pkts == 0) {
  14704. -- brcmf_dbg(INFO, "no packets in reorder queue\n");
  14705. -- return;
  14706. -- }
  14707. --
  14708. -- do {
  14709. -- if (rfi->pktslots[start]) {
  14710. -- __skb_queue_tail(skb_list, rfi->pktslots[start]);
  14711. -- rfi->pktslots[start] = NULL;
  14712. -- }
  14713. -- start++;
  14714. -- if (start > rfi->max_idx)
  14715. -- start = 0;
  14716. -- } while (start != end);
  14717. -- rfi->pend_pkts -= skb_queue_len(skb_list);
  14718. --}
  14719. --
  14720. --static void brcmf_rxreorder_process_info(struct brcmf_if *ifp, u8 *reorder_data,
  14721. -- struct sk_buff *pkt)
  14722. --{
  14723. -- u8 flow_id, max_idx, cur_idx, exp_idx, end_idx;
  14724. -- struct brcmf_ampdu_rx_reorder *rfi;
  14725. -- struct sk_buff_head reorder_list;
  14726. -- struct sk_buff *pnext;
  14727. -- u8 flags;
  14728. -- u32 buf_size;
  14729. --
  14730. -- flow_id = reorder_data[BRCMF_RXREORDER_FLOWID_OFFSET];
  14731. -- flags = reorder_data[BRCMF_RXREORDER_FLAGS_OFFSET];
  14732. --
  14733. -- /* validate flags and flow id */
  14734. -- if (flags == 0xFF) {
  14735. -- brcmf_err("invalid flags...so ignore this packet\n");
  14736. -- brcmf_netif_rx(ifp, pkt, false);
  14737. -- return;
  14738. -- }
  14739. --
  14740. -- rfi = ifp->drvr->reorder_flows[flow_id];
  14741. -- if (flags & BRCMF_RXREORDER_DEL_FLOW) {
  14742. -- brcmf_dbg(INFO, "flow-%d: delete\n",
  14743. -- flow_id);
  14744. --
  14745. -- if (rfi == NULL) {
  14746. -- brcmf_dbg(INFO, "received flags to cleanup, but no flow (%d) yet\n",
  14747. -- flow_id);
  14748. -- brcmf_netif_rx(ifp, pkt, false);
  14749. -- return;
  14750. -- }
  14751. --
  14752. -- brcmf_rxreorder_get_skb_list(rfi, rfi->exp_idx, rfi->exp_idx,
  14753. -- &reorder_list);
  14754. -- /* add the last packet */
  14755. -- __skb_queue_tail(&reorder_list, pkt);
  14756. -- kfree(rfi);
  14757. -- ifp->drvr->reorder_flows[flow_id] = NULL;
  14758. -- goto netif_rx;
  14759. -- }
  14760. -- /* from here on we need a flow reorder instance */
  14761. -- if (rfi == NULL) {
  14762. -- buf_size = sizeof(*rfi);
  14763. -- max_idx = reorder_data[BRCMF_RXREORDER_MAXIDX_OFFSET];
  14764. --
  14765. -- buf_size += (max_idx + 1) * sizeof(pkt);
  14766. --
  14767. -- /* allocate space for flow reorder info */
  14768. -- brcmf_dbg(INFO, "flow-%d: start, maxidx %d\n",
  14769. -- flow_id, max_idx);
  14770. -- rfi = kzalloc(buf_size, GFP_ATOMIC);
  14771. -- if (rfi == NULL) {
  14772. -- brcmf_err("failed to alloc buffer\n");
  14773. -- brcmf_netif_rx(ifp, pkt, false);
  14774. -- return;
  14775. -- }
  14776. --
  14777. -- ifp->drvr->reorder_flows[flow_id] = rfi;
  14778. -- rfi->pktslots = (struct sk_buff **)(rfi+1);
  14779. -- rfi->max_idx = max_idx;
  14780. -- }
  14781. -- if (flags & BRCMF_RXREORDER_NEW_HOLE) {
  14782. -- if (rfi->pend_pkts) {
  14783. -- brcmf_rxreorder_get_skb_list(rfi, rfi->exp_idx,
  14784. -- rfi->exp_idx,
  14785. -- &reorder_list);
  14786. -- WARN_ON(rfi->pend_pkts);
  14787. -- } else {
  14788. -- __skb_queue_head_init(&reorder_list);
  14789. -- }
  14790. -- rfi->cur_idx = reorder_data[BRCMF_RXREORDER_CURIDX_OFFSET];
  14791. -- rfi->exp_idx = reorder_data[BRCMF_RXREORDER_EXPIDX_OFFSET];
  14792. -- rfi->max_idx = reorder_data[BRCMF_RXREORDER_MAXIDX_OFFSET];
  14793. -- rfi->pktslots[rfi->cur_idx] = pkt;
  14794. -- rfi->pend_pkts++;
  14795. -- brcmf_dbg(DATA, "flow-%d: new hole %d (%d), pending %d\n",
  14796. -- flow_id, rfi->cur_idx, rfi->exp_idx, rfi->pend_pkts);
  14797. -- } else if (flags & BRCMF_RXREORDER_CURIDX_VALID) {
  14798. -- cur_idx = reorder_data[BRCMF_RXREORDER_CURIDX_OFFSET];
  14799. -- exp_idx = reorder_data[BRCMF_RXREORDER_EXPIDX_OFFSET];
  14800. --
  14801. -- if ((exp_idx == rfi->exp_idx) && (cur_idx != rfi->exp_idx)) {
  14802. -- /* still in the current hole */
  14803. -- /* enqueue the current on the buffer chain */
  14804. -- if (rfi->pktslots[cur_idx] != NULL) {
  14805. -- brcmf_dbg(INFO, "HOLE: ERROR buffer pending..free it\n");
  14806. -- brcmu_pkt_buf_free_skb(rfi->pktslots[cur_idx]);
  14807. -- rfi->pktslots[cur_idx] = NULL;
  14808. -- }
  14809. -- rfi->pktslots[cur_idx] = pkt;
  14810. -- rfi->pend_pkts++;
  14811. -- rfi->cur_idx = cur_idx;
  14812. -- brcmf_dbg(DATA, "flow-%d: store pkt %d (%d), pending %d\n",
  14813. -- flow_id, cur_idx, exp_idx, rfi->pend_pkts);
  14814. --
  14815. -- /* can return now as there is no reorder
  14816. -- * list to process.
  14817. -- */
  14818. -- return;
  14819. -- }
  14820. -- if (rfi->exp_idx == cur_idx) {
  14821. -- if (rfi->pktslots[cur_idx] != NULL) {
  14822. -- brcmf_dbg(INFO, "error buffer pending..free it\n");
  14823. -- brcmu_pkt_buf_free_skb(rfi->pktslots[cur_idx]);
  14824. -- rfi->pktslots[cur_idx] = NULL;
  14825. -- }
  14826. -- rfi->pktslots[cur_idx] = pkt;
  14827. -- rfi->pend_pkts++;
  14828. --
  14829. -- /* got the expected one. flush from current to expected
  14830. -- * and update expected
  14831. -- */
  14832. -- brcmf_dbg(DATA, "flow-%d: expected %d (%d), pending %d\n",
  14833. -- flow_id, cur_idx, exp_idx, rfi->pend_pkts);
  14834. --
  14835. -- rfi->cur_idx = cur_idx;
  14836. -- rfi->exp_idx = exp_idx;
  14837. --
  14838. -- brcmf_rxreorder_get_skb_list(rfi, cur_idx, exp_idx,
  14839. -- &reorder_list);
  14840. -- brcmf_dbg(DATA, "flow-%d: freeing buffers %d, pending %d\n",
  14841. -- flow_id, skb_queue_len(&reorder_list),
  14842. -- rfi->pend_pkts);
  14843. -- } else {
  14844. -- u8 end_idx;
  14845. --
  14846. -- brcmf_dbg(DATA, "flow-%d (0x%x): both moved, old %d/%d, new %d/%d\n",
  14847. -- flow_id, flags, rfi->cur_idx, rfi->exp_idx,
  14848. -- cur_idx, exp_idx);
  14849. -- if (flags & BRCMF_RXREORDER_FLUSH_ALL)
  14850. -- end_idx = rfi->exp_idx;
  14851. -- else
  14852. -- end_idx = exp_idx;
  14853. --
  14854. -- /* flush pkts first */
  14855. -- brcmf_rxreorder_get_skb_list(rfi, rfi->exp_idx, end_idx,
  14856. -- &reorder_list);
  14857. --
  14858. -- if (exp_idx == ((cur_idx + 1) % (rfi->max_idx + 1))) {
  14859. -- __skb_queue_tail(&reorder_list, pkt);
  14860. -- } else {
  14861. -- rfi->pktslots[cur_idx] = pkt;
  14862. -- rfi->pend_pkts++;
  14863. -- }
  14864. -- rfi->exp_idx = exp_idx;
  14865. -- rfi->cur_idx = cur_idx;
  14866. -- }
  14867. -- } else {
  14868. -- /* explicity window move updating the expected index */
  14869. -- exp_idx = reorder_data[BRCMF_RXREORDER_EXPIDX_OFFSET];
  14870. --
  14871. -- brcmf_dbg(DATA, "flow-%d (0x%x): change expected: %d -> %d\n",
  14872. -- flow_id, flags, rfi->exp_idx, exp_idx);
  14873. -- if (flags & BRCMF_RXREORDER_FLUSH_ALL)
  14874. -- end_idx = rfi->exp_idx;
  14875. -- else
  14876. -- end_idx = exp_idx;
  14877. --
  14878. -- brcmf_rxreorder_get_skb_list(rfi, rfi->exp_idx, end_idx,
  14879. -- &reorder_list);
  14880. -- __skb_queue_tail(&reorder_list, pkt);
  14881. -- /* set the new expected idx */
  14882. -- rfi->exp_idx = exp_idx;
  14883. -- }
  14884. --netif_rx:
  14885. -- skb_queue_walk_safe(&reorder_list, pkt, pnext) {
  14886. -- __skb_unlink(pkt, &reorder_list);
  14887. -- brcmf_netif_rx(ifp, pkt, false);
  14888. -- }
  14889. --}
  14890. --
  14891. - void brcmf_rx_frame(struct device *dev, struct sk_buff *skb, bool handle_evnt)
  14892. - {
  14893. - struct brcmf_if *ifp;
  14894. - struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  14895. - struct brcmf_pub *drvr = bus_if->drvr;
  14896. -- struct brcmf_skb_reorder_data *rd;
  14897. - int ret;
  14898. -
  14899. - brcmf_dbg(DATA, "Enter: %s: rxp=%p\n", dev_name(dev), skb);
  14900. -@@ -557,9 +348,8 @@ void brcmf_rx_frame(struct device *dev,
  14901. - return;
  14902. - }
  14903. -
  14904. -- rd = (struct brcmf_skb_reorder_data *)skb->cb;
  14905. -- if (rd->reorder)
  14906. -- brcmf_rxreorder_process_info(ifp, rd->reorder, skb);
  14907. -+ if (brcmf_proto_is_reorder_skb(skb))
  14908. -+ brcmf_proto_rxreorder(ifp, skb);
  14909. - else
  14910. - brcmf_netif_rx(ifp, skb, handle_evnt);
  14911. - }
  14912. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  14913. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  14914. -@@ -208,10 +208,6 @@ struct brcmf_if {
  14915. - u8 ipv6addr_idx;
  14916. - };
  14917. -
  14918. --struct brcmf_skb_reorder_data {
  14919. -- u8 *reorder;
  14920. --};
  14921. --
  14922. - int brcmf_netdev_wait_pend8021x(struct brcmf_if *ifp);
  14923. -
  14924. - /* Return pointer to interface name */
  14925. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
  14926. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
  14927. -@@ -92,6 +92,19 @@ enum brcmf_fws_tlv_len {
  14928. - };
  14929. - #undef BRCMF_FWS_TLV_DEF
  14930. -
  14931. -+/* AMPDU rx reordering definitions */
  14932. -+#define BRCMF_RXREORDER_FLOWID_OFFSET 0
  14933. -+#define BRCMF_RXREORDER_MAXIDX_OFFSET 2
  14934. -+#define BRCMF_RXREORDER_FLAGS_OFFSET 4
  14935. -+#define BRCMF_RXREORDER_CURIDX_OFFSET 6
  14936. -+#define BRCMF_RXREORDER_EXPIDX_OFFSET 8
  14937. -+
  14938. -+#define BRCMF_RXREORDER_DEL_FLOW 0x01
  14939. -+#define BRCMF_RXREORDER_FLUSH_ALL 0x02
  14940. -+#define BRCMF_RXREORDER_CURIDX_VALID 0x04
  14941. -+#define BRCMF_RXREORDER_EXPIDX_VALID 0x08
  14942. -+#define BRCMF_RXREORDER_NEW_HOLE 0x10
  14943. -+
  14944. - #ifdef DEBUG
  14945. - /*
  14946. - * brcmf_fws_tlv_names - array of tlv names.
  14947. -@@ -1614,6 +1627,202 @@ static int brcmf_fws_notify_bcmc_credit_
  14948. - return 0;
  14949. - }
  14950. -
  14951. -+static void brcmf_rxreorder_get_skb_list(struct brcmf_ampdu_rx_reorder *rfi,
  14952. -+ u8 start, u8 end,
  14953. -+ struct sk_buff_head *skb_list)
  14954. -+{
  14955. -+ /* initialize return list */
  14956. -+ __skb_queue_head_init(skb_list);
  14957. -+
  14958. -+ if (rfi->pend_pkts == 0) {
  14959. -+ brcmf_dbg(INFO, "no packets in reorder queue\n");
  14960. -+ return;
  14961. -+ }
  14962. -+
  14963. -+ do {
  14964. -+ if (rfi->pktslots[start]) {
  14965. -+ __skb_queue_tail(skb_list, rfi->pktslots[start]);
  14966. -+ rfi->pktslots[start] = NULL;
  14967. -+ }
  14968. -+ start++;
  14969. -+ if (start > rfi->max_idx)
  14970. -+ start = 0;
  14971. -+ } while (start != end);
  14972. -+ rfi->pend_pkts -= skb_queue_len(skb_list);
  14973. -+}
  14974. -+
  14975. -+void brcmf_fws_rxreorder(struct brcmf_if *ifp, struct sk_buff *pkt)
  14976. -+{
  14977. -+ u8 *reorder_data;
  14978. -+ u8 flow_id, max_idx, cur_idx, exp_idx, end_idx;
  14979. -+ struct brcmf_ampdu_rx_reorder *rfi;
  14980. -+ struct sk_buff_head reorder_list;
  14981. -+ struct sk_buff *pnext;
  14982. -+ u8 flags;
  14983. -+ u32 buf_size;
  14984. -+
  14985. -+ reorder_data = ((struct brcmf_skb_reorder_data *)pkt->cb)->reorder;
  14986. -+ flow_id = reorder_data[BRCMF_RXREORDER_FLOWID_OFFSET];
  14987. -+ flags = reorder_data[BRCMF_RXREORDER_FLAGS_OFFSET];
  14988. -+
  14989. -+ /* validate flags and flow id */
  14990. -+ if (flags == 0xFF) {
  14991. -+ brcmf_err("invalid flags...so ignore this packet\n");
  14992. -+ brcmf_netif_rx(ifp, pkt, false);
  14993. -+ return;
  14994. -+ }
  14995. -+
  14996. -+ rfi = ifp->drvr->reorder_flows[flow_id];
  14997. -+ if (flags & BRCMF_RXREORDER_DEL_FLOW) {
  14998. -+ brcmf_dbg(INFO, "flow-%d: delete\n",
  14999. -+ flow_id);
  15000. -+
  15001. -+ if (rfi == NULL) {
  15002. -+ brcmf_dbg(INFO, "received flags to cleanup, but no flow (%d) yet\n",
  15003. -+ flow_id);
  15004. -+ brcmf_netif_rx(ifp, pkt, false);
  15005. -+ return;
  15006. -+ }
  15007. -+
  15008. -+ brcmf_rxreorder_get_skb_list(rfi, rfi->exp_idx, rfi->exp_idx,
  15009. -+ &reorder_list);
  15010. -+ /* add the last packet */
  15011. -+ __skb_queue_tail(&reorder_list, pkt);
  15012. -+ kfree(rfi);
  15013. -+ ifp->drvr->reorder_flows[flow_id] = NULL;
  15014. -+ goto netif_rx;
  15015. -+ }
  15016. -+ /* from here on we need a flow reorder instance */
  15017. -+ if (rfi == NULL) {
  15018. -+ buf_size = sizeof(*rfi);
  15019. -+ max_idx = reorder_data[BRCMF_RXREORDER_MAXIDX_OFFSET];
  15020. -+
  15021. -+ buf_size += (max_idx + 1) * sizeof(pkt);
  15022. -+
  15023. -+ /* allocate space for flow reorder info */
  15024. -+ brcmf_dbg(INFO, "flow-%d: start, maxidx %d\n",
  15025. -+ flow_id, max_idx);
  15026. -+ rfi = kzalloc(buf_size, GFP_ATOMIC);
  15027. -+ if (rfi == NULL) {
  15028. -+ brcmf_err("failed to alloc buffer\n");
  15029. -+ brcmf_netif_rx(ifp, pkt, false);
  15030. -+ return;
  15031. -+ }
  15032. -+
  15033. -+ ifp->drvr->reorder_flows[flow_id] = rfi;
  15034. -+ rfi->pktslots = (struct sk_buff **)(rfi + 1);
  15035. -+ rfi->max_idx = max_idx;
  15036. -+ }
  15037. -+ if (flags & BRCMF_RXREORDER_NEW_HOLE) {
  15038. -+ if (rfi->pend_pkts) {
  15039. -+ brcmf_rxreorder_get_skb_list(rfi, rfi->exp_idx,
  15040. -+ rfi->exp_idx,
  15041. -+ &reorder_list);
  15042. -+ WARN_ON(rfi->pend_pkts);
  15043. -+ } else {
  15044. -+ __skb_queue_head_init(&reorder_list);
  15045. -+ }
  15046. -+ rfi->cur_idx = reorder_data[BRCMF_RXREORDER_CURIDX_OFFSET];
  15047. -+ rfi->exp_idx = reorder_data[BRCMF_RXREORDER_EXPIDX_OFFSET];
  15048. -+ rfi->max_idx = reorder_data[BRCMF_RXREORDER_MAXIDX_OFFSET];
  15049. -+ rfi->pktslots[rfi->cur_idx] = pkt;
  15050. -+ rfi->pend_pkts++;
  15051. -+ brcmf_dbg(DATA, "flow-%d: new hole %d (%d), pending %d\n",
  15052. -+ flow_id, rfi->cur_idx, rfi->exp_idx, rfi->pend_pkts);
  15053. -+ } else if (flags & BRCMF_RXREORDER_CURIDX_VALID) {
  15054. -+ cur_idx = reorder_data[BRCMF_RXREORDER_CURIDX_OFFSET];
  15055. -+ exp_idx = reorder_data[BRCMF_RXREORDER_EXPIDX_OFFSET];
  15056. -+
  15057. -+ if ((exp_idx == rfi->exp_idx) && (cur_idx != rfi->exp_idx)) {
  15058. -+ /* still in the current hole */
  15059. -+ /* enqueue the current on the buffer chain */
  15060. -+ if (rfi->pktslots[cur_idx] != NULL) {
  15061. -+ brcmf_dbg(INFO, "HOLE: ERROR buffer pending..free it\n");
  15062. -+ brcmu_pkt_buf_free_skb(rfi->pktslots[cur_idx]);
  15063. -+ rfi->pktslots[cur_idx] = NULL;
  15064. -+ }
  15065. -+ rfi->pktslots[cur_idx] = pkt;
  15066. -+ rfi->pend_pkts++;
  15067. -+ rfi->cur_idx = cur_idx;
  15068. -+ brcmf_dbg(DATA, "flow-%d: store pkt %d (%d), pending %d\n",
  15069. -+ flow_id, cur_idx, exp_idx, rfi->pend_pkts);
  15070. -+
  15071. -+ /* can return now as there is no reorder
  15072. -+ * list to process.
  15073. -+ */
  15074. -+ return;
  15075. -+ }
  15076. -+ if (rfi->exp_idx == cur_idx) {
  15077. -+ if (rfi->pktslots[cur_idx] != NULL) {
  15078. -+ brcmf_dbg(INFO, "error buffer pending..free it\n");
  15079. -+ brcmu_pkt_buf_free_skb(rfi->pktslots[cur_idx]);
  15080. -+ rfi->pktslots[cur_idx] = NULL;
  15081. -+ }
  15082. -+ rfi->pktslots[cur_idx] = pkt;
  15083. -+ rfi->pend_pkts++;
  15084. -+
  15085. -+ /* got the expected one. flush from current to expected
  15086. -+ * and update expected
  15087. -+ */
  15088. -+ brcmf_dbg(DATA, "flow-%d: expected %d (%d), pending %d\n",
  15089. -+ flow_id, cur_idx, exp_idx, rfi->pend_pkts);
  15090. -+
  15091. -+ rfi->cur_idx = cur_idx;
  15092. -+ rfi->exp_idx = exp_idx;
  15093. -+
  15094. -+ brcmf_rxreorder_get_skb_list(rfi, cur_idx, exp_idx,
  15095. -+ &reorder_list);
  15096. -+ brcmf_dbg(DATA, "flow-%d: freeing buffers %d, pending %d\n",
  15097. -+ flow_id, skb_queue_len(&reorder_list),
  15098. -+ rfi->pend_pkts);
  15099. -+ } else {
  15100. -+ u8 end_idx;
  15101. -+
  15102. -+ brcmf_dbg(DATA, "flow-%d (0x%x): both moved, old %d/%d, new %d/%d\n",
  15103. -+ flow_id, flags, rfi->cur_idx, rfi->exp_idx,
  15104. -+ cur_idx, exp_idx);
  15105. -+ if (flags & BRCMF_RXREORDER_FLUSH_ALL)
  15106. -+ end_idx = rfi->exp_idx;
  15107. -+ else
  15108. -+ end_idx = exp_idx;
  15109. -+
  15110. -+ /* flush pkts first */
  15111. -+ brcmf_rxreorder_get_skb_list(rfi, rfi->exp_idx, end_idx,
  15112. -+ &reorder_list);
  15113. -+
  15114. -+ if (exp_idx == ((cur_idx + 1) % (rfi->max_idx + 1))) {
  15115. -+ __skb_queue_tail(&reorder_list, pkt);
  15116. -+ } else {
  15117. -+ rfi->pktslots[cur_idx] = pkt;
  15118. -+ rfi->pend_pkts++;
  15119. -+ }
  15120. -+ rfi->exp_idx = exp_idx;
  15121. -+ rfi->cur_idx = cur_idx;
  15122. -+ }
  15123. -+ } else {
  15124. -+ /* explicity window move updating the expected index */
  15125. -+ exp_idx = reorder_data[BRCMF_RXREORDER_EXPIDX_OFFSET];
  15126. -+
  15127. -+ brcmf_dbg(DATA, "flow-%d (0x%x): change expected: %d -> %d\n",
  15128. -+ flow_id, flags, rfi->exp_idx, exp_idx);
  15129. -+ if (flags & BRCMF_RXREORDER_FLUSH_ALL)
  15130. -+ end_idx = rfi->exp_idx;
  15131. -+ else
  15132. -+ end_idx = exp_idx;
  15133. -+
  15134. -+ brcmf_rxreorder_get_skb_list(rfi, rfi->exp_idx, end_idx,
  15135. -+ &reorder_list);
  15136. -+ __skb_queue_tail(&reorder_list, pkt);
  15137. -+ /* set the new expected idx */
  15138. -+ rfi->exp_idx = exp_idx;
  15139. -+ }
  15140. -+netif_rx:
  15141. -+ skb_queue_walk_safe(&reorder_list, pkt, pnext) {
  15142. -+ __skb_unlink(pkt, &reorder_list);
  15143. -+ brcmf_netif_rx(ifp, pkt, false);
  15144. -+ }
  15145. -+}
  15146. -+
  15147. - void brcmf_fws_hdrpull(struct brcmf_if *ifp, s16 siglen, struct sk_buff *skb)
  15148. - {
  15149. - struct brcmf_skb_reorder_data *rd;
  15150. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.h
  15151. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.h
  15152. -@@ -29,5 +29,6 @@ void brcmf_fws_add_interface(struct brcm
  15153. - void brcmf_fws_del_interface(struct brcmf_if *ifp);
  15154. - void brcmf_fws_bustxfail(struct brcmf_fws_info *fws, struct sk_buff *skb);
  15155. - void brcmf_fws_bus_blocked(struct brcmf_pub *drvr, bool flow_blocked);
  15156. -+void brcmf_fws_rxreorder(struct brcmf_if *ifp, struct sk_buff *skb);
  15157. -
  15158. - #endif /* FWSIGNAL_H_ */
  15159. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  15160. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  15161. -@@ -527,6 +527,9 @@ static int brcmf_msgbuf_hdrpull(struct b
  15162. - return -ENODEV;
  15163. - }
  15164. -
  15165. -+static void brcmf_msgbuf_rxreorder(struct brcmf_if *ifp, struct sk_buff *skb)
  15166. -+{
  15167. -+}
  15168. -
  15169. - static void
  15170. - brcmf_msgbuf_remove_flowring(struct brcmf_msgbuf *msgbuf, u16 flowid)
  15171. -@@ -1466,6 +1469,7 @@ int brcmf_proto_msgbuf_attach(struct brc
  15172. - drvr->proto->configure_addr_mode = brcmf_msgbuf_configure_addr_mode;
  15173. - drvr->proto->delete_peer = brcmf_msgbuf_delete_peer;
  15174. - drvr->proto->add_tdls_peer = brcmf_msgbuf_add_tdls_peer;
  15175. -+ drvr->proto->rxreorder = brcmf_msgbuf_rxreorder;
  15176. - drvr->proto->pd = msgbuf;
  15177. -
  15178. - init_waitqueue_head(&msgbuf->ioctl_resp_wait);
  15179. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h
  15180. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h
  15181. -@@ -22,6 +22,9 @@ enum proto_addr_mode {
  15182. - ADDR_DIRECT
  15183. - };
  15184. -
  15185. -+struct brcmf_skb_reorder_data {
  15186. -+ u8 *reorder;
  15187. -+};
  15188. -
  15189. - struct brcmf_proto {
  15190. - int (*hdrpull)(struct brcmf_pub *drvr, bool do_fws,
  15191. -@@ -38,6 +41,7 @@ struct brcmf_proto {
  15192. - u8 peer[ETH_ALEN]);
  15193. - void (*add_tdls_peer)(struct brcmf_pub *drvr, int ifidx,
  15194. - u8 peer[ETH_ALEN]);
  15195. -+ void (*rxreorder)(struct brcmf_if *ifp, struct sk_buff *skb);
  15196. - void *pd;
  15197. - };
  15198. -
  15199. -@@ -91,6 +95,18 @@ brcmf_proto_add_tdls_peer(struct brcmf_p
  15200. - {
  15201. - drvr->proto->add_tdls_peer(drvr, ifidx, peer);
  15202. - }
  15203. -+static inline bool brcmf_proto_is_reorder_skb(struct sk_buff *skb)
  15204. -+{
  15205. -+ struct brcmf_skb_reorder_data *rd;
  15206. -+
  15207. -+ rd = (struct brcmf_skb_reorder_data *)skb->cb;
  15208. -+ return !!rd->reorder;
  15209. -+}
  15210. -
  15211. -+static inline void
  15212. -+brcmf_proto_rxreorder(struct brcmf_if *ifp, struct sk_buff *skb)
  15213. -+{
  15214. -+ ifp->drvr->proto->rxreorder(ifp, skb);
  15215. -+}
  15216. -
  15217. - #endif /* BRCMFMAC_PROTO_H */
  15218. diff --git a/package/kernel/mac80211/patches/349-0007-brcmfmac-revise-handling-events-in-receive-path.patch b/package/kernel/mac80211/patches/349-0007-brcmfmac-revise-handling-events-in-receive-path.patch
  15219. deleted file mode 100644
  15220. index a43feff..0000000
  15221. --- a/package/kernel/mac80211/patches/349-0007-brcmfmac-revise-handling-events-in-receive-path.patch
  15222. +++ /dev/null
  15223. @@ -1,139 +0,0 @@
  15224. -From: Arend van Spriel <arend@broadcom.com>
  15225. -Date: Mon, 11 Apr 2016 11:35:27 +0200
  15226. -Subject: [PATCH] brcmfmac: revise handling events in receive path
  15227. -
  15228. -Move event handling out of brcmf_netif_rx() avoiding the need
  15229. -to pass a flag. This flag is only ever true for USB hosts as
  15230. -other interface use separate brcmf_rx_event() function.
  15231. -
  15232. -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  15233. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  15234. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  15235. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15236. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15237. ----
  15238. -
  15239. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
  15240. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
  15241. -@@ -216,7 +216,7 @@ bool brcmf_c_prec_enq(struct device *dev
  15242. - int prec);
  15243. -
  15244. - /* Receive frame for delivery to OS. Callee disposes of rxp. */
  15245. --void brcmf_rx_frame(struct device *dev, struct sk_buff *rxp, bool handle_evnt);
  15246. -+void brcmf_rx_frame(struct device *dev, struct sk_buff *rxp, bool handle_event);
  15247. - /* Receive async event packet from firmware. Callee disposes of rxp. */
  15248. - void brcmf_rx_event(struct device *dev, struct sk_buff *rxp);
  15249. -
  15250. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  15251. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  15252. -@@ -298,18 +298,11 @@ void brcmf_txflowblock(struct device *de
  15253. - brcmf_fws_bus_blocked(drvr, state);
  15254. - }
  15255. -
  15256. --void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb,
  15257. -- bool handle_event)
  15258. -+void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb)
  15259. - {
  15260. -- skb->protocol = eth_type_trans(skb, ifp->ndev);
  15261. --
  15262. - if (skb->pkt_type == PACKET_MULTICAST)
  15263. - ifp->stats.multicast++;
  15264. -
  15265. -- /* Process special event packets */
  15266. -- if (handle_event)
  15267. -- brcmf_fweh_process_skb(ifp->drvr, skb);
  15268. --
  15269. - if (!(ifp->ndev->flags & IFF_UP)) {
  15270. - brcmu_pkt_buf_free_skb(skb);
  15271. - return;
  15272. -@@ -329,7 +322,7 @@ void brcmf_netif_rx(struct brcmf_if *ifp
  15273. - netif_rx_ni(skb);
  15274. - }
  15275. -
  15276. --void brcmf_rx_frame(struct device *dev, struct sk_buff *skb, bool handle_evnt)
  15277. -+void brcmf_rx_frame(struct device *dev, struct sk_buff *skb, bool handle_event)
  15278. - {
  15279. - struct brcmf_if *ifp;
  15280. - struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  15281. -@@ -348,10 +341,17 @@ void brcmf_rx_frame(struct device *dev,
  15282. - return;
  15283. - }
  15284. -
  15285. -- if (brcmf_proto_is_reorder_skb(skb))
  15286. -+ skb->protocol = eth_type_trans(skb, ifp->ndev);
  15287. -+
  15288. -+ if (brcmf_proto_is_reorder_skb(skb)) {
  15289. - brcmf_proto_rxreorder(ifp, skb);
  15290. -- else
  15291. -- brcmf_netif_rx(ifp, skb, handle_evnt);
  15292. -+ } else {
  15293. -+ /* Process special event packets */
  15294. -+ if (handle_event)
  15295. -+ brcmf_fweh_process_skb(ifp->drvr, skb);
  15296. -+
  15297. -+ brcmf_netif_rx(ifp, skb);
  15298. -+ }
  15299. - }
  15300. -
  15301. - void brcmf_rx_event(struct device *dev, struct sk_buff *skb)
  15302. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  15303. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  15304. -@@ -221,8 +221,7 @@ int brcmf_get_next_free_bsscfgidx(struct
  15305. - void brcmf_txflowblock_if(struct brcmf_if *ifp,
  15306. - enum brcmf_netif_stop_reason reason, bool state);
  15307. - void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
  15308. --void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb,
  15309. -- bool handle_event);
  15310. -+void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb);
  15311. - void brcmf_net_setcarrier(struct brcmf_if *ifp, bool on);
  15312. - int __init brcmf_core_init(void);
  15313. - void __exit brcmf_core_exit(void);
  15314. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
  15315. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
  15316. -@@ -1668,7 +1668,7 @@ void brcmf_fws_rxreorder(struct brcmf_if
  15317. - /* validate flags and flow id */
  15318. - if (flags == 0xFF) {
  15319. - brcmf_err("invalid flags...so ignore this packet\n");
  15320. -- brcmf_netif_rx(ifp, pkt, false);
  15321. -+ brcmf_netif_rx(ifp, pkt);
  15322. - return;
  15323. - }
  15324. -
  15325. -@@ -1680,7 +1680,7 @@ void brcmf_fws_rxreorder(struct brcmf_if
  15326. - if (rfi == NULL) {
  15327. - brcmf_dbg(INFO, "received flags to cleanup, but no flow (%d) yet\n",
  15328. - flow_id);
  15329. -- brcmf_netif_rx(ifp, pkt, false);
  15330. -+ brcmf_netif_rx(ifp, pkt);
  15331. - return;
  15332. - }
  15333. -
  15334. -@@ -1705,7 +1705,7 @@ void brcmf_fws_rxreorder(struct brcmf_if
  15335. - rfi = kzalloc(buf_size, GFP_ATOMIC);
  15336. - if (rfi == NULL) {
  15337. - brcmf_err("failed to alloc buffer\n");
  15338. -- brcmf_netif_rx(ifp, pkt, false);
  15339. -+ brcmf_netif_rx(ifp, pkt);
  15340. - return;
  15341. - }
  15342. -
  15343. -@@ -1819,7 +1819,7 @@ void brcmf_fws_rxreorder(struct brcmf_if
  15344. - netif_rx:
  15345. - skb_queue_walk_safe(&reorder_list, pkt, pnext) {
  15346. - __skb_unlink(pkt, &reorder_list);
  15347. -- brcmf_netif_rx(ifp, pkt, false);
  15348. -+ brcmf_netif_rx(ifp, pkt);
  15349. - }
  15350. - }
  15351. -
  15352. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  15353. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  15354. -@@ -1157,7 +1157,7 @@ brcmf_msgbuf_process_rx_complete(struct
  15355. - brcmu_pkt_buf_free_skb(skb);
  15356. - return;
  15357. - }
  15358. -- brcmf_netif_rx(ifp, skb, false);
  15359. -+ brcmf_netif_rx(ifp, skb);
  15360. - }
  15361. -
  15362. -
  15363. diff --git a/package/kernel/mac80211/patches/349-0008-brcmfmac-create-common-function-for-handling-brcmf_p.patch b/package/kernel/mac80211/patches/349-0008-brcmfmac-create-common-function-for-handling-brcmf_p.patch
  15364. deleted file mode 100644
  15365. index 08ea235..0000000
  15366. --- a/package/kernel/mac80211/patches/349-0008-brcmfmac-create-common-function-for-handling-brcmf_p.patch
  15367. +++ /dev/null
  15368. @@ -1,88 +0,0 @@
  15369. -From: Arend van Spriel <arend@broadcom.com>
  15370. -Date: Mon, 11 Apr 2016 11:35:28 +0200
  15371. -Subject: [PATCH] brcmfmac: create common function for handling
  15372. - brcmf_proto_hdrpull()
  15373. -
  15374. -In receive path brcmf_proto_hdrpull() needs to be called and handled
  15375. -similar in brcmf_rx_frame() and brcmf_rx_event(). Move that duplicated
  15376. -code in separate function.
  15377. -
  15378. -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  15379. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  15380. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  15381. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15382. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15383. ----
  15384. -
  15385. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  15386. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  15387. -@@ -322,26 +322,35 @@ void brcmf_netif_rx(struct brcmf_if *ifp
  15388. - netif_rx_ni(skb);
  15389. - }
  15390. -
  15391. --void brcmf_rx_frame(struct device *dev, struct sk_buff *skb, bool handle_event)
  15392. -+static int brcmf_rx_hdrpull(struct brcmf_pub *drvr, struct sk_buff *skb,
  15393. -+ struct brcmf_if **ifp)
  15394. - {
  15395. -- struct brcmf_if *ifp;
  15396. -- struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  15397. -- struct brcmf_pub *drvr = bus_if->drvr;
  15398. - int ret;
  15399. -
  15400. -- brcmf_dbg(DATA, "Enter: %s: rxp=%p\n", dev_name(dev), skb);
  15401. --
  15402. - /* process and remove protocol-specific header */
  15403. -- ret = brcmf_proto_hdrpull(drvr, true, skb, &ifp);
  15404. -+ ret = brcmf_proto_hdrpull(drvr, true, skb, ifp);
  15405. -
  15406. -- if (ret || !ifp || !ifp->ndev) {
  15407. -+ if (ret || !(*ifp) || !(*ifp)->ndev) {
  15408. - if (ret != -ENODATA && ifp)
  15409. -- ifp->stats.rx_errors++;
  15410. -+ (*ifp)->stats.rx_errors++;
  15411. - brcmu_pkt_buf_free_skb(skb);
  15412. -- return;
  15413. -+ return -ENODATA;
  15414. - }
  15415. -
  15416. -- skb->protocol = eth_type_trans(skb, ifp->ndev);
  15417. -+ skb->protocol = eth_type_trans(skb, (*ifp)->ndev);
  15418. -+ return 0;
  15419. -+}
  15420. -+
  15421. -+void brcmf_rx_frame(struct device *dev, struct sk_buff *skb, bool handle_event)
  15422. -+{
  15423. -+ struct brcmf_if *ifp;
  15424. -+ struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  15425. -+ struct brcmf_pub *drvr = bus_if->drvr;
  15426. -+
  15427. -+ brcmf_dbg(DATA, "Enter: %s: rxp=%p\n", dev_name(dev), skb);
  15428. -+
  15429. -+ if (brcmf_rx_hdrpull(drvr, skb, &ifp))
  15430. -+ return;
  15431. -
  15432. - if (brcmf_proto_is_reorder_skb(skb)) {
  15433. - brcmf_proto_rxreorder(ifp, skb);
  15434. -@@ -359,21 +368,11 @@ void brcmf_rx_event(struct device *dev,
  15435. - struct brcmf_if *ifp;
  15436. - struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  15437. - struct brcmf_pub *drvr = bus_if->drvr;
  15438. -- int ret;
  15439. -
  15440. - brcmf_dbg(EVENT, "Enter: %s: rxp=%p\n", dev_name(dev), skb);
  15441. -
  15442. -- /* process and remove protocol-specific header */
  15443. -- ret = brcmf_proto_hdrpull(drvr, true, skb, &ifp);
  15444. --
  15445. -- if (ret || !ifp || !ifp->ndev) {
  15446. -- if (ret != -ENODATA && ifp)
  15447. -- ifp->stats.rx_errors++;
  15448. -- brcmu_pkt_buf_free_skb(skb);
  15449. -+ if (brcmf_rx_hdrpull(drvr, skb, &ifp))
  15450. - return;
  15451. -- }
  15452. --
  15453. -- skb->protocol = eth_type_trans(skb, ifp->ndev);
  15454. -
  15455. - brcmf_fweh_process_skb(ifp->drvr, skb);
  15456. - brcmu_pkt_buf_free_skb(skb);
  15457. diff --git a/package/kernel/mac80211/patches/351-0005-brcmfmac-rework-function-picking-free-BSS-index.patch b/package/kernel/mac80211/patches/351-0005-brcmfmac-rework-function-picking-free-BSS-index.patch
  15458. deleted file mode 100644
  15459. index c602f22..0000000
  15460. --- a/package/kernel/mac80211/patches/351-0005-brcmfmac-rework-function-picking-free-BSS-index.patch
  15461. +++ /dev/null
  15462. @@ -1,119 +0,0 @@
  15463. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  15464. -Date: Thu, 26 May 2016 01:44:27 +0200
  15465. -Subject: [PATCH] brcmfmac: rework function picking free BSS index
  15466. -MIME-Version: 1.0
  15467. -Content-Type: text/plain; charset=UTF-8
  15468. -Content-Transfer-Encoding: 8bit
  15469. -
  15470. -The old implementation was overcomplicated and slightly bugged in some
  15471. -corner cases.
  15472. -
  15473. -Consider following state of BSS-es (limited to 6 for simplification):
  15474. -drvr->iflist[0]: { bsscfgidx:0, ndev->name:wlan1, }
  15475. -drvr->iflist[1]: (null)
  15476. -drvr->iflist[2]: { bsscfgidx:2, ndev->name:wlan1-1, }
  15477. -drvr->iflist[3]: { bsscfgidx:3, ndev->name:wlan1-2, }
  15478. -drvr->iflist[4]: (null)
  15479. -drvr->iflist[5]: (null)
  15480. -In such case the next AP interface should bsscfgidx 4 (we don't use 1 as
  15481. -it's reserved for P2P).
  15482. -
  15483. -With old code the loop iterations were following:
  15484. -[ifidx = 0] [bsscfgidx = 2] [highest = 2]
  15485. -[ifidx = 1] [bsscfgidx = 2] [highest = 2] available = true
  15486. -[ifidx = 2] [bsscfgidx = 2] [highest = 2] bsscfgidx = highest + 1
  15487. -[ifidx = 3] [bsscfgidx = 3] [highest = 2] bsscfgidx = highest + 1
  15488. -[ifidx = 4] [bsscfgidx = 3] [highest = 2] available = true
  15489. -[ifidx = 5] [bsscfgidx = 3] [highest = 2] available = true
  15490. -There were 2 obvious problems:
  15491. -1) Having empty BSS at index 1 was resulting in available being always
  15492. - set to true, even if we would run out of BSS-es.
  15493. -2) Calculated bsscfgidx was invalid (3 instead of 4) resulting in driver
  15494. - not being able to create the 4th AP interface.
  15495. -
  15496. -New code is simpler, placed in file where it's really used, handles
  15497. -running out of free BSS-es and allows using 4 interfaces at the same
  15498. -time. It also looks for the first free BSS instead of one after the last
  15499. -in use. It works well with current driver (which doesn't allow deleting
  15500. -interfaces) and should be future proof (if we ever allow deleting).
  15501. -
  15502. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  15503. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15504. ----
  15505. -
  15506. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  15507. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  15508. -@@ -527,6 +527,21 @@ brcmf_cfg80211_update_proto_addr_mode(st
  15509. - ADDR_INDIRECT);
  15510. - }
  15511. -
  15512. -+static int brcmf_get_first_free_bsscfgidx(struct brcmf_pub *drvr)
  15513. -+{
  15514. -+ int bsscfgidx;
  15515. -+
  15516. -+ for (bsscfgidx = 0; bsscfgidx < BRCMF_MAX_IFS; bsscfgidx++) {
  15517. -+ /* bsscfgidx 1 is reserved for legacy P2P */
  15518. -+ if (bsscfgidx == 1)
  15519. -+ continue;
  15520. -+ if (!drvr->iflist[bsscfgidx])
  15521. -+ return bsscfgidx;
  15522. -+ }
  15523. -+
  15524. -+ return -ENOMEM;
  15525. -+}
  15526. -+
  15527. - static int brcmf_cfg80211_request_ap_if(struct brcmf_if *ifp)
  15528. - {
  15529. - struct brcmf_mbss_ssid_le mbss_ssid_le;
  15530. -@@ -534,7 +549,7 @@ static int brcmf_cfg80211_request_ap_if(
  15531. - int err;
  15532. -
  15533. - memset(&mbss_ssid_le, 0, sizeof(mbss_ssid_le));
  15534. -- bsscfgidx = brcmf_get_next_free_bsscfgidx(ifp->drvr);
  15535. -+ bsscfgidx = brcmf_get_first_free_bsscfgidx(ifp->drvr);
  15536. - if (bsscfgidx < 0)
  15537. - return bsscfgidx;
  15538. -
  15539. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  15540. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  15541. -@@ -753,30 +753,6 @@ void brcmf_remove_interface(struct brcmf
  15542. - brcmf_del_if(ifp->drvr, ifp->bsscfgidx);
  15543. - }
  15544. -
  15545. --int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr)
  15546. --{
  15547. -- int ifidx;
  15548. -- int bsscfgidx;
  15549. -- bool available;
  15550. -- int highest;
  15551. --
  15552. -- available = false;
  15553. -- bsscfgidx = 2;
  15554. -- highest = 2;
  15555. -- for (ifidx = 0; ifidx < BRCMF_MAX_IFS; ifidx++) {
  15556. -- if (drvr->iflist[ifidx]) {
  15557. -- if (drvr->iflist[ifidx]->bsscfgidx == bsscfgidx)
  15558. -- bsscfgidx = highest + 1;
  15559. -- else if (drvr->iflist[ifidx]->bsscfgidx > highest)
  15560. -- highest = drvr->iflist[ifidx]->bsscfgidx;
  15561. -- } else {
  15562. -- available = true;
  15563. -- }
  15564. -- }
  15565. --
  15566. -- return available ? bsscfgidx : -ENOMEM;
  15567. --}
  15568. --
  15569. - #ifdef CONFIG_INET
  15570. - #define ARPOL_MAX_ENTRIES 8
  15571. - static int brcmf_inetaddr_changed(struct notifier_block *nb,
  15572. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  15573. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  15574. -@@ -217,7 +217,6 @@ int brcmf_net_attach(struct brcmf_if *if
  15575. - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
  15576. - bool is_p2pdev, char *name, u8 *mac_addr);
  15577. - void brcmf_remove_interface(struct brcmf_if *ifp);
  15578. --int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr);
  15579. - void brcmf_txflowblock_if(struct brcmf_if *ifp,
  15580. - enum brcmf_netif_stop_reason reason, bool state);
  15581. - void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
  15582. diff --git a/package/kernel/mac80211/patches/351-0007-brcmutil-add-field-storing-control-channel-to-the-st.patch b/package/kernel/mac80211/patches/351-0007-brcmutil-add-field-storing-control-channel-to-the-st.patch
  15583. deleted file mode 100644
  15584. index a79c9a2..0000000
  15585. --- a/package/kernel/mac80211/patches/351-0007-brcmutil-add-field-storing-control-channel-to-the-st.patch
  15586. +++ /dev/null
  15587. @@ -1,244 +0,0 @@
  15588. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  15589. -Date: Fri, 20 May 2016 13:38:57 +0200
  15590. -Subject: [PATCH] brcmutil: add field storing control channel to the struct
  15591. - brcmu_chan
  15592. -MIME-Version: 1.0
  15593. -Content-Type: text/plain; charset=UTF-8
  15594. -Content-Transfer-Encoding: 8bit
  15595. -
  15596. -Our d11 code supports encoding/decoding channel info into/from chanspec
  15597. -format used by firmware. Current implementation is quite misleading
  15598. -because of the way "chnum" field is used.
  15599. -When encoding channel info, "chnum" has to be filled by a caller with
  15600. -*center* channel number. However when decoding chanspec the same field
  15601. -is filled with a *control* channel number.
  15602. -
  15603. -1) This can be confusing. It's expected for information to be the same
  15604. - after encoding and decoding.
  15605. -2) It doesn't allow accessing all info when decoding. Some functions may
  15606. - need to know both channel numbers, e.g. cfg80211 callback getting
  15607. - current channel.
  15608. -Solve this by adding a separated field for control channel.
  15609. -
  15610. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  15611. -Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  15612. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15613. ----
  15614. -
  15615. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  15616. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  15617. -@@ -2689,7 +2689,7 @@ static s32 brcmf_inform_single_bss(struc
  15618. - if (!bi->ctl_ch) {
  15619. - ch.chspec = le16_to_cpu(bi->chanspec);
  15620. - cfg->d11inf.decchspec(&ch);
  15621. -- bi->ctl_ch = ch.chnum;
  15622. -+ bi->ctl_ch = ch.control_ch_num;
  15623. - }
  15624. - channel = bi->ctl_ch;
  15625. -
  15626. -@@ -2807,7 +2807,7 @@ static s32 brcmf_inform_ibss(struct brcm
  15627. - else
  15628. - band = wiphy->bands[IEEE80211_BAND_5GHZ];
  15629. -
  15630. -- freq = ieee80211_channel_to_frequency(ch.chnum, band->band);
  15631. -+ freq = ieee80211_channel_to_frequency(ch.control_ch_num, band->band);
  15632. - cfg->channel = freq;
  15633. - notify_channel = ieee80211_get_channel(wiphy, freq);
  15634. -
  15635. -@@ -2817,7 +2817,7 @@ static s32 brcmf_inform_ibss(struct brcm
  15636. - notify_ielen = le32_to_cpu(bi->ie_length);
  15637. - notify_signal = (s16)le16_to_cpu(bi->RSSI) * 100;
  15638. -
  15639. -- brcmf_dbg(CONN, "channel: %d(%d)\n", ch.chnum, freq);
  15640. -+ brcmf_dbg(CONN, "channel: %d(%d)\n", ch.control_ch_num, freq);
  15641. - brcmf_dbg(CONN, "capability: %X\n", notify_capability);
  15642. - brcmf_dbg(CONN, "beacon interval: %d\n", notify_interval);
  15643. - brcmf_dbg(CONN, "signal: %d\n", notify_signal);
  15644. -@@ -5235,7 +5235,7 @@ brcmf_bss_roaming_done(struct brcmf_cfg8
  15645. - else
  15646. - band = wiphy->bands[IEEE80211_BAND_5GHZ];
  15647. -
  15648. -- freq = ieee80211_channel_to_frequency(ch.chnum, band->band);
  15649. -+ freq = ieee80211_channel_to_frequency(ch.control_ch_num, band->band);
  15650. - notify_channel = ieee80211_get_channel(wiphy, freq);
  15651. -
  15652. - done:
  15653. -@@ -5757,14 +5757,15 @@ static int brcmf_construct_chaninfo(stru
  15654. - channel = band->channels;
  15655. - index = band->n_channels;
  15656. - for (j = 0; j < band->n_channels; j++) {
  15657. -- if (channel[j].hw_value == ch.chnum) {
  15658. -+ if (channel[j].hw_value == ch.control_ch_num) {
  15659. - index = j;
  15660. - break;
  15661. - }
  15662. - }
  15663. - channel[index].center_freq =
  15664. -- ieee80211_channel_to_frequency(ch.chnum, band->band);
  15665. -- channel[index].hw_value = ch.chnum;
  15666. -+ ieee80211_channel_to_frequency(ch.control_ch_num,
  15667. -+ band->band);
  15668. -+ channel[index].hw_value = ch.control_ch_num;
  15669. -
  15670. - /* assuming the chanspecs order is HT20,
  15671. - * HT40 upper, HT40 lower, and VHT80.
  15672. -@@ -5866,7 +5867,7 @@ static int brcmf_enable_bw40_2g(struct b
  15673. - if (WARN_ON(ch.bw != BRCMU_CHAN_BW_40))
  15674. - continue;
  15675. - for (j = 0; j < band->n_channels; j++) {
  15676. -- if (band->channels[j].hw_value == ch.chnum)
  15677. -+ if (band->channels[j].hw_value == ch.control_ch_num)
  15678. - break;
  15679. - }
  15680. - if (WARN_ON(j == band->n_channels))
  15681. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  15682. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  15683. -@@ -1246,7 +1246,7 @@ bool brcmf_p2p_scan_finding_common_chann
  15684. - if (!bi->ctl_ch) {
  15685. - ch.chspec = le16_to_cpu(bi->chanspec);
  15686. - cfg->d11inf.decchspec(&ch);
  15687. -- bi->ctl_ch = ch.chnum;
  15688. -+ bi->ctl_ch = ch.control_ch_num;
  15689. - }
  15690. - afx_hdl->peer_chan = bi->ctl_ch;
  15691. - brcmf_dbg(TRACE, "ACTION FRAME SCAN : Peer %pM found, channel : %d\n",
  15692. -@@ -1385,7 +1385,7 @@ int brcmf_p2p_notify_action_frame_rx(str
  15693. - if (test_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL,
  15694. - &p2p->status) &&
  15695. - (ether_addr_equal(afx_hdl->tx_dst_addr, e->addr))) {
  15696. -- afx_hdl->peer_chan = ch.chnum;
  15697. -+ afx_hdl->peer_chan = ch.control_ch_num;
  15698. - brcmf_dbg(INFO, "GON request: Peer found, channel=%d\n",
  15699. - afx_hdl->peer_chan);
  15700. - complete(&afx_hdl->act_frm_scan);
  15701. -@@ -1428,7 +1428,7 @@ int brcmf_p2p_notify_action_frame_rx(str
  15702. - memcpy(&mgmt_frame->u, frame, mgmt_frame_len);
  15703. - mgmt_frame_len += offsetof(struct ieee80211_mgmt, u);
  15704. -
  15705. -- freq = ieee80211_channel_to_frequency(ch.chnum,
  15706. -+ freq = ieee80211_channel_to_frequency(ch.control_ch_num,
  15707. - ch.band == BRCMU_CHAN_BAND_2G ?
  15708. - IEEE80211_BAND_2GHZ :
  15709. - IEEE80211_BAND_5GHZ);
  15710. -@@ -1873,7 +1873,7 @@ s32 brcmf_p2p_notify_rx_mgmt_p2p_probere
  15711. -
  15712. - if (test_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL, &p2p->status) &&
  15713. - (ether_addr_equal(afx_hdl->tx_dst_addr, e->addr))) {
  15714. -- afx_hdl->peer_chan = ch.chnum;
  15715. -+ afx_hdl->peer_chan = ch.control_ch_num;
  15716. - brcmf_dbg(INFO, "PROBE REQUEST: Peer found, channel=%d\n",
  15717. - afx_hdl->peer_chan);
  15718. - complete(&afx_hdl->act_frm_scan);
  15719. -@@ -1898,7 +1898,7 @@ s32 brcmf_p2p_notify_rx_mgmt_p2p_probere
  15720. -
  15721. - mgmt_frame = (u8 *)(rxframe + 1);
  15722. - mgmt_frame_len = e->datalen - sizeof(*rxframe);
  15723. -- freq = ieee80211_channel_to_frequency(ch.chnum,
  15724. -+ freq = ieee80211_channel_to_frequency(ch.control_ch_num,
  15725. - ch.band == BRCMU_CHAN_BAND_2G ?
  15726. - IEEE80211_BAND_2GHZ :
  15727. - IEEE80211_BAND_5GHZ);
  15728. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmutil/d11.c
  15729. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmutil/d11.c
  15730. -@@ -107,6 +107,7 @@ static void brcmu_d11n_decchspec(struct
  15731. - u16 val;
  15732. -
  15733. - ch->chnum = (u8)(ch->chspec & BRCMU_CHSPEC_CH_MASK);
  15734. -+ ch->control_ch_num = ch->chnum;
  15735. -
  15736. - switch (ch->chspec & BRCMU_CHSPEC_D11N_BW_MASK) {
  15737. - case BRCMU_CHSPEC_D11N_BW_20:
  15738. -@@ -118,10 +119,10 @@ static void brcmu_d11n_decchspec(struct
  15739. - val = ch->chspec & BRCMU_CHSPEC_D11N_SB_MASK;
  15740. - if (val == BRCMU_CHSPEC_D11N_SB_L) {
  15741. - ch->sb = BRCMU_CHAN_SB_L;
  15742. -- ch->chnum -= CH_10MHZ_APART;
  15743. -+ ch->control_ch_num -= CH_10MHZ_APART;
  15744. - } else {
  15745. - ch->sb = BRCMU_CHAN_SB_U;
  15746. -- ch->chnum += CH_10MHZ_APART;
  15747. -+ ch->control_ch_num += CH_10MHZ_APART;
  15748. - }
  15749. - break;
  15750. - default:
  15751. -@@ -147,6 +148,7 @@ static void brcmu_d11ac_decchspec(struct
  15752. - u16 val;
  15753. -
  15754. - ch->chnum = (u8)(ch->chspec & BRCMU_CHSPEC_CH_MASK);
  15755. -+ ch->control_ch_num = ch->chnum;
  15756. -
  15757. - switch (ch->chspec & BRCMU_CHSPEC_D11AC_BW_MASK) {
  15758. - case BRCMU_CHSPEC_D11AC_BW_20:
  15759. -@@ -158,10 +160,10 @@ static void brcmu_d11ac_decchspec(struct
  15760. - val = ch->chspec & BRCMU_CHSPEC_D11AC_SB_MASK;
  15761. - if (val == BRCMU_CHSPEC_D11AC_SB_L) {
  15762. - ch->sb = BRCMU_CHAN_SB_L;
  15763. -- ch->chnum -= CH_10MHZ_APART;
  15764. -+ ch->control_ch_num -= CH_10MHZ_APART;
  15765. - } else if (val == BRCMU_CHSPEC_D11AC_SB_U) {
  15766. - ch->sb = BRCMU_CHAN_SB_U;
  15767. -- ch->chnum += CH_10MHZ_APART;
  15768. -+ ch->control_ch_num += CH_10MHZ_APART;
  15769. - } else {
  15770. - WARN_ON_ONCE(1);
  15771. - }
  15772. -@@ -172,16 +174,16 @@ static void brcmu_d11ac_decchspec(struct
  15773. - BRCMU_CHSPEC_D11AC_SB_SHIFT);
  15774. - switch (ch->sb) {
  15775. - case BRCMU_CHAN_SB_LL:
  15776. -- ch->chnum -= CH_30MHZ_APART;
  15777. -+ ch->control_ch_num -= CH_30MHZ_APART;
  15778. - break;
  15779. - case BRCMU_CHAN_SB_LU:
  15780. -- ch->chnum -= CH_10MHZ_APART;
  15781. -+ ch->control_ch_num -= CH_10MHZ_APART;
  15782. - break;
  15783. - case BRCMU_CHAN_SB_UL:
  15784. -- ch->chnum += CH_10MHZ_APART;
  15785. -+ ch->control_ch_num += CH_10MHZ_APART;
  15786. - break;
  15787. - case BRCMU_CHAN_SB_UU:
  15788. -- ch->chnum += CH_30MHZ_APART;
  15789. -+ ch->control_ch_num += CH_30MHZ_APART;
  15790. - break;
  15791. - default:
  15792. - WARN_ON_ONCE(1);
  15793. ---- a/drivers/net/wireless/broadcom/brcm80211/include/brcmu_d11.h
  15794. -+++ b/drivers/net/wireless/broadcom/brcm80211/include/brcmu_d11.h
  15795. -@@ -125,14 +125,36 @@ enum brcmu_chan_sb {
  15796. - BRCMU_CHAN_SB_UU = BRCMU_CHAN_SB_LUU,
  15797. - };
  15798. -
  15799. -+/**
  15800. -+ * struct brcmu_chan - stores channel formats
  15801. -+ *
  15802. -+ * This structure can be used with functions translating chanspec into generic
  15803. -+ * channel info and the other way.
  15804. -+ *
  15805. -+ * @chspec: firmware specific format
  15806. -+ * @chnum: center channel number
  15807. -+ * @control_ch_num: control channel number
  15808. -+ * @band: frequency band
  15809. -+ * @bw: channel width
  15810. -+ * @sb: control sideband (location of control channel against the center one)
  15811. -+ */
  15812. - struct brcmu_chan {
  15813. - u16 chspec;
  15814. - u8 chnum;
  15815. -+ u8 control_ch_num;
  15816. - u8 band;
  15817. - enum brcmu_chan_bw bw;
  15818. - enum brcmu_chan_sb sb;
  15819. - };
  15820. -
  15821. -+/**
  15822. -+ * struct brcmu_d11inf - provides functions translating channel format
  15823. -+ *
  15824. -+ * @io_type: determines version of channel format used by firmware
  15825. -+ * @encchspec: encodes channel info into a chanspec, requires center channel
  15826. -+ * number, ignores control one
  15827. -+ * @decchspec: decodes chanspec into generic info
  15828. -+ */
  15829. - struct brcmu_d11inf {
  15830. - u8 io_type;
  15831. -
  15832. diff --git a/package/kernel/mac80211/patches/351-0008-brcmfmac-support-get_channel-cfg80211-callback.patch b/package/kernel/mac80211/patches/351-0008-brcmfmac-support-get_channel-cfg80211-callback.patch
  15833. deleted file mode 100644
  15834. index 2c536d1..0000000
  15835. --- a/package/kernel/mac80211/patches/351-0008-brcmfmac-support-get_channel-cfg80211-callback.patch
  15836. +++ /dev/null
  15837. @@ -1,94 +0,0 @@
  15838. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  15839. -Date: Fri, 20 May 2016 13:38:58 +0200
  15840. -Subject: [PATCH] brcmfmac: support get_channel cfg80211 callback
  15841. -MIME-Version: 1.0
  15842. -Content-Type: text/plain; charset=UTF-8
  15843. -Content-Transfer-Encoding: 8bit
  15844. -
  15845. -This is important for brcmfmac as some of released firmwares (e.g.
  15846. -brcmfmac4366b-pcie.bin) may pick different channel than requested. This
  15847. -has been tested with BCM4366B1 in D-Link DIR-885L.
  15848. -
  15849. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  15850. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15851. ----
  15852. -
  15853. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  15854. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  15855. -@@ -4847,6 +4847,68 @@ exit:
  15856. - return err;
  15857. - }
  15858. -
  15859. -+static int brcmf_cfg80211_get_channel(struct wiphy *wiphy,
  15860. -+ struct wireless_dev *wdev,
  15861. -+ struct cfg80211_chan_def *chandef)
  15862. -+{
  15863. -+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
  15864. -+ struct net_device *ndev = wdev->netdev;
  15865. -+ struct brcmf_if *ifp;
  15866. -+ struct brcmu_chan ch;
  15867. -+ enum nl80211_band band = 0;
  15868. -+ enum nl80211_chan_width width = 0;
  15869. -+ u32 chanspec;
  15870. -+ int freq, err;
  15871. -+
  15872. -+ if (!ndev)
  15873. -+ return -ENODEV;
  15874. -+ ifp = netdev_priv(ndev);
  15875. -+
  15876. -+ err = brcmf_fil_iovar_int_get(ifp, "chanspec", &chanspec);
  15877. -+ if (err) {
  15878. -+ brcmf_err("chanspec failed (%d)\n", err);
  15879. -+ return err;
  15880. -+ }
  15881. -+
  15882. -+ ch.chspec = chanspec;
  15883. -+ cfg->d11inf.decchspec(&ch);
  15884. -+
  15885. -+ switch (ch.band) {
  15886. -+ case BRCMU_CHAN_BAND_2G:
  15887. -+ band = NL80211_BAND_2GHZ;
  15888. -+ break;
  15889. -+ case BRCMU_CHAN_BAND_5G:
  15890. -+ band = NL80211_BAND_5GHZ;
  15891. -+ break;
  15892. -+ }
  15893. -+
  15894. -+ switch (ch.bw) {
  15895. -+ case BRCMU_CHAN_BW_80:
  15896. -+ width = NL80211_CHAN_WIDTH_80;
  15897. -+ break;
  15898. -+ case BRCMU_CHAN_BW_40:
  15899. -+ width = NL80211_CHAN_WIDTH_40;
  15900. -+ break;
  15901. -+ case BRCMU_CHAN_BW_20:
  15902. -+ width = NL80211_CHAN_WIDTH_20;
  15903. -+ break;
  15904. -+ case BRCMU_CHAN_BW_80P80:
  15905. -+ width = NL80211_CHAN_WIDTH_80P80;
  15906. -+ break;
  15907. -+ case BRCMU_CHAN_BW_160:
  15908. -+ width = NL80211_CHAN_WIDTH_160;
  15909. -+ break;
  15910. -+ }
  15911. -+
  15912. -+ freq = ieee80211_channel_to_frequency(ch.control_ch_num, band);
  15913. -+ chandef->chan = ieee80211_get_channel(wiphy, freq);
  15914. -+ chandef->width = width;
  15915. -+ chandef->center_freq1 = ieee80211_channel_to_frequency(ch.chnum, band);
  15916. -+ chandef->center_freq2 = 0;
  15917. -+
  15918. -+ return 0;
  15919. -+}
  15920. -+
  15921. - static int brcmf_cfg80211_crit_proto_start(struct wiphy *wiphy,
  15922. - struct wireless_dev *wdev,
  15923. - enum nl80211_crit_proto_id proto,
  15924. -@@ -5009,6 +5071,7 @@ static struct cfg80211_ops brcmf_cfg8021
  15925. - .mgmt_tx = brcmf_cfg80211_mgmt_tx,
  15926. - .remain_on_channel = brcmf_p2p_remain_on_channel,
  15927. - .cancel_remain_on_channel = brcmf_cfg80211_cancel_remain_on_channel,
  15928. -+ .get_channel = brcmf_cfg80211_get_channel,
  15929. - .start_p2p_device = brcmf_p2p_start_device,
  15930. - .stop_p2p_device = brcmf_p2p_stop_device,
  15931. - .crit_proto_start = brcmf_cfg80211_crit_proto_start,
  15932. diff --git a/package/kernel/mac80211/patches/351-0009-brcmfmac-print-errors-if-creating-interface-fails.patch b/package/kernel/mac80211/patches/351-0009-brcmfmac-print-errors-if-creating-interface-fails.patch
  15933. deleted file mode 100644
  15934. index 1b119b2..0000000
  15935. --- a/package/kernel/mac80211/patches/351-0009-brcmfmac-print-errors-if-creating-interface-fails.patch
  15936. +++ /dev/null
  15937. @@ -1,59 +0,0 @@
  15938. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  15939. -Date: Fri, 27 May 2016 10:54:28 +0200
  15940. -Subject: [PATCH] brcmfmac: print errors if creating interface fails
  15941. -
  15942. -This is helpful for debugging. Without this all I was getting from "iw"
  15943. -command on failed creating of P2P interface was:
  15944. -> command failed: Too many open files in system (-23)
  15945. -
  15946. -Signed-off-by: Rafal Milecki <zajec5@gmail.com>
  15947. -[arend@broadcom.com: reduce error prints upon iface creation]
  15948. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15949. -Reviewed-by: Julian Calaby <julian.calaby@gmail.com>
  15950. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15951. ----
  15952. -
  15953. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  15954. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  15955. -@@ -670,20 +670,24 @@ static struct wireless_dev *brcmf_cfg802
  15956. - return ERR_PTR(-EOPNOTSUPP);
  15957. - case NL80211_IFTYPE_AP:
  15958. - wdev = brcmf_ap_add_vif(wiphy, name, flags, params);
  15959. -- if (!IS_ERR(wdev))
  15960. -- brcmf_cfg80211_update_proto_addr_mode(wdev);
  15961. -- return wdev;
  15962. -+ break;
  15963. - case NL80211_IFTYPE_P2P_CLIENT:
  15964. - case NL80211_IFTYPE_P2P_GO:
  15965. - case NL80211_IFTYPE_P2P_DEVICE:
  15966. - wdev = brcmf_p2p_add_vif(wiphy, name, name_assign_type, type, flags, params);
  15967. -- if (!IS_ERR(wdev))
  15968. -- brcmf_cfg80211_update_proto_addr_mode(wdev);
  15969. -- return wdev;
  15970. -+ break;
  15971. - case NL80211_IFTYPE_UNSPECIFIED:
  15972. - default:
  15973. - return ERR_PTR(-EINVAL);
  15974. - }
  15975. -+
  15976. -+ if (IS_ERR(wdev))
  15977. -+ brcmf_err("add iface %s type %d failed: err=%d\n",
  15978. -+ name, type, (int)PTR_ERR(wdev));
  15979. -+ else
  15980. -+ brcmf_cfg80211_update_proto_addr_mode(wdev);
  15981. -+
  15982. -+ return wdev;
  15983. - }
  15984. -
  15985. - static void brcmf_scan_config_mpc(struct brcmf_if *ifp, int mpc)
  15986. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  15987. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  15988. -@@ -2030,8 +2030,6 @@ static int brcmf_p2p_request_p2p_if(stru
  15989. -
  15990. - err = brcmf_fil_iovar_data_set(ifp, "p2p_ifadd", &if_request,
  15991. - sizeof(if_request));
  15992. -- if (err)
  15993. -- return err;
  15994. -
  15995. - return err;
  15996. - }
  15997. diff --git a/package/kernel/mac80211/patches/351-0010-brcmfmac-fix-setting-AP-channel-with-new-firmwares.patch b/package/kernel/mac80211/patches/351-0010-brcmfmac-fix-setting-AP-channel-with-new-firmwares.patch
  15998. deleted file mode 100644
  15999. index a2e18a5..0000000
  16000. --- a/package/kernel/mac80211/patches/351-0010-brcmfmac-fix-setting-AP-channel-with-new-firmwares.patch
  16001. +++ /dev/null
  16002. @@ -1,114 +0,0 @@
  16003. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  16004. -Date: Fri, 27 May 2016 21:07:19 +0200
  16005. -Subject: [PATCH] brcmfmac: fix setting AP channel with new firmwares
  16006. -MIME-Version: 1.0
  16007. -Content-Type: text/plain; charset=UTF-8
  16008. -Content-Transfer-Encoding: 8bit
  16009. -
  16010. -Firmware for new chipsets is based on a new major version of code
  16011. -internally maintained at Broadcom. E.g. brcmfmac4366b-pcie.bin (used for
  16012. -BCM4366B1) is based on 10.10.69.3309 while brcmfmac43602-pcie.ap.bin was
  16013. -based on 7.35.177.56.
  16014. -
  16015. -Currently setting AP 5 GHz channel doesn't work reliably with BCM4366B1.
  16016. -When setting e.g. 36 control channel with VHT80 (center channel 42)
  16017. -firmware may randomly pick one of:
  16018. -1) 52 control channel with 58 as center one
  16019. -2) 100 control channel with 106 as center one
  16020. -3) 116 control channel with 122 as center one
  16021. -4) 149 control channel with 155 as center one
  16022. -
  16023. -It seems new firmwares require setting AP mode (BRCMF_C_SET_AP) before
  16024. -specifying a channel. Changing an order of firmware calls fixes the
  16025. -problem. This requirement resulted in two separated "chanspec" calls,
  16026. -one in AP code path and one in P2P path.
  16027. -
  16028. -This fix was verified with BCM4366B1 and tested for regressions on
  16029. -BCM43602.
  16030. -
  16031. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  16032. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16033. ----
  16034. -
  16035. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  16036. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  16037. -@@ -4382,7 +4382,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  16038. - struct brcmf_join_params join_params;
  16039. - enum nl80211_iftype dev_role;
  16040. - struct brcmf_fil_bss_enable_le bss_enable;
  16041. -- u16 chanspec;
  16042. -+ u16 chanspec = chandef_to_chanspec(&cfg->d11inf, &settings->chandef);
  16043. - bool mbss;
  16044. - int is_11d;
  16045. -
  16046. -@@ -4458,16 +4458,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  16047. -
  16048. - brcmf_config_ap_mgmt_ie(ifp->vif, &settings->beacon);
  16049. -
  16050. -+ /* Parameters shared by all radio interfaces */
  16051. - if (!mbss) {
  16052. -- chanspec = chandef_to_chanspec(&cfg->d11inf,
  16053. -- &settings->chandef);
  16054. -- err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec);
  16055. -- if (err < 0) {
  16056. -- brcmf_err("Set Channel failed: chspec=%d, %d\n",
  16057. -- chanspec, err);
  16058. -- goto exit;
  16059. -- }
  16060. --
  16061. - if (is_11d != ifp->vif->is_11d) {
  16062. - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY,
  16063. - is_11d);
  16064. -@@ -4515,6 +4507,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  16065. - err = -EINVAL;
  16066. - goto exit;
  16067. - }
  16068. -+
  16069. -+ /* Interface specific setup */
  16070. - if (dev_role == NL80211_IFTYPE_AP) {
  16071. - if ((brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) && (!mbss))
  16072. - brcmf_fil_iovar_int_set(ifp, "mbss", 1);
  16073. -@@ -4524,6 +4518,17 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  16074. - brcmf_err("setting AP mode failed %d\n", err);
  16075. - goto exit;
  16076. - }
  16077. -+ if (!mbss) {
  16078. -+ /* Firmware 10.x requires setting channel after enabling
  16079. -+ * AP and before bringing interface up.
  16080. -+ */
  16081. -+ err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec);
  16082. -+ if (err < 0) {
  16083. -+ brcmf_err("Set Channel failed: chspec=%d, %d\n",
  16084. -+ chanspec, err);
  16085. -+ goto exit;
  16086. -+ }
  16087. -+ }
  16088. - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1);
  16089. - if (err < 0) {
  16090. - brcmf_err("BRCMF_C_UP error (%d)\n", err);
  16091. -@@ -4545,7 +4550,13 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  16092. - goto exit;
  16093. - }
  16094. - brcmf_dbg(TRACE, "AP mode configuration complete\n");
  16095. -- } else {
  16096. -+ } else if (dev_role == NL80211_IFTYPE_P2P_GO) {
  16097. -+ err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec);
  16098. -+ if (err < 0) {
  16099. -+ brcmf_err("Set Channel failed: chspec=%d, %d\n",
  16100. -+ chanspec, err);
  16101. -+ goto exit;
  16102. -+ }
  16103. - err = brcmf_fil_bsscfg_data_set(ifp, "ssid", &ssid_le,
  16104. - sizeof(ssid_le));
  16105. - if (err < 0) {
  16106. -@@ -4562,7 +4573,10 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  16107. - }
  16108. -
  16109. - brcmf_dbg(TRACE, "GO mode configuration complete\n");
  16110. -+ } else {
  16111. -+ WARN_ON(1);
  16112. - }
  16113. -+
  16114. - set_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state);
  16115. - brcmf_net_setcarrier(ifp, true);
  16116. -
  16117. diff --git a/package/kernel/mac80211/patches/351-0011-brcmfmac-don-t-remove-interface-on-link-down-firmwar.patch b/package/kernel/mac80211/patches/351-0011-brcmfmac-don-t-remove-interface-on-link-down-firmwar.patch
  16118. deleted file mode 100644
  16119. index 167e434..0000000
  16120. --- a/package/kernel/mac80211/patches/351-0011-brcmfmac-don-t-remove-interface-on-link-down-firmwar.patch
  16121. +++ /dev/null
  16122. @@ -1,60 +0,0 @@
  16123. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  16124. -Date: Mon, 30 May 2016 06:40:54 +0200
  16125. -Subject: [PATCH] brcmfmac: don't remove interface on link down firmware event
  16126. -MIME-Version: 1.0
  16127. -Content-Type: text/plain; charset=UTF-8
  16128. -Content-Transfer-Encoding: 8bit
  16129. -
  16130. -There are two firmware events we handle similarly in brcmfmac:
  16131. -BRCMF_E_LINK and BRCMF_E_IF. The difference from firmware point of view
  16132. -is that the first one means BSS remains present in the firmware. Trying
  16133. -to (re)create it (e.g. when adding new virtual interface) will result in
  16134. -an error.
  16135. -
  16136. -Current code treats both events in a similar way. It removes Linux
  16137. -interface for each of them. It works OK with e.g. BCM43602. Its firmware
  16138. -generates both events for each interface. It means we get BRCMF_E_LINK
  16139. -and remove interface. That is soon followed by BRCMF_E_IF which means
  16140. -BSS was also removed in a firmware. The only downside of this is a
  16141. -harmless error like:
  16142. -[ 208.643180] brcmfmac: brcmf_fweh_call_event_handler: no interface object
  16143. -
  16144. -Unfortunately BCM4366 firmware doesn't automatically remove BSS and so
  16145. -it doesn't generate BRCMF_E_IF. In such case we incorrectly remove Linux
  16146. -interface on BRCMF_E_LINK as BSS is still present in the firmware. It
  16147. -results in an error when trying to re-create virtual interface, e.g.:
  16148. -> iw phy phy1 interface add wlan1-1 type __ap
  16149. -[ 3602.929199] brcmfmac: brcmf_ap_add_vif: timeout occurred
  16150. -command failed: I/O error (-5)
  16151. -
  16152. -With this patch we don't remove Linux interface while firmware keeps
  16153. -BSS. Thanks to this we keep a consistent states of host driver and
  16154. -device firmware.
  16155. -
  16156. -Further improvement should be to mark BSS as disabled and remove
  16157. -interface on BRCMF_E_LINK. Then we should add support for reusing
  16158. -BSS-es.
  16159. -
  16160. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  16161. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16162. ----
  16163. -
  16164. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  16165. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  16166. -@@ -5372,7 +5372,6 @@ brcmf_notify_connect_status_ap(struct br
  16167. - struct net_device *ndev,
  16168. - const struct brcmf_event_msg *e, void *data)
  16169. - {
  16170. -- struct brcmf_if *ifp = netdev_priv(ndev);
  16171. - static int generation;
  16172. - u32 event = e->event_code;
  16173. - u32 reason = e->reason;
  16174. -@@ -5383,8 +5382,6 @@ brcmf_notify_connect_status_ap(struct br
  16175. - ndev != cfg_to_ndev(cfg)) {
  16176. - brcmf_dbg(CONN, "AP mode link down\n");
  16177. - complete(&cfg->vif_disabled);
  16178. -- if (ifp->vif->mbss)
  16179. -- brcmf_remove_interface(ifp);
  16180. - return 0;
  16181. - }
  16182. -
  16183. diff --git a/package/kernel/mac80211/patches/351-0017-brcmfmac-drop-unused-pm_block-vif-attribute.patch b/package/kernel/mac80211/patches/351-0017-brcmfmac-drop-unused-pm_block-vif-attribute.patch
  16184. deleted file mode 100644
  16185. index 28ef3a6..0000000
  16186. --- a/package/kernel/mac80211/patches/351-0017-brcmfmac-drop-unused-pm_block-vif-attribute.patch
  16187. +++ /dev/null
  16188. @@ -1,103 +0,0 @@
  16189. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  16190. -Date: Mon, 6 Jun 2016 23:03:55 +0200
  16191. -Subject: [PATCH] brcmfmac: drop unused pm_block vif attribute
  16192. -MIME-Version: 1.0
  16193. -Content-Type: text/plain; charset=UTF-8
  16194. -Content-Transfer-Encoding: 8bit
  16195. -
  16196. -This attribute was added 3 years ago by
  16197. -commit 3eacf866559c ("brcmfmac: introduce brcmf_cfg80211_vif structure")
  16198. -but it remains unused since then. It seems we can safely drop it.
  16199. -
  16200. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  16201. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16202. ----
  16203. -
  16204. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  16205. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  16206. -@@ -587,7 +587,7 @@ struct wireless_dev *brcmf_ap_add_vif(st
  16207. -
  16208. - brcmf_dbg(INFO, "Adding vif \"%s\"\n", name);
  16209. -
  16210. -- vif = brcmf_alloc_vif(cfg, NL80211_IFTYPE_AP, false);
  16211. -+ vif = brcmf_alloc_vif(cfg, NL80211_IFTYPE_AP);
  16212. - if (IS_ERR(vif))
  16213. - return (struct wireless_dev *)vif;
  16214. -
  16215. -@@ -5098,8 +5098,7 @@ static struct cfg80211_ops brcmf_cfg8021
  16216. - };
  16217. -
  16218. - struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg,
  16219. -- enum nl80211_iftype type,
  16220. -- bool pm_block)
  16221. -+ enum nl80211_iftype type)
  16222. - {
  16223. - struct brcmf_cfg80211_vif *vif_walk;
  16224. - struct brcmf_cfg80211_vif *vif;
  16225. -@@ -5114,8 +5113,6 @@ struct brcmf_cfg80211_vif *brcmf_alloc_v
  16226. - vif->wdev.wiphy = cfg->wiphy;
  16227. - vif->wdev.iftype = type;
  16228. -
  16229. -- vif->pm_block = pm_block;
  16230. --
  16231. - brcmf_init_prof(&vif->profile);
  16232. -
  16233. - if (type == NL80211_IFTYPE_AP) {
  16234. -@@ -6754,7 +6751,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  16235. - init_vif_event(&cfg->vif_event);
  16236. - INIT_LIST_HEAD(&cfg->vif_list);
  16237. -
  16238. -- vif = brcmf_alloc_vif(cfg, NL80211_IFTYPE_STATION, false);
  16239. -+ vif = brcmf_alloc_vif(cfg, NL80211_IFTYPE_STATION);
  16240. - if (IS_ERR(vif))
  16241. - goto wiphy_out;
  16242. -
  16243. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  16244. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  16245. -@@ -167,7 +167,6 @@ struct vif_saved_ie {
  16246. - * @wdev: wireless device.
  16247. - * @profile: profile information.
  16248. - * @sme_state: SME state using enum brcmf_vif_status bits.
  16249. -- * @pm_block: power-management blocked.
  16250. - * @list: linked list.
  16251. - * @mgmt_rx_reg: registered rx mgmt frame types.
  16252. - * @mbss: Multiple BSS type, set if not first AP (not relevant for P2P).
  16253. -@@ -177,7 +176,6 @@ struct brcmf_cfg80211_vif {
  16254. - struct wireless_dev wdev;
  16255. - struct brcmf_cfg80211_profile profile;
  16256. - unsigned long sme_state;
  16257. -- bool pm_block;
  16258. - struct vif_saved_ie saved_ie;
  16259. - struct list_head list;
  16260. - u16 mgmt_rx_reg;
  16261. -@@ -388,8 +386,7 @@ s32 brcmf_cfg80211_down(struct net_devic
  16262. - enum nl80211_iftype brcmf_cfg80211_get_iftype(struct brcmf_if *ifp);
  16263. -
  16264. - struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg,
  16265. -- enum nl80211_iftype type,
  16266. -- bool pm_block);
  16267. -+ enum nl80211_iftype type);
  16268. - void brcmf_free_vif(struct brcmf_cfg80211_vif *vif);
  16269. -
  16270. - s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag,
  16271. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  16272. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  16273. -@@ -2074,8 +2074,7 @@ static struct wireless_dev *brcmf_p2p_cr
  16274. - if (p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif)
  16275. - return ERR_PTR(-ENOSPC);
  16276. -
  16277. -- p2p_vif = brcmf_alloc_vif(p2p->cfg, NL80211_IFTYPE_P2P_DEVICE,
  16278. -- false);
  16279. -+ p2p_vif = brcmf_alloc_vif(p2p->cfg, NL80211_IFTYPE_P2P_DEVICE);
  16280. - if (IS_ERR(p2p_vif)) {
  16281. - brcmf_err("could not create discovery vif\n");
  16282. - return (struct wireless_dev *)p2p_vif;
  16283. -@@ -2175,7 +2174,7 @@ struct wireless_dev *brcmf_p2p_add_vif(s
  16284. - return ERR_PTR(-EOPNOTSUPP);
  16285. - }
  16286. -
  16287. -- vif = brcmf_alloc_vif(cfg, type, false);
  16288. -+ vif = brcmf_alloc_vif(cfg, type);
  16289. - if (IS_ERR(vif))
  16290. - return (struct wireless_dev *)vif;
  16291. - brcmf_cfg80211_arm_vif_event(cfg, vif);
  16292. diff --git a/package/kernel/mac80211/patches/351-0018-brcmfmac-include-required-headers-in-cfg80211.h.patch b/package/kernel/mac80211/patches/351-0018-brcmfmac-include-required-headers-in-cfg80211.h.patch
  16293. deleted file mode 100644
  16294. index 09547d8..0000000
  16295. --- a/package/kernel/mac80211/patches/351-0018-brcmfmac-include-required-headers-in-cfg80211.h.patch
  16296. +++ /dev/null
  16297. @@ -1,37 +0,0 @@
  16298. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  16299. -Date: Tue, 7 Jun 2016 08:20:21 +0200
  16300. -Subject: [PATCH] brcmfmac: include required headers in cfg80211.h
  16301. -MIME-Version: 1.0
  16302. -Content-Type: text/plain; charset=UTF-8
  16303. -Content-Transfer-Encoding: 8bit
  16304. -
  16305. -Without this including cfg80211.h in a wrong order could result in:
  16306. -
  16307. -drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h:122:24: error: array type has incomplete element type
  16308. - struct brcmf_wsec_key key[BRCMF_MAX_DEFAULT_KEYS];
  16309. - ^
  16310. -drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h:291:24: error: field ‘p2p’ has incomplete type
  16311. - struct brcmf_p2p_info p2p;
  16312. - ^
  16313. -drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h:297:27: error: field ‘pmk_list’ has incomplete type
  16314. - struct brcmf_pmk_list_le pmk_list;
  16315. - ^
  16316. -drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h:317:28: error: field ‘assoclist’ has incomplete type
  16317. - struct brcmf_assoclist_le assoclist;
  16318. -
  16319. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  16320. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16321. ----
  16322. -
  16323. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  16324. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  16325. -@@ -20,6 +20,9 @@
  16326. - /* for brcmu_d11inf */
  16327. - #include <brcmu_d11.h>
  16328. -
  16329. -+#include "fwil_types.h"
  16330. -+#include "p2p.h"
  16331. -+
  16332. - #define WL_NUM_SCAN_MAX 10
  16333. - #define WL_TLV_INFO_MAX 1024
  16334. - #define WL_BSS_INFO_MAX 2048
  16335. diff --git a/package/kernel/mac80211/patches/351-0019-brcmfmac-slightly-simplify-building-interface-combin.patch b/package/kernel/mac80211/patches/351-0019-brcmfmac-slightly-simplify-building-interface-combin.patch
  16336. deleted file mode 100644
  16337. index 461e3db..0000000
  16338. --- a/package/kernel/mac80211/patches/351-0019-brcmfmac-slightly-simplify-building-interface-combin.patch
  16339. +++ /dev/null
  16340. @@ -1,108 +0,0 @@
  16341. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  16342. -Date: Tue, 7 Jun 2016 21:10:18 +0200
  16343. -Subject: [PATCH] brcmfmac: slightly simplify building interface combinations
  16344. -MIME-Version: 1.0
  16345. -Content-Type: text/plain; charset=UTF-8
  16346. -Content-Transfer-Encoding: 8bit
  16347. -
  16348. -This change reorders some operations in brcmf_setup_ifmodes in hope to
  16349. -make it simpler:
  16350. -1) It allocates arrays right before filling them. This way it's easier
  16351. - to follow requested array length as it's immediately followed by
  16352. - code filling it. It's easier to check e.g. why we need 4 entries for
  16353. - P2P. Other than that it deduplicates some checks (e.g. for P2P).
  16354. -2) It reorders code to first prepare limits and then define a new combo.
  16355. - Previously this was mixed (e.g. we were setting num of channels
  16356. - before preparing limits).
  16357. -3) It modifies mbss code to use i variable just like other combos do.
  16358. -
  16359. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  16360. -Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  16361. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16362. ----
  16363. -
  16364. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  16365. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  16366. -@@ -6208,29 +6208,15 @@ static int brcmf_setup_ifmodes(struct wi
  16367. - if (!combo)
  16368. - goto err;
  16369. -
  16370. -- c0_limits = kcalloc(p2p ? 3 : 2, sizeof(*c0_limits), GFP_KERNEL);
  16371. -- if (!c0_limits)
  16372. -- goto err;
  16373. --
  16374. -- if (p2p) {
  16375. -- p2p_limits = kcalloc(4, sizeof(*p2p_limits), GFP_KERNEL);
  16376. -- if (!p2p_limits)
  16377. -- goto err;
  16378. -- }
  16379. --
  16380. -- if (mbss) {
  16381. -- mbss_limits = kcalloc(1, sizeof(*mbss_limits), GFP_KERNEL);
  16382. -- if (!mbss_limits)
  16383. -- goto err;
  16384. -- }
  16385. --
  16386. - wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
  16387. - BIT(NL80211_IFTYPE_ADHOC) |
  16388. - BIT(NL80211_IFTYPE_AP);
  16389. -
  16390. - c = 0;
  16391. - i = 0;
  16392. -- combo[c].num_different_channels = 1;
  16393. -+ c0_limits = kcalloc(p2p ? 3 : 2, sizeof(*c0_limits), GFP_KERNEL);
  16394. -+ if (!c0_limits)
  16395. -+ goto err;
  16396. - c0_limits[i].max = 1;
  16397. - c0_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  16398. - if (p2p) {
  16399. -@@ -6248,6 +6234,7 @@ static int brcmf_setup_ifmodes(struct wi
  16400. - c0_limits[i].max = 1;
  16401. - c0_limits[i++].types = BIT(NL80211_IFTYPE_AP);
  16402. - }
  16403. -+ combo[c].num_different_channels = 1;
  16404. - combo[c].max_interfaces = i;
  16405. - combo[c].n_limits = i;
  16406. - combo[c].limits = c0_limits;
  16407. -@@ -6255,7 +6242,9 @@ static int brcmf_setup_ifmodes(struct wi
  16408. - if (p2p) {
  16409. - c++;
  16410. - i = 0;
  16411. -- combo[c].num_different_channels = 1;
  16412. -+ p2p_limits = kcalloc(4, sizeof(*p2p_limits), GFP_KERNEL);
  16413. -+ if (!p2p_limits)
  16414. -+ goto err;
  16415. - p2p_limits[i].max = 1;
  16416. - p2p_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  16417. - p2p_limits[i].max = 1;
  16418. -@@ -6264,6 +6253,7 @@ static int brcmf_setup_ifmodes(struct wi
  16419. - p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT);
  16420. - p2p_limits[i].max = 1;
  16421. - p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  16422. -+ combo[c].num_different_channels = 1;
  16423. - combo[c].max_interfaces = i;
  16424. - combo[c].n_limits = i;
  16425. - combo[c].limits = p2p_limits;
  16426. -@@ -6271,14 +6261,19 @@ static int brcmf_setup_ifmodes(struct wi
  16427. -
  16428. - if (mbss) {
  16429. - c++;
  16430. -+ i = 0;
  16431. -+ mbss_limits = kcalloc(1, sizeof(*mbss_limits), GFP_KERNEL);
  16432. -+ if (!mbss_limits)
  16433. -+ goto err;
  16434. -+ mbss_limits[i].max = 4;
  16435. -+ mbss_limits[i++].types = BIT(NL80211_IFTYPE_AP);
  16436. - combo[c].beacon_int_infra_match = true;
  16437. - combo[c].num_different_channels = 1;
  16438. -- mbss_limits[0].max = 4;
  16439. -- mbss_limits[0].types = BIT(NL80211_IFTYPE_AP);
  16440. - combo[c].max_interfaces = 4;
  16441. -- combo[c].n_limits = 1;
  16442. -+ combo[c].n_limits = i;
  16443. - combo[c].limits = mbss_limits;
  16444. - }
  16445. -+
  16446. - wiphy->n_iface_combinations = n_combos;
  16447. - wiphy->iface_combinations = combo;
  16448. - return 0;
  16449. diff --git a/package/kernel/mac80211/patches/351-0020-brcmfmac-fix-lockup-when-removing-P2P-interface-afte.patch b/package/kernel/mac80211/patches/351-0020-brcmfmac-fix-lockup-when-removing-P2P-interface-afte.patch
  16450. deleted file mode 100644
  16451. index e991f32..0000000
  16452. --- a/package/kernel/mac80211/patches/351-0020-brcmfmac-fix-lockup-when-removing-P2P-interface-afte.patch
  16453. +++ /dev/null
  16454. @@ -1,160 +0,0 @@
  16455. -From b50ddfa8530e9b5f52e873fdd6ff04f327a88799 Mon Sep 17 00:00:00 2001
  16456. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  16457. -Date: Fri, 17 Jun 2016 12:29:21 +0200
  16458. -Subject: [PATCH] brcmfmac: fix lockup when removing P2P interface after event
  16459. - timeout
  16460. -MIME-Version: 1.0
  16461. -Content-Type: text/plain; charset=UTF-8
  16462. -Content-Transfer-Encoding: 8bit
  16463. -
  16464. -Removing P2P interface is handled by sending a proper request to the
  16465. -firmware. On success firmware triggers an event and driver's handler
  16466. -removes a matching interface.
  16467. -
  16468. -However on event timeout we remove interface directly from the cfg80211
  16469. -callback. Current code doesn't handle this case correctly as it always
  16470. -assumes rtnl to be unlocked.
  16471. -
  16472. -Fix it by adding an extra rtnl_locked parameter to functions and calling
  16473. -unregister_netdevice when needed.
  16474. -
  16475. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  16476. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16477. ----
  16478. - .../wireless/broadcom/brcm80211/brcmfmac/core.c | 29 +++++++++++++---------
  16479. - .../wireless/broadcom/brcm80211/brcmfmac/core.h | 2 +-
  16480. - .../wireless/broadcom/brcm80211/brcmfmac/fweh.c | 2 +-
  16481. - .../net/wireless/broadcom/brcm80211/brcmfmac/p2p.c | 4 +--
  16482. - 4 files changed, 21 insertions(+), 16 deletions(-)
  16483. -
  16484. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  16485. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  16486. -@@ -548,12 +548,16 @@ fail:
  16487. - return -EBADE;
  16488. - }
  16489. -
  16490. --static void brcmf_net_detach(struct net_device *ndev)
  16491. -+static void brcmf_net_detach(struct net_device *ndev, bool rtnl_locked)
  16492. - {
  16493. -- if (ndev->reg_state == NETREG_REGISTERED)
  16494. -- unregister_netdev(ndev);
  16495. -- else
  16496. -+ if (ndev->reg_state == NETREG_REGISTERED) {
  16497. -+ if (rtnl_locked)
  16498. -+ unregister_netdevice(ndev);
  16499. -+ else
  16500. -+ unregister_netdev(ndev);
  16501. -+ } else {
  16502. - brcmf_cfg80211_free_netdev(ndev);
  16503. -+ }
  16504. - }
  16505. -
  16506. - void brcmf_net_setcarrier(struct brcmf_if *ifp, bool on)
  16507. -@@ -651,7 +655,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  16508. - brcmf_err("ERROR: netdev:%s already exists\n",
  16509. - ifp->ndev->name);
  16510. - netif_stop_queue(ifp->ndev);
  16511. -- brcmf_net_detach(ifp->ndev);
  16512. -+ brcmf_net_detach(ifp->ndev, false);
  16513. - drvr->iflist[bsscfgidx] = NULL;
  16514. - } else {
  16515. - brcmf_dbg(INFO, "netdev:%s ignore IF event\n",
  16516. -@@ -699,7 +703,8 @@ struct brcmf_if *brcmf_add_if(struct brc
  16517. - return ifp;
  16518. - }
  16519. -
  16520. --static void brcmf_del_if(struct brcmf_pub *drvr, s32 bsscfgidx)
  16521. -+static void brcmf_del_if(struct brcmf_pub *drvr, s32 bsscfgidx,
  16522. -+ bool rtnl_locked)
  16523. - {
  16524. - struct brcmf_if *ifp;
  16525. -
  16526. -@@ -729,7 +734,7 @@ static void brcmf_del_if(struct brcmf_pu
  16527. - cancel_work_sync(&ifp->multicast_work);
  16528. - cancel_work_sync(&ifp->ndoffload_work);
  16529. - }
  16530. -- brcmf_net_detach(ifp->ndev);
  16531. -+ brcmf_net_detach(ifp->ndev, rtnl_locked);
  16532. - } else {
  16533. - /* Only p2p device interfaces which get dynamically created
  16534. - * end up here. In this case the p2p module should be informed
  16535. -@@ -743,14 +748,14 @@ static void brcmf_del_if(struct brcmf_pu
  16536. - }
  16537. - }
  16538. -
  16539. --void brcmf_remove_interface(struct brcmf_if *ifp)
  16540. -+void brcmf_remove_interface(struct brcmf_if *ifp, bool rtnl_locked)
  16541. - {
  16542. - if (!ifp || WARN_ON(ifp->drvr->iflist[ifp->bsscfgidx] != ifp))
  16543. - return;
  16544. - brcmf_dbg(TRACE, "Enter, bsscfgidx=%d, ifidx=%d\n", ifp->bsscfgidx,
  16545. - ifp->ifidx);
  16546. - brcmf_fws_del_interface(ifp);
  16547. -- brcmf_del_if(ifp->drvr, ifp->bsscfgidx);
  16548. -+ brcmf_del_if(ifp->drvr, ifp->bsscfgidx, rtnl_locked);
  16549. - }
  16550. -
  16551. - #ifdef CONFIG_INET
  16552. -@@ -1057,9 +1062,9 @@ fail:
  16553. - brcmf_fws_deinit(drvr);
  16554. - }
  16555. - if (ifp)
  16556. -- brcmf_net_detach(ifp->ndev);
  16557. -+ brcmf_net_detach(ifp->ndev, false);
  16558. - if (p2p_ifp)
  16559. -- brcmf_net_detach(p2p_ifp->ndev);
  16560. -+ brcmf_net_detach(p2p_ifp->ndev, false);
  16561. - drvr->iflist[0] = NULL;
  16562. - drvr->iflist[1] = NULL;
  16563. - if (drvr->settings->ignore_probe_fail)
  16564. -@@ -1128,7 +1133,7 @@ void brcmf_detach(struct device *dev)
  16565. -
  16566. - /* make sure primary interface removed last */
  16567. - for (i = BRCMF_MAX_IFS-1; i > -1; i--)
  16568. -- brcmf_remove_interface(drvr->iflist[i]);
  16569. -+ brcmf_remove_interface(drvr->iflist[i], false);
  16570. -
  16571. - brcmf_cfg80211_detach(drvr->config);
  16572. -
  16573. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  16574. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  16575. -@@ -216,7 +216,7 @@ struct brcmf_if *brcmf_get_ifp(struct br
  16576. - int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  16577. - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
  16578. - bool is_p2pdev, char *name, u8 *mac_addr);
  16579. --void brcmf_remove_interface(struct brcmf_if *ifp);
  16580. -+void brcmf_remove_interface(struct brcmf_if *ifp, bool rtnl_locked);
  16581. - void brcmf_txflowblock_if(struct brcmf_if *ifp,
  16582. - enum brcmf_netif_stop_reason reason, bool state);
  16583. - void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
  16584. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  16585. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  16586. -@@ -183,7 +183,7 @@ static void brcmf_fweh_handle_if_event(s
  16587. - err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data);
  16588. -
  16589. - if (ifp && ifevent->action == BRCMF_E_IF_DEL)
  16590. -- brcmf_remove_interface(ifp);
  16591. -+ brcmf_remove_interface(ifp, false);
  16592. - }
  16593. -
  16594. - /**
  16595. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  16596. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  16597. -@@ -2289,7 +2289,7 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  16598. - err = 0;
  16599. - }
  16600. - if (err)
  16601. -- brcmf_remove_interface(vif->ifp);
  16602. -+ brcmf_remove_interface(vif->ifp, true);
  16603. -
  16604. - brcmf_cfg80211_arm_vif_event(cfg, NULL);
  16605. - if (vif->wdev.iftype != NL80211_IFTYPE_P2P_DEVICE)
  16606. -@@ -2395,7 +2395,7 @@ void brcmf_p2p_detach(struct brcmf_p2p_i
  16607. - if (vif != NULL) {
  16608. - brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  16609. - brcmf_p2p_deinit_discovery(p2p);
  16610. -- brcmf_remove_interface(vif->ifp);
  16611. -+ brcmf_remove_interface(vif->ifp, false);
  16612. - }
  16613. - /* just set it all to zero */
  16614. - memset(p2p, 0, sizeof(*p2p));
  16615. diff --git a/package/kernel/mac80211/patches/351-0021-brcmfmac-use-const-char-for-interface-name-in-brcmf_.patch b/package/kernel/mac80211/patches/351-0021-brcmfmac-use-const-char-for-interface-name-in-brcmf_.patch
  16616. deleted file mode 100644
  16617. index ed65f4d..0000000
  16618. --- a/package/kernel/mac80211/patches/351-0021-brcmfmac-use-const-char-for-interface-name-in-brcmf_.patch
  16619. +++ /dev/null
  16620. @@ -1,39 +0,0 @@
  16621. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  16622. -Date: Fri, 17 Jun 2016 12:48:44 +0200
  16623. -Subject: [PATCH] brcmfmac: use const char * for interface name in brcmf_add_if
  16624. -MIME-Version: 1.0
  16625. -Content-Type: text/plain; charset=UTF-8
  16626. -Content-Transfer-Encoding: 8bit
  16627. -
  16628. -This function can work just fine with const pointer, it only calls
  16629. -alloc_netdev which take const as well. Moreover it makes this function
  16630. -more flexible as some cfg80211 callback may provide const char * as
  16631. -well, e.g. add_virtual_intf. This will be needed for more advanced
  16632. -interface management.
  16633. -
  16634. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  16635. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16636. ----
  16637. -
  16638. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  16639. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  16640. -@@ -638,7 +638,7 @@ fail:
  16641. - }
  16642. -
  16643. - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
  16644. -- bool is_p2pdev, char *name, u8 *mac_addr)
  16645. -+ bool is_p2pdev, const char *name, u8 *mac_addr)
  16646. - {
  16647. - struct brcmf_if *ifp;
  16648. - struct net_device *ndev;
  16649. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  16650. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  16651. -@@ -215,7 +215,7 @@ char *brcmf_ifname(struct brcmf_if *ifp)
  16652. - struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx);
  16653. - int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  16654. - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
  16655. -- bool is_p2pdev, char *name, u8 *mac_addr);
  16656. -+ bool is_p2pdev, const char *name, u8 *mac_addr);
  16657. - void brcmf_remove_interface(struct brcmf_if *ifp, bool rtnl_locked);
  16658. - void brcmf_txflowblock_if(struct brcmf_if *ifp,
  16659. - enum brcmf_netif_stop_reason reason, bool state);
  16660. diff --git a/package/kernel/mac80211/patches/351-0022-brcmfmac-include-also-core.h-header-in-cfg80211.h.patch b/package/kernel/mac80211/patches/351-0022-brcmfmac-include-also-core.h-header-in-cfg80211.h.patch
  16661. deleted file mode 100644
  16662. index ef35fab..0000000
  16663. --- a/package/kernel/mac80211/patches/351-0022-brcmfmac-include-also-core.h-header-in-cfg80211.h.patch
  16664. +++ /dev/null
  16665. @@ -1,33 +0,0 @@
  16666. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  16667. -Date: Sat, 18 Jun 2016 18:49:38 +0200
  16668. -Subject: [PATCH] brcmfmac: include also core.h header in cfg80211.h
  16669. -MIME-Version: 1.0
  16670. -Content-Type: text/plain; charset=UTF-8
  16671. -Content-Transfer-Encoding: 8bit
  16672. -
  16673. -This header provides two inline functions using struct brcmf_if so we
  16674. -need core.h to avoid:
  16675. -
  16676. -drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h: In function ‘ndev_to_prof’:
  16677. -drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h:368:13: error: dereferencing pointer to incomplete type
  16678. - return &ifp->vif->profile;
  16679. - ^
  16680. -drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h: In function ‘ndev_to_vif’:
  16681. -drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h:374:12: error: dereferencing pointer to incomplete type
  16682. - return ifp->vif;
  16683. - ^
  16684. -
  16685. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  16686. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16687. ----
  16688. -
  16689. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  16690. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  16691. -@@ -20,6 +20,7 @@
  16692. - /* for brcmu_d11inf */
  16693. - #include <brcmu_d11.h>
  16694. -
  16695. -+#include "core.h"
  16696. - #include "fwil_types.h"
  16697. - #include "p2p.h"
  16698. -
  16699. diff --git a/package/kernel/mac80211/patches/351-0023-brcmfmac-add-missing-break-when-deleting-P2P_DEVICE.patch b/package/kernel/mac80211/patches/351-0023-brcmfmac-add-missing-break-when-deleting-P2P_DEVICE.patch
  16700. deleted file mode 100644
  16701. index ab9a634..0000000
  16702. --- a/package/kernel/mac80211/patches/351-0023-brcmfmac-add-missing-break-when-deleting-P2P_DEVICE.patch
  16703. +++ /dev/null
  16704. @@ -1,27 +0,0 @@
  16705. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  16706. -Date: Sun, 19 Jun 2016 01:55:57 +0200
  16707. -Subject: [PATCH] brcmfmac: add missing break when deleting P2P_DEVICE
  16708. -MIME-Version: 1.0
  16709. -Content-Type: text/plain; charset=UTF-8
  16710. -Content-Transfer-Encoding: 8bit
  16711. -
  16712. -We obviously don't want to fall through in that switch. With this change
  16713. -1) We wait for event (triggered by p2p_disc) as expected
  16714. -2) We remove interface manually on timeout
  16715. -3) We return 0 on success instead of -ENOTSUPP
  16716. -
  16717. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  16718. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16719. ----
  16720. -
  16721. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  16722. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  16723. -@@ -2263,6 +2263,8 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  16724. - return 0;
  16725. - brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  16726. - brcmf_p2p_deinit_discovery(p2p);
  16727. -+ break;
  16728. -+
  16729. - default:
  16730. - return -ENOTSUPP;
  16731. - }
  16732. diff --git a/package/kernel/mac80211/patches/351-0024-brcmfmac-delete-interface-directly-in-code-that-sent.patch b/package/kernel/mac80211/patches/351-0024-brcmfmac-delete-interface-directly-in-code-that-sent.patch
  16733. deleted file mode 100644
  16734. index 6dd0c03..0000000
  16735. --- a/package/kernel/mac80211/patches/351-0024-brcmfmac-delete-interface-directly-in-code-that-sent.patch
  16736. +++ /dev/null
  16737. @@ -1,75 +0,0 @@
  16738. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  16739. -Date: Wed, 29 Jun 2016 21:54:26 +0200
  16740. -Subject: [PATCH] brcmfmac: delete interface directly in code that sent fw
  16741. - request
  16742. -MIME-Version: 1.0
  16743. -Content-Type: text/plain; charset=UTF-8
  16744. -Content-Transfer-Encoding: 8bit
  16745. -
  16746. -So far when receiving event about in-firmware-interface removal our
  16747. -event worker was notifying listener and afterwards it was removing Linux
  16748. -interface.
  16749. -
  16750. -First of all it was resulting in slightly unexpected order. The listener
  16751. -(del_virtual_intf callback) was (usually) returning with success before
  16752. -we even called unregister_netdev(ice).
  16753. -
  16754. -Please note this couldn't be simply fixed by changing order of calls in
  16755. -brcmf_fweh_handle_if_event as unregistering interface earlier could free
  16756. -struct brcmf_if.
  16757. -
  16758. -Another problem of current implementation are possible lockups. Focus on
  16759. -the time slot between calling event handler and removing Linux
  16760. -interface. During that time original caller may leave (unlocking rtnl
  16761. -semaphore) *and* another call to the same code may be done (locking it
  16762. -again). If that happens our event handler will stuck at removing Linux
  16763. -interface, it won't handle another event and will block process holding
  16764. -rtnl lock.
  16765. -
  16766. -This can be simply solved by unregistering interface in a proper
  16767. -callback, right after receiving confirmation event from firmware. This
  16768. -only required modifying worker to don't unregister on its own if there
  16769. -is someone waiting for the event.
  16770. -
  16771. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  16772. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16773. ----
  16774. -
  16775. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  16776. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  16777. -@@ -18,6 +18,7 @@
  16778. - #include "brcmu_wifi.h"
  16779. - #include "brcmu_utils.h"
  16780. -
  16781. -+#include "cfg80211.h"
  16782. - #include "core.h"
  16783. - #include "debug.h"
  16784. - #include "tracepoint.h"
  16785. -@@ -182,8 +183,13 @@ static void brcmf_fweh_handle_if_event(s
  16786. -
  16787. - err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data);
  16788. -
  16789. -- if (ifp && ifevent->action == BRCMF_E_IF_DEL)
  16790. -- brcmf_remove_interface(ifp, false);
  16791. -+ if (ifp && ifevent->action == BRCMF_E_IF_DEL) {
  16792. -+ bool armed = brcmf_cfg80211_vif_event_armed(drvr->config);
  16793. -+
  16794. -+ /* Default handling in case no-one waits for this event */
  16795. -+ if (!armed)
  16796. -+ brcmf_remove_interface(ifp, false);
  16797. -+ }
  16798. - }
  16799. -
  16800. - /**
  16801. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  16802. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  16803. -@@ -2290,8 +2290,7 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  16804. - else
  16805. - err = 0;
  16806. - }
  16807. -- if (err)
  16808. -- brcmf_remove_interface(vif->ifp, true);
  16809. -+ brcmf_remove_interface(vif->ifp, true);
  16810. -
  16811. - brcmf_cfg80211_arm_vif_event(cfg, NULL);
  16812. - if (vif->wdev.iftype != NL80211_IFTYPE_P2P_DEVICE)
  16813. diff --git a/package/kernel/mac80211/patches/351-0025-brcmfmac-support-removing-AP-interfaces-with-interfa.patch b/package/kernel/mac80211/patches/351-0025-brcmfmac-support-removing-AP-interfaces-with-interfa.patch
  16814. deleted file mode 100644
  16815. index 1929f0b..0000000
  16816. --- a/package/kernel/mac80211/patches/351-0025-brcmfmac-support-removing-AP-interfaces-with-interfa.patch
  16817. +++ /dev/null
  16818. @@ -1,84 +0,0 @@
  16819. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  16820. -Date: Wed, 29 Jun 2016 21:54:27 +0200
  16821. -Subject: [PATCH] brcmfmac: support removing AP interfaces with
  16822. - "interface_remove"
  16823. -MIME-Version: 1.0
  16824. -Content-Type: text/plain; charset=UTF-8
  16825. -Content-Transfer-Encoding: 8bit
  16826. -
  16827. -New firmwares (e.g. 10.10.69.36 for BCM4366) support "interface_remove"
  16828. -for removing interfaces. Try to use this method on cfg80211 request. In
  16829. -case of older firmwares (e.g. 7.35.177.56 for BCM43602 as I tested) this
  16830. -will just result in firmware rejecting command and this won't change any
  16831. -behavior.
  16832. -
  16833. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  16834. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16835. ----
  16836. -
  16837. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  16838. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  16839. -@@ -771,12 +771,48 @@ s32 brcmf_notify_escan_complete(struct b
  16840. - return err;
  16841. - }
  16842. -
  16843. -+static int brcmf_cfg80211_del_ap_iface(struct wiphy *wiphy,
  16844. -+ struct wireless_dev *wdev)
  16845. -+{
  16846. -+ struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy);
  16847. -+ struct net_device *ndev = wdev->netdev;
  16848. -+ struct brcmf_if *ifp = netdev_priv(ndev);
  16849. -+ int ret;
  16850. -+ int err;
  16851. -+
  16852. -+ brcmf_cfg80211_arm_vif_event(cfg, ifp->vif);
  16853. -+
  16854. -+ err = brcmf_fil_bsscfg_data_set(ifp, "interface_remove", NULL, 0);
  16855. -+ if (err) {
  16856. -+ brcmf_err("interface_remove failed %d\n", err);
  16857. -+ goto err_unarm;
  16858. -+ }
  16859. -+
  16860. -+ /* wait for firmware event */
  16861. -+ ret = brcmf_cfg80211_wait_vif_event(cfg, BRCMF_E_IF_DEL,
  16862. -+ BRCMF_VIF_EVENT_TIMEOUT);
  16863. -+ if (!ret) {
  16864. -+ brcmf_err("timeout occurred\n");
  16865. -+ err = -EIO;
  16866. -+ goto err_unarm;
  16867. -+ }
  16868. -+
  16869. -+ brcmf_remove_interface(ifp, true);
  16870. -+
  16871. -+err_unarm:
  16872. -+ brcmf_cfg80211_arm_vif_event(cfg, NULL);
  16873. -+ return err;
  16874. -+}
  16875. -+
  16876. - static
  16877. - int brcmf_cfg80211_del_iface(struct wiphy *wiphy, struct wireless_dev *wdev)
  16878. - {
  16879. - struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy);
  16880. - struct net_device *ndev = wdev->netdev;
  16881. -
  16882. -+ if (ndev && ndev == cfg_to_ndev(cfg))
  16883. -+ return -ENOTSUPP;
  16884. -+
  16885. - /* vif event pending in firmware */
  16886. - if (brcmf_cfg80211_vif_event_armed(cfg))
  16887. - return -EBUSY;
  16888. -@@ -793,12 +829,13 @@ int brcmf_cfg80211_del_iface(struct wiph
  16889. - switch (wdev->iftype) {
  16890. - case NL80211_IFTYPE_ADHOC:
  16891. - case NL80211_IFTYPE_STATION:
  16892. -- case NL80211_IFTYPE_AP:
  16893. - case NL80211_IFTYPE_AP_VLAN:
  16894. - case NL80211_IFTYPE_WDS:
  16895. - case NL80211_IFTYPE_MONITOR:
  16896. - case NL80211_IFTYPE_MESH_POINT:
  16897. - return -EOPNOTSUPP;
  16898. -+ case NL80211_IFTYPE_AP:
  16899. -+ return brcmf_cfg80211_del_ap_iface(wiphy, wdev);
  16900. - case NL80211_IFTYPE_P2P_CLIENT:
  16901. - case NL80211_IFTYPE_P2P_GO:
  16902. - case NL80211_IFTYPE_P2P_DEVICE:
  16903. diff --git a/package/kernel/mac80211/patches/351-0026-brcmfmac-respect-hidden_ssid-for-AP-interfaces.patch b/package/kernel/mac80211/patches/351-0026-brcmfmac-respect-hidden_ssid-for-AP-interfaces.patch
  16904. deleted file mode 100644
  16905. index ae458e7..0000000
  16906. --- a/package/kernel/mac80211/patches/351-0026-brcmfmac-respect-hidden_ssid-for-AP-interfaces.patch
  16907. +++ /dev/null
  16908. @@ -1,43 +0,0 @@
  16909. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  16910. -Date: Wed, 6 Jul 2016 12:22:54 +0200
  16911. -Subject: [PATCH] brcmfmac: respect hidden_ssid for AP interfaces
  16912. -MIME-Version: 1.0
  16913. -Content-Type: text/plain; charset=UTF-8
  16914. -Content-Transfer-Encoding: 8bit
  16915. -
  16916. -This was succesfully tested with 4366B1. A small workaround is needed
  16917. -for the main interface otherwise it would stuck at the hidden state.
  16918. -
  16919. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  16920. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16921. ----
  16922. -
  16923. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  16924. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  16925. -@@ -4586,6 +4586,15 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  16926. - brcmf_err("SET SSID error (%d)\n", err);
  16927. - goto exit;
  16928. - }
  16929. -+
  16930. -+ if (settings->hidden_ssid) {
  16931. -+ err = brcmf_fil_iovar_int_set(ifp, "closednet", 1);
  16932. -+ if (err) {
  16933. -+ brcmf_err("closednet error (%d)\n", err);
  16934. -+ goto exit;
  16935. -+ }
  16936. -+ }
  16937. -+
  16938. - brcmf_dbg(TRACE, "AP mode configuration complete\n");
  16939. - } else if (dev_role == NL80211_IFTYPE_P2P_GO) {
  16940. - err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec);
  16941. -@@ -4644,6 +4653,10 @@ static int brcmf_cfg80211_stop_ap(struct
  16942. - return err;
  16943. - }
  16944. -
  16945. -+ /* First BSS doesn't get a full reset */
  16946. -+ if (ifp->bsscfgidx == 0)
  16947. -+ brcmf_fil_iovar_int_set(ifp, "closednet", 0);
  16948. -+
  16949. - memset(&join_params, 0, sizeof(join_params));
  16950. - err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
  16951. - &join_params, sizeof(join_params));
  16952. diff --git a/package/kernel/mac80211/patches/351-0027-brcmfmac-restore-stopping-netdev-queue-when-bus-clog.patch b/package/kernel/mac80211/patches/351-0027-brcmfmac-restore-stopping-netdev-queue-when-bus-clog.patch
  16953. deleted file mode 100644
  16954. index fcafa79..0000000
  16955. --- a/package/kernel/mac80211/patches/351-0027-brcmfmac-restore-stopping-netdev-queue-when-bus-clog.patch
  16956. +++ /dev/null
  16957. @@ -1,53 +0,0 @@
  16958. -From: Arend Van Spriel <arend.vanspriel@broadcom.com>
  16959. -Date: Fri, 15 Jul 2016 12:16:12 +0200
  16960. -Subject: [PATCH] brcmfmac: restore stopping netdev queue when bus clogs up
  16961. -MIME-Version: 1.0
  16962. -Content-Type: text/plain; charset=UTF-8
  16963. -Content-Transfer-Encoding: 8bit
  16964. -
  16965. -When the host-interface bus has hard time handling transmit packets
  16966. -it informs higher layer about this and it would stop the netdev
  16967. -queue when needed. However, since commit 9cd18359d31e ("brcmfmac:
  16968. -Make FWS queueing configurable.") this was broken. With this patch
  16969. -the behaviour is restored.
  16970. -
  16971. -Cc: stable@vger.kernel.org # v4.5, v4.6, v4.7
  16972. -Fixes: 9cd18359d31e ("brcmfmac: Make FWS queueing configurable.")
  16973. -Tested-by: Per Förlin <per.forlin@gmail.com>
  16974. -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  16975. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  16976. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  16977. -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  16978. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16979. ----
  16980. -
  16981. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
  16982. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
  16983. -@@ -2469,10 +2469,22 @@ void brcmf_fws_bustxfail(struct brcmf_fw
  16984. - void brcmf_fws_bus_blocked(struct brcmf_pub *drvr, bool flow_blocked)
  16985. - {
  16986. - struct brcmf_fws_info *fws = drvr->fws;
  16987. -+ struct brcmf_if *ifp;
  16988. -+ int i;
  16989. -
  16990. -- fws->bus_flow_blocked = flow_blocked;
  16991. -- if (!flow_blocked)
  16992. -- brcmf_fws_schedule_deq(fws);
  16993. -- else
  16994. -- fws->stats.bus_flow_block++;
  16995. -+ if (fws->avoid_queueing) {
  16996. -+ for (i = 0; i < BRCMF_MAX_IFS; i++) {
  16997. -+ ifp = drvr->iflist[i];
  16998. -+ if (!ifp || !ifp->ndev)
  16999. -+ continue;
  17000. -+ brcmf_txflowblock_if(ifp, BRCMF_NETIF_STOP_REASON_FLOW,
  17001. -+ flow_blocked);
  17002. -+ }
  17003. -+ } else {
  17004. -+ fws->bus_flow_blocked = flow_blocked;
  17005. -+ if (!flow_blocked)
  17006. -+ brcmf_fws_schedule_deq(fws);
  17007. -+ else
  17008. -+ fws->stats.bus_flow_block++;
  17009. -+ }
  17010. - }
  17011. diff --git a/package/kernel/mac80211/patches/351-0028-brcmfmac-defer-DPC-processing-during-probe.patch b/package/kernel/mac80211/patches/351-0028-brcmfmac-defer-DPC-processing-during-probe.patch
  17012. deleted file mode 100644
  17013. index a24c07f..0000000
  17014. --- a/package/kernel/mac80211/patches/351-0028-brcmfmac-defer-DPC-processing-during-probe.patch
  17015. +++ /dev/null
  17016. @@ -1,42 +0,0 @@
  17017. -From fd3ed33f51c2a586412d35b4f64803f019ab589f Mon Sep 17 00:00:00 2001
  17018. -From: Arend Van Spriel <arend.vanspriel@broadcom.com>
  17019. -Date: Fri, 15 Jul 2016 12:39:13 +0200
  17020. -Subject: [PATCH] brcmfmac: defer DPC processing during probe
  17021. -
  17022. -The sdio dpc starts processing when in SDIOD_STATE_DATA. This state was
  17023. -entered right after firmware download. This patch moves that transition
  17024. -just before enabling sdio interrupt handling thus avoiding watchdog
  17025. -expiry which would put the bus to sleep while probing.
  17026. -
  17027. -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  17028. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  17029. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  17030. -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  17031. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17032. ----
  17033. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 7 +++----
  17034. - 1 file changed, 3 insertions(+), 4 deletions(-)
  17035. -
  17036. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  17037. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  17038. -@@ -3304,10 +3304,6 @@ static int brcmf_sdio_download_firmware(
  17039. - goto err;
  17040. - }
  17041. -
  17042. -- /* Allow full data communication using DPC from now on. */
  17043. -- brcmf_sdiod_change_state(bus->sdiodev, BRCMF_SDIOD_DATA);
  17044. -- bcmerror = 0;
  17045. --
  17046. - err:
  17047. - brcmf_sdio_clkctl(bus, CLK_SDONLY, false);
  17048. - sdio_release_host(bus->sdiodev->func[1]);
  17049. -@@ -4045,6 +4041,9 @@ static void brcmf_sdio_firmware_callback
  17050. - }
  17051. -
  17052. - if (err == 0) {
  17053. -+ /* Allow full data communication using DPC from now on. */
  17054. -+ brcmf_sdiod_change_state(bus->sdiodev, BRCMF_SDIOD_DATA);
  17055. -+
  17056. - err = brcmf_sdiod_intr_register(sdiodev);
  17057. - if (err != 0)
  17058. - brcmf_err("intr register failed:%d\n", err);
  17059. diff --git a/package/kernel/mac80211/patches/351-0029-brcmfmac-Fix-glob_skb-leak-in-brcmf_sdiod_recv_chain.patch b/package/kernel/mac80211/patches/351-0029-brcmfmac-Fix-glob_skb-leak-in-brcmf_sdiod_recv_chain.patch
  17060. deleted file mode 100644
  17061. index ba9a349..0000000
  17062. --- a/package/kernel/mac80211/patches/351-0029-brcmfmac-Fix-glob_skb-leak-in-brcmf_sdiod_recv_chain.patch
  17063. +++ /dev/null
  17064. @@ -1,32 +0,0 @@
  17065. -From 3bdae810721b33061d2e541bd78a70f86ca42af3 Mon Sep 17 00:00:00 2001
  17066. -From: Florian Fainelli <f.fainelli@gmail.com>
  17067. -Date: Mon, 18 Jul 2016 16:24:34 -0700
  17068. -Subject: [PATCH] brcmfmac: Fix glob_skb leak in brcmf_sdiod_recv_chain
  17069. -
  17070. -In case brcmf_sdiod_recv_chain() cannot complete a succeful call to
  17071. -brcmf_sdiod_buffrw, we would be leaking glom_skb and not free it as we
  17072. -should, fix this.
  17073. -
  17074. -Reported-by: coverity (CID 1164856)
  17075. -Fixes: a413e39a38573 ("brcmfmac: fix brcmf_sdcard_recv_chain() for host without sg support")
  17076. -Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
  17077. -Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  17078. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17079. ----
  17080. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 4 +++-
  17081. - 1 file changed, 3 insertions(+), 1 deletion(-)
  17082. -
  17083. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  17084. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  17085. -@@ -722,8 +722,10 @@ int brcmf_sdiod_recv_chain(struct brcmf_
  17086. - return -ENOMEM;
  17087. - err = brcmf_sdiod_buffrw(sdiodev, SDIO_FUNC_2, false, addr,
  17088. - glom_skb);
  17089. -- if (err)
  17090. -+ if (err) {
  17091. -+ brcmu_pkt_buf_free_skb(glom_skb);
  17092. - goto done;
  17093. -+ }
  17094. -
  17095. - skb_queue_walk(pktq, skb) {
  17096. - memcpy(skb->data, glom_skb->data, skb->len);
  17097. diff --git a/package/kernel/mac80211/patches/351-0030-net-wireless-broadcom-brcm80211-brcmfmac-usb-don-t-p.patch b/package/kernel/mac80211/patches/351-0030-net-wireless-broadcom-brcm80211-brcmfmac-usb-don-t-p.patch
  17098. deleted file mode 100644
  17099. index 540b7f0..0000000
  17100. --- a/package/kernel/mac80211/patches/351-0030-net-wireless-broadcom-brcm80211-brcmfmac-usb-don-t-p.patch
  17101. +++ /dev/null
  17102. @@ -1,34 +0,0 @@
  17103. -From 938f89e50a41c2d56710805fb019ad7618cef84b Mon Sep 17 00:00:00 2001
  17104. -From: Wolfram Sang <wsa-dev@sang-engineering.com>
  17105. -Date: Thu, 11 Aug 2016 23:05:31 +0200
  17106. -Subject: [PATCH] net: wireless: broadcom: brcm80211: brcmfmac: usb: don't
  17107. - print error when allocating urb fails
  17108. -
  17109. -kmalloc will print enough information in case of failure.
  17110. -
  17111. -Signed-off-by: Wolfram Sang <wsa-dev@sang-engineering.com>
  17112. -Signed-off-by: David S. Miller <davem@davemloft.net>
  17113. ----
  17114. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 8 ++------
  17115. - 1 file changed, 2 insertions(+), 6 deletions(-)
  17116. -
  17117. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
  17118. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
  17119. -@@ -1099,15 +1099,11 @@ struct brcmf_usbdev *brcmf_usb_attach(st
  17120. - devinfo->tx_freecount = ntxq;
  17121. -
  17122. - devinfo->ctl_urb = usb_alloc_urb(0, GFP_ATOMIC);
  17123. -- if (!devinfo->ctl_urb) {
  17124. -- brcmf_err("usb_alloc_urb (ctl) failed\n");
  17125. -+ if (!devinfo->ctl_urb)
  17126. - goto error;
  17127. -- }
  17128. - devinfo->bulk_urb = usb_alloc_urb(0, GFP_ATOMIC);
  17129. -- if (!devinfo->bulk_urb) {
  17130. -- brcmf_err("usb_alloc_urb (bulk) failed\n");
  17131. -+ if (!devinfo->bulk_urb)
  17132. - goto error;
  17133. -- }
  17134. -
  17135. - return &devinfo->bus_pub;
  17136. -
  17137. diff --git a/package/kernel/mac80211/patches/351-0031-brcmfmac-Check-rtnl_lock-is-locked-when-removing-int.patch b/package/kernel/mac80211/patches/351-0031-brcmfmac-Check-rtnl_lock-is-locked-when-removing-int.patch
  17138. deleted file mode 100644
  17139. index b98b68a..0000000
  17140. --- a/package/kernel/mac80211/patches/351-0031-brcmfmac-Check-rtnl_lock-is-locked-when-removing-int.patch
  17141. +++ /dev/null
  17142. @@ -1,111 +0,0 @@
  17143. -From 15dacf880e49ce3ecee05eb1a0c6b8e363dbacdc Mon Sep 17 00:00:00 2001
  17144. -From: "mhiramat@kernel.org" <mhiramat@kernel.org>
  17145. -Date: Mon, 15 Aug 2016 18:40:57 +0900
  17146. -Subject: [PATCH] brcmfmac: Check rtnl_lock is locked when removing interface
  17147. -MIME-Version: 1.0
  17148. -Content-Type: text/plain; charset=UTF-8
  17149. -Content-Transfer-Encoding: 8bit
  17150. -
  17151. -Check rtnl_lock is locked in brcmf_p2p_ifp_removed() by passing
  17152. -rtnl_locked flag. Actually the caller brcmf_del_if() checks whether
  17153. -the rtnl_lock is locked, but doesn't pass it to brcmf_p2p_ifp_removed().
  17154. -
  17155. -Without this fix, wpa_supplicant goes softlockup with rtnl_lock
  17156. -holding (this means all other process using netlink are locked up too)
  17157. -
  17158. -e.g.
  17159. -[ 4495.876627] INFO: task wpa_supplicant:7307 blocked for more than 10 seconds.
  17160. -[ 4495.876632] Tainted: G W 4.8.0-rc1+ #8
  17161. -[ 4495.876635] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
  17162. -[ 4495.876638] wpa_supplicant D ffff974c647b39a0 0 7307 1 0x00000000
  17163. -[ 4495.876644] ffff974c647b39a0 0000000000000000 ffff974c00000000 ffff974c7dc59c58
  17164. -[ 4495.876651] ffff974c6b7417c0 ffff974c645017c0 ffff974c647b4000 ffffffff86f16c08
  17165. -[ 4495.876657] ffff974c645017c0 0000000000000246 00000000ffffffff ffff974c647b39b8
  17166. -[ 4495.876664] Call Trace:
  17167. -[ 4495.876671] [<ffffffff868aeccc>] schedule+0x3c/0x90
  17168. -[ 4495.876676] [<ffffffff868af065>] schedule_preempt_disabled+0x15/0x20
  17169. -[ 4495.876682] [<ffffffff868b0996>] mutex_lock_nested+0x176/0x3b0
  17170. -[ 4495.876686] [<ffffffff867a2067>] ? rtnl_lock+0x17/0x20
  17171. -[ 4495.876690] [<ffffffff867a2067>] rtnl_lock+0x17/0x20
  17172. -[ 4495.876720] [<ffffffffc0ae9a5d>] brcmf_p2p_ifp_removed+0x4d/0x70 [brcmfmac]
  17173. -[ 4495.876741] [<ffffffffc0aebde6>] brcmf_remove_interface+0x196/0x1b0 [brcmfmac]
  17174. -[ 4495.876760] [<ffffffffc0ae9901>] brcmf_p2p_del_vif+0x111/0x220 [brcmfmac]
  17175. -[ 4495.876777] [<ffffffffc0adefab>] brcmf_cfg80211_del_iface+0x21b/0x270 [brcmfmac]
  17176. -[ 4495.876820] [<ffffffffc097b39e>] nl80211_del_interface+0xfe/0x3a0 [cfg80211]
  17177. -[ 4495.876825] [<ffffffff867ca335>] genl_family_rcv_msg+0x1b5/0x370
  17178. -[ 4495.876832] [<ffffffff860e5d8d>] ? trace_hardirqs_on+0xd/0x10
  17179. -[ 4495.876836] [<ffffffff867ca56d>] genl_rcv_msg+0x7d/0xb0
  17180. -[ 4495.876839] [<ffffffff867ca4f0>] ? genl_family_rcv_msg+0x370/0x370
  17181. -[ 4495.876846] [<ffffffff867c9a47>] netlink_rcv_skb+0x97/0xb0
  17182. -[ 4495.876849] [<ffffffff867ca168>] genl_rcv+0x28/0x40
  17183. -[ 4495.876854] [<ffffffff867c93c3>] netlink_unicast+0x1d3/0x2f0
  17184. -[ 4495.876860] [<ffffffff867c933b>] ? netlink_unicast+0x14b/0x2f0
  17185. -[ 4495.876866] [<ffffffff867c97cb>] netlink_sendmsg+0x2eb/0x3a0
  17186. -[ 4495.876870] [<ffffffff8676dad8>] sock_sendmsg+0x38/0x50
  17187. -[ 4495.876874] [<ffffffff8676e4df>] ___sys_sendmsg+0x27f/0x290
  17188. -[ 4495.876882] [<ffffffff8628b935>] ? mntput_no_expire+0x5/0x3f0
  17189. -[ 4495.876888] [<ffffffff8628b9be>] ? mntput_no_expire+0x8e/0x3f0
  17190. -[ 4495.876894] [<ffffffff8628b935>] ? mntput_no_expire+0x5/0x3f0
  17191. -[ 4495.876899] [<ffffffff8628bd44>] ? mntput+0x24/0x40
  17192. -[ 4495.876904] [<ffffffff86267830>] ? __fput+0x190/0x200
  17193. -[ 4495.876909] [<ffffffff8676f125>] __sys_sendmsg+0x45/0x80
  17194. -[ 4495.876914] [<ffffffff8676f172>] SyS_sendmsg+0x12/0x20
  17195. -[ 4495.876918] [<ffffffff868b5680>] entry_SYSCALL_64_fastpath+0x23/0xc1
  17196. -[ 4495.876924] [<ffffffff860e2b8f>] ? trace_hardirqs_off_caller+0x1f/0xc0
  17197. -
  17198. -Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
  17199. -Acked-by: Rafał Miłecki <rafal@milecki.pl>
  17200. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17201. ----
  17202. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 2 +-
  17203. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c | 8 +++++---
  17204. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h | 2 +-
  17205. - 3 files changed, 7 insertions(+), 5 deletions(-)
  17206. -
  17207. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  17208. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  17209. -@@ -743,7 +743,7 @@ static void brcmf_del_if(struct brcmf_pu
  17210. - * serious troublesome side effects. The p2p module will clean
  17211. - * up the ifp if needed.
  17212. - */
  17213. -- brcmf_p2p_ifp_removed(ifp);
  17214. -+ brcmf_p2p_ifp_removed(ifp, rtnl_locked);
  17215. - kfree(ifp);
  17216. - }
  17217. - }
  17218. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  17219. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  17220. -@@ -2299,7 +2299,7 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  17221. - return err;
  17222. - }
  17223. -
  17224. --void brcmf_p2p_ifp_removed(struct brcmf_if *ifp)
  17225. -+void brcmf_p2p_ifp_removed(struct brcmf_if *ifp, bool rtnl_locked)
  17226. - {
  17227. - struct brcmf_cfg80211_info *cfg;
  17228. - struct brcmf_cfg80211_vif *vif;
  17229. -@@ -2308,9 +2308,11 @@ void brcmf_p2p_ifp_removed(struct brcmf_
  17230. - vif = ifp->vif;
  17231. - cfg = wdev_to_cfg(&vif->wdev);
  17232. - cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  17233. -- rtnl_lock();
  17234. -+ if (!rtnl_locked)
  17235. -+ rtnl_lock();
  17236. - cfg80211_unregister_wdev(&vif->wdev);
  17237. -- rtnl_unlock();
  17238. -+ if (!rtnl_locked)
  17239. -+ rtnl_unlock();
  17240. - brcmf_free_vif(vif);
  17241. - }
  17242. -
  17243. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h
  17244. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h
  17245. -@@ -155,7 +155,7 @@ struct wireless_dev *brcmf_p2p_add_vif(s
  17246. - int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev);
  17247. - int brcmf_p2p_ifchange(struct brcmf_cfg80211_info *cfg,
  17248. - enum brcmf_fil_p2p_if_types if_type);
  17249. --void brcmf_p2p_ifp_removed(struct brcmf_if *ifp);
  17250. -+void brcmf_p2p_ifp_removed(struct brcmf_if *ifp, bool rtnl_locked);
  17251. - int brcmf_p2p_start_device(struct wiphy *wiphy, struct wireless_dev *wdev);
  17252. - void brcmf_p2p_stop_device(struct wiphy *wiphy, struct wireless_dev *wdev);
  17253. - int brcmf_p2p_scan_prep(struct wiphy *wiphy,
  17254. diff --git a/package/kernel/mac80211/patches/351-0032-brcmfmac-Change-vif_event_lock-to-spinlock.patch b/package/kernel/mac80211/patches/351-0032-brcmfmac-Change-vif_event_lock-to-spinlock.patch
  17255. deleted file mode 100644
  17256. index 30ca258..0000000
  17257. --- a/package/kernel/mac80211/patches/351-0032-brcmfmac-Change-vif_event_lock-to-spinlock.patch
  17258. +++ /dev/null
  17259. @@ -1,175 +0,0 @@
  17260. -From b64abcb7dae6060c67ab0e548da3ef923c49641d Mon Sep 17 00:00:00 2001
  17261. -From: "mhiramat@kernel.org" <mhiramat@kernel.org>
  17262. -Date: Mon, 15 Aug 2016 18:41:12 +0900
  17263. -Subject: [PATCH] brcmfmac: Change vif_event_lock to spinlock
  17264. -
  17265. -Change vif_event_lock to spinlock from mutex, since this lock is
  17266. -used in wait_event_timeout() via vif_event_equals(). This caused
  17267. -a warning report as below.
  17268. -
  17269. -As far as I can see, this lock protects regions where updating
  17270. -structure members, not function calls. Also, since those
  17271. -regions are not called from interrupt handlers (of course, it
  17272. -was a mutex), spin_lock is used instead of spin_lock_irqsave.
  17273. -
  17274. -[ 186.678550] ------------[ cut here ]------------
  17275. -[ 186.678556] WARNING: CPU: 2 PID: 7140 at /home/mhiramat/ksrc/linux/kernel/sched/core.c:7545 __might_sleep+0x7c/0x80
  17276. -[ 186.678560] do not call blocking ops when !TASK_RUNNING; state=2 set at [<ffffffff980d9090>] prepare_to_wait_event+0x60/0x100
  17277. -[ 186.678560] Modules linked in: brcmfmac xt_CHECKSUM rfcomm ipt_MASQUERADE nf_nat_masquerade_ipv4 xt_addrtype br_netfilter xt_tcpudp ip6t_rpfilter ip6t_REJECT nf_reject_ipv6 ipt_REJECT nf_reject_ipv4 xt_conntrack ip_set nfnetlink ebtable_nat ebtable_broute bridge stp llc ebtable_filter ebtables ip6table_raw ip6table_security ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 ip6table_mangle ip6table_filter ip6_tables iptable_raw iptable_security iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack iptable_mangle iptable_filter ip_tables x_tables bnep nls_iso8859_1 i2c_designware_platform i2c_designware_core snd_hda_codec_hdmi snd_hda_codec_realtek dcdbas snd_hda_codec_generic snd_hda_intel snd_hda_codec intel_rapl snd_hda_core x86_pkg_temp_thermal intel_powerclamp coretemp
  17278. -[ 186.678594] snd_pcm crct10dif_pclmul crc32_pclmul aesni_intel aes_x86_64 joydev glue_helper snd_hwdep lrw gf128mul uvcvideo ablk_helper snd_seq_midi cryptd snd_seq_midi_event snd_rawmidi videobuf2_vmalloc videobuf2_memops snd_seq input_leds videobuf2_v4l2 cfg80211 videobuf2_core snd_timer videodev serio_raw btusb snd_seq_device media btrtl rtsx_pci_ms snd mei_me memstick hid_multitouch mei soundcore brcmutil idma64 virt_dma intel_lpss_pci processor_thermal_device intel_soc_dts_iosf hci_uart btbcm btqca btintel bluetooth int3403_thermal dell_smo8800 intel_lpss_acpi intel_lpss int3402_thermal int340x_thermal_zone intel_hid mac_hid int3400_thermal shpchp sparse_keymap acpi_pad acpi_thermal_rel acpi_als kfifo_buf industrialio kvm_intel kvm irqbypass parport_pc ppdev lp parport autofs4 btrfs xor raid6_pq
  17279. -[ 186.678631] usbhid nouveau ttm i915 rtsx_pci_sdmmc mxm_wmi i2c_algo_bit drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops psmouse drm ahci rtsx_pci nvme nvme_core libahci i2c_hid hid pinctrl_sunrisepoint video wmi pinctrl_intel fjes [last unloaded: brcmfmac]
  17280. -[ 186.678646] CPU: 2 PID: 7140 Comm: wpa_supplicant Not tainted 4.8.0-rc1+ #8
  17281. -[ 186.678647] Hardware name: Dell Inc. XPS 15 9550/0N7TVV, BIOS 01.02.00 04/07/2016
  17282. -[ 186.678648] 0000000000000000 ffff9d8c64b5b900 ffffffff98442f23 ffff9d8c64b5b950
  17283. -[ 186.678651] 0000000000000000 ffff9d8c64b5b940 ffffffff9808b22b 00001d790000000d
  17284. -[ 186.678653] ffffffff98c75e78 000000000000026c 0000000000000000 ffff9d8c2706d058
  17285. -[ 186.678655] Call Trace:
  17286. -[ 186.678659] [<ffffffff98442f23>] dump_stack+0x85/0xc2
  17287. -[ 186.678666] [<ffffffff9808b22b>] __warn+0xcb/0xf0
  17288. -[ 186.678668] [<ffffffff9808b29f>] warn_slowpath_fmt+0x4f/0x60
  17289. -[ 186.678671] [<ffffffff980d9090>] ? prepare_to_wait_event+0x60/0x100
  17290. -[ 186.678672] [<ffffffff980d9090>] ? prepare_to_wait_event+0x60/0x100
  17291. -[ 186.678674] [<ffffffff980b922c>] __might_sleep+0x7c/0x80
  17292. -[ 186.678680] [<ffffffff988b0853>] mutex_lock_nested+0x33/0x3b0
  17293. -[ 186.678682] [<ffffffff980e5d8d>] ? trace_hardirqs_on+0xd/0x10
  17294. -[ 186.678689] [<ffffffffc0c57d2d>] brcmf_cfg80211_wait_vif_event+0xcd/0x130 [brcmfmac]
  17295. -[ 186.678691] [<ffffffff980d9190>] ? wake_atomic_t_function+0x60/0x60
  17296. -[ 186.678697] [<ffffffffc0c628e9>] brcmf_p2p_del_vif+0xf9/0x220 [brcmfmac]
  17297. -[ 186.678702] [<ffffffffc0c57fab>] brcmf_cfg80211_del_iface+0x21b/0x270 [brcmfmac]
  17298. -[ 186.678716] [<ffffffffc0b0539e>] nl80211_del_interface+0xfe/0x3a0 [cfg80211]
  17299. -[ 186.678718] [<ffffffff987ca335>] genl_family_rcv_msg+0x1b5/0x370
  17300. -[ 186.678720] [<ffffffff980e5d8d>] ? trace_hardirqs_on+0xd/0x10
  17301. -[ 186.678721] [<ffffffff987ca56d>] genl_rcv_msg+0x7d/0xb0
  17302. -[ 186.678722] [<ffffffff987ca4f0>] ? genl_family_rcv_msg+0x370/0x370
  17303. -[ 186.678724] [<ffffffff987c9a47>] netlink_rcv_skb+0x97/0xb0
  17304. -[ 186.678726] [<ffffffff987ca168>] genl_rcv+0x28/0x40
  17305. -[ 186.678727] [<ffffffff987c93c3>] netlink_unicast+0x1d3/0x2f0
  17306. -[ 186.678729] [<ffffffff987c933b>] ? netlink_unicast+0x14b/0x2f0
  17307. -[ 186.678731] [<ffffffff987c97cb>] netlink_sendmsg+0x2eb/0x3a0
  17308. -[ 186.678733] [<ffffffff9876dad8>] sock_sendmsg+0x38/0x50
  17309. -[ 186.678734] [<ffffffff9876e4df>] ___sys_sendmsg+0x27f/0x290
  17310. -[ 186.678737] [<ffffffff9828b935>] ? mntput_no_expire+0x5/0x3f0
  17311. -[ 186.678739] [<ffffffff9828b9be>] ? mntput_no_expire+0x8e/0x3f0
  17312. -[ 186.678741] [<ffffffff9828b935>] ? mntput_no_expire+0x5/0x3f0
  17313. -[ 186.678743] [<ffffffff9828bd44>] ? mntput+0x24/0x40
  17314. -[ 186.678744] [<ffffffff98267830>] ? __fput+0x190/0x200
  17315. -[ 186.678746] [<ffffffff9876f125>] __sys_sendmsg+0x45/0x80
  17316. -[ 186.678748] [<ffffffff9876f172>] SyS_sendmsg+0x12/0x20
  17317. -[ 186.678749] [<ffffffff988b5680>] entry_SYSCALL_64_fastpath+0x23/0xc1
  17318. -[ 186.678751] [<ffffffff980e2b8f>] ? trace_hardirqs_off_caller+0x1f/0xc0
  17319. -[ 186.678752] ---[ end trace e224d66c5d8408b5 ]---
  17320. -
  17321. -Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
  17322. -Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  17323. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17324. ----
  17325. - .../broadcom/brcm80211/brcmfmac/cfg80211.c | 26 +++++++++++-----------
  17326. - .../broadcom/brcm80211/brcmfmac/cfg80211.h | 2 +-
  17327. - 2 files changed, 14 insertions(+), 14 deletions(-)
  17328. -
  17329. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  17330. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  17331. -@@ -5555,7 +5555,7 @@ static s32 brcmf_notify_vif_event(struct
  17332. - ifevent->action, ifevent->flags, ifevent->ifidx,
  17333. - ifevent->bsscfgidx);
  17334. -
  17335. -- mutex_lock(&event->vif_event_lock);
  17336. -+ spin_lock(&event->vif_event_lock);
  17337. - event->action = ifevent->action;
  17338. - vif = event->vif;
  17339. -
  17340. -@@ -5563,7 +5563,7 @@ static s32 brcmf_notify_vif_event(struct
  17341. - case BRCMF_E_IF_ADD:
  17342. - /* waiting process may have timed out */
  17343. - if (!cfg->vif_event.vif) {
  17344. -- mutex_unlock(&event->vif_event_lock);
  17345. -+ spin_unlock(&event->vif_event_lock);
  17346. - return -EBADF;
  17347. - }
  17348. -
  17349. -@@ -5574,24 +5574,24 @@ static s32 brcmf_notify_vif_event(struct
  17350. - ifp->ndev->ieee80211_ptr = &vif->wdev;
  17351. - SET_NETDEV_DEV(ifp->ndev, wiphy_dev(cfg->wiphy));
  17352. - }
  17353. -- mutex_unlock(&event->vif_event_lock);
  17354. -+ spin_unlock(&event->vif_event_lock);
  17355. - wake_up(&event->vif_wq);
  17356. - return 0;
  17357. -
  17358. - case BRCMF_E_IF_DEL:
  17359. -- mutex_unlock(&event->vif_event_lock);
  17360. -+ spin_unlock(&event->vif_event_lock);
  17361. - /* event may not be upon user request */
  17362. - if (brcmf_cfg80211_vif_event_armed(cfg))
  17363. - wake_up(&event->vif_wq);
  17364. - return 0;
  17365. -
  17366. - case BRCMF_E_IF_CHANGE:
  17367. -- mutex_unlock(&event->vif_event_lock);
  17368. -+ spin_unlock(&event->vif_event_lock);
  17369. - wake_up(&event->vif_wq);
  17370. - return 0;
  17371. -
  17372. - default:
  17373. -- mutex_unlock(&event->vif_event_lock);
  17374. -+ spin_unlock(&event->vif_event_lock);
  17375. - break;
  17376. - }
  17377. - return -EINVAL;
  17378. -@@ -5712,7 +5712,7 @@ static void wl_deinit_priv(struct brcmf_
  17379. - static void init_vif_event(struct brcmf_cfg80211_vif_event *event)
  17380. - {
  17381. - init_waitqueue_head(&event->vif_wq);
  17382. -- mutex_init(&event->vif_event_lock);
  17383. -+ spin_lock_init(&event->vif_event_lock);
  17384. - }
  17385. -
  17386. - static s32 brcmf_dongle_roam(struct brcmf_if *ifp)
  17387. -@@ -6607,9 +6607,9 @@ static inline bool vif_event_equals(stru
  17388. - {
  17389. - u8 evt_action;
  17390. -
  17391. -- mutex_lock(&event->vif_event_lock);
  17392. -+ spin_lock(&event->vif_event_lock);
  17393. - evt_action = event->action;
  17394. -- mutex_unlock(&event->vif_event_lock);
  17395. -+ spin_unlock(&event->vif_event_lock);
  17396. - return evt_action == action;
  17397. - }
  17398. -
  17399. -@@ -6618,10 +6618,10 @@ void brcmf_cfg80211_arm_vif_event(struct
  17400. - {
  17401. - struct brcmf_cfg80211_vif_event *event = &cfg->vif_event;
  17402. -
  17403. -- mutex_lock(&event->vif_event_lock);
  17404. -+ spin_lock(&event->vif_event_lock);
  17405. - event->vif = vif;
  17406. - event->action = 0;
  17407. -- mutex_unlock(&event->vif_event_lock);
  17408. -+ spin_unlock(&event->vif_event_lock);
  17409. - }
  17410. -
  17411. - bool brcmf_cfg80211_vif_event_armed(struct brcmf_cfg80211_info *cfg)
  17412. -@@ -6629,9 +6629,9 @@ bool brcmf_cfg80211_vif_event_armed(stru
  17413. - struct brcmf_cfg80211_vif_event *event = &cfg->vif_event;
  17414. - bool armed;
  17415. -
  17416. -- mutex_lock(&event->vif_event_lock);
  17417. -+ spin_lock(&event->vif_event_lock);
  17418. - armed = event->vif != NULL;
  17419. -- mutex_unlock(&event->vif_event_lock);
  17420. -+ spin_unlock(&event->vif_event_lock);
  17421. -
  17422. - return armed;
  17423. - }
  17424. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  17425. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  17426. -@@ -227,7 +227,7 @@ struct escan_info {
  17427. - */
  17428. - struct brcmf_cfg80211_vif_event {
  17429. - wait_queue_head_t vif_wq;
  17430. -- struct mutex vif_event_lock;
  17431. -+ spinlock_t vif_event_lock;
  17432. - u8 action;
  17433. - struct brcmf_cfg80211_vif *vif;
  17434. - };
  17435. diff --git a/package/kernel/mac80211/patches/351-0033-brcmfmac-add-missing-header-dependencies.patch b/package/kernel/mac80211/patches/351-0033-brcmfmac-add-missing-header-dependencies.patch
  17436. deleted file mode 100644
  17437. index 1a7947b..0000000
  17438. --- a/package/kernel/mac80211/patches/351-0033-brcmfmac-add-missing-header-dependencies.patch
  17439. +++ /dev/null
  17440. @@ -1,29 +0,0 @@
  17441. -From 8af92af3f2d55db143417a5d401696f4b642009a Mon Sep 17 00:00:00 2001
  17442. -From: Baoyou Xie <baoyou.xie@linaro.org>
  17443. -Date: Mon, 29 Aug 2016 20:39:35 +0800
  17444. -Subject: [PATCH] brcmfmac: add missing header dependencies
  17445. -
  17446. -We get 1 warning when building kernel with W=1:
  17447. -
  17448. -drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.c:23:6: warning: no previous prototype for '__brcmf_err' [-Wmissing-prototypes]
  17449. -
  17450. -In fact, this function is declared in brcmfmac/debug.h, so this patch
  17451. -adds missing header dependencies.
  17452. -
  17453. -Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
  17454. -Acked-by: Arnd Bergmann <arnd@arndb.de>
  17455. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17456. ----
  17457. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.c | 1 +
  17458. - 1 file changed, 1 insertion(+)
  17459. -
  17460. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.c
  17461. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.c
  17462. -@@ -19,6 +19,7 @@
  17463. - #ifndef __CHECKER__
  17464. - #define CREATE_TRACE_POINTS
  17465. - #include "tracepoint.h"
  17466. -+#include "debug.h"
  17467. -
  17468. - void __brcmf_err(const char *func, const char *fmt, ...)
  17469. - {
  17470. diff --git a/package/kernel/mac80211/patches/351-0034-brcmfmac-Add-USB-ID-for-Cisco-Linksys-AE1200.patch b/package/kernel/mac80211/patches/351-0034-brcmfmac-Add-USB-ID-for-Cisco-Linksys-AE1200.patch
  17471. deleted file mode 100644
  17472. index 24cd92a..0000000
  17473. --- a/package/kernel/mac80211/patches/351-0034-brcmfmac-Add-USB-ID-for-Cisco-Linksys-AE1200.patch
  17474. +++ /dev/null
  17475. @@ -1,51 +0,0 @@
  17476. -From bccf3ffc8c6d8e0251a15541bb4d12b423c4f729 Mon Sep 17 00:00:00 2001
  17477. -From: Ismael Luceno <ismael@iodev.co.uk>
  17478. -Date: Mon, 22 Aug 2016 19:40:07 -0300
  17479. -Subject: [PATCH] brcmfmac: Add USB ID for Cisco Linksys AE1200
  17480. -
  17481. -The AE1200 comes with different revisions of the BCM43235 chipset,
  17482. -but all have the same USB ID. Only revision 3 can be supported.
  17483. -
  17484. -Signed-off-by: Ismael Luceno <ismael@iodev.co.uk>
  17485. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17486. ----
  17487. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 4 ++++
  17488. - drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h | 2 ++
  17489. - 2 files changed, 6 insertions(+)
  17490. -
  17491. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
  17492. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
  17493. -@@ -1456,11 +1456,15 @@ static int brcmf_usb_reset_resume(struct
  17494. - #define BRCMF_USB_DEVICE(dev_id) \
  17495. - { USB_DEVICE(BRCM_USB_VENDOR_ID_BROADCOM, dev_id) }
  17496. -
  17497. -+#define LINKSYS_USB_DEVICE(dev_id) \
  17498. -+ { USB_DEVICE(BRCM_USB_VENDOR_ID_LINKSYS, dev_id) }
  17499. -+
  17500. - static struct usb_device_id brcmf_usb_devid_table[] = {
  17501. - BRCMF_USB_DEVICE(BRCM_USB_43143_DEVICE_ID),
  17502. - BRCMF_USB_DEVICE(BRCM_USB_43236_DEVICE_ID),
  17503. - BRCMF_USB_DEVICE(BRCM_USB_43242_DEVICE_ID),
  17504. - BRCMF_USB_DEVICE(BRCM_USB_43569_DEVICE_ID),
  17505. -+ LINKSYS_USB_DEVICE(BRCM_USB_43235_LINKSYS_DEVICE_ID),
  17506. - { USB_DEVICE(BRCM_USB_VENDOR_ID_LG, BRCM_USB_43242_LG_DEVICE_ID) },
  17507. - /* special entry for device with firmware loaded and running */
  17508. - BRCMF_USB_DEVICE(BRCM_USB_BCMFW_DEVICE_ID),
  17509. ---- a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h
  17510. -+++ b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h
  17511. -@@ -22,6 +22,7 @@
  17512. -
  17513. - #define BRCM_USB_VENDOR_ID_BROADCOM 0x0a5c
  17514. - #define BRCM_USB_VENDOR_ID_LG 0x043e
  17515. -+#define BRCM_USB_VENDOR_ID_LINKSYS 0x13b1
  17516. - #define BRCM_PCIE_VENDOR_ID_BROADCOM PCI_VENDOR_ID_BROADCOM
  17517. -
  17518. - /* Chipcommon Core Chip IDs */
  17519. -@@ -56,6 +57,7 @@
  17520. -
  17521. - /* USB Device IDs */
  17522. - #define BRCM_USB_43143_DEVICE_ID 0xbd1e
  17523. -+#define BRCM_USB_43235_LINKSYS_DEVICE_ID 0x0039
  17524. - #define BRCM_USB_43236_DEVICE_ID 0xbd17
  17525. - #define BRCM_USB_43242_DEVICE_ID 0xbd1f
  17526. - #define BRCM_USB_43242_LG_DEVICE_ID 0x3101
  17527. diff --git a/package/kernel/mac80211/patches/351-0035-brcmfmac-fix-pmksa-bssid-usage.patch b/package/kernel/mac80211/patches/351-0035-brcmfmac-fix-pmksa-bssid-usage.patch
  17528. deleted file mode 100644
  17529. index b58a266..0000000
  17530. --- a/package/kernel/mac80211/patches/351-0035-brcmfmac-fix-pmksa-bssid-usage.patch
  17531. +++ /dev/null
  17532. @@ -1,51 +0,0 @@
  17533. -From 7703773ef1d85b40433902a8da20167331597e4a Mon Sep 17 00:00:00 2001
  17534. -From: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
  17535. -Date: Tue, 23 Aug 2016 11:37:17 +0200
  17536. -Subject: [PATCH] brcmfmac: fix pmksa->bssid usage
  17537. -
  17538. -The struct cfg80211_pmksa defines its bssid field as:
  17539. -
  17540. - const u8 *bssid;
  17541. -
  17542. -contrary to struct brcmf_pmksa, which uses:
  17543. -
  17544. - u8 bssid[ETH_ALEN];
  17545. -
  17546. -Therefore in brcmf_cfg80211_del_pmksa(), &pmksa->bssid takes the address
  17547. -of this field (of type u8**), not the one of its content (which would be
  17548. -u8*). Remove the & operator to make brcmf_dbg("%pM") and memcmp()
  17549. -behave as expected.
  17550. -
  17551. -This bug have been found using a custom static checker (which checks the
  17552. -usage of %p... attributes at build time). It has been introduced in
  17553. -commit 6c404f34f2bd ("brcmfmac: Cleanup pmksa cache handling code"),
  17554. -which replaced pmksa->bssid by &pmksa->bssid while refactoring the code,
  17555. -without modifying struct cfg80211_pmksa definition.
  17556. -
  17557. -Replace &pmk[i].bssid with pmk[i].bssid too to make the code clearer,
  17558. -this change does not affect the semantic.
  17559. -
  17560. -Fixes: 6c404f34f2bd ("brcmfmac: Cleanup pmksa cache handling code")
  17561. -Cc: stable@vger.kernel.org
  17562. -Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
  17563. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17564. ----
  17565. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 4 ++--
  17566. - 1 file changed, 2 insertions(+), 2 deletions(-)
  17567. -
  17568. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  17569. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  17570. -@@ -3804,11 +3804,11 @@ brcmf_cfg80211_del_pmksa(struct wiphy *w
  17571. - if (!check_vif_up(ifp->vif))
  17572. - return -EIO;
  17573. -
  17574. -- brcmf_dbg(CONN, "del_pmksa - PMK bssid = %pM\n", &pmksa->bssid);
  17575. -+ brcmf_dbg(CONN, "del_pmksa - PMK bssid = %pM\n", pmksa->bssid);
  17576. -
  17577. - npmk = le32_to_cpu(cfg->pmk_list.npmk);
  17578. - for (i = 0; i < npmk; i++)
  17579. -- if (!memcmp(&pmksa->bssid, &pmk[i].bssid, ETH_ALEN))
  17580. -+ if (!memcmp(pmksa->bssid, pmk[i].bssid, ETH_ALEN))
  17581. - break;
  17582. -
  17583. - if ((npmk > 0) && (i < npmk)) {
  17584. diff --git a/package/kernel/mac80211/patches/351-0036-brcmfmac-avoid-potential-stack-overflow-in-brcmf_cfg.patch b/package/kernel/mac80211/patches/351-0036-brcmfmac-avoid-potential-stack-overflow-in-brcmf_cfg.patch
  17585. deleted file mode 100644
  17586. index 760b6da..0000000
  17587. --- a/package/kernel/mac80211/patches/351-0036-brcmfmac-avoid-potential-stack-overflow-in-brcmf_cfg.patch
  17588. +++ /dev/null
  17589. @@ -1,34 +0,0 @@
  17590. -From ded89912156b1a47d940a0c954c43afbabd0c42c Mon Sep 17 00:00:00 2001
  17591. -From: Arend Van Spriel <arend.vanspriel@broadcom.com>
  17592. -Date: Mon, 5 Sep 2016 10:45:47 +0100
  17593. -Subject: [PATCH] brcmfmac: avoid potential stack overflow in
  17594. - brcmf_cfg80211_start_ap()
  17595. -
  17596. -User-space can choose to omit NL80211_ATTR_SSID and only provide raw
  17597. -IE TLV data. When doing so it can provide SSID IE with length exceeding
  17598. -the allowed size. The driver further processes this IE copying it
  17599. -into a local variable without checking the length. Hence stack can be
  17600. -corrupted and used as exploit.
  17601. -
  17602. -Cc: stable@vger.kernel.org # v4.7
  17603. -Reported-by: Daxing Guo <freener.gdx@gmail.com>
  17604. -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  17605. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  17606. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  17607. -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  17608. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17609. ----
  17610. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 2 +-
  17611. - 1 file changed, 1 insertion(+), 1 deletion(-)
  17612. -
  17613. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  17614. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  17615. -@@ -4447,7 +4447,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  17616. - (u8 *)&settings->beacon.head[ie_offset],
  17617. - settings->beacon.head_len - ie_offset,
  17618. - WLAN_EID_SSID);
  17619. -- if (!ssid_ie)
  17620. -+ if (!ssid_ie || ssid_ie->len > IEEE80211_MAX_SSID_LEN)
  17621. - return -EINVAL;
  17622. -
  17623. - memcpy(ssid_le.SSID, ssid_ie->data, ssid_ie->len);
  17624. diff --git a/package/kernel/mac80211/patches/351-0037-brcmfmac-add-support-for-bcm4339-chip-with-modalias-.patch b/package/kernel/mac80211/patches/351-0037-brcmfmac-add-support-for-bcm4339-chip-with-modalias-.patch
  17625. deleted file mode 100644
  17626. index 1285b30..0000000
  17627. --- a/package/kernel/mac80211/patches/351-0037-brcmfmac-add-support-for-bcm4339-chip-with-modalias-.patch
  17628. +++ /dev/null
  17629. @@ -1,55 +0,0 @@
  17630. -From 634faf3686900ccdee87b77e2c56df8b2159912b Mon Sep 17 00:00:00 2001
  17631. -From: Arend Van Spriel <arend.vanspriel@broadcom.com>
  17632. -Date: Mon, 5 Sep 2016 11:42:12 +0100
  17633. -Subject: [PATCH] brcmfmac: add support for bcm4339 chip with modalias
  17634. - sdio:c00v02D0d4339
  17635. -
  17636. -The driver already supports the bcm4339 chipset but only for the variant
  17637. -that shares the same modalias as the bcm4335, ie. sdio:c00v02D0d4335.
  17638. -It turns out that there are also bcm4339 devices out there that have a
  17639. -more distiguishable modalias sdio:c00v02D0d4339.
  17640. -
  17641. -Reported-by: Steve deRosier <derosier@gmail.com>
  17642. -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  17643. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  17644. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  17645. -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  17646. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17647. ----
  17648. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 1 +
  17649. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 3 ++-
  17650. - include/linux/mmc/sdio_ids.h | 1 +
  17651. - 3 files changed, 4 insertions(+), 1 deletion(-)
  17652. -
  17653. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  17654. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  17655. -@@ -1097,6 +1097,7 @@ static const struct sdio_device_id brcmf
  17656. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43341),
  17657. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43362),
  17658. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4335_4339),
  17659. -+ BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4339),
  17660. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43430),
  17661. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4345),
  17662. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4354),
  17663. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  17664. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  17665. -@@ -3756,7 +3756,8 @@ static u32 brcmf_sdio_buscore_read32(voi
  17666. - u32 val, rev;
  17667. -
  17668. - val = brcmf_sdiod_regrl(sdiodev, addr, NULL);
  17669. -- if (sdiodev->func[0]->device == SDIO_DEVICE_ID_BROADCOM_4335_4339 &&
  17670. -+ if ((sdiodev->func[0]->device == SDIO_DEVICE_ID_BROADCOM_4335_4339 ||
  17671. -+ sdiodev->func[0]->device == SDIO_DEVICE_ID_BROADCOM_4339) &&
  17672. - addr == CORE_CC_REG(SI_ENUM_BASE, chipid)) {
  17673. - rev = (val & CID_REV_MASK) >> CID_REV_SHIFT;
  17674. - if (rev >= 2) {
  17675. ---- a/include/linux/mmc/sdio_ids.h
  17676. -+++ b/include/linux/mmc/sdio_ids.h
  17677. -@@ -32,6 +32,7 @@
  17678. - #define SDIO_DEVICE_ID_BROADCOM_43340 0xa94c
  17679. - #define SDIO_DEVICE_ID_BROADCOM_43341 0xa94d
  17680. - #define SDIO_DEVICE_ID_BROADCOM_4335_4339 0x4335
  17681. -+#define SDIO_DEVICE_ID_BROADCOM_4339 0x4339
  17682. - #define SDIO_DEVICE_ID_BROADCOM_43362 0xa962
  17683. - #define SDIO_DEVICE_ID_BROADCOM_43430 0xa9a6
  17684. - #define SDIO_DEVICE_ID_BROADCOM_4345 0x4345
  17685. diff --git a/package/kernel/mac80211/patches/351-0038-brcmfmac-sdio-shorten-retry-loop-in-brcmf_sdio_kso_c.patch b/package/kernel/mac80211/patches/351-0038-brcmfmac-sdio-shorten-retry-loop-in-brcmf_sdio_kso_c.patch
  17686. deleted file mode 100644
  17687. index 1d5667e..0000000
  17688. --- a/package/kernel/mac80211/patches/351-0038-brcmfmac-sdio-shorten-retry-loop-in-brcmf_sdio_kso_c.patch
  17689. +++ /dev/null
  17690. @@ -1,56 +0,0 @@
  17691. -From 5251b6be8bb5c5675bdf12347c7b83937a5c91e5 Mon Sep 17 00:00:00 2001
  17692. -From: Arend Van Spriel <arend.vanspriel@broadcom.com>
  17693. -Date: Mon, 5 Sep 2016 11:42:13 +0100
  17694. -Subject: [PATCH] brcmfmac: sdio: shorten retry loop in
  17695. - brcmf_sdio_kso_control()
  17696. -
  17697. -In brcmf_sdio_kso_control() there is a retry loop as hardware may take
  17698. -time to settle. However, when the call to brcmf_sdiod_regrb() returns
  17699. -an error it is due to SDIO access failure and it makes no sense to wait
  17700. -for hardware to settle. This patch aborts the loop after a number of
  17701. -subsequent access errors.
  17702. -
  17703. -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  17704. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  17705. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  17706. -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  17707. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17708. ----
  17709. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 11 +++++++++--
  17710. - 1 file changed, 9 insertions(+), 2 deletions(-)
  17711. -
  17712. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  17713. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  17714. -@@ -313,6 +313,7 @@ struct rte_console {
  17715. -
  17716. - #define KSO_WAIT_US 50
  17717. - #define MAX_KSO_ATTEMPTS (PMU_MAX_TRANSITION_DLY/KSO_WAIT_US)
  17718. -+#define BRCMF_SDIO_MAX_ACCESS_ERRORS 5
  17719. -
  17720. - /*
  17721. - * Conversion of 802.1D priority to precedence level
  17722. -@@ -675,6 +676,7 @@ brcmf_sdio_kso_control(struct brcmf_sdio
  17723. - {
  17724. - u8 wr_val = 0, rd_val, cmp_val, bmask;
  17725. - int err = 0;
  17726. -+ int err_cnt = 0;
  17727. - int try_cnt = 0;
  17728. -
  17729. - brcmf_dbg(TRACE, "Enter: on=%d\n", on);
  17730. -@@ -710,9 +712,14 @@ brcmf_sdio_kso_control(struct brcmf_sdio
  17731. - */
  17732. - rd_val = brcmf_sdiod_regrb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR,
  17733. - &err);
  17734. -- if (((rd_val & bmask) == cmp_val) && !err)
  17735. -+ if (!err) {
  17736. -+ if ((rd_val & bmask) == cmp_val)
  17737. -+ break;
  17738. -+ err_cnt = 0;
  17739. -+ }
  17740. -+ /* bail out upon subsequent access errors */
  17741. -+ if (err && (err_cnt++ > BRCMF_SDIO_MAX_ACCESS_ERRORS))
  17742. - break;
  17743. --
  17744. - udelay(KSO_WAIT_US);
  17745. - brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR,
  17746. - wr_val, &err);
  17747. diff --git a/package/kernel/mac80211/patches/351-0039-brcmfmac-ignore-11d-configuration-errors.patch b/package/kernel/mac80211/patches/351-0039-brcmfmac-ignore-11d-configuration-errors.patch
  17748. deleted file mode 100644
  17749. index 1620e00..0000000
  17750. --- a/package/kernel/mac80211/patches/351-0039-brcmfmac-ignore-11d-configuration-errors.patch
  17751. +++ /dev/null
  17752. @@ -1,84 +0,0 @@
  17753. -From b3589dfe02123a0d0ea82076a9f8ef84a46852c0 Mon Sep 17 00:00:00 2001
  17754. -From: Hante Meuleman <hante.meuleman@broadcom.com>
  17755. -Date: Mon, 19 Sep 2016 12:09:51 +0100
  17756. -Subject: [PATCH] brcmfmac: ignore 11d configuration errors
  17757. -
  17758. -802.11d is not always supported by firmware anymore. Currently the
  17759. -AP configuration of 11d will cause an abort if the ioctl set is
  17760. -failing. This behavior is not correct and the error should be
  17761. -ignored.
  17762. -
  17763. -Reviewed-by: Arend Van Spriel <arend.vanspriel@broadcom.com>
  17764. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  17765. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  17766. -Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
  17767. -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  17768. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17769. ----
  17770. - .../broadcom/brcm80211/brcmfmac/cfg80211.c | 27 ++++++++++++----------
  17771. - 1 file changed, 15 insertions(+), 12 deletions(-)
  17772. -
  17773. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  17774. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  17775. -@@ -4422,6 +4422,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  17776. - u16 chanspec = chandef_to_chanspec(&cfg->d11inf, &settings->chandef);
  17777. - bool mbss;
  17778. - int is_11d;
  17779. -+ bool supports_11d;
  17780. -
  17781. - brcmf_dbg(TRACE, "ctrlchn=%d, center=%d, bw=%d, beacon_interval=%d, dtim_period=%d,\n",
  17782. - settings->chandef.chan->hw_value,
  17783. -@@ -4434,11 +4435,16 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  17784. - mbss = ifp->vif->mbss;
  17785. -
  17786. - /* store current 11d setting */
  17787. -- brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_REGULATORY, &ifp->vif->is_11d);
  17788. -- country_ie = brcmf_parse_tlvs((u8 *)settings->beacon.tail,
  17789. -- settings->beacon.tail_len,
  17790. -- WLAN_EID_COUNTRY);
  17791. -- is_11d = country_ie ? 1 : 0;
  17792. -+ if (brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_REGULATORY,
  17793. -+ &ifp->vif->is_11d)) {
  17794. -+ supports_11d = false;
  17795. -+ } else {
  17796. -+ country_ie = brcmf_parse_tlvs((u8 *)settings->beacon.tail,
  17797. -+ settings->beacon.tail_len,
  17798. -+ WLAN_EID_COUNTRY);
  17799. -+ is_11d = country_ie ? 1 : 0;
  17800. -+ supports_11d = true;
  17801. -+ }
  17802. -
  17803. - memset(&ssid_le, 0, sizeof(ssid_le));
  17804. - if (settings->ssid == NULL || settings->ssid_len == 0) {
  17805. -@@ -4497,7 +4503,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  17806. -
  17807. - /* Parameters shared by all radio interfaces */
  17808. - if (!mbss) {
  17809. -- if (is_11d != ifp->vif->is_11d) {
  17810. -+ if ((supports_11d) && (is_11d != ifp->vif->is_11d)) {
  17811. - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY,
  17812. - is_11d);
  17813. - if (err < 0) {
  17814. -@@ -4539,7 +4545,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  17815. - brcmf_err("SET INFRA error %d\n", err);
  17816. - goto exit;
  17817. - }
  17818. -- } else if (WARN_ON(is_11d != ifp->vif->is_11d)) {
  17819. -+ } else if (WARN_ON(supports_11d && (is_11d != ifp->vif->is_11d))) {
  17820. - /* Multiple-BSS should use same 11d configuration */
  17821. - err = -EINVAL;
  17822. - goto exit;
  17823. -@@ -4673,11 +4679,8 @@ static int brcmf_cfg80211_stop_ap(struct
  17824. - brcmf_err("setting INFRA mode failed %d\n", err);
  17825. - if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS))
  17826. - brcmf_fil_iovar_int_set(ifp, "mbss", 0);
  17827. -- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY,
  17828. -- ifp->vif->is_11d);
  17829. -- if (err < 0)
  17830. -- brcmf_err("restoring REGULATORY setting failed %d\n",
  17831. -- err);
  17832. -+ brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY,
  17833. -+ ifp->vif->is_11d);
  17834. - /* Bring device back up so it can be used again */
  17835. - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1);
  17836. - if (err < 0)
  17837. diff --git a/package/kernel/mac80211/patches/351-0040-brcmfmac-rework-pointer-trickery-in-brcmf_proto_bcdc.patch b/package/kernel/mac80211/patches/351-0040-brcmfmac-rework-pointer-trickery-in-brcmf_proto_bcdc.patch
  17838. deleted file mode 100644
  17839. index 9461164..0000000
  17840. --- a/package/kernel/mac80211/patches/351-0040-brcmfmac-rework-pointer-trickery-in-brcmf_proto_bcdc.patch
  17841. +++ /dev/null
  17842. @@ -1,32 +0,0 @@
  17843. -From 704d1c6b56f4ee2ad6a5f012a72a278d17c1a223 Mon Sep 17 00:00:00 2001
  17844. -From: Arend Van Spriel <arend.vanspriel@broadcom.com>
  17845. -Date: Mon, 19 Sep 2016 12:09:52 +0100
  17846. -Subject: [PATCH] brcmfmac: rework pointer trickery in
  17847. - brcmf_proto_bcdc_query_dcmd()
  17848. -
  17849. -The variable info is assigned to point to bcdc->msg[1], which is the
  17850. -same as pointing to bcdc->buf. As that is what we want to access
  17851. -make it clear by fixing the assignment. This also avoid out-of-bounds
  17852. -errors from static analyzers are bcdc->msg[1] is not in the structure
  17853. -definition.
  17854. -
  17855. -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  17856. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  17857. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  17858. -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  17859. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17860. ----
  17861. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c | 2 +-
  17862. - 1 file changed, 1 insertion(+), 1 deletion(-)
  17863. -
  17864. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
  17865. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
  17866. -@@ -194,7 +194,7 @@ retry:
  17867. - }
  17868. -
  17869. - /* Check info buffer */
  17870. -- info = (void *)&msg[1];
  17871. -+ info = (void *)&bcdc->buf[0];
  17872. -
  17873. - /* Copy info buffer */
  17874. - if (buf) {
  17875. diff --git a/package/kernel/mac80211/patches/351-0041-brcmfmac-fix-memory-leak-in-brcmf_flowring_add_tdls_.patch b/package/kernel/mac80211/patches/351-0041-brcmfmac-fix-memory-leak-in-brcmf_flowring_add_tdls_.patch
  17876. deleted file mode 100644
  17877. index 2ececdf..0000000
  17878. --- a/package/kernel/mac80211/patches/351-0041-brcmfmac-fix-memory-leak-in-brcmf_flowring_add_tdls_.patch
  17879. +++ /dev/null
  17880. @@ -1,39 +0,0 @@
  17881. -From bc981641360183990de59da17f9f560f9150b801 Mon Sep 17 00:00:00 2001
  17882. -From: Arend Van Spriel <arend.vanspriel@broadcom.com>
  17883. -Date: Mon, 19 Sep 2016 12:09:53 +0100
  17884. -Subject: [PATCH] brcmfmac: fix memory leak in brcmf_flowring_add_tdls_peer()
  17885. -
  17886. -In the error paths in brcmf_flowring_add_tdls_peer() the allocated
  17887. -resource should be freed.
  17888. -
  17889. -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  17890. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  17891. -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  17892. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17893. ----
  17894. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c | 8 ++++++--
  17895. - 1 file changed, 6 insertions(+), 2 deletions(-)
  17896. -
  17897. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c
  17898. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c
  17899. -@@ -495,14 +495,18 @@ void brcmf_flowring_add_tdls_peer(struct
  17900. - } else {
  17901. - search = flow->tdls_entry;
  17902. - if (memcmp(search->mac, peer, ETH_ALEN) == 0)
  17903. -- return;
  17904. -+ goto free_entry;
  17905. - while (search->next) {
  17906. - search = search->next;
  17907. - if (memcmp(search->mac, peer, ETH_ALEN) == 0)
  17908. -- return;
  17909. -+ goto free_entry;
  17910. - }
  17911. - search->next = tdls_entry;
  17912. - }
  17913. -
  17914. - flow->tdls_active = true;
  17915. -+ return;
  17916. -+
  17917. -+free_entry:
  17918. -+ kfree(tdls_entry);
  17919. - }
  17920. diff --git a/package/kernel/mac80211/patches/351-0042-brcmfmac-initialize-variable-in-brcmf_sdiod_regrl.patch b/package/kernel/mac80211/patches/351-0042-brcmfmac-initialize-variable-in-brcmf_sdiod_regrl.patch
  17921. deleted file mode 100644
  17922. index 529cc8d..0000000
  17923. --- a/package/kernel/mac80211/patches/351-0042-brcmfmac-initialize-variable-in-brcmf_sdiod_regrl.patch
  17924. +++ /dev/null
  17925. @@ -1,28 +0,0 @@
  17926. -From 26305d3d7298d1ddf8fd4ce95a382aa90534f0a3 Mon Sep 17 00:00:00 2001
  17927. -From: Arend Van Spriel <arend.vanspriel@broadcom.com>
  17928. -Date: Mon, 19 Sep 2016 12:09:54 +0100
  17929. -Subject: [PATCH] brcmfmac: initialize variable in brcmf_sdiod_regrl()
  17930. -
  17931. -In case of an error the variable returned is uninitialized. The caller
  17932. -will probably check the error code before using it, but better assure
  17933. -it is set to zero.
  17934. -
  17935. -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  17936. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  17937. -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  17938. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17939. ----
  17940. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 2 +-
  17941. - 1 file changed, 1 insertion(+), 1 deletion(-)
  17942. -
  17943. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  17944. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  17945. -@@ -416,7 +416,7 @@ u8 brcmf_sdiod_regrb(struct brcmf_sdio_d
  17946. -
  17947. - u32 brcmf_sdiod_regrl(struct brcmf_sdio_dev *sdiodev, u32 addr, int *ret)
  17948. - {
  17949. -- u32 data;
  17950. -+ u32 data = 0;
  17951. - int retval;
  17952. -
  17953. - brcmf_dbg(SDIO, "addr:0x%08x\n", addr);
  17954. diff --git a/package/kernel/mac80211/patches/351-0043-brcmfmac-remove-worker-from-.ndo_set_mac_address-cal.patch b/package/kernel/mac80211/patches/351-0043-brcmfmac-remove-worker-from-.ndo_set_mac_address-cal.patch
  17955. deleted file mode 100644
  17956. index 67af30e..0000000
  17957. --- a/package/kernel/mac80211/patches/351-0043-brcmfmac-remove-worker-from-.ndo_set_mac_address-cal.patch
  17958. +++ /dev/null
  17959. @@ -1,107 +0,0 @@
  17960. -From 8fa5fdec09cd379c9ecb8972f344f8f308e0ccf3 Mon Sep 17 00:00:00 2001
  17961. -From: Arend Van Spriel <arend.vanspriel@broadcom.com>
  17962. -Date: Mon, 19 Sep 2016 12:09:55 +0100
  17963. -Subject: [PATCH] brcmfmac: remove worker from .ndo_set_mac_address() callback
  17964. -
  17965. -As it turns out there is no need to use a worker for the callback
  17966. -because it is not called from atomic context.
  17967. -
  17968. -Reported-by: Dan Williams <dcbw@redhat.com>
  17969. -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  17970. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  17971. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  17972. -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  17973. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17974. ----
  17975. - .../wireless/broadcom/brcm80211/brcmfmac/core.c | 39 ++++++++--------------
  17976. - .../wireless/broadcom/brcm80211/brcmfmac/core.h | 2 --
  17977. - 2 files changed, 13 insertions(+), 28 deletions(-)
  17978. -
  17979. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  17980. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  17981. -@@ -136,27 +136,6 @@ static void _brcmf_set_multicast_list(st
  17982. - err);
  17983. - }
  17984. -
  17985. --static void
  17986. --_brcmf_set_mac_address(struct work_struct *work)
  17987. --{
  17988. -- struct brcmf_if *ifp;
  17989. -- s32 err;
  17990. --
  17991. -- ifp = container_of(work, struct brcmf_if, setmacaddr_work);
  17992. --
  17993. -- brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx);
  17994. --
  17995. -- err = brcmf_fil_iovar_data_set(ifp, "cur_etheraddr", ifp->mac_addr,
  17996. -- ETH_ALEN);
  17997. -- if (err < 0) {
  17998. -- brcmf_err("Setting cur_etheraddr failed, %d\n", err);
  17999. -- } else {
  18000. -- brcmf_dbg(TRACE, "MAC address updated to %pM\n",
  18001. -- ifp->mac_addr);
  18002. -- memcpy(ifp->ndev->dev_addr, ifp->mac_addr, ETH_ALEN);
  18003. -- }
  18004. --}
  18005. --
  18006. - #if IS_ENABLED(CONFIG_IPV6)
  18007. - static void _brcmf_update_ndtable(struct work_struct *work)
  18008. - {
  18009. -@@ -190,10 +169,20 @@ static int brcmf_netdev_set_mac_address(
  18010. - {
  18011. - struct brcmf_if *ifp = netdev_priv(ndev);
  18012. - struct sockaddr *sa = (struct sockaddr *)addr;
  18013. -+ int err;
  18014. -
  18015. -- memcpy(&ifp->mac_addr, sa->sa_data, ETH_ALEN);
  18016. -- schedule_work(&ifp->setmacaddr_work);
  18017. -- return 0;
  18018. -+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx);
  18019. -+
  18020. -+ err = brcmf_fil_iovar_data_set(ifp, "cur_etheraddr", sa->sa_data,
  18021. -+ ETH_ALEN);
  18022. -+ if (err < 0) {
  18023. -+ brcmf_err("Setting cur_etheraddr failed, %d\n", err);
  18024. -+ } else {
  18025. -+ brcmf_dbg(TRACE, "updated to %pM\n", sa->sa_data);
  18026. -+ memcpy(ifp->mac_addr, sa->sa_data, ETH_ALEN);
  18027. -+ memcpy(ifp->ndev->dev_addr, ifp->mac_addr, ETH_ALEN);
  18028. -+ }
  18029. -+ return err;
  18030. - }
  18031. -
  18032. - static void brcmf_netdev_set_multicast_list(struct net_device *ndev)
  18033. -@@ -525,7 +514,6 @@ int brcmf_net_attach(struct brcmf_if *if
  18034. - /* set the mac address */
  18035. - memcpy(ndev->dev_addr, ifp->mac_addr, ETH_ALEN);
  18036. -
  18037. -- INIT_WORK(&ifp->setmacaddr_work, _brcmf_set_mac_address);
  18038. - INIT_WORK(&ifp->multicast_work, _brcmf_set_multicast_list);
  18039. - INIT_WORK(&ifp->ndoffload_work, _brcmf_update_ndtable);
  18040. -
  18041. -@@ -730,7 +718,6 @@ static void brcmf_del_if(struct brcmf_pu
  18042. - }
  18043. -
  18044. - if (ifp->ndev->netdev_ops == &brcmf_netdev_ops_pri) {
  18045. -- cancel_work_sync(&ifp->setmacaddr_work);
  18046. - cancel_work_sync(&ifp->multicast_work);
  18047. - cancel_work_sync(&ifp->ndoffload_work);
  18048. - }
  18049. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  18050. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  18051. -@@ -176,7 +176,6 @@ enum brcmf_netif_stop_reason {
  18052. - * @vif: points to cfg80211 specific interface information.
  18053. - * @ndev: associated network device.
  18054. - * @stats: interface specific network statistics.
  18055. -- * @setmacaddr_work: worker object for setting mac address.
  18056. - * @multicast_work: worker object for multicast provisioning.
  18057. - * @ndoffload_work: worker object for neighbor discovery offload configuration.
  18058. - * @fws_desc: interface specific firmware-signalling descriptor.
  18059. -@@ -193,7 +192,6 @@ struct brcmf_if {
  18060. - struct brcmf_cfg80211_vif *vif;
  18061. - struct net_device *ndev;
  18062. - struct net_device_stats stats;
  18063. -- struct work_struct setmacaddr_work;
  18064. - struct work_struct multicast_work;
  18065. - struct work_struct ndoffload_work;
  18066. - struct brcmf_fws_mac_descriptor *fws_desc;
  18067. diff --git a/package/kernel/mac80211/patches/351-0044-brcmfmac-remove-unnecessary-null-pointer-check.patch b/package/kernel/mac80211/patches/351-0044-brcmfmac-remove-unnecessary-null-pointer-check.patch
  18068. deleted file mode 100644
  18069. index 5a08479..0000000
  18070. --- a/package/kernel/mac80211/patches/351-0044-brcmfmac-remove-unnecessary-null-pointer-check.patch
  18071. +++ /dev/null
  18072. @@ -1,31 +0,0 @@
  18073. -From 835680b82f029818c813324aed3073cdcf63241f Mon Sep 17 00:00:00 2001
  18074. -From: Hante Meuleman <hante.meuleman@broadcom.com>
  18075. -Date: Mon, 19 Sep 2016 12:09:56 +0100
  18076. -Subject: [PATCH] brcmfmac: remove unnecessary null pointer check
  18077. -
  18078. -in the function brcmf_bus_start() in the exception handling a
  18079. -check is made to dermine whether ifp is null, though this is not
  18080. -possible. Removing the unnessary check.
  18081. -
  18082. -Reviewed-by: Arend Van Spriel <arend.vanspriel@broadcom.com>
  18083. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  18084. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  18085. -Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
  18086. -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  18087. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18088. ----
  18089. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 3 +--
  18090. - 1 file changed, 1 insertion(+), 2 deletions(-)
  18091. -
  18092. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  18093. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  18094. -@@ -1048,8 +1048,7 @@ fail:
  18095. - brcmf_fws_del_interface(ifp);
  18096. - brcmf_fws_deinit(drvr);
  18097. - }
  18098. -- if (ifp)
  18099. -- brcmf_net_detach(ifp->ndev, false);
  18100. -+ brcmf_net_detach(ifp->ndev, false);
  18101. - if (p2p_ifp)
  18102. - brcmf_net_detach(p2p_ifp->ndev, false);
  18103. - drvr->iflist[0] = NULL;
  18104. diff --git a/package/kernel/mac80211/patches/351-0045-brcmfmac-fix-clearing-entry-IPv6-address.patch b/package/kernel/mac80211/patches/351-0045-brcmfmac-fix-clearing-entry-IPv6-address.patch
  18105. deleted file mode 100644
  18106. index 0b3a23e..0000000
  18107. --- a/package/kernel/mac80211/patches/351-0045-brcmfmac-fix-clearing-entry-IPv6-address.patch
  18108. +++ /dev/null
  18109. @@ -1,37 +0,0 @@
  18110. -From 2b7425f3629b38c438f890c20c5faeca64b144ff Mon Sep 17 00:00:00 2001
  18111. -From: Hante Meuleman <hante.meuleman@broadcom.com>
  18112. -Date: Mon, 19 Sep 2016 12:09:57 +0100
  18113. -Subject: [PATCH] brcmfmac: fix clearing entry IPv6 address
  18114. -
  18115. -When IPv6 address is to be cleared there is a possible out of
  18116. -bound access. But also the clearing of the last entry and the
  18117. -adjustment of total number of stored IPv6 addresses is not
  18118. -updated. This patch fixes that bug. Bug was found using coverity.
  18119. -
  18120. -Reviewed-by: Arend Van Spriel <arend.vanspriel@broadcom.com>
  18121. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  18122. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  18123. -Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
  18124. -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  18125. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18126. ----
  18127. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 7 +++++--
  18128. - 1 file changed, 5 insertions(+), 2 deletions(-)
  18129. -
  18130. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  18131. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  18132. -@@ -873,9 +873,12 @@ static int brcmf_inet6addr_changed(struc
  18133. - }
  18134. - break;
  18135. - case NETDEV_DOWN:
  18136. -- if (i < NDOL_MAX_ENTRIES)
  18137. -- for (; i < ifp->ipv6addr_idx; i++)
  18138. -+ if (i < NDOL_MAX_ENTRIES) {
  18139. -+ for (; i < ifp->ipv6addr_idx - 1; i++)
  18140. - table[i] = table[i + 1];
  18141. -+ memset(&table[i], 0, sizeof(table[i]));
  18142. -+ ifp->ipv6addr_idx--;
  18143. -+ }
  18144. - break;
  18145. - default:
  18146. - break;
  18147. diff --git a/package/kernel/mac80211/patches/351-0046-brcmfmac-fix-out-of-bound-access-on-clearing-wowl-wa.patch b/package/kernel/mac80211/patches/351-0046-brcmfmac-fix-out-of-bound-access-on-clearing-wowl-wa.patch
  18148. deleted file mode 100644
  18149. index a47cb32..0000000
  18150. --- a/package/kernel/mac80211/patches/351-0046-brcmfmac-fix-out-of-bound-access-on-clearing-wowl-wa.patch
  18151. +++ /dev/null
  18152. @@ -1,44 +0,0 @@
  18153. -From a7ed7828ecda0c2b5e0d7f55dedd4230afd4b583 Mon Sep 17 00:00:00 2001
  18154. -From: Hante Meuleman <hante.meuleman@broadcom.com>
  18155. -Date: Mon, 19 Sep 2016 12:09:58 +0100
  18156. -Subject: [PATCH] brcmfmac: fix out of bound access on clearing wowl wake
  18157. - indicator
  18158. -
  18159. -Clearing the wowl wakeindicator happens with a rather odd
  18160. -construction where the string "clear" is used to set the iovar
  18161. -wowl_wakeind. This was implemented incorrectly as it caused an
  18162. -out of bound access. Use an intermediate variable of correct
  18163. -length and copy string in that. Problem was found using coverity.
  18164. -
  18165. -Reviewed-by: Arend Van Spriel <arend.vanspriel@broadcom.com>
  18166. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  18167. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  18168. -Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
  18169. -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  18170. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18171. ----
  18172. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 6 ++++--
  18173. - 1 file changed, 4 insertions(+), 2 deletions(-)
  18174. -
  18175. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  18176. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  18177. -@@ -3623,6 +3623,7 @@ static void brcmf_configure_wowl(struct
  18178. - struct cfg80211_wowlan *wowl)
  18179. - {
  18180. - u32 wowl_config;
  18181. -+ struct brcmf_wowl_wakeind_le wowl_wakeind;
  18182. - u32 i;
  18183. -
  18184. - brcmf_dbg(TRACE, "Suspend, wowl config.\n");
  18185. -@@ -3664,8 +3665,9 @@ static void brcmf_configure_wowl(struct
  18186. - if (!test_bit(BRCMF_VIF_STATUS_CONNECTED, &ifp->vif->sme_state))
  18187. - wowl_config |= BRCMF_WOWL_UNASSOC;
  18188. -
  18189. -- brcmf_fil_iovar_data_set(ifp, "wowl_wakeind", "clear",
  18190. -- sizeof(struct brcmf_wowl_wakeind_le));
  18191. -+ memcpy(&wowl_wakeind, "clear", 6);
  18192. -+ brcmf_fil_iovar_data_set(ifp, "wowl_wakeind", &wowl_wakeind,
  18193. -+ sizeof(wowl_wakeind));
  18194. - brcmf_fil_iovar_int_set(ifp, "wowl", wowl_config);
  18195. - brcmf_fil_iovar_int_set(ifp, "wowl_activate", 1);
  18196. - brcmf_bus_wowl_config(cfg->pub->bus_if, true);
  18197. diff --git a/package/kernel/mac80211/patches/351-0047-brcmfmac-simplify-mapping-of-auth-type.patch b/package/kernel/mac80211/patches/351-0047-brcmfmac-simplify-mapping-of-auth-type.patch
  18198. deleted file mode 100644
  18199. index a652ae6..0000000
  18200. --- a/package/kernel/mac80211/patches/351-0047-brcmfmac-simplify-mapping-of-auth-type.patch
  18201. +++ /dev/null
  18202. @@ -1,39 +0,0 @@
  18203. -From 92c313604711a0976def79dabb9e8da3cc2cc780 Mon Sep 17 00:00:00 2001
  18204. -From: Hante Meuleman <hante.meuleman@broadcom.com>
  18205. -Date: Mon, 19 Sep 2016 12:09:59 +0100
  18206. -Subject: [PATCH] brcmfmac: simplify mapping of auth type
  18207. -
  18208. -The 802.11 standard only has four valid auth type configurations of which
  18209. -our firmware only supports two, ie. Open System and Shared Key. Simplify
  18210. -the mapping falling back to automatic for other types specified by
  18211. -user-space.
  18212. -
  18213. -Reviewed-by: Arend Van Spriel <arend.vanspriel@broadcom.com>
  18214. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  18215. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  18216. -Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
  18217. -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  18218. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18219. ----
  18220. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 8 +-------
  18221. - 1 file changed, 1 insertion(+), 7 deletions(-)
  18222. -
  18223. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  18224. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  18225. -@@ -1577,15 +1577,9 @@ static s32 brcmf_set_auth_type(struct ne
  18226. - val = 1;
  18227. - brcmf_dbg(CONN, "shared key\n");
  18228. - break;
  18229. -- case NL80211_AUTHTYPE_AUTOMATIC:
  18230. -- val = 2;
  18231. -- brcmf_dbg(CONN, "automatic\n");
  18232. -- break;
  18233. -- case NL80211_AUTHTYPE_NETWORK_EAP:
  18234. -- brcmf_dbg(CONN, "network eap\n");
  18235. - default:
  18236. - val = 2;
  18237. -- brcmf_err("invalid auth type (%d)\n", sme->auth_type);
  18238. -+ brcmf_dbg(CONN, "automatic, auth type (%d)\n", sme->auth_type);
  18239. - break;
  18240. - }
  18241. -
  18242. diff --git a/package/kernel/mac80211/patches/351-0048-brcmfmac-fix-memory-leak-in-brcmf_fill_bss_param.patch b/package/kernel/mac80211/patches/351-0048-brcmfmac-fix-memory-leak-in-brcmf_fill_bss_param.patch
  18243. deleted file mode 100644
  18244. index a6fae37..0000000
  18245. --- a/package/kernel/mac80211/patches/351-0048-brcmfmac-fix-memory-leak-in-brcmf_fill_bss_param.patch
  18246. +++ /dev/null
  18247. @@ -1,41 +0,0 @@
  18248. -From 23e9c128adb2038c27a424a5f91136e7fa3e0dc6 Mon Sep 17 00:00:00 2001
  18249. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
  18250. -Date: Wed, 21 Sep 2016 08:23:24 +0200
  18251. -Subject: [PATCH] brcmfmac: fix memory leak in brcmf_fill_bss_param
  18252. -MIME-Version: 1.0
  18253. -Content-Type: text/plain; charset=UTF-8
  18254. -Content-Transfer-Encoding: 8bit
  18255. -
  18256. -This function is called from get_station callback which means that every
  18257. -time user space was getting/dumping station(s) we were leaking 2 KiB.
  18258. -
  18259. -Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
  18260. -Fixes: 1f0dc59a6de ("brcmfmac: rework .get_station() callback")
  18261. -Cc: stable@vger.kernel.org # 4.2+
  18262. -Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  18263. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18264. ----
  18265. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 5 ++++-
  18266. - 1 file changed, 4 insertions(+), 1 deletion(-)
  18267. -
  18268. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  18269. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  18270. -@@ -2463,7 +2463,7 @@ static void brcmf_fill_bss_param(struct
  18271. - WL_BSS_INFO_MAX);
  18272. - if (err) {
  18273. - brcmf_err("Failed to get bss info (%d)\n", err);
  18274. -- return;
  18275. -+ goto out_kfree;
  18276. - }
  18277. - si->filled |= BIT(NL80211_STA_INFO_BSS_PARAM);
  18278. - si->bss_param.beacon_interval = le16_to_cpu(buf->bss_le.beacon_period);
  18279. -@@ -2475,6 +2475,9 @@ static void brcmf_fill_bss_param(struct
  18280. - si->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_PREAMBLE;
  18281. - if (capability & WLAN_CAPABILITY_SHORT_SLOT_TIME)
  18282. - si->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_SLOT_TIME;
  18283. -+
  18284. -+out_kfree:
  18285. -+ kfree(buf);
  18286. - }
  18287. -
  18288. - static s32
  18289. diff --git a/package/kernel/mac80211/patches/351-0049-brcmfmac-drop-unused-fields-from-struct-brcmf_pub.patch b/package/kernel/mac80211/patches/351-0049-brcmfmac-drop-unused-fields-from-struct-brcmf_pub.patch
  18290. deleted file mode 100644
  18291. index 47af73a..0000000
  18292. --- a/package/kernel/mac80211/patches/351-0049-brcmfmac-drop-unused-fields-from-struct-brcmf_pub.patch
  18293. +++ /dev/null
  18294. @@ -1,60 +0,0 @@
  18295. -From 2df86ad959c9d1cdbeb2f23a0801857731156692 Mon Sep 17 00:00:00 2001
  18296. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
  18297. -Date: Fri, 23 Sep 2016 15:27:46 +0200
  18298. -Subject: [PATCH] brcmfmac: drop unused fields from struct brcmf_pub
  18299. -MIME-Version: 1.0
  18300. -Content-Type: text/plain; charset=UTF-8
  18301. -Content-Transfer-Encoding: 8bit
  18302. -
  18303. -They seem to be there from the first day. We calculate these values but
  18304. -never use them.
  18305. -
  18306. -Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
  18307. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18308. ----
  18309. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 3 ---
  18310. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h | 4 ----
  18311. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c | 2 --
  18312. - 3 files changed, 9 deletions(-)
  18313. -
  18314. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  18315. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  18316. -@@ -508,9 +508,6 @@ int brcmf_net_attach(struct brcmf_if *if
  18317. - ndev->hard_header_len += drvr->hdrlen;
  18318. - ndev->ethtool_ops = &brcmf_ethtool_ops;
  18319. -
  18320. -- drvr->rxsz = ndev->mtu + ndev->hard_header_len +
  18321. -- drvr->hdrlen;
  18322. --
  18323. - /* set the mac address */
  18324. - memcpy(ndev->dev_addr, ifp->mac_addr, ETH_ALEN);
  18325. -
  18326. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  18327. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  18328. -@@ -112,15 +112,11 @@ struct brcmf_pub {
  18329. -
  18330. - /* Internal brcmf items */
  18331. - uint hdrlen; /* Total BRCMF header length (proto + bus) */
  18332. -- uint rxsz; /* Rx buffer size bus module should use */
  18333. -
  18334. - /* Dongle media info */
  18335. - char fwver[BRCMF_DRIVER_FIRMWARE_VERSION_LEN];
  18336. - u8 mac[ETH_ALEN]; /* MAC address obtained from dongle */
  18337. -
  18338. -- /* Multicast data packets sent to dongle */
  18339. -- unsigned long tx_multicast;
  18340. --
  18341. - struct mac_address addresses[BRCMF_MAX_IFS];
  18342. -
  18343. - struct brcmf_if *iflist[BRCMF_MAX_IFS];
  18344. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
  18345. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
  18346. -@@ -2104,8 +2104,6 @@ int brcmf_fws_process_skb(struct brcmf_i
  18347. - if (!skb->priority)
  18348. - skb->priority = cfg80211_classify8021d(skb, NULL);
  18349. -
  18350. -- drvr->tx_multicast += !!multicast;
  18351. --
  18352. - if (fws->avoid_queueing) {
  18353. - rc = brcmf_proto_txdata(drvr, ifp->ifidx, 0, skb);
  18354. - if (rc < 0)
  18355. diff --git a/package/kernel/mac80211/patches/351-0050-brcmfmac-replace-WARNING-on-timeout-with-a-simple-er.patch b/package/kernel/mac80211/patches/351-0050-brcmfmac-replace-WARNING-on-timeout-with-a-simple-er.patch
  18356. deleted file mode 100644
  18357. index ca4863a..0000000
  18358. --- a/package/kernel/mac80211/patches/351-0050-brcmfmac-replace-WARNING-on-timeout-with-a-simple-er.patch
  18359. +++ /dev/null
  18360. @@ -1,38 +0,0 @@
  18361. -From 2f0e56fa37cce60a5ac5d451bcadec51cd711436 Mon Sep 17 00:00:00 2001
  18362. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
  18363. -Date: Tue, 27 Sep 2016 12:12:24 +0200
  18364. -Subject: [PATCH] brcmfmac: replace WARNING on timeout with a simple error
  18365. - message
  18366. -MIME-Version: 1.0
  18367. -Content-Type: text/plain; charset=UTF-8
  18368. -Content-Transfer-Encoding: 8bit
  18369. -
  18370. -Even with timeout increased to 950 ms we get WARNINGs from time to time.
  18371. -It mostly happens on A-MPDU stalls (e.g. when station goes out of
  18372. -range). It may take up to 5-10 secods for the firmware to recover and
  18373. -for that time it doesn't process packets.
  18374. -
  18375. -It's still useful to have a message on time out as it may indicate some
  18376. -firmware problem and incorrect key update. Raising a WARNING however
  18377. -wasn't really that necessary, it doesn't point to any driver bug anymore
  18378. -and backtrace wasn't much useful.
  18379. -
  18380. -Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
  18381. -Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  18382. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18383. ----
  18384. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 3 ++-
  18385. - 1 file changed, 2 insertions(+), 1 deletion(-)
  18386. -
  18387. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  18388. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  18389. -@@ -1155,7 +1155,8 @@ int brcmf_netdev_wait_pend8021x(struct b
  18390. - !brcmf_get_pend_8021x_cnt(ifp),
  18391. - MAX_WAIT_FOR_8021X_TX);
  18392. -
  18393. -- WARN_ON(!err);
  18394. -+ if (!err)
  18395. -+ brcmf_err("Timed out waiting for no pending 802.1x packets\n");
  18396. -
  18397. - return !err;
  18398. - }
  18399. diff --git a/package/kernel/mac80211/patches/351-0051-brcmfmac-use-correct-skb-freeing-helper-when-deletin.patch b/package/kernel/mac80211/patches/351-0051-brcmfmac-use-correct-skb-freeing-helper-when-deletin.patch
  18400. deleted file mode 100644
  18401. index 6976359..0000000
  18402. --- a/package/kernel/mac80211/patches/351-0051-brcmfmac-use-correct-skb-freeing-helper-when-deletin.patch
  18403. +++ /dev/null
  18404. @@ -1,58 +0,0 @@
  18405. -From 7f00ee2bbc630900ba16fc2690473f3e2db0e264 Mon Sep 17 00:00:00 2001
  18406. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
  18407. -Date: Tue, 27 Sep 2016 14:11:04 +0200
  18408. -Subject: [PATCH] brcmfmac: use correct skb freeing helper when deleting
  18409. - flowring
  18410. -MIME-Version: 1.0
  18411. -Content-Type: text/plain; charset=UTF-8
  18412. -Content-Transfer-Encoding: 8bit
  18413. -
  18414. -Flowrings contain skbs waiting for transmission that were passed to us
  18415. -by netif. It means we checked every one of them looking for 802.1x
  18416. -Ethernet type. When deleting flowring we have to use freeing function
  18417. -that will check for 802.1x type as well.
  18418. -
  18419. -Freeing skbs without a proper check was leading to counter not being
  18420. -properly decreased. This was triggering a WARNING every time
  18421. -brcmf_netdev_wait_pend8021x was called.
  18422. -
  18423. -Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
  18424. -Acked-by: Arend van Spriel <arend@broadcom.com>
  18425. -Cc: stable@vger.kernel.org # 4.5+
  18426. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18427. ----
  18428. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c | 9 ++++++++-
  18429. - 1 file changed, 8 insertions(+), 1 deletion(-)
  18430. -
  18431. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c
  18432. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c
  18433. -@@ -234,13 +234,20 @@ static void brcmf_flowring_block(struct
  18434. -
  18435. - void brcmf_flowring_delete(struct brcmf_flowring *flow, u16 flowid)
  18436. - {
  18437. -+ struct brcmf_bus *bus_if = dev_get_drvdata(flow->dev);
  18438. - struct brcmf_flowring_ring *ring;
  18439. -+ struct brcmf_if *ifp;
  18440. - u16 hash_idx;
  18441. -+ u8 ifidx;
  18442. - struct sk_buff *skb;
  18443. -
  18444. - ring = flow->rings[flowid];
  18445. - if (!ring)
  18446. - return;
  18447. -+
  18448. -+ ifidx = brcmf_flowring_ifidx_get(flow, flowid);
  18449. -+ ifp = brcmf_get_ifp(bus_if->drvr, ifidx);
  18450. -+
  18451. - brcmf_flowring_block(flow, flowid, false);
  18452. - hash_idx = ring->hash_id;
  18453. - flow->hash[hash_idx].ifidx = BRCMF_FLOWRING_INVALID_IFIDX;
  18454. -@@ -249,7 +256,7 @@ void brcmf_flowring_delete(struct brcmf_
  18455. -
  18456. - skb = skb_dequeue(&ring->skblist);
  18457. - while (skb) {
  18458. -- brcmu_pkt_buf_free_skb(skb);
  18459. -+ brcmf_txfinalize(ifp, skb, false);
  18460. - skb = skb_dequeue(&ring->skblist);
  18461. - }
  18462. -
  18463. diff --git a/package/kernel/mac80211/patches/402-ath_regd_optional.patch b/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  18464. index 7351353..4634283 100644
  18465. --- a/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  18466. +++ b/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  18467. @@ -8,7 +8,7 @@
  18468. + return;
  18469. +#endif
  18470. +
  18471. - for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
  18472. + for (band = 0; band < NUM_NL80211_BANDS; band++) {
  18473. if (!wiphy->bands[band])
  18474. continue;
  18475. @@ -374,6 +378,10 @@ ath_reg_apply_ir_flags(struct wiphy *wip
  18476. @@ -19,7 +19,7 @@
  18477. + return;
  18478. +#endif
  18479. +
  18480. - sband = wiphy->bands[IEEE80211_BAND_2GHZ];
  18481. + sband = wiphy->bands[NL80211_BAND_2GHZ];
  18482. if (!sband)
  18483. return;
  18484. @@ -402,6 +410,10 @@ static void ath_reg_apply_radar_flags(st
  18485. @@ -30,7 +30,7 @@
  18486. + return;
  18487. +#endif
  18488. +
  18489. - if (!wiphy->bands[IEEE80211_BAND_5GHZ])
  18490. + if (!wiphy->bands[NL80211_BAND_5GHZ])
  18491. return;
  18492. @@ -633,6 +645,11 @@ ath_regd_init_wiphy(struct ath_regulator
  18493. @@ -59,7 +59,7 @@
  18494. ---help---
  18495. --- a/.local-symbols
  18496. +++ b/.local-symbols
  18497. -@@ -125,6 +125,7 @@ ADM8211=
  18498. +@@ -127,6 +127,7 @@ ADM8211=
  18499. ATH_COMMON=
  18500. WLAN_VENDOR_ATH=
  18501. ATH_DEBUG=
  18502. 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
  18503. index 1a62484..f2f52f9 100644
  18504. --- a/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch
  18505. +++ b/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch
  18506. @@ -1,6 +1,6 @@
  18507. --- a/drivers/net/wireless/ath/ath9k/init.c
  18508. +++ b/drivers/net/wireless/ath/ath9k/init.c
  18509. -@@ -722,6 +722,7 @@ static const struct ieee80211_iface_limi
  18510. +@@ -727,6 +727,7 @@ static const struct ieee80211_iface_limi
  18511. BIT(NL80211_IFTYPE_AP) },
  18512. { .max = 1, .types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  18513. BIT(NL80211_IFTYPE_P2P_GO) },
  18514. diff --git a/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch b/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch
  18515. index a7f9d9f..f21eed1 100644
  18516. --- a/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch
  18517. +++ b/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch
  18518. @@ -1,6 +1,6 @@
  18519. --- a/drivers/net/wireless/ath/ath9k/debug.c
  18520. +++ b/drivers/net/wireless/ath/ath9k/debug.c
  18521. -@@ -1301,6 +1301,53 @@ void ath9k_deinit_debug(struct ath_softc
  18522. +@@ -1315,6 +1315,53 @@ void ath9k_deinit_debug(struct ath_softc
  18523. ath9k_cmn_spectral_deinit_debug(&sc->spec_priv);
  18524. }
  18525. @@ -54,7 +54,7 @@
  18526. int ath9k_init_debug(struct ath_hw *ah)
  18527. {
  18528. struct ath_common *common = ath9k_hw_common(ah);
  18529. -@@ -1320,6 +1367,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  18530. +@@ -1334,6 +1381,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  18531. ath9k_tx99_init_debug(sc);
  18532. ath9k_cmn_spectral_init_debug(&sc->spec_priv, sc->debug.debugfs_phy);
  18533. diff --git a/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch b/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch
  18534. index 5892c3e..1825d77 100644
  18535. --- a/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch
  18536. +++ b/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch
  18537. @@ -1,6 +1,6 @@
  18538. --- a/drivers/net/wireless/ath/ath9k/init.c
  18539. +++ b/drivers/net/wireless/ath/ath9k/init.c
  18540. -@@ -1024,23 +1024,23 @@ static int __init ath9k_init(void)
  18541. +@@ -1030,23 +1030,23 @@ static int __init ath9k_init(void)
  18542. {
  18543. int error;
  18544. diff --git a/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch b/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch
  18545. index 6766111..15b8d7b 100644
  18546. --- a/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch
  18547. +++ b/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch
  18548. @@ -8,4 +8,4 @@
  18549. +#define ATH_RXBUF 256
  18550. #define ATH_TXBUF 512
  18551. #define ATH_TXBUF_RESERVE 5
  18552. - #define ATH_MAX_QDEPTH (ATH_TXBUF / 4 - ATH_TXBUF_RESERVE)
  18553. + #define ATH_TXMAXTRY 13
  18554. diff --git a/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch b/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch
  18555. index 5ecf528..c98072b 100644
  18556. --- a/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch
  18557. +++ b/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch
  18558. @@ -1,6 +1,6 @@
  18559. --- a/drivers/net/wireless/ath/ath9k/debug.c
  18560. +++ b/drivers/net/wireless/ath/ath9k/debug.c
  18561. -@@ -1348,6 +1348,52 @@ static const struct file_operations fops
  18562. +@@ -1362,6 +1362,52 @@ static const struct file_operations fops
  18563. .owner = THIS_MODULE
  18564. };
  18565. @@ -53,7 +53,7 @@
  18566. int ath9k_init_debug(struct ath_hw *ah)
  18567. {
  18568. struct ath_common *common = ath9k_hw_common(ah);
  18569. -@@ -1369,6 +1415,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  18570. +@@ -1383,6 +1429,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  18571. debugfs_create_file("eeprom", S_IRUSR, sc->debug.debugfs_phy, sc,
  18572. &fops_eeprom);
  18573. @@ -90,7 +90,7 @@
  18574. ichan->channel = chan->center_freq;
  18575. ichan->chan = chan;
  18576. @@ -308,7 +310,19 @@ static void ath9k_cmn_update_ichannel(st
  18577. - if (chan->band == IEEE80211_BAND_5GHZ)
  18578. + if (chan->band == NL80211_BAND_5GHZ)
  18579. flags |= CHANNEL_5GHZ;
  18580. - switch (chandef->width) {
  18581. diff --git a/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch b/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
  18582. index c84d1bc..167eeff 100644
  18583. --- a/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
  18584. +++ b/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
  18585. @@ -20,7 +20,7 @@
  18586. #define AR9160_DEVID_PCI 0x0027
  18587. --- a/drivers/net/wireless/ath/ath9k/pci.c
  18588. +++ b/drivers/net/wireless/ath/ath9k/pci.c
  18589. -@@ -751,6 +751,7 @@ static const struct pci_device_id ath_pc
  18590. +@@ -761,6 +761,7 @@ static const struct pci_device_id ath_pc
  18591. .driver_data = ATH9K_PCI_BT_ANT_DIV },
  18592. #endif
  18593. diff --git a/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
  18594. index e151a12..c40598d 100644
  18595. --- a/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
  18596. +++ b/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
  18597. @@ -1,6 +1,6 @@
  18598. --- a/include/net/cfg80211.h
  18599. +++ b/include/net/cfg80211.h
  18600. -@@ -2363,6 +2363,7 @@ struct cfg80211_qos_map {
  18601. +@@ -2410,6 +2410,7 @@ struct cfg80211_qos_map {
  18602. * (as advertised by the nl80211 feature flag.)
  18603. * @get_tx_power: store the current TX power into the dbm variable;
  18604. * return 0 if successful
  18605. @@ -8,7 +8,7 @@
  18606. *
  18607. * @set_wds_peer: set the WDS peer for a WDS interface
  18608. *
  18609. -@@ -2624,6 +2625,7 @@ struct cfg80211_ops {
  18610. +@@ -2671,6 +2672,7 @@ struct cfg80211_ops {
  18611. enum nl80211_tx_power_setting type, int mbm);
  18612. int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
  18613. int *dbm);
  18614. @@ -18,7 +18,7 @@
  18615. const u8 *addr);
  18616. --- a/include/net/mac80211.h
  18617. +++ b/include/net/mac80211.h
  18618. -@@ -1286,6 +1286,7 @@ enum ieee80211_smps_mode {
  18619. +@@ -1317,6 +1317,7 @@ enum ieee80211_smps_mode {
  18620. *
  18621. * @power_level: requested transmit power (in dBm), backward compatibility
  18622. * value only that is set to the minimum of all interfaces
  18623. @@ -26,7 +26,7 @@
  18624. *
  18625. * @chandef: the channel definition to tune to
  18626. * @radar_enabled: whether radar detection is enabled
  18627. -@@ -1306,6 +1307,7 @@ enum ieee80211_smps_mode {
  18628. +@@ -1337,6 +1338,7 @@ enum ieee80211_smps_mode {
  18629. struct ieee80211_conf {
  18630. u32 flags;
  18631. int power_level, dynamic_ps_timeout;
  18632. @@ -36,9 +36,9 @@
  18633. u8 ps_dtim_period;
  18634. --- a/include/uapi/linux/nl80211.h
  18635. +++ b/include/uapi/linux/nl80211.h
  18636. -@@ -1790,6 +1790,9 @@ enum nl80211_commands {
  18637. - * between scans. The scan plans are executed sequentially.
  18638. - * Each scan plan is a nested attribute of &enum nl80211_sched_scan_plan.
  18639. +@@ -1829,6 +1829,9 @@ enum nl80211_commands {
  18640. + * %NL80211_ATTR_EXT_CAPA_MASK, to specify the extended capabilities per
  18641. + * interface type.
  18642. *
  18643. + * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce
  18644. + * transmit power to stay within regulatory limits. u32, dBi.
  18645. @@ -46,9 +46,9 @@
  18646. * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  18647. * @NL80211_ATTR_MAX: highest attribute number currently defined
  18648. * @__NL80211_ATTR_AFTER_LAST: internal use
  18649. -@@ -2164,6 +2167,8 @@ enum nl80211_attrs {
  18650. - NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS,
  18651. - NL80211_ATTR_SCHED_SCAN_PLANS,
  18652. +@@ -2213,6 +2216,8 @@ enum nl80211_attrs {
  18653. +
  18654. + NL80211_ATTR_IFTYPE_EXT_CAPA,
  18655. + NL80211_ATTR_WIPHY_ANTENNA_GAIN,
  18656. +
  18657. @@ -57,7 +57,7 @@
  18658. __NL80211_ATTR_AFTER_LAST,
  18659. --- a/net/mac80211/cfg.c
  18660. +++ b/net/mac80211/cfg.c
  18661. -@@ -2229,6 +2229,19 @@ static int ieee80211_get_tx_power(struct
  18662. +@@ -2238,6 +2238,19 @@ static int ieee80211_get_tx_power(struct
  18663. return 0;
  18664. }
  18665. @@ -77,7 +77,7 @@
  18666. static int ieee80211_set_wds_peer(struct wiphy *wiphy, struct net_device *dev,
  18667. const u8 *addr)
  18668. {
  18669. -@@ -3403,6 +3416,7 @@ const struct cfg80211_ops mac80211_confi
  18670. +@@ -3412,6 +3425,7 @@ const struct cfg80211_ops mac80211_confi
  18671. .set_wiphy_params = ieee80211_set_wiphy_params,
  18672. .set_tx_power = ieee80211_set_tx_power,
  18673. .get_tx_power = ieee80211_get_tx_power,
  18674. @@ -87,7 +87,7 @@
  18675. CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd)
  18676. --- a/net/mac80211/ieee80211_i.h
  18677. +++ b/net/mac80211/ieee80211_i.h
  18678. -@@ -1318,6 +1318,7 @@ struct ieee80211_local {
  18679. +@@ -1338,6 +1338,7 @@ struct ieee80211_local {
  18680. int dynamic_ps_forced_timeout;
  18681. int user_power_level; /* in dBm, for all interfaces */
  18682. @@ -119,7 +119,7 @@
  18683. if (local->hw.conf.power_level != power) {
  18684. changed |= IEEE80211_CONF_CHANGE_POWER;
  18685. local->hw.conf.power_level = power;
  18686. -@@ -586,6 +592,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
  18687. +@@ -588,6 +594,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
  18688. IEEE80211_RADIOTAP_MCS_HAVE_BW;
  18689. local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI |
  18690. IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH;
  18691. @@ -129,15 +129,15 @@
  18692. local->user_power_level = IEEE80211_UNSET_POWER_LEVEL;
  18693. --- a/net/wireless/nl80211.c
  18694. +++ b/net/wireless/nl80211.c
  18695. -@@ -403,6 +403,7 @@ static const struct nla_policy nl80211_p
  18696. - [NL80211_ATTR_NETNS_FD] = { .type = NLA_U32 },
  18697. - [NL80211_ATTR_SCHED_SCAN_DELAY] = { .type = NLA_U32 },
  18698. - [NL80211_ATTR_REG_INDOOR] = { .type = NLA_FLAG },
  18699. +@@ -407,6 +407,7 @@ static const struct nla_policy nl80211_p
  18700. + [NL80211_ATTR_PBSS] = { .type = NLA_FLAG },
  18701. + [NL80211_ATTR_BSS_SELECT] = { .type = NLA_NESTED },
  18702. + [NL80211_ATTR_STA_SUPPORT_P2P_PS] = { .type = NLA_U8 },
  18703. + [NL80211_ATTR_WIPHY_ANTENNA_GAIN] = { .type = NLA_U32 },
  18704. };
  18705. /* policy for the key attributes */
  18706. -@@ -2220,6 +2221,20 @@ static int nl80211_set_wiphy(struct sk_b
  18707. +@@ -2294,6 +2295,20 @@ static int nl80211_set_wiphy(struct sk_b
  18708. if (result)
  18709. return result;
  18710. }
  18711. diff --git a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  18712. index 5a5e464..0b25749 100644
  18713. --- a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  18714. +++ b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  18715. @@ -1,16 +1,16 @@
  18716. --- a/drivers/net/wireless/ath/ath9k/ath9k.h
  18717. +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  18718. @@ -814,6 +814,9 @@ static inline int ath9k_dump_btcoex(stru
  18719. + #ifdef CPTCFG_MAC80211_LEDS
  18720. void ath_init_leds(struct ath_softc *sc);
  18721. void ath_deinit_leds(struct ath_softc *sc);
  18722. - void ath_fill_led_pin(struct ath_softc *sc);
  18723. +int ath_create_gpio_led(struct ath_softc *sc, int gpio, const char *name,
  18724. -+ const char *trigger, bool active_low);
  18725. ++ const char *trigger, bool active_low);
  18726. +
  18727. #else
  18728. static inline void ath_init_leds(struct ath_softc *sc)
  18729. {
  18730. -@@ -953,6 +956,13 @@ void ath_ant_comb_scan(struct ath_softc
  18731. +@@ -950,6 +953,13 @@ void ath_ant_comb_scan(struct ath_softc
  18732. #define ATH9K_NUM_CHANCTX 2 /* supports 2 operating channels */
  18733. @@ -24,7 +24,7 @@
  18734. struct ath_softc {
  18735. struct ieee80211_hw *hw;
  18736. struct device *dev;
  18737. -@@ -1005,9 +1015,8 @@ struct ath_softc {
  18738. +@@ -1002,9 +1012,8 @@ struct ath_softc {
  18739. spinlock_t chan_lock;
  18740. #ifdef CPTCFG_MAC80211_LEDS
  18741. @@ -38,24 +38,33 @@
  18742. #ifdef CPTCFG_ATH9K_DEBUGFS
  18743. --- a/drivers/net/wireless/ath/ath9k/gpio.c
  18744. +++ b/drivers/net/wireless/ath/ath9k/gpio.c
  18745. -@@ -24,45 +24,102 @@
  18746. - static void ath_led_brightness(struct led_classdev *led_cdev,
  18747. - enum led_brightness brightness)
  18748. +@@ -22,7 +22,7 @@
  18749. +
  18750. + #ifdef CPTCFG_MAC80211_LEDS
  18751. +
  18752. +-void ath_fill_led_pin(struct ath_softc *sc)
  18753. ++static void ath_fill_led_pin(struct ath_softc *sc)
  18754. {
  18755. -- struct ath_softc *sc = container_of(led_cdev, struct ath_softc, led_cdev);
  18756. -- u32 val = (brightness == LED_OFF);
  18757. + struct ath_hw *ah = sc->sc_ah;
  18758. +
  18759. +@@ -39,61 +39,111 @@ void ath_fill_led_pin(struct ath_softc *
  18760. + else
  18761. + ah->led_pin = ATH_LED_PIN_DEF;
  18762. + }
  18763. ++}
  18764. ++
  18765. ++static void ath_led_brightness(struct led_classdev *led_cdev,
  18766. ++ enum led_brightness brightness)
  18767. ++{
  18768. + struct ath_led *led = container_of(led_cdev, struct ath_led, cdev);
  18769. + struct ath_softc *sc = led->sc;
  18770. -
  18771. -- if (sc->sc_ah->config.led_active_high)
  18772. -- val = !val;
  18773. ++
  18774. + ath9k_ps_wakeup(sc);
  18775. + ath9k_hw_set_gpio(sc->sc_ah, led->gpio->gpio,
  18776. + (brightness != LED_OFF) ^ led->gpio->active_low);
  18777. + ath9k_ps_restore(sc);
  18778. +}
  18779. -
  18780. -- ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, val);
  18781. ++
  18782. +static int ath_add_led(struct ath_softc *sc, struct ath_led *led)
  18783. +{
  18784. + const struct gpio_led *gpio = led->gpio;
  18785. @@ -71,30 +80,40 @@
  18786. +
  18787. + led->sc = sc;
  18788. + list_add(&led->list, &sc->leds);
  18789. -+
  18790. -+ /* Configure gpio for output */
  18791. -+ ath9k_hw_cfg_output(sc->sc_ah, gpio->gpio,
  18792. -+ AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
  18793. -+
  18794. +
  18795. + /* Configure gpio for output */
  18796. +- ath9k_hw_gpio_request_out(ah, ah->led_pin, "ath9k-led",
  18797. ++ ath9k_hw_gpio_request_out(sc->sc_ah, gpio->gpio, gpio->name,
  18798. + AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
  18799. +
  18800. +- /* LED off, active low */
  18801. +- ath9k_hw_set_gpio(ah, ah->led_pin, ah->config.led_active_high ? 0 : 1);
  18802. + /* LED off */
  18803. + ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low);
  18804. +
  18805. + return 0;
  18806. -+}
  18807. -+
  18808. + }
  18809. +
  18810. +-static void ath_led_brightness(struct led_classdev *led_cdev,
  18811. +- enum led_brightness brightness)
  18812. +int ath_create_gpio_led(struct ath_softc *sc, int gpio_num, const char *name,
  18813. + const char *trigger, bool active_low)
  18814. -+{
  18815. + {
  18816. +- struct ath_softc *sc = container_of(led_cdev, struct ath_softc, led_cdev);
  18817. +- u32 val = (brightness == LED_OFF);
  18818. + struct ath_led *led;
  18819. + struct gpio_led *gpio;
  18820. + char *_name;
  18821. + int ret;
  18822. -+
  18823. +
  18824. +- if (sc->sc_ah->config.led_active_high)
  18825. +- val = !val;
  18826. + led = kzalloc(sizeof(*led) + sizeof(*gpio) + strlen(name) + 1,
  18827. + GFP_KERNEL);
  18828. + if (!led)
  18829. + return -ENOMEM;
  18830. -+
  18831. +
  18832. +- ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, val);
  18833. + led->gpio = gpio = (struct gpio_led *) (led + 1);
  18834. + _name = (char *) (led->gpio + 1);
  18835. +
  18836. @@ -115,15 +134,18 @@
  18837. {
  18838. - if (!sc->led_registered)
  18839. - return;
  18840. -+ struct ath_led *led;
  18841. -
  18842. +-
  18843. - ath_led_brightness(&sc->led_cdev, LED_OFF);
  18844. - led_classdev_unregister(&sc->led_cdev);
  18845. ++ struct ath_led *led;
  18846. +
  18847. +- ath9k_hw_gpio_free(sc->sc_ah, sc->sc_ah->led_pin);
  18848. + while (!list_empty(&sc->leds)) {
  18849. + led = list_first_entry(&sc->leds, struct ath_led, list);
  18850. + list_del(&led->list);
  18851. + ath_led_brightness(&led->cdev, LED_OFF);
  18852. + led_classdev_unregister(&led->cdev);
  18853. ++ ath9k_hw_gpio_free(sc->sc_ah, led->gpio->gpio);
  18854. + kfree(led);
  18855. + }
  18856. }
  18857. @@ -139,6 +161,8 @@
  18858. if (AR_SREV_9100(sc->sc_ah))
  18859. return;
  18860. + ath_fill_led_pin(sc);
  18861. +
  18862. - if (!ath9k_led_blink)
  18863. - sc->led_cdev.default_trigger =
  18864. - ieee80211_get_radio_led_name(sc->hw);
  18865. @@ -159,13 +183,14 @@
  18866. + trigger = ieee80211_get_radio_led_name(sc->hw);
  18867. - sc->led_registered = true;
  18868. -+ ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, !sc->sc_ah->config.led_active_high);
  18869. ++ ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger,
  18870. ++ !sc->sc_ah->config.led_active_high);
  18871. }
  18872. + #endif
  18873. - void ath_fill_led_pin(struct ath_softc *sc)
  18874. --- a/drivers/net/wireless/ath/ath9k/init.c
  18875. +++ b/drivers/net/wireless/ath/ath9k/init.c
  18876. -@@ -936,7 +936,7 @@ int ath9k_init_device(u16 devid, struct
  18877. +@@ -942,7 +942,7 @@ int ath9k_init_device(u16 devid, struct
  18878. #ifdef CPTCFG_MAC80211_LEDS
  18879. /* must be initialized before ieee80211_register_hw */
  18880. @@ -176,7 +201,7 @@
  18881. #endif
  18882. --- a/drivers/net/wireless/ath/ath9k/debug.c
  18883. +++ b/drivers/net/wireless/ath/ath9k/debug.c
  18884. -@@ -1393,6 +1393,61 @@ static const struct file_operations fops
  18885. +@@ -1407,6 +1407,61 @@ static const struct file_operations fops
  18886. .llseek = default_llseek,
  18887. };
  18888. @@ -238,7 +263,7 @@
  18889. int ath9k_init_debug(struct ath_hw *ah)
  18890. {
  18891. -@@ -1417,6 +1472,10 @@ int ath9k_init_debug(struct ath_hw *ah)
  18892. +@@ -1431,6 +1486,10 @@ int ath9k_init_debug(struct ath_hw *ah)
  18893. &fops_eeprom);
  18894. debugfs_create_file("chanbw", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
  18895. sc, &fops_chanbw);
  18896. diff --git a/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch b/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch
  18897. index 7c10ea6..f656697 100644
  18898. --- a/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch
  18899. +++ b/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch
  18900. @@ -1,6 +1,6 @@
  18901. --- a/include/linux/ath9k_platform.h
  18902. +++ b/include/linux/ath9k_platform.h
  18903. -@@ -41,6 +41,9 @@ struct ath9k_platform_data {
  18904. +@@ -45,6 +45,9 @@ struct ath9k_platform_data {
  18905. int (*external_reset)(void);
  18906. bool use_eeprom;
  18907. @@ -20,7 +20,7 @@
  18908. /********************************/
  18909. /* LED functions */
  18910. -@@ -88,6 +89,24 @@ int ath_create_gpio_led(struct ath_softc
  18911. +@@ -108,6 +109,24 @@ int ath_create_gpio_led(struct ath_softc
  18912. return ret;
  18913. }
  18914. @@ -45,7 +45,7 @@
  18915. void ath_deinit_leds(struct ath_softc *sc)
  18916. {
  18917. struct ath_led *led;
  18918. -@@ -103,8 +122,10 @@ void ath_deinit_leds(struct ath_softc *s
  18919. +@@ -124,8 +143,10 @@ void ath_deinit_leds(struct ath_softc *s
  18920. void ath_init_leds(struct ath_softc *sc)
  18921. {
  18922. @@ -56,10 +56,10 @@
  18923. INIT_LIST_HEAD(&sc->leds);
  18924. -@@ -120,6 +141,12 @@ void ath_init_leds(struct ath_softc *sc)
  18925. - trigger = ieee80211_get_radio_led_name(sc->hw);
  18926. +@@ -144,6 +165,12 @@ void ath_init_leds(struct ath_softc *sc)
  18927. - ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, !sc->sc_ah->config.led_active_high);
  18928. + ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger,
  18929. + !sc->sc_ah->config.led_active_high);
  18930. +
  18931. + if (!pdata)
  18932. + return;
  18933. @@ -67,5 +67,5 @@
  18934. + for (i = 0; i < pdata->num_leds; i++)
  18935. + ath_create_platform_led(sc, &pdata->leds[i]);
  18936. }
  18937. + #endif
  18938. - void ath_fill_led_pin(struct ath_softc *sc)
  18939. 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
  18940. index 6d62a2b..50d8a7a 100644
  18941. --- a/package/kernel/mac80211/patches/532-ath9k_get_led_polarity_from_platform_data.patch
  18942. +++ b/package/kernel/mac80211/patches/532-ath9k_get_led_polarity_from_platform_data.patch
  18943. @@ -1,6 +1,6 @@
  18944. --- a/include/linux/ath9k_platform.h
  18945. +++ b/include/linux/ath9k_platform.h
  18946. -@@ -36,6 +36,7 @@ struct ath9k_platform_data {
  18947. +@@ -40,6 +40,7 @@ struct ath9k_platform_data {
  18948. bool tx_gain_buffalo;
  18949. bool disable_2ghz;
  18950. bool disable_5ghz;
  18951. @@ -10,7 +10,7 @@
  18952. int (*external_reset)(void);
  18953. --- a/drivers/net/wireless/ath/ath9k/init.c
  18954. +++ b/drivers/net/wireless/ath/ath9k/init.c
  18955. -@@ -577,6 +577,7 @@ static int ath9k_init_softc(u16 devid, s
  18956. +@@ -580,6 +580,7 @@ static int ath9k_init_softc(u16 devid, s
  18957. ah->external_reset = pdata->external_reset;
  18958. ah->disable_2ghz = pdata->disable_2ghz;
  18959. ah->disable_5ghz = pdata->disable_5ghz;
  18960. 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
  18961. index 3c5e9f5..c2d2781 100644
  18962. --- a/package/kernel/mac80211/patches/541-ath9k_rx_dma_stop_check.patch
  18963. +++ b/package/kernel/mac80211/patches/541-ath9k_rx_dma_stop_check.patch
  18964. @@ -1,6 +1,6 @@
  18965. --- a/drivers/net/wireless/ath/ath9k/mac.c
  18966. +++ b/drivers/net/wireless/ath/ath9k/mac.c
  18967. -@@ -695,7 +695,7 @@ bool ath9k_hw_stopdmarecv(struct ath_hw
  18968. +@@ -698,7 +698,7 @@ bool ath9k_hw_stopdmarecv(struct ath_hw
  18969. {
  18970. #define AH_RX_STOP_DMA_TIMEOUT 10000 /* usec */
  18971. struct ath_common *common = ath9k_hw_common(ah);
  18972. @@ -9,7 +9,7 @@
  18973. int i;
  18974. /* Enable access to the DMA observation bus */
  18975. -@@ -725,6 +725,16 @@ bool ath9k_hw_stopdmarecv(struct ath_hw
  18976. +@@ -728,6 +728,16 @@ bool ath9k_hw_stopdmarecv(struct ath_hw
  18977. }
  18978. if (i == 0) {
  18979. diff --git a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  18980. index e83c6bf..4615643 100644
  18981. --- a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  18982. +++ b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  18983. @@ -1,6 +1,6 @@
  18984. --- a/drivers/net/wireless/ath/ath9k/debug.c
  18985. +++ b/drivers/net/wireless/ath/ath9k/debug.c
  18986. -@@ -1449,6 +1449,50 @@ static const struct file_operations fops
  18987. +@@ -1463,6 +1463,50 @@ static const struct file_operations fops
  18988. #endif
  18989. @@ -51,7 +51,7 @@
  18990. int ath9k_init_debug(struct ath_hw *ah)
  18991. {
  18992. struct ath_common *common = ath9k_hw_common(ah);
  18993. -@@ -1476,6 +1520,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  18994. +@@ -1490,6 +1534,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  18995. debugfs_create_file("gpio_led", S_IWUSR,
  18996. sc->debug.debugfs_phy, sc, &fops_gpio_led);
  18997. #endif
  18998. @@ -62,7 +62,7 @@
  18999. debugfs_create_devm_seqfile(sc->dev, "interrupt", sc->debug.debugfs_phy,
  19000. --- a/drivers/net/wireless/ath/ath9k/hw.h
  19001. +++ b/drivers/net/wireless/ath/ath9k/hw.h
  19002. -@@ -519,6 +519,12 @@ enum {
  19003. +@@ -520,6 +520,12 @@ enum {
  19004. ATH9K_RESET_COLD,
  19005. };
  19006. @@ -75,7 +75,7 @@
  19007. struct ath9k_hw_version {
  19008. u32 magic;
  19009. u16 devid;
  19010. -@@ -804,6 +810,8 @@ struct ath_hw {
  19011. +@@ -805,6 +811,8 @@ struct ath_hw {
  19012. u32 rfkill_polarity;
  19013. u32 ah_flags;
  19014. @@ -84,7 +84,7 @@
  19015. bool reset_power_on;
  19016. bool htc_reset_init;
  19017. -@@ -1066,6 +1074,7 @@ void ath9k_hw_check_nav(struct ath_hw *a
  19018. +@@ -1068,6 +1076,7 @@ void ath9k_hw_check_nav(struct ath_hw *a
  19019. bool ath9k_hw_check_alive(struct ath_hw *ah);
  19020. bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode);
  19021. @@ -94,7 +94,7 @@
  19022. struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah,
  19023. --- a/drivers/net/wireless/ath/ath9k/hw.c
  19024. +++ b/drivers/net/wireless/ath/ath9k/hw.c
  19025. -@@ -1819,6 +1819,20 @@ u32 ath9k_hw_get_tsf_offset(struct times
  19026. +@@ -1841,6 +1841,20 @@ u32 ath9k_hw_get_tsf_offset(struct times
  19027. }
  19028. EXPORT_SYMBOL(ath9k_hw_get_tsf_offset);
  19029. @@ -115,7 +115,7 @@
  19030. int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
  19031. struct ath9k_hw_cal_data *caldata, bool fastcc)
  19032. {
  19033. -@@ -2027,6 +2041,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  19034. +@@ -2049,6 +2063,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  19035. ar9003_hw_disable_phy_restart(ah);
  19036. ath9k_hw_apply_gpio_override(ah);
  19037. diff --git a/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch b/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  19038. index d7bb5a1..656ed43 100644
  19039. --- a/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  19040. +++ b/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  19041. @@ -1,6 +1,6 @@
  19042. --- a/drivers/net/wireless/ath/ath9k/hw.h
  19043. +++ b/drivers/net/wireless/ath/ath9k/hw.h
  19044. -@@ -720,6 +720,7 @@ struct ath_spec_scan {
  19045. +@@ -721,6 +721,7 @@ struct ath_spec_scan {
  19046. * @config_pci_powersave:
  19047. * @calibrate: periodic calibration for NF, ANI, IQ, ADC gain, ADC-DC
  19048. *
  19049. @@ -8,7 +8,7 @@
  19050. * @spectral_scan_config: set parameters for spectral scan and enable/disable it
  19051. * @spectral_scan_trigger: trigger a spectral scan run
  19052. * @spectral_scan_wait: wait for a spectral scan run to finish
  19053. -@@ -742,6 +743,7 @@ struct ath_hw_ops {
  19054. +@@ -743,6 +744,7 @@ struct ath_hw_ops {
  19055. struct ath_hw_antcomb_conf *antconf);
  19056. void (*antdiv_comb_conf_set)(struct ath_hw *ah,
  19057. struct ath_hw_antcomb_conf *antconf);
  19058. @@ -18,7 +18,7 @@
  19059. void (*spectral_scan_trigger)(struct ath_hw *ah);
  19060. --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  19061. +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  19062. -@@ -1998,6 +1998,26 @@ void ar9003_hw_init_rate_txpower(struct
  19063. +@@ -1945,6 +1945,26 @@ void ar9003_hw_init_rate_txpower(struct
  19064. }
  19065. }
  19066. @@ -45,7 +45,7 @@
  19067. void ar9003_hw_attach_phy_ops(struct ath_hw *ah)
  19068. {
  19069. struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah);
  19070. -@@ -2034,6 +2054,7 @@ void ar9003_hw_attach_phy_ops(struct ath
  19071. +@@ -1981,6 +2001,7 @@ void ar9003_hw_attach_phy_ops(struct ath
  19072. priv_ops->set_radar_params = ar9003_hw_set_radar_params;
  19073. priv_ops->fast_chan_change = ar9003_hw_fast_chan_change;
  19074. @@ -55,9 +55,9 @@
  19075. ops->spectral_scan_config = ar9003_hw_spectral_scan_config;
  19076. --- a/drivers/net/wireless/ath/ath9k/init.c
  19077. +++ b/drivers/net/wireless/ath/ath9k/init.c
  19078. -@@ -711,7 +711,8 @@ static void ath9k_init_txpower_limits(st
  19079. +@@ -716,7 +716,8 @@ static void ath9k_init_txpower_limits(st
  19080. if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)
  19081. - ath9k_init_band_txpower(sc, IEEE80211_BAND_5GHZ);
  19082. + ath9k_init_band_txpower(sc, NL80211_BAND_5GHZ);
  19083. - ah->curchan = curchan;
  19084. + if (curchan)
  19085. @@ -65,7 +65,7 @@
  19086. }
  19087. static const struct ieee80211_iface_limit if_limits[] = {
  19088. -@@ -897,6 +898,18 @@ static void ath9k_set_hw_capab(struct at
  19089. +@@ -903,6 +904,18 @@ static void ath9k_set_hw_capab(struct at
  19090. SET_IEEE80211_PERM_ADDR(hw, common->macaddr);
  19091. }
  19092. @@ -84,7 +84,7 @@
  19093. int ath9k_init_device(u16 devid, struct ath_softc *sc,
  19094. const struct ath_bus_ops *bus_ops)
  19095. {
  19096. -@@ -942,6 +955,8 @@ int ath9k_init_device(u16 devid, struct
  19097. +@@ -948,6 +961,8 @@ int ath9k_init_device(u16 devid, struct
  19098. ARRAY_SIZE(ath9k_tpt_blink));
  19099. #endif
  19100. @@ -110,7 +110,7 @@
  19101. static inline void ath9k_hw_set_bt_ant_diversity(struct ath_hw *ah, bool enable)
  19102. --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  19103. +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  19104. -@@ -1327,9 +1327,30 @@ void ar5008_hw_init_rate_txpower(struct
  19105. +@@ -1325,9 +1325,30 @@ void ar5008_hw_init_rate_txpower(struct
  19106. }
  19107. }
  19108. @@ -141,7 +141,7 @@
  19109. static const u32 ar5416_cca_regs[6] = {
  19110. AR_PHY_CCA,
  19111. AR_PHY_CH1_CCA,
  19112. -@@ -1344,6 +1365,8 @@ int ar5008_hw_attach_phy_ops(struct ath_
  19113. +@@ -1342,6 +1363,8 @@ int ar5008_hw_attach_phy_ops(struct ath_
  19114. if (ret)
  19115. return ret;
  19116. @@ -175,7 +175,7 @@
  19117. #define AR_PHY_TIMING2 0x9810
  19118. #define AR_PHY_TIMING3 0x9814
  19119. #define AR_PHY_TIMING3_DSC_MAN 0xFFFE0000
  19120. -@@ -390,6 +399,8 @@
  19121. +@@ -393,6 +402,8 @@
  19122. #define AR_PHY_RFBUS_GRANT 0x9C20
  19123. #define AR_PHY_RFBUS_GRANT_EN 0x00000001
  19124. 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
  19125. index 8768c5d..b9c962e 100644
  19126. --- a/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch
  19127. +++ b/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch
  19128. @@ -20,9 +20,9 @@
  19129. /******************/
  19130. /* Chip Revisions */
  19131. /******************/
  19132. -@@ -1397,6 +1410,9 @@ static bool ath9k_hw_set_reset(struct at
  19133. - if (AR_SREV_9100(ah))
  19134. +@@ -1417,6 +1430,9 @@ static bool ath9k_hw_set_reset(struct at
  19135. udelay(50);
  19136. + }
  19137. + if (AR_SREV_9330(ah) || AR_SREV_9340(ah))
  19138. + ath9k_hw_disable_pll_lock_detect(ah);
  19139. @@ -30,7 +30,7 @@
  19140. return true;
  19141. }
  19142. -@@ -1496,6 +1512,9 @@ static bool ath9k_hw_chip_reset(struct a
  19143. +@@ -1516,6 +1532,9 @@ static bool ath9k_hw_chip_reset(struct a
  19144. ar9003_hw_internal_regulator_apply(ah);
  19145. ath9k_hw_init_pll(ah, chan);
  19146. @@ -40,7 +40,7 @@
  19147. return true;
  19148. }
  19149. -@@ -1797,8 +1816,14 @@ static int ath9k_hw_do_fastcc(struct ath
  19150. +@@ -1819,8 +1838,14 @@ static int ath9k_hw_do_fastcc(struct ath
  19151. if (AR_SREV_9271(ah))
  19152. ar9002_hw_load_ani_reg(ah, chan);
  19153. @@ -55,7 +55,7 @@
  19154. return -EINVAL;
  19155. }
  19156. -@@ -2052,6 +2077,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  19157. +@@ -2074,6 +2099,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  19158. ath9k_hw_set_radar_params(ah);
  19159. }
  19160. diff --git a/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch b/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
  19161. index 3d24ccd..b639f97 100644
  19162. --- a/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
  19163. +++ b/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
  19164. @@ -1,6 +1,6 @@
  19165. --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  19166. +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  19167. -@@ -956,55 +956,6 @@ static bool ar5008_hw_ani_control_new(st
  19168. +@@ -954,55 +954,6 @@ static bool ar5008_hw_ani_control_new(st
  19169. * on == 0 means more noise imm
  19170. */
  19171. u32 on = param ? 1 : 0;
  19172. @@ -58,7 +58,7 @@
  19173. REG_SET_BIT(ah, AR_PHY_SFCORR_LOW,
  19174. --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  19175. +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  19176. -@@ -41,20 +41,6 @@ static const int cycpwrThr1_table[] =
  19177. +@@ -42,20 +42,6 @@ static const int cycpwrThr1_table[] =
  19178. /* level: 0 1 2 3 4 5 6 7 8 */
  19179. { -6, -4, -2, 0, 2, 4, 6, 8 }; /* lvl 0-7, default 3 */
  19180. @@ -79,7 +79,7 @@
  19181. static const u8 ofdm2pwr[] = {
  19182. ALL_TARGET_LEGACY_6_24,
  19183. ALL_TARGET_LEGACY_6_24,
  19184. -@@ -1089,11 +1075,6 @@ static bool ar9003_hw_ani_control(struct
  19185. +@@ -1095,11 +1081,6 @@ static bool ar9003_hw_ani_control(struct
  19186. struct ath_common *common = ath9k_hw_common(ah);
  19187. struct ath9k_channel *chan = ah->curchan;
  19188. struct ar5416AniState *aniState = &ah->ani;
  19189. @@ -91,7 +91,7 @@
  19190. s32 value, value2;
  19191. switch (cmd & ah->ani_function) {
  19192. -@@ -1107,61 +1088,6 @@ static bool ar9003_hw_ani_control(struct
  19193. +@@ -1113,61 +1094,6 @@ static bool ar9003_hw_ani_control(struct
  19194. */
  19195. u32 on = param ? 1 : 0;
  19196. diff --git a/package/kernel/mac80211/patches/546-ath9k_platform_led_name.patch b/package/kernel/mac80211/patches/546-ath9k_platform_led_name.patch
  19197. new file mode 100644
  19198. index 0000000..ced72c6
  19199. --- /dev/null
  19200. +++ b/package/kernel/mac80211/patches/546-ath9k_platform_led_name.patch
  19201. @@ -0,0 +1,39 @@
  19202. +From: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  19203. +Date: Sun, 31 Jan 2016 20:45:57 +0100
  19204. +Subject: [PATCH v4 1/8] mac80211: ath9k: enable platform WLAN LED name
  19205. +
  19206. +Enable platform-supplied WLAN LED name for ath9k device. It replaces generic
  19207. +'ath9k-phy*' label with string set during platform initialization.
  19208. +
  19209. +Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  19210. +---
  19211. + drivers/net/wireless/ath/ath9k/gpio.c | 10 +++++++---
  19212. + include/linux/ath9k_platform.h | 1 +
  19213. + 2 files changed, 8 insertions(+), 3 deletions(-)
  19214. +
  19215. +--- a/drivers/net/wireless/ath/ath9k/gpio.c
  19216. ++++ b/drivers/net/wireless/ath/ath9k/gpio.c
  19217. +@@ -155,8 +155,11 @@ void ath_init_leds(struct ath_softc *sc)
  19218. +
  19219. + ath_fill_led_pin(sc);
  19220. +
  19221. +- snprintf(led_name, sizeof(led_name), "ath9k-%s",
  19222. +- wiphy_name(sc->hw->wiphy));
  19223. ++ if (pdata && pdata->led_name)
  19224. ++ strncpy(led_name, pdata->led_name, sizeof(led_name));
  19225. ++ else
  19226. ++ snprintf(led_name, sizeof(led_name), "ath9k-%s",
  19227. ++ wiphy_name(sc->hw->wiphy));
  19228. +
  19229. + if (ath9k_led_blink)
  19230. + trigger = sc->led_default_trigger;
  19231. +--- a/include/linux/ath9k_platform.h
  19232. ++++ b/include/linux/ath9k_platform.h
  19233. +@@ -49,6 +49,7 @@ struct ath9k_platform_data {
  19234. +
  19235. + int num_leds;
  19236. + const struct gpio_led *leds;
  19237. ++ const char *led_name;
  19238. + };
  19239. +
  19240. + #endif /* _LINUX_ATH9K_PLATFORM_H */
  19241. diff --git a/package/kernel/mac80211/patches/547-ath9k_led_defstate_fix.patch b/package/kernel/mac80211/patches/547-ath9k_led_defstate_fix.patch
  19242. new file mode 100644
  19243. index 0000000..5d84cf0
  19244. --- /dev/null
  19245. +++ b/package/kernel/mac80211/patches/547-ath9k_led_defstate_fix.patch
  19246. @@ -0,0 +1,29 @@
  19247. +From: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  19248. +Date: Sun, 31 Jan 2016 20:48:49 +0100
  19249. +Subject: [PATCH v4 2/8] mac80211: ath9k: set default state for platform LEDs
  19250. +
  19251. +Support default state for platform LEDs connected to ath9k device.
  19252. +Now LEDs are correctly set on or off at ath9k module initialization.
  19253. +Very useful if power LED is connected to wireless chip.
  19254. +
  19255. +Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  19256. +---
  19257. + gpio.c | 7 +++++--
  19258. + 1 file changed, 5 insertions(+), 2 deletions(-)
  19259. +
  19260. +--- a/drivers/net/wireless/ath/ath9k/gpio.c
  19261. ++++ b/drivers/net/wireless/ath/ath9k/gpio.c
  19262. +@@ -74,8 +74,11 @@ static int ath_add_led(struct ath_softc
  19263. + ath9k_hw_gpio_request_out(sc->sc_ah, gpio->gpio, gpio->name,
  19264. + AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
  19265. +
  19266. +- /* LED off */
  19267. +- ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low);
  19268. ++ /* Set default LED state */
  19269. ++ if (gpio->default_state == LEDS_GPIO_DEFSTATE_ON)
  19270. ++ ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, !gpio->active_low);
  19271. ++ else
  19272. ++ ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low);
  19273. +
  19274. + return 0;
  19275. + }
  19276. diff --git a/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch b/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch
  19277. new file mode 100644
  19278. index 0000000..de7c0ac
  19279. --- /dev/null
  19280. +++ b/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch
  19281. @@ -0,0 +1,234 @@
  19282. +From: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  19283. +Date: Sun, 31 Jan 2016 21:01:31 +0100
  19284. +Subject: [PATCH v4 4/8] mac80211: ath9k: enable access to GPIO
  19285. +
  19286. +Enable access to GPIO chip and its pins for Atheros AR92xx
  19287. +wireless devices. For now AR9285 and AR9287 are supported.
  19288. +
  19289. +Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  19290. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  19291. +---
  19292. +--- a/drivers/net/wireless/ath/ath9k/ath9k.h
  19293. ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  19294. +@@ -24,6 +24,7 @@
  19295. + #include <linux/completion.h>
  19296. + #include <linux/time.h>
  19297. + #include <linux/hw_random.h>
  19298. ++#include <linux/gpio/driver.h>
  19299. +
  19300. + #include "common.h"
  19301. + #include "debug.h"
  19302. +@@ -960,6 +961,14 @@ struct ath_led {
  19303. + struct led_classdev cdev;
  19304. + };
  19305. +
  19306. ++#ifdef CONFIG_GPIOLIB
  19307. ++struct ath9k_gpio_chip {
  19308. ++ struct ath_softc *sc;
  19309. ++ char label[32];
  19310. ++ struct gpio_chip gchip;
  19311. ++};
  19312. ++#endif
  19313. ++
  19314. + struct ath_softc {
  19315. + struct ieee80211_hw *hw;
  19316. + struct device *dev;
  19317. +@@ -1014,6 +1023,9 @@ struct ath_softc {
  19318. + #ifdef CPTCFG_MAC80211_LEDS
  19319. + const char *led_default_trigger;
  19320. + struct list_head leds;
  19321. ++#ifdef CONFIG_GPIOLIB
  19322. ++ struct ath9k_gpio_chip *gpiochip;
  19323. ++#endif
  19324. + #endif
  19325. +
  19326. + #ifdef CPTCFG_ATH9K_DEBUGFS
  19327. +--- a/drivers/net/wireless/ath/ath9k/gpio.c
  19328. ++++ b/drivers/net/wireless/ath/ath9k/gpio.c
  19329. +@@ -16,13 +16,135 @@
  19330. +
  19331. + #include "ath9k.h"
  19332. + #include <linux/ath9k_platform.h>
  19333. ++#include <linux/gpio.h>
  19334. ++
  19335. ++#ifdef CPTCFG_MAC80211_LEDS
  19336. ++
  19337. ++#ifdef CONFIG_GPIOLIB
  19338. ++
  19339. ++/***************/
  19340. ++/* GPIO Chip */
  19341. ++/***************/
  19342. ++
  19343. ++/* gpio_chip handler : set GPIO to input */
  19344. ++static int ath9k_gpio_pin_cfg_input(struct gpio_chip *chip, unsigned offset)
  19345. ++{
  19346. ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip,
  19347. ++ gchip);
  19348. ++
  19349. ++ ath9k_hw_gpio_request_in(gc->sc->sc_ah, offset, "ath9k-gpio");
  19350. ++
  19351. ++ return 0;
  19352. ++}
  19353. ++
  19354. ++/* gpio_chip handler : set GPIO to output */
  19355. ++static int ath9k_gpio_pin_cfg_output(struct gpio_chip *chip, unsigned offset,
  19356. ++ int value)
  19357. ++{
  19358. ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip,
  19359. ++ gchip);
  19360. ++
  19361. ++ ath9k_hw_gpio_request_out(gc->sc->sc_ah, offset, "ath9k-gpio",
  19362. ++ AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
  19363. ++ ath9k_hw_set_gpio(gc->sc->sc_ah, offset, value);
  19364. ++
  19365. ++ return 0;
  19366. ++}
  19367. ++
  19368. ++/* gpio_chip handler : query GPIO direction (0=out, 1=in) */
  19369. ++static int ath9k_gpio_pin_get_dir(struct gpio_chip *chip, unsigned offset)
  19370. ++{
  19371. ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip,
  19372. ++ gchip);
  19373. ++ struct ath_hw *ah = gc->sc->sc_ah;
  19374. ++
  19375. ++ return !((REG_READ(ah, AR_GPIO_OE_OUT) >> (offset * 2)) & 3);
  19376. ++}
  19377. ++
  19378. ++/* gpio_chip handler : get GPIO pin value */
  19379. ++static int ath9k_gpio_pin_get(struct gpio_chip *chip, unsigned offset)
  19380. ++{
  19381. ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip,
  19382. ++ gchip);
  19383. ++
  19384. ++ return ath9k_hw_gpio_get(gc->sc->sc_ah, offset);
  19385. ++}
  19386. ++
  19387. ++/* gpio_chip handler : set GPIO pin to value */
  19388. ++static void ath9k_gpio_pin_set(struct gpio_chip *chip, unsigned offset,
  19389. ++ int value)
  19390. ++{
  19391. ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip,
  19392. ++ gchip);
  19393. ++
  19394. ++ ath9k_hw_set_gpio(gc->sc->sc_ah, offset, value);
  19395. ++}
  19396. ++
  19397. ++/* register GPIO chip */
  19398. ++static void ath9k_register_gpio_chip(struct ath_softc *sc)
  19399. ++{
  19400. ++ struct ath9k_gpio_chip *gc;
  19401. ++ struct ath_hw *ah = sc->sc_ah;
  19402. ++
  19403. ++ gc = kzalloc(sizeof(struct ath9k_gpio_chip), GFP_KERNEL);
  19404. ++ if (!gc)
  19405. ++ return;
  19406. ++
  19407. ++ snprintf(gc->label, sizeof(gc->label), "ath9k-%s",
  19408. ++ wiphy_name(sc->hw->wiphy));
  19409. ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0)
  19410. ++ gc->gchip.parent = sc->dev;
  19411. ++#else
  19412. ++ gc->gchip.dev = sc->dev;
  19413. ++#endif
  19414. ++ gc->gchip.label = gc->label;
  19415. ++ gc->gchip.base = -1; /* determine base automatically */
  19416. ++ gc->gchip.ngpio = ah->caps.num_gpio_pins;
  19417. ++ gc->gchip.direction_input = ath9k_gpio_pin_cfg_input;
  19418. ++ gc->gchip.direction_output = ath9k_gpio_pin_cfg_output;
  19419. ++ gc->gchip.get_direction = ath9k_gpio_pin_get_dir;
  19420. ++ gc->gchip.get = ath9k_gpio_pin_get;
  19421. ++ gc->gchip.set = ath9k_gpio_pin_set;
  19422. ++
  19423. ++ if (gpiochip_add(&gc->gchip)) {
  19424. ++ kfree(gc);
  19425. ++ return;
  19426. ++ }
  19427. ++
  19428. ++ gc->gchip.owner = NULL;
  19429. ++ sc->gpiochip = gc;
  19430. ++ gc->sc = sc;
  19431. ++}
  19432. ++
  19433. ++/* remove GPIO chip */
  19434. ++static void ath9k_unregister_gpio_chip(struct ath_softc *sc)
  19435. ++{
  19436. ++ struct ath9k_gpio_chip *gc = sc->gpiochip;
  19437. ++
  19438. ++ if (!gc)
  19439. ++ return;
  19440. ++
  19441. ++ gpiochip_remove(&gc->gchip);
  19442. ++ kfree(gc);
  19443. ++ sc->gpiochip = NULL;
  19444. ++}
  19445. ++
  19446. ++#else /* CONFIG_GPIOLIB */
  19447. ++
  19448. ++static inline void ath9k_register_gpio_chip(struct ath_softc *sc)
  19449. ++{
  19450. ++}
  19451. ++
  19452. ++static inline void ath9k_unregister_gpio_chip(struct ath_softc *sc)
  19453. ++{
  19454. ++}
  19455. ++
  19456. ++#endif /* CONFIG_GPIOLIB */
  19457. +
  19458. + /********************************/
  19459. + /* LED functions */
  19460. + /********************************/
  19461. +
  19462. +-#ifdef CPTCFG_MAC80211_LEDS
  19463. +-
  19464. + static void ath_fill_led_pin(struct ath_softc *sc)
  19465. + {
  19466. + struct ath_hw *ah = sc->sc_ah;
  19467. +@@ -80,6 +202,12 @@ static int ath_add_led(struct ath_softc
  19468. + else
  19469. + ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low);
  19470. +
  19471. ++#ifdef CONFIG_GPIOLIB
  19472. ++ /* If there is GPIO chip configured, reserve LED pin */
  19473. ++ if (sc->gpiochip)
  19474. ++ gpio_request(sc->gpiochip->gchip.base + gpio->gpio, gpio->name);
  19475. ++#endif
  19476. ++
  19477. + return 0;
  19478. + }
  19479. +
  19480. +@@ -136,12 +264,18 @@ void ath_deinit_leds(struct ath_softc *s
  19481. +
  19482. + while (!list_empty(&sc->leds)) {
  19483. + led = list_first_entry(&sc->leds, struct ath_led, list);
  19484. ++#ifdef CONFIG_GPIOLIB
  19485. ++ /* If there is GPIO chip configured, free LED pin */
  19486. ++ if (sc->gpiochip)
  19487. ++ gpio_free(sc->gpiochip->gchip.base + led->gpio->gpio);
  19488. ++#endif
  19489. + list_del(&led->list);
  19490. + ath_led_brightness(&led->cdev, LED_OFF);
  19491. + led_classdev_unregister(&led->cdev);
  19492. + ath9k_hw_gpio_free(sc->sc_ah, led->gpio->gpio);
  19493. + kfree(led);
  19494. + }
  19495. ++ ath9k_unregister_gpio_chip(sc);
  19496. + }
  19497. +
  19498. + void ath_init_leds(struct ath_softc *sc)
  19499. +@@ -158,6 +292,8 @@ void ath_init_leds(struct ath_softc *sc)
  19500. +
  19501. + ath_fill_led_pin(sc);
  19502. +
  19503. ++ ath9k_register_gpio_chip(sc);
  19504. ++
  19505. + if (pdata && pdata->led_name)
  19506. + strncpy(led_name, pdata->led_name, sizeof(led_name));
  19507. + else
  19508. +@@ -178,6 +314,7 @@ void ath_init_leds(struct ath_softc *sc)
  19509. + for (i = 0; i < pdata->num_leds; i++)
  19510. + ath_create_platform_led(sc, &pdata->leds[i]);
  19511. + }
  19512. ++
  19513. + #endif
  19514. +
  19515. + /*******************/
  19516. diff --git a/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch b/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch
  19517. new file mode 100644
  19518. index 0000000..b9d1883
  19519. --- /dev/null
  19520. +++ b/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch
  19521. @@ -0,0 +1,149 @@
  19522. +From: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  19523. +Subject: [PATCH v5 5/8] mac80211: ath9k: enable GPIO buttons
  19524. +
  19525. +Enable platform-defined GPIO button support for ath9k device.
  19526. +Key poller is activated for attached platform buttons.
  19527. +Requires ath9k GPIO chip access.
  19528. +
  19529. +Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  19530. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  19531. +---
  19532. +--- a/drivers/net/wireless/ath/ath9k/ath9k.h
  19533. ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  19534. +@@ -1025,6 +1025,7 @@ struct ath_softc {
  19535. + struct list_head leds;
  19536. + #ifdef CONFIG_GPIOLIB
  19537. + struct ath9k_gpio_chip *gpiochip;
  19538. ++ struct platform_device *btnpdev; /* gpio-keys-polled */
  19539. + #endif
  19540. + #endif
  19541. +
  19542. +--- a/drivers/net/wireless/ath/ath9k/gpio.c
  19543. ++++ b/drivers/net/wireless/ath/ath9k/gpio.c
  19544. +@@ -17,6 +17,8 @@
  19545. + #include "ath9k.h"
  19546. + #include <linux/ath9k_platform.h>
  19547. + #include <linux/gpio.h>
  19548. ++#include <linux/platform_device.h>
  19549. ++#include <linux/gpio_keys.h>
  19550. +
  19551. + #ifdef CPTCFG_MAC80211_LEDS
  19552. +
  19553. +@@ -129,6 +131,64 @@ static void ath9k_unregister_gpio_chip(s
  19554. + sc->gpiochip = NULL;
  19555. + }
  19556. +
  19557. ++/******************/
  19558. ++/* GPIO Buttons */
  19559. ++/******************/
  19560. ++
  19561. ++/* add GPIO buttons */
  19562. ++static void ath9k_init_buttons(struct ath_softc *sc)
  19563. ++{
  19564. ++ struct ath9k_platform_data *pdata = sc->dev->platform_data;
  19565. ++ struct platform_device *pdev;
  19566. ++ struct gpio_keys_platform_data gkpdata;
  19567. ++ struct gpio_keys_button *bt;
  19568. ++ int i;
  19569. ++
  19570. ++ if (!sc->gpiochip)
  19571. ++ return;
  19572. ++
  19573. ++ if (!pdata || !pdata->btns || !pdata->num_btns)
  19574. ++ return;
  19575. ++
  19576. ++ bt = devm_kmemdup(sc->dev, pdata->btns,
  19577. ++ pdata->num_btns * sizeof(struct gpio_keys_button),
  19578. ++ GFP_KERNEL);
  19579. ++ if (!bt)
  19580. ++ return;
  19581. ++
  19582. ++ for (i = 0; i < pdata->num_btns; i++) {
  19583. ++ ath9k_hw_gpio_request_in(sc->sc_ah, pdata->btns[i].gpio,
  19584. ++ "ath9k-gpio");
  19585. ++ bt[i].gpio = sc->gpiochip->gchip.base + pdata->btns[i].gpio;
  19586. ++ }
  19587. ++
  19588. ++ memset(&gkpdata, 0, sizeof(struct gpio_keys_platform_data));
  19589. ++ gkpdata.buttons = bt;
  19590. ++ gkpdata.nbuttons = pdata->num_btns;
  19591. ++ gkpdata.poll_interval = pdata->btn_poll_interval;
  19592. ++
  19593. ++ pdev = platform_device_register_data(sc->dev, "gpio-keys-polled",
  19594. ++ PLATFORM_DEVID_AUTO, &gkpdata,
  19595. ++ sizeof(gkpdata));
  19596. ++ if (!IS_ERR_OR_NULL(pdev))
  19597. ++ sc->btnpdev = pdev;
  19598. ++ else {
  19599. ++ sc->btnpdev = NULL;
  19600. ++ devm_kfree(sc->dev, bt);
  19601. ++ }
  19602. ++}
  19603. ++
  19604. ++/* remove GPIO buttons */
  19605. ++static void ath9k_deinit_buttons(struct ath_softc *sc)
  19606. ++{
  19607. ++ if (!sc->gpiochip || !sc->btnpdev)
  19608. ++ return;
  19609. ++
  19610. ++ platform_device_unregister(sc->btnpdev);
  19611. ++
  19612. ++ sc->btnpdev = NULL;
  19613. ++}
  19614. ++
  19615. + #else /* CONFIG_GPIOLIB */
  19616. +
  19617. + static inline void ath9k_register_gpio_chip(struct ath_softc *sc)
  19618. +@@ -139,6 +199,14 @@ static inline void ath9k_unregister_gpio
  19619. + {
  19620. + }
  19621. +
  19622. ++static inline void ath9k_init_buttons(struct ath_softc *sc)
  19623. ++{
  19624. ++}
  19625. ++
  19626. ++static inline void ath9k_deinit_buttons(struct ath_softc *sc)
  19627. ++{
  19628. ++}
  19629. ++
  19630. + #endif /* CONFIG_GPIOLIB */
  19631. +
  19632. + /********************************/
  19633. +@@ -262,6 +330,7 @@ void ath_deinit_leds(struct ath_softc *s
  19634. + {
  19635. + struct ath_led *led;
  19636. +
  19637. ++ ath9k_deinit_buttons(sc);
  19638. + while (!list_empty(&sc->leds)) {
  19639. + led = list_first_entry(&sc->leds, struct ath_led, list);
  19640. + #ifdef CONFIG_GPIOLIB
  19641. +@@ -293,6 +362,7 @@ void ath_init_leds(struct ath_softc *sc)
  19642. + ath_fill_led_pin(sc);
  19643. +
  19644. + ath9k_register_gpio_chip(sc);
  19645. ++ ath9k_init_buttons(sc);
  19646. +
  19647. + if (pdata && pdata->led_name)
  19648. + strncpy(led_name, pdata->led_name, sizeof(led_name));
  19649. +@@ -308,7 +378,7 @@ void ath_init_leds(struct ath_softc *sc)
  19650. + ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger,
  19651. + !sc->sc_ah->config.led_active_high);
  19652. +
  19653. +- if (!pdata)
  19654. ++ if (!pdata || !pdata->leds || !pdata->num_leds)
  19655. + return;
  19656. +
  19657. + for (i = 0; i < pdata->num_leds; i++)
  19658. +--- a/include/linux/ath9k_platform.h
  19659. ++++ b/include/linux/ath9k_platform.h
  19660. +@@ -50,6 +50,10 @@ struct ath9k_platform_data {
  19661. + int num_leds;
  19662. + const struct gpio_led *leds;
  19663. + const char *led_name;
  19664. ++
  19665. ++ unsigned num_btns;
  19666. ++ const struct gpio_keys_button *btns;
  19667. ++ unsigned btn_poll_interval;
  19668. + };
  19669. +
  19670. + #endif /* _LINUX_ATH9K_PLATFORM_H */
  19671. 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
  19672. index 8245909..db70a33 100644
  19673. --- a/package/kernel/mac80211/patches/600-0002-rt2x00-rt2800lib-introduce-RT2800_HAS_HIGH_SHARED_ME.patch
  19674. +++ b/package/kernel/mac80211/patches/600-0002-rt2x00-rt2800lib-introduce-RT2800_HAS_HIGH_SHARED_ME.patch
  19675. @@ -24,7 +24,7 @@ Changes since v1:
  19676. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  19677. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  19678. -@@ -7722,6 +7722,7 @@ static int rt2800_probe_rt(struct rt2x00
  19679. +@@ -7726,6 +7726,7 @@ static int rt2800_probe_rt(struct rt2x00
  19680. int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev)
  19681. {
  19682. @@ -32,7 +32,7 @@ Changes since v1:
  19683. int retval;
  19684. u32 reg;
  19685. -@@ -7729,6 +7730,9 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  19686. +@@ -7733,6 +7734,9 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  19687. if (retval)
  19688. return retval;
  19689. 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
  19690. index 7abfcd1..a3b62bc 100644
  19691. --- a/package/kernel/mac80211/patches/600-0003-rt2x00-rt2800-serialize-shared-memory-access.patch
  19692. +++ b/package/kernel/mac80211/patches/600-0003-rt2x00-rt2800-serialize-shared-memory-access.patch
  19693. @@ -239,7 +239,7 @@ Changes since v1: ---
  19694. msleep(1);
  19695. /*
  19696. -@@ -7726,6 +7774,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  19697. +@@ -7730,6 +7778,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  19698. int retval;
  19699. u32 reg;
  19700. @@ -248,7 +248,7 @@ Changes since v1: ---
  19701. retval = rt2800_probe_rt(rt2x00dev);
  19702. if (retval)
  19703. return retval;
  19704. -@@ -7809,8 +7859,11 @@ void rt2800_get_key_seq(struct ieee80211
  19705. +@@ -7813,8 +7863,11 @@ void rt2800_get_key_seq(struct ieee80211
  19706. return;
  19707. offset = MAC_IVEIV_ENTRY(key->hw_key_idx);
  19708. 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
  19709. index 02b2acf..f41a160 100644
  19710. --- a/package/kernel/mac80211/patches/600-0005-rt2x00-rt2800lib-add-hw_beacon_count-field-to-struct.patch
  19711. +++ b/package/kernel/mac80211/patches/600-0005-rt2x00-rt2800lib-add-hw_beacon_count-field-to-struct.patch
  19712. @@ -41,7 +41,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19713. rt2800_clear_beacon_register(rt2x00dev, i);
  19714. if (rt2x00_is_usb(rt2x00dev)) {
  19715. -@@ -7827,6 +7828,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  19716. +@@ -7831,6 +7832,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  19717. if (rt2x00_rt(rt2x00dev, RT3593))
  19718. __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  19719. 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
  19720. index e909272..5099c64 100644
  19721. --- a/package/kernel/mac80211/patches/600-0007-rt2x00-rt2800lib-fix-max-supported-beacon-count-for-.patch
  19722. +++ b/package/kernel/mac80211/patches/600-0007-rt2x00-rt2800lib-fix-max-supported-beacon-count-for-.patch
  19723. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19724. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  19725. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  19726. -@@ -7852,7 +7852,10 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  19727. +@@ -7856,7 +7856,10 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  19728. if (rt2x00_rt(rt2x00dev, RT3593))
  19729. __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  19730. 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
  19731. index 7fe38e0..a2e7015 100644
  19732. --- a/package/kernel/mac80211/patches/600-0009-rt2x00-rt2800lib-enable-support-for-RT3883.patch
  19733. +++ b/package/kernel/mac80211/patches/600-0009-rt2x00-rt2800lib-enable-support-for-RT3883.patch
  19734. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19735. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  19736. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  19737. -@@ -7822,6 +7822,7 @@ static int rt2800_probe_rt(struct rt2x00
  19738. +@@ -7826,6 +7826,7 @@ static int rt2800_probe_rt(struct rt2x00
  19739. case RT3390:
  19740. case RT3572:
  19741. case RT3593:
  19742. 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
  19743. index 253a0c0..89bd0ac 100644
  19744. --- a/package/kernel/mac80211/patches/600-0010-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch
  19745. +++ b/package/kernel/mac80211/patches/600-0010-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch
  19746. @@ -98,7 +98,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19747. static const struct rf_channel rf_vals_5592_xtal20[] = {
  19748. /* Channel, N, K, mod, R */
  19749. {1, 482, 4, 10, 3},
  19750. -@@ -7669,6 +7729,11 @@ static int rt2800_probe_hw_mode(struct r
  19751. +@@ -7673,6 +7733,11 @@ static int rt2800_probe_hw_mode(struct r
  19752. spec->channels = rf_vals_3x;
  19753. break;
  19754. 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
  19755. index f15c22b..b7efc9f 100644
  19756. --- a/package/kernel/mac80211/patches/600-0011-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch
  19757. +++ b/package/kernel/mac80211/patches/600-0011-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch
  19758. @@ -18,7 +18,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19759. case RF5360:
  19760. case RF5362:
  19761. case RF5370:
  19762. -@@ -7848,6 +7849,7 @@ static int rt2800_probe_hw_mode(struct r
  19763. +@@ -7852,6 +7853,7 @@ static int rt2800_probe_hw_mode(struct r
  19764. case RF3053:
  19765. case RF3070:
  19766. case RF3290:
  19767. 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
  19768. index 6ce224a..220e35f 100644
  19769. --- a/package/kernel/mac80211/patches/600-0026-rt2x00-rt2800lib-use-correct-beacon-count-for-RT3883.patch
  19770. +++ b/package/kernel/mac80211/patches/600-0026-rt2x00-rt2800lib-use-correct-beacon-count-for-RT3883.patch
  19771. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19772. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  19773. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  19774. -@@ -8403,7 +8403,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  19775. +@@ -8407,7 +8407,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  19776. if (rt2x00_rt(rt2x00dev, RT3593))
  19777. __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  19778. 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
  19779. index 25753af..2ffa5a4 100644
  19780. --- a/package/kernel/mac80211/patches/600-0032-rt2x00-rt2800lib-enable-RT2800_HAS_HIGH_SHARED_MEM-f.patch
  19781. +++ b/package/kernel/mac80211/patches/600-0032-rt2x00-rt2800lib-enable-RT2800_HAS_HIGH_SHARED_MEM-f.patch
  19782. @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19783. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  19784. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  19785. -@@ -8416,7 +8416,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  19786. +@@ -8420,7 +8420,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  19787. if (retval)
  19788. return retval;
  19789. 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
  19790. index 7a183a4..daa5dc6 100644
  19791. --- a/package/kernel/mac80211/patches/602-rt2x00-introduce-rt2x00_platform_h.patch
  19792. +++ b/package/kernel/mac80211/patches/602-rt2x00-introduce-rt2x00_platform_h.patch
  19793. @@ -22,10 +22,10 @@
  19794. +#endif /* _RT2X00_PLATFORM_H */
  19795. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  19796. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  19797. -@@ -38,6 +38,7 @@
  19798. - #include <linux/kfifo.h>
  19799. +@@ -39,6 +39,7 @@
  19800. #include <linux/hrtimer.h>
  19801. #include <linux/average.h>
  19802. + #include <linux/usb.h>
  19803. +#include <linux/rt2x00_platform.h>
  19804. #include <net/mac80211.h>
  19805. diff --git a/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch b/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
  19806. index bc056cd..8ae5da3 100644
  19807. --- a/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
  19808. +++ b/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
  19809. @@ -1,6 +1,6 @@
  19810. --- a/.local-symbols
  19811. +++ b/.local-symbols
  19812. -@@ -329,6 +329,7 @@ RT2X00_LIB_FIRMWARE=
  19813. +@@ -331,6 +331,7 @@ RT2X00_LIB_FIRMWARE=
  19814. RT2X00_LIB_CRYPTO=
  19815. RT2X00_LIB_LEDS=
  19816. RT2X00_LIB_DEBUGFS=
  19817. @@ -105,7 +105,7 @@
  19818. .drv_init_registers = rt2800mmio_init_registers,
  19819. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  19820. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  19821. -@@ -697,6 +697,7 @@ enum rt2x00_capability_flags {
  19822. +@@ -699,6 +699,7 @@ enum rt2x00_capability_flags {
  19823. REQUIRE_HT_TX_DESC,
  19824. REQUIRE_PS_AUTOWAKE,
  19825. REQUIRE_DELAYED_RFKILL,
  19826. @@ -127,7 +127,7 @@
  19827. DECLARE_KFIFO_PTR(txstatus_fifo, u32);
  19828. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  19829. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  19830. -@@ -1335,6 +1335,10 @@ int rt2x00lib_probe_dev(struct rt2x00_de
  19831. +@@ -1334,6 +1334,10 @@ int rt2x00lib_probe_dev(struct rt2x00_de
  19832. INIT_DELAYED_WORK(&rt2x00dev->autowakeup_work, rt2x00lib_autowakeup);
  19833. INIT_WORK(&rt2x00dev->sleep_work, rt2x00lib_sleep);
  19834. @@ -138,7 +138,7 @@
  19835. /*
  19836. * Let the driver probe the device to detect the capabilities.
  19837. */
  19838. -@@ -1475,6 +1479,11 @@ void rt2x00lib_remove_dev(struct rt2x00_
  19839. +@@ -1477,6 +1481,11 @@ void rt2x00lib_remove_dev(struct rt2x00_
  19840. * Free the driver data.
  19841. */
  19842. kfree(rt2x00dev->drv_data);
  19843. 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
  19844. index d923e05..a2e1faf 100644
  19845. --- a/package/kernel/mac80211/patches/607-rt2x00-allow_disabling_bands_through_platform_data.patch
  19846. +++ b/package/kernel/mac80211/patches/607-rt2x00-allow_disabling_bands_through_platform_data.patch
  19847. @@ -37,7 +37,7 @@
  19848. num_rates += 4;
  19849. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  19850. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  19851. -@@ -405,6 +405,7 @@ struct hw_mode_spec {
  19852. +@@ -406,6 +406,7 @@ struct hw_mode_spec {
  19853. unsigned int supported_bands;
  19854. #define SUPPORT_BAND_2GHZ 0x00000001
  19855. #define SUPPORT_BAND_5GHZ 0x00000002
  19856. 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
  19857. index a645ba1..6704ff8 100644
  19858. --- a/package/kernel/mac80211/patches/608-add_platform_data_mac_addr.patch
  19859. +++ b/package/kernel/mac80211/patches/608-add_platform_data_mac_addr.patch
  19860. @@ -31,7 +31,7 @@
  19861. {
  19862. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  19863. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  19864. -@@ -1414,6 +1414,7 @@ static inline void rt2x00debug_dump_fram
  19865. +@@ -1416,6 +1416,7 @@ static inline void rt2x00debug_dump_fram
  19866. */
  19867. u32 rt2x00lib_get_bssidx(struct rt2x00_dev *rt2x00dev,
  19868. struct ieee80211_vif *vif);
  19869. 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
  19870. index c69d330..9f10fe3 100644
  19871. --- a/package/kernel/mac80211/patches/610-rt2x00-fix-rt3352-ext-pa.patch
  19872. +++ b/package/kernel/mac80211/patches/610-rt2x00-fix-rt3352-ext-pa.patch
  19873. @@ -200,7 +200,7 @@
  19874. * EEPROM frequency
  19875. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  19876. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  19877. -@@ -717,6 +717,8 @@ enum rt2x00_capability_flags {
  19878. +@@ -719,6 +719,8 @@ enum rt2x00_capability_flags {
  19879. CAPABILITY_DOUBLE_ANTENNA,
  19880. CAPABILITY_BT_COEXIST,
  19881. CAPABILITY_VCO_RECALIBRATION,
  19882. 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
  19883. index b44fe90..860fdc0 100644
  19884. --- a/package/kernel/mac80211/patches/611-rt2x00-rf_vals-rt3352-xtal20.patch
  19885. +++ b/package/kernel/mac80211/patches/611-rt2x00-rf_vals-rt3352-xtal20.patch
  19886. @@ -28,7 +28,7 @@
  19887. static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
  19888. {
  19889. struct hw_mode_spec *spec = &rt2x00dev->spec;
  19890. -@@ -8272,7 +8293,10 @@ static int rt2800_probe_hw_mode(struct r
  19891. +@@ -8276,7 +8297,10 @@ static int rt2800_probe_hw_mode(struct r
  19892. case RF5390:
  19893. case RF5392:
  19894. spec->num_channels = 14;
  19895. @@ -40,7 +40,7 @@
  19896. break;
  19897. case RF3052:
  19898. -@@ -8456,6 +8480,19 @@ static int rt2800_probe_rt(struct rt2x00
  19899. +@@ -8460,6 +8484,19 @@ static int rt2800_probe_rt(struct rt2x00
  19900. return 0;
  19901. }
  19902. @@ -60,7 +60,7 @@
  19903. int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev)
  19904. {
  19905. struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
  19906. -@@ -8498,6 +8535,15 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  19907. +@@ -8502,6 +8539,15 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  19908. rt2800_register_write(rt2x00dev, GPIO_CTRL, reg);
  19909. /*
  19910. @@ -78,7 +78,7 @@
  19911. retval = rt2800_probe_hw_mode(rt2x00dev);
  19912. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  19913. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  19914. -@@ -400,6 +400,7 @@ static inline struct rt2x00_intf* vif_to
  19915. +@@ -401,6 +401,7 @@ static inline struct rt2x00_intf* vif_to
  19916. * @channels: Device/chipset specific channel values (See &struct rf_channel).
  19917. * @channels_info: Additional information for channels (See &struct channel_info).
  19918. * @ht: Driver HT Capabilities (See &ieee80211_sta_ht_cap).
  19919. @@ -86,7 +86,7 @@
  19920. */
  19921. struct hw_mode_spec {
  19922. unsigned int supported_bands;
  19923. -@@ -416,6 +417,7 @@ struct hw_mode_spec {
  19924. +@@ -417,6 +418,7 @@ struct hw_mode_spec {
  19925. const struct channel_info *channels_info;
  19926. struct ieee80211_sta_ht_cap ht;
  19927. diff --git a/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch b/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
  19928. index 8e3bd2a..e7b2a8c 100644
  19929. --- a/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
  19930. +++ b/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
  19931. @@ -8,7 +8,7 @@
  19932. #include "rt2x00.h"
  19933. #include "rt2800lib.h"
  19934. -@@ -8482,13 +8483,14 @@ static int rt2800_probe_rt(struct rt2x00
  19935. +@@ -8486,13 +8487,14 @@ static int rt2800_probe_rt(struct rt2x00
  19936. int rt2800_probe_clk(struct rt2x00_dev *rt2x00dev)
  19937. {
  19938. diff --git a/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch b/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch
  19939. index faa5879..44bd8a1 100644
  19940. --- a/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch
  19941. +++ b/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch
  19942. @@ -240,7 +240,7 @@
  19943. case RF5360:
  19944. case RF5362:
  19945. case RF5370:
  19946. -@@ -8287,6 +8398,7 @@ static int rt2800_probe_hw_mode(struct r
  19947. +@@ -8291,6 +8402,7 @@ static int rt2800_probe_hw_mode(struct r
  19948. case RF3290:
  19949. case RF3320:
  19950. case RF3322:
  19951. @@ -248,7 +248,7 @@
  19952. case RF5360:
  19953. case RF5362:
  19954. case RF5370:
  19955. -@@ -8426,6 +8538,7 @@ static int rt2800_probe_hw_mode(struct r
  19956. +@@ -8430,6 +8542,7 @@ static int rt2800_probe_hw_mode(struct r
  19957. case RF3070:
  19958. case RF3290:
  19959. case RF3853:
  19960. @@ -256,7 +256,7 @@
  19961. case RF5360:
  19962. case RF5362:
  19963. case RF5370:
  19964. -@@ -8466,6 +8579,7 @@ static int rt2800_probe_rt(struct rt2x00
  19965. +@@ -8470,6 +8583,7 @@ static int rt2800_probe_rt(struct rt2x00
  19966. case RT3572:
  19967. case RT3593:
  19968. case RT3883:
  19969. @@ -266,7 +266,7 @@
  19970. case RT5592:
  19971. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  19972. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  19973. -@@ -169,6 +169,7 @@ struct rt2x00_chip {
  19974. +@@ -170,6 +170,7 @@ struct rt2x00_chip {
  19975. #define RT3572 0x3572
  19976. #define RT3593 0x3593
  19977. #define RT3883 0x3883 /* WSOC */
  19978. 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
  19979. index 55452b9..dba6033 100644
  19980. --- a/package/kernel/mac80211/patches/620-rt2x00-add-AP+STA-support.patch
  19981. +++ b/package/kernel/mac80211/patches/620-rt2x00-add-AP+STA-support.patch
  19982. @@ -1,6 +1,6 @@
  19983. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  19984. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  19985. -@@ -1284,7 +1284,7 @@ static inline void rt2x00lib_set_if_comb
  19986. +@@ -1283,7 +1283,7 @@ static inline void rt2x00lib_set_if_comb
  19987. */
  19988. if_limit = &rt2x00dev->if_limits_ap;
  19989. if_limit->max = rt2x00dev->ops->max_ap_intf;
  19990. diff --git a/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch b/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
  19991. index fd885cc..02f3053 100644
  19992. --- a/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
  19993. +++ b/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
  19994. @@ -1,6 +1,6 @@
  19995. --- a/drivers/net/wireless/marvell/libertas/cfg.c
  19996. +++ b/drivers/net/wireless/marvell/libertas/cfg.c
  19997. -@@ -2084,6 +2084,8 @@ struct wireless_dev *lbs_cfg_alloc(struc
  19998. +@@ -2122,6 +2122,8 @@ struct wireless_dev *lbs_cfg_alloc(struc
  19999. goto err_wiphy_new;
  20000. }
  20001. diff --git a/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch b/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
  20002. index b67a95f..ad30608 100644
  20003. --- a/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
  20004. +++ b/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
  20005. @@ -1,6 +1,6 @@
  20006. --- a/drivers/net/wireless/marvell/libertas/cfg.c
  20007. +++ b/drivers/net/wireless/marvell/libertas/cfg.c
  20008. -@@ -2174,6 +2174,8 @@ int lbs_cfg_register(struct lbs_private
  20009. +@@ -2212,6 +2212,8 @@ int lbs_cfg_register(struct lbs_private
  20010. wdev->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
  20011. wdev->wiphy->reg_notifier = lbs_reg_notifier;
  20012. diff --git a/package/kernel/mac80211/patches/804-b43-sync-with-bcma.patch b/package/kernel/mac80211/patches/804-b43-sync-with-bcma.patch
  20013. deleted file mode 100644
  20014. index 74cd448..0000000
  20015. --- a/package/kernel/mac80211/patches/804-b43-sync-with-bcma.patch
  20016. +++ /dev/null
  20017. @@ -1,17 +0,0 @@
  20018. ---- a/drivers/net/wireless/broadcom/b43/main.c
  20019. -+++ b/drivers/net/wireless/broadcom/b43/main.c
  20020. -@@ -1215,10 +1215,10 @@ void b43_wireless_core_phy_pll_reset(str
  20021. - case B43_BUS_BCMA:
  20022. - bcma_cc = &dev->dev->bdev->bus->drv_cc;
  20023. -
  20024. -- bcma_cc_write32(bcma_cc, BCMA_CC_CHIPCTL_ADDR, 0);
  20025. -- bcma_cc_mask32(bcma_cc, BCMA_CC_CHIPCTL_DATA, ~0x4);
  20026. -- bcma_cc_set32(bcma_cc, BCMA_CC_CHIPCTL_DATA, 0x4);
  20027. -- bcma_cc_mask32(bcma_cc, BCMA_CC_CHIPCTL_DATA, ~0x4);
  20028. -+ bcma_cc_write32(bcma_cc, BCMA_CC_PMU_CHIPCTL_ADDR, 0);
  20029. -+ bcma_cc_mask32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, ~0x4);
  20030. -+ bcma_cc_set32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, 0x4);
  20031. -+ bcma_cc_mask32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, ~0x4);
  20032. - break;
  20033. - #endif
  20034. - #ifdef CPTCFG_B43_SSB
  20035. diff --git a/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch b/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch
  20036. index 06c731f..f8f555f 100644
  20037. --- a/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch
  20038. +++ b/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch
  20039. @@ -9,7 +9,7 @@
  20040. antenna = b43_antenna_to_phyctl(antenna);
  20041. ctl = b43_shm_read16(dev, B43_SHM_SHARED, B43_SHM_SH_BEACPHYCTL);
  20042. /* We can't send beacons with short preamble. Would get PHY errors. */
  20043. -@@ -3300,8 +3300,8 @@ static int b43_chip_init(struct b43_wlde
  20044. +@@ -3297,8 +3297,8 @@ static int b43_chip_init(struct b43_wlde
  20045. /* Select the antennae */
  20046. if (phy->ops->set_rx_antenna)
  20047. @@ -20,7 +20,7 @@
  20048. if (phy->type == B43_PHYTYPE_B) {
  20049. value16 = b43_read16(dev, 0x005E);
  20050. -@@ -4001,7 +4001,6 @@ static int b43_op_config(struct ieee8021
  20051. +@@ -3998,7 +3998,6 @@ static int b43_op_config(struct ieee8021
  20052. struct b43_wldev *dev = wl->current_dev;
  20053. struct b43_phy *phy = &dev->phy;
  20054. struct ieee80211_conf *conf = &hw->conf;
  20055. @@ -28,7 +28,7 @@
  20056. int err = 0;
  20057. mutex_lock(&wl->mutex);
  20058. -@@ -4044,11 +4043,9 @@ static int b43_op_config(struct ieee8021
  20059. +@@ -4041,11 +4040,9 @@ static int b43_op_config(struct ieee8021
  20060. }
  20061. /* Antennas for RX and management frame TX. */
  20062. @@ -42,7 +42,7 @@
  20063. if (wl->radio_enabled != phy->radio_on) {
  20064. if (wl->radio_enabled) {
  20065. -@@ -5209,6 +5206,47 @@ static int b43_op_get_survey(struct ieee
  20066. +@@ -5189,6 +5186,47 @@ static int b43_op_get_survey(struct ieee
  20067. return 0;
  20068. }
  20069. @@ -90,7 +90,7 @@
  20070. static const struct ieee80211_ops b43_hw_ops = {
  20071. .tx = b43_op_tx,
  20072. .conf_tx = b43_op_conf_tx,
  20073. -@@ -5230,6 +5268,8 @@ static const struct ieee80211_ops b43_hw
  20074. +@@ -5210,6 +5248,8 @@ static const struct ieee80211_ops b43_hw
  20075. .sw_scan_complete = b43_op_sw_scan_complete_notifier,
  20076. .get_survey = b43_op_get_survey,
  20077. .rfkill_poll = b43_rfkill_poll,
  20078. @@ -99,7 +99,7 @@
  20079. };
  20080. /* Hard-reset the chip. Do not call this directly.
  20081. -@@ -5538,6 +5578,8 @@ static int b43_one_core_attach(struct b4
  20082. +@@ -5513,6 +5553,8 @@ static int b43_one_core_attach(struct b4
  20083. if (!wldev)
  20084. goto out;
  20085. @@ -108,7 +108,7 @@
  20086. wldev->use_pio = b43_modparam_pio;
  20087. wldev->dev = dev;
  20088. wldev->wl = wl;
  20089. -@@ -5628,6 +5670,9 @@ static struct b43_wl *b43_wireless_init(
  20090. +@@ -5603,6 +5645,9 @@ static struct b43_wl *b43_wireless_init(
  20091. hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
  20092. diff --git a/package/kernel/mac80211/patches/860-brcmfmac-add-missing-eth_type_trans-call.patch b/package/kernel/mac80211/patches/860-brcmfmac-add-missing-eth_type_trans-call.patch
  20093. deleted file mode 100644
  20094. index e265354..0000000
  20095. --- a/package/kernel/mac80211/patches/860-brcmfmac-add-missing-eth_type_trans-call.patch
  20096. +++ /dev/null
  20097. @@ -1,26 +0,0 @@
  20098. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  20099. -Subject: [PATCH] brcmfmac: add missing eth_type_trans call
  20100. -MIME-Version: 1.0
  20101. -Content-Type: text/plain; charset=UTF-8
  20102. -Content-Transfer-Encoding: 8bit
  20103. -
  20104. -There are 2 protocols supported by brcmfmac and msgbuf one was missing a
  20105. -proper skb setup before passing it to the netif. This was triggering
  20106. -"NULL pointer dereference".
  20107. -
  20108. -Fixes: 9c349892ccc9 ("brcmfmac: revise handling events in receive path")
  20109. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  20110. ----
  20111. -
  20112. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  20113. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  20114. -@@ -1157,6 +1157,9 @@ brcmf_msgbuf_process_rx_complete(struct
  20115. - brcmu_pkt_buf_free_skb(skb);
  20116. - return;
  20117. - }
  20118. -+
  20119. -+ skb->protocol = eth_type_trans(skb, ifp->ndev);
  20120. -+
  20121. - brcmf_netif_rx(ifp, skb);
  20122. - }
  20123. -
  20124. 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
  20125. new file mode 100644
  20126. index 0000000..ae571c9
  20127. --- /dev/null
  20128. +++ b/package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch
  20129. @@ -0,0 +1,97 @@
  20130. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  20131. +Date: Mon, 8 Jun 2015 16:11:40 +0200
  20132. +Subject: [PATCH] brcmfmac: register wiphy(s) during module_init
  20133. +MIME-Version: 1.0
  20134. +Content-Type: text/plain; charset=UTF-8
  20135. +Content-Transfer-Encoding: 8bit
  20136. +
  20137. +This is needed by OpenWrt which expects all PHYs to be created after
  20138. +module loads successfully.
  20139. +
  20140. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  20141. +---
  20142. +
  20143. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  20144. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  20145. +@@ -1213,6 +1213,7 @@ int __init brcmf_core_init(void)
  20146. + {
  20147. + if (!schedule_work(&brcmf_driver_work))
  20148. + return -EBUSY;
  20149. ++ flush_work(&brcmf_driver_work);
  20150. +
  20151. + return 0;
  20152. + }
  20153. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  20154. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  20155. +@@ -444,6 +444,7 @@ struct brcmf_fw {
  20156. + u16 bus_nr;
  20157. + void (*done)(struct device *dev, const struct firmware *fw,
  20158. + void *nvram_image, u32 nvram_len);
  20159. ++ struct completion *completion;
  20160. + };
  20161. +
  20162. + static void brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx)
  20163. +@@ -478,6 +479,8 @@ static void brcmf_fw_request_nvram_done(
  20164. + goto fail;
  20165. +
  20166. + fwctx->done(fwctx->dev, fwctx->code, nvram, nvram_length);
  20167. ++ if (fwctx->completion)
  20168. ++ complete(fwctx->completion);
  20169. + kfree(fwctx);
  20170. + return;
  20171. +
  20172. +@@ -485,6 +488,8 @@ fail:
  20173. + brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev));
  20174. + release_firmware(fwctx->code);
  20175. + device_release_driver(fwctx->dev);
  20176. ++ if (fwctx->completion)
  20177. ++ complete(fwctx->completion);
  20178. + kfree(fwctx);
  20179. + }
  20180. +
  20181. +@@ -500,6 +505,8 @@ static void brcmf_fw_request_code_done(c
  20182. + /* only requested code so done here */
  20183. + if (!(fwctx->flags & BRCMF_FW_REQUEST_NVRAM)) {
  20184. + fwctx->done(fwctx->dev, fw, NULL, 0);
  20185. ++ if (fwctx->completion)
  20186. ++ complete(fwctx->completion);
  20187. + kfree(fwctx);
  20188. + return;
  20189. + }
  20190. +@@ -517,6 +524,8 @@ static void brcmf_fw_request_code_done(c
  20191. + fail:
  20192. + brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev));
  20193. + device_release_driver(fwctx->dev);
  20194. ++ if (fwctx->completion)
  20195. ++ complete(fwctx->completion);
  20196. + kfree(fwctx);
  20197. + }
  20198. +
  20199. +@@ -528,6 +537,8 @@ int brcmf_fw_get_firmwares_pcie(struct d
  20200. + u16 domain_nr, u16 bus_nr)
  20201. + {
  20202. + struct brcmf_fw *fwctx;
  20203. ++ struct completion completion;
  20204. ++ int err;
  20205. +
  20206. + brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(dev));
  20207. + if (!fw_cb || !code)
  20208. +@@ -548,9 +559,17 @@ int brcmf_fw_get_firmwares_pcie(struct d
  20209. + fwctx->domain_nr = domain_nr;
  20210. + fwctx->bus_nr = bus_nr;
  20211. +
  20212. +- return request_firmware_nowait(THIS_MODULE, true, code, dev,
  20213. ++ init_completion(&completion);
  20214. ++ fwctx->completion = &completion;
  20215. ++
  20216. ++ err = request_firmware_nowait(THIS_MODULE, true, code, dev,
  20217. + GFP_KERNEL, fwctx,
  20218. + brcmf_fw_request_code_done);
  20219. ++ if (!err)
  20220. ++ wait_for_completion_timeout(fwctx->completion,
  20221. ++ msecs_to_jiffies(5000));
  20222. ++ fwctx->completion = NULL;
  20223. ++ return err;
  20224. + }
  20225. +
  20226. + int brcmf_fw_get_firmwares(struct device *dev, u16 flags,
  20227. 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
  20228. deleted file mode 100644
  20229. index f7f44f5..0000000
  20230. --- a/package/kernel/mac80211/patches/861-brcmfmac-register-wiphy-s-during-module_init.patch
  20231. +++ /dev/null
  20232. @@ -1,97 +0,0 @@
  20233. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  20234. -Date: Mon, 8 Jun 2015 16:11:40 +0200
  20235. -Subject: [PATCH] brcmfmac: register wiphy(s) during module_init
  20236. -MIME-Version: 1.0
  20237. -Content-Type: text/plain; charset=UTF-8
  20238. -Content-Transfer-Encoding: 8bit
  20239. -
  20240. -This is needed by OpenWrt which expects all PHYs to be created after
  20241. -module loads successfully.
  20242. -
  20243. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  20244. ----
  20245. -
  20246. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  20247. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  20248. -@@ -1200,6 +1200,7 @@ int __init brcmf_core_init(void)
  20249. - {
  20250. - if (!schedule_work(&brcmf_driver_work))
  20251. - return -EBUSY;
  20252. -+ flush_work(&brcmf_driver_work);
  20253. -
  20254. - return 0;
  20255. - }
  20256. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  20257. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  20258. -@@ -444,6 +444,7 @@ struct brcmf_fw {
  20259. - u16 bus_nr;
  20260. - void (*done)(struct device *dev, const struct firmware *fw,
  20261. - void *nvram_image, u32 nvram_len);
  20262. -+ struct completion *completion;
  20263. - };
  20264. -
  20265. - static void brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx)
  20266. -@@ -478,6 +479,8 @@ static void brcmf_fw_request_nvram_done(
  20267. - goto fail;
  20268. -
  20269. - fwctx->done(fwctx->dev, fwctx->code, nvram, nvram_length);
  20270. -+ if (fwctx->completion)
  20271. -+ complete(fwctx->completion);
  20272. - kfree(fwctx);
  20273. - return;
  20274. -
  20275. -@@ -485,6 +488,8 @@ fail:
  20276. - brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev));
  20277. - release_firmware(fwctx->code);
  20278. - device_release_driver(fwctx->dev);
  20279. -+ if (fwctx->completion)
  20280. -+ complete(fwctx->completion);
  20281. - kfree(fwctx);
  20282. - }
  20283. -
  20284. -@@ -500,6 +505,8 @@ static void brcmf_fw_request_code_done(c
  20285. - /* only requested code so done here */
  20286. - if (!(fwctx->flags & BRCMF_FW_REQUEST_NVRAM)) {
  20287. - fwctx->done(fwctx->dev, fw, NULL, 0);
  20288. -+ if (fwctx->completion)
  20289. -+ complete(fwctx->completion);
  20290. - kfree(fwctx);
  20291. - return;
  20292. - }
  20293. -@@ -517,6 +524,8 @@ static void brcmf_fw_request_code_done(c
  20294. - fail:
  20295. - brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev));
  20296. - device_release_driver(fwctx->dev);
  20297. -+ if (fwctx->completion)
  20298. -+ complete(fwctx->completion);
  20299. - kfree(fwctx);
  20300. - }
  20301. -
  20302. -@@ -528,6 +537,8 @@ int brcmf_fw_get_firmwares_pcie(struct d
  20303. - u16 domain_nr, u16 bus_nr)
  20304. - {
  20305. - struct brcmf_fw *fwctx;
  20306. -+ struct completion completion;
  20307. -+ int err;
  20308. -
  20309. - brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(dev));
  20310. - if (!fw_cb || !code)
  20311. -@@ -548,9 +559,17 @@ int brcmf_fw_get_firmwares_pcie(struct d
  20312. - fwctx->domain_nr = domain_nr;
  20313. - fwctx->bus_nr = bus_nr;
  20314. -
  20315. -- return request_firmware_nowait(THIS_MODULE, true, code, dev,
  20316. -+ init_completion(&completion);
  20317. -+ fwctx->completion = &completion;
  20318. -+
  20319. -+ err = request_firmware_nowait(THIS_MODULE, true, code, dev,
  20320. - GFP_KERNEL, fwctx,
  20321. - brcmf_fw_request_code_done);
  20322. -+ if (!err)
  20323. -+ wait_for_completion_timeout(fwctx->completion,
  20324. -+ msecs_to_jiffies(5000));
  20325. -+ fwctx->completion = NULL;
  20326. -+ return err;
  20327. - }
  20328. -
  20329. - int brcmf_fw_get_firmwares(struct device *dev, u16 flags,
  20330. 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
  20331. new file mode 100644
  20332. index 0000000..8721155
  20333. --- /dev/null
  20334. +++ b/package/kernel/mac80211/patches/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch
  20335. @@ -0,0 +1,50 @@
  20336. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  20337. +Date: Thu, 9 Jul 2015 00:07:59 +0200
  20338. +Subject: [PATCH] brcmfmac: workaround bug with some inconsistent BSSes state
  20339. +MIME-Version: 1.0
  20340. +Content-Type: text/plain; charset=UTF-8
  20341. +Content-Transfer-Encoding: 8bit
  20342. +
  20343. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  20344. +---
  20345. +
  20346. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  20347. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  20348. +@@ -665,9 +665,37 @@ static struct wireless_dev *brcmf_cfg802
  20349. + u32 *flags,
  20350. + struct vif_params *params)
  20351. + {
  20352. ++ struct net_device *dev;
  20353. + struct wireless_dev *wdev;
  20354. + int err;
  20355. +
  20356. ++ /*
  20357. ++ * There is a bug with in-firmware BSS management. When adding virtual
  20358. ++ * interface brcmfmac first tells firmware to create new BSS and then
  20359. ++ * it creates new struct net_device.
  20360. ++ *
  20361. ++ * If creating/registering netdev(ice) fails, BSS remains in some bugged
  20362. ++ * state. It conflicts with existing BSSes by overtaking their auth
  20363. ++ * requests.
  20364. ++ *
  20365. ++ * It results in one BSS (addresss X) sending beacons and another BSS
  20366. ++ * (address Y) replying to authentication requests. This makes interface
  20367. ++ * unusable as AP.
  20368. ++ *
  20369. ++ * To workaround this bug we may try to guess if register_netdev(ice)
  20370. ++ * will fail. The most obvious case is using interface name that already
  20371. ++ * exists. This is actually quite likely with brcmfmac & some user space
  20372. ++ * scripts as brcmfmac doesn't allow deleting virtual interfaces.
  20373. ++ * So this bug can be triggered even by something trivial like:
  20374. ++ * iw dev wlan0 delete
  20375. ++ * iw phy phy0 interface add wlan0 type __ap
  20376. ++ */
  20377. ++ dev = dev_get_by_name(&init_net, name);
  20378. ++ if (dev) {
  20379. ++ dev_put(dev);
  20380. ++ return ERR_PTR(-ENFILE);
  20381. ++ }
  20382. ++
  20383. + brcmf_dbg(TRACE, "enter: %s type %d\n", name, type);
  20384. + err = brcmf_vif_add_validate(wiphy_to_cfg(wiphy), type);
  20385. + if (err) {
  20386. diff --git a/package/kernel/mac80211/patches/862-brcmfmac-Disable-power-management.patch b/package/kernel/mac80211/patches/862-brcmfmac-Disable-power-management.patch
  20387. new file mode 100644
  20388. index 0000000..f301fe1
  20389. --- /dev/null
  20390. +++ b/package/kernel/mac80211/patches/862-brcmfmac-Disable-power-management.patch
  20391. @@ -0,0 +1,27 @@
  20392. +From 66ae1b1750720a33e29792a177b1e696f4f005fb Mon Sep 17 00:00:00 2001
  20393. +From: Phil Elwell <phil@raspberrypi.org>
  20394. +Date: Wed, 9 Mar 2016 17:25:59 +0000
  20395. +Subject: [PATCH] brcmfmac: Disable power management
  20396. +
  20397. +Disable wireless power saving in the brcmfmac WLAN driver. This is a
  20398. +temporary measure until the connectivity loss resulting from power
  20399. +saving is resolved.
  20400. +
  20401. +Signed-off-by: Phil Elwell <phil@raspberrypi.org>
  20402. +---
  20403. + drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c | 2 ++
  20404. + 1 file changed, 2 insertions(+)
  20405. +
  20406. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  20407. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  20408. +@@ -2783,6 +2783,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip
  20409. + * preference in cfg struct to apply this to
  20410. + * FW later while initializing the dongle
  20411. + */
  20412. ++#if defined(CONFIG_BCM2708) || defined(CONFIG_BCM2709)
  20413. ++ pr_info("power management disabled\n");
  20414. ++ enabled = false;
  20415. ++#endif
  20416. + cfg->pwr_save = enabled;
  20417. + if (!check_vif_up(ifp->vif)) {
  20418. +
  20419. 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
  20420. deleted file mode 100644
  20421. index 1e440c0..0000000
  20422. --- a/package/kernel/mac80211/patches/862-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch
  20423. +++ /dev/null
  20424. @@ -1,50 +0,0 @@
  20425. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  20426. -Date: Thu, 9 Jul 2015 00:07:59 +0200
  20427. -Subject: [PATCH] brcmfmac: workaround bug with some inconsistent BSSes state
  20428. -MIME-Version: 1.0
  20429. -Content-Type: text/plain; charset=UTF-8
  20430. -Content-Transfer-Encoding: 8bit
  20431. -
  20432. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  20433. ----
  20434. -
  20435. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  20436. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  20437. -@@ -651,9 +651,37 @@ static struct wireless_dev *brcmf_cfg802
  20438. - u32 *flags,
  20439. - struct vif_params *params)
  20440. - {
  20441. -+ struct net_device *dev;
  20442. - struct wireless_dev *wdev;
  20443. - int err;
  20444. -
  20445. -+ /*
  20446. -+ * There is a bug with in-firmware BSS management. When adding virtual
  20447. -+ * interface brcmfmac first tells firmware to create new BSS and then
  20448. -+ * it creates new struct net_device.
  20449. -+ *
  20450. -+ * If creating/registering netdev(ice) fails, BSS remains in some bugged
  20451. -+ * state. It conflicts with existing BSSes by overtaking their auth
  20452. -+ * requests.
  20453. -+ *
  20454. -+ * It results in one BSS (addresss X) sending beacons and another BSS
  20455. -+ * (address Y) replying to authentication requests. This makes interface
  20456. -+ * unusable as AP.
  20457. -+ *
  20458. -+ * To workaround this bug we may try to guess if register_netdev(ice)
  20459. -+ * will fail. The most obvious case is using interface name that already
  20460. -+ * exists. This is actually quite likely with brcmfmac & some user space
  20461. -+ * scripts as brcmfmac doesn't allow deleting virtual interfaces.
  20462. -+ * So this bug can be triggered even by something trivial like:
  20463. -+ * iw dev wlan0 delete
  20464. -+ * iw phy phy0 interface add wlan0 type __ap
  20465. -+ */
  20466. -+ dev = dev_get_by_name(&init_net, name);
  20467. -+ if (dev) {
  20468. -+ dev_put(dev);
  20469. -+ return ERR_PTR(-ENFILE);
  20470. -+ }
  20471. -+
  20472. - brcmf_dbg(TRACE, "enter: %s type %d\n", name, type);
  20473. - err = brcmf_vif_add_validate(wiphy_to_cfg(wiphy), type);
  20474. - if (err) {
  20475. 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
  20476. index f2e21ea..be210f2 100644
  20477. --- a/package/kernel/mac80211/patches/910-01-add-support-for-mt7620.patch
  20478. +++ b/package/kernel/mac80211/patches/910-01-add-support-for-mt7620.patch
  20479. @@ -1184,7 +1184,7 @@
  20480. break;
  20481. default:
  20482. rt2x00_err(rt2x00dev, "Invalid RF chipset 0x%04x detected\n",
  20483. -@@ -8423,6 +9363,7 @@ static int rt2800_probe_hw_mode(struct r
  20484. +@@ -8427,6 +9367,7 @@ static int rt2800_probe_hw_mode(struct r
  20485. case RF5372:
  20486. case RF5390:
  20487. case RF5392:
  20488. @@ -1192,7 +1192,7 @@
  20489. spec->num_channels = 14;
  20490. if (spec->clk_is_20mhz)
  20491. spec->channels = rf_vals_xtal20mhz_3x;
  20492. -@@ -8563,6 +9504,7 @@ static int rt2800_probe_hw_mode(struct r
  20493. +@@ -8567,6 +9508,7 @@ static int rt2800_probe_hw_mode(struct r
  20494. case RF5372:
  20495. case RF5390:
  20496. case RF5392:
  20497. diff --git a/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch b/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
  20498. index 8c6d720..e842d61 100644
  20499. --- a/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
  20500. +++ b/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
  20501. @@ -14,7 +14,7 @@ Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
  20502. --- a/drivers/net/wireless/ath/ath10k/core.c
  20503. +++ b/drivers/net/wireless/ath/ath10k/core.c
  20504. -@@ -1914,6 +1914,16 @@ int ath10k_core_register(struct ath10k *
  20505. +@@ -2107,6 +2107,16 @@ int ath10k_core_register(struct ath10k *
  20506. ar->chip_id = chip_id;
  20507. queue_work(ar->workqueue, &ar->register_work);
  20508. 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
  20509. index 281b447..a501b99 100644
  20510. --- a/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch
  20511. +++ b/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch
  20512. @@ -1,6 +1,6 @@
  20513. --- a/drivers/net/wireless/ath/ath10k/mac.c
  20514. +++ b/drivers/net/wireless/ath/ath10k/mac.c
  20515. -@@ -7141,6 +7141,21 @@ struct ath10k_vif *ath10k_get_arvif(stru
  20516. +@@ -7742,6 +7742,21 @@ struct ath10k_vif *ath10k_get_arvif(stru
  20517. return arvif_iter.arvif;
  20518. }
  20519. @@ -22,11 +22,11 @@
  20520. int ath10k_mac_register(struct ath10k *ar)
  20521. {
  20522. static const u32 cipher_suites[] = {
  20523. -@@ -7357,6 +7372,12 @@ int ath10k_mac_register(struct ath10k *a
  20524. +@@ -7975,6 +7990,12 @@ int ath10k_mac_register(struct ath10k *a
  20525. ar->hw->wiphy->cipher_suites = cipher_suites;
  20526. ar->hw->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
  20527. -+#if CPTCFG_MAC80211_LEDS
  20528. ++#ifdef CPTCFG_MAC80211_LEDS
  20529. + ieee80211_create_tpt_led_trigger(ar->hw,
  20530. + IEEE80211_TPT_LEDTRIG_FL_RADIO, ath10k_tpt_blink,
  20531. + ARRAY_SIZE(ath10k_tpt_blink));
  20532. diff --git a/package/kernel/mac80211/patches/936-ath10k_skip_otp_check.patch b/package/kernel/mac80211/patches/936-ath10k_skip_otp_check.patch
  20533. new file mode 100644
  20534. index 0000000..596ef98
  20535. --- /dev/null
  20536. +++ b/package/kernel/mac80211/patches/936-ath10k_skip_otp_check.patch
  20537. @@ -0,0 +1,51 @@
  20538. +--- a/drivers/net/wireless/ath/ath10k/core.c
  20539. ++++ b/drivers/net/wireless/ath/ath10k/core.c
  20540. +@@ -1243,9 +1243,6 @@ static int ath10k_core_fetch_firmware_fi
  20541. + {
  20542. + int ret;
  20543. +
  20544. +- /* calibration file is optional, don't check for any errors */
  20545. +- ath10k_fetch_cal_file(ar);
  20546. +-
  20547. + ar->fw_api = 5;
  20548. + ath10k_dbg(ar, ATH10K_DBG_BOOT, "trying fw api %d\n", ar->fw_api);
  20549. +
  20550. +@@ -1944,7 +1941,7 @@ EXPORT_SYMBOL(ath10k_core_stop);
  20551. + static int ath10k_core_probe_fw(struct ath10k *ar)
  20552. + {
  20553. + struct bmi_target_info target_info;
  20554. +- int ret = 0;
  20555. ++ int calret, ret = 0;
  20556. +
  20557. + ret = ath10k_hif_power_up(ar);
  20558. + if (ret) {
  20559. +@@ -1968,6 +1965,9 @@ static int ath10k_core_probe_fw(struct a
  20560. + goto err_power_down;
  20561. + }
  20562. +
  20563. ++ /* calibration file is optional, don't check for any errors */
  20564. ++ calret = ath10k_fetch_cal_file(ar);
  20565. ++
  20566. + ret = ath10k_core_fetch_firmware_files(ar);
  20567. + if (ret) {
  20568. + ath10k_err(ar, "could not fetch firmware files (%d)\n", ret);
  20569. +@@ -1990,11 +1990,14 @@ static int ath10k_core_probe_fw(struct a
  20570. + "could not load pre cal data: %d\n", ret);
  20571. + }
  20572. +
  20573. +- ret = ath10k_core_get_board_id_from_otp(ar);
  20574. +- if (ret && ret != -EOPNOTSUPP) {
  20575. +- ath10k_err(ar, "failed to get board id from otp: %d\n",
  20576. +- ret);
  20577. +- goto err_free_firmware_files;
  20578. ++ /* otp and board file not needed if calibration data is present */
  20579. ++ if (calret) {
  20580. ++ ret = ath10k_core_get_board_id_from_otp(ar);
  20581. ++ if (ret && ret != -EOPNOTSUPP) {
  20582. ++ ath10k_err(ar, "failed to get board id from otp: %d\n",
  20583. ++ ret);
  20584. ++ goto err_free_firmware_files;
  20585. ++ }
  20586. + }
  20587. +
  20588. + ret = ath10k_core_fetch_board_file(ar);
  20589. diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile
  20590. index e49dd48..bd851e6 100644
  20591. --- a/package/kernel/mt76/Makefile
  20592. +++ b/package/kernel/mt76/Makefile
  20593. @@ -1,7 +1,7 @@
  20594. include $(TOPDIR)/rules.mk
  20595. PKG_NAME:=mt76
  20596. -PKG_VERSION:=2016-03-03
  20597. +PKG_VERSION:=2016-08-25
  20598. PKG_RELEASE=1
  20599. PKG_LICENSE:=GPLv2
  20600. @@ -10,23 +10,26 @@ PKG_LICENSE_FILES:=
  20601. PKG_SOURCE_URL:=https://github.com/openwrt/mt76
  20602. PKG_SOURCE_PROTO:=git
  20603. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  20604. -PKG_SOURCE_VERSION:=310d420178c86e253a172413da30ecf479b64251
  20605. +PKG_SOURCE_VERSION:=c3127d2acc354b4a27c8604716b0591093601971
  20606. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
  20607. -PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  20608. +PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  20609. PKG_BUILD_PARALLEL:=1
  20610. +STAMP_CONFIGURED_DEPENDS := $(STAGING_DIR)/usr/include/mac80211-backport/backport/autoconf.h
  20611. +
  20612. include $(INCLUDE_DIR)/kernel.mk
  20613. include $(INCLUDE_DIR)/package.mk
  20614. define KernelPackage/mt76
  20615. SUBMENU:=Wireless Drivers
  20616. - TITLE:=MediaTek MT76x2 wireless driver
  20617. - DEPENDS:=+kmod-mac80211 +@DRIVER_11N_SUPPORT @PCI_SUPPORT
  20618. + TITLE:=MediaTek MT76x2/MT7603 wireless driver
  20619. + DEPENDS:=+kmod-mac80211 +@DRIVER_11N_SUPPORT @PCI_SUPPORT @!LINUX_3_18
  20620. FILES:=\
  20621. $(PKG_BUILD_DIR)/mt76.ko \
  20622. - $(PKG_BUILD_DIR)/mt76x2e.ko
  20623. - AUTOLOAD:=$(call AutoLoad,50,mac80211 mt76 mt76x2e)
  20624. + $(PKG_BUILD_DIR)/mt76x2e.ko \
  20625. + $(PKG_BUILD_DIR)/mt7603e.ko
  20626. + AUTOLOAD:=$(call AutoLoad,50,mac80211 mt76 mt76x2e mt7603e)
  20627. endef
  20628. NOSTDINC_FLAGS = \
  20629. @@ -54,6 +57,12 @@ endef
  20630. define KernelPackage/mt76/install
  20631. $(INSTALL_DIR) $(1)/lib/firmware
  20632. cp \
  20633. + $(if $(CONFIG_TARGET_ramips_mt7628) || $(CONFIG_TARGET_ramips_mt7688), \
  20634. + $(PKG_BUILD_DIR)/firmware/mt7628_e1.bin \
  20635. + $(PKG_BUILD_DIR)/firmware/mt7628_e2.bin \
  20636. + ) \
  20637. + $(PKG_BUILD_DIR)/firmware/mt7603_e1.bin \
  20638. + $(PKG_BUILD_DIR)/firmware/mt7603_e2.bin \
  20639. $(PKG_BUILD_DIR)/firmware/mt7662_rom_patch.bin \
  20640. $(PKG_BUILD_DIR)/firmware/mt7662.bin \
  20641. $(1)/lib/firmware
  20642. diff --git a/package/network/services/hostapd/Config.in b/package/network/services/hostapd/Config.in
  20643. index aee2a15..645888e 100644
  20644. --- a/package/network/services/hostapd/Config.in
  20645. +++ b/package/network/services/hostapd/Config.in
  20646. @@ -10,11 +10,10 @@ config WPA_SUPPLICANT_NO_TIMESTAMP_CHECK
  20647. choice
  20648. prompt "Choose TLS provider"
  20649. default WPA_SUPPLICANT_INTERNAL
  20650. - depends on PACKAGE_wpa-supplicant || PACKAGE_wpa-supplicant-mesh || PACKAGE_wpad || PACKAGE_wpad-mesh
  20651. + depends on PACKAGE_wpa-supplicant || PACKAGE_wpad
  20652. config WPA_SUPPLICANT_INTERNAL
  20653. bool "internal"
  20654. - depends on PACKAGE_wpa-supplicant || PACKAGE_wpad
  20655. config WPA_SUPPLICANT_OPENSSL
  20656. bool "openssl"
  20657. diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile
  20658. index 8e706dc..5caf3e3 100644
  20659. --- a/package/network/services/hostapd/Makefile
  20660. +++ b/package/network/services/hostapd/Makefile
  20661. @@ -7,18 +7,18 @@
  20662. include $(TOPDIR)/rules.mk
  20663. PKG_NAME:=hostapd
  20664. -PKG_VERSION:=2015-03-25
  20665. +PKG_VERSION:=2016-06-15
  20666. PKG_RELEASE:=1
  20667. -PKG_REV:=8278138e679174b1ec8af7f169c2810a8888e202
  20668. +PKG_REV:=31d3692fe5d56c05753ed4a70c7943979e1d29e7
  20669. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
  20670. -PKG_SOURCE_URL:=git://w1.fi/srv/git/hostap.git
  20671. +PKG_SOURCE_URL:=http://w1.fi/hostap.git
  20672. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  20673. PKG_SOURCE_VERSION:=$(PKG_REV)
  20674. PKG_SOURCE_PROTO:=git
  20675. # PKG_MIRROR_MD5SUM:=4e7c1f97edd7514535056fce54ae053a
  20676. -PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  20677. +PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  20678. PKG_LICENSE:=BSD-3-Clause
  20679. PKG_BUILD_PARALLEL:=1
  20680. @@ -29,7 +29,6 @@ PKG_CONFIG_DEPENDS:= \
  20681. CONFIG_PACKAGE_kmod-cfg80211 \
  20682. CONFIG_PACKAGE_hostapd \
  20683. CONFIG_PACKAGE_hostapd-mini \
  20684. - CONFIG_PACKAGE_kmod-hostap \
  20685. CONFIG_WPA_RFKILL_SUPPORT \
  20686. CONFIG_DRIVER_WEXT_SUPPORT \
  20687. CONFIG_DRIVER_11N_SUPPORT
  20688. @@ -40,6 +39,10 @@ LOCAL_TYPE=$(strip \
  20689. hostapd \
  20690. )))
  20691. LOCAL_VARIANT=$(patsubst wpad-%,%,$(patsubst supplicant-%,%,$(BUILD_VARIANT)))
  20692. +CONFIG_VARIANT:=$(LOCAL_VARIANT)
  20693. +ifeq ($(LOCAL_VARIANT),mesh)
  20694. + CONFIG_VARIANT:=full
  20695. +endif
  20696. ifeq ($(LOCAL_TYPE),supplicant)
  20697. ifeq ($(LOCAL_VARIANT),full)
  20698. @@ -47,10 +50,6 @@ ifeq ($(LOCAL_TYPE),supplicant)
  20699. CONFIG_WPA_SUPPLICANT_INTERNAL \
  20700. CONFIG_WPA_SUPPLICANT_OPENSSL
  20701. endif
  20702. - ifeq ($(LOCAL_VARIANT),mesh)
  20703. - PKG_CONFIG_DEPENDS += \
  20704. - CONFIG_WPA_SUPPLICANT_OPENSSL
  20705. - endif
  20706. endif
  20707. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
  20708. @@ -66,7 +65,6 @@ endif
  20709. DRIVER_MAKEOPTS= \
  20710. CONFIG_ACS=$(CONFIG_PACKAGE_kmod-cfg80211) \
  20711. CONFIG_DRIVER_NL80211=$(CONFIG_PACKAGE_kmod-cfg80211) \
  20712. - CONFIG_DRIVER_HOSTAP=$(CONFIG_PACKAGE_kmod-hostap) \
  20713. CONFIG_IEEE80211N=$(HOSTAPD_IEEE80211N) \
  20714. CONFIG_DRIVER_WEXT=$(CONFIG_DRIVER_WEXT_SUPPORT) \
  20715. @@ -82,7 +80,7 @@ ifneq ($(LOCAL_TYPE),hostapd)
  20716. endif
  20717. endif
  20718. ifeq ($(LOCAL_VARIANT),mesh)
  20719. - DRIVER_MAKEOPTS += CONFIG_TLS=openssl
  20720. + DRIVER_MAKEOPTS += CONFIG_TLS=openssl CONFIG_AP=y CONFIG_SAE=y CONFIG_MESH=y
  20721. TARGET_LDFLAGS += -lcrypto -lssl
  20722. endif
  20723. ifdef CONFIG_WPA_SUPPLICANT_NO_TIMESTAMP_CHECK
  20724. @@ -177,8 +175,7 @@ endef
  20725. define Package/wpad-mesh
  20726. $(call Package/wpad/Default)
  20727. TITLE+= (with 802.11s mesh and SAE support)
  20728. - DEPENDS:=$(DRV_DEPENDS) +libubus +libopenssl +@CONFIG_WPA_SUPPLICANT_OPENSSL @(!TARGET_uml||BROKEN)
  20729. - CONFLICTS:=@WPA_SUPPLICANT_INTERNAL
  20730. + DEPENDS:=$(DRV_DEPENDS) +libubus +PACKAGE_wpad-mesh:libopenssl @(!TARGET_uml||BROKEN)
  20731. VARIANT:=wpad-mesh
  20732. endef
  20733. @@ -257,12 +254,6 @@ define Package/hostapd-common
  20734. CATEGORY:=Network
  20735. endef
  20736. -define Package/hostapd-common-old
  20737. - TITLE:=hostapd/wpa_supplicant common support files (legacy drivers)
  20738. - SECTION:=net
  20739. - CATEGORY:=Network
  20740. -endef
  20741. -
  20742. define Package/eapol-test
  20743. TITLE:=802.1x authentication test utility
  20744. SECTION:=net
  20745. @@ -284,10 +275,10 @@ endif
  20746. define Build/Configure
  20747. $(Build/Configure/rebuild)
  20748. - $(if $(wildcard ./files/hostapd-$(LOCAL_VARIANT).config), \
  20749. - $(CP) ./files/hostapd-$(LOCAL_VARIANT).config $(PKG_BUILD_DIR)/hostapd/.config \
  20750. + $(if $(wildcard ./files/hostapd-$(CONFIG_VARIANT).config), \
  20751. + $(CP) ./files/hostapd-$(CONFIG_VARIANT).config $(PKG_BUILD_DIR)/hostapd/.config \
  20752. )
  20753. - $(CP) ./files/wpa_supplicant-$(LOCAL_VARIANT).config $(PKG_BUILD_DIR)/wpa_supplicant/.config
  20754. + $(CP) ./files/wpa_supplicant-$(CONFIG_VARIANT).config $(PKG_BUILD_DIR)/wpa_supplicant/.config
  20755. endef
  20756. TARGET_CPPFLAGS := \
  20757. @@ -379,12 +370,6 @@ define Package/hostapd-common/install
  20758. $(INSTALL_DATA) ./files/netifd.sh $(1)/lib/netifd/hostapd.sh
  20759. endef
  20760. -define Package/hostapd-common-old/install
  20761. - $(INSTALL_DIR) $(1)/lib/wifi
  20762. - $(INSTALL_DATA) ./files/hostapd.sh $(1)/lib/wifi/hostapd.sh
  20763. - $(INSTALL_DATA) ./files/wpa_supplicant.sh $(1)/lib/wifi/wpa_supplicant.sh
  20764. -endef
  20765. -
  20766. define Package/hostapd/install
  20767. $(call Install/hostapd,$(1))
  20768. $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd $(1)/usr/sbin/
  20769. @@ -442,5 +427,4 @@ $(eval $(call BuildPackage,wpa-supplicant-p2p))
  20770. $(eval $(call BuildPackage,wpa-cli))
  20771. $(eval $(call BuildPackage,hostapd-utils))
  20772. $(eval $(call BuildPackage,hostapd-common))
  20773. -$(eval $(call BuildPackage,hostapd-common-old))
  20774. $(eval $(call BuildPackage,eapol-test))
  20775. diff --git a/package/network/services/hostapd/files/hostapd-full.config b/package/network/services/hostapd/files/hostapd-full.config
  20776. index f1b2655..e388109 100644
  20777. --- a/package/network/services/hostapd/files/hostapd-full.config
  20778. +++ b/package/network/services/hostapd/files/hostapd-full.config
  20779. @@ -10,7 +10,7 @@
  20780. # to override previous values of the variables.
  20781. # Driver interface for Host AP driver
  20782. -CONFIG_DRIVER_HOSTAP=y
  20783. +#CONFIG_DRIVER_HOSTAP=y
  20784. # Driver interface for wired authenticator
  20785. CONFIG_DRIVER_WIRED=y
  20786. @@ -53,6 +53,9 @@ CONFIG_PEERKEY=y
  20787. # Integrated EAP server
  20788. CONFIG_EAP=y
  20789. +# EAP-FAST for the integrated EAP server
  20790. +CONFIG_EAP_FAST=y
  20791. +
  20792. # EAP-MD5 for the integrated EAP server
  20793. CONFIG_EAP_MD5=y
  20794. diff --git a/package/network/services/hostapd/files/hostapd-mini.config b/package/network/services/hostapd/files/hostapd-mini.config
  20795. index 118d97c..8baff18 100644
  20796. --- a/package/network/services/hostapd/files/hostapd-mini.config
  20797. +++ b/package/network/services/hostapd/files/hostapd-mini.config
  20798. @@ -10,7 +10,7 @@
  20799. # to override previous values of the variables.
  20800. # Driver interface for Host AP driver
  20801. -CONFIG_DRIVER_HOSTAP=y
  20802. +#CONFIG_DRIVER_HOSTAP=y
  20803. # Driver interface for wired authenticator
  20804. CONFIG_DRIVER_WIRED=y
  20805. diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh
  20806. deleted file mode 100644
  20807. index 7aec7ad..0000000
  20808. --- a/package/network/services/hostapd/files/hostapd.sh
  20809. +++ /dev/null
  20810. @@ -1,394 +0,0 @@
  20811. -hostapd_set_bss_options() {
  20812. - local var="$1"
  20813. - local vif="$2"
  20814. - local enc wep_rekey wpa_group_rekey wpa_pair_rekey wpa_master_rekey wps_possible wpa_key_mgmt
  20815. -
  20816. - config_get enc "$vif" encryption "none"
  20817. - config_get wep_rekey "$vif" wep_rekey # 300
  20818. - config_get wpa_group_rekey "$vif" wpa_group_rekey # 300
  20819. - config_get wpa_pair_rekey "$vif" wpa_pair_rekey # 300
  20820. - config_get wpa_master_rekey "$vif" wpa_master_rekey # 640
  20821. - config_get_bool ap_isolate "$vif" isolate 0
  20822. - config_get_bool disassoc_low_ack "$vif" disassoc_low_ack 1
  20823. - config_get max_num_sta "$vif" max_num_sta 0
  20824. - config_get max_inactivity "$vif" max_inactivity 0
  20825. - config_get_bool preamble "$vif" short_preamble 1
  20826. -
  20827. - config_get device "$vif" device
  20828. - config_get hwmode "$device" hwmode
  20829. - config_get phy "$device" phy
  20830. -
  20831. - append "$var" "ctrl_interface=/var/run/hostapd-$phy" "$N"
  20832. -
  20833. - if [ "$ap_isolate" -gt 0 ]; then
  20834. - append "$var" "ap_isolate=$ap_isolate" "$N"
  20835. - fi
  20836. - if [ "$max_num_sta" -gt 0 ]; then
  20837. - append "$var" "max_num_sta=$max_num_sta" "$N"
  20838. - fi
  20839. - if [ "$max_inactivity" -gt 0 ]; then
  20840. - append "$var" "ap_max_inactivity=$max_inactivity" "$N"
  20841. - fi
  20842. - append "$var" "disassoc_low_ack=$disassoc_low_ack" "$N"
  20843. - if [ "$preamble" -gt 0 ]; then
  20844. - append "$var" "preamble=$preamble" "$N"
  20845. - fi
  20846. -
  20847. - # Examples:
  20848. - # psk-mixed/tkip => WPA1+2 PSK, TKIP
  20849. - # wpa-psk2/tkip+aes => WPA2 PSK, CCMP+TKIP
  20850. - # wpa2/tkip+aes => WPA2 RADIUS, CCMP+TKIP
  20851. - # ...
  20852. -
  20853. - # TODO: move this parsing function somewhere generic, so that
  20854. - # later it can be reused by drivers that don't use hostapd
  20855. -
  20856. - # crypto defaults: WPA2 vs WPA1
  20857. - case "$enc" in
  20858. - wpa2*|*psk2*)
  20859. - wpa=2
  20860. - crypto="CCMP"
  20861. - ;;
  20862. - *mixed*)
  20863. - wpa=3
  20864. - crypto="CCMP TKIP"
  20865. - ;;
  20866. - *)
  20867. - wpa=1
  20868. - crypto="TKIP"
  20869. - ;;
  20870. - esac
  20871. -
  20872. - # explicit override for crypto setting
  20873. - case "$enc" in
  20874. - *tkip+aes|*tkip+ccmp|*aes+tkip|*ccmp+tkip) crypto="CCMP TKIP";;
  20875. - *aes|*ccmp) crypto="CCMP";;
  20876. - *tkip) crypto="TKIP";;
  20877. - esac
  20878. -
  20879. - # enforce CCMP for 11ng and 11na
  20880. - case "$hwmode:$crypto" in
  20881. - *ng:TKIP|*na:TKIP) crypto="CCMP TKIP";;
  20882. - esac
  20883. -
  20884. - # use crypto/auth settings for building the hostapd config
  20885. - case "$enc" in
  20886. - none)
  20887. - wps_possible=1
  20888. - wpa=0
  20889. - crypto=
  20890. - # Here we make the assumption that if we're in open mode
  20891. - # with WPS enabled, we got to be in unconfigured state.
  20892. - wps_not_configured=1
  20893. - ;;
  20894. - *psk*)
  20895. - config_get psk "$vif" key
  20896. - if [ ${#psk} -eq 64 ]; then
  20897. - append "$var" "wpa_psk=$psk" "$N"
  20898. - else
  20899. - append "$var" "wpa_passphrase=$psk" "$N"
  20900. - fi
  20901. - wps_possible=1
  20902. - [ -n "$wpa_group_rekey" ] && append "$var" "wpa_group_rekey=$wpa_group_rekey" "$N"
  20903. - [ -n "$wpa_pair_rekey" ] && append "$var" "wpa_ptk_rekey=$wpa_pair_rekey" "$N"
  20904. - [ -n "$wpa_master_rekey" ] && append "$var" "wpa_gmk_rekey=$wpa_master_rekey" "$N"
  20905. - append wpa_key_mgmt "WPA-PSK"
  20906. - ;;
  20907. - *wpa*|*8021x*)
  20908. - # required fields? formats?
  20909. - # hostapd is particular, maybe a default configuration for failures
  20910. - config_get auth_server "$vif" auth_server
  20911. - [ -z "$auth_server" ] && config_get auth_server "$vif" server
  20912. - append "$var" "auth_server_addr=$auth_server" "$N"
  20913. - config_get auth_port "$vif" auth_port
  20914. - [ -z "$auth_port" ] && config_get auth_port "$vif" port
  20915. - auth_port=${auth_port:-1812}
  20916. - append "$var" "auth_server_port=$auth_port" "$N"
  20917. - config_get auth_secret "$vif" auth_secret
  20918. - [ -z "$auth_secret" ] && config_get auth_secret "$vif" key
  20919. - append "$var" "auth_server_shared_secret=$auth_secret" "$N"
  20920. - # You don't really want to enable this unless you are doing
  20921. - # some corner case testing or are using OpenWrt as a work around
  20922. - # for some systematic issues.
  20923. - config_get_bool auth_cache "$vif" auth_cache 0
  20924. - config_get rsn_preauth "$vif" rsn_preauth
  20925. - [ "$auth_cache" -gt 0 ] || [[ "$rsn_preauth" = 1 ]] || append "$var" "disable_pmksa_caching=1" "$N"
  20926. - [ "$auth_cache" -gt 0 ] || [[ "$rsn_preauth" = 1 ]] || append "$var" "okc=0" "$N"
  20927. - config_get acct_server "$vif" acct_server
  20928. - [ -n "$acct_server" ] && append "$var" "acct_server_addr=$acct_server" "$N"
  20929. - config_get acct_port "$vif" acct_port
  20930. - [ -n "$acct_port" ] && acct_port=${acct_port:-1813}
  20931. - [ -n "$acct_port" ] && append "$var" "acct_server_port=$acct_port" "$N"
  20932. - config_get acct_secret "$vif" acct_secret
  20933. - [ -n "$acct_secret" ] && append "$var" "acct_server_shared_secret=$acct_secret" "$N"
  20934. - config_get eap_reauth_period "$vif" eap_reauth_period
  20935. - [ -n "$eap_reauth_period" ] && append "$var" "eap_reauth_period=$eap_reauth_period" "$N"
  20936. - config_get dae_client "$vif" dae_client
  20937. - config_get dae_secret "$vif" dae_secret
  20938. - [ -n "$dae_client" -a -n "$dae_secret" ] && {
  20939. - config_get dae_port "$vif" dae_port
  20940. - append "$var" "radius_das_port=${dae_port:-3799}" "$N"
  20941. - append "$var" "radius_das_client=$dae_client $dae_secret" "$N"
  20942. - }
  20943. - config_get ownip "$vif" ownip
  20944. - append "$var" "own_ip_addr=$ownip" "$N"
  20945. - append "$var" "eapol_key_index_workaround=1" "$N"
  20946. - append "$var" "ieee8021x=1" "$N"
  20947. - append wpa_key_mgmt "WPA-EAP"
  20948. - [ -n "$wpa_group_rekey" ] && append "$var" "wpa_group_rekey=$wpa_group_rekey" "$N"
  20949. - [ -n "$wpa_pair_rekey" ] && append "$var" "wpa_ptk_rekey=$wpa_pair_rekey" "$N"
  20950. - [ -n "$wpa_master_rekey" ] && append "$var" "wpa_gmk_rekey=$wpa_master_rekey" "$N"
  20951. - ;;
  20952. - *wep*)
  20953. - config_get key "$vif" key
  20954. - key="${key:-1}"
  20955. - case "$key" in
  20956. - [1234])
  20957. - for idx in 1 2 3 4; do
  20958. - local zidx
  20959. - zidx=$(($idx - 1))
  20960. - config_get ckey "$vif" "key${idx}"
  20961. - [ -n "$ckey" ] && \
  20962. - append "$var" "wep_key${zidx}=$(prepare_key_wep "$ckey")" "$N"
  20963. - done
  20964. - append "$var" "wep_default_key=$((key - 1))" "$N"
  20965. - ;;
  20966. - *)
  20967. - append "$var" "wep_key0=$(prepare_key_wep "$key")" "$N"
  20968. - append "$var" "wep_default_key=0" "$N"
  20969. - [ -n "$wep_rekey" ] && append "$var" "wep_rekey_period=$wep_rekey" "$N"
  20970. - ;;
  20971. - esac
  20972. - case "$enc" in
  20973. - *shared*)
  20974. - auth_algs=2
  20975. - ;;
  20976. - *mixed*)
  20977. - auth_algs=3
  20978. - ;;
  20979. - esac
  20980. - wpa=0
  20981. - crypto=
  20982. - ;;
  20983. - *)
  20984. - wpa=0
  20985. - crypto=
  20986. - ;;
  20987. - esac
  20988. - append "$var" "auth_algs=${auth_algs:-1}" "$N"
  20989. - append "$var" "wpa=$wpa" "$N"
  20990. - [ -n "$crypto" ] && append "$var" "wpa_pairwise=$crypto" "$N"
  20991. - [ -n "$wpa_group_rekey" ] && append "$var" "wpa_group_rekey=$wpa_group_rekey" "$N"
  20992. -
  20993. - config_get ssid "$vif" ssid
  20994. - config_get bridge "$vif" bridge
  20995. - config_get ieee80211d "$vif" ieee80211d
  20996. - config_get iapp_interface "$vif" iapp_interface
  20997. -
  20998. - config_get_bool wps_pbc "$vif" wps_pushbutton 0
  20999. - config_get_bool wps_label "$vif" wps_label 0
  21000. -
  21001. - config_get config_methods "$vif" wps_config
  21002. - [ "$wps_pbc" -gt 0 ] && append config_methods push_button
  21003. -
  21004. - [ -n "$wps_possible" -a -n "$config_methods" ] && {
  21005. - config_get device_type "$vif" wps_device_type "6-0050F204-1"
  21006. - config_get device_name "$vif" wps_device_name "OpenWrt AP"
  21007. - config_get manufacturer "$vif" wps_manufacturer "openwrt.org"
  21008. - config_get wps_pin "$vif" wps_pin
  21009. -
  21010. - config_get_bool ext_registrar "$vif" ext_registrar 0
  21011. - [ "$ext_registrar" -gt 0 -a -n "$bridge" ] && append "$var" "upnp_iface=$bridge" "$N"
  21012. -
  21013. - append "$var" "eap_server=1" "$N"
  21014. - [ -n "$wps_pin" ] && append "$var" "ap_pin=$wps_pin" "$N"
  21015. - append "$var" "wps_state=${wps_not_configured:-2}" "$N"
  21016. - append "$var" "ap_setup_locked=0" "$N"
  21017. - append "$var" "device_type=$device_type" "$N"
  21018. - append "$var" "device_name=$device_name" "$N"
  21019. - append "$var" "manufacturer=$manufacturer" "$N"
  21020. - append "$var" "config_methods=$config_methods" "$N"
  21021. - }
  21022. -
  21023. - append "$var" "ssid=$ssid" "$N"
  21024. - [ -n "$bridge" ] && append "$var" "bridge=$bridge" "$N"
  21025. - [ -n "$ieee80211d" ] && append "$var" "ieee80211d=$ieee80211d" "$N"
  21026. - [ -n "$iapp_interface" ] && append "$var" iapp_interface=$(uci_get_state network "$iapp_interface" ifname "$iapp_interface") "$N"
  21027. -
  21028. - if [ "$wpa" -ge "1" ]
  21029. - then
  21030. - config_get nasid "$vif" nasid
  21031. - [ -n "$nasid" ] && append "$var" "nas_identifier=$nasid" "$N"
  21032. -
  21033. - config_get_bool ieee80211r "$vif" ieee80211r 0
  21034. - if [ "$ieee80211r" -gt 0 ]
  21035. - then
  21036. - config_get mobility_domain "$vif" mobility_domain "4f57"
  21037. - config_get r0_key_lifetime "$vif" r0_key_lifetime "10000"
  21038. - config_get r1_key_holder "$vif" r1_key_holder "00004f577274"
  21039. - config_get reassociation_deadline "$vif" reassociation_deadline "1000"
  21040. - config_get r0kh "$vif" r0kh
  21041. - config_get r1kh "$vif" r1kh
  21042. - config_get_bool pmk_r1_push "$vif" pmk_r1_push 0
  21043. -
  21044. - append "$var" "mobility_domain=$mobility_domain" "$N"
  21045. - append "$var" "r0_key_lifetime=$r0_key_lifetime" "$N"
  21046. - append "$var" "r1_key_holder=$r1_key_holder" "$N"
  21047. - append "$var" "reassociation_deadline=$reassociation_deadline" "$N"
  21048. - append "$var" "pmk_r1_push=$pmk_r1_push" "$N"
  21049. -
  21050. - for kh in $r0kh; do
  21051. - "$var" "r0kh=${kh//,/ }" "$N"
  21052. - done
  21053. - for kh in $r1kh; do
  21054. - "$var" "r1kh=${kh//,/ }" "$N"
  21055. - done
  21056. -
  21057. - [ "$wpa_key_mgmt" != "${wpa_key_mgmt/EAP/}" ] && append wpa_key_mgmt "FT-EAP"
  21058. - [ "$wpa_key_mgmt" != "${wpa_key_mgmt/PSK/}" ] && append wpa_key_mgmt "FT-PSK"
  21059. - fi
  21060. -
  21061. - [ -n "wpa_key_mgmt" ] && append "$var" "wpa_key_mgmt=$wpa_key_mgmt"
  21062. - fi
  21063. -
  21064. - if [ "$wpa" -ge "2" ]
  21065. - then
  21066. - # RSN -> allow preauthentication. You have two
  21067. - # options, rsn_preauth for production or rsn_preauth_testing
  21068. - # for validation / testing.
  21069. - if [ -n "$bridge" -a "$rsn_preauth" = 1 ]
  21070. - then
  21071. - append "$var" "rsn_preauth=1" "$N"
  21072. - append "$var" "rsn_preauth_interfaces=$bridge" "$N"
  21073. - append "$var" "okc=1" "$N"
  21074. - else
  21075. - # RSN preauthentication testings hould disable
  21076. - # Opportunistic Key Caching (okc) as otherwise the PMKSA
  21077. - # entry for a test could come from the Opportunistic Key Caching
  21078. - config_get rsn_preauth_testing "$vif" rsn_preauth_testing
  21079. - if [ -n "$bridge" -a "$rsn_preauth_testing" = 1 ]
  21080. - then
  21081. - append "$var" "rsn_preauth=1" "$N"
  21082. - append "$var" "rsn_preauth_interfaces=$bridge" "$N"
  21083. - append "$var" "okc=0" "$N"
  21084. - fi
  21085. - fi
  21086. -
  21087. - # RSN -> allow management frame protection
  21088. - config_get ieee80211w "$vif" ieee80211w
  21089. - case "$ieee80211w" in
  21090. - [012])
  21091. - append "$var" "ieee80211w=$ieee80211w" "$N"
  21092. - [ "$ieee80211w" -gt "0" ] && {
  21093. - config_get ieee80211w_max_timeout "$vif" ieee80211w_max_timeout
  21094. - config_get ieee80211w_retry_timeout "$vif" ieee80211w_retry_timeout
  21095. - [ -n "$ieee80211w_max_timeout" ] && \
  21096. - append "$var" "assoc_sa_query_max_timeout=$ieee80211w_max_timeout" "$N"
  21097. - [ -n "$ieee80211w_retry_timeout" ] && \
  21098. - append "$var" "assoc_sa_query_retry_timeout=$ieee80211w_retry_timeout" "$N"
  21099. - }
  21100. - ;;
  21101. - esac
  21102. - fi
  21103. -
  21104. - config_get macfile "$vif" macfile
  21105. - config_get maclist "$vif" maclist
  21106. - if [ -z "$macfile" ]
  21107. - then
  21108. - # if no macfile has been specified, fallback to the default name
  21109. - # and truncate file to avoid aggregating entries over time
  21110. - macfile="/var/run/hostapd-$ifname.maclist"
  21111. - echo "" > "$macfile"
  21112. - else
  21113. - if [ -n "$maclist" ]
  21114. - then
  21115. - # to avoid to overwrite the original file, make a copy
  21116. - # before appending the entries specified by the maclist
  21117. - # option
  21118. - cp $macfile $macfile.maclist
  21119. - macfile=$macfile.maclist
  21120. - fi
  21121. - fi
  21122. -
  21123. - if [ -n "$maclist" ]
  21124. - then
  21125. - for mac in $maclist; do
  21126. - echo "$mac" >> $macfile
  21127. - done
  21128. - fi
  21129. -
  21130. - config_get macfilter "$vif" macfilter
  21131. - case "$macfilter" in
  21132. - allow)
  21133. - append "$var" "macaddr_acl=1" "$N"
  21134. - append "$var" "accept_mac_file=$macfile" "$N"
  21135. - ;;
  21136. - deny)
  21137. - append "$var" "macaddr_acl=0" "$N"
  21138. - append "$var" "deny_mac_file=$macfile" "$N"
  21139. - ;;
  21140. - esac
  21141. -}
  21142. -
  21143. -hostapd_set_log_options() {
  21144. - local var="$1"
  21145. - local cfg="$2"
  21146. - local log_level log_80211 log_8021x log_radius log_wpa log_driver log_iapp log_mlme
  21147. -
  21148. - config_get log_level "$cfg" log_level 2
  21149. -
  21150. - config_get_bool log_80211 "$cfg" log_80211 1
  21151. - config_get_bool log_8021x "$cfg" log_8021x 1
  21152. - config_get_bool log_radius "$cfg" log_radius 1
  21153. - config_get_bool log_wpa "$cfg" log_wpa 1
  21154. - config_get_bool log_driver "$cfg" log_driver 1
  21155. - config_get_bool log_iapp "$cfg" log_iapp 1
  21156. - config_get_bool log_mlme "$cfg" log_mlme 1
  21157. -
  21158. - local log_mask=$(( \
  21159. - ($log_80211 << 0) | \
  21160. - ($log_8021x << 1) | \
  21161. - ($log_radius << 2) | \
  21162. - ($log_wpa << 3) | \
  21163. - ($log_driver << 4) | \
  21164. - ($log_iapp << 5) | \
  21165. - ($log_mlme << 6) \
  21166. - ))
  21167. -
  21168. - append "$var" "logger_syslog=$log_mask" "$N"
  21169. - append "$var" "logger_syslog_level=$log_level" "$N"
  21170. - append "$var" "logger_stdout=$log_mask" "$N"
  21171. - append "$var" "logger_stdout_level=$log_level" "$N"
  21172. -}
  21173. -
  21174. -hostapd_setup_vif() {
  21175. - local vif="$1"
  21176. - local driver="$2"
  21177. - local ifname device channel hwmode
  21178. -
  21179. - hostapd_cfg=
  21180. -
  21181. - config_get ifname "$vif" ifname
  21182. - config_get device "$vif" device
  21183. - config_get channel "$device" channel
  21184. - config_get hwmode "$device" hwmode
  21185. -
  21186. - hostapd_set_log_options hostapd_cfg "$device"
  21187. - hostapd_set_bss_options hostapd_cfg "$vif"
  21188. -
  21189. - case "$hwmode" in
  21190. - *bg|*gdt|*gst|*fh) hwmode=g;;
  21191. - *adt|*ast) hwmode=a;;
  21192. - esac
  21193. - [ "$channel" = auto ] && channel=
  21194. - [ -n "$channel" -a -z "$hwmode" ] && wifi_fixup_hwmode "$device"
  21195. - cat > /var/run/hostapd-$ifname.conf <<EOF
  21196. -driver=$driver
  21197. -interface=$ifname
  21198. -${hwmode:+hw_mode=${hwmode#11}}
  21199. -${channel:+channel=$channel}
  21200. -$hostapd_cfg
  21201. -EOF
  21202. - hostapd -P /var/run/wifi-$ifname.pid -B /var/run/hostapd-$ifname.conf
  21203. -}
  21204. -
  21205. diff --git a/package/network/services/hostapd/files/netifd.sh b/package/network/services/hostapd/files/netifd.sh
  21206. index 23d2e7e..e6b0b0d 100644
  21207. --- a/package/network/services/hostapd/files/netifd.sh
  21208. +++ b/package/network/services/hostapd/files/netifd.sh
  21209. @@ -1,3 +1,5 @@
  21210. +. /lib/functions/network.sh
  21211. +
  21212. wpa_supplicant_add_rate() {
  21213. local var="$1"
  21214. local val="$(($2 / 1000))"
  21215. @@ -120,6 +122,7 @@ hostapd_common_add_bss_config() {
  21216. config_add_boolean rsn_preauth auth_cache
  21217. config_add_int ieee80211w
  21218. + config_add_int eapol_version
  21219. config_add_string 'auth_server:host' 'server:host'
  21220. config_add_string auth_secret
  21221. @@ -136,10 +139,11 @@ hostapd_common_add_bss_config() {
  21222. config_add_string nasid
  21223. config_add_string ownip
  21224. config_add_string iapp_interface
  21225. - config_add_string eap_type ca_cert client_cert identity auth priv_key priv_key_pwd
  21226. + config_add_string eap_type ca_cert client_cert identity anonymous_identity auth priv_key priv_key_pwd
  21227. config_add_int dynamic_vlan vlan_naming
  21228. config_add_string vlan_tagged_interface vlan_bridge
  21229. + config_add_string vlan_file
  21230. config_add_string 'key1:wepkey' 'key2:wepkey' 'key3:wepkey' 'key4:wepkey' 'password:wpakey'
  21231. @@ -182,7 +186,7 @@ hostapd_set_bss_options() {
  21232. wps_pushbutton wps_label ext_registrar wps_pbc_in_m1 \
  21233. wps_device_type wps_device_name wps_manufacturer wps_pin \
  21234. macfilter ssid wmm uapsd hidden short_preamble rsn_preauth \
  21235. - iapp_interface
  21236. + iapp_interface eapol_version acct_server acct_secret acct_port
  21237. set_default isolate 0
  21238. set_default maxassoc 0
  21239. @@ -192,6 +196,8 @@ hostapd_set_bss_options() {
  21240. set_default hidden 0
  21241. set_default wmm 1
  21242. set_default uapsd 1
  21243. + set_default eapol_version 0
  21244. + set_default acct_port 1813
  21245. append bss_conf "ctrl_interface=/var/run/hostapd"
  21246. if [ "$isolate" -gt 0 ]; then
  21247. @@ -216,6 +222,13 @@ hostapd_set_bss_options() {
  21248. [ -n "$wpa_master_rekey" ] && append bss_conf "wpa_gmk_rekey=$wpa_master_rekey" "$N"
  21249. }
  21250. + [ -n "$acct_server" ] && {
  21251. + append bss_conf "acct_server_addr=$acct_server" "$N"
  21252. + append bss_conf "acct_server_port=$acct_port" "$N"
  21253. + [ -n "$acct_secret" ] && \
  21254. + append bss_conf "acct_server_shared_secret=$acct_secret" "$N"
  21255. + }
  21256. +
  21257. case "$auth_type" in
  21258. none)
  21259. wps_possible=1
  21260. @@ -237,18 +250,19 @@ hostapd_set_bss_options() {
  21261. [ -e "$wpa_psk_file" ] || touch "$wpa_psk_file"
  21262. append bss_conf "wpa_psk_file=$wpa_psk_file" "$N"
  21263. }
  21264. + [ "$eapol_version" -ge "1" -a "$eapol_version" -le "2" ] && append bss_conf "eapol_version=$eapol_version" "$N"
  21265. +
  21266. wps_possible=1
  21267. append wpa_key_mgmt "WPA-PSK"
  21268. ;;
  21269. eap)
  21270. json_get_vars \
  21271. auth_server auth_secret auth_port \
  21272. - acct_server acct_secret acct_port \
  21273. dae_client dae_secret dae_port \
  21274. ownip \
  21275. eap_reauth_period dynamic_vlan \
  21276. vlan_naming vlan_tagged_interface \
  21277. - vlan_bridge
  21278. + vlan_bridge vlan_file
  21279. # legacy compatibility
  21280. [ -n "$auth_server" ] || json_get_var auth_server server
  21281. @@ -256,7 +270,6 @@ hostapd_set_bss_options() {
  21282. [ -n "$auth_secret" ] || json_get_var auth_secret key
  21283. set_default auth_port 1812
  21284. - set_default acct_port 1813
  21285. set_default dae_port 3799
  21286. set_default vlan_naming 1
  21287. @@ -265,13 +278,6 @@ hostapd_set_bss_options() {
  21288. append bss_conf "auth_server_port=$auth_port" "$N"
  21289. append bss_conf "auth_server_shared_secret=$auth_secret" "$N"
  21290. - [ -n "$acct_server" ] && {
  21291. - append bss_conf "acct_server_addr=$acct_server" "$N"
  21292. - append bss_conf "acct_server_port=$acct_port" "$N"
  21293. - [ -n "$acct_secret" ] && \
  21294. - append bss_conf "acct_server_shared_secret=$acct_secret" "$N"
  21295. - }
  21296. -
  21297. [ -n "$eap_reauth_period" ] && append bss_conf "eap_reauth_period=$eap_reauth_period" "$N"
  21298. [ -n "$dae_client" -a -n "$dae_secret" ] && {
  21299. @@ -291,7 +297,13 @@ hostapd_set_bss_options() {
  21300. append bss_conf "vlan_bridge=$vlan_bridge" "$N"
  21301. [ -n "$vlan_tagged_interface" ] && \
  21302. append bss_conf "vlan_tagged_interface=$vlan_tagged_interface" "$N"
  21303. + [ -n "$vlan_file" ] && {
  21304. + [ -e "$vlan_file" ] || touch "$vlan_file"
  21305. + append bss_conf "vlan_file=$vlan_file" "$N"
  21306. + }
  21307. }
  21308. +
  21309. + [ "$eapol_version" -ge "1" -a "$eapol_version" -le "2" ] && append bss_conf "eapol_version=$eapol_version" "$N"
  21310. ;;
  21311. wep)
  21312. local wep_keyidx=0
  21313. @@ -318,8 +330,8 @@ hostapd_set_bss_options() {
  21314. [ -n "$wps_possible" -a -n "$config_methods" ] && {
  21315. set_default ext_registrar 0
  21316. set_default wps_device_type "6-0050F204-1"
  21317. - set_default wps_device_name "OpenWrt AP"
  21318. - set_default wps_manufacturer "openwrt.org"
  21319. + set_default wps_device_name "Lede AP"
  21320. + set_default wps_manufacturer "www.lede-project.org"
  21321. wps_state=2
  21322. [ -n "$wps_configured" ] && wps_state=1
  21323. @@ -340,8 +352,9 @@ hostapd_set_bss_options() {
  21324. append bss_conf "ssid=$ssid" "$N"
  21325. [ -n "$network_bridge" ] && append bss_conf "bridge=$network_bridge" "$N"
  21326. [ -n "$iapp_interface" ] && {
  21327. - iapp_interface="$(uci_get_state network "$iapp_interface" ifname "$iapp_interface")"
  21328. - [ -n "$iapp_interface" ] && append bss_conf "iapp_interface=$iapp_interface" "$N"
  21329. + local ifname
  21330. + network_get_device ifname "$iapp_interface" || ifname = "$iapp_interface"
  21331. + append bss_conf "iapp_interface=$ifname" "$N"
  21332. }
  21333. if [ "$wpa" -ge "1" ]; then
  21334. @@ -522,9 +535,15 @@ wpa_supplicant_prepare_interface() {
  21335. _w_modestr="mode=1"
  21336. }
  21337. + local country_str=
  21338. + [ -n "$country" ] && {
  21339. + country_str="country=$country"
  21340. + }
  21341. +
  21342. wpa_supplicant_teardown_interface "$ifname"
  21343. cat > "$_config" <<EOF
  21344. $ap_scan
  21345. +$country_str
  21346. EOF
  21347. return 0
  21348. }
  21349. @@ -538,7 +557,9 @@ wpa_supplicant_add_network() {
  21350. json_get_vars \
  21351. ssid bssid key \
  21352. basic_rate mcast_rate \
  21353. - ieee80211w
  21354. + ieee80211w ieee80211r
  21355. +
  21356. + set_default ieee80211r 0
  21357. local key_mgmt='NONE'
  21358. local enc_str=
  21359. @@ -549,6 +570,8 @@ wpa_supplicant_add_network() {
  21360. local scan_ssid="scan_ssid=1"
  21361. local freq
  21362. + [ "$ieee80211r" -gt 0 ] && wpa_key_mgmt="FT-PSK $wpa_key_mgmt"
  21363. +
  21364. [[ "$_w_mode" = "adhoc" ]] && {
  21365. append network_data "mode=1" "$N$T"
  21366. [ -n "$channel" ] && {
  21367. @@ -563,6 +586,9 @@ wpa_supplicant_add_network() {
  21368. }
  21369. [[ "$_w_mode" = "mesh" ]] && {
  21370. + json_get_vars mesh_id
  21371. + ssid="${mesh_id}"
  21372. +
  21373. append network_data "mode=5" "$N$T"
  21374. [ -n "$channel" ] && {
  21375. freq="$(get_freq "$phy" "$channel")"
  21376. @@ -594,10 +620,12 @@ wpa_supplicant_add_network() {
  21377. ;;
  21378. eap)
  21379. key_mgmt='WPA-EAP'
  21380. + [ "$ieee80211r" -gt 0 ] && key_mgmt="FT-EAP $key_mgmt"
  21381. - json_get_vars eap_type identity ca_cert
  21382. + json_get_vars eap_type identity anonymous_identity ca_cert
  21383. [ -n "$ca_cert" ] && append network_data "ca_cert=\"$ca_cert\"" "$N$T"
  21384. [ -n "$identity" ] && append network_data "identity=\"$identity\"" "$N$T"
  21385. + [ -n "$anonymous_identity" ] && append network_data "anonymous_identity=\"$anonymous_identity\"" "$N$T"
  21386. case "$eap_type" in
  21387. tls)
  21388. json_get_vars client_cert priv_key priv_key_pwd
  21389. @@ -605,11 +633,32 @@ wpa_supplicant_add_network() {
  21390. append network_data "private_key=\"$priv_key\"" "$N$T"
  21391. append network_data "private_key_passwd=\"$priv_key_pwd\"" "$N$T"
  21392. ;;
  21393. - peap|ttls)
  21394. - json_get_vars auth password
  21395. + fast|peap|ttls)
  21396. + json_get_vars auth password ca_cert2 client_cert2 priv_key2 priv_key2_pwd
  21397. set_default auth MSCHAPV2
  21398. - append network_data "phase2=\"$auth\"" "$N$T"
  21399. - append network_data "password=\"$password\"" "$N$T"
  21400. +
  21401. + if [ "$auth" = "EAP-TLS" ]; then
  21402. + [ -n "$ca_cert2" ] &&
  21403. + append network_data "ca_cert2=\"$ca_cert2\"" "$N$T"
  21404. + append network_data "client_cert2=\"$client_cert2\"" "$N$T"
  21405. + append network_data "private_key2=\"$priv_key2\"" "$N$T"
  21406. + append network_data "private_key2_passwd=\"$priv_key2_pwd\"" "$N$T"
  21407. + else
  21408. + append network_data "password=\"$password\"" "$N$T"
  21409. + fi
  21410. +
  21411. + phase2proto="auth="
  21412. + case "$auth" in
  21413. + "auth"*)
  21414. + phase2proto=""
  21415. + ;;
  21416. + "EAP-"*)
  21417. + auth="$(echo $auth | cut -b 5- )"
  21418. + [ "$eap_type" = "ttls" ] &&
  21419. + phase2proto="autheap="
  21420. + ;;
  21421. + esac
  21422. + append network_data "phase2=\"$phase2proto$auth\"" "$N$T"
  21423. ;;
  21424. esac
  21425. append network_data "eap=$(echo $eap_type | tr 'a-z' 'A-Z')" "$N$T"
  21426. diff --git a/package/network/services/hostapd/files/wpa_supplicant-full.config b/package/network/services/hostapd/files/wpa_supplicant-full.config
  21427. index a9d04ab..18c3f9a 100644
  21428. --- a/package/network/services/hostapd/files/wpa_supplicant-full.config
  21429. +++ b/package/network/services/hostapd/files/wpa_supplicant-full.config
  21430. @@ -41,7 +41,7 @@
  21431. # Driver interface for Host AP driver
  21432. -CONFIG_DRIVER_HOSTAP=y
  21433. +#CONFIG_DRIVER_HOSTAP=y
  21434. # Driver interface for Agere driver
  21435. #CONFIG_DRIVER_HERMES=y
  21436. @@ -121,6 +121,9 @@ CONFIG_DRIVER_WIRED=y
  21437. # included)
  21438. CONFIG_IEEE8021X_EAPOL=y
  21439. +# EAP-FAST
  21440. +CONFIG_EAP_FAST=y
  21441. +
  21442. # EAP-MD5
  21443. CONFIG_EAP_MD5=y
  21444. @@ -367,7 +370,7 @@ CONFIG_INTERNAL_LIBTOMMATH_FAST=y
  21445. #CONFIG_DYNAMIC_EAP_METHODS=y
  21446. # IEEE Std 802.11r-2008 (Fast BSS Transition)
  21447. -#CONFIG_IEEE80211R=y
  21448. +CONFIG_IEEE80211R=y
  21449. # Add support for writing debug log to a file (/tmp/wpa_supplicant-log-#.txt)
  21450. #CONFIG_DEBUG_FILE=y
  21451. diff --git a/package/network/services/hostapd/files/wpa_supplicant-mesh.config b/package/network/services/hostapd/files/wpa_supplicant-mesh.config
  21452. deleted file mode 100644
  21453. index 36e2908..0000000
  21454. --- a/package/network/services/hostapd/files/wpa_supplicant-mesh.config
  21455. +++ /dev/null
  21456. @@ -1,407 +0,0 @@
  21457. -# Example wpa_supplicant build time configuration
  21458. -#
  21459. -# This file lists the configuration options that are used when building the
  21460. -# hostapd binary. All lines starting with # are ignored. Configuration option
  21461. -# lines must be commented out complete, if they are not to be included, i.e.,
  21462. -# just setting VARIABLE=n is not disabling that variable.
  21463. -#
  21464. -# This file is included in Makefile, so variables like CFLAGS and LIBS can also
  21465. -# be modified from here. In most cases, these lines should use += in order not
  21466. -# to override previous values of the variables.
  21467. -
  21468. -
  21469. -# Uncomment following two lines and fix the paths if you have installed OpenSSL
  21470. -# or GnuTLS in non-default location
  21471. -#CFLAGS += -I/usr/local/openssl/include
  21472. -#LIBS += -L/usr/local/openssl/lib
  21473. -
  21474. -# Some Red Hat versions seem to include kerberos header files from OpenSSL, but
  21475. -# the kerberos files are not in the default include path. Following line can be
  21476. -# used to fix build issues on such systems (krb5.h not found).
  21477. -#CFLAGS += -I/usr/include/kerberos
  21478. -
  21479. -# Example configuration for various cross-compilation platforms
  21480. -
  21481. -#### sveasoft (e.g., for Linksys WRT54G) ######################################
  21482. -#CC=mipsel-uclibc-gcc
  21483. -#CC=/opt/brcm/hndtools-mipsel-uclibc/bin/mipsel-uclibc-gcc
  21484. -#CFLAGS += -Os
  21485. -#CPPFLAGS += -I../src/include -I../../src/router/openssl/include
  21486. -#LIBS += -L/opt/brcm/hndtools-mipsel-uclibc-0.9.19/lib -lssl
  21487. -###############################################################################
  21488. -
  21489. -#### openwrt (e.g., for Linksys WRT54G) #######################################
  21490. -#CC=mipsel-uclibc-gcc
  21491. -#CC=/opt/brcm/hndtools-mipsel-uclibc/bin/mipsel-uclibc-gcc
  21492. -#CFLAGS += -Os
  21493. -#CPPFLAGS=-I../src/include -I../openssl-0.9.7d/include \
  21494. -# -I../WRT54GS/release/src/include
  21495. -#LIBS = -lssl
  21496. -###############################################################################
  21497. -
  21498. -
  21499. -# Driver interface for Host AP driver
  21500. -CONFIG_DRIVER_HOSTAP=y
  21501. -
  21502. -# Driver interface for Agere driver
  21503. -#CONFIG_DRIVER_HERMES=y
  21504. -# Change include directories to match with the local setup
  21505. -#CFLAGS += -I../../hcf -I../../include -I../../include/hcf
  21506. -#CFLAGS += -I../../include/wireless
  21507. -
  21508. -# Driver interface for ndiswrapper
  21509. -# Deprecated; use CONFIG_DRIVER_WEXT=y instead.
  21510. -#CONFIG_DRIVER_NDISWRAPPER=y
  21511. -
  21512. -# Driver interface for Atmel driver
  21513. -# CONFIG_DRIVER_ATMEL=y
  21514. -
  21515. -# Driver interface for old Broadcom driver
  21516. -# Please note that the newer Broadcom driver ("hybrid Linux driver") supports
  21517. -# Linux wireless extensions and does not need (or even work) with the old
  21518. -# driver wrapper. Use CONFIG_DRIVER_WEXT=y with that driver.
  21519. -#CONFIG_DRIVER_BROADCOM=y
  21520. -# Example path for wlioctl.h; change to match your configuration
  21521. -#CFLAGS += -I/opt/WRT54GS/release/src/include
  21522. -
  21523. -# Driver interface for Intel ipw2100/2200 driver
  21524. -# Deprecated; use CONFIG_DRIVER_WEXT=y instead.
  21525. -#CONFIG_DRIVER_IPW=y
  21526. -
  21527. -# Driver interface for Ralink driver
  21528. -#CONFIG_DRIVER_RALINK=y
  21529. -
  21530. -# Driver interface for generic Linux wireless extensions
  21531. -CONFIG_DRIVER_WEXT=y
  21532. -
  21533. -# Driver interface for Linux drivers using the nl80211 kernel interface
  21534. -CONFIG_DRIVER_NL80211=y
  21535. -
  21536. -# Driver interface for FreeBSD net80211 layer (e.g., Atheros driver)
  21537. -#CONFIG_DRIVER_BSD=y
  21538. -#CFLAGS += -I/usr/local/include
  21539. -#LIBS += -L/usr/local/lib
  21540. -#LIBS_p += -L/usr/local/lib
  21541. -#LIBS_c += -L/usr/local/lib
  21542. -
  21543. -# Driver interface for Windows NDIS
  21544. -#CONFIG_DRIVER_NDIS=y
  21545. -#CFLAGS += -I/usr/include/w32api/ddk
  21546. -#LIBS += -L/usr/local/lib
  21547. -# For native build using mingw
  21548. -#CONFIG_NATIVE_WINDOWS=y
  21549. -# Additional directories for cross-compilation on Linux host for mingw target
  21550. -#CFLAGS += -I/opt/mingw/mingw32/include/ddk
  21551. -#LIBS += -L/opt/mingw/mingw32/lib
  21552. -#CC=mingw32-gcc
  21553. -# By default, driver_ndis uses WinPcap for low-level operations. This can be
  21554. -# replaced with the following option which replaces WinPcap calls with NDISUIO.
  21555. -# However, this requires that WZC is disabled (net stop wzcsvc) before starting
  21556. -# wpa_supplicant.
  21557. -# CONFIG_USE_NDISUIO=y
  21558. -
  21559. -# Driver interface for development testing
  21560. -#CONFIG_DRIVER_TEST=y
  21561. -
  21562. -# Include client MLME (management frame processing) for test driver
  21563. -# This can be used to test MLME operations in hostapd with the test interface.
  21564. -# space.
  21565. -#CONFIG_CLIENT_MLME=y
  21566. -
  21567. -# Driver interface for wired Ethernet drivers
  21568. -CONFIG_DRIVER_WIRED=y
  21569. -
  21570. -# Driver interface for the Broadcom RoboSwitch family
  21571. -#CONFIG_DRIVER_ROBOSWITCH=y
  21572. -
  21573. -# Driver interface for no driver (e.g., WPS ER only)
  21574. -#CONFIG_DRIVER_NONE=y
  21575. -
  21576. -# Enable IEEE 802.1X Supplicant (automatically included if any EAP method is
  21577. -# included)
  21578. -CONFIG_IEEE8021X_EAPOL=y
  21579. -
  21580. -# EAP-MD5
  21581. -CONFIG_EAP_MD5=y
  21582. -
  21583. -# EAP-MSCHAPv2
  21584. -CONFIG_EAP_MSCHAPV2=y
  21585. -
  21586. -# EAP-TLS
  21587. -CONFIG_EAP_TLS=y
  21588. -
  21589. -# EAL-PEAP
  21590. -CONFIG_EAP_PEAP=y
  21591. -
  21592. -# EAP-TTLS
  21593. -CONFIG_EAP_TTLS=y
  21594. -
  21595. -# EAP-FAST
  21596. -# Note: Default OpenSSL package does not include support for all the
  21597. -# functionality needed for EAP-FAST. If EAP-FAST is enabled with OpenSSL,
  21598. -# the OpenSSL library must be patched (openssl-0.9.8d-tls-extensions.patch)
  21599. -# to add the needed functions.
  21600. -#CONFIG_EAP_FAST=y
  21601. -
  21602. -# EAP-GTC
  21603. -CONFIG_EAP_GTC=y
  21604. -
  21605. -# EAP-OTP
  21606. -CONFIG_EAP_OTP=y
  21607. -
  21608. -# EAP-SIM (enable CONFIG_PCSC, if EAP-SIM is used)
  21609. -#CONFIG_EAP_SIM=y
  21610. -
  21611. -# EAP-PSK (experimental; this is _not_ needed for WPA-PSK)
  21612. -#CONFIG_EAP_PSK=y
  21613. -
  21614. -# EAP-PAX
  21615. -#CONFIG_EAP_PAX=y
  21616. -
  21617. -# LEAP
  21618. -CONFIG_EAP_LEAP=y
  21619. -
  21620. -# EAP-AKA (enable CONFIG_PCSC, if EAP-AKA is used)
  21621. -#CONFIG_EAP_AKA=y
  21622. -
  21623. -# EAP-AKA' (enable CONFIG_PCSC, if EAP-AKA' is used).
  21624. -# This requires CONFIG_EAP_AKA to be enabled, too.
  21625. -#CONFIG_EAP_AKA_PRIME=y
  21626. -
  21627. -# Enable USIM simulator (Milenage) for EAP-AKA
  21628. -#CONFIG_USIM_SIMULATOR=y
  21629. -
  21630. -# EAP-SAKE
  21631. -#CONFIG_EAP_SAKE=y
  21632. -
  21633. -# EAP-GPSK
  21634. -#CONFIG_EAP_GPSK=y
  21635. -# Include support for optional SHA256 cipher suite in EAP-GPSK
  21636. -#CONFIG_EAP_GPSK_SHA256=y
  21637. -
  21638. -# EAP-TNC and related Trusted Network Connect support (experimental)
  21639. -#CONFIG_EAP_TNC=y
  21640. -
  21641. -# Wi-Fi Protected Setup (WPS)
  21642. -CONFIG_WPS=y
  21643. -
  21644. -# EAP-IKEv2
  21645. -#CONFIG_EAP_IKEV2=y
  21646. -
  21647. -# PKCS#12 (PFX) support (used to read private key and certificate file from
  21648. -# a file that usually has extension .p12 or .pfx)
  21649. -CONFIG_PKCS12=y
  21650. -
  21651. -# Smartcard support (i.e., private key on a smartcard), e.g., with openssl
  21652. -# engine.
  21653. -CONFIG_SMARTCARD=y
  21654. -
  21655. -# PC/SC interface for smartcards (USIM, GSM SIM)
  21656. -# Enable this if EAP-SIM or EAP-AKA is included
  21657. -#CONFIG_PCSC=y
  21658. -
  21659. -# Development testing
  21660. -#CONFIG_EAPOL_TEST=y
  21661. -
  21662. -# Select control interface backend for external programs, e.g, wpa_cli:
  21663. -# unix = UNIX domain sockets (default for Linux/*BSD)
  21664. -# udp = UDP sockets using localhost (127.0.0.1)
  21665. -# named_pipe = Windows Named Pipe (default for Windows)
  21666. -# y = use default (backwards compatibility)
  21667. -# If this option is commented out, control interface is not included in the
  21668. -# build.
  21669. -CONFIG_CTRL_IFACE=y
  21670. -
  21671. -# Include support for GNU Readline and History Libraries in wpa_cli.
  21672. -# When building a wpa_cli binary for distribution, please note that these
  21673. -# libraries are licensed under GPL and as such, BSD license may not apply for
  21674. -# the resulting binary.
  21675. -#CONFIG_READLINE=y
  21676. -
  21677. -# Remove debugging code that is printing out debug message to stdout.
  21678. -# This can be used to reduce the size of the wpa_supplicant considerably
  21679. -# if debugging code is not needed. The size reduction can be around 35%
  21680. -# (e.g., 90 kB).
  21681. -#CONFIG_NO_STDOUT_DEBUG=y
  21682. -
  21683. -# Remove WPA support, e.g., for wired-only IEEE 802.1X supplicant, to save
  21684. -# 35-50 kB in code size.
  21685. -#CONFIG_NO_WPA=y
  21686. -
  21687. -# Remove WPA2 support. This allows WPA to be used, but removes WPA2 code to
  21688. -# save about 1 kB in code size when building only WPA-Personal (no EAP support)
  21689. -# or 6 kB if building for WPA-Enterprise.
  21690. -#CONFIG_NO_WPA2=y
  21691. -
  21692. -# Remove IEEE 802.11i/WPA-Personal ASCII passphrase support
  21693. -# This option can be used to reduce code size by removing support for
  21694. -# converting ASCII passphrases into PSK. If this functionality is removed, the
  21695. -# PSK can only be configured as the 64-octet hexstring (e.g., from
  21696. -# wpa_passphrase). This saves about 0.5 kB in code size.
  21697. -#CONFIG_NO_WPA_PASSPHRASE=y
  21698. -
  21699. -# Disable scan result processing (ap_mode=1) to save code size by about 1 kB.
  21700. -# This can be used if ap_scan=1 mode is never enabled.
  21701. -#CONFIG_NO_SCAN_PROCESSING=y
  21702. -
  21703. -# Select configuration backend:
  21704. -# file = text file (e.g., wpa_supplicant.conf; note: the configuration file
  21705. -# path is given on command line, not here; this option is just used to
  21706. -# select the backend that allows configuration files to be used)
  21707. -# winreg = Windows registry (see win_example.reg for an example)
  21708. -CONFIG_BACKEND=file
  21709. -
  21710. -# Remove configuration write functionality (i.e., to allow the configuration
  21711. -# file to be updated based on runtime configuration changes). The runtime
  21712. -# configuration can still be changed, the changes are just not going to be
  21713. -# persistent over restarts. This option can be used to reduce code size by
  21714. -# about 3.5 kB.
  21715. -#CONFIG_NO_CONFIG_WRITE=y
  21716. -
  21717. -# Remove support for configuration blobs to reduce code size by about 1.5 kB.
  21718. -#CONFIG_NO_CONFIG_BLOBS=y
  21719. -
  21720. -# Select program entry point implementation:
  21721. -# main = UNIX/POSIX like main() function (default)
  21722. -# main_winsvc = Windows service (read parameters from registry)
  21723. -# main_none = Very basic example (development use only)
  21724. -#CONFIG_MAIN=main
  21725. -
  21726. -# Select wrapper for operatins system and C library specific functions
  21727. -# unix = UNIX/POSIX like systems (default)
  21728. -# win32 = Windows systems
  21729. -# none = Empty template
  21730. -#CONFIG_OS=unix
  21731. -
  21732. -# Select event loop implementation
  21733. -# eloop = select() loop (default)
  21734. -# eloop_win = Windows events and WaitForMultipleObject() loop
  21735. -# eloop_none = Empty template
  21736. -#CONFIG_ELOOP=eloop
  21737. -
  21738. -# Select layer 2 packet implementation
  21739. -# linux = Linux packet socket (default)
  21740. -# pcap = libpcap/libdnet/WinPcap
  21741. -# freebsd = FreeBSD libpcap
  21742. -# winpcap = WinPcap with receive thread
  21743. -# ndis = Windows NDISUIO (note: requires CONFIG_USE_NDISUIO=y)
  21744. -# none = Empty template
  21745. -#CONFIG_L2_PACKET=linux
  21746. -
  21747. -# PeerKey handshake for Station to Station Link (IEEE 802.11e DLS)
  21748. -CONFIG_PEERKEY=y
  21749. -
  21750. -# IEEE 802.11w (management frame protection)
  21751. -# This version is an experimental implementation based on IEEE 802.11w/D1.0
  21752. -# draft and is subject to change since the standard has not yet been finalized.
  21753. -# Driver support is also needed for IEEE 802.11w.
  21754. -CONFIG_IEEE80211W=y
  21755. -
  21756. -# Select TLS implementation
  21757. -# openssl = OpenSSL (default)
  21758. -# gnutls = GnuTLS (needed for TLS/IA, see also CONFIG_GNUTLS_EXTRA)
  21759. -# internal = Internal TLSv1 implementation (experimental)
  21760. -# none = Empty template
  21761. -CONFIG_TLS=internal
  21762. -
  21763. -# Whether to enable TLS/IA support, which is required for EAP-TTLSv1.
  21764. -# You need CONFIG_TLS=gnutls for this to have any effect. Please note that
  21765. -# even though the core GnuTLS library is released under LGPL, this extra
  21766. -# library uses GPL and as such, the terms of GPL apply to the combination
  21767. -# of wpa_supplicant and GnuTLS if this option is enabled. BSD license may not
  21768. -# apply for distribution of the resulting binary.
  21769. -#CONFIG_GNUTLS_EXTRA=y
  21770. -
  21771. -# If CONFIG_TLS=internal is used, additional library and include paths are
  21772. -# needed for LibTomMath. Alternatively, an integrated, minimal version of
  21773. -# LibTomMath can be used. See beginning of libtommath.c for details on benefits
  21774. -# and drawbacks of this option.
  21775. -CONFIG_INTERNAL_LIBTOMMATH=y
  21776. -#ifndef CONFIG_INTERNAL_LIBTOMMATH
  21777. -#LTM_PATH=/usr/src/libtommath-0.39
  21778. -#CFLAGS += -I$(LTM_PATH)
  21779. -#LIBS += -L$(LTM_PATH)
  21780. -#LIBS_p += -L$(LTM_PATH)
  21781. -#endif
  21782. -# At the cost of about 4 kB of additional binary size, the internal LibTomMath
  21783. -# can be configured to include faster routines for exptmod, sqr, and div to
  21784. -# speed up DH and RSA calculation considerably
  21785. -CONFIG_INTERNAL_LIBTOMMATH_FAST=y
  21786. -
  21787. -# Include NDIS event processing through WMI into wpa_supplicant/wpasvc.
  21788. -# This is only for Windows builds and requires WMI-related header files and
  21789. -# WbemUuid.Lib from Platform SDK even when building with MinGW.
  21790. -#CONFIG_NDIS_EVENTS_INTEGRATED=y
  21791. -#PLATFORMSDKLIB="/opt/Program Files/Microsoft Platform SDK/Lib"
  21792. -
  21793. -# Add support for old DBus control interface
  21794. -# (fi.epitest.hostap.WPASupplicant)
  21795. -#CONFIG_CTRL_IFACE_DBUS=y
  21796. -
  21797. -# Add support for new DBus control interface
  21798. -# (fi.w1.hostap.wpa_supplicant1)
  21799. -#CONFIG_CTRL_IFACE_DBUS_NEW=y
  21800. -
  21801. -# Add introspection support for new DBus control interface
  21802. -#CONFIG_CTRL_IFACE_DBUS_INTRO=y
  21803. -
  21804. -# Add support for loading EAP methods dynamically as shared libraries.
  21805. -# When this option is enabled, each EAP method can be either included
  21806. -# statically (CONFIG_EAP_<method>=y) or dynamically (CONFIG_EAP_<method>=dyn).
  21807. -# Dynamic EAP methods are build as shared objects (eap_*.so) and they need to
  21808. -# be loaded in the beginning of the wpa_supplicant configuration file
  21809. -# (see load_dynamic_eap parameter in the example file) before being used in
  21810. -# the network blocks.
  21811. -#
  21812. -# Note that some shared parts of EAP methods are included in the main program
  21813. -# and in order to be able to use dynamic EAP methods using these parts, the
  21814. -# main program must have been build with the EAP method enabled (=y or =dyn).
  21815. -# This means that EAP-TLS/PEAP/TTLS/FAST cannot be added as dynamic libraries
  21816. -# unless at least one of them was included in the main build to force inclusion
  21817. -# of the shared code. Similarly, at least one of EAP-SIM/AKA must be included
  21818. -# in the main build to be able to load these methods dynamically.
  21819. -#
  21820. -# Please also note that using dynamic libraries will increase the total binary
  21821. -# size. Thus, it may not be the best option for targets that have limited
  21822. -# amount of memory/flash.
  21823. -#CONFIG_DYNAMIC_EAP_METHODS=y
  21824. -
  21825. -# IEEE Std 802.11r-2008 (Fast BSS Transition)
  21826. -#CONFIG_IEEE80211R=y
  21827. -
  21828. -# Add support for writing debug log to a file (/tmp/wpa_supplicant-log-#.txt)
  21829. -#CONFIG_DEBUG_FILE=y
  21830. -
  21831. -# Enable privilege separation (see README 'Privilege separation' for details)
  21832. -#CONFIG_PRIVSEP=y
  21833. -
  21834. -# Enable mitigation against certain attacks against TKIP by delaying Michael
  21835. -# MIC error reports by a random amount of time between 0 and 60 seconds
  21836. -#CONFIG_DELAYED_MIC_ERROR_REPORT=y
  21837. -
  21838. -# Enable tracing code for developer debugging
  21839. -# This tracks use of memory allocations and other registrations and reports
  21840. -# incorrect use with a backtrace of call (or allocation) location.
  21841. -#CONFIG_WPA_TRACE=y
  21842. -# For BSD, comment out these.
  21843. -#LIBS += -lexecinfo
  21844. -#LIBS_p += -lexecinfo
  21845. -#LIBS_c += -lexecinfo
  21846. -
  21847. -# Use libbfd to get more details for developer debugging
  21848. -# This enables use of libbfd to get more detailed symbols for the backtraces
  21849. -# generated by CONFIG_WPA_TRACE=y.
  21850. -#CONFIG_WPA_TRACE_BFD=y
  21851. -# For BSD, comment out these.
  21852. -#LIBS += -lbfd -liberty -lz
  21853. -#LIBS_p += -lbfd -liberty -lz
  21854. -#LIBS_c += -lbfd -liberty -lz
  21855. -
  21856. -CONFIG_NO_RANDOM_POOL=y
  21857. -NEED_80211_COMMON=y
  21858. -
  21859. -CONFIG_IBSS_RSN=y
  21860. -
  21861. -CONFIG_MESH=y
  21862. -CONFIG_SAE=y
  21863. -CONFIG_AP=y
  21864. diff --git a/package/network/services/hostapd/files/wpa_supplicant-mini.config b/package/network/services/hostapd/files/wpa_supplicant-mini.config
  21865. index a8d334d..c272153 100644
  21866. --- a/package/network/services/hostapd/files/wpa_supplicant-mini.config
  21867. +++ b/package/network/services/hostapd/files/wpa_supplicant-mini.config
  21868. @@ -41,7 +41,7 @@
  21869. # Driver interface for Host AP driver
  21870. -CONFIG_DRIVER_HOSTAP=y
  21871. +#CONFIG_DRIVER_HOSTAP=y
  21872. # Driver interface for Agere driver
  21873. #CONFIG_DRIVER_HERMES=y
  21874. diff --git a/package/network/services/hostapd/files/wpa_supplicant-p2p.config b/package/network/services/hostapd/files/wpa_supplicant-p2p.config
  21875. index 1c307d0..563dace 100644
  21876. --- a/package/network/services/hostapd/files/wpa_supplicant-p2p.config
  21877. +++ b/package/network/services/hostapd/files/wpa_supplicant-p2p.config
  21878. @@ -41,7 +41,7 @@
  21879. # Driver interface for Host AP driver
  21880. -CONFIG_DRIVER_HOSTAP=y
  21881. +#CONFIG_DRIVER_HOSTAP=y
  21882. # Driver interface for Agere driver
  21883. #CONFIG_DRIVER_HERMES=y
  21884. diff --git a/package/network/services/hostapd/files/wpa_supplicant.sh b/package/network/services/hostapd/files/wpa_supplicant.sh
  21885. deleted file mode 100644
  21886. index b678484..0000000
  21887. --- a/package/network/services/hostapd/files/wpa_supplicant.sh
  21888. +++ /dev/null
  21889. @@ -1,194 +0,0 @@
  21890. -wpa_supplicant_setup_vif() {
  21891. - local vif="$1"
  21892. - local driver="$2"
  21893. - local key="$key"
  21894. - local options="$3"
  21895. - local freq=""
  21896. - local ht="$5"
  21897. - local ap_scan=""
  21898. - local scan_ssid="1"
  21899. - [ -n "$4" ] && freq="frequency=$4"
  21900. -
  21901. - config_get enc "$vif" encryption
  21902. - config_get key "$vif" key
  21903. -
  21904. - local net_cfg bridge
  21905. - config_get bridge "$vif" bridge
  21906. - [ -z "$bridge" ] && {
  21907. - net_cfg="$(find_net_config "$vif")"
  21908. - [ -z "$net_cfg" ] || bridge="$(bridge_interface "$net_cfg")"
  21909. - config_set "$vif" bridge "$bridge"
  21910. - }
  21911. -
  21912. - local mode ifname wds modestr=""
  21913. - config_get mode "$vif" mode
  21914. - config_get ifname "$vif" ifname
  21915. - config_get_bool wds "$vif" wds 0
  21916. - [ -z "$bridge" ] || [ "$mode" = ap ] || [ "$mode" = sta -a $wds -eq 1 ] || {
  21917. - echo "wpa_supplicant_setup_vif($ifname): Refusing to bridge $mode mode interface"
  21918. - return 1
  21919. - }
  21920. - [ "$mode" = "adhoc" ] && {
  21921. - modestr="mode=1"
  21922. - scan_ssid="0"
  21923. - ap_scan="ap_scan=2"
  21924. - }
  21925. -
  21926. - key_mgmt='NONE'
  21927. - case "$enc" in
  21928. - *none*) ;;
  21929. - *wep*)
  21930. - config_get key "$vif" key
  21931. - key="${key:-1}"
  21932. - case "$key" in
  21933. - [1234])
  21934. - for idx in 1 2 3 4; do
  21935. - local zidx
  21936. - zidx=$(($idx - 1))
  21937. - config_get ckey "$vif" "key${idx}"
  21938. - [ -n "$ckey" ] && \
  21939. - append "wep_key${zidx}" "wep_key${zidx}=$(prepare_key_wep "$ckey")"
  21940. - done
  21941. - wep_tx_keyidx="wep_tx_keyidx=$((key - 1))"
  21942. - ;;
  21943. - *)
  21944. - wep_key0="wep_key0=$(prepare_key_wep "$key")"
  21945. - wep_tx_keyidx="wep_tx_keyidx=0"
  21946. - ;;
  21947. - esac
  21948. - ;;
  21949. - *psk*)
  21950. - key_mgmt='WPA-PSK'
  21951. - # if you want to use PSK with a non-nl80211 driver you
  21952. - # have to use WPA-NONE and wext driver for wpa_s
  21953. - [ "$mode" = "adhoc" -a "$driver" != "nl80211" ] && {
  21954. - key_mgmt='WPA-NONE'
  21955. - driver='wext'
  21956. - }
  21957. - if [ ${#key} -eq 64 ]; then
  21958. - passphrase="psk=${key}"
  21959. - else
  21960. - passphrase="psk=\"${key}\""
  21961. - fi
  21962. - case "$enc" in
  21963. - *psk2*)
  21964. - proto='proto=RSN'
  21965. - config_get ieee80211w "$vif" ieee80211w
  21966. - ;;
  21967. - *psk*)
  21968. - proto='proto=WPA'
  21969. - ;;
  21970. - esac
  21971. - ;;
  21972. - *wpa*|*8021x*)
  21973. - proto='proto=WPA2'
  21974. - key_mgmt='WPA-EAP'
  21975. - config_get ieee80211w "$vif" ieee80211w
  21976. - config_get ca_cert "$vif" ca_cert
  21977. - config_get eap_type "$vif" eap_type
  21978. - ca_cert=${ca_cert:+"ca_cert=\"$ca_cert\""}
  21979. - case "$eap_type" in
  21980. - tls)
  21981. - pairwise='pairwise=CCMP'
  21982. - group='group=CCMP'
  21983. - config_get identity "$vif" identity
  21984. - config_get client_cert "$vif" client_cert
  21985. - config_get priv_key "$vif" priv_key
  21986. - config_get priv_key_pwd "$vif" priv_key_pwd
  21987. - identity="identity=\"$identity\""
  21988. - client_cert="client_cert=\"$client_cert\""
  21989. - priv_key="private_key=\"$priv_key\""
  21990. - priv_key_pwd="private_key_passwd=\"$priv_key_pwd\""
  21991. - ;;
  21992. - peap|ttls)
  21993. - config_get auth "$vif" auth
  21994. - config_get identity "$vif" identity
  21995. - config_get password "$vif" password
  21996. - phase2="phase2=\"auth=${auth:-MSCHAPV2}\""
  21997. - identity="identity=\"$identity\""
  21998. - password="${password:+password=\"$password\"}"
  21999. - ;;
  22000. - esac
  22001. - eap_type="eap=$(echo $eap_type | tr 'a-z' 'A-Z')"
  22002. - ;;
  22003. - esac
  22004. -
  22005. - case "$ieee80211w" in
  22006. - [012])
  22007. - ieee80211w="ieee80211w=$ieee80211w"
  22008. - ;;
  22009. - esac
  22010. -
  22011. - local fixed_freq bssid1 beacon_int brates mrate
  22012. - config_get ifname "$vif" ifname
  22013. - config_get bridge "$vif" bridge
  22014. - config_get ssid "$vif" ssid
  22015. - config_get bssid "$vif" bssid
  22016. - bssid1=${bssid:+"bssid=$bssid"}
  22017. - beacon_int=${beacon_int:+"beacon_int=$beacon_int"}
  22018. -
  22019. - local br brval brsub brstr
  22020. - [ -n "$basic_rate_list" ] && {
  22021. - for br in $basic_rate_list; do
  22022. - brval="$(($br / 1000))"
  22023. - brsub="$((($br / 100) % 10))"
  22024. - [ "$brsub" -gt 0 ] && brval="$brval.$brsub"
  22025. - [ -n "$brstr" ] && brstr="$brstr,"
  22026. - brstr="$brstr$brval"
  22027. - done
  22028. - brates=${basic_rate_list:+"rates=$brstr"}
  22029. - }
  22030. -
  22031. - local mcval=""
  22032. - [ -n "$mcast_rate" ] && {
  22033. - mcval="$(($mcast_rate / 1000))"
  22034. - mcsub="$(( ($mcast_rate / 100) % 10 ))"
  22035. - [ "$mcsub" -gt 0 ] && mcval="$mcval.$mcsub"
  22036. - mrate=${mcast_rate:+"mcast_rate=$mcval"}
  22037. - }
  22038. -
  22039. - local ht_str
  22040. - [ -n "$ht" ] && ht_str="htmode=$ht"
  22041. -
  22042. - rm -rf /var/run/wpa_supplicant-$ifname
  22043. - cat > /var/run/wpa_supplicant-$ifname.conf <<EOF
  22044. -ctrl_interface=/var/run/wpa_supplicant-$ifname
  22045. -$ap_scan
  22046. -network={
  22047. - $modestr
  22048. - scan_ssid=$scan_ssid
  22049. - ssid="$ssid"
  22050. - $bssid1
  22051. - key_mgmt=$key_mgmt
  22052. - $proto
  22053. - $freq
  22054. - ${fixed:+"fixed_freq=1"}
  22055. - $beacon_int
  22056. - $brates
  22057. - $mrate
  22058. - $ht_str
  22059. - $ieee80211w
  22060. - $passphrase
  22061. - $pairwise
  22062. - $group
  22063. - $eap_type
  22064. - $ca_cert
  22065. - $client_cert
  22066. - $priv_key
  22067. - $priv_key_pwd
  22068. - $phase2
  22069. - $identity
  22070. - $password
  22071. - $wep_key0
  22072. - $wep_key1
  22073. - $wep_key2
  22074. - $wep_key3
  22075. - $wep_tx_keyidx
  22076. -}
  22077. -EOF
  22078. - if [ -n "$proto" -o "$key_mgmt" = "NONE" ]; then
  22079. - wpa_supplicant ${bridge:+ -b $bridge} -B -P "/var/run/wifi-${ifname}.pid" -D ${driver:-wext} -i "$ifname" -c /var/run/wpa_supplicant-$ifname.conf $options
  22080. - else
  22081. - return 0
  22082. - fi
  22083. -}
  22084. diff --git a/package/network/services/hostapd/patches/001-4addr-fix-reconnecting-client-on-connection-lost.patch b/package/network/services/hostapd/patches/001-4addr-fix-reconnecting-client-on-connection-lost.patch
  22085. new file mode 100644
  22086. index 0000000..5c8b662
  22087. --- /dev/null
  22088. +++ b/package/network/services/hostapd/patches/001-4addr-fix-reconnecting-client-on-connection-lost.patch
  22089. @@ -0,0 +1,25 @@
  22090. +From: Matthias May <matthias.may@neratec.com>
  22091. +Date: Tue, 5 Jul 2016 15:00:43 +0200
  22092. +Subject: [PATCH] 4addr: fix reconnecting client on connection lost
  22093. +
  22094. +When a 4addr client suddenly looses its connection (no deauth/deassoc)
  22095. +the AP still thinks it is connected.
  22096. +If the client reconnects before the AP timeoutes the client, traffic
  22097. +cannot flow.
  22098. +
  22099. +Fix this by making sure the WLAN_STA_WDS flag is unset in the sta->flags
  22100. +when the client completes association.
  22101. +
  22102. +Signed-off-by: Matthias May <matthias.may@neratec.com>
  22103. +---
  22104. +
  22105. +--- a/src/ap/ieee802_11.c
  22106. ++++ b/src/ap/ieee802_11.c
  22107. +@@ -2826,6 +2826,7 @@ static void handle_assoc_cb(struct hosta
  22108. + new_assoc = 0;
  22109. + sta->flags |= WLAN_STA_ASSOC;
  22110. + sta->flags &= ~WLAN_STA_WNM_SLEEP_MODE;
  22111. ++ sta->flags &= ~WLAN_STA_WDS;
  22112. + if ((!hapd->conf->ieee802_1x && !hapd->conf->wpa && !hapd->conf->osen) ||
  22113. + sta->auth_alg == WLAN_AUTH_FT) {
  22114. + /*
  22115. diff --git a/package/network/services/hostapd/patches/001-P2P-Validate-SSID-element-length-before-copying-it-C.patch b/package/network/services/hostapd/patches/001-P2P-Validate-SSID-element-length-before-copying-it-C.patch
  22116. deleted file mode 100644
  22117. index e408fbe..0000000
  22118. --- a/package/network/services/hostapd/patches/001-P2P-Validate-SSID-element-length-before-copying-it-C.patch
  22119. +++ /dev/null
  22120. @@ -1,37 +0,0 @@
  22121. -From 9ed4eee345f85e3025c33c6e20aa25696e341ccd Mon Sep 17 00:00:00 2001
  22122. -From: Jouni Malinen <jouni@qca.qualcomm.com>
  22123. -Date: Tue, 7 Apr 2015 11:32:11 +0300
  22124. -Subject: [PATCH] P2P: Validate SSID element length before copying it
  22125. - (CVE-2015-1863)
  22126. -
  22127. -This fixes a possible memcpy overflow for P2P dev->oper_ssid in
  22128. -p2p_add_device(). The length provided by the peer device (0..255 bytes)
  22129. -was used without proper bounds checking and that could have resulted in
  22130. -arbitrary data of up to 223 bytes being written beyond the end of the
  22131. -dev->oper_ssid[] array (of which about 150 bytes would be beyond the
  22132. -heap allocation) when processing a corrupted management frame for P2P
  22133. -peer discovery purposes.
  22134. -
  22135. -This could result in corrupted state in heap, unexpected program
  22136. -behavior due to corrupted P2P peer device information, denial of service
  22137. -due to process crash, exposure of memory contents during GO Negotiation,
  22138. -and potentially arbitrary code execution.
  22139. -
  22140. -Thanks to Google security team for reporting this issue and smart
  22141. -hardware research group of Alibaba security team for discovering it.
  22142. -
  22143. -Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
  22144. ----
  22145. - src/p2p/p2p.c | 1 +
  22146. - 1 file changed, 1 insertion(+)
  22147. -
  22148. ---- a/src/p2p/p2p.c
  22149. -+++ b/src/p2p/p2p.c
  22150. -@@ -778,6 +778,7 @@ int p2p_add_device(struct p2p_data *p2p,
  22151. - if (os_memcmp(addr, p2p_dev_addr, ETH_ALEN) != 0)
  22152. - os_memcpy(dev->interface_addr, addr, ETH_ALEN);
  22153. - if (msg.ssid &&
  22154. -+ msg.ssid[1] <= sizeof(dev->oper_ssid) &&
  22155. - (msg.ssid[1] != P2P_WILDCARD_SSID_LEN ||
  22156. - os_memcmp(msg.ssid + 2, P2P_WILDCARD_SSID, P2P_WILDCARD_SSID_LEN)
  22157. - != 0)) {
  22158. diff --git a/package/network/services/hostapd/patches/002-AP-WMM-Fix-integer-underflow-in-WMM-Action-frame-par.patch b/package/network/services/hostapd/patches/002-AP-WMM-Fix-integer-underflow-in-WMM-Action-frame-par.patch
  22159. deleted file mode 100644
  22160. index bc4d60f..0000000
  22161. --- a/package/network/services/hostapd/patches/002-AP-WMM-Fix-integer-underflow-in-WMM-Action-frame-par.patch
  22162. +++ /dev/null
  22163. @@ -1,36 +0,0 @@
  22164. -From ef566a4d4f74022e1fdb0a2addfe81e6de9f4aae Mon Sep 17 00:00:00 2001
  22165. -From: Jouni Malinen <j@w1.fi>
  22166. -Date: Wed, 29 Apr 2015 02:21:53 +0300
  22167. -Subject: [PATCH] AP WMM: Fix integer underflow in WMM Action frame parser
  22168. -
  22169. -The length of the WMM Action frame was not properly validated and the
  22170. -length of the information elements (int left) could end up being
  22171. -negative. This would result in reading significantly past the stack
  22172. -buffer while parsing the IEs in ieee802_11_parse_elems() and while doing
  22173. -so, resulting in segmentation fault.
  22174. -
  22175. -This can result in an invalid frame being used for a denial of service
  22176. -attack (hostapd process killed) against an AP with a driver that uses
  22177. -hostapd for management frame processing (e.g., all mac80211-based
  22178. -drivers).
  22179. -
  22180. -Thanks to Kostya Kortchinsky of Google security team for discovering and
  22181. -reporting this issue.
  22182. -
  22183. -Signed-off-by: Jouni Malinen <j@w1.fi>
  22184. ----
  22185. - src/ap/wmm.c | 3 +++
  22186. - 1 file changed, 3 insertions(+)
  22187. -
  22188. ---- a/src/ap/wmm.c
  22189. -+++ b/src/ap/wmm.c
  22190. -@@ -274,6 +274,9 @@ void hostapd_wmm_action(struct hostapd_d
  22191. - return;
  22192. - }
  22193. -
  22194. -+ if (left < 0)
  22195. -+ return; /* not a valid WMM Action frame */
  22196. -+
  22197. - /* extract the tspec info element */
  22198. - if (ieee802_11_parse_elems(pos, left, &elems, 1) == ParseFailed) {
  22199. - hostapd_logger(hapd, mgmt->sa, HOSTAPD_MODULE_IEEE80211,
  22200. diff --git a/package/network/services/hostapd/patches/002-mesh-Set-correct-secondary-channel-offset-if-HT40-is.patch b/package/network/services/hostapd/patches/002-mesh-Set-correct-secondary-channel-offset-if-HT40-is.patch
  22201. new file mode 100644
  22202. index 0000000..2439220
  22203. --- /dev/null
  22204. +++ b/package/network/services/hostapd/patches/002-mesh-Set-correct-secondary-channel-offset-if-HT40-is.patch
  22205. @@ -0,0 +1,61 @@
  22206. +From: Masashi Honma <masashi.honma@gmail.com>
  22207. +Date: Tue, 26 Jul 2016 11:45:40 +0900
  22208. +Subject: [PATCH] mesh: Set correct secondary channel offset if HT40 is
  22209. + disabled
  22210. +
  22211. +Previously, secondary channel offset could be non zero even though
  22212. +disable_ht40=1. This patch fixes it.
  22213. +
  22214. +Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
  22215. +---
  22216. +
  22217. +--- a/wpa_supplicant/wpa_supplicant.c
  22218. ++++ b/wpa_supplicant/wpa_supplicant.c
  22219. +@@ -1901,20 +1901,27 @@ void ibss_mesh_setup_freq(struct wpa_sup
  22220. + break;
  22221. + }
  22222. + }
  22223. ++#ifdef CONFIG_HT_OVERRIDES
  22224. ++ if (ssid->disable_ht40)
  22225. ++ ht40 = 0;
  22226. ++#endif /* CONFIG_HT_OVERRIDES */
  22227. +
  22228. +- /* Find secondary channel */
  22229. +- for (i = 0; i < mode->num_channels; i++) {
  22230. +- sec_chan = &mode->channels[i];
  22231. +- if (sec_chan->chan == channel + ht40 * 4)
  22232. +- break;
  22233. +- sec_chan = NULL;
  22234. +- }
  22235. +- if (!sec_chan)
  22236. +- return;
  22237. ++ if (ht40) {
  22238. ++ /* Find secondary channel */
  22239. ++ for (i = 0; i < mode->num_channels; i++) {
  22240. ++ sec_chan = &mode->channels[i];
  22241. ++ if (sec_chan->chan == channel + ht40 * 4)
  22242. ++ break;
  22243. ++ sec_chan = NULL;
  22244. ++ }
  22245. ++ if (!sec_chan)
  22246. ++ return;
  22247. +
  22248. +- /* Check secondary channel flags */
  22249. +- if (sec_chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR))
  22250. +- return;
  22251. ++ /* Check secondary channel flags */
  22252. ++ if (sec_chan->flag &
  22253. ++ (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR))
  22254. ++ return;
  22255. ++ }
  22256. +
  22257. + freq->channel = pri_chan->chan;
  22258. +
  22259. +@@ -1930,6 +1937,7 @@ void ibss_mesh_setup_freq(struct wpa_sup
  22260. + freq->sec_channel_offset = 1;
  22261. + break;
  22262. + default:
  22263. ++ freq->sec_channel_offset = 0;
  22264. + break;
  22265. + }
  22266. +
  22267. diff --git a/package/network/services/hostapd/patches/003-WPS-Fix-HTTP-chunked-transfer-encoding-parser.patch b/package/network/services/hostapd/patches/003-WPS-Fix-HTTP-chunked-transfer-encoding-parser.patch
  22268. deleted file mode 100644
  22269. index 36b4ca2..0000000
  22270. --- a/package/network/services/hostapd/patches/003-WPS-Fix-HTTP-chunked-transfer-encoding-parser.patch
  22271. +++ /dev/null
  22272. @@ -1,49 +0,0 @@
  22273. -From 5acd23f4581da58683f3cf5e36cb71bbe4070bd7 Mon Sep 17 00:00:00 2001
  22274. -From: Jouni Malinen <j@w1.fi>
  22275. -Date: Tue, 28 Apr 2015 17:08:33 +0300
  22276. -Subject: [PATCH] WPS: Fix HTTP chunked transfer encoding parser
  22277. -
  22278. -strtoul() return value may end up overflowing the int h->chunk_size and
  22279. -resulting in a negative value to be stored as the chunk_size. This could
  22280. -result in the following memcpy operation using a very large length
  22281. -argument which would result in a buffer overflow and segmentation fault.
  22282. -
  22283. -This could have been used to cause a denial service by any device that
  22284. -has been authorized for network access (either wireless or wired). This
  22285. -would affect both the WPS UPnP functionality in a WPS AP (hostapd with
  22286. -upnp_iface parameter set in the configuration) and WPS ER
  22287. -(wpa_supplicant with WPS_ER_START control interface command used).
  22288. -
  22289. -Validate the parsed chunk length value to avoid this. In addition to
  22290. -rejecting negative values, we can also reject chunk size that would be
  22291. -larger than the maximum configured body length.
  22292. -
  22293. -Thanks to Kostya Kortchinsky of Google security team for discovering and
  22294. -reporting this issue.
  22295. -
  22296. -Signed-off-by: Jouni Malinen <j@w1.fi>
  22297. ----
  22298. - src/wps/httpread.c | 7 +++++++
  22299. - 1 file changed, 7 insertions(+)
  22300. -
  22301. -diff --git a/src/wps/httpread.c b/src/wps/httpread.c
  22302. -index 2f08f37..d2855e3 100644
  22303. ---- a/src/wps/httpread.c
  22304. -+++ b/src/wps/httpread.c
  22305. -@@ -533,6 +533,13 @@ static void httpread_read_handler(int sd, void *eloop_ctx, void *sock_ctx)
  22306. - if (!isxdigit(*cbp))
  22307. - goto bad;
  22308. - h->chunk_size = strtoul(cbp, NULL, 16);
  22309. -+ if (h->chunk_size < 0 ||
  22310. -+ h->chunk_size > h->max_bytes) {
  22311. -+ wpa_printf(MSG_DEBUG,
  22312. -+ "httpread: Invalid chunk size %d",
  22313. -+ h->chunk_size);
  22314. -+ goto bad;
  22315. -+ }
  22316. - /* throw away chunk header
  22317. - * so we have only real data
  22318. - */
  22319. ---
  22320. -1.9.1
  22321. -
  22322. diff --git a/package/network/services/hostapd/patches/004-EAP-pwd-peer-Fix-payload-length-validation-for-Commi.patch b/package/network/services/hostapd/patches/004-EAP-pwd-peer-Fix-payload-length-validation-for-Commi.patch
  22323. deleted file mode 100644
  22324. index 91627fb..0000000
  22325. --- a/package/network/services/hostapd/patches/004-EAP-pwd-peer-Fix-payload-length-validation-for-Commi.patch
  22326. +++ /dev/null
  22327. @@ -1,73 +0,0 @@
  22328. -From dd2f043c9c43d156494e33d7ce22db96e6ef42c7 Mon Sep 17 00:00:00 2001
  22329. -From: Jouni Malinen <j@w1.fi>
  22330. -Date: Fri, 1 May 2015 16:37:45 +0300
  22331. -Subject: [PATCH 1/5] EAP-pwd peer: Fix payload length validation for Commit
  22332. - and Confirm
  22333. -
  22334. -The length of the received Commit and Confirm message payloads was not
  22335. -checked before reading them. This could result in a buffer read
  22336. -overflow when processing an invalid message.
  22337. -
  22338. -Fix this by verifying that the payload is of expected length before
  22339. -processing it. In addition, enforce correct state transition sequence to
  22340. -make sure there is no unexpected behavior if receiving a Commit/Confirm
  22341. -message before the previous exchanges have been completed.
  22342. -
  22343. -Thanks to Kostya Kortchinsky of Google security team for discovering and
  22344. -reporting this issue.
  22345. -
  22346. -Signed-off-by: Jouni Malinen <j@w1.fi>
  22347. ----
  22348. - src/eap_peer/eap_pwd.c | 29 +++++++++++++++++++++++++++++
  22349. - 1 file changed, 29 insertions(+)
  22350. -
  22351. -diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c
  22352. -index f2b0926..a629437 100644
  22353. ---- a/src/eap_peer/eap_pwd.c
  22354. -+++ b/src/eap_peer/eap_pwd.c
  22355. -@@ -355,6 +355,23 @@ eap_pwd_perform_commit_exchange(struct eap_sm *sm, struct eap_pwd_data *data,
  22356. - BIGNUM *mask = NULL, *x = NULL, *y = NULL, *cofactor = NULL;
  22357. - u16 offset;
  22358. - u8 *ptr, *scalar = NULL, *element = NULL;
  22359. -+ size_t prime_len, order_len;
  22360. -+
  22361. -+ if (data->state != PWD_Commit_Req) {
  22362. -+ ret->ignore = TRUE;
  22363. -+ goto fin;
  22364. -+ }
  22365. -+
  22366. -+ prime_len = BN_num_bytes(data->grp->prime);
  22367. -+ order_len = BN_num_bytes(data->grp->order);
  22368. -+
  22369. -+ if (payload_len != 2 * prime_len + order_len) {
  22370. -+ wpa_printf(MSG_INFO,
  22371. -+ "EAP-pwd: Unexpected Commit payload length %u (expected %u)",
  22372. -+ (unsigned int) payload_len,
  22373. -+ (unsigned int) (2 * prime_len + order_len));
  22374. -+ goto fin;
  22375. -+ }
  22376. -
  22377. - if (((data->private_value = BN_new()) == NULL) ||
  22378. - ((data->my_element = EC_POINT_new(data->grp->group)) == NULL) ||
  22379. -@@ -554,6 +571,18 @@ eap_pwd_perform_confirm_exchange(struct eap_sm *sm, struct eap_pwd_data *data,
  22380. - u8 conf[SHA256_MAC_LEN], *cruft = NULL, *ptr;
  22381. - int offset;
  22382. -
  22383. -+ if (data->state != PWD_Confirm_Req) {
  22384. -+ ret->ignore = TRUE;
  22385. -+ goto fin;
  22386. -+ }
  22387. -+
  22388. -+ if (payload_len != SHA256_MAC_LEN) {
  22389. -+ wpa_printf(MSG_INFO,
  22390. -+ "EAP-pwd: Unexpected Confirm payload length %u (expected %u)",
  22391. -+ (unsigned int) payload_len, SHA256_MAC_LEN);
  22392. -+ goto fin;
  22393. -+ }
  22394. -+
  22395. - /*
  22396. - * first build up the ciphersuite which is group | random_function |
  22397. - * prf
  22398. ---
  22399. -1.9.1
  22400. -
  22401. diff --git a/package/network/services/hostapd/patches/005-EAP-pwd-server-Fix-payload-length-validation-for-Com.patch b/package/network/services/hostapd/patches/005-EAP-pwd-server-Fix-payload-length-validation-for-Com.patch
  22402. deleted file mode 100644
  22403. index 5dca20b..0000000
  22404. --- a/package/network/services/hostapd/patches/005-EAP-pwd-server-Fix-payload-length-validation-for-Com.patch
  22405. +++ /dev/null
  22406. @@ -1,66 +0,0 @@
  22407. -From e28a58be26184c2a23f80b410e0997ef1bd5d578 Mon Sep 17 00:00:00 2001
  22408. -From: Jouni Malinen <j@w1.fi>
  22409. -Date: Fri, 1 May 2015 16:40:44 +0300
  22410. -Subject: [PATCH 2/5] EAP-pwd server: Fix payload length validation for Commit
  22411. - and Confirm
  22412. -
  22413. -The length of the received Commit and Confirm message payloads was not
  22414. -checked before reading them. This could result in a buffer read
  22415. -overflow when processing an invalid message.
  22416. -
  22417. -Fix this by verifying that the payload is of expected length before
  22418. -processing it. In addition, enforce correct state transition sequence to
  22419. -make sure there is no unexpected behavior if receiving a Commit/Confirm
  22420. -message before the previous exchanges have been completed.
  22421. -
  22422. -Thanks to Kostya Kortchinsky of Google security team for discovering and
  22423. -reporting this issue.
  22424. -
  22425. -Signed-off-by: Jouni Malinen <j@w1.fi>
  22426. ----
  22427. - src/eap_server/eap_server_pwd.c | 19 +++++++++++++++++++
  22428. - 1 file changed, 19 insertions(+)
  22429. -
  22430. -diff --git a/src/eap_server/eap_server_pwd.c b/src/eap_server/eap_server_pwd.c
  22431. -index 66bd5d2..3189105 100644
  22432. ---- a/src/eap_server/eap_server_pwd.c
  22433. -+++ b/src/eap_server/eap_server_pwd.c
  22434. -@@ -656,9 +656,21 @@ eap_pwd_process_commit_resp(struct eap_sm *sm, struct eap_pwd_data *data,
  22435. - BIGNUM *x = NULL, *y = NULL, *cofactor = NULL;
  22436. - EC_POINT *K = NULL, *point = NULL;
  22437. - int res = 0;
  22438. -+ size_t prime_len, order_len;
  22439. -
  22440. - wpa_printf(MSG_DEBUG, "EAP-pwd: Received commit response");
  22441. -
  22442. -+ prime_len = BN_num_bytes(data->grp->prime);
  22443. -+ order_len = BN_num_bytes(data->grp->order);
  22444. -+
  22445. -+ if (payload_len != 2 * prime_len + order_len) {
  22446. -+ wpa_printf(MSG_INFO,
  22447. -+ "EAP-pwd: Unexpected Commit payload length %u (expected %u)",
  22448. -+ (unsigned int) payload_len,
  22449. -+ (unsigned int) (2 * prime_len + order_len));
  22450. -+ goto fin;
  22451. -+ }
  22452. -+
  22453. - if (((data->peer_scalar = BN_new()) == NULL) ||
  22454. - ((data->k = BN_new()) == NULL) ||
  22455. - ((cofactor = BN_new()) == NULL) ||
  22456. -@@ -774,6 +786,13 @@ eap_pwd_process_confirm_resp(struct eap_sm *sm, struct eap_pwd_data *data,
  22457. - u8 conf[SHA256_MAC_LEN], *cruft = NULL, *ptr;
  22458. - int offset;
  22459. -
  22460. -+ if (payload_len != SHA256_MAC_LEN) {
  22461. -+ wpa_printf(MSG_INFO,
  22462. -+ "EAP-pwd: Unexpected Confirm payload length %u (expected %u)",
  22463. -+ (unsigned int) payload_len, SHA256_MAC_LEN);
  22464. -+ goto fin;
  22465. -+ }
  22466. -+
  22467. - /* build up the ciphersuite: group | random_function | prf */
  22468. - grp = htons(data->group_num);
  22469. - ptr = (u8 *) &cs;
  22470. ---
  22471. -1.9.1
  22472. -
  22473. diff --git a/package/network/services/hostapd/patches/006-EAP-pwd-peer-Fix-Total-Length-parsing-for-fragment-r.patch b/package/network/services/hostapd/patches/006-EAP-pwd-peer-Fix-Total-Length-parsing-for-fragment-r.patch
  22474. deleted file mode 100644
  22475. index 4d2f9d8..0000000
  22476. --- a/package/network/services/hostapd/patches/006-EAP-pwd-peer-Fix-Total-Length-parsing-for-fragment-r.patch
  22477. +++ /dev/null
  22478. @@ -1,52 +0,0 @@
  22479. -From 477c74395acd0123340457ba6f15ab345d42016e Mon Sep 17 00:00:00 2001
  22480. -From: Jouni Malinen <j@w1.fi>
  22481. -Date: Sat, 2 May 2015 19:23:04 +0300
  22482. -Subject: [PATCH 3/5] EAP-pwd peer: Fix Total-Length parsing for fragment
  22483. - reassembly
  22484. -
  22485. -The remaining number of bytes in the message could be smaller than the
  22486. -Total-Length field size, so the length needs to be explicitly checked
  22487. -prior to reading the field and decrementing the len variable. This could
  22488. -have resulted in the remaining length becoming negative and interpreted
  22489. -as a huge positive integer.
  22490. -
  22491. -In addition, check that there is no already started fragment in progress
  22492. -before allocating a new buffer for reassembling fragments. This avoid a
  22493. -potential memory leak when processing invalid message.
  22494. -
  22495. -Signed-off-by: Jouni Malinen <j@w1.fi>
  22496. ----
  22497. - src/eap_peer/eap_pwd.c | 12 ++++++++++++
  22498. - 1 file changed, 12 insertions(+)
  22499. -
  22500. -diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c
  22501. -index a629437..1d2079b 100644
  22502. ---- a/src/eap_peer/eap_pwd.c
  22503. -+++ b/src/eap_peer/eap_pwd.c
  22504. -@@ -866,11 +866,23 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret,
  22505. - * if it's the first fragment there'll be a length field
  22506. - */
  22507. - if (EAP_PWD_GET_LENGTH_BIT(lm_exch)) {
  22508. -+ if (len < 2) {
  22509. -+ wpa_printf(MSG_DEBUG,
  22510. -+ "EAP-pwd: Frame too short to contain Total-Length field");
  22511. -+ ret->ignore = TRUE;
  22512. -+ return NULL;
  22513. -+ }
  22514. - tot_len = WPA_GET_BE16(pos);
  22515. - wpa_printf(MSG_DEBUG, "EAP-pwd: Incoming fragments whose "
  22516. - "total length = %d", tot_len);
  22517. - if (tot_len > 15000)
  22518. - return NULL;
  22519. -+ if (data->inbuf) {
  22520. -+ wpa_printf(MSG_DEBUG,
  22521. -+ "EAP-pwd: Unexpected new fragment start when previous fragment is still in use");
  22522. -+ ret->ignore = TRUE;
  22523. -+ return NULL;
  22524. -+ }
  22525. - data->inbuf = wpabuf_alloc(tot_len);
  22526. - if (data->inbuf == NULL) {
  22527. - wpa_printf(MSG_INFO, "Out of memory to buffer "
  22528. ---
  22529. -1.9.1
  22530. -
  22531. diff --git a/package/network/services/hostapd/patches/007-EAP-pwd-server-Fix-Total-Length-parsing-for-fragment.patch b/package/network/services/hostapd/patches/007-EAP-pwd-server-Fix-Total-Length-parsing-for-fragment.patch
  22532. deleted file mode 100644
  22533. index 7edef09..0000000
  22534. --- a/package/network/services/hostapd/patches/007-EAP-pwd-server-Fix-Total-Length-parsing-for-fragment.patch
  22535. +++ /dev/null
  22536. @@ -1,50 +0,0 @@
  22537. -From 3035cc2894e08319b905bd6561e8bddc8c2db9fa Mon Sep 17 00:00:00 2001
  22538. -From: Jouni Malinen <j@w1.fi>
  22539. -Date: Sat, 2 May 2015 19:26:06 +0300
  22540. -Subject: [PATCH 4/5] EAP-pwd server: Fix Total-Length parsing for fragment
  22541. - reassembly
  22542. -
  22543. -The remaining number of bytes in the message could be smaller than the
  22544. -Total-Length field size, so the length needs to be explicitly checked
  22545. -prior to reading the field and decrementing the len variable. This could
  22546. -have resulted in the remaining length becoming negative and interpreted
  22547. -as a huge positive integer.
  22548. -
  22549. -In addition, check that there is no already started fragment in progress
  22550. -before allocating a new buffer for reassembling fragments. This avoid a
  22551. -potential memory leak when processing invalid message.
  22552. -
  22553. -Signed-off-by: Jouni Malinen <j@w1.fi>
  22554. ----
  22555. - src/eap_server/eap_server_pwd.c | 10 ++++++++++
  22556. - 1 file changed, 10 insertions(+)
  22557. -
  22558. -diff --git a/src/eap_server/eap_server_pwd.c b/src/eap_server/eap_server_pwd.c
  22559. -index 3189105..2bfc3c2 100644
  22560. ---- a/src/eap_server/eap_server_pwd.c
  22561. -+++ b/src/eap_server/eap_server_pwd.c
  22562. -@@ -942,11 +942,21 @@ static void eap_pwd_process(struct eap_sm *sm, void *priv,
  22563. - * the first fragment has a total length
  22564. - */
  22565. - if (EAP_PWD_GET_LENGTH_BIT(lm_exch)) {
  22566. -+ if (len < 2) {
  22567. -+ wpa_printf(MSG_DEBUG,
  22568. -+ "EAP-pwd: Frame too short to contain Total-Length field");
  22569. -+ return;
  22570. -+ }
  22571. - tot_len = WPA_GET_BE16(pos);
  22572. - wpa_printf(MSG_DEBUG, "EAP-pwd: Incoming fragments, total "
  22573. - "length = %d", tot_len);
  22574. - if (tot_len > 15000)
  22575. - return;
  22576. -+ if (data->inbuf) {
  22577. -+ wpa_printf(MSG_DEBUG,
  22578. -+ "EAP-pwd: Unexpected new fragment start when previous fragment is still in use");
  22579. -+ return;
  22580. -+ }
  22581. - data->inbuf = wpabuf_alloc(tot_len);
  22582. - if (data->inbuf == NULL) {
  22583. - wpa_printf(MSG_INFO, "EAP-pwd: Out of memory to "
  22584. ---
  22585. -1.9.1
  22586. -
  22587. diff --git a/package/network/services/hostapd/patches/008-EAP-pwd-peer-Fix-asymmetric-fragmentation-behavior.patch b/package/network/services/hostapd/patches/008-EAP-pwd-peer-Fix-asymmetric-fragmentation-behavior.patch
  22588. deleted file mode 100644
  22589. index a601323..0000000
  22590. --- a/package/network/services/hostapd/patches/008-EAP-pwd-peer-Fix-asymmetric-fragmentation-behavior.patch
  22591. +++ /dev/null
  22592. @@ -1,32 +0,0 @@
  22593. -From 28a069a545b06b99eb55ad53f63f2c99e65a98f6 Mon Sep 17 00:00:00 2001
  22594. -From: Jouni Malinen <j@w1.fi>
  22595. -Date: Sat, 2 May 2015 19:26:28 +0300
  22596. -Subject: [PATCH 5/5] EAP-pwd peer: Fix asymmetric fragmentation behavior
  22597. -
  22598. -The L (Length) and M (More) flags needs to be cleared before deciding
  22599. -whether the locally generated response requires fragmentation. This
  22600. -fixes an issue where these flags from the server could have been invalid
  22601. -for the following message. In some cases, this could have resulted in
  22602. -triggering the wpabuf security check that would terminate the process
  22603. -due to invalid buffer allocation.
  22604. -
  22605. -Signed-off-by: Jouni Malinen <j@w1.fi>
  22606. ----
  22607. - src/eap_peer/eap_pwd.c | 1 +
  22608. - 1 file changed, 1 insertion(+)
  22609. -
  22610. -diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c
  22611. -index 1d2079b..e58b13a 100644
  22612. ---- a/src/eap_peer/eap_pwd.c
  22613. -+++ b/src/eap_peer/eap_pwd.c
  22614. -@@ -968,6 +968,7 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret,
  22615. - /*
  22616. - * we have output! Do we need to fragment it?
  22617. - */
  22618. -+ lm_exch = EAP_PWD_GET_EXCHANGE(lm_exch);
  22619. - len = wpabuf_len(data->outbuf);
  22620. - if ((len + EAP_PWD_HDR_SIZE) > data->mtu) {
  22621. - resp = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_PWD, data->mtu,
  22622. ---
  22623. -1.9.1
  22624. -
  22625. diff --git a/package/network/services/hostapd/patches/009-NFC-Fix-payload-length-validation-in-NDEF-record-par.patch b/package/network/services/hostapd/patches/009-NFC-Fix-payload-length-validation-in-NDEF-record-par.patch
  22626. deleted file mode 100644
  22627. index dd34624..0000000
  22628. --- a/package/network/services/hostapd/patches/009-NFC-Fix-payload-length-validation-in-NDEF-record-par.patch
  22629. +++ /dev/null
  22630. @@ -1,61 +0,0 @@
  22631. -From df9079e72760ceb7ebe7fb11538200c516bdd886 Mon Sep 17 00:00:00 2001
  22632. -From: Jouni Malinen <j@w1.fi>
  22633. -Date: Tue, 7 Jul 2015 21:57:28 +0300
  22634. -Subject: [PATCH] NFC: Fix payload length validation in NDEF record parser
  22635. -
  22636. -It was possible for the 32-bit record->total_length value to end up
  22637. -wrapping around due to integer overflow if the longer form of payload
  22638. -length field is used and record->payload_length gets a value close to
  22639. -2^32. This could result in ndef_parse_record() accepting a too large
  22640. -payload length value and the record type filter reading up to about 20
  22641. -bytes beyond the end of the buffer and potentially killing the process.
  22642. -This could also result in an attempt to allocate close to 2^32 bytes of
  22643. -heap memory and if that were to succeed, a buffer read overflow of the
  22644. -same length which would most likely result in the process termination.
  22645. -In case of record->total_length ending up getting the value 0, there
  22646. -would be no buffer read overflow, but record parsing would result in an
  22647. -infinite loop in ndef_parse_records().
  22648. -
  22649. -Any of these error cases could potentially be used for denial of service
  22650. -attacks over NFC by using a malformed NDEF record on an NFC Tag or
  22651. -sending them during NFC connection handover if the application providing
  22652. -the NDEF message to hostapd/wpa_supplicant did no validation of the
  22653. -received records. While such validation is likely done in the NFC stack
  22654. -that needs to parse the NFC messages before further processing,
  22655. -hostapd/wpa_supplicant better be prepared for any data being included
  22656. -here.
  22657. -
  22658. -Fix this by validating record->payload_length value in a way that
  22659. -detects integer overflow. (CID 122668)
  22660. -
  22661. -Signed-off-by: Jouni Malinen <j@w1.fi>
  22662. ----
  22663. - src/wps/ndef.c | 5 ++++-
  22664. - 1 file changed, 4 insertions(+), 1 deletion(-)
  22665. -
  22666. -diff --git a/src/wps/ndef.c b/src/wps/ndef.c
  22667. -index 5604b0a..50d018f 100644
  22668. ---- a/src/wps/ndef.c
  22669. -+++ b/src/wps/ndef.c
  22670. -@@ -48,6 +48,8 @@ static int ndef_parse_record(const u8 *data, u32 size,
  22671. - if (size < 6)
  22672. - return -1;
  22673. - record->payload_length = ntohl(*(u32 *)pos);
  22674. -+ if (record->payload_length > size - 6)
  22675. -+ return -1;
  22676. - pos += sizeof(u32);
  22677. - }
  22678. -
  22679. -@@ -68,7 +70,8 @@ static int ndef_parse_record(const u8 *data, u32 size,
  22680. - pos += record->payload_length;
  22681. -
  22682. - record->total_length = pos - data;
  22683. -- if (record->total_length > size)
  22684. -+ if (record->total_length > size ||
  22685. -+ record->total_length < record->payload_length)
  22686. - return -1;
  22687. - return 0;
  22688. - }
  22689. ---
  22690. -1.9.1
  22691. -
  22692. diff --git a/package/network/services/hostapd/patches/010-WNM-Ignore-Key-Data-in-WNM-Sleep-Mode-Response-frame.patch b/package/network/services/hostapd/patches/010-WNM-Ignore-Key-Data-in-WNM-Sleep-Mode-Response-frame.patch
  22693. deleted file mode 100644
  22694. index 00e5b7c..0000000
  22695. --- a/package/network/services/hostapd/patches/010-WNM-Ignore-Key-Data-in-WNM-Sleep-Mode-Response-frame.patch
  22696. +++ /dev/null
  22697. @@ -1,32 +0,0 @@
  22698. -From 6b12d93d2c7428a34bfd4b3813ba339ed57b698a Mon Sep 17 00:00:00 2001
  22699. -From: Jouni Malinen <j@w1.fi>
  22700. -Date: Sun, 25 Oct 2015 15:45:50 +0200
  22701. -Subject: [PATCH] WNM: Ignore Key Data in WNM Sleep Mode Response frame if no
  22702. - PMF in use
  22703. -
  22704. -WNM Sleep Mode Response frame is used to update GTK/IGTK only if PMF is
  22705. -enabled. Verify that PMF is in use before using this field on station
  22706. -side to avoid accepting unauthenticated key updates. (CVE-2015-5310)
  22707. -
  22708. -Signed-off-by: Jouni Malinen <j@w1.fi>
  22709. ----
  22710. - wpa_supplicant/wnm_sta.c | 6 ++++++
  22711. - 1 file changed, 6 insertions(+)
  22712. -
  22713. -diff --git a/wpa_supplicant/wnm_sta.c b/wpa_supplicant/wnm_sta.c
  22714. -index 954de67..7d79499 100644
  22715. ---- a/wpa_supplicant/wnm_sta.c
  22716. -+++ b/wpa_supplicant/wnm_sta.c
  22717. -@@ -187,6 +187,12 @@ static void wnm_sleep_mode_exit_success(struct wpa_supplicant *wpa_s,
  22718. - end = ptr + key_len_total;
  22719. - wpa_hexdump_key(MSG_DEBUG, "WNM: Key Data", ptr, key_len_total);
  22720. -
  22721. -+ if (key_len_total && !wpa_sm_pmf_enabled(wpa_s->wpa)) {
  22722. -+ wpa_msg(wpa_s, MSG_INFO,
  22723. -+ "WNM: Ignore Key Data in WNM-Sleep Mode Response - PMF not enabled");
  22724. -+ return;
  22725. -+ }
  22726. -+
  22727. - while (ptr + 1 < end) {
  22728. - if (ptr + 2 + ptr[1] > end) {
  22729. - wpa_printf(MSG_DEBUG, "WNM: Invalid Key Data element "
  22730. diff --git a/package/network/services/hostapd/patches/011-EAP-pwd-peer-Fix-last-fragment-length-validation.patch b/package/network/services/hostapd/patches/011-EAP-pwd-peer-Fix-last-fragment-length-validation.patch
  22731. deleted file mode 100644
  22732. index 82c2639..0000000
  22733. --- a/package/network/services/hostapd/patches/011-EAP-pwd-peer-Fix-last-fragment-length-validation.patch
  22734. +++ /dev/null
  22735. @@ -1,54 +0,0 @@
  22736. -From 8057821706784608b828e769ccefbced95591e50 Mon Sep 17 00:00:00 2001
  22737. -From: Jouni Malinen <j@w1.fi>
  22738. -Date: Sun, 1 Nov 2015 18:18:17 +0200
  22739. -Subject: [PATCH] EAP-pwd peer: Fix last fragment length validation
  22740. -
  22741. -All but the last fragment had their length checked against the remaining
  22742. -room in the reassembly buffer. This allowed a suitably constructed last
  22743. -fragment frame to try to add extra data that would go beyond the buffer.
  22744. -The length validation code in wpabuf_put_data() prevents an actual
  22745. -buffer write overflow from occurring, but this results in process
  22746. -termination. (CVE-2015-5315)
  22747. -
  22748. -Signed-off-by: Jouni Malinen <j@w1.fi>
  22749. ----
  22750. - src/eap_peer/eap_pwd.c | 7 +++----
  22751. - 1 file changed, 3 insertions(+), 4 deletions(-)
  22752. -
  22753. -diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c
  22754. -index 1f78544..75ceef1 100644
  22755. ---- a/src/eap_peer/eap_pwd.c
  22756. -+++ b/src/eap_peer/eap_pwd.c
  22757. -@@ -903,7 +903,7 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret,
  22758. - /*
  22759. - * buffer and ACK the fragment
  22760. - */
  22761. -- if (EAP_PWD_GET_MORE_BIT(lm_exch)) {
  22762. -+ if (EAP_PWD_GET_MORE_BIT(lm_exch) || data->in_frag_pos) {
  22763. - data->in_frag_pos += len;
  22764. - if (data->in_frag_pos > wpabuf_size(data->inbuf)) {
  22765. - wpa_printf(MSG_INFO, "EAP-pwd: Buffer overflow attack "
  22766. -@@ -916,7 +916,8 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret,
  22767. - return NULL;
  22768. - }
  22769. - wpabuf_put_data(data->inbuf, pos, len);
  22770. --
  22771. -+ }
  22772. -+ if (EAP_PWD_GET_MORE_BIT(lm_exch)) {
  22773. - resp = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_PWD,
  22774. - EAP_PWD_HDR_SIZE,
  22775. - EAP_CODE_RESPONSE, eap_get_id(reqData));
  22776. -@@ -930,10 +931,8 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret,
  22777. - * we're buffering and this is the last fragment
  22778. - */
  22779. - if (data->in_frag_pos) {
  22780. -- wpabuf_put_data(data->inbuf, pos, len);
  22781. - wpa_printf(MSG_DEBUG, "EAP-pwd: Last fragment, %d bytes",
  22782. - (int) len);
  22783. -- data->in_frag_pos += len;
  22784. - pos = wpabuf_head_u8(data->inbuf);
  22785. - len = data->in_frag_pos;
  22786. - }
  22787. ---
  22788. -1.9.1
  22789. -
  22790. diff --git a/package/network/services/hostapd/patches/012-EAP-pwd-server-Fix-last-fragment-length-validation.patch b/package/network/services/hostapd/patches/012-EAP-pwd-server-Fix-last-fragment-length-validation.patch
  22791. deleted file mode 100644
  22792. index bfc4c74..0000000
  22793. --- a/package/network/services/hostapd/patches/012-EAP-pwd-server-Fix-last-fragment-length-validation.patch
  22794. +++ /dev/null
  22795. @@ -1,51 +0,0 @@
  22796. -From bef802ece03f9ae9d52a21f0cf4f1bc2c5a1f8aa Mon Sep 17 00:00:00 2001
  22797. -From: Jouni Malinen <j@w1.fi>
  22798. -Date: Sun, 1 Nov 2015 18:24:16 +0200
  22799. -Subject: [PATCH] EAP-pwd server: Fix last fragment length validation
  22800. -
  22801. -All but the last fragment had their length checked against the remaining
  22802. -room in the reassembly buffer. This allowed a suitably constructed last
  22803. -fragment frame to try to add extra data that would go beyond the buffer.
  22804. -The length validation code in wpabuf_put_data() prevents an actual
  22805. -buffer write overflow from occurring, but this results in process
  22806. -termination. (CVE-2015-5314)
  22807. -
  22808. -Signed-off-by: Jouni Malinen <j@w1.fi>
  22809. ----
  22810. - src/eap_server/eap_server_pwd.c | 6 +++---
  22811. - 1 file changed, 3 insertions(+), 3 deletions(-)
  22812. -
  22813. -diff --git a/src/eap_server/eap_server_pwd.c b/src/eap_server/eap_server_pwd.c
  22814. -index cb83ff7..9f787ab 100644
  22815. ---- a/src/eap_server/eap_server_pwd.c
  22816. -+++ b/src/eap_server/eap_server_pwd.c
  22817. -@@ -970,7 +970,7 @@ static void eap_pwd_process(struct eap_sm *sm, void *priv,
  22818. - /*
  22819. - * the first and all intermediate fragments have the M bit set
  22820. - */
  22821. -- if (EAP_PWD_GET_MORE_BIT(lm_exch)) {
  22822. -+ if (EAP_PWD_GET_MORE_BIT(lm_exch) || data->in_frag_pos) {
  22823. - if ((data->in_frag_pos + len) > wpabuf_size(data->inbuf)) {
  22824. - wpa_printf(MSG_DEBUG, "EAP-pwd: Buffer overflow "
  22825. - "attack detected! (%d+%d > %d)",
  22826. -@@ -981,6 +981,8 @@ static void eap_pwd_process(struct eap_sm *sm, void *priv,
  22827. - }
  22828. - wpabuf_put_data(data->inbuf, pos, len);
  22829. - data->in_frag_pos += len;
  22830. -+ }
  22831. -+ if (EAP_PWD_GET_MORE_BIT(lm_exch)) {
  22832. - wpa_printf(MSG_DEBUG, "EAP-pwd: Got a %d byte fragment",
  22833. - (int) len);
  22834. - return;
  22835. -@@ -990,8 +992,6 @@ static void eap_pwd_process(struct eap_sm *sm, void *priv,
  22836. - * buffering fragments so that's how we know it's the last)
  22837. - */
  22838. - if (data->in_frag_pos) {
  22839. -- wpabuf_put_data(data->inbuf, pos, len);
  22840. -- data->in_frag_pos += len;
  22841. - pos = wpabuf_head_u8(data->inbuf);
  22842. - len = data->in_frag_pos;
  22843. - wpa_printf(MSG_DEBUG, "EAP-pwd: Last fragment, %d bytes",
  22844. ---
  22845. -1.9.1
  22846. -
  22847. diff --git a/package/network/services/hostapd/patches/013-EAP-pwd-peer-Fix-error-path-for-unexpected-Confirm-m.patch b/package/network/services/hostapd/patches/013-EAP-pwd-peer-Fix-error-path-for-unexpected-Confirm-m.patch
  22848. deleted file mode 100644
  22849. index 3088f6a..0000000
  22850. --- a/package/network/services/hostapd/patches/013-EAP-pwd-peer-Fix-error-path-for-unexpected-Confirm-m.patch
  22851. +++ /dev/null
  22852. @@ -1,34 +0,0 @@
  22853. -From 95577884ca4fa76be91344ff7a8d5d1e6dc3da61 Mon Sep 17 00:00:00 2001
  22854. -From: Jouni Malinen <j@w1.fi>
  22855. -Date: Sun, 1 Nov 2015 19:35:44 +0200
  22856. -Subject: [PATCH] EAP-pwd peer: Fix error path for unexpected Confirm message
  22857. -
  22858. -If the Confirm message is received from the server before the Identity
  22859. -exchange has been completed, the group has not yet been determined and
  22860. -data->grp is NULL. The error path in eap_pwd_perform_confirm_exchange()
  22861. -did not take this corner case into account and could end up
  22862. -dereferencing a NULL pointer and terminating the process if invalid
  22863. -message sequence is received. (CVE-2015-5316)
  22864. -
  22865. -Signed-off-by: Jouni Malinen <j@w1.fi>
  22866. ----
  22867. - src/eap_peer/eap_pwd.c | 3 ++-
  22868. - 1 file changed, 2 insertions(+), 1 deletion(-)
  22869. -
  22870. -diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c
  22871. -index 75ceef1..892b590 100644
  22872. ---- a/src/eap_peer/eap_pwd.c
  22873. -+++ b/src/eap_peer/eap_pwd.c
  22874. -@@ -774,7 +774,8 @@ eap_pwd_perform_confirm_exchange(struct eap_sm *sm, struct eap_pwd_data *data,
  22875. - wpabuf_put_data(data->outbuf, conf, SHA256_MAC_LEN);
  22876. -
  22877. - fin:
  22878. -- bin_clear_free(cruft, BN_num_bytes(data->grp->prime));
  22879. -+ if (data->grp)
  22880. -+ bin_clear_free(cruft, BN_num_bytes(data->grp->prime));
  22881. - BN_clear_free(x);
  22882. - BN_clear_free(y);
  22883. - if (data->outbuf == NULL) {
  22884. ---
  22885. -1.9.1
  22886. -
  22887. diff --git a/package/network/services/hostapd/patches/014-nl80211-Try-running-without-mgmt-frame-subscription-.patch b/package/network/services/hostapd/patches/014-nl80211-Try-running-without-mgmt-frame-subscription-.patch
  22888. deleted file mode 100644
  22889. index 25ba87d..0000000
  22890. --- a/package/network/services/hostapd/patches/014-nl80211-Try-running-without-mgmt-frame-subscription-.patch
  22891. +++ /dev/null
  22892. @@ -1,48 +0,0 @@
  22893. -From f4830bed661f4adff51f50a0d37c64ceb748e780 Mon Sep 17 00:00:00 2001
  22894. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  22895. -Date: Mon, 25 Apr 2016 17:10:47 +0200
  22896. -Subject: [PATCH] nl80211: Try running without mgmt frame subscription (driver
  22897. - AP SME)
  22898. -MIME-Version: 1.0
  22899. -Content-Type: text/plain; charset=UTF-8
  22900. -Content-Transfer-Encoding: 8bit
  22901. -
  22902. -One of supported code paths already allows this scenario. It is used if
  22903. -driver doesn't report NL80211_ATTR_DEVICE_AP_SME and doesn't support
  22904. -monitor interface. In such situation:
  22905. -1) We don't quit if subscribing for WLAN_FC_STYPE_PROBE_REQ fails
  22906. -2) We don't try subscribing for WLAN_FC_STYPE_ACTION
  22907. -3) We fallback to AP SME mode after failing to create monitor interface
  22908. -4) We don't quit if subscribing for WLAN_FC_STYPE_PROBE_REQ fails
  22909. -Above scenario is used, e.g., with brcmfmac. As you can see - thanks to
  22910. -events provided by cfg80211 - it's not really required to receive Probe
  22911. -Request or action frames.
  22912. -
  22913. -However, the previous implementation did not allow using hostapd with
  22914. -drivers that:
  22915. -1) Report NL80211_ATTR_DEVICE_AP_SME
  22916. -2) Don't support subscribing for PROBE_REQ and/or ACTION frames
  22917. -In case of using such a driver hostapd will cancel setup after failing
  22918. -to subscribe for WLAN_FC_STYPE_ACTION. I noticed it after setting flag
  22919. -WIPHY_FLAG_HAVE_AP_SME in brcmfmac driver for my experiments.
  22920. -
  22921. -This patch allows working with such drivers with just a small warning
  22922. -printed as debug message.
  22923. -
  22924. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  22925. ----
  22926. - src/drivers/driver_nl80211.c | 3 ++-
  22927. - 1 file changed, 2 insertions(+), 1 deletion(-)
  22928. -
  22929. ---- a/src/drivers/driver_nl80211.c
  22930. -+++ b/src/drivers/driver_nl80211.c
  22931. -@@ -4108,7 +4108,8 @@ static int nl80211_setup_ap(struct i802_
  22932. -
  22933. - if (drv->device_ap_sme && !drv->use_monitor)
  22934. - if (nl80211_mgmt_subscribe_ap_dev_sme(bss))
  22935. -- return -1;
  22936. -+ wpa_printf(MSG_DEBUG,
  22937. -+ "nl80211: Failed to subscribe for mgmt frames from SME driver - trying to run without it");
  22938. -
  22939. - if (!drv->device_ap_sme && drv->use_monitor &&
  22940. - nl80211_create_monitor_interface(drv) &&
  22941. diff --git a/package/network/services/hostapd/patches/100-mesh_mode_fix.patch b/package/network/services/hostapd/patches/100-mesh_mode_fix.patch
  22942. new file mode 100644
  22943. index 0000000..ceb4c53
  22944. --- /dev/null
  22945. +++ b/package/network/services/hostapd/patches/100-mesh_mode_fix.patch
  22946. @@ -0,0 +1,12 @@
  22947. +--- a/src/drivers/driver_nl80211.c
  22948. ++++ b/src/drivers/driver_nl80211.c
  22949. +@@ -2332,7 +2332,8 @@ wpa_driver_nl80211_finish_drv_init(struc
  22950. +
  22951. + if (drv->hostapd || bss->static_ap)
  22952. + nlmode = NL80211_IFTYPE_AP;
  22953. +- else if (bss->if_dynamic)
  22954. ++ else if (bss->if_dynamic ||
  22955. ++ nl80211_get_ifmode(bss) == NL80211_IFTYPE_MESH_POINT)
  22956. + nlmode = nl80211_get_ifmode(bss);
  22957. + else
  22958. + nlmode = NL80211_IFTYPE_STATION;
  22959. diff --git a/package/network/services/hostapd/patches/110-bool_fix.patch b/package/network/services/hostapd/patches/110-bool_fix.patch
  22960. deleted file mode 100644
  22961. index 865c014..0000000
  22962. --- a/package/network/services/hostapd/patches/110-bool_fix.patch
  22963. +++ /dev/null
  22964. @@ -1,14 +0,0 @@
  22965. ---- a/src/ap/ieee802_1x.c
  22966. -+++ b/src/ap/ieee802_1x.c
  22967. -@@ -2332,9 +2332,9 @@ void ieee802_1x_notify_pre_auth(struct e
  22968. - }
  22969. -
  22970. -
  22971. --static const char * bool_txt(Boolean bool)
  22972. -+static const char * bool_txt(Boolean bool_val)
  22973. - {
  22974. -- return bool ? "TRUE" : "FALSE";
  22975. -+ return bool_val ? "TRUE" : "FALSE";
  22976. - }
  22977. -
  22978. -
  22979. diff --git a/package/network/services/hostapd/patches/110-fix_parse_das_client.patch b/package/network/services/hostapd/patches/110-fix_parse_das_client.patch
  22980. new file mode 100644
  22981. index 0000000..67fb899
  22982. --- /dev/null
  22983. +++ b/package/network/services/hostapd/patches/110-fix_parse_das_client.patch
  22984. @@ -0,0 +1,10 @@
  22985. +--- a/hostapd/config_file.c
  22986. ++++ b/hostapd/config_file.c
  22987. +@@ -645,6 +645,7 @@ static int hostapd_parse_das_client(stru
  22988. + if (secret == NULL)
  22989. + return -1;
  22990. +
  22991. ++ *secret = 0;
  22992. + secret++;
  22993. +
  22994. + if (hostapd_parse_ip_addr(val, &bss->radius_das_client_addr))
  22995. diff --git a/package/network/services/hostapd/patches/120-daemonize_fix.patch b/package/network/services/hostapd/patches/120-daemonize_fix.patch
  22996. index 032e207..0389406 100644
  22997. --- a/package/network/services/hostapd/patches/120-daemonize_fix.patch
  22998. +++ b/package/network/services/hostapd/patches/120-daemonize_fix.patch
  22999. @@ -8,7 +8,7 @@
  23000. #ifdef ANDROID
  23001. #include <sys/capability.h>
  23002. -@@ -155,59 +156,46 @@ int os_gmtime(os_time_t t, struct os_tm
  23003. +@@ -179,59 +180,46 @@ int os_gmtime(os_time_t t, struct os_tm
  23004. return 0;
  23005. }
  23006. @@ -60,13 +60,13 @@
  23007. + if (chdir("/") < 0)
  23008. return -1;
  23009. - }
  23010. --
  23011. +
  23012. - return 0;
  23013. -}
  23014. -#else /* __APPLE__ */
  23015. -#define os_daemon daemon
  23016. -#endif /* __APPLE__ */
  23017. -
  23018. +-
  23019. -
  23020. -int os_daemonize(const char *pid_file)
  23021. -{
  23022. diff --git a/package/network/services/hostapd/patches/130-no_eapol_fix.patch b/package/network/services/hostapd/patches/130-no_eapol_fix.patch
  23023. index d23b47b..5aee3d0 100644
  23024. --- a/package/network/services/hostapd/patches/130-no_eapol_fix.patch
  23025. +++ b/package/network/services/hostapd/patches/130-no_eapol_fix.patch
  23026. @@ -1,6 +1,6 @@
  23027. --- a/wpa_supplicant/wpa_supplicant.c
  23028. +++ b/wpa_supplicant/wpa_supplicant.c
  23029. -@@ -252,9 +252,10 @@ void wpa_supplicant_cancel_auth_timeout(
  23030. +@@ -257,9 +257,10 @@ void wpa_supplicant_cancel_auth_timeout(
  23031. */
  23032. void wpa_supplicant_initiate_eapol(struct wpa_supplicant *wpa_s)
  23033. {
  23034. diff --git a/package/network/services/hostapd/patches/140-disable_bridge_packet_workaround.patch b/package/network/services/hostapd/patches/140-disable_bridge_packet_workaround.patch
  23035. index 6337d8d..fdd5da9 100644
  23036. --- a/package/network/services/hostapd/patches/140-disable_bridge_packet_workaround.patch
  23037. +++ b/package/network/services/hostapd/patches/140-disable_bridge_packet_workaround.patch
  23038. @@ -1,6 +1,6 @@
  23039. --- a/src/l2_packet/l2_packet_linux.c
  23040. +++ b/src/l2_packet/l2_packet_linux.c
  23041. -@@ -307,8 +307,7 @@ struct l2_packet_data * l2_packet_init_b
  23042. +@@ -337,8 +337,7 @@ struct l2_packet_data * l2_packet_init_b
  23043. l2 = l2_packet_init(br_ifname, own_addr, protocol, rx_callback,
  23044. rx_callback_ctx, l2_hdr);
  23045. @@ -8,5 +8,5 @@
  23046. - return NULL;
  23047. + return l2;
  23048. + #ifndef CONFIG_NO_LINUX_PACKET_SOCKET_WAR
  23049. /*
  23050. - * The Linux packet socket behavior has changed over the years and there
  23051. diff --git a/package/network/services/hostapd/patches/150-nl80211-Report-disassociated-STA-lost-peer-for-the-c.patch b/package/network/services/hostapd/patches/150-nl80211-Report-disassociated-STA-lost-peer-for-the-c.patch
  23052. deleted file mode 100644
  23053. index 66c682f..0000000
  23054. --- a/package/network/services/hostapd/patches/150-nl80211-Report-disassociated-STA-lost-peer-for-the-c.patch
  23055. +++ /dev/null
  23056. @@ -1,67 +0,0 @@
  23057. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  23058. -Date: Mon, 11 Jan 2016 19:18:06 +0100
  23059. -Subject: [PATCH] nl80211: Report disassociated STA / lost peer for the correct
  23060. - BSS
  23061. -MIME-Version: 1.0
  23062. -Content-Type: text/plain; charset=UTF-8
  23063. -Content-Transfer-Encoding: 8bit
  23064. -
  23065. -We shouldn't use drv->ctx as it always points to the first BSS. When
  23066. -using FullMAC driver with multi-BSS support it resulted in incorrect
  23067. -treating nl80211 events. I noticed with with brcmfmac and BCM43602.
  23068. -
  23069. -Before my change I was getting "disassociated" on a wrong interface:
  23070. -wlan0-1: STA 78:d6:f0:00:11:22 IEEE 802.11: associated
  23071. -wlan0-1: STA 78:d6:f0:00:11:22 WPA: pairwise key handshake completed (RSN)
  23072. -wlan0: STA 78:d6:f0:00:11:22 IEEE 802.11: disassociated
  23073. -
  23074. -With this patch it works as expected:
  23075. -wlan0-1: STA 78:d6:f0:00:11:22 IEEE 802.11: associated
  23076. -wlan0-1: STA 78:d6:f0:00:11:22 WPA: pairwise key handshake completed (RSN)
  23077. -wlan0-1: STA 78:d6:f0:00:11:22 IEEE 802.11: disassociated
  23078. -
  23079. -This doesn't apply to hostapd dealing with SoftMAC drivers when handling
  23080. -AP SME & MLME is done it hostapd not the firmware.
  23081. -
  23082. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  23083. ----
  23084. - src/drivers/driver_nl80211_event.c | 7 ++++---
  23085. - 1 file changed, 4 insertions(+), 3 deletions(-)
  23086. -
  23087. ---- a/src/drivers/driver_nl80211_event.c
  23088. -+++ b/src/drivers/driver_nl80211_event.c
  23089. -@@ -1154,6 +1154,7 @@ static void nl80211_new_station_event(st
  23090. -
  23091. -
  23092. - static void nl80211_del_station_event(struct wpa_driver_nl80211_data *drv,
  23093. -+ struct i802_bss *bss,
  23094. - struct nlattr **tb)
  23095. - {
  23096. - u8 *addr;
  23097. -@@ -1166,7 +1167,7 @@ static void nl80211_del_station_event(st
  23098. - MAC2STR(addr));
  23099. -
  23100. - if (is_ap_interface(drv->nlmode) && drv->device_ap_sme) {
  23101. -- drv_event_disassoc(drv->ctx, addr);
  23102. -+ drv_event_disassoc(bss->ctx, addr);
  23103. - return;
  23104. - }
  23105. -
  23106. -@@ -1175,7 +1176,7 @@ static void nl80211_del_station_event(st
  23107. -
  23108. - os_memset(&data, 0, sizeof(data));
  23109. - os_memcpy(data.ibss_peer_lost.peer, addr, ETH_ALEN);
  23110. -- wpa_supplicant_event(drv->ctx, EVENT_IBSS_PEER_LOST, &data);
  23111. -+ wpa_supplicant_event(bss->ctx, EVENT_IBSS_PEER_LOST, &data);
  23112. - }
  23113. -
  23114. -
  23115. -@@ -1939,7 +1940,7 @@ static void do_process_drv_event(struct
  23116. - nl80211_new_station_event(drv, bss, tb);
  23117. - break;
  23118. - case NL80211_CMD_DEL_STATION:
  23119. -- nl80211_del_station_event(drv, tb);
  23120. -+ nl80211_del_station_event(drv, bss, tb);
  23121. - break;
  23122. - case NL80211_CMD_SET_REKEY_OFFLOAD:
  23123. - nl80211_rekey_offload_event(drv, tb);
  23124. diff --git a/package/network/services/hostapd/patches/200-multicall.patch b/package/network/services/hostapd/patches/200-multicall.patch
  23125. index de4a3a8..40bd733 100644
  23126. --- a/package/network/services/hostapd/patches/200-multicall.patch
  23127. +++ b/package/network/services/hostapd/patches/200-multicall.patch
  23128. @@ -1,15 +1,25 @@
  23129. --- a/hostapd/Makefile
  23130. +++ b/hostapd/Makefile
  23131. -@@ -17,6 +17,7 @@ export BINDIR ?= /usr/local/bin/
  23132. - # CFLAGS += -DUSE_KERNEL_HEADERS -I/usr/src/linux/include
  23133. +@@ -28,6 +28,7 @@ CFLAGS += -I$(abspath ../src/utils)
  23134. + export BINDIR ?= /usr/local/bin/
  23135. -include .config
  23136. +-include $(if $(MULTICALL), ../wpa_supplicant/.config)
  23137. - ifdef CONFIG_TESTING_OPTIONS
  23138. - CFLAGS += -DCONFIG_TESTING_OPTIONS
  23139. -@@ -242,10 +243,14 @@ ifdef CONFIG_IEEE80211AC
  23140. - CFLAGS += -DCONFIG_IEEE80211AC
  23141. + ifndef CONFIG_NO_GITVER
  23142. + # Add VERSION_STR postfix for builds from a git repository
  23143. +@@ -190,7 +191,8 @@ endif
  23144. +
  23145. + ifdef CONFIG_NO_VLAN
  23146. + CFLAGS += -DCONFIG_NO_VLAN
  23147. +-else
  23148. ++endif
  23149. ++ifneq ($(findstring CONFIG_NO_VLAN,$(CFLAGS)), CONFIG_NO_VLAN)
  23150. + OBJS += ../src/ap/vlan_init.o
  23151. + OBJS += ../src/ap/vlan_ifconfig.o
  23152. + OBJS += ../src/ap/vlan.o
  23153. +@@ -315,10 +317,14 @@ CFLAGS += -DCONFIG_MBO
  23154. + OBJS += ../src/ap/mbo_ap.o
  23155. endif
  23156. +ifndef MULTICALL
  23157. @@ -26,7 +36,7 @@
  23158. LIBS += $(DRV_AP_LIBS)
  23159. ifdef CONFIG_L2_PACKET
  23160. -@@ -941,6 +946,12 @@ install: $(addprefix $(DESTDIR)$(BINDIR)
  23161. +@@ -1051,6 +1057,12 @@ install: $(addprefix $(DESTDIR)$(BINDIR)
  23162. BCHECK=../src/drivers/build.hostapd
  23163. @@ -39,30 +49,40 @@
  23164. hostapd: $(BCHECK) $(OBJS)
  23165. $(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS)
  23166. @$(E) " LD " $@
  23167. -@@ -980,6 +991,12 @@ HOBJS += ../src/crypto/aes-internal.o
  23168. +@@ -1092,6 +1104,12 @@ HOBJS += ../src/crypto/aes-internal.o
  23169. HOBJS += ../src/crypto/aes-internal-enc.o
  23170. endif
  23171. +dump_cflags:
  23172. -+ @echo -n $(CFLAGS) " "
  23173. ++ @printf "%s " "$(CFLAGS)"
  23174. +
  23175. +dump_ldflags:
  23176. -+ @echo -n $(LDFLAGS) $(LIBS) $(EXTRALIBS) " "
  23177. ++ @printf "%s " "$(LDFLAGS) $(LIBS) $(EXTRALIBS)"
  23178. +
  23179. nt_password_hash: $(NOBJS)
  23180. $(Q)$(CC) $(LDFLAGS) -o nt_password_hash $(NOBJS) $(LIBS_n)
  23181. @$(E) " LD " $@
  23182. --- a/wpa_supplicant/Makefile
  23183. +++ b/wpa_supplicant/Makefile
  23184. -@@ -15,6 +15,7 @@ CFLAGS += -I$(abspath ../src)
  23185. +@@ -27,6 +27,7 @@ CFLAGS += -I$(abspath ../src)
  23186. CFLAGS += -I$(abspath ../src/utils)
  23187. -include .config
  23188. +-include $(if $(MULTICALL),../hostapd/.config)
  23189. - ifdef CONFIG_TESTING_OPTIONS
  23190. - CFLAGS += -DCONFIG_TESTING_OPTIONS
  23191. -@@ -773,6 +774,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS
  23192. + ifndef CONFIG_NO_GITVER
  23193. + # Add VERSION_STR postfix for builds from a git repository
  23194. +@@ -312,7 +313,9 @@ endif
  23195. + ifdef CONFIG_IBSS_RSN
  23196. + NEED_RSN_AUTHENTICATOR=y
  23197. + CFLAGS += -DCONFIG_IBSS_RSN
  23198. ++ifndef MULTICALL
  23199. + CFLAGS += -DCONFIG_NO_VLAN
  23200. ++endif
  23201. + OBJS += ibss_rsn.o
  23202. + endif
  23203. +
  23204. +@@ -803,6 +806,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS
  23205. CFLAGS += -DCONFIG_DYNAMIC_EAP_METHODS
  23206. LIBS += -ldl -rdynamic
  23207. endif
  23208. @@ -73,7 +93,7 @@
  23209. endif
  23210. ifdef CONFIG_MACSEC
  23211. -@@ -793,9 +798,11 @@ NEED_EAP_COMMON=y
  23212. +@@ -823,9 +830,11 @@ NEED_EAP_COMMON=y
  23213. NEED_RSN_AUTHENTICATOR=y
  23214. CFLAGS += -DCONFIG_AP
  23215. OBJS += ap.o
  23216. @@ -85,7 +105,7 @@
  23217. OBJS += ../src/ap/hostapd.o
  23218. OBJS += ../src/ap/wpa_auth_glue.o
  23219. OBJS += ../src/ap/utils.o
  23220. -@@ -858,10 +865,18 @@ endif
  23221. +@@ -898,10 +907,18 @@ endif
  23222. ifdef CONFIG_HS20
  23223. OBJS += ../src/ap/hs20.o
  23224. endif
  23225. @@ -104,7 +124,7 @@
  23226. NEED_AES_WRAP=y
  23227. OBJS += ../src/ap/wpa_auth.o
  23228. OBJS += ../src/ap/wpa_auth_ie.o
  23229. -@@ -1603,6 +1618,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv)
  23230. +@@ -1680,6 +1697,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv)
  23231. $(OBJS_c) $(OBJS_t) $(OBJS_t2) $(OBJS) $(BCHECK) $(EXTRA_progs): .config
  23232. @@ -117,22 +137,22 @@
  23233. wpa_supplicant: $(BCHECK) $(OBJS) $(EXTRA_progs)
  23234. $(Q)$(LDO) $(LDFLAGS) -o wpa_supplicant $(OBJS) $(LIBS) $(EXTRALIBS)
  23235. @$(E) " LD " $@
  23236. -@@ -1694,6 +1715,12 @@ endif
  23237. - $(Q)sed -e 's|\@BINDIR\@|$(BINDIR)|g' $< >$@
  23238. +@@ -1782,6 +1805,12 @@ endif
  23239. + -e 's|\@DBUS_INTERFACE\@|$(DBUS_INTERFACE)|g' $< >$@
  23240. @$(E) " sed" $<
  23241. +dump_cflags:
  23242. -+ @echo -n $(CFLAGS) " "
  23243. ++ @printf "%s " "$(CFLAGS)"
  23244. +
  23245. +dump_ldflags:
  23246. -+ @echo -n $(LDFLAGS) $(LIBS) $(EXTRALIBS) " "
  23247. ++ @printf "%s " "$(LDFLAGS) $(LIBS) $(EXTRALIBS)"
  23248. +
  23249. wpa_supplicant.exe: wpa_supplicant
  23250. mv -f $< $@
  23251. wpa_cli.exe: wpa_cli
  23252. --- a/src/drivers/driver.h
  23253. +++ b/src/drivers/driver.h
  23254. -@@ -4581,8 +4581,8 @@ union wpa_event_data {
  23255. +@@ -4794,8 +4794,8 @@ union wpa_event_data {
  23256. * Driver wrapper code should call this function whenever an event is received
  23257. * from the driver.
  23258. */
  23259. @@ -141,11 +161,20 @@
  23260. +extern void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event,
  23261. + union wpa_event_data *data);
  23262. + /**
  23263. + * wpa_supplicant_event_global - Report a driver event for wpa_supplicant
  23264. +@@ -4807,7 +4807,7 @@ void wpa_supplicant_event(void *ctx, enu
  23265. + * Same as wpa_supplicant_event(), but we search for the interface in
  23266. + * wpa_global.
  23267. + */
  23268. +-void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
  23269. ++extern void (*wpa_supplicant_event_global)(void *ctx, enum wpa_event_type event,
  23270. + union wpa_event_data *data);
  23271. /*
  23272. --- a/src/ap/drv_callbacks.c
  23273. +++ b/src/ap/drv_callbacks.c
  23274. -@@ -1075,8 +1075,8 @@ static void hostapd_event_dfs_cac_starte
  23275. +@@ -1157,8 +1157,8 @@ static void hostapd_event_dfs_cac_starte
  23276. #endif /* NEED_AP_MLME */
  23277. @@ -156,9 +185,18 @@
  23278. {
  23279. struct hostapd_data *hapd = ctx;
  23280. #ifndef CONFIG_NO_STDOUT_DEBUG
  23281. +@@ -1367,7 +1367,7 @@ void wpa_supplicant_event(void *ctx, enu
  23282. + }
  23283. +
  23284. +
  23285. +-void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
  23286. ++void hostapd_wpa_event_global(void *ctx, enum wpa_event_type event,
  23287. + union wpa_event_data *data)
  23288. + {
  23289. + struct hapd_interfaces *interfaces = ctx;
  23290. --- a/wpa_supplicant/wpa_priv.c
  23291. +++ b/wpa_supplicant/wpa_priv.c
  23292. -@@ -819,8 +819,8 @@ static void wpa_priv_send_ft_response(st
  23293. +@@ -940,8 +940,8 @@ static void wpa_priv_send_ft_response(st
  23294. }
  23295. @@ -169,17 +207,27 @@
  23296. {
  23297. struct wpa_priv_interface *iface = ctx;
  23298. -@@ -961,6 +961,7 @@ int main(int argc, char *argv[])
  23299. +@@ -1010,7 +1010,7 @@ void wpa_supplicant_event(void *ctx, enu
  23300. + }
  23301. +
  23302. +
  23303. +-void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
  23304. ++void supplicant_event_global(void *ctx, enum wpa_event_type event,
  23305. + union wpa_event_data *data)
  23306. + {
  23307. + struct wpa_priv_global *global = ctx;
  23308. +@@ -1122,6 +1122,8 @@ int main(int argc, char *argv[])
  23309. if (os_program_init())
  23310. return -1;
  23311. + wpa_supplicant_event = supplicant_event;
  23312. ++ wpa_supplicant_event_global = supplicant_event_global;
  23313. wpa_priv_fd_workaround();
  23314. - for (;;) {
  23315. + os_memset(&global, 0, sizeof(global));
  23316. --- a/wpa_supplicant/events.c
  23317. +++ b/wpa_supplicant/events.c
  23318. -@@ -3138,8 +3138,8 @@ static void wpa_supplicant_event_assoc_a
  23319. +@@ -3384,8 +3384,8 @@ static void wpa_supplicant_event_assoc_a
  23320. }
  23321. @@ -189,88 +237,125 @@
  23322. + union wpa_event_data *data)
  23323. {
  23324. struct wpa_supplicant *wpa_s = ctx;
  23325. + int resched;
  23326. +@@ -4051,7 +4051,7 @@ void wpa_supplicant_event(void *ctx, enu
  23327. + #endif /* CONFIG_AP */
  23328. + break;
  23329. + case EVENT_ACS_CHANNEL_SELECTED:
  23330. +-#ifdef CONFIG_ACS
  23331. ++#if defined(CONFIG_ACS) && defined(CONFIG_AP)
  23332. + if (!wpa_s->ap_iface)
  23333. + break;
  23334. + hostapd_acs_channel_selected(wpa_s->ap_iface->bss[0],
  23335. +@@ -4065,7 +4065,7 @@ void wpa_supplicant_event(void *ctx, enu
  23336. + }
  23337. +
  23338. +-void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
  23339. ++void supplicant_event_global(void *ctx, enum wpa_event_type event,
  23340. + union wpa_event_data *data)
  23341. + {
  23342. + struct wpa_supplicant *wpa_s;
  23343. --- a/wpa_supplicant/wpa_supplicant.c
  23344. +++ b/wpa_supplicant/wpa_supplicant.c
  23345. -@@ -4300,6 +4300,9 @@ static void wpa_supplicant_deinit_iface(
  23346. - os_free(wpa_s);
  23347. +@@ -4990,7 +4990,6 @@ struct wpa_interface * wpa_supplicant_ma
  23348. + return NULL;
  23349. }
  23350. +-
  23351. + /**
  23352. + * wpa_supplicant_match_existing - Match existing interfaces
  23353. + * @global: Pointer to global data from wpa_supplicant_init()
  23354. +@@ -5027,6 +5026,11 @@ static int wpa_supplicant_match_existing
  23355. +
  23356. + #endif /* CONFIG_MATCH_IFACE */
  23357. +
  23358. +extern void supplicant_event(void *ctx, enum wpa_event_type event,
  23359. + union wpa_event_data *data);
  23360. +
  23361. ++extern void supplicant_event_global(void *ctx, enum wpa_event_type event,
  23362. ++ union wpa_event_data *data);
  23363. /**
  23364. * wpa_supplicant_add_iface - Add a new network interface
  23365. -@@ -4526,6 +4529,7 @@ struct wpa_global * wpa_supplicant_init(
  23366. +@@ -5282,6 +5286,8 @@ struct wpa_global * wpa_supplicant_init(
  23367. #ifndef CONFIG_NO_WPA_MSG
  23368. wpa_msg_register_ifname_cb(wpa_supplicant_msg_ifname_cb);
  23369. #endif /* CONFIG_NO_WPA_MSG */
  23370. + wpa_supplicant_event = supplicant_event;
  23371. ++ wpa_supplicant_event_global = supplicant_event_global;
  23372. if (params->wpa_debug_file_path)
  23373. wpa_debug_open_file(params->wpa_debug_file_path);
  23374. --- a/hostapd/main.c
  23375. +++ b/hostapd/main.c
  23376. -@@ -511,6 +511,9 @@ static int hostapd_get_ctrl_iface_group(
  23377. - return 0;
  23378. +@@ -583,6 +583,11 @@ fail:
  23379. + return -1;
  23380. }
  23381. +void hostapd_wpa_event(void *ctx, enum wpa_event_type event,
  23382. + union wpa_event_data *data);
  23383. +
  23384. ++void hostapd_wpa_event_global(void *ctx, enum wpa_event_type event,
  23385. ++ union wpa_event_data *data);
  23386. #ifdef CONFIG_WPS
  23387. static int gen_uuid(const char *txt_addr)
  23388. -@@ -562,6 +565,7 @@ int main(int argc, char *argv[])
  23389. - interfaces.global_iface_name = NULL;
  23390. +@@ -660,6 +665,8 @@ int main(int argc, char *argv[])
  23391. interfaces.global_ctrl_sock = -1;
  23392. + dl_list_init(&interfaces.global_ctrl_dst);
  23393. + wpa_supplicant_event = hostapd_wpa_event;
  23394. ++ wpa_supplicant_event_global = hostapd_wpa_event_global;
  23395. for (;;) {
  23396. - c = getopt(argc, argv, "b:Bde:f:hKP:Ttu:vg:G:");
  23397. + c = getopt(argc, argv, "b:Bde:f:hi:KP:STtu:vg:G:");
  23398. if (c < 0)
  23399. --- a/src/drivers/drivers.c
  23400. +++ b/src/drivers/drivers.c
  23401. -@@ -10,6 +10,9 @@
  23402. +@@ -10,6 +10,11 @@
  23403. #include "utils/common.h"
  23404. #include "driver.h"
  23405. +void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event,
  23406. + union wpa_event_data *data);
  23407. ++void (*wpa_supplicant_event_global)(void *ctx, enum wpa_event_type event,
  23408. ++ union wpa_event_data *data);
  23409. +
  23410. #ifdef CONFIG_DRIVER_WEXT
  23411. extern struct wpa_driver_ops wpa_driver_wext_ops; /* driver_wext.c */
  23412. #endif /* CONFIG_DRIVER_WEXT */
  23413. --- a/wpa_supplicant/eapol_test.c
  23414. +++ b/wpa_supplicant/eapol_test.c
  23415. -@@ -28,8 +28,12 @@
  23416. +@@ -29,7 +29,12 @@
  23417. #include "ctrl_iface.h"
  23418. #include "pcsc_funcs.h"
  23419. #include "wpas_glue.h"
  23420. +#include "drivers/driver.h"
  23421. -
  23422. +void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event,
  23423. + union wpa_event_data *data);
  23424. -+
  23425. - struct wpa_driver_ops *wpa_drivers[] = { NULL };
  23426. ++void (*wpa_supplicant_event_global)(void *ctx, enum wpa_event_type event,
  23427. ++ union wpa_event_data *data);
  23428. + const struct wpa_driver_ops *const wpa_drivers[] = { NULL };
  23429. -@@ -1203,6 +1207,8 @@ static void usage(void)
  23430. +@@ -1295,6 +1300,10 @@ static void usage(void)
  23431. "option several times.\n");
  23432. }
  23433. +extern void supplicant_event(void *ctx, enum wpa_event_type event,
  23434. + union wpa_event_data *data);
  23435. ++extern void supplicant_event_global(void *ctx, enum wpa_event_type event,
  23436. ++ union wpa_event_data *data);
  23437. int main(int argc, char *argv[])
  23438. {
  23439. -@@ -1221,6 +1227,7 @@ int main(int argc, char *argv[])
  23440. +@@ -1315,6 +1324,8 @@ int main(int argc, char *argv[])
  23441. if (os_program_init())
  23442. return -1;
  23443. + wpa_supplicant_event = supplicant_event;
  23444. ++ wpa_supplicant_event_global = supplicant_event_global;
  23445. hostapd_logger_register_cb(hostapd_logger_cb);
  23446. os_memset(&eapol_test, 0, sizeof(eapol_test));
  23447. diff --git a/package/network/services/hostapd/patches/300-noscan.patch b/package/network/services/hostapd/patches/300-noscan.patch
  23448. index 57d8fe2..21d6316 100644
  23449. --- a/package/network/services/hostapd/patches/300-noscan.patch
  23450. +++ b/package/network/services/hostapd/patches/300-noscan.patch
  23451. @@ -1,6 +1,6 @@
  23452. --- a/hostapd/config_file.c
  23453. +++ b/hostapd/config_file.c
  23454. -@@ -2771,6 +2771,10 @@ static int hostapd_config_fill(struct ho
  23455. +@@ -2862,6 +2862,10 @@ static int hostapd_config_fill(struct ho
  23456. }
  23457. #endif /* CONFIG_IEEE80211W */
  23458. #ifdef CONFIG_IEEE80211N
  23459. @@ -13,7 +13,7 @@
  23460. } else if (os_strcmp(buf, "ht_capab") == 0) {
  23461. --- a/src/ap/ap_config.h
  23462. +++ b/src/ap/ap_config.h
  23463. -@@ -619,6 +619,8 @@ struct hostapd_config {
  23464. +@@ -655,6 +655,8 @@ struct hostapd_config {
  23465. int ht_op_mode_fixed;
  23466. u16 ht_capab;
  23467. @@ -21,21 +21,22 @@
  23468. + int no_ht_coex;
  23469. int ieee80211n;
  23470. int secondary_channel;
  23471. - int require_ht;
  23472. + int no_pri_sec_switch;
  23473. --- a/src/ap/hw_features.c
  23474. +++ b/src/ap/hw_features.c
  23475. -@@ -461,7 +461,7 @@ static int ieee80211n_check_40mhz(struct
  23476. - struct wpa_driver_scan_params params;
  23477. +@@ -474,7 +474,8 @@ static int ieee80211n_check_40mhz(struct
  23478. int ret;
  23479. -- if (!iface->conf->secondary_channel)
  23480. -+ if (!iface->conf->secondary_channel || iface->conf->noscan)
  23481. - return 0; /* HT40 not used */
  23482. + /* Check that HT40 is used and PRI / SEC switch is allowed */
  23483. +- if (!iface->conf->secondary_channel || iface->conf->no_pri_sec_switch)
  23484. ++ if (!iface->conf->secondary_channel || iface->conf->no_pri_sec_switch ||
  23485. ++ iface->conf->noscan)
  23486. + return 0;
  23487. hostapd_set_state(iface, HAPD_IFACE_HT_SCAN);
  23488. --- a/src/ap/ieee802_11_ht.c
  23489. +++ b/src/ap/ieee802_11_ht.c
  23490. -@@ -221,6 +221,9 @@ void hostapd_2040_coex_action(struct hos
  23491. +@@ -244,6 +244,9 @@ void hostapd_2040_coex_action(struct hos
  23492. if (!(iface->conf->ht_capab & HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET))
  23493. return;
  23494. @@ -45,7 +46,7 @@
  23495. if (len < IEEE80211_HDRLEN + 2 + sizeof(*bc_ie))
  23496. return;
  23497. -@@ -346,6 +349,9 @@ void ht40_intolerant_add(struct hostapd_
  23498. +@@ -368,6 +371,9 @@ void ht40_intolerant_add(struct hostapd_
  23499. if (iface->current_mode->mode != HOSTAPD_MODE_IEEE80211G)
  23500. return;
  23501. diff --git a/package/network/services/hostapd/patches/310-rescan_immediately.patch b/package/network/services/hostapd/patches/310-rescan_immediately.patch
  23502. index 7be8c32..3f46cc4 100644
  23503. --- a/package/network/services/hostapd/patches/310-rescan_immediately.patch
  23504. +++ b/package/network/services/hostapd/patches/310-rescan_immediately.patch
  23505. @@ -1,6 +1,6 @@
  23506. --- a/wpa_supplicant/wpa_supplicant.c
  23507. +++ b/wpa_supplicant/wpa_supplicant.c
  23508. -@@ -3249,7 +3249,7 @@ wpa_supplicant_alloc(struct wpa_supplica
  23509. +@@ -3556,7 +3556,7 @@ wpa_supplicant_alloc(struct wpa_supplica
  23510. if (wpa_s == NULL)
  23511. return NULL;
  23512. wpa_s->scan_req = INITIAL_SCAN_REQ;
  23513. @@ -8,4 +8,4 @@
  23514. + wpa_s->scan_interval = 1;
  23515. wpa_s->new_connection = 1;
  23516. wpa_s->parent = parent ? parent : wpa_s;
  23517. - wpa_s->sched_scanning = 0;
  23518. + wpa_s->p2pdev = wpa_s->parent;
  23519. diff --git a/package/network/services/hostapd/patches/320-optional_rfkill.patch b/package/network/services/hostapd/patches/320-optional_rfkill.patch
  23520. index 75b4b07..cf2a2c1 100644
  23521. --- a/package/network/services/hostapd/patches/320-optional_rfkill.patch
  23522. +++ b/package/network/services/hostapd/patches/320-optional_rfkill.patch
  23523. @@ -1,14 +1,14 @@
  23524. --- a/src/drivers/drivers.mak
  23525. +++ b/src/drivers/drivers.mak
  23526. -@@ -34,7 +34,6 @@ NEED_SME=y
  23527. +@@ -36,7 +36,6 @@ NEED_SME=y
  23528. NEED_AP_MLME=y
  23529. NEED_NETLINK=y
  23530. NEED_LINUX_IOCTL=y
  23531. -NEED_RFKILL=y
  23532. + NEED_RADIOTAP=y
  23533. ifdef CONFIG_LIBNL32
  23534. - DRV_LIBS += -lnl-3
  23535. -@@ -116,7 +115,6 @@ DRV_WPA_CFLAGS += -DCONFIG_DRIVER_WEXT
  23536. +@@ -123,7 +122,6 @@ DRV_WPA_CFLAGS += -DCONFIG_DRIVER_WEXT
  23537. CONFIG_WIRELESS_EXTENSION=y
  23538. NEED_NETLINK=y
  23539. NEED_LINUX_IOCTL=y
  23540. @@ -16,7 +16,7 @@
  23541. endif
  23542. ifdef CONFIG_DRIVER_NDIS
  23543. -@@ -142,7 +140,6 @@ endif
  23544. +@@ -149,7 +147,6 @@ endif
  23545. ifdef CONFIG_WIRELESS_EXTENSION
  23546. DRV_WPA_CFLAGS += -DCONFIG_WIRELESS_EXTENSION
  23547. DRV_WPA_OBJS += ../src/drivers/driver_wext.o
  23548. @@ -24,14 +24,14 @@
  23549. endif
  23550. ifdef NEED_NETLINK
  23551. -@@ -155,6 +152,7 @@ endif
  23552. +@@ -162,6 +159,7 @@ endif
  23553. ifdef NEED_RFKILL
  23554. DRV_OBJS += ../src/drivers/rfkill.o
  23555. +DRV_WPA_CFLAGS += -DCONFIG_RFKILL
  23556. endif
  23557. - ifdef CONFIG_VLAN_NETLINK
  23558. + ifdef NEED_RADIOTAP
  23559. --- a/src/drivers/rfkill.h
  23560. +++ b/src/drivers/rfkill.h
  23561. @@ -18,8 +18,24 @@ struct rfkill_config {
  23562. diff --git a/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch b/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch
  23563. index dd90877..ca46012 100644
  23564. --- a/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch
  23565. +++ b/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch
  23566. @@ -1,6 +1,6 @@
  23567. --- a/src/drivers/driver_nl80211.c
  23568. +++ b/src/drivers/driver_nl80211.c
  23569. -@@ -3616,7 +3616,7 @@ static int nl80211_set_channel(struct i8
  23570. +@@ -3795,7 +3795,7 @@ static int nl80211_set_channel(struct i8
  23571. freq->freq, freq->ht_enabled, freq->vht_enabled,
  23572. freq->bandwidth, freq->center_freq1, freq->center_freq2);
  23573. diff --git a/package/network/services/hostapd/patches/340-reload_freq_change.patch b/package/network/services/hostapd/patches/340-reload_freq_change.patch
  23574. index 91b6196..086ade9 100644
  23575. --- a/package/network/services/hostapd/patches/340-reload_freq_change.patch
  23576. +++ b/package/network/services/hostapd/patches/340-reload_freq_change.patch
  23577. @@ -1,6 +1,6 @@
  23578. --- a/src/ap/hostapd.c
  23579. +++ b/src/ap/hostapd.c
  23580. -@@ -76,6 +76,16 @@ static void hostapd_reload_bss(struct ho
  23581. +@@ -80,6 +80,16 @@ static void hostapd_reload_bss(struct ho
  23582. #endif /* CONFIG_NO_RADIUS */
  23583. ssid = &hapd->conf->ssid;
  23584. @@ -17,7 +17,7 @@
  23585. if (!ssid->wpa_psk_set && ssid->wpa_psk && !ssid->wpa_psk->next &&
  23586. ssid->wpa_passphrase_set && ssid->wpa_passphrase) {
  23587. /*
  23588. -@@ -175,21 +185,12 @@ int hostapd_reload_config(struct hostapd
  23589. +@@ -179,21 +189,12 @@ int hostapd_reload_config(struct hostapd
  23590. oldconf = hapd->iconf;
  23591. iface->conf = newconf;
  23592. diff --git a/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch b/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch
  23593. index a14fa03..247f154 100644
  23594. --- a/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch
  23595. +++ b/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch
  23596. @@ -1,6 +1,6 @@
  23597. --- a/src/drivers/driver_nl80211.c
  23598. +++ b/src/drivers/driver_nl80211.c
  23599. -@@ -2254,13 +2254,18 @@ wpa_driver_nl80211_finish_drv_init(struc
  23600. +@@ -2394,13 +2394,18 @@ wpa_driver_nl80211_finish_drv_init(struc
  23601. }
  23602. @@ -22,7 +22,7 @@
  23603. return send_and_recv_msgs(drv, msg, NULL, NULL);
  23604. }
  23605. -@@ -2311,7 +2316,7 @@ static void wpa_driver_nl80211_deinit(st
  23606. +@@ -2452,7 +2457,7 @@ static void wpa_driver_nl80211_deinit(st
  23607. nl80211_remove_monitor_interface(drv);
  23608. if (is_ap_interface(drv->nlmode))
  23609. @@ -31,7 +31,7 @@
  23610. if (drv->eapol_sock >= 0) {
  23611. eloop_unregister_read_sock(drv->eapol_sock);
  23612. -@@ -4140,8 +4145,7 @@ static void nl80211_teardown_ap(struct i
  23613. +@@ -4385,8 +4390,7 @@ static void nl80211_teardown_ap(struct i
  23614. nl80211_remove_monitor_interface(drv);
  23615. else
  23616. nl80211_mgmt_unsubscribe(bss, "AP teardown");
  23617. @@ -41,7 +41,7 @@
  23618. }
  23619. -@@ -6066,8 +6070,6 @@ static int wpa_driver_nl80211_if_remove(
  23620. +@@ -6387,8 +6391,6 @@ static int wpa_driver_nl80211_if_remove(
  23621. } else {
  23622. wpa_printf(MSG_DEBUG, "nl80211: First BSS - reassign context");
  23623. nl80211_teardown_ap(bss);
  23624. @@ -50,7 +50,7 @@
  23625. nl80211_destroy_bss(bss);
  23626. if (!bss->added_if)
  23627. i802_set_iface_flags(bss, 0);
  23628. -@@ -6389,8 +6391,7 @@ static int wpa_driver_nl80211_deinit_ap(
  23629. +@@ -6750,8 +6752,7 @@ static int wpa_driver_nl80211_deinit_ap(
  23630. struct wpa_driver_nl80211_data *drv = bss->drv;
  23631. if (!is_ap_interface(drv->nlmode))
  23632. return -1;
  23633. @@ -60,7 +60,7 @@
  23634. /*
  23635. * If the P2P GO interface was dynamically added, then it is
  23636. -@@ -6409,8 +6410,7 @@ static int wpa_driver_nl80211_stop_ap(vo
  23637. +@@ -6770,8 +6771,7 @@ static int wpa_driver_nl80211_stop_ap(vo
  23638. struct wpa_driver_nl80211_data *drv = bss->drv;
  23639. if (!is_ap_interface(drv->nlmode))
  23640. return -1;
  23641. diff --git a/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch b/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch
  23642. index 06b005e..1e405cb 100644
  23643. --- a/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch
  23644. +++ b/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch
  23645. @@ -1,22 +1,22 @@
  23646. --- a/hostapd/ctrl_iface.c
  23647. +++ b/hostapd/ctrl_iface.c
  23648. -@@ -45,6 +45,7 @@
  23649. - #include "wps/wps.h"
  23650. +@@ -54,6 +54,7 @@
  23651. + #include "fst/fst_ctrl_iface.h"
  23652. #include "config_file.h"
  23653. #include "ctrl_iface.h"
  23654. +#include "config_file.h"
  23655. - struct wpa_ctrl_dst {
  23656. -@@ -55,6 +56,7 @@ struct wpa_ctrl_dst {
  23657. - int errors;
  23658. - };
  23659. + #define HOSTAPD_CLI_DUP_VALUE_MAX_LEN 256
  23660. +@@ -72,6 +73,7 @@ static void hostapd_ctrl_iface_send(stru
  23661. + enum wpa_msg_type type,
  23662. + const char *buf, size_t len);
  23663. +static char *reload_opts = NULL;
  23664. - static void hostapd_ctrl_iface_send(struct hostapd_data *hapd, int level,
  23665. - const char *buf, size_t len);
  23666. -@@ -164,6 +166,61 @@ static int hostapd_ctrl_iface_new_sta(st
  23667. + static int hostapd_ctrl_iface_attach(struct hostapd_data *hapd,
  23668. + struct sockaddr_storage *from,
  23669. +@@ -123,6 +125,61 @@ static int hostapd_ctrl_iface_new_sta(st
  23670. return 0;
  23671. }
  23672. @@ -78,7 +78,7 @@
  23673. #ifdef CONFIG_IEEE80211W
  23674. #ifdef NEED_AP_MLME
  23675. -@@ -2086,6 +2143,8 @@ static void hostapd_ctrl_iface_receive(i
  23676. +@@ -2483,6 +2540,8 @@ static int hostapd_ctrl_iface_receive_pr
  23677. } else if (os_strncmp(buf, "VENDOR ", 7) == 0) {
  23678. reply_len = hostapd_ctrl_iface_vendor(hapd, buf + 7, reply,
  23679. reply_size);
  23680. @@ -89,7 +89,7 @@
  23681. #ifdef RADIUS_SERVER
  23682. --- a/src/ap/ctrl_iface_ap.c
  23683. +++ b/src/ap/ctrl_iface_ap.c
  23684. -@@ -541,5 +541,11 @@ int hostapd_parse_csa_settings(const cha
  23685. +@@ -593,7 +593,13 @@ int hostapd_parse_csa_settings(const cha
  23686. int hostapd_ctrl_iface_stop_ap(struct hostapd_data *hapd)
  23687. {
  23688. @@ -102,3 +102,5 @@
  23689. +
  23690. + return 0;
  23691. }
  23692. +
  23693. +
  23694. diff --git a/package/network/services/hostapd/patches/370-ap_sta_support.patch b/package/network/services/hostapd/patches/370-ap_sta_support.patch
  23695. index ea235e6..a77d4c9 100644
  23696. --- a/package/network/services/hostapd/patches/370-ap_sta_support.patch
  23697. +++ b/package/network/services/hostapd/patches/370-ap_sta_support.patch
  23698. @@ -1,6 +1,6 @@
  23699. --- a/wpa_supplicant/wpa_supplicant_i.h
  23700. +++ b/wpa_supplicant/wpa_supplicant_i.h
  23701. -@@ -110,6 +110,11 @@ struct wpa_interface {
  23702. +@@ -100,6 +100,11 @@ struct wpa_interface {
  23703. const char *ifname;
  23704. /**
  23705. @@ -12,8 +12,8 @@
  23706. * bridge_ifname - Optional bridge interface name
  23707. *
  23708. * If the driver interface (ifname) is included in a Linux bridge
  23709. -@@ -442,6 +447,8 @@ struct wpa_supplicant {
  23710. - #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
  23711. +@@ -484,6 +489,8 @@ struct wpa_supplicant {
  23712. + #endif /* CONFIG_CTRL_IFACE_BINDER */
  23713. char bridge_ifname[16];
  23714. + struct wpa_ctrl *hostapd;
  23715. @@ -23,7 +23,7 @@
  23716. --- a/wpa_supplicant/Makefile
  23717. +++ b/wpa_supplicant/Makefile
  23718. -@@ -14,6 +14,10 @@ CFLAGS += $(EXTRA_CFLAGS)
  23719. +@@ -26,6 +26,10 @@ CFLAGS += $(EXTRA_CFLAGS)
  23720. CFLAGS += -I$(abspath ../src)
  23721. CFLAGS += -I$(abspath ../src/utils)
  23722. @@ -34,7 +34,7 @@
  23723. -include .config
  23724. -include $(if $(MULTICALL),../hostapd/.config)
  23725. -@@ -84,6 +88,8 @@ OBJS_c += ../src/utils/wpa_debug.o
  23726. +@@ -113,6 +117,8 @@ OBJS_c += ../src/utils/wpa_debug.o
  23727. OBJS_c += ../src/utils/common.o
  23728. OBJS += wmm_ac.o
  23729. @@ -45,7 +45,7 @@
  23730. CONFIG_OS=win32
  23731. --- a/wpa_supplicant/wpa_supplicant.c
  23732. +++ b/wpa_supplicant/wpa_supplicant.c
  23733. -@@ -107,6 +107,55 @@ const char *wpa_supplicant_full_license5
  23734. +@@ -112,6 +112,55 @@ const char *const wpa_supplicant_full_li
  23735. "\n";
  23736. #endif /* CONFIG_NO_STDOUT_DEBUG */
  23737. @@ -73,7 +73,7 @@
  23738. + int ret;
  23739. +
  23740. + if (!bss)
  23741. -+ return;
  23742. ++ return -1;
  23743. +
  23744. + if (bss->ht_param & HT_INFO_HT_PARAM_STA_CHNL_WIDTH) {
  23745. + int sec = bss->ht_param & HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK;
  23746. @@ -101,7 +101,7 @@
  23747. /* Configure default/group WEP keys for static WEP */
  23748. int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
  23749. {
  23750. -@@ -743,8 +792,12 @@ void wpa_supplicant_set_state(struct wpa
  23751. +@@ -812,8 +861,12 @@ void wpa_supplicant_set_state(struct wpa
  23752. wpas_p2p_completed(wpa_s);
  23753. sme_sched_obss_scan(wpa_s, 1);
  23754. @@ -114,7 +114,7 @@
  23755. wpa_s->new_connection = 1;
  23756. wpa_drv_set_operstate(wpa_s, 0);
  23757. #ifndef IEEE8021X_EAPOL
  23758. -@@ -4038,6 +4091,20 @@ static int wpa_supplicant_init_iface(str
  23759. +@@ -4646,6 +4699,20 @@ static int wpa_supplicant_init_iface(str
  23760. sizeof(wpa_s->bridge_ifname));
  23761. }
  23762. @@ -135,7 +135,7 @@
  23763. /* RSNA Supplicant Key Management - INITIALIZE */
  23764. eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE);
  23765. eapol_sm_notify_portValid(wpa_s->eapol, FALSE);
  23766. -@@ -4280,6 +4347,11 @@ static void wpa_supplicant_deinit_iface(
  23767. +@@ -4937,6 +5004,11 @@ static void wpa_supplicant_deinit_iface(
  23768. if (terminate)
  23769. wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_TERMINATING);
  23770. @@ -157,7 +157,7 @@
  23771. #include "drivers/driver.h"
  23772. #include "wpa_supplicant_i.h"
  23773. #include "config.h"
  23774. -@@ -277,6 +278,10 @@ static void calculate_update_time(const
  23775. +@@ -287,6 +288,10 @@ static void calculate_update_time(const
  23776. static void wpa_bss_copy_res(struct wpa_bss *dst, struct wpa_scan_res *src,
  23777. struct os_reltime *fetch_time)
  23778. {
  23779. @@ -168,7 +168,7 @@
  23780. dst->flags = src->flags;
  23781. os_memcpy(dst->bssid, src->bssid, ETH_ALEN);
  23782. dst->freq = src->freq;
  23783. -@@ -289,6 +294,15 @@ static void wpa_bss_copy_res(struct wpa_
  23784. +@@ -299,6 +304,15 @@ static void wpa_bss_copy_res(struct wpa_
  23785. dst->est_throughput = src->est_throughput;
  23786. dst->snr = src->snr;
  23787. @@ -186,7 +186,7 @@
  23788. --- a/wpa_supplicant/main.c
  23789. +++ b/wpa_supplicant/main.c
  23790. -@@ -33,7 +33,7 @@ static void usage(void)
  23791. +@@ -34,7 +34,7 @@ static void usage(void)
  23792. "vW] [-P<pid file>] "
  23793. "[-g<global ctrl>] \\\n"
  23794. " [-G<group>] \\\n"
  23795. @@ -195,24 +195,24 @@
  23796. "[-p<driver_param>] \\\n"
  23797. " [-b<br_ifname>] [-e<entropy file>]"
  23798. #ifdef CONFIG_DEBUG_FILE
  23799. -@@ -84,6 +84,7 @@ static void usage(void)
  23800. - #endif /* CONFIG_DEBUG_LINUX_TRACING */
  23801. - printf(" -t = include timestamp in debug messages\n"
  23802. +@@ -74,6 +74,7 @@ static void usage(void)
  23803. + " -g = global ctrl_interface\n"
  23804. + " -G = global ctrl_interface group\n"
  23805. " -h = show this help text\n"
  23806. -+ " -H = connect to a hostapd instance to manage state changes\n"
  23807. - " -L = show license (BSD)\n"
  23808. - " -o = override driver parameter for new interfaces\n"
  23809. - " -O = override ctrl_interface parameter for new interfaces\n"
  23810. -@@ -175,7 +176,7 @@ int main(int argc, char *argv[])
  23811. ++ " -H = connect to a hostapd instance to manage state changes\n"
  23812. + " -i = interface name\n"
  23813. + " -I = additional configuration file\n"
  23814. + " -K = include keys (passwords, etc.) in debug output\n"
  23815. +@@ -201,7 +202,7 @@ int main(int argc, char *argv[])
  23816. for (;;) {
  23817. c = getopt(argc, argv,
  23818. -- "b:Bc:C:D:de:f:g:G:hi:I:KLm:No:O:p:P:qsTtuvW");
  23819. -+ "b:Bc:C:D:de:f:g:G:hH:i:I:KLm:No:O:p:P:qsTtuvW");
  23820. +- "b:Bc:C:D:de:f:g:G:hi:I:KLMm:No:O:p:P:qsTtuvW");
  23821. ++ "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuvW");
  23822. if (c < 0)
  23823. break;
  23824. switch (c) {
  23825. -@@ -222,6 +223,9 @@ int main(int argc, char *argv[])
  23826. +@@ -248,6 +249,9 @@ int main(int argc, char *argv[])
  23827. usage();
  23828. exitcode = 0;
  23829. goto out;
  23830. @@ -224,11 +224,11 @@
  23831. break;
  23832. --- a/wpa_supplicant/bss.h
  23833. +++ b/wpa_supplicant/bss.h
  23834. -@@ -72,6 +72,10 @@ struct wpa_bss {
  23835. - u8 ssid[32];
  23836. +@@ -79,6 +79,10 @@ struct wpa_bss {
  23837. + u8 ssid[SSID_MAX_LEN];
  23838. /** Length of SSID */
  23839. size_t ssid_len;
  23840. -+ /** HT caapbilities */
  23841. ++ /** HT capabilities */
  23842. + u16 ht_capab;
  23843. + /* Five octets of HT Operation Information */
  23844. + u8 ht_param;
  23845. diff --git a/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch b/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch
  23846. index 3a41b82..9e815e9 100644
  23847. --- a/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch
  23848. +++ b/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch
  23849. @@ -1,18 +1,18 @@
  23850. --- a/hostapd/Makefile
  23851. +++ b/hostapd/Makefile
  23852. -@@ -168,6 +168,9 @@ endif
  23853. +@@ -212,6 +212,9 @@ endif
  23854. ifdef CONFIG_NO_CTRL_IFACE
  23855. CFLAGS += -DCONFIG_NO_CTRL_IFACE
  23856. else
  23857. +ifdef CONFIG_CTRL_IFACE_MIB
  23858. +CFLAGS += -DCONFIG_CTRL_IFACE_MIB
  23859. +endif
  23860. - OBJS += ctrl_iface.o
  23861. - OBJS += ../src/ap/ctrl_iface_ap.o
  23862. - endif
  23863. + ifeq ($(CONFIG_CTRL_IFACE), udp)
  23864. + CFLAGS += -DCONFIG_CTRL_IFACE_UDP
  23865. + else
  23866. --- a/hostapd/ctrl_iface.c
  23867. +++ b/hostapd/ctrl_iface.c
  23868. -@@ -1953,6 +1953,7 @@ static void hostapd_ctrl_iface_receive(i
  23869. +@@ -2342,6 +2342,7 @@ static int hostapd_ctrl_iface_receive_pr
  23870. reply_size);
  23871. } else if (os_strcmp(buf, "STATUS-DRIVER") == 0) {
  23872. reply_len = hostapd_drv_status(hapd, reply, reply_size);
  23873. @@ -20,18 +20,18 @@
  23874. } else if (os_strcmp(buf, "MIB") == 0) {
  23875. reply_len = ieee802_11_get_mib(hapd, reply, reply_size);
  23876. if (reply_len >= 0) {
  23877. -@@ -1994,6 +1995,7 @@ static void hostapd_ctrl_iface_receive(i
  23878. +@@ -2383,6 +2384,7 @@ static int hostapd_ctrl_iface_receive_pr
  23879. } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) {
  23880. reply_len = hostapd_ctrl_iface_sta_next(hapd, buf + 9, reply,
  23881. reply_size);
  23882. +#endif
  23883. } else if (os_strcmp(buf, "ATTACH") == 0) {
  23884. - if (hostapd_ctrl_iface_attach(hapd, &from, fromlen))
  23885. + if (hostapd_ctrl_iface_attach(hapd, from, fromlen))
  23886. reply_len = -1;
  23887. --- a/wpa_supplicant/Makefile
  23888. +++ b/wpa_supplicant/Makefile
  23889. -@@ -837,6 +837,9 @@ ifdef CONFIG_WNM
  23890. - OBJS += ../src/ap/wnm_ap.o
  23891. +@@ -874,6 +874,9 @@ ifdef CONFIG_MBO
  23892. + OBJS += ../src/ap/mbo_ap.o
  23893. endif
  23894. ifdef CONFIG_CTRL_IFACE
  23895. +ifdef CONFIG_CTRL_IFACE_MIB
  23896. @@ -42,7 +42,7 @@
  23897. --- a/wpa_supplicant/ctrl_iface.c
  23898. +++ b/wpa_supplicant/ctrl_iface.c
  23899. -@@ -1795,7 +1795,7 @@ static int wpa_supplicant_ctrl_iface_sta
  23900. +@@ -1895,7 +1895,7 @@ static int wpa_supplicant_ctrl_iface_sta
  23901. pos += ret;
  23902. }
  23903. @@ -51,7 +51,7 @@
  23904. if (wpa_s->ap_iface) {
  23905. pos += ap_ctrl_iface_wpa_get_status(wpa_s, pos,
  23906. end - pos,
  23907. -@@ -7896,6 +7896,7 @@ char * wpa_supplicant_ctrl_iface_process
  23908. +@@ -8687,6 +8687,7 @@ char * wpa_supplicant_ctrl_iface_process
  23909. reply_len = -1;
  23910. } else if (os_strncmp(buf, "NOTE ", 5) == 0) {
  23911. wpa_printf(MSG_INFO, "NOTE: %s", buf + 5);
  23912. @@ -59,7 +59,7 @@
  23913. } else if (os_strcmp(buf, "MIB") == 0) {
  23914. reply_len = wpa_sm_get_mib(wpa_s->wpa, reply, reply_size);
  23915. if (reply_len >= 0) {
  23916. -@@ -7903,6 +7904,7 @@ char * wpa_supplicant_ctrl_iface_process
  23917. +@@ -8694,6 +8695,7 @@ char * wpa_supplicant_ctrl_iface_process
  23918. reply + reply_len,
  23919. reply_size - reply_len);
  23920. }
  23921. @@ -67,7 +67,7 @@
  23922. } else if (os_strncmp(buf, "STATUS", 6) == 0) {
  23923. reply_len = wpa_supplicant_ctrl_iface_status(
  23924. wpa_s, buf + 6, reply, reply_size);
  23925. -@@ -8353,6 +8355,7 @@ char * wpa_supplicant_ctrl_iface_process
  23926. +@@ -9164,6 +9166,7 @@ char * wpa_supplicant_ctrl_iface_process
  23927. reply_len = wpa_supplicant_ctrl_iface_bss(
  23928. wpa_s, buf + 4, reply, reply_size);
  23929. #ifdef CONFIG_AP
  23930. @@ -75,7 +75,7 @@
  23931. } else if (os_strcmp(buf, "STA-FIRST") == 0) {
  23932. reply_len = ap_ctrl_iface_sta_first(wpa_s, reply, reply_size);
  23933. } else if (os_strncmp(buf, "STA ", 4) == 0) {
  23934. -@@ -8361,12 +8364,15 @@ char * wpa_supplicant_ctrl_iface_process
  23935. +@@ -9172,12 +9175,15 @@ char * wpa_supplicant_ctrl_iface_process
  23936. } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) {
  23937. reply_len = ap_ctrl_iface_sta_next(wpa_s, buf + 9, reply,
  23938. reply_size);
  23939. @@ -93,15 +93,15 @@
  23940. reply_len = -1;
  23941. --- a/src/ap/ctrl_iface_ap.c
  23942. +++ b/src/ap/ctrl_iface_ap.c
  23943. -@@ -22,6 +22,7 @@
  23944. - #include "ctrl_iface_ap.h"
  23945. +@@ -24,6 +24,7 @@
  23946. #include "ap_drv_ops.h"
  23947. + #include "mbo_ap.h"
  23948. +#ifdef CONFIG_CTRL_IFACE_MIB
  23949. static int hostapd_get_sta_tx_rx(struct hostapd_data *hapd,
  23950. struct sta_info *sta,
  23951. -@@ -224,6 +225,7 @@ int hostapd_ctrl_iface_sta_next(struct h
  23952. +@@ -249,6 +250,7 @@ int hostapd_ctrl_iface_sta_next(struct h
  23953. return hostapd_ctrl_iface_sta_mib(hapd, sta->next, buf, buflen);
  23954. }
  23955. @@ -111,33 +111,33 @@
  23956. static int p2p_manager_disconnect(struct hostapd_data *hapd, u16 stype,
  23957. --- a/src/ap/ieee802_1x.c
  23958. +++ b/src/ap/ieee802_1x.c
  23959. -@@ -2337,6 +2337,7 @@ static const char * bool_txt(Boolean boo
  23960. - return bool_val ? "TRUE" : "FALSE";
  23961. +@@ -2441,6 +2441,7 @@ static const char * bool_txt(Boolean val
  23962. + return val ? "TRUE" : "FALSE";
  23963. }
  23964. +#ifdef CONFIG_CTRL_IFACE_MIB
  23965. int ieee802_1x_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen)
  23966. {
  23967. -@@ -2512,6 +2513,7 @@ int ieee802_1x_get_mib_sta(struct hostap
  23968. +@@ -2616,6 +2617,7 @@ int ieee802_1x_get_mib_sta(struct hostap
  23969. return len;
  23970. }
  23971. +#endif
  23972. - static void ieee802_1x_finished(struct hostapd_data *hapd,
  23973. - struct sta_info *sta, int success,
  23974. + #ifdef CONFIG_HS20
  23975. + static void ieee802_1x_wnm_notif_send(void *eloop_ctx, void *timeout_ctx)
  23976. --- a/src/ap/wpa_auth.c
  23977. +++ b/src/ap/wpa_auth.c
  23978. -@@ -2999,6 +2999,7 @@ static const char * wpa_bool_txt(int boo
  23979. - return bool ? "TRUE" : "FALSE";
  23980. +@@ -3069,6 +3069,7 @@ static const char * wpa_bool_txt(int val
  23981. + return val ? "TRUE" : "FALSE";
  23982. }
  23983. +#ifdef CONFIG_CTRL_IFACE_MIB
  23984. #define RSN_SUITE "%02x-%02x-%02x-%d"
  23985. #define RSN_SUITE_ARG(s) \
  23986. -@@ -3143,7 +3144,7 @@ int wpa_get_mib_sta(struct wpa_state_mac
  23987. +@@ -3213,7 +3214,7 @@ int wpa_get_mib_sta(struct wpa_state_mac
  23988. return len;
  23989. }
  23990. @@ -148,7 +148,7 @@
  23991. {
  23992. --- a/src/rsn_supp/wpa.c
  23993. +++ b/src/rsn_supp/wpa.c
  23994. -@@ -2032,6 +2032,8 @@ static u32 wpa_key_mgmt_suite(struct wpa
  23995. +@@ -2108,6 +2108,8 @@ static u32 wpa_key_mgmt_suite(struct wpa
  23996. }
  23997. @@ -157,7 +157,7 @@
  23998. #define RSN_SUITE "%02x-%02x-%02x-%d"
  23999. #define RSN_SUITE_ARG(s) \
  24000. ((s) >> 24) & 0xff, ((s) >> 16) & 0xff, ((s) >> 8) & 0xff, (s) & 0xff
  24001. -@@ -2115,6 +2117,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch
  24002. +@@ -2191,6 +2193,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch
  24003. return (int) len;
  24004. }
  24005. @@ -167,7 +167,7 @@
  24006. --- a/wpa_supplicant/ap.c
  24007. +++ b/wpa_supplicant/ap.c
  24008. -@@ -1015,7 +1015,7 @@ int wpas_ap_wps_nfc_report_handover(stru
  24009. +@@ -1114,7 +1114,7 @@ int wpas_ap_wps_nfc_report_handover(stru
  24010. #endif /* CONFIG_WPS */
  24011. diff --git a/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch b/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch
  24012. index 1065a7f..c9e7bf4 100644
  24013. --- a/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch
  24014. +++ b/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch
  24015. @@ -1,6 +1,6 @@
  24016. --- a/src/common/wpa_common.c
  24017. +++ b/src/common/wpa_common.c
  24018. -@@ -1228,6 +1228,31 @@ u32 wpa_akm_to_suite(int akm)
  24019. +@@ -1244,6 +1244,31 @@ u32 wpa_akm_to_suite(int akm)
  24020. }
  24021. @@ -32,7 +32,7 @@
  24022. int wpa_compare_rsn_ie(int ft_initial_assoc,
  24023. const u8 *ie1, size_t ie1len,
  24024. const u8 *ie2, size_t ie2len)
  24025. -@@ -1235,8 +1260,19 @@ int wpa_compare_rsn_ie(int ft_initial_as
  24026. +@@ -1251,8 +1276,19 @@ int wpa_compare_rsn_ie(int ft_initial_as
  24027. if (ie1 == NULL || ie2 == NULL)
  24028. return -1;
  24029. diff --git a/package/network/services/hostapd/patches/400-wps_single_auth_enc_type.patch b/package/network/services/hostapd/patches/400-wps_single_auth_enc_type.patch
  24030. index 083af5b..f5872cd 100644
  24031. --- a/package/network/services/hostapd/patches/400-wps_single_auth_enc_type.patch
  24032. +++ b/package/network/services/hostapd/patches/400-wps_single_auth_enc_type.patch
  24033. @@ -1,25 +1,22 @@
  24034. --- a/src/ap/wps_hostapd.c
  24035. +++ b/src/ap/wps_hostapd.c
  24036. -@@ -1052,11 +1052,9 @@ int hostapd_init_wps(struct hostapd_data
  24037. -
  24038. - if (conf->rsn_pairwise & (WPA_CIPHER_CCMP | WPA_CIPHER_GCMP))
  24039. +@@ -352,8 +352,7 @@ static int hapd_wps_reconfig_in_memory(s
  24040. + bss->wpa_pairwise |= WPA_CIPHER_GCMP;
  24041. + else
  24042. + bss->wpa_pairwise |= WPA_CIPHER_CCMP;
  24043. +- }
  24044. +- if (cred->encr_type & WPS_ENCR_TKIP)
  24045. ++ } else if (cred->encr_type & WPS_ENCR_TKIP)
  24046. + bss->wpa_pairwise |= WPA_CIPHER_TKIP;
  24047. + bss->rsn_pairwise = bss->wpa_pairwise;
  24048. + bss->wpa_group = wpa_select_ap_group_cipher(bss->wpa,
  24049. +@@ -1073,8 +1072,7 @@ int hostapd_init_wps(struct hostapd_data
  24050. + if (conf->rsn_pairwise & (WPA_CIPHER_CCMP | WPA_CIPHER_GCMP)) {
  24051. wps->encr_types |= WPS_ENCR_AES;
  24052. -- if (conf->rsn_pairwise & WPA_CIPHER_TKIP)
  24053. -+ else if (conf->rsn_pairwise & WPA_CIPHER_TKIP)
  24054. + wps->encr_types_rsn |= WPS_ENCR_AES;
  24055. +- }
  24056. +- if (conf->rsn_pairwise & WPA_CIPHER_TKIP) {
  24057. ++ } else if (conf->rsn_pairwise & WPA_CIPHER_TKIP) {
  24058. wps->encr_types |= WPS_ENCR_TKIP;
  24059. -- }
  24060. --
  24061. -- if (conf->wpa & WPA_PROTO_WPA) {
  24062. -+ } else if (conf->wpa & WPA_PROTO_WPA) {
  24063. - if (conf->wpa_key_mgmt & WPA_KEY_MGMT_PSK)
  24064. - wps->auth_types |= WPS_AUTH_WPAPSK;
  24065. - if (conf->wpa_key_mgmt & WPA_KEY_MGMT_IEEE8021X)
  24066. -@@ -1064,7 +1062,7 @@ int hostapd_init_wps(struct hostapd_data
  24067. -
  24068. - if (conf->wpa_pairwise & WPA_CIPHER_CCMP)
  24069. - wps->encr_types |= WPS_ENCR_AES;
  24070. -- if (conf->wpa_pairwise & WPA_CIPHER_TKIP)
  24071. -+ else if (conf->wpa_pairwise & WPA_CIPHER_TKIP)
  24072. - wps->encr_types |= WPS_ENCR_TKIP;
  24073. - }
  24074. -
  24075. + wps->encr_types_rsn |= WPS_ENCR_TKIP;
  24076. + }
  24077. diff --git a/package/network/services/hostapd/patches/410-limit_debug_messages.patch b/package/network/services/hostapd/patches/410-limit_debug_messages.patch
  24078. index da88732..a48b696 100644
  24079. --- a/package/network/services/hostapd/patches/410-limit_debug_messages.patch
  24080. +++ b/package/network/services/hostapd/patches/410-limit_debug_messages.patch
  24081. @@ -64,7 +64,7 @@
  24082. #ifdef CONFIG_DEBUG_FILE
  24083. static char *last_path = NULL;
  24084. #endif /* CONFIG_DEBUG_FILE */
  24085. -@@ -602,7 +576,7 @@ void wpa_msg_register_ifname_cb(wpa_msg_
  24086. +@@ -604,7 +578,7 @@ void wpa_msg_register_ifname_cb(wpa_msg_
  24087. }
  24088. @@ -73,7 +73,7 @@
  24089. {
  24090. va_list ap;
  24091. char *buf;
  24092. -@@ -640,7 +614,7 @@ void wpa_msg(void *ctx, int level, const
  24093. +@@ -642,7 +616,7 @@ void wpa_msg(void *ctx, int level, const
  24094. }
  24095. @@ -183,7 +183,7 @@
  24096. /*
  24097. * wpa_dbg() behaves like wpa_msg(), but it can be removed from build to reduce
  24098. -@@ -181,7 +222,12 @@ void wpa_hexdump_ascii_key(int level, co
  24099. +@@ -182,7 +223,12 @@ void wpa_hexdump_ascii_key(int level, co
  24100. *
  24101. * Note: New line '\n' is added to the end of the text when printing to stdout.
  24102. */
  24103. @@ -197,7 +197,7 @@
  24104. /**
  24105. * wpa_msg_ctrl - Conditional printf for ctrl_iface monitors
  24106. -@@ -195,8 +241,13 @@ void wpa_msg(void *ctx, int level, const
  24107. +@@ -196,8 +242,13 @@ void wpa_msg(void *ctx, int level, const
  24108. * attached ctrl_iface monitors. In other words, it can be used for frequent
  24109. * events that do not need to be sent to syslog.
  24110. */
  24111. diff --git a/package/network/services/hostapd/patches/420-indicate-features.patch b/package/network/services/hostapd/patches/420-indicate-features.patch
  24112. index 64c92df..335e71e 100644
  24113. --- a/package/network/services/hostapd/patches/420-indicate-features.patch
  24114. +++ b/package/network/services/hostapd/patches/420-indicate-features.patch
  24115. @@ -8,16 +8,16 @@
  24116. #include "crypto/random.h"
  24117. #include "crypto/tls.h"
  24118. #include "common/version.h"
  24119. -@@ -567,7 +568,7 @@ int main(int argc, char *argv[])
  24120. -
  24121. +@@ -668,7 +669,7 @@ int main(int argc, char *argv[])
  24122. wpa_supplicant_event = hostapd_wpa_event;
  24123. + wpa_supplicant_event_global = hostapd_wpa_event_global;
  24124. for (;;) {
  24125. -- c = getopt(argc, argv, "b:Bde:f:hKP:Ttu:vg:G:");
  24126. -+ c = getopt(argc, argv, "b:Bde:f:hKP:Ttu:g:G:v::");
  24127. +- c = getopt(argc, argv, "b:Bde:f:hi:KP:STtu:vg:G:");
  24128. ++ c = getopt(argc, argv, "b:Bde:f:hi:KP:STtu:g:G:v::");
  24129. if (c < 0)
  24130. break;
  24131. switch (c) {
  24132. -@@ -604,6 +605,8 @@ int main(int argc, char *argv[])
  24133. +@@ -705,6 +706,8 @@ int main(int argc, char *argv[])
  24134. break;
  24135. #endif /* CONFIG_DEBUG_LINUX_TRACING */
  24136. case 'v':
  24137. @@ -33,19 +33,19 @@
  24138. #include "common.h"
  24139. +#include "build_features.h"
  24140. + #include "fst/fst.h"
  24141. #include "wpa_supplicant_i.h"
  24142. #include "driver_i.h"
  24143. - #include "p2p_supplicant.h"
  24144. -@@ -176,7 +177,7 @@ int main(int argc, char *argv[])
  24145. +@@ -202,7 +203,7 @@ int main(int argc, char *argv[])
  24146. for (;;) {
  24147. c = getopt(argc, argv,
  24148. -- "b:Bc:C:D:de:f:g:G:hH:i:I:KLm:No:O:p:P:qsTtuvW");
  24149. -+ "b:Bc:C:D:de:f:g:G:hH:i:I:KLm:No:O:p:P:qsTtuv::W");
  24150. +- "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuvW");
  24151. ++ "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuv::W");
  24152. if (c < 0)
  24153. break;
  24154. switch (c) {
  24155. -@@ -279,8 +280,12 @@ int main(int argc, char *argv[])
  24156. +@@ -305,8 +306,12 @@ int main(int argc, char *argv[])
  24157. break;
  24158. #endif /* CONFIG_DBUS */
  24159. case 'v':
  24160. diff --git a/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch b/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch
  24161. index 85d2e16..d07b747 100644
  24162. --- a/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch
  24163. +++ b/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch
  24164. @@ -1,6 +1,6 @@
  24165. --- a/hostapd/hostapd_cli.c
  24166. +++ b/hostapd/hostapd_cli.c
  24167. -@@ -67,7 +67,6 @@ static const char *commands_help =
  24168. +@@ -69,7 +69,6 @@ static const char *const commands_help =
  24169. #ifdef CONFIG_IEEE80211W
  24170. " sa_query <addr> send SA Query to a station\n"
  24171. #endif /* CONFIG_IEEE80211W */
  24172. @@ -8,7 +8,7 @@
  24173. " wps_pin <uuid> <pin> [timeout] [addr] add WPS Enrollee PIN\n"
  24174. " wps_check_pin <PIN> verify PIN checksum\n"
  24175. " wps_pbc indicate button pushed to initiate PBC\n"
  24176. -@@ -80,7 +79,6 @@ static const char *commands_help =
  24177. +@@ -82,7 +81,6 @@ static const char *const commands_help =
  24178. " wps_ap_pin <cmd> [params..] enable/disable AP PIN\n"
  24179. " wps_config <SSID> <auth> <encr> <key> configure AP\n"
  24180. " wps_get_status show current WPS status\n"
  24181. @@ -16,7 +16,7 @@
  24182. " get_config show current configuration\n"
  24183. " help show this usage help\n"
  24184. " interface [ifname] show interfaces/select interface\n"
  24185. -@@ -353,7 +351,6 @@ static int hostapd_cli_cmd_sa_query(stru
  24186. +@@ -418,7 +416,6 @@ static int hostapd_cli_cmd_sa_query(stru
  24187. #endif /* CONFIG_IEEE80211W */
  24188. @@ -24,7 +24,7 @@
  24189. static int hostapd_cli_cmd_wps_pin(struct wpa_ctrl *ctrl, int argc,
  24190. char *argv[])
  24191. {
  24192. -@@ -579,7 +576,6 @@ static int hostapd_cli_cmd_wps_config(st
  24193. +@@ -644,7 +641,6 @@ static int hostapd_cli_cmd_wps_config(st
  24194. ssid_hex, argv[1]);
  24195. return wpa_ctrl_command(ctrl, buf);
  24196. }
  24197. @@ -32,7 +32,7 @@
  24198. static int hostapd_cli_cmd_disassoc_imminent(struct wpa_ctrl *ctrl, int argc,
  24199. -@@ -1027,7 +1023,6 @@ static struct hostapd_cli_cmd hostapd_cl
  24200. +@@ -1236,7 +1232,6 @@ static const struct hostapd_cli_cmd host
  24201. #ifdef CONFIG_IEEE80211W
  24202. { "sa_query", hostapd_cli_cmd_sa_query },
  24203. #endif /* CONFIG_IEEE80211W */
  24204. @@ -40,7 +40,7 @@
  24205. { "wps_pin", hostapd_cli_cmd_wps_pin },
  24206. { "wps_check_pin", hostapd_cli_cmd_wps_check_pin },
  24207. { "wps_pbc", hostapd_cli_cmd_wps_pbc },
  24208. -@@ -1041,7 +1036,6 @@ static struct hostapd_cli_cmd hostapd_cl
  24209. +@@ -1250,7 +1245,6 @@ static const struct hostapd_cli_cmd host
  24210. { "wps_ap_pin", hostapd_cli_cmd_wps_ap_pin },
  24211. { "wps_config", hostapd_cli_cmd_wps_config },
  24212. { "wps_get_status", hostapd_cli_cmd_wps_get_status },
  24213. diff --git a/package/network/services/hostapd/patches/431-wpa_cli_ifdef.patch b/package/network/services/hostapd/patches/431-wpa_cli_ifdef.patch
  24214. index 874ff4b..256f6b5 100644
  24215. --- a/package/network/services/hostapd/patches/431-wpa_cli_ifdef.patch
  24216. +++ b/package/network/services/hostapd/patches/431-wpa_cli_ifdef.patch
  24217. @@ -1,13 +1,12 @@
  24218. --- a/wpa_supplicant/wpa_cli.c
  24219. +++ b/wpa_supplicant/wpa_cli.c
  24220. -@@ -26,6 +26,10 @@
  24221. +@@ -25,6 +25,9 @@
  24222. + #include <cutils/properties.h>
  24223. #endif /* ANDROID */
  24224. -
  24225. +#ifndef CONFIG_P2P
  24226. +#define CONFIG_P2P
  24227. +#endif
  24228. -+
  24229. - static const char *wpa_cli_version =
  24230. +
  24231. + static const char *const wpa_cli_version =
  24232. "wpa_cli v" VERSION_STR "\n"
  24233. - "Copyright (c) 2004-2015, Jouni Malinen <j@w1.fi> and contributors";
  24234. diff --git a/package/network/services/hostapd/patches/432-missing-typedef.patch b/package/network/services/hostapd/patches/432-missing-typedef.patch
  24235. new file mode 100644
  24236. index 0000000..7a100f1
  24237. --- /dev/null
  24238. +++ b/package/network/services/hostapd/patches/432-missing-typedef.patch
  24239. @@ -0,0 +1,10 @@
  24240. +--- a/src/drivers/linux_wext.h
  24241. ++++ b/src/drivers/linux_wext.h
  24242. +@@ -26,6 +26,7 @@ typedef int32_t __s32;
  24243. + typedef uint16_t __u16;
  24244. + typedef int16_t __s16;
  24245. + typedef uint8_t __u8;
  24246. ++typedef int8_t __s8;
  24247. + #ifndef __user
  24248. + #define __user
  24249. + #endif /* __user */
  24250. diff --git a/package/network/services/hostapd/patches/440-max_num_sta_probe.patch b/package/network/services/hostapd/patches/440-max_num_sta_probe.patch
  24251. deleted file mode 100644
  24252. index 74aef26..0000000
  24253. --- a/package/network/services/hostapd/patches/440-max_num_sta_probe.patch
  24254. +++ /dev/null
  24255. @@ -1,13 +0,0 @@
  24256. ---- a/src/ap/beacon.c
  24257. -+++ b/src/ap/beacon.c
  24258. -@@ -664,6 +664,10 @@ void handle_probe_req(struct hostapd_dat
  24259. - return;
  24260. - }
  24261. -
  24262. -+ if (!sta && hapd->num_sta >= hapd->conf->max_num_sta)
  24263. -+ wpa_printf(MSG_MSGDUMP, "Probe Request from " MACSTR " ignored,"
  24264. -+ " too many connected stations.", MAC2STR(mgmt->sa));
  24265. -+
  24266. - #ifdef CONFIG_INTERWORKING
  24267. - if (hapd->conf->interworking &&
  24268. - elems.interworking && elems.interworking_len >= 1) {
  24269. diff --git a/package/network/services/hostapd/patches/450-scan_wait.patch b/package/network/services/hostapd/patches/450-scan_wait.patch
  24270. index 87ebd45..78cf306 100644
  24271. --- a/package/network/services/hostapd/patches/450-scan_wait.patch
  24272. +++ b/package/network/services/hostapd/patches/450-scan_wait.patch
  24273. @@ -1,6 +1,6 @@
  24274. --- a/hostapd/main.c
  24275. +++ b/hostapd/main.c
  24276. -@@ -36,6 +36,8 @@ struct hapd_global {
  24277. +@@ -37,6 +37,8 @@ struct hapd_global {
  24278. };
  24279. static struct hapd_global global;
  24280. @@ -9,7 +9,7 @@
  24281. #ifndef CONFIG_NO_HOSTAPD_LOGGER
  24282. -@@ -142,6 +144,14 @@ static void hostapd_logger_cb(void *ctx,
  24283. +@@ -143,6 +145,14 @@ static void hostapd_logger_cb(void *ctx,
  24284. }
  24285. #endif /* CONFIG_NO_HOSTAPD_LOGGER */
  24286. @@ -24,7 +24,7 @@
  24287. /**
  24288. * hostapd_driver_init - Preparate driver interface
  24289. -@@ -160,6 +170,8 @@ static int hostapd_driver_init(struct ho
  24290. +@@ -161,6 +171,8 @@ static int hostapd_driver_init(struct ho
  24291. return -1;
  24292. }
  24293. @@ -33,7 +33,7 @@
  24294. /* Initialize the driver interface */
  24295. if (!(b[0] | b[1] | b[2] | b[3] | b[4] | b[5]))
  24296. b = NULL;
  24297. -@@ -381,8 +393,6 @@ static void hostapd_global_deinit(const
  24298. +@@ -401,8 +413,6 @@ static void hostapd_global_deinit(const
  24299. #endif /* CONFIG_NATIVE_WINDOWS */
  24300. eap_server_unregister_methods();
  24301. @@ -42,19 +42,26 @@
  24302. }
  24303. -@@ -408,11 +418,6 @@ static int hostapd_global_run(struct hap
  24304. +@@ -428,18 +438,6 @@ static int hostapd_global_run(struct hap
  24305. }
  24306. #endif /* EAP_SERVER_TNC */
  24307. -- if (daemonize && os_daemonize(pid_file)) {
  24308. -- wpa_printf(MSG_ERROR, "daemon: %s", strerror(errno));
  24309. -- return -1;
  24310. +- if (daemonize) {
  24311. +- if (os_daemonize(pid_file)) {
  24312. +- wpa_printf(MSG_ERROR, "daemon: %s", strerror(errno));
  24313. +- return -1;
  24314. +- }
  24315. +- if (eloop_sock_requeue()) {
  24316. +- wpa_printf(MSG_ERROR, "eloop_sock_requeue: %s",
  24317. +- strerror(errno));
  24318. +- return -1;
  24319. +- }
  24320. - }
  24321. -
  24322. eloop_run();
  24323. return 0;
  24324. -@@ -542,8 +547,7 @@ int main(int argc, char *argv[])
  24325. +@@ -638,8 +636,7 @@ int main(int argc, char *argv[])
  24326. struct hapd_interfaces interfaces;
  24327. int ret = 1;
  24328. size_t i, j;
  24329. diff --git a/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch b/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch
  24330. index 217e701..6a5866e 100644
  24331. --- a/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch
  24332. +++ b/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch
  24333. @@ -18,15 +18,15 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  24334. #define WPA_SUPPLICANT_DRIVER_VERSION 4
  24335. -+#include "drivers/nl80211_copy.h"
  24336. ++#include "ap/sta_info.h"
  24337. #include "common/defs.h"
  24338. + #include "common/ieee802_11_defs.h"
  24339. #include "utils/list.h"
  24340. -
  24341. -@@ -538,6 +539,9 @@ struct wpa_driver_associate_params {
  24342. +@@ -587,6 +588,9 @@ struct wpa_driver_associate_params {
  24343. * responsible for selecting with which BSS to associate. */
  24344. const u8 *bssid;
  24345. -+ unsigned char rates[NL80211_MAX_SUPP_RATES];
  24346. ++ unsigned char rates[WLAN_SUPP_RATES_MAX];
  24347. + int mcast_rate;
  24348. +
  24349. /**
  24350. @@ -34,15 +34,15 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  24351. *
  24352. --- a/wpa_supplicant/config.c
  24353. +++ b/wpa_supplicant/config.c
  24354. -@@ -15,6 +15,7 @@
  24355. - #include "rsn_supp/wpa.h"
  24356. +@@ -16,6 +16,7 @@
  24357. #include "eap_peer/eap.h"
  24358. #include "p2p/p2p.h"
  24359. -+#include "drivers/nl80211_copy.h"
  24360. + #include "fst/fst.h"
  24361. ++#include "ap/sta_info.h"
  24362. #include "config.h"
  24363. -@@ -1722,6 +1723,97 @@ static char * wpa_config_write_mesh_basi
  24364. +@@ -1816,6 +1817,97 @@ static char * wpa_config_write_mesh_basi
  24365. #endif /* CONFIG_MESH */
  24366. @@ -88,7 +88,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  24367. + pos = (char *)value;
  24368. + r = strtok_r(pos, ",", &sptr);
  24369. + i = 0;
  24370. -+ while (pos && i < NL80211_MAX_SUPP_RATES) {
  24371. ++ while (pos && i < WLAN_SUPP_RATES_MAX) {
  24372. + rate = 0.0;
  24373. + if (r)
  24374. + rate = strtod(r, &end);
  24375. @@ -113,11 +113,11 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  24376. + if (ssid->rates[0] <= 0)
  24377. + return NULL;
  24378. +
  24379. -+ value = os_malloc(6 * NL80211_MAX_SUPP_RATES + 1);
  24380. ++ value = os_malloc(6 * WLAN_SUPP_RATES_MAX + 1);
  24381. + if (value == NULL)
  24382. + return NULL;
  24383. + pos = value;
  24384. -+ for (i = 0; i < NL80211_MAX_SUPP_RATES - 1; i++) {
  24385. ++ for (i = 0; i < WLAN_SUPP_RATES_MAX - 1; i++) {
  24386. + res = os_snprintf(pos, 6, "%.1f,", (double)ssid->rates[i] / 2);
  24387. + if (res < 0) {
  24388. + os_free(value);
  24389. @@ -126,13 +126,13 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  24390. + pos += res;
  24391. + }
  24392. + res = os_snprintf(pos, 6, "%.1f",
  24393. -+ (double)ssid->rates[NL80211_MAX_SUPP_RATES - 1] / 2);
  24394. ++ (double)ssid->rates[WLAN_SUPP_RATES_MAX - 1] / 2);
  24395. + if (res < 0) {
  24396. + os_free(value);
  24397. + return NULL;
  24398. + }
  24399. +
  24400. -+ value[6 * NL80211_MAX_SUPP_RATES] = '\0';
  24401. ++ value[6 * WLAN_SUPP_RATES_MAX] = '\0';
  24402. + return value;
  24403. +}
  24404. +#endif /* NO_CONFIG_WRITE */
  24405. @@ -140,7 +140,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  24406. /* Helper macros for network block parser */
  24407. #ifdef OFFSET
  24408. -@@ -1947,6 +2039,9 @@ static const struct parse_data ssid_fiel
  24409. +@@ -2047,6 +2139,9 @@ static const struct parse_data ssid_fiel
  24410. { INT(ap_max_inactivity) },
  24411. { INT(dtim_period) },
  24412. { INT(beacon_int) },
  24413. @@ -152,19 +152,22 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  24414. #endif /* CONFIG_MACSEC */
  24415. --- a/wpa_supplicant/config_ssid.h
  24416. +++ b/wpa_supplicant/config_ssid.h
  24417. -@@ -12,6 +12,7 @@
  24418. +@@ -10,8 +10,10 @@
  24419. + #define CONFIG_SSID_H
  24420. +
  24421. #include "common/defs.h"
  24422. ++#include "ap/sta_info.h"
  24423. #include "utils/list.h"
  24424. #include "eap_peer/eap_config.h"
  24425. +#include "drivers/nl80211_copy.h"
  24426. - #define MAX_SSID_LEN 32
  24427. -@@ -675,6 +676,9 @@ struct wpa_ssid {
  24428. + #define DEFAULT_EAP_WORKAROUND ((unsigned int) -1)
  24429. +@@ -711,6 +713,9 @@ struct wpa_ssid {
  24430. */
  24431. void *parent_cred;
  24432. -+ unsigned char rates[NL80211_MAX_SUPP_RATES];
  24433. ++ unsigned char rates[WLAN_SUPP_RATES_MAX];
  24434. + double mcast_rate;
  24435. +
  24436. #ifdef CONFIG_MACSEC
  24437. @@ -172,13 +175,13 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  24438. * macsec_policy - Determines the policy for MACsec secure session
  24439. --- a/wpa_supplicant/wpa_supplicant.c
  24440. +++ b/wpa_supplicant/wpa_supplicant.c
  24441. -@@ -2266,6 +2266,13 @@ static void wpas_start_assoc_cb(struct w
  24442. +@@ -2518,6 +2518,13 @@ static void wpas_start_assoc_cb(struct w
  24443. params.beacon_int = ssid->beacon_int;
  24444. else
  24445. params.beacon_int = wpa_s->conf->beacon_int;
  24446. + params.fixed_freq = ssid->fixed_freq;
  24447. + i = 0;
  24448. -+ while (i < NL80211_MAX_SUPP_RATES) {
  24449. ++ while (i < WLAN_SUPP_RATES_MAX) {
  24450. + params.rates[i] = ssid->rates[i];
  24451. + i++;
  24452. + }
  24453. diff --git a/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch b/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch
  24454. index 730cc31..459bdb9 100644
  24455. --- a/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch
  24456. +++ b/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch
  24457. @@ -10,7 +10,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  24458. --- a/src/drivers/driver_nl80211.c
  24459. +++ b/src/drivers/driver_nl80211.c
  24460. -@@ -4398,7 +4398,7 @@ static int wpa_driver_nl80211_ibss(struc
  24461. +@@ -4644,7 +4644,7 @@ static int wpa_driver_nl80211_ibss(struc
  24462. struct wpa_driver_associate_params *params)
  24463. {
  24464. struct nl_msg *msg;
  24465. @@ -19,7 +19,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  24466. int count = 0;
  24467. wpa_printf(MSG_DEBUG, "nl80211: Join IBSS (ifindex=%d)", drv->ifindex);
  24468. -@@ -4425,6 +4425,37 @@ retry:
  24469. +@@ -4671,6 +4671,37 @@ retry:
  24470. nl80211_put_beacon_int(msg, params->beacon_int))
  24471. goto fail;
  24472. diff --git a/package/network/services/hostapd/patches/462-wpa_s-support-htmode-param.patch b/package/network/services/hostapd/patches/462-wpa_s-support-htmode-param.patch
  24473. index 30bb2dc..80fe49c 100644
  24474. --- a/package/network/services/hostapd/patches/462-wpa_s-support-htmode-param.patch
  24475. +++ b/package/network/services/hostapd/patches/462-wpa_s-support-htmode-param.patch
  24476. @@ -16,9 +16,9 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  24477. --- a/src/drivers/driver.h
  24478. +++ b/src/drivers/driver.h
  24479. -@@ -541,6 +541,8 @@ struct wpa_driver_associate_params {
  24480. +@@ -590,6 +590,8 @@ struct wpa_driver_associate_params {
  24481. - unsigned char rates[NL80211_MAX_SUPP_RATES];
  24482. + unsigned char rates[WLAN_SUPP_RATES_MAX];
  24483. int mcast_rate;
  24484. + int ht_set;
  24485. + unsigned int htmode;
  24486. @@ -27,7 +27,7 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  24487. * bssid_hint - BSSID of a proposed AP
  24488. --- a/src/drivers/driver_nl80211.c
  24489. +++ b/src/drivers/driver_nl80211.c
  24490. -@@ -4456,6 +4456,22 @@ retry:
  24491. +@@ -4702,6 +4702,22 @@ retry:
  24492. nla_put_u32(msg, NL80211_ATTR_MCAST_RATE, params->mcast_rate);
  24493. }
  24494. @@ -52,7 +52,7 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  24495. goto fail;
  24496. --- a/wpa_supplicant/config.c
  24497. +++ b/wpa_supplicant/config.c
  24498. -@@ -1754,6 +1754,71 @@ static char * wpa_config_write_mcast_rat
  24499. +@@ -1848,6 +1848,71 @@ static char * wpa_config_write_mcast_rat
  24500. }
  24501. #endif /* NO_CONFIG_WRITE */
  24502. @@ -124,7 +124,7 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  24503. static int wpa_config_parse_rates(const struct parse_data *data,
  24504. struct wpa_ssid *ssid, int line,
  24505. const char *value)
  24506. -@@ -2042,6 +2107,7 @@ static const struct parse_data ssid_fiel
  24507. +@@ -2142,6 +2207,7 @@ static const struct parse_data ssid_fiel
  24508. { INT_RANGE(fixed_freq, 0, 1) },
  24509. { FUNC(rates) },
  24510. { FUNC(mcast_rate) },
  24511. @@ -134,9 +134,9 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  24512. #endif /* CONFIG_MACSEC */
  24513. --- a/wpa_supplicant/config_ssid.h
  24514. +++ b/wpa_supplicant/config_ssid.h
  24515. -@@ -678,6 +678,8 @@ struct wpa_ssid {
  24516. +@@ -715,6 +715,8 @@ struct wpa_ssid {
  24517. - unsigned char rates[NL80211_MAX_SUPP_RATES];
  24518. + unsigned char rates[WLAN_SUPP_RATES_MAX];
  24519. double mcast_rate;
  24520. + int ht_set;
  24521. + unsigned int htmode;
  24522. @@ -145,7 +145,7 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  24523. /**
  24524. --- a/wpa_supplicant/wpa_supplicant.c
  24525. +++ b/wpa_supplicant/wpa_supplicant.c
  24526. -@@ -2273,6 +2273,8 @@ static void wpas_start_assoc_cb(struct w
  24527. +@@ -2525,6 +2525,8 @@ static void wpas_start_assoc_cb(struct w
  24528. i++;
  24529. }
  24530. params.mcast_rate = ssid->mcast_rate;
  24531. diff --git a/package/network/services/hostapd/patches/470-survey_data_fallback.patch b/package/network/services/hostapd/patches/470-survey_data_fallback.patch
  24532. new file mode 100644
  24533. index 0000000..4e40a87
  24534. --- /dev/null
  24535. +++ b/package/network/services/hostapd/patches/470-survey_data_fallback.patch
  24536. @@ -0,0 +1,45 @@
  24537. +--- a/src/ap/acs.c
  24538. ++++ b/src/ap/acs.c
  24539. +@@ -292,18 +292,12 @@ static void acs_fail(struct hostapd_ifac
  24540. + static long double
  24541. + acs_survey_interference_factor(struct freq_survey *survey, s8 min_nf)
  24542. + {
  24543. +- long double factor, busy, total;
  24544. ++ long double factor, busy = 0, total;
  24545. +
  24546. + if (survey->filled & SURVEY_HAS_CHAN_TIME_BUSY)
  24547. + busy = survey->channel_time_busy;
  24548. + else if (survey->filled & SURVEY_HAS_CHAN_TIME_RX)
  24549. + busy = survey->channel_time_rx;
  24550. +- else {
  24551. +- /* This shouldn't really happen as survey data is checked in
  24552. +- * acs_sanity_check() */
  24553. +- wpa_printf(MSG_ERROR, "ACS: Survey data missing");
  24554. +- return 0;
  24555. +- }
  24556. +
  24557. + total = survey->channel_time;
  24558. +
  24559. +@@ -395,20 +389,19 @@ static int acs_usable_vht80_chan(struct
  24560. + static int acs_survey_is_sufficient(struct freq_survey *survey)
  24561. + {
  24562. + if (!(survey->filled & SURVEY_HAS_NF)) {
  24563. ++ survey->nf = -95;
  24564. + wpa_printf(MSG_INFO, "ACS: Survey is missing noise floor");
  24565. +- return 0;
  24566. + }
  24567. +
  24568. + if (!(survey->filled & SURVEY_HAS_CHAN_TIME)) {
  24569. ++ survey->channel_time = 0;
  24570. + wpa_printf(MSG_INFO, "ACS: Survey is missing channel time");
  24571. +- return 0;
  24572. + }
  24573. +
  24574. + if (!(survey->filled & SURVEY_HAS_CHAN_TIME_BUSY) &&
  24575. + !(survey->filled & SURVEY_HAS_CHAN_TIME_RX)) {
  24576. + wpa_printf(MSG_INFO,
  24577. + "ACS: Survey is missing RX and busy time (at least one is required)");
  24578. +- return 0;
  24579. + }
  24580. +
  24581. + return 1;
  24582. diff --git a/package/network/services/hostapd/patches/470-wait-for-nullfunc-longer.patch b/package/network/services/hostapd/patches/470-wait-for-nullfunc-longer.patch
  24583. deleted file mode 100644
  24584. index e6bbddd..0000000
  24585. --- a/package/network/services/hostapd/patches/470-wait-for-nullfunc-longer.patch
  24586. +++ /dev/null
  24587. @@ -1,11 +0,0 @@
  24588. ---- a/src/ap/sta_info.h
  24589. -+++ b/src/ap/sta_info.h
  24590. -@@ -179,7 +179,7 @@ struct sta_info {
  24591. - * AP_DISASSOC_DELAY seconds. Similarly, the station will be deauthenticated
  24592. - * after AP_DEAUTH_DELAY seconds has passed after disassociation. */
  24593. - #define AP_MAX_INACTIVITY (5 * 60)
  24594. --#define AP_DISASSOC_DELAY (1)
  24595. -+#define AP_DISASSOC_DELAY (3)
  24596. - #define AP_DEAUTH_DELAY (1)
  24597. - /* Number of seconds to keep STA entry with Authenticated flag after it has
  24598. - * been disassociated. */
  24599. diff --git a/package/network/services/hostapd/patches/600-ubus_support.patch b/package/network/services/hostapd/patches/600-ubus_support.patch
  24600. index df2eac8..feacdf2 100644
  24601. --- a/package/network/services/hostapd/patches/600-ubus_support.patch
  24602. +++ b/package/network/services/hostapd/patches/600-ubus_support.patch
  24603. @@ -1,6 +1,6 @@
  24604. --- a/hostapd/Makefile
  24605. +++ b/hostapd/Makefile
  24606. -@@ -121,6 +121,11 @@ OBJS += ../src/common/hw_features_common
  24607. +@@ -157,6 +157,11 @@ OBJS += ../src/common/hw_features_common
  24608. OBJS += ../src/eapol_auth/eapol_auth_sm.o
  24609. @@ -22,7 +22,7 @@
  24610. struct wpa_ctrl_dst;
  24611. struct radius_server_data;
  24612. -@@ -103,6 +104,7 @@ struct hostapd_data {
  24613. +@@ -118,6 +119,7 @@ struct hostapd_data {
  24614. struct hostapd_iface *iface;
  24615. struct hostapd_config *iconf;
  24616. struct hostapd_bss_config *conf;
  24617. @@ -30,7 +30,7 @@
  24618. int interface_added; /* virtual interface added for this BSS */
  24619. unsigned int started:1;
  24620. unsigned int disabled:1;
  24621. -@@ -286,6 +288,8 @@ struct hostapd_iface {
  24622. +@@ -323,6 +325,8 @@ struct hostapd_iface {
  24623. struct hostapd_config *conf;
  24624. char phy[16]; /* Name of the PHY (radio) */
  24625. @@ -41,10 +41,10 @@
  24626. HAPD_IFACE_DISABLED,
  24627. --- /dev/null
  24628. +++ b/src/ap/ubus.c
  24629. -@@ -0,0 +1,511 @@
  24630. +@@ -0,0 +1,536 @@
  24631. +/*
  24632. + * hostapd / ubus support
  24633. -+ * Copyright (c) 2013, Felix Fietkau <nbd@openwrt.org>
  24634. ++ * Copyright (c) 2013, Felix Fietkau <nbd@nbd.name>
  24635. + *
  24636. + * This software may be distributed under the terms of the BSD license.
  24637. + * See README for more details.
  24638. @@ -58,6 +58,8 @@
  24639. +#include "wps_hostapd.h"
  24640. +#include "sta_info.h"
  24641. +#include "ubus.h"
  24642. ++#include "ap_drv_ops.h"
  24643. ++#include "beacon.h"
  24644. +
  24645. +static struct ubus_context *ctx;
  24646. +static struct blob_buf b;
  24647. @@ -417,6 +419,10 @@
  24648. +{
  24649. + struct blob_attr *tb[__VENDOR_ELEMENTS_MAX];
  24650. + struct hostapd_data *hapd = get_hapd_from_object(obj);
  24651. ++ struct hostapd_bss_config *bss = hapd->conf;
  24652. ++ struct wpabuf *elems;
  24653. ++ const char *pos;
  24654. ++ size_t len;
  24655. +
  24656. + blobmsg_parse(ve_policy, __VENDOR_ELEMENTS_MAX, tb,
  24657. + blob_data(msg), blob_len(msg));
  24658. @@ -424,10 +430,29 @@
  24659. + if (!tb[VENDOR_ELEMENTS])
  24660. + return UBUS_STATUS_INVALID_ARGUMENT;
  24661. +
  24662. -+ const char *vendor_elements = blobmsg_data(tb[VENDOR_ELEMENTS]);
  24663. -+ if (hostapd_set_iface(hapd->iconf, hapd->conf, "vendor_elements",
  24664. -+ vendor_elements) != 0)
  24665. -+ return UBUS_STATUS_NOT_SUPPORTED;
  24666. ++ pos = blobmsg_data(tb[VENDOR_ELEMENTS]);
  24667. ++ len = os_strlen(pos);
  24668. ++ if (len & 0x01)
  24669. ++ return UBUS_STATUS_INVALID_ARGUMENT;
  24670. ++
  24671. ++ len /= 2;
  24672. ++ if (len == 0) {
  24673. ++ wpabuf_free(bss->vendor_elements);
  24674. ++ bss->vendor_elements = NULL;
  24675. ++ return 0;
  24676. ++ }
  24677. ++
  24678. ++ elems = wpabuf_alloc(len);
  24679. ++ if (elems == NULL)
  24680. ++ return 1;
  24681. ++
  24682. ++ if (hexstr2bin(pos, wpabuf_put(elems, len), len)) {
  24683. ++ wpabuf_free(elems);
  24684. ++ return UBUS_STATUS_INVALID_ARGUMENT;
  24685. ++ }
  24686. ++
  24687. ++ wpabuf_free(bss->vendor_elements);
  24688. ++ bss->vendor_elements = elems;
  24689. +
  24690. + /* update beacons if vendor elements were set successfully */
  24691. + if (ieee802_11_update_beacons(hapd->iface) != 0)
  24692. @@ -558,7 +583,7 @@
  24693. @@ -0,0 +1,78 @@
  24694. +/*
  24695. + * hostapd / ubus support
  24696. -+ * Copyright (c) 2013, Felix Fietkau <nbd@openwrt.org>
  24697. ++ * Copyright (c) 2013, Felix Fietkau <nbd@nbd.name>
  24698. + *
  24699. + * This software may be distributed under the terms of the BSD license.
  24700. + * See README for more details.
  24701. @@ -636,7 +661,7 @@
  24702. +#endif
  24703. --- a/src/ap/hostapd.c
  24704. +++ b/src/ap/hostapd.c
  24705. -@@ -277,6 +277,7 @@ static void hostapd_free_hapd_data(struc
  24706. +@@ -284,6 +284,7 @@ static void hostapd_free_hapd_data(struc
  24707. hapd->started = 0;
  24708. wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface);
  24709. @@ -644,7 +669,7 @@
  24710. iapp_deinit(hapd->iapp);
  24711. hapd->iapp = NULL;
  24712. accounting_deinit(hapd);
  24713. -@@ -1098,6 +1099,8 @@ static int hostapd_setup_bss(struct host
  24714. +@@ -1139,6 +1140,8 @@ static int hostapd_setup_bss(struct host
  24715. if (hapd->driver && hapd->driver->set_operstate)
  24716. hapd->driver->set_operstate(hapd->drv_priv, 1);
  24717. @@ -653,7 +678,7 @@
  24718. return 0;
  24719. }
  24720. -@@ -1384,6 +1387,7 @@ int hostapd_setup_interface_complete(str
  24721. +@@ -1664,6 +1667,7 @@ static int hostapd_setup_interface_compl
  24722. if (err)
  24723. goto fail;
  24724. @@ -661,15 +686,15 @@
  24725. wpa_printf(MSG_DEBUG, "Completing interface initialization");
  24726. if (iface->conf->channel) {
  24727. #ifdef NEED_AP_MLME
  24728. -@@ -1544,6 +1548,7 @@ dfs_offload:
  24729. +@@ -1844,6 +1848,7 @@ dfs_offload:
  24730. fail:
  24731. wpa_printf(MSG_ERROR, "Interface initialization failed");
  24732. + hostapd_ubus_free_iface(iface);
  24733. hostapd_set_state(iface, HAPD_IFACE_DISABLED);
  24734. wpa_msg(hapd->msg_ctx, MSG_INFO, AP_EVENT_DISABLED);
  24735. - if (iface->interfaces && iface->interfaces->terminate_on_error)
  24736. -@@ -1873,6 +1878,7 @@ void hostapd_interface_deinit_free(struc
  24737. + #ifdef CONFIG_FST
  24738. +@@ -2277,6 +2282,7 @@ void hostapd_interface_deinit_free(struc
  24739. (unsigned int) iface->conf->num_bss);
  24740. driver = iface->bss[0]->driver;
  24741. drv_priv = iface->bss[0]->drv_priv;
  24742. @@ -679,7 +704,7 @@
  24743. __func__, driver, drv_priv);
  24744. --- a/src/ap/ieee802_11.c
  24745. +++ b/src/ap/ieee802_11.c
  24746. -@@ -881,7 +881,8 @@ int auth_sae_init_committed(struct hosta
  24747. +@@ -980,7 +980,8 @@ int auth_sae_init_committed(struct hosta
  24748. static void handle_auth(struct hostapd_data *hapd,
  24749. @@ -689,7 +714,7 @@
  24750. {
  24751. u16 auth_alg, auth_transaction, status_code;
  24752. u16 resp = WLAN_STATUS_SUCCESS;
  24753. -@@ -897,6 +898,11 @@ static void handle_auth(struct hostapd_d
  24754. +@@ -996,6 +997,11 @@ static void handle_auth(struct hostapd_d
  24755. char *identity = NULL;
  24756. char *radius_cui = NULL;
  24757. u16 seq_ctrl;
  24758. @@ -699,9 +724,9 @@
  24759. + .frame_info = fi,
  24760. + };
  24761. - if (len < IEEE80211_HDRLEN + sizeof(mgmt->u.auth)) {
  24762. - wpa_printf(MSG_INFO, "handle_auth - too short payload (len=%lu)",
  24763. -@@ -983,6 +989,14 @@ static void handle_auth(struct hostapd_d
  24764. + os_memset(&vlan_id, 0, sizeof(vlan_id));
  24765. +
  24766. +@@ -1149,6 +1155,14 @@ static void handle_auth(struct hostapd_d
  24767. resp = WLAN_STATUS_UNSPECIFIED_FAILURE;
  24768. goto fail;
  24769. }
  24770. @@ -716,7 +741,7 @@
  24771. if (res == HOSTAPD_ACL_PENDING) {
  24772. wpa_printf(MSG_DEBUG, "Authentication frame from " MACSTR
  24773. " waiting for an external authentication",
  24774. -@@ -1694,13 +1708,18 @@ static void send_assoc_resp(struct hosta
  24775. +@@ -2033,13 +2047,18 @@ static u16 send_assoc_resp(struct hostap
  24776. static void handle_assoc(struct hostapd_data *hapd,
  24777. const struct ieee80211_mgmt *mgmt, size_t len,
  24778. @@ -724,7 +749,7 @@
  24779. + int reassoc, struct hostapd_frame_info *fi)
  24780. {
  24781. u16 capab_info, listen_interval, seq_ctrl, fc;
  24782. - u16 resp = WLAN_STATUS_SUCCESS;
  24783. + u16 resp = WLAN_STATUS_SUCCESS, reply_res;
  24784. const u8 *pos;
  24785. int left, i;
  24786. struct sta_info *sta;
  24787. @@ -736,9 +761,9 @@
  24788. if (len < IEEE80211_HDRLEN + (reassoc ? sizeof(mgmt->u.reassoc_req) :
  24789. sizeof(mgmt->u.assoc_req))) {
  24790. -@@ -1820,6 +1839,13 @@ static void handle_assoc(struct hostapd_
  24791. - goto fail;
  24792. +@@ -2159,6 +2178,13 @@ static void handle_assoc(struct hostapd_
  24793. }
  24794. + #endif /* CONFIG_MBO */
  24795. + if (hostapd_ubus_handle_event(hapd, &req)) {
  24796. + wpa_printf(MSG_DEBUG, "Station " MACSTR " assoc rejected by ubus handler.\n",
  24797. @@ -747,10 +772,10 @@
  24798. + goto fail;
  24799. + }
  24800. +
  24801. - sta->capability = capab_info;
  24802. - sta->listen_interval = listen_interval;
  24803. -
  24804. -@@ -2236,7 +2262,7 @@ int ieee802_11_mgmt(struct hostapd_data
  24805. + /*
  24806. + * sta->capability is used in check_assoc_ies() for RRM enabled
  24807. + * capability element.
  24808. +@@ -2639,7 +2665,7 @@ int ieee802_11_mgmt(struct hostapd_data
  24809. if (stype == WLAN_FC_STYPE_PROBE_REQ) {
  24810. @@ -759,7 +784,7 @@
  24811. return 1;
  24812. }
  24813. -@@ -2251,17 +2277,17 @@ int ieee802_11_mgmt(struct hostapd_data
  24814. +@@ -2657,17 +2683,17 @@ int ieee802_11_mgmt(struct hostapd_data
  24815. switch (stype) {
  24816. case WLAN_FC_STYPE_AUTH:
  24817. wpa_printf(MSG_DEBUG, "mgmt::auth");
  24818. @@ -782,7 +807,7 @@
  24819. case WLAN_FC_STYPE_DISASSOC:
  24820. --- a/src/ap/beacon.c
  24821. +++ b/src/ap/beacon.c
  24822. -@@ -542,7 +542,7 @@ static enum ssid_match_result ssid_match
  24823. +@@ -675,7 +675,7 @@ sta_track_seen_on(struct hostapd_iface *
  24824. void handle_probe_req(struct hostapd_data *hapd,
  24825. const struct ieee80211_mgmt *mgmt, size_t len,
  24826. @@ -791,22 +816,23 @@
  24827. {
  24828. u8 *resp;
  24829. struct ieee802_11_elems elems;
  24830. -@@ -550,8 +550,14 @@ void handle_probe_req(struct hostapd_dat
  24831. - size_t ie_len;
  24832. - struct sta_info *sta = NULL;
  24833. +@@ -684,9 +684,15 @@ void handle_probe_req(struct hostapd_dat
  24834. size_t i, resp_len;
  24835. -+ int ssi_signal = fi->ssi_signal;
  24836. int noack;
  24837. enum ssid_match_result res;
  24838. ++ int ssi_signal = fi->ssi_signal;
  24839. + int ret;
  24840. + u16 csa_offs[2];
  24841. + size_t csa_offs_len;
  24842. + struct hostapd_ubus_request req = {
  24843. + .type = HOSTAPD_UBUS_PROBE_REQ,
  24844. + .mgmt_frame = mgmt,
  24845. + .frame_info = fi,
  24846. + };
  24847. - ie = mgmt->u.probe_req.variable;
  24848. - if (len < IEEE80211_HDRLEN + sizeof(mgmt->u.probe_req))
  24849. -@@ -710,6 +716,12 @@ void handle_probe_req(struct hostapd_dat
  24850. + if (len < IEEE80211_HDRLEN)
  24851. + return;
  24852. +@@ -838,6 +844,12 @@ void handle_probe_req(struct hostapd_dat
  24853. }
  24854. #endif /* CONFIG_P2P */
  24855. @@ -832,7 +858,7 @@
  24856. int ieee802_11_update_beacons(struct hostapd_iface *iface);
  24857. --- a/src/ap/drv_callbacks.c
  24858. +++ b/src/ap/drv_callbacks.c
  24859. -@@ -49,6 +49,10 @@ int hostapd_notif_assoc(struct hostapd_d
  24860. +@@ -52,6 +52,10 @@ int hostapd_notif_assoc(struct hostapd_d
  24861. u16 reason = WLAN_REASON_UNSPECIFIED;
  24862. u16 status = WLAN_STATUS_SUCCESS;
  24863. const u8 *p2p_dev_addr = NULL;
  24864. @@ -843,9 +869,9 @@
  24865. if (addr == NULL) {
  24866. /*
  24867. -@@ -113,6 +117,12 @@ int hostapd_notif_assoc(struct hostapd_d
  24868. +@@ -124,6 +128,12 @@ int hostapd_notif_assoc(struct hostapd_d
  24869. + goto fail;
  24870. }
  24871. - sta->flags &= ~(WLAN_STA_WPS | WLAN_STA_MAYBE_WPS | WLAN_STA_WPS2);
  24872. + if (hostapd_ubus_handle_event(hapd, &req)) {
  24873. + wpa_printf(MSG_DEBUG, "Station " MACSTR " assoc rejected by ubus handler.\n",
  24874. diff --git a/package/network/utils/iw/Makefile b/package/network/utils/iw/Makefile
  24875. index ad82081..d17cbca 100644
  24876. --- a/package/network/utils/iw/Makefile
  24877. +++ b/package/network/utils/iw/Makefile
  24878. @@ -12,10 +12,10 @@ PKG_VERSION:=4.3
  24879. PKG_RELEASE:=1
  24880. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  24881. -PKG_SOURCE_URL:=https://www.kernel.org/pub/software/network/iw
  24882. +PKG_SOURCE_URL:=@KERNEL/software/network/iw
  24883. PKG_MD5SUM:=7adec72e91ebdd9c55429fa34a23a6f5
  24884. -PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  24885. +PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  24886. PKG_LICENSE:=GPL-2.0
  24887. include $(INCLUDE_DIR)/package.mk
  24888. diff --git a/package/network/utils/iw/patches/001-nl80211_h_sync.patch b/package/network/utils/iw/patches/001-nl80211_h_sync.patch
  24889. index 7de2258..e5ea8f7 100644
  24890. --- a/package/network/utils/iw/patches/001-nl80211_h_sync.patch
  24891. +++ b/package/network/utils/iw/patches/001-nl80211_h_sync.patch
  24892. @@ -8,7 +8,17 @@
  24893. *
  24894. * Permission to use, copy, modify, and/or distribute this software for any
  24895. * purpose with or without fee is hereby granted, provided that the above
  24896. -@@ -328,7 +329,15 @@
  24897. +@@ -321,14 +322,24 @@
  24898. + * @NL80211_CMD_GET_SCAN: get scan results
  24899. + * @NL80211_CMD_TRIGGER_SCAN: trigger a new scan with the given parameters
  24900. + * %NL80211_ATTR_TX_NO_CCK_RATE is used to decide whether to send the
  24901. +- * probe requests at CCK rate or not.
  24902. ++ * probe requests at CCK rate or not. %NL80211_ATTR_MAC can be used to
  24903. ++ * specify a BSSID to scan for; if not included, the wildcard BSSID will
  24904. ++ * be used.
  24905. + * @NL80211_CMD_NEW_SCAN_RESULTS: scan notification (as a reply to
  24906. + * NL80211_CMD_GET_SCAN and on the "scan" multicast group)
  24907. + * @NL80211_CMD_SCAN_ABORTED: scan was aborted, for unspecified reasons,
  24908. * partial scan results may be available
  24909. *
  24910. * @NL80211_CMD_START_SCHED_SCAN: start a scheduled scan at certain
  24911. @@ -25,7 +35,82 @@
  24912. * Like with normal scans, if SSIDs (%NL80211_ATTR_SCAN_SSIDS)
  24913. * are passed, they are used in the probe requests. For
  24914. * broadcast, a broadcast SSID must be passed (ie. an empty
  24915. -@@ -1761,6 +1770,22 @@ enum nl80211_commands {
  24916. +@@ -418,7 +429,11 @@
  24917. + * @NL80211_CMD_ASSOCIATE: association request and notification; like
  24918. + * NL80211_CMD_AUTHENTICATE but for Association and Reassociation
  24919. + * (similar to MLME-ASSOCIATE.request, MLME-REASSOCIATE.request,
  24920. +- * MLME-ASSOCIATE.confirm or MLME-REASSOCIATE.confirm primitives).
  24921. ++ * MLME-ASSOCIATE.confirm or MLME-REASSOCIATE.confirm primitives). The
  24922. ++ * %NL80211_ATTR_PREV_BSSID attribute is used to specify whether the
  24923. ++ * request is for the initial association to an ESS (that attribute not
  24924. ++ * included) or for reassociation within the ESS (that attribute is
  24925. ++ * included).
  24926. + * @NL80211_CMD_DEAUTHENTICATE: deauthentication request and notification; like
  24927. + * NL80211_CMD_AUTHENTICATE but for Deauthentication frames (similar to
  24928. + * MLME-DEAUTHENTICATION.request and MLME-DEAUTHENTICATE.indication
  24929. +@@ -468,6 +483,9 @@
  24930. + * set of BSSID,frequency parameters is used (i.e., either the enforcing
  24931. + * %NL80211_ATTR_MAC,%NL80211_ATTR_WIPHY_FREQ or the less strict
  24932. + * %NL80211_ATTR_MAC_HINT and %NL80211_ATTR_WIPHY_FREQ_HINT).
  24933. ++ * %NL80211_ATTR_PREV_BSSID can be used to request a reassociation within
  24934. ++ * the ESS in case the device is already associated and an association with
  24935. ++ * a different BSS is desired.
  24936. + * Background scan period can optionally be
  24937. + * specified in %NL80211_ATTR_BG_SCAN_PERIOD,
  24938. + * if not specified default background scan configuration
  24939. +@@ -811,6 +829,10 @@
  24940. + * as an event to indicate changes for devices with wiphy-specific regdom
  24941. + * management.
  24942. + *
  24943. ++ * @NL80211_CMD_ABORT_SCAN: Stop an ongoing scan. Returns -ENOENT if a scan is
  24944. ++ * not running. The driver indicates the status of the scan through
  24945. ++ * cfg80211_scan_done().
  24946. ++ *
  24947. + * @NL80211_CMD_MAX: highest used command number
  24948. + * @__NL80211_CMD_AFTER_LAST: internal use
  24949. + */
  24950. +@@ -997,6 +1019,8 @@ enum nl80211_commands {
  24951. +
  24952. + NL80211_CMD_WIPHY_REG_CHANGE,
  24953. +
  24954. ++ NL80211_CMD_ABORT_SCAN,
  24955. ++
  24956. + /* add new commands above here */
  24957. +
  24958. + /* used to define NL80211_CMD_MAX below */
  24959. +@@ -1270,8 +1294,11 @@ enum nl80211_commands {
  24960. + * @NL80211_ATTR_RESP_IE: (Re)association response information elements as
  24961. + * sent by peer, for ROAM and successful CONNECT events.
  24962. + *
  24963. +- * @NL80211_ATTR_PREV_BSSID: previous BSSID, to be used by in ASSOCIATE
  24964. +- * commands to specify using a reassociate frame
  24965. ++ * @NL80211_ATTR_PREV_BSSID: previous BSSID, to be used in ASSOCIATE and CONNECT
  24966. ++ * commands to specify a request to reassociate within an ESS, i.e., to use
  24967. ++ * Reassociate Request frame (with the value of this attribute in the
  24968. ++ * Current AP address field) instead of Association Request frame which is
  24969. ++ * used for the initial association to an ESS.
  24970. + *
  24971. + * @NL80211_ATTR_KEY: key information in a nested attribute with
  24972. + * %NL80211_KEY_* sub-attributes
  24973. +@@ -1712,6 +1739,8 @@ enum nl80211_commands {
  24974. + * underlying device supports these minimal RRM features:
  24975. + * %NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES,
  24976. + * %NL80211_FEATURE_QUIET,
  24977. ++ * Or, if global RRM is supported, see:
  24978. ++ * %NL80211_EXT_FEATURE_RRM
  24979. + * If this flag is used, driver must add the Power Capabilities IE to the
  24980. + * association request. In addition, it must also set the RRM capability
  24981. + * flag in the association request's Capability Info field.
  24982. +@@ -1755,12 +1784,44 @@ enum nl80211_commands {
  24983. + * over all channels.
  24984. + *
  24985. + * @NL80211_ATTR_SCHED_SCAN_DELAY: delay before the first cycle of a
  24986. +- * scheduled scan (or a WoWLAN net-detect scan) is started, u32
  24987. +- * in seconds.
  24988. ++ * scheduled scan is started. Or the delay before a WoWLAN
  24989. ++ * net-detect scan is started, counting from the moment the
  24990. ++ * system is suspended. This value is a u32, in seconds.
  24991. +
  24992. * @NL80211_ATTR_REG_INDOOR: flag attribute, if set indicates that the device
  24993. * is operating in an indoor environment.
  24994. *
  24995. @@ -41,6 +126,21 @@
  24996. + * thus it must not specify the number of iterations, only the interval
  24997. + * between scans. The scan plans are executed sequentially.
  24998. + * Each scan plan is a nested attribute of &enum nl80211_sched_scan_plan.
  24999. ++ * @NL80211_ATTR_PBSS: flag attribute. If set it means operate
  25000. ++ * in a PBSS. Specified in %NL80211_CMD_CONNECT to request
  25001. ++ * connecting to a PCP, and in %NL80211_CMD_START_AP to start
  25002. ++ * a PCP instead of AP. Relevant for DMG networks only.
  25003. ++ * @NL80211_ATTR_BSS_SELECT: nested attribute for driver supporting the
  25004. ++ * BSS selection feature. When used with %NL80211_CMD_GET_WIPHY it contains
  25005. ++ * attributes according &enum nl80211_bss_select_attr to indicate what
  25006. ++ * BSS selection behaviours are supported. When used with %NL80211_CMD_CONNECT
  25007. ++ * it contains the behaviour-specific attribute containing the parameters for
  25008. ++ * BSS selection to be done by driver and/or firmware.
  25009. ++ *
  25010. ++ * @NL80211_ATTR_STA_SUPPORT_P2P_PS: whether P2P PS mechanism supported
  25011. ++ * or not. u8, one of the values of &enum nl80211_sta_p2p_ps_status
  25012. ++ *
  25013. ++ * @NL80211_ATTR_PAD: attribute used for padding for 64-bit alignment
  25014. + *
  25015. + * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce
  25016. + * transmit power to stay within regulatory limits. u32, dBi.
  25017. @@ -48,7 +148,7 @@
  25018. * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  25019. * @NL80211_ATTR_MAX: highest attribute number currently defined
  25020. * @__NL80211_ATTR_AFTER_LAST: internal use
  25021. -@@ -2130,6 +2155,13 @@ enum nl80211_attrs {
  25022. +@@ -2130,6 +2191,21 @@ enum nl80211_attrs {
  25023. NL80211_ATTR_REG_INDOOR,
  25024. @@ -57,30 +157,147 @@
  25025. + NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS,
  25026. + NL80211_ATTR_SCHED_SCAN_PLANS,
  25027. +
  25028. ++ NL80211_ATTR_PBSS,
  25029. ++
  25030. ++ NL80211_ATTR_BSS_SELECT,
  25031. ++
  25032. ++ NL80211_ATTR_STA_SUPPORT_P2P_PS,
  25033. ++
  25034. ++ NL80211_ATTR_PAD,
  25035. ++
  25036. + NL80211_ATTR_WIPHY_ANTENNA_GAIN,
  25037. +
  25038. /* add attributes here, update the policy in nl80211.c */
  25039. __NL80211_ATTR_AFTER_LAST,
  25040. -@@ -3364,6 +3396,9 @@ enum nl80211_bss_scan_width {
  25041. +@@ -2273,6 +2349,20 @@ enum nl80211_sta_flags {
  25042. + NL80211_STA_FLAG_MAX = __NL80211_STA_FLAG_AFTER_LAST - 1
  25043. + };
  25044. +
  25045. ++/**
  25046. ++ * enum nl80211_sta_p2p_ps_status - station support of P2P PS
  25047. ++ *
  25048. ++ * @NL80211_P2P_PS_UNSUPPORTED: station doesn't support P2P PS mechanism
  25049. ++ * @@NL80211_P2P_PS_SUPPORTED: station supports P2P PS mechanism
  25050. ++ * @NUM_NL80211_P2P_PS_STATUS: number of values
  25051. ++ */
  25052. ++enum nl80211_sta_p2p_ps_status {
  25053. ++ NL80211_P2P_PS_UNSUPPORTED = 0,
  25054. ++ NL80211_P2P_PS_SUPPORTED,
  25055. ++
  25056. ++ NUM_NL80211_P2P_PS_STATUS,
  25057. ++};
  25058. ++
  25059. + #define NL80211_STA_FLAG_MAX_OLD_API NL80211_STA_FLAG_TDLS_PEER
  25060. +
  25061. + /**
  25062. +@@ -2430,6 +2520,9 @@ enum nl80211_sta_bss_param {
  25063. + * TID+1 and the special TID 16 (i.e. value 17) is used for non-QoS frames;
  25064. + * each one of those is again nested with &enum nl80211_tid_stats
  25065. + * attributes carrying the actual values.
  25066. ++ * @NL80211_STA_INFO_RX_DURATION: aggregate PPDU duration for all frames
  25067. ++ * received from the station (u64, usec)
  25068. ++ * @NL80211_STA_INFO_PAD: attribute used for padding for 64-bit alignment
  25069. + * @__NL80211_STA_INFO_AFTER_LAST: internal
  25070. + * @NL80211_STA_INFO_MAX: highest possible station info attribute
  25071. + */
  25072. +@@ -2466,6 +2559,8 @@ enum nl80211_sta_info {
  25073. + NL80211_STA_INFO_BEACON_RX,
  25074. + NL80211_STA_INFO_BEACON_SIGNAL_AVG,
  25075. + NL80211_STA_INFO_TID_STATS,
  25076. ++ NL80211_STA_INFO_RX_DURATION,
  25077. ++ NL80211_STA_INFO_PAD,
  25078. +
  25079. + /* keep last */
  25080. + __NL80211_STA_INFO_AFTER_LAST,
  25081. +@@ -2482,6 +2577,7 @@ enum nl80211_sta_info {
  25082. + * transmitted MSDUs (not counting the first attempt; u64)
  25083. + * @NL80211_TID_STATS_TX_MSDU_FAILED: number of failed transmitted
  25084. + * MSDUs (u64)
  25085. ++ * @NL80211_TID_STATS_PAD: attribute used for padding for 64-bit alignment
  25086. + * @NUM_NL80211_TID_STATS: number of attributes here
  25087. + * @NL80211_TID_STATS_MAX: highest numbered attribute here
  25088. + */
  25089. +@@ -2491,6 +2587,7 @@ enum nl80211_tid_stats {
  25090. + NL80211_TID_STATS_TX_MSDU,
  25091. + NL80211_TID_STATS_TX_MSDU_RETRIES,
  25092. + NL80211_TID_STATS_TX_MSDU_FAILED,
  25093. ++ NL80211_TID_STATS_PAD,
  25094. +
  25095. + /* keep last */
  25096. + NUM_NL80211_TID_STATS,
  25097. +@@ -2927,6 +3024,7 @@ enum nl80211_user_reg_hint_type {
  25098. + * transmitting data (on channel or globally)
  25099. + * @NL80211_SURVEY_INFO_TIME_SCAN: time the radio spent for scan
  25100. + * (on this channel or globally)
  25101. ++ * @NL80211_SURVEY_INFO_PAD: attribute used for padding for 64-bit alignment
  25102. + * @NL80211_SURVEY_INFO_MAX: highest survey info attribute number
  25103. + * currently defined
  25104. + * @__NL80211_SURVEY_INFO_AFTER_LAST: internal use
  25105. +@@ -2942,6 +3040,7 @@ enum nl80211_survey_info {
  25106. + NL80211_SURVEY_INFO_TIME_RX,
  25107. + NL80211_SURVEY_INFO_TIME_TX,
  25108. + NL80211_SURVEY_INFO_TIME_SCAN,
  25109. ++ NL80211_SURVEY_INFO_PAD,
  25110. +
  25111. + /* keep last */
  25112. + __NL80211_SURVEY_INFO_AFTER_LAST,
  25113. +@@ -3364,6 +3463,10 @@ enum nl80211_bss_scan_width {
  25114. * (not present if no beacon frame has been received yet)
  25115. * @NL80211_BSS_PRESP_DATA: the data in @NL80211_BSS_INFORMATION_ELEMENTS and
  25116. * @NL80211_BSS_TSF is known to be from a probe response (flag attribute)
  25117. + * @NL80211_BSS_LAST_SEEN_BOOTTIME: CLOCK_BOOTTIME timestamp when this entry
  25118. + * was last updated by a received frame. The value is expected to be
  25119. + * accurate to about 10ms. (u64, nanoseconds)
  25120. ++ * @NL80211_BSS_PAD: attribute used for padding for 64-bit alignment
  25121. * @__NL80211_BSS_AFTER_LAST: internal
  25122. * @NL80211_BSS_MAX: highest BSS attribute
  25123. */
  25124. -@@ -3383,6 +3418,7 @@ enum nl80211_bss {
  25125. +@@ -3383,6 +3486,8 @@ enum nl80211_bss {
  25126. NL80211_BSS_CHAN_WIDTH,
  25127. NL80211_BSS_BEACON_TSF,
  25128. NL80211_BSS_PRESP_DATA,
  25129. + NL80211_BSS_LAST_SEEN_BOOTTIME,
  25130. ++ NL80211_BSS_PAD,
  25131. /* keep last */
  25132. __NL80211_BSS_AFTER_LAST,
  25133. -@@ -4589,4 +4625,28 @@ enum nl80211_tdls_peer_capability {
  25134. +@@ -3568,11 +3673,15 @@ enum nl80211_txrate_gi {
  25135. + * @NL80211_BAND_2GHZ: 2.4 GHz ISM band
  25136. + * @NL80211_BAND_5GHZ: around 5 GHz band (4.9 - 5.7 GHz)
  25137. + * @NL80211_BAND_60GHZ: around 60 GHz band (58.32 - 64.80 GHz)
  25138. ++ * @NUM_NL80211_BANDS: number of bands, avoid using this in userspace
  25139. ++ * since newer kernel versions may support more bands
  25140. + */
  25141. + enum nl80211_band {
  25142. + NL80211_BAND_2GHZ,
  25143. + NL80211_BAND_5GHZ,
  25144. + NL80211_BAND_60GHZ,
  25145. ++
  25146. ++ NUM_NL80211_BANDS,
  25147. + };
  25148. +
  25149. + /**
  25150. +@@ -4358,12 +4467,18 @@ enum nl80211_feature_flags {
  25151. + /**
  25152. + * enum nl80211_ext_feature_index - bit index of extended features.
  25153. + * @NL80211_EXT_FEATURE_VHT_IBSS: This driver supports IBSS with VHT datarates.
  25154. ++ * @NL80211_EXT_FEATURE_RRM: This driver supports RRM. When featured, user can
  25155. ++ * can request to use RRM (see %NL80211_ATTR_USE_RRM) with
  25156. ++ * %NL80211_CMD_ASSOCIATE and %NL80211_CMD_CONNECT requests, which will set
  25157. ++ * the ASSOC_REQ_USE_RRM flag in the association request even if
  25158. ++ * NL80211_FEATURE_QUIET is not advertized.
  25159. + *
  25160. + * @NUM_NL80211_EXT_FEATURES: number of extended features.
  25161. + * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
  25162. + */
  25163. + enum nl80211_ext_feature_index {
  25164. + NL80211_EXT_FEATURE_VHT_IBSS,
  25165. ++ NL80211_EXT_FEATURE_RRM,
  25166. +
  25167. + /* add new features before the definition below */
  25168. + NUM_NL80211_EXT_FEATURES,
  25169. +@@ -4589,4 +4704,72 @@ enum nl80211_tdls_peer_capability {
  25170. NL80211_TDLS_PEER_WMM = 1<<2,
  25171. };
  25172. @@ -108,4 +325,48 @@
  25173. + __NL80211_SCHED_SCAN_PLAN_AFTER_LAST - 1
  25174. +};
  25175. +
  25176. ++/**
  25177. ++ * struct nl80211_bss_select_rssi_adjust - RSSI adjustment parameters.
  25178. ++ *
  25179. ++ * @band: band of BSS that must match for RSSI value adjustment.
  25180. ++ * @delta: value used to adjust the RSSI value of matching BSS.
  25181. ++ */
  25182. ++struct nl80211_bss_select_rssi_adjust {
  25183. ++ __u8 band;
  25184. ++ __s8 delta;
  25185. ++} __attribute__((packed));
  25186. ++
  25187. ++/**
  25188. ++ * enum nl80211_bss_select_attr - attributes for bss selection.
  25189. ++ *
  25190. ++ * @__NL80211_BSS_SELECT_ATTR_INVALID: reserved.
  25191. ++ * @NL80211_BSS_SELECT_ATTR_RSSI: Flag indicating only RSSI-based BSS selection
  25192. ++ * is requested.
  25193. ++ * @NL80211_BSS_SELECT_ATTR_BAND_PREF: attribute indicating BSS
  25194. ++ * selection should be done such that the specified band is preferred.
  25195. ++ * When there are multiple BSS-es in the preferred band, the driver
  25196. ++ * shall use RSSI-based BSS selection as a second step. The value of
  25197. ++ * this attribute is according to &enum nl80211_band (u32).
  25198. ++ * @NL80211_BSS_SELECT_ATTR_RSSI_ADJUST: When present the RSSI level for
  25199. ++ * BSS-es in the specified band is to be adjusted before doing
  25200. ++ * RSSI-based BSS selection. The attribute value is a packed structure
  25201. ++ * value as specified by &struct nl80211_bss_select_rssi_adjust.
  25202. ++ * @NL80211_BSS_SELECT_ATTR_MAX: highest bss select attribute number.
  25203. ++ * @__NL80211_BSS_SELECT_ATTR_AFTER_LAST: internal use.
  25204. ++ *
  25205. ++ * One and only one of these attributes are found within %NL80211_ATTR_BSS_SELECT
  25206. ++ * for %NL80211_CMD_CONNECT. It specifies the required BSS selection behaviour
  25207. ++ * which the driver shall use.
  25208. ++ */
  25209. ++enum nl80211_bss_select_attr {
  25210. ++ __NL80211_BSS_SELECT_ATTR_INVALID,
  25211. ++ NL80211_BSS_SELECT_ATTR_RSSI,
  25212. ++ NL80211_BSS_SELECT_ATTR_BAND_PREF,
  25213. ++ NL80211_BSS_SELECT_ATTR_RSSI_ADJUST,
  25214. ++
  25215. ++ /* keep last */
  25216. ++ __NL80211_BSS_SELECT_ATTR_AFTER_LAST,
  25217. ++ NL80211_BSS_SELECT_ATTR_MAX = __NL80211_BSS_SELECT_ATTR_AFTER_LAST - 1
  25218. ++};
  25219. ++
  25220. #endif /* __LINUX_NL80211_H */
  25221. 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
  25222. index 574c490..2cdf360 100644
  25223. --- a/package/network/utils/iw/patches/300-display_interface_TX_power.patch
  25224. +++ b/package/network/utils/iw/patches/300-display_interface_TX_power.patch
  25225. @@ -12,11 +12,9 @@ Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  25226. interface.c | 7 +++++++
  25227. 1 file changed, 7 insertions(+)
  25228. -diff --git a/interface.c b/interface.c
  25229. -index 73ccecd..4f0821d 100644
  25230. --- a/interface.c
  25231. +++ b/interface.c
  25232. -@@ -368,6 +368,13 @@ static int print_iface_handler(struct nl_msg *msg, void *arg)
  25233. +@@ -368,6 +368,13 @@ static int print_iface_handler(struct nl
  25234. printf("\n");
  25235. }
  25236. diff --git a/package/network/utils/iw/patches/301-ibss_add_VHT80.patch b/package/network/utils/iw/patches/301-ibss_add_VHT80.patch
  25237. index 709fbb2..0627bcc 100644
  25238. --- a/package/network/utils/iw/patches/301-ibss_add_VHT80.patch
  25239. +++ b/package/network/utils/iw/patches/301-ibss_add_VHT80.patch
  25240. @@ -14,8 +14,6 @@ Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  25241. ibss.c | 49 +++++++++++++++++++++++++++++++++++++++++--------
  25242. 1 file changed, 41 insertions(+), 8 deletions(-)
  25243. -diff --git a/ibss.c b/ibss.c
  25244. -index 7a0b707..a99a262 100644
  25245. --- a/ibss.c
  25246. +++ b/ibss.c
  25247. @@ -16,6 +16,39 @@
  25248. @@ -58,7 +56,7 @@ index 7a0b707..a99a262 100644
  25249. static int join_ibss(struct nl80211_state *state,
  25250. struct nl_msg *msg,
  25251. int argc, char **argv,
  25252. -@@ -30,12 +63,8 @@ static int join_ibss(struct nl80211_state *state,
  25253. +@@ -30,12 +63,8 @@ static int join_ibss(struct nl80211_stat
  25254. int bintval;
  25255. int i;
  25256. unsigned long freq;
  25257. @@ -73,7 +71,7 @@ index 7a0b707..a99a262 100644
  25258. { .name = "HT20",
  25259. .width = NL80211_CHAN_WIDTH_20,
  25260. .freq1_diff = 0,
  25261. -@@ -60,6 +89,10 @@ static int join_ibss(struct nl80211_state *state,
  25262. +@@ -60,6 +89,10 @@ static int join_ibss(struct nl80211_stat
  25263. .width = NL80211_CHAN_WIDTH_10,
  25264. .freq1_diff = 0,
  25265. .chantype = -1 },
  25266. @@ -84,7 +82,7 @@ index 7a0b707..a99a262 100644
  25267. };
  25268. if (argc < 2)
  25269. -@@ -90,7 +123,7 @@ static int join_ibss(struct nl80211_state *state,
  25270. +@@ -90,7 +123,7 @@ static int join_ibss(struct nl80211_stat
  25271. NLA_PUT_U32(msg, NL80211_ATTR_CHANNEL_WIDTH,
  25272. chanmode_selected->width);
  25273. NLA_PUT_U32(msg, NL80211_ATTR_CENTER_FREQ1,
  25274. 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
  25275. index fc44427..f96d5ea 100644
  25276. --- a/package/network/utils/iw/patches/302-ibss_use_MHz_instead_MHZ.patch
  25277. +++ b/package/network/utils/iw/patches/302-ibss_use_MHz_instead_MHZ.patch
  25278. @@ -7,11 +7,9 @@ Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  25279. ibss.c | 8 ++++----
  25280. 1 file changed, 4 insertions(+), 4 deletions(-)
  25281. -diff --git a/ibss.c b/ibss.c
  25282. -index a99a262..23bda70 100644
  25283. --- a/ibss.c
  25284. +++ b/ibss.c
  25285. -@@ -81,15 +81,15 @@ static int join_ibss(struct nl80211_state *state,
  25286. +@@ -81,15 +81,15 @@ static int join_ibss(struct nl80211_stat
  25287. .width = NL80211_CHAN_WIDTH_20_NOHT,
  25288. .freq1_diff = 0,
  25289. .chantype = NL80211_CHAN_NO_HT },
  25290. diff --git a/package/network/utils/iw/patches/303-mesh_add_VHT80.patch b/package/network/utils/iw/patches/303-mesh_add_VHT80.patch
  25291. index fe8dc21..956b050 100644
  25292. --- a/package/network/utils/iw/patches/303-mesh_add_VHT80.patch
  25293. +++ b/package/network/utils/iw/patches/303-mesh_add_VHT80.patch
  25294. @@ -15,8 +15,6 @@ Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
  25295. util.c | 26 ++++++++++++++++++++++++++
  25296. 4 files changed, 43 insertions(+), 41 deletions(-)
  25297. -diff --git a/ibss.c b/ibss.c
  25298. -index 23bda70..ac06fc5 100644
  25299. --- a/ibss.c
  25300. +++ b/ibss.c
  25301. @@ -16,39 +16,6 @@
  25302. @@ -59,8 +57,6 @@ index 23bda70..ac06fc5 100644
  25303. static int join_ibss(struct nl80211_state *state,
  25304. struct nl_msg *msg,
  25305. int argc, char **argv,
  25306. -diff --git a/iw.h b/iw.h
  25307. -index cef9da8..8e1a37a 100644
  25308. --- a/iw.h
  25309. +++ b/iw.h
  25310. @@ -59,6 +59,13 @@ struct cmd {
  25311. @@ -77,7 +73,7 @@ index cef9da8..8e1a37a 100644
  25312. #define ARRAY_SIZE(ar) (sizeof(ar)/sizeof(ar[0]))
  25313. #define DIV_ROUND_UP(x, y) (((x) + (y - 1)) / (y))
  25314. -@@ -174,6 +181,8 @@ void print_ies(unsigned char *ie, int ielen, bool unknown,
  25315. +@@ -174,6 +181,8 @@ void print_ies(unsigned char *ie, int ie
  25316. void parse_bitrate(struct nlattr *bitrate_attr, char *buf, int buflen);
  25317. void iw_hexdump(const char *prefix, const __u8 *data, size_t len);
  25318. @@ -86,11 +82,9 @@ index cef9da8..8e1a37a 100644
  25319. #define SCHED_SCAN_OPTIONS "interval <in_msecs> [delay <in_secs>] " \
  25320. "[freqs <freq>+] [matches [ssid <ssid>]+]] [active [ssid <ssid>]+|passive] [randomise[=<addr>/<mask>]]"
  25321. int parse_sched_scan(struct nl_msg *msg, int *argc, char ***argv);
  25322. -diff --git a/mesh.c b/mesh.c
  25323. -index 0090530..930d58f 100644
  25324. --- a/mesh.c
  25325. +++ b/mesh.c
  25326. -@@ -439,12 +439,8 @@ static int join_mesh(struct nl80211_state *state,
  25327. +@@ -439,12 +439,8 @@ static int join_mesh(struct nl80211_stat
  25328. int bintval, dtim_period, i, n_rates = 0;
  25329. char *end, *value = NULL, *sptr = NULL;
  25330. unsigned long freq = 0;
  25331. @@ -105,7 +99,7 @@ index 0090530..930d58f 100644
  25332. { .name = "HT20",
  25333. .width = NL80211_CHAN_WIDTH_20,
  25334. .freq1_diff = 0,
  25335. -@@ -461,6 +457,10 @@ static int join_mesh(struct nl80211_state *state,
  25336. +@@ -461,6 +457,10 @@ static int join_mesh(struct nl80211_stat
  25337. .width = NL80211_CHAN_WIDTH_20_NOHT,
  25338. .freq1_diff = 0,
  25339. .chantype = NL80211_CHAN_NO_HT },
  25340. @@ -116,7 +110,7 @@ index 0090530..930d58f 100644
  25341. };
  25342. if (argc < 1)
  25343. -@@ -497,7 +497,7 @@ static int join_mesh(struct nl80211_state *state,
  25344. +@@ -497,7 +497,7 @@ static int join_mesh(struct nl80211_stat
  25345. NLA_PUT_U32(msg, NL80211_ATTR_CHANNEL_WIDTH,
  25346. chanmode_selected->width);
  25347. NLA_PUT_U32(msg, NL80211_ATTR_CENTER_FREQ1,
  25348. @@ -125,7 +119,7 @@ index 0090530..930d58f 100644
  25349. if (chanmode_selected->chantype != -1)
  25350. NLA_PUT_U32(msg,
  25351. NL80211_ATTR_WIPHY_CHANNEL_TYPE,
  25352. -@@ -599,7 +599,7 @@ static int join_mesh(struct nl80211_state *state,
  25353. +@@ -599,7 +599,7 @@ static int join_mesh(struct nl80211_stat
  25354. nla_put_failure:
  25355. return -ENOBUFS;
  25356. }
  25357. @@ -134,11 +128,9 @@ index 0090530..930d58f 100644
  25358. " [basic-rates <rate in Mbps,rate2,...>]], [mcast-rate <rate in Mbps>]"
  25359. " [beacon-interval <time in TUs>] [dtim-period <value>]"
  25360. " [vendor_sync on|off] [<param>=<value>]*",
  25361. -diff --git a/util.c b/util.c
  25362. -index 4efc4c8..d75ffe0 100644
  25363. --- a/util.c
  25364. +++ b/util.c
  25365. -@@ -728,3 +728,29 @@ void iw_hexdump(const char *prefix, const __u8 *buf, size_t size)
  25366. +@@ -728,3 +728,29 @@ void iw_hexdump(const char *prefix, cons
  25367. }
  25368. printf("\n\n");
  25369. }
  25370. 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
  25371. index d382453..20bb06e 100644
  25372. --- a/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.c
  25373. +++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.c
  25374. @@ -39,6 +39,18 @@ __init void ap9x_pci_setup_wmac_led_pin(unsigned wmac, int pin)
  25375. }
  25376. }
  25377. +__init void ap9x_pci_setup_wmac_led_name(unsigned wmac, const char *led_name)
  25378. +{
  25379. + switch (wmac) {
  25380. + case 0:
  25381. + ap9x_wmac0_data.led_name = led_name;
  25382. + break;
  25383. + case 1:
  25384. + ap9x_wmac1_data.led_name = led_name;
  25385. + break;
  25386. + }
  25387. +}
  25388. +
  25389. __init struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac)
  25390. {
  25391. switch (wmac) {
  25392. @@ -81,6 +93,20 @@ __init void ap9x_pci_setup_wmac_leds(unsigned wmac, struct gpio_led *leds,
  25393. }
  25394. }
  25395. +__init void ap9x_pci_setup_wmac_btns(unsigned wmac,
  25396. + struct gpio_keys_button *btns,
  25397. + unsigned num_btns, unsigned poll_interval)
  25398. +{
  25399. + struct ath9k_platform_data *ap9x_wmac_data;
  25400. +
  25401. + if (!(ap9x_wmac_data = ap9x_pci_get_wmac_data(wmac)))
  25402. + return;
  25403. +
  25404. + ap9x_wmac_data->btns = btns;
  25405. + ap9x_wmac_data->num_btns = num_btns;
  25406. + ap9x_wmac_data->btn_poll_interval = poll_interval;
  25407. +}
  25408. +
  25409. static int ap91_pci_plat_dev_init(struct pci_dev *dev)
  25410. {
  25411. switch (PCI_SLOT(dev->devfn)) {
  25412. 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
  25413. index ad288cb..d7c0185 100644
  25414. --- a/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.h
  25415. +++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.h
  25416. @@ -12,6 +12,7 @@
  25417. #define _ATH79_DEV_AP9X_PCI_H
  25418. struct gpio_led;
  25419. +struct gpio_keys_button;
  25420. struct ath9k_platform_data;
  25421. #if defined(CONFIG_ATH79_DEV_AP9X_PCI)
  25422. @@ -19,6 +20,9 @@ void ap9x_pci_setup_wmac_led_pin(unsigned wmac, int pin);
  25423. void ap9x_pci_setup_wmac_gpio(unsigned wmac, u32 mask, u32 val);
  25424. void ap9x_pci_setup_wmac_leds(unsigned wmac, struct gpio_led *leds,
  25425. int num_leds);
  25426. +void ap9x_pci_setup_wmac_led_name(unsigned wmac, const char *led_name);
  25427. +void ap9x_pci_setup_wmac_btns(unsigned wmac, struct gpio_keys_button *btns,
  25428. + unsigned num_btns, unsigned poll_interval);
  25429. struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac);
  25430. void ap91_pci_init(u8 *cal_data, u8 *mac_addr);
  25431. @@ -33,6 +37,12 @@ static inline void ap9x_pci_setup_wmac_gpio(unsigned wmac,
  25432. static inline void ap9x_pci_setup_wmac_leds(unsigned wmac,
  25433. struct gpio_led *leds,
  25434. int num_leds) {}
  25435. +static inline void ap9x_pci_setup_wmac_led_name(unsigned wmac,
  25436. + const char *led_name) {}
  25437. +static inline void ap9x_pci_setup_wmac_btns(unsigned wmac,
  25438. + struct gpio_keys_button *btns,
  25439. + unsigned num_btns,
  25440. + unsigned poll_interval) {}
  25441. static inline struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac)
  25442. {
  25443. return NULL;
  25444. diff --git a/target/linux/generic/files/include/linux/ath9k_platform.h b/target/linux/generic/files/include/linux/ath9k_platform.h
  25445. index 30ce216..2c19f3b 100644
  25446. --- a/target/linux/generic/files/include/linux/ath9k_platform.h
  25447. +++ b/target/linux/generic/files/include/linux/ath9k_platform.h
  25448. @@ -31,6 +31,10 @@ struct ath9k_platform_data {
  25449. u32 gpio_mask;
  25450. u32 gpio_val;
  25451. + u32 bt_active_pin;
  25452. + u32 bt_priority_pin;
  25453. + u32 wlan_active_pin;
  25454. +
  25455. bool endian_check;
  25456. bool is_clk_25mhz;
  25457. bool tx_gain_buffalo;
  25458. @@ -45,6 +49,11 @@ struct ath9k_platform_data {
  25459. int num_leds;
  25460. const struct gpio_led *leds;
  25461. + const char *led_name;
  25462. +
  25463. + unsigned num_btns;
  25464. + const struct gpio_keys_button *btns;
  25465. + unsigned btn_poll_interval;
  25466. };
  25467. #endif /* _LINUX_ATH9K_PLATFORM_H */