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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894
  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. diff --git a/package/firmware/ath10k-firmware/Makefile b/package/firmware/ath10k-firmware/Makefile
  16. index b03d64491a554fafb72170eaa4fae171b5599835..624da6a1ed43ea37bbb3409b3dbe4b3af01263b5 100644
  17. --- a/package/firmware/ath10k-firmware/Makefile
  18. +++ b/package/firmware/ath10k-firmware/Makefile
  19. @@ -8,7 +8,7 @@
  20. include $(TOPDIR)/rules.mk
  21. PKG_NAME:=ath10k-firmware
  22. -PKG_SOURCE_VERSION:=77f72b5f7dd940386d9e619a17904987759b7186
  23. +PKG_SOURCE_VERSION:=b00eb8d30fbebb6a5047ccacefa8c37e072fca9c
  24. PKG_VERSION:=2014-11-13-$(PKG_SOURCE_VERSION)
  25. PKG_RELEASE:=1
  26. @@ -17,7 +17,7 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  27. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  28. PKG_SOURCE_URL:=https://github.com/kvalo/ath10k-firmware.git
  29. -PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  30. +PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  31. include $(INCLUDE_DIR)/package.mk
  32. @@ -28,14 +28,48 @@ define Package/ath10k-firmware-default
  33. CATEGORY:=Kernel modules
  34. SUBMENU:=$(WMENU)
  35. URL:=$(PKG_SOURCE_URL)
  36. + DEPENDS:=
  37. endef
  38. +define Package/ath10k-firmware-qca9887
  39. +$(Package/ath10k-firmware-default)
  40. + TITLE:=ath10k firmware for QCA9887 devices
  41. +endef
  42. +
  43. +QCA9887_REV:=3cce88e245f2d685e49411c4f80998f94baf67b8
  44. +QCA9887_FIRMWARE_FILE:=firmware-5.bin_10.2.4-1.0-00013
  45. +QCA9887_FIRMWARE_FILE_MD5:=bd9cdcbf49561c7176432a81c29e7e87
  46. +QCA9887_FIRMWARE_FILE_DL:=$(QCA9887_FIRMWARE_FILE).$(QCA9887_FIRMWARE_FILE_MD5)
  47. +QCA9887_BOARD_FILE:=board.bin
  48. +QCA9887_BOARD_FILE_MD5:=ebf3af10160c45373f19e0b8226b02ae
  49. +QCA9887_BOARD_FILE_DL:=$(QCA9887_BOARD_FILE).$(QCA9887_BOARD_FILE_MD5)
  50. +
  51. +define Download/ath10k-qca9887-firmware
  52. + URL:=https://github.com/kvalo/ath10k-firmware/raw/$(QCA9887_REV)/QCA9887/hw1.0/
  53. + URL_FILE:=$(QCA9887_FIRMWARE_FILE)
  54. + FILE:=$(QCA9887_FIRMWARE_FILE_DL)
  55. + MD5SUM:=$(QCA9887_FIRMWARE_FILE_MD5)
  56. +endef
  57. +$(eval $(call Download,ath10k-qca9887-firmware))
  58. +
  59. +define Download/ath10k-qca9887-board
  60. + URL:=https://github.com/kvalo/ath10k-firmware/raw/$(QCA9887_REV)/QCA9887/hw1.0/
  61. + URL_FILE:=$(QCA9887_BOARD_FILE)
  62. + FILE:=$(QCA9887_BOARD_FILE_DL)
  63. + MD5SUM:=$(QCA9887_BOARD_FILE_MD5)
  64. +endef
  65. +$(eval $(call Download,ath10k-qca9887-board))
  66. +
  67. define Package/ath10k-firmware-qca988x
  68. $(Package/ath10k-firmware-default)
  69. + DEFAULT:=PACKAGE_kmod-ath10k
  70. TITLE:=ath10k firmware for QCA988x devices
  71. endef
  72. QCA988X_FIRMWARE_FILE:=firmware-5.bin_10.2.4.97-1
  73. +QCA988X_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-16.1.bin-lede
  74. +QCA99X0_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-7.bin-lede.004
  75. +QCA9984_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-7.bin-lede.004
  76. define Download/ath10k-firmware-qca988x
  77. URL:=https://www.codeaurora.org/cgit/quic/qsdk/oss/firmware/ath10k-firmware/plain/10.2.4/
  78. @@ -44,11 +78,83 @@ define Download/ath10k-firmware-qca988x
  79. endef
  80. $(eval $(call Download,ath10k-firmware-qca988x))
  81. +define Download/ath10k-firmware-qca988x-ct
  82. + URL:=https://www.candelatech.com/downloads/
  83. + FILE:=$(QCA988X_FIRMWARE_FILE_CT)
  84. + MD5SUM:=d7e081e9782936ed544b78994c9133fb
  85. +endef
  86. +$(eval $(call Download,ath10k-firmware-qca988x-ct))
  87. +
  88. +define Download/ath10k-firmware-qca99x0-ct
  89. + URL:=https://www.candelatech.com/downloads/ath10k-10-4/
  90. + FILE:=$(QCA99X0_FIRMWARE_FILE_CT)
  91. + MD5SUM:=809bb9bf8a18ea218a8e1b9ffc0f8447
  92. +endef
  93. +$(eval $(call Download,ath10k-firmware-qca99x0-ct))
  94. +
  95. +define Download/ath10k-firmware-qca9984-ct
  96. + URL:=https://www.candelatech.com/downloads/ath10k-9984-10-4/
  97. + FILE:=$(QCA9984_FIRMWARE_FILE_CT)
  98. + MD5SUM:=924eb8ea30de11299b13e207469a3350
  99. +endef
  100. +$(eval $(call Download,ath10k-firmware-qca9984-ct))
  101. +
  102. define Package/ath10k-firmware-qca99x0
  103. $(Package/ath10k-firmware-default)
  104. TITLE:=ath10k firmware for QCA99x0 devices
  105. endef
  106. +define Package/ath10k-firmware-qca988x-ct
  107. +$(Package/ath10k-firmware-default)
  108. + TITLE:=ath10k CT 10.1 firmware for QCA988x devices
  109. +endef
  110. +
  111. +define Package/ath10k-firmware-qca988x-ct/description
  112. +Alternative ath10k firmware for QCA988X from Candela Technologies.
  113. +Enables IBSS and other features. See:
  114. +http://www.candelatech.com/ath10k-10.1.php
  115. +This firmware will NOT be used unless the standard ath10k-firmware-qca988x
  116. +is un-selected since the driver will try to load firmware-5.bin before
  117. +firmware-2.bin
  118. +endef
  119. +
  120. +define Package/ath10k-firmware-qca99x0-ct/description
  121. +Alternative ath10k firmware for QCA99x0 from Candela Technologies.
  122. +Enables IBSS and other features. See:
  123. +http://www.candelatech.com/ath10k-10.4.php
  124. +This firmware conflicts with the standard 99x0 firmware, so select only
  125. +one.
  126. +endef
  127. +
  128. +define Package/ath10k-firmware-qca9984-ct/description
  129. +Alternative ath10k firmware for QCA9984 from Candela Technologies.
  130. +Enables IBSS and other features. See:
  131. +http://www.candelatech.com/ath10k-10.4-9984.php
  132. +This firmware conflicts with the standard 9984 firmware, so select only
  133. +one.
  134. +endef
  135. +
  136. +define Package/ath10k-firmware-qca99x0/description
  137. +Standard ath10k firmware for QCA99x0 from QCA
  138. +This firmware conflicts with the CT 99x0 firmware, so select only
  139. +one.
  140. +endef
  141. +
  142. +define Package/ath10k-firmware-qca99x0-ct
  143. +$(Package/ath10k-firmware-default)
  144. + TITLE:=ath10k CT 10.4.3 firmware for QCA99x0 devices
  145. +endef
  146. +
  147. +define Package/ath10k-firmware-qca9984-ct
  148. +$(Package/ath10k-firmware-default)
  149. + TITLE:=ath10k CT 10.4.3 firmware for QCA9984 devices
  150. +endef
  151. +
  152. +define Package/ath10k-firmware-qca9984
  153. +$(Package/ath10k-firmware-default)
  154. + TITLE:=ath10k firmware for QCA9984 devices
  155. +endef
  156. +
  157. define Package/ath10k-firmware-qca6174
  158. $(Package/ath10k-firmware-default)
  159. TITLE:=ath10k firmware for QCA6174 devices
  160. @@ -58,8 +164,8 @@ QCA99X0_BOARD_REV:=ddcec9efd245da9365c474f513a855a55f3ac7fe
  161. QCA99X0_BOARD_FILE:=board-2.bin.$(QCA99X0_BOARD_REV)
  162. define Download/qca99x0-board
  163. - URL:=https://www.codeaurora.org/cgit/quic/qsdk/oss/firmware/ath10k-firmware/plain/ath10k/QCA99X0/hw2.0
  164. - URL_FILE:=board-2.bin?id=ddcec9efd245da9365c474f513a855a55f3ac7fe
  165. + URL:=https://source.codeaurora.org/quic/qsdk/oss/firmware/ath10k-firmware/plain/ath10k/QCA99X0/hw2.0
  166. + URL_FILE:=board-2.bin?id=$(QCA99X0_BOARD_REV)
  167. FILE:=$(QCA99X0_BOARD_FILE)
  168. MD5SUM:=a2b3c653c2363a5641200051d6333d0a
  169. endef
  170. @@ -69,6 +175,16 @@ define Build/Compile
  171. endef
  172. +define Package/ath10k-firmware-qca9887/install
  173. + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9887/hw1.0
  174. + $(INSTALL_DATA) \
  175. + $(DL_DIR)/$(QCA9887_FIRMWARE_FILE_DL) \
  176. + $(1)/lib/firmware/ath10k/QCA9887/hw1.0/firmware-5.bin
  177. + $(INSTALL_DATA) \
  178. + $(DL_DIR)/$(QCA9887_BOARD_FILE_DL) \
  179. + $(1)/lib/firmware/ath10k/QCA9887/hw1.0/board.bin
  180. +endef
  181. +
  182. define Package/ath10k-firmware-qca988x/install
  183. $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA988X/hw2.0
  184. $(INSTALL_DATA) \
  185. @@ -79,6 +195,16 @@ define Package/ath10k-firmware-qca988x/install
  186. $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-5.bin
  187. endef
  188. +define Package/ath10k-firmware-qca988x-ct/install
  189. + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA988X/hw2.0
  190. + $(INSTALL_DATA) \
  191. + $(PKG_BUILD_DIR)/QCA988X/board.bin \
  192. + $(1)/lib/firmware/ath10k/QCA988X/hw2.0/
  193. + $(INSTALL_DATA) \
  194. + $(DL_DIR)/$(QCA988X_FIRMWARE_FILE_CT) \
  195. + $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-2.bin
  196. +endef
  197. +
  198. define Package/ath10k-firmware-qca6174/install
  199. $(INSTALL_DIR) $(1)/lib/firmware/ath10k
  200. $(CP) $(PKG_BUILD_DIR)/QCA6174 $(1)/lib/firmware/ath10k/
  201. @@ -97,6 +223,51 @@ define Package/ath10k-firmware-qca99x0/install
  202. $(1)/lib/firmware/ath10k/QCA99X0/hw2.0/firmware-5.bin
  203. endef
  204. +define Package/ath10k-firmware-qca99x0-ct/install
  205. + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA99X0/hw2.0
  206. + $(INSTALL_DATA) \
  207. + $(DL_DIR)/$(QCA99X0_BOARD_FILE) \
  208. + $(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board-2.bin
  209. + $(INSTALL_DATA) \
  210. + $(PKG_BUILD_DIR)/QCA99X0/hw2.0/boardData_AR900B_CUS239_5G_v2_001.bin \
  211. + $(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board.bin
  212. + $(INSTALL_DATA) \
  213. + $(DL_DIR)/$(QCA99X0_FIRMWARE_FILE_CT) \
  214. + $(1)/lib/firmware/ath10k/QCA99X0/hw2.0/firmware-5.bin
  215. +endef
  216. +
  217. +define Package/ath10k-firmware-qca9984/install
  218. + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9984/hw1.0
  219. + ln -s \
  220. + ../../cal-pci-0000:01:00.0.bin \
  221. + $(1)/lib/firmware/ath10k/QCA9984/hw1.0/board.bin
  222. + $(INSTALL_DATA) \
  223. + $(PKG_BUILD_DIR)/QCA9984/hw1.0/board-2.bin \
  224. + $(1)/lib/firmware/ath10k/QCA9984/hw1.0/board-2.bin
  225. + $(INSTALL_DATA) \
  226. + $(PKG_BUILD_DIR)/QCA9984/hw1.0/firmware-5.bin_10.4-3.2-00072 \
  227. + $(1)/lib/firmware/ath10k/QCA9984/hw1.0/firmware-5.bin
  228. +endef
  229. +
  230. +define Package/ath10k-firmware-qca9984-ct/install
  231. + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9984/hw1.0
  232. + ln -s \
  233. + ../../cal-pci-0000:01:00.0.bin \
  234. + $(1)/lib/firmware/ath10k/QCA9984/hw1.0/board.bin
  235. + $(INSTALL_DATA) \
  236. + $(PKG_BUILD_DIR)/QCA9984/hw1.0/board-2.bin \
  237. + $(1)/lib/firmware/ath10k/QCA9984/hw1.0/board-2.bin
  238. + $(INSTALL_DATA) \
  239. + $(DL_DIR)/$(QCA9984_FIRMWARE_FILE_CT) \
  240. + $(1)/lib/firmware/ath10k/QCA9984/hw1.0/firmware-5.bin
  241. +endef
  242. +
  243. +$(eval $(call BuildPackage,ath10k-firmware-qca9887))
  244. $(eval $(call BuildPackage,ath10k-firmware-qca988x))
  245. $(eval $(call BuildPackage,ath10k-firmware-qca99x0))
  246. $(eval $(call BuildPackage,ath10k-firmware-qca6174))
  247. +$(eval $(call BuildPackage,ath10k-firmware-qca9984))
  248. +
  249. +$(eval $(call BuildPackage,ath10k-firmware-qca988x-ct))
  250. +$(eval $(call BuildPackage,ath10k-firmware-qca99x0-ct))
  251. +$(eval $(call BuildPackage,ath10k-firmware-qca9984-ct))
  252. diff --git a/package/firmware/linux-firmware/Makefile b/package/firmware/linux-firmware/Makefile
  253. index 2fcd93b2ef104647a61c3aa40e2cef4404b1e484..ae5894cc56ff28271dff8871d640cc213c5c0107 100644
  254. --- a/package/firmware/linux-firmware/Makefile
  255. +++ b/package/firmware/linux-firmware/Makefile
  256. @@ -17,9 +17,9 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  257. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION)
  258. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
  259. PKG_SOURCE_URL:=git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
  260. -PKG_MIRROR_MD5SUM:=ca4d289ad9380471cae376fc7dd3660a
  261. +PKG_MIRROR_MD5SUM:=8d44332359de89b1936b4ff608a72614
  262. -PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  263. +PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  264. SCAN_DEPS = *.mk
  265. diff --git a/package/firmware/linux-firmware/realtek.mk b/package/firmware/linux-firmware/realtek.mk
  266. index 0f8b1ce75053713b25ea601fd56ad02c410861b7..4229ca0ebbaa1fe55c3e30be5769c0cc492084d6 100644
  267. --- a/package/firmware/linux-firmware/realtek.mk
  268. +++ b/package/firmware/linux-firmware/realtek.mk
  269. @@ -43,8 +43,15 @@ endef
  270. $(eval $(call BuildPackage,rtl8192de-firmware))
  271. Package/rtl8192se-firmware = $(call Package/firmware-default,RealTek RTL8192SE firmware)
  272. -define KernelPackage/rtl8192se/install
  273. +define Package/rtl8192se-firmware/install
  274. $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  275. $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8192sefw.bin $(1)/lib/firmware/rtlwifi
  276. endef
  277. $(eval $(call BuildPackage,rtl8192se-firmware))
  278. +
  279. +Package/rtl8192su-firmware = $(call Package/firmware-default,RealTek RTL8192SU firmware)
  280. +define Package/rtl8192su-firmware/install
  281. + $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  282. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8712u.bin $(1)/lib/firmware/rtlwifi
  283. +endef
  284. +$(eval $(call BuildPackage,rtl8192su-firmware))
  285. diff --git a/package/kernel/acx-mac80211/Makefile b/package/kernel/acx-mac80211/Makefile
  286. index 1820e7abb3ed5adbe74c1e9774b9c910d72d34eb..8fce374d2b99446d11e3bf56b2df014fdd9cbc9d 100644
  287. --- a/package/kernel/acx-mac80211/Makefile
  288. +++ b/package/kernel/acx-mac80211/Makefile
  289. @@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk
  290. include $(INCLUDE_DIR)/kernel.mk
  291. PKG_NAME:=acx-mac80211
  292. -PKG_REV:=v20130127
  293. -PKG_VERSION:=20130909
  294. +PKG_REV:=b6fc31491020cb01d2cd1acc170cfa03ced7e726
  295. +PKG_VERSION:=20140216
  296. PKG_RELEASE:=1
  297. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
  298. -PKG_SOURCE_URL:=git://acx100.git.sourceforge.net/gitroot/acx100/acx-mac80211
  299. +PKG_SOURCE_URL:=http://git.code.sf.net/p/acx100/acx-mac80211
  300. PKG_SOURCE_PROTO:=git
  301. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  302. PKG_SOURCE_VERSION:=$(PKG_REV)
  303. @@ -190,7 +190,7 @@ define Build/Compile
  304. CROSS_COMPILE="$(TARGET_CROSS)" \
  305. SUBDIRS="$(PKG_BUILD_DIR)" \
  306. $(PKG_EXTRA_KCONFIG) \
  307. - EXTRA_CFLAGS="$(PKG_EXTRA_CFLAGS) -DCONFIG_ACX_MAC80211_VERSION=\"KERNEL_VERSION(3,14,0)\"" \
  308. + EXTRA_CFLAGS="$(PKG_EXTRA_CFLAGS) -DCONFIG_ACX_MAC80211_VERSION=\"KERNEL_VERSION(4,2,0)\"" \
  309. LINUXINCLUDE="-I$(STAGING_DIR)/usr/include/mac80211-backport/uapi -I$(STAGING_DIR)/usr/include/mac80211-backport \
  310. -I$(STAGING_DIR)/usr/include/mac80211/uapi -I$(STAGING_DIR)/usr/include/mac80211 \
  311. -I$(LINUX_DIR)/include -I$(LINUX_DIR)/include/$(LINUX_UAPI_DIR) \
  312. 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
  313. deleted file mode 100644
  314. index fa4a6be6ab09ad9515ccc9595808a093aeac7ab2..0000000000000000000000000000000000000000
  315. --- a/package/kernel/acx-mac80211/patches/001-pci-mem-Fix-3.8-build.patch
  316. +++ /dev/null
  317. @@ -1,129 +0,0 @@
  318. -From 8a0f5890019bf43f4bc95ef0754b062ddfcfa9cd Mon Sep 17 00:00:00 2001
  319. -From: Oliver Winker <oliver@oli1170.net>
  320. -Date: Sun, 10 Mar 2013 21:04:23 +0100
  321. -Subject: [PATCH 1/3] pci, mem: Fix 3.8 build
  322. -
  323. -__devexit and __devinit not used anymore in 3.8
  324. -
  325. -Signed-off-by: Reinhard Karcher <reinhard.karcher@gmx.net>
  326. -Signed-off-by: Oliver Winker <oliver@oli1170.net>
  327. ----
  328. - mem.c | 13 ++++++++++++-
  329. - pci.c | 26 +++++++++++++++++++++++++-
  330. - 2 files changed, 37 insertions(+), 2 deletions(-)
  331. -
  332. ---- a/mem.c
  333. -+++ b/mem.c
  334. -@@ -2216,7 +2216,11 @@ int acx100mem_ioctl_set_phy_amp_bias(str
  335. - * ==================================================
  336. - */
  337. -
  338. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  339. - static int __devinit acxmem_probe(struct platform_device *pdev)
  340. -+#else
  341. -+static int acxmem_probe(struct platform_device *pdev)
  342. -+#endif
  343. - {
  344. - acx_device_t *adev = NULL;
  345. - const char *chip_name;
  346. -@@ -2392,7 +2396,11 @@ static int __devinit acxmem_probe(struct
  347. - * pdev - ptr to PCI device structure containing info about pci
  348. - * configuration
  349. - */
  350. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  351. - static int __devexit acxmem_remove(struct platform_device *pdev)
  352. -+#else
  353. -+static int acxmem_remove(struct platform_device *pdev)
  354. -+#endif
  355. - {
  356. - struct ieee80211_hw *hw = (struct ieee80211_hw *)
  357. - platform_get_drvdata(pdev);
  358. -@@ -2594,8 +2602,11 @@ static struct platform_driver acxmem_dri
  359. - .name = "acx-mem",
  360. - },
  361. - .probe = acxmem_probe,
  362. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  363. - .remove = __devexit_p(acxmem_remove),
  364. --
  365. -+#else
  366. -+ .remove = acxmem_remove,
  367. -+#endif
  368. - #ifdef CONFIG_PM
  369. - .suspend = acxmem_e_suspend,
  370. - .resume = acxmem_e_resume
  371. ---- a/pci.c
  372. -+++ b/pci.c
  373. -@@ -1039,7 +1039,11 @@ int acx100pci_ioctl_set_phy_amp_bias(str
  374. - * id - ptr to the device id entry that matched this device
  375. - */
  376. - #ifdef CONFIG_PCI
  377. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  378. - static int __devinit acxpci_probe(struct pci_dev *pdev,
  379. -+#else
  380. -+static int acxpci_probe(struct pci_dev *pdev,
  381. -+#endif
  382. - const struct pci_device_id *id)
  383. - {
  384. - unsigned long mem_region1 = 0;
  385. -@@ -1292,7 +1296,11 @@ static int __devinit acxpci_probe(struct
  386. - *
  387. - * pdev - ptr to PCI device structure containing info about pci configuration
  388. - */
  389. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  390. - static void __devexit acxpci_remove(struct pci_dev *pdev)
  391. -+#else
  392. -+static void acxpci_remove(struct pci_dev *pdev)
  393. -+#endif
  394. - {
  395. - struct ieee80211_hw *hw
  396. - = (struct ieee80211_hw *) pci_get_drvdata(pdev);
  397. -@@ -1505,7 +1513,11 @@ static struct pci_driver acxpci_driver =
  398. - .name = "acx_pci",
  399. - .id_table = acxpci_id_tbl,
  400. - .probe = acxpci_probe,
  401. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  402. - .remove = __devexit_p(acxpci_remove),
  403. -+#else
  404. -+ .remove = acxpci_remove,
  405. -+#endif
  406. - #ifdef CONFIG_PM
  407. - .suspend = acxpci_e_suspend,
  408. - .resume = acxpci_e_resume
  409. -@@ -1603,8 +1615,12 @@ static struct vlynq_device_id acx_vlynq_
  410. - };
  411. -
  412. -
  413. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  414. - static __devinit int vlynq_probe(struct vlynq_device *vdev,
  415. -- struct vlynq_device_id *id)
  416. -+#else
  417. -+static int vlynq_probe(struct vlynq_device *vdev,
  418. -+#endif
  419. -+ struct vlynq_device_id *id)
  420. - {
  421. - int result = -EIO, i;
  422. - u32 addr;
  423. -@@ -1785,7 +1801,11 @@ static __devinit int vlynq_probe(struct
  424. - return result;
  425. - }
  426. -
  427. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  428. - static __devexit void vlynq_remove(struct vlynq_device *vdev)
  429. -+#else
  430. -+static void vlynq_remove(struct vlynq_device *vdev)
  431. -+#endif
  432. - {
  433. - struct ieee80211_hw *hw = vlynq_get_drvdata(vdev);
  434. - acx_device_t *adev = hw2adev(hw);
  435. -@@ -1851,7 +1871,11 @@ static struct vlynq_driver acxvlynq_driv
  436. - .name = "acx_vlynq",
  437. - .id_table = acx_vlynq_id,
  438. - .probe = vlynq_probe,
  439. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  440. - .remove = __devexit_p(vlynq_remove),
  441. -+#else
  442. -+ .remove = vlynq_remove,
  443. -+#endif
  444. - };
  445. - #endif /* CONFIG_VLYNQ */
  446. -
  447. 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
  448. deleted file mode 100644
  449. index c73784465e0729863aeba1c51a64ee8069bc99d1..0000000000000000000000000000000000000000
  450. --- a/package/kernel/acx-mac80211/patches/003-Fix-3.10-build.patch
  451. +++ /dev/null
  452. @@ -1,31 +0,0 @@
  453. -From 1daf4bfdb072b08f3b4e412bbfa9645f88dc0a01 Mon Sep 17 00:00:00 2001
  454. -From: Oliver Winker <oliver@oli1170.net>
  455. -Date: Tue, 3 Sep 2013 20:36:36 +0200
  456. -Subject: [PATCH 3/3] Fix 3.10 build
  457. -
  458. -Signed-off-by: Reinhard Karcher <reinhard.karcher@gmx.net>
  459. -Signed-off-by: Oliver Winker <oliver@oli1170.net>
  460. ----
  461. - main.c | 7 +++++++
  462. - 1 file changed, 7 insertions(+)
  463. -
  464. ---- a/main.c
  465. -+++ b/main.c
  466. -@@ -682,10 +682,17 @@ int acx_op_config(struct ieee80211_hw *h
  467. -
  468. - if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
  469. - logf1(L_DEBUG, "IEEE80211_CONF_CHANGE_CHANNEL,"
  470. -+#if CONFIG_ACX_MAC80211_VERSION >= KERNEL_VERSION(3, 10, 0)
  471. -+ "channel->hw_value=%i\n", conf->chandef.chan->hw_value);
  472. -+
  473. -+ acx_set_channel(adev, conf->chandef.chan->hw_value,
  474. -+ conf->chandef.chan->center_freq);
  475. -+#else
  476. - "channel->hw_value=%i\n", conf->channel->hw_value);
  477. -
  478. - acx_set_channel(adev, conf->channel->hw_value,
  479. - conf->channel->center_freq);
  480. -+#endif
  481. -
  482. - changed_not_done &= ~IEEE80211_CONF_CHANGE_CHANNEL;
  483. - }
  484. 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
  485. deleted file mode 100644
  486. index 847b5731598caee82179813fcc9dea2d75ffdebd..0000000000000000000000000000000000000000
  487. --- a/package/kernel/acx-mac80211/patches/004-Fix-3.14-build.patch
  488. +++ /dev/null
  489. @@ -1,22 +0,0 @@
  490. -From d17fcac710e629463591f6bd09d76b66ec591583 Mon Sep 17 00:00:00 2001
  491. -From: Hauke Mehrtens <hauke@hauke-m.de>
  492. -Date: Wed, 5 Feb 2014 20:57:07 +0100
  493. -Subject: [PATCH] Fix 3.14 build
  494. -
  495. -Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
  496. ----
  497. - main.c | 2 ++
  498. - 1 file changed, 2 insertions(+)
  499. -
  500. ---- a/main.c
  501. -+++ b/main.c
  502. -@@ -500,7 +500,9 @@ int acx_init_ieee80211(acx_device_t *ade
  503. - hw->flags &= ~IEEE80211_HW_RX_INCLUDES_FCS;
  504. - hw->queues = 1;
  505. - hw->wiphy->max_scan_ssids = 1;
  506. -+#if CONFIG_ACX_MAC80211_VERSION < KERNEL_VERSION(3, 14, 0)
  507. - hw->channel_change_time = 10000;
  508. -+#endif
  509. -
  510. - /* OW TODO Check if RTS/CTS threshold can be included here */
  511. -
  512. diff --git a/package/kernel/acx-mac80211/patches/300-api_sync.patch b/package/kernel/acx-mac80211/patches/300-api_sync.patch
  513. new file mode 100644
  514. index 0000000000000000000000000000000000000000..94d61351aaaa530cc881448679219b28ab51888c
  515. --- /dev/null
  516. +++ b/package/kernel/acx-mac80211/patches/300-api_sync.patch
  517. @@ -0,0 +1,83 @@
  518. +--- a/main.c
  519. ++++ b/main.c
  520. +@@ -497,7 +497,7 @@ int acx_free_mechanics(acx_device_t *ade
  521. +
  522. + int acx_init_ieee80211(acx_device_t *adev, struct ieee80211_hw *hw)
  523. + {
  524. +- hw->flags &= ~IEEE80211_HW_RX_INCLUDES_FCS;
  525. ++ __clear_bit(IEEE80211_HW_RX_INCLUDES_FCS, hw->flags);
  526. + hw->queues = 1;
  527. + hw->wiphy->max_scan_ssids = 1;
  528. +
  529. +@@ -525,14 +525,14 @@ int acx_init_ieee80211(acx_device_t *ade
  530. + /* We base signal quality on winlevel approach of previous driver
  531. + * TODO OW 20100615 This should into a common init code
  532. + */
  533. +- hw->flags |= IEEE80211_HW_SIGNAL_UNSPEC;
  534. ++ __set_bit(IEEE80211_HW_SIGNAL_UNSPEC, hw->flags);
  535. + hw->max_signal = 100;
  536. +
  537. + if (IS_ACX100(adev)) {
  538. +- adev->hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
  539. ++ adev->hw->wiphy->bands[NL80211_BAND_2GHZ] =
  540. + &acx100_band_2GHz;
  541. + } else if (IS_ACX111(adev))
  542. +- adev->hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
  543. ++ adev->hw->wiphy->bands[NL80211_BAND_2GHZ] =
  544. + &acx111_band_2GHz;
  545. + else {
  546. + log(L_ANY, "Error: Unknown device");
  547. +@@ -945,8 +945,8 @@ void acx_op_configure_filter(struct ieee
  548. + changed_flags, *total_flags);
  549. +
  550. + /* OWI TODO: Set also FIF_PROBE_REQ ? */
  551. +- *total_flags &= (FIF_PROMISC_IN_BSS | FIF_ALLMULTI | FIF_FCSFAIL
  552. +- | FIF_CONTROL | FIF_OTHER_BSS);
  553. ++ *total_flags &= (FIF_ALLMULTI | FIF_FCSFAIL | FIF_CONTROL
  554. ++ | FIF_OTHER_BSS);
  555. +
  556. + logf1(L_DEBUG, "2: *total_flags=0x%08x\n", *total_flags);
  557. +
  558. +@@ -1045,9 +1045,10 @@ void acx_op_tx(struct ieee80211_hw *hw,
  559. + }
  560. +
  561. + int acx_op_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  562. +- struct cfg80211_scan_request *req)
  563. ++ struct ieee80211_scan_request *hw_req)
  564. + {
  565. + acx_device_t *adev = hw2adev(hw);
  566. ++ struct cfg80211_scan_request *req = &hw_req->req;
  567. + struct sk_buff *skb;
  568. + size_t ssid_len = 0;
  569. + u8 *ssid = NULL;
  570. +@@ -1082,7 +1083,7 @@ int acx_op_hw_scan(struct ieee80211_hw *
  571. + goto out;
  572. + }
  573. + #else
  574. +- skb = ieee80211_probereq_get(adev->hw, adev->vif, ssid, ssid_len,
  575. ++ skb = ieee80211_probereq_get(adev->hw, vif->addr, ssid, ssid_len,
  576. + req->ie_len);
  577. + if (!skb) {
  578. + ret = -ENOMEM;
  579. +--- a/main.h
  580. ++++ b/main.h
  581. +@@ -62,7 +62,7 @@ void acx_op_tx(struct ieee80211_hw *hw,
  582. + #endif
  583. +
  584. + int acx_op_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  585. +- struct cfg80211_scan_request *req);
  586. ++ struct ieee80211_scan_request *req);
  587. +
  588. + int acx_recover_hw(acx_device_t *adev);
  589. +
  590. +--- a/cardsetting.c
  591. ++++ b/cardsetting.c
  592. +@@ -159,7 +159,7 @@ int acx_set_channel(acx_device_t *adev,
  593. + int res = 0;
  594. +
  595. + adev->rx_status.freq = freq;
  596. +- adev->rx_status.band = IEEE80211_BAND_2GHZ;
  597. ++ adev->rx_status.band = NL80211_BAND_2GHZ;
  598. +
  599. + adev->channel = channel;
  600. +
  601. diff --git a/package/kernel/ath10k-ct/Makefile b/package/kernel/ath10k-ct/Makefile
  602. new file mode 100644
  603. index 0000000000000000000000000000000000000000..bbff8d8042ade849e467196056ca4ae1828dc3fe
  604. --- /dev/null
  605. +++ b/package/kernel/ath10k-ct/Makefile
  606. @@ -0,0 +1,80 @@
  607. +include $(TOPDIR)/rules.mk
  608. +
  609. +PKG_NAME:=ath10k-ct
  610. +PKG_VERSION:=2016-08-24
  611. +PKG_RELEASE=1
  612. +
  613. +PKG_LICENSE:=GPLv2
  614. +PKG_LICENSE_FILES:=
  615. +
  616. +PKG_SOURCE_URL:=https://github.com/greearb/ath10k-ct.git
  617. +PKG_SOURCE_PROTO:=git
  618. +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  619. +PKG_SOURCE_VERSION:=cd725d5465e1d4476a504794c541afeeba84b479
  620. +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
  621. +
  622. +PKG_MAINTAINER:=Ben Greear <greearb@candelatech.com>
  623. +PKG_BUILD_PARALLEL:=1
  624. +
  625. +STAMP_CONFIGURED_DEPENDS := $(STAGING_DIR)/usr/include/mac80211-backport/backport/autoconf.h
  626. +
  627. +include $(INCLUDE_DIR)/kernel.mk
  628. +include $(INCLUDE_DIR)/package.mk
  629. +
  630. +define KernelPackage/ath10k-ct
  631. + SUBMENU:=Wireless Drivers
  632. + TITLE:=ath10k-ct driver optimized for CT ath10k firmware
  633. + DEPENDS:=+kmod-mac80211 +kmod-ath +@DRIVER_11N_SUPPORT @PCI_SUPPORT +@KERNEL_RELAY
  634. + FILES:=\
  635. + $(PKG_BUILD_DIR)/ath10k/ath10k_pci.ko \
  636. + $(PKG_BUILD_DIR)/ath10k/ath10k_core.ko
  637. + AUTOLOAD:=$(call AutoLoad,50,mac80211 ath ath10k_core ath10k_pci)
  638. +endef
  639. +
  640. +NOSTDINC_FLAGS = \
  641. + -I$(PKG_BUILD_DIR) \
  642. + -I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \
  643. + -I$(STAGING_DIR)/usr/include/mac80211-backport \
  644. + -I$(STAGING_DIR)/usr/include/mac80211/uapi \
  645. + -I$(STAGING_DIR)/usr/include/mac80211 \
  646. + -include backport/autoconf.h \
  647. + -include backport/backport.h
  648. +
  649. +ifdef CONFIG_PACKAGE_MAC80211_MESH
  650. + NOSTDINC_FLAGS += -DCONFIG_MAC80211_MESH
  651. +endif
  652. +
  653. +CT_MAKEDEFS += CONFIG_ATH10K=m CONFIG_ATH10K_PCI=m
  654. +# No AHB support enabled yet. Could conditionally enable it later.
  655. +#CT_MAKEDEFS += CONFIG_ATH10K_AHB=y
  656. +#NOSTDINC_FLAGS += -DCONFIG_ATH10K_AHB
  657. +NOSTDINC_FLAGS += -DSTANDALONE_CT
  658. +
  659. +ifdef CONFIG_PACKAGE_MAC80211_DEBUGFS
  660. + CT_MAKEDEFS += CONFIG_ATH10K_DEBUGFS=y CONFIG_MAC80211_DEBUGFS=y
  661. + NOSTDINC_FLAGS += -DCONFIG_MAC80211_DEBUGFS
  662. + NOSTDINC_FLAGS += -DCONFIG_ATH10K_DEBUGFS
  663. +endif
  664. +
  665. +ifdef CONFIG_PACKAGE_ATH_DEBUG
  666. + NOSTDINC_FLAGS += -DCONFIG_ATH10K_DEBUG
  667. +endif
  668. +
  669. +define Build/Configure
  670. + cp $(STAGING_DIR)/usr/include/mac80211/ath/*.h $(PKG_BUILD_DIR)
  671. +endef
  672. +
  673. +ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
  674. + CT_MAKEDEFS += V=1
  675. +endif
  676. +
  677. +define Build/Compile
  678. + +$(MAKE) $(CT_MAKEDEFS) $(PKG_JOBS) -C "$(LINUX_DIR)" \
  679. + ARCH="$(LINUX_KARCH)" \
  680. + CROSS_COMPILE="$(TARGET_CROSS)" \
  681. + SUBDIRS="$(PKG_BUILD_DIR)/ath10k" \
  682. + NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \
  683. + modules
  684. +endef
  685. +
  686. +$(eval $(call KernelPackage,ath10k-ct))
  687. diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile
  688. index 30da1cfe250fd9cd630bf04e0c68cd7382355a2a..f2839cde2b1514f4342989b72e0baf1d79fddab2 100644
  689. --- a/package/kernel/mac80211/Makefile
  690. +++ b/package/kernel/mac80211/Makefile
  691. @@ -10,20 +10,21 @@ include $(INCLUDE_DIR)/kernel.mk
  692. PKG_NAME:=mac80211
  693. -PKG_VERSION:=2016-01-10
  694. +PKG_VERSION:=2016-06-20
  695. PKG_RELEASE:=1
  696. PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources
  697. PKG_BACKPORT_VERSION:=
  698. -PKG_MD5SUM:=be5fae2e8d6f7490f9b073374fb895ba
  699. +PKG_MD5SUM:=29c79bdc3928ef5113b17042ebda9237
  700. PKG_SOURCE:=compat-wireless-$(PKG_VERSION)$(PKG_BACKPORT_VERSION).tar.bz2
  701. PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/compat-wireless-$(PKG_VERSION)
  702. PKG_BUILD_PARALLEL:=1
  703. -PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  704. +PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  705. PKG_DRIVERS = \
  706. adm8211 \
  707. + airo \
  708. ath ath5k ath9k ath9k-common ath9k-htc ath10k \
  709. b43 b43legacy \
  710. carl9170 \
  711. @@ -52,6 +53,7 @@ PKG_CONFIG_DEPENDS:= \
  712. $(patsubst %,CONFIG_PACKAGE_kmod-%,$(PKG_DRIVERS)) \
  713. CONFIG_PACKAGE_MAC80211_DEBUGFS \
  714. CONFIG_PACKAGE_MAC80211_MESH \
  715. + CONFIG_PACKAGE_MAC80211_TRACING \
  716. CONFIG_PACKAGE_ATH_DEBUG \
  717. CONFIG_PACKAGE_ATH_DFS \
  718. CONFIG_PACKAGE_B43_DEBUG \
  719. @@ -63,7 +65,12 @@ PKG_CONFIG_DEPENDS:= \
  720. CONFIG_PACKAGE_B43_BUSES_BCMA_AND_SSB \
  721. CONFIG_PACKAGE_B43_BUSES_BCMA \
  722. CONFIG_PACKAGE_B43_BUSES_SSB \
  723. + CONFIG_PACKAGE_BRCM80211_DEBUG \
  724. + CONFIG_PACKAGE_IWLWIFI_DEBUG \
  725. + CONFIG_PACKAGE_IWLWIFI_DEBUGFS \
  726. CONFIG_PACKAGE_RTLWIFI_DEBUG \
  727. + CONFIG_ATH9K_SUPPORT_PCOEM \
  728. + CONFIG_ATH9K_TX99 \
  729. CONFIG_ATH_USER_REGD \
  730. include $(INCLUDE_DIR)/package.mk
  731. @@ -73,7 +80,7 @@ WMENU:=Wireless Drivers
  732. define KernelPackage/mac80211/Default
  733. SUBMENU:=$(WMENU)
  734. URL:=https://wireless.wiki.kernel.org/
  735. - MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  736. + MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  737. endef
  738. define KernelPackage/cfg80211
  739. @@ -92,7 +99,7 @@ endef
  740. define KernelPackage/mac80211
  741. $(call KernelPackage/mac80211/Default)
  742. TITLE:=Linux 802.11 Wireless Networking Stack
  743. - DEPENDS+= +kmod-cfg80211 +hostapd-common +kmod-crypto-core +kmod-crypto-arc4
  744. + DEPENDS+= +kmod-cfg80211 +hostapd-common
  745. KCONFIG:=\
  746. CONFIG_AVERAGE=y
  747. FILES:= $(PKG_BUILD_DIR)/net/mac80211/mac80211.ko
  748. @@ -138,10 +145,23 @@ define KernelPackage/adm8211
  749. AUTOLOAD:=$(call AutoProbe,adm8211)
  750. endef
  751. +define KernelPackage/airo
  752. + $(call KernelPackage/mac80211/Default)
  753. + TITLE:=Cisco Aironet driver
  754. + DEPENDS+=@PCI_SUPPORT +@DRIVER_WEXT_SUPPORT +kmod-cfg80211 @TARGET_x86
  755. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/cisco/airo.ko
  756. + AUTOLOAD:=$(call AutoProbe,airo)
  757. +endef
  758. +
  759. +define KernelPackage/airo/description
  760. + Kernel support for Cisco Aironet cards
  761. +endef
  762. +
  763. define KernelPackage/ath/config
  764. if PACKAGE_kmod-ath
  765. config ATH_USER_REGD
  766. bool "Force Atheros drivers to respect the user's regdomain settings"
  767. + default y
  768. help
  769. Atheros' idea of regulatory handling is that the EEPROM of the card defines
  770. the regulatory limits and the user is only allowed to restrict the settings
  771. @@ -199,6 +219,7 @@ define KernelPackage/ath9k-common
  772. $(call KernelPackage/mac80211/Default)
  773. TITLE:=Atheros 802.11n wireless devices (common code for ath9k and ath9k_htc)
  774. URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
  775. + HIDDEN:=1
  776. DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT +@KERNEL_RELAY
  777. FILES:= \
  778. $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_common.ko \
  779. @@ -226,6 +247,10 @@ define KernelPackage/ath9k/config
  780. bool "Support chips used in PC OEM cards"
  781. depends on PACKAGE_kmod-ath9k
  782. + config ATH9K_TX99
  783. + bool "Enable TX99 support"
  784. + depends on PACKAGE_kmod-ath9k
  785. +
  786. endef
  787. define KernelPackage/ath9k-htc
  788. @@ -247,7 +272,7 @@ define KernelPackage/ath10k
  789. $(call KernelPackage/mac80211/Default)
  790. TITLE:=Atheros 802.11ac wireless cards support
  791. URL:=https://wireless.wiki.kernel.org/en/users/Drivers/ath10k
  792. - DEPENDS+= @PCI_SUPPORT +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT +@KERNEL_RELAY +ath10k-firmware-qca988x
  793. + DEPENDS+= @PCI_SUPPORT +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT +@KERNEL_RELAY
  794. FILES:= \
  795. $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_core.ko \
  796. $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_pci.ko
  797. @@ -673,6 +698,7 @@ define KernelPackage/brcmfmac/config
  798. config BRCMFMAC_SDIO
  799. bool "Enable SDIO bus interface support"
  800. + default y if TARGET_brcm2708
  801. default n
  802. help
  803. Enable support for cards attached to an SDIO bus.
  804. @@ -761,7 +787,7 @@ endef
  805. define KernelPackage/iwlwifi
  806. $(call KernelPackage/mac80211/Default)
  807. - DEPENDS:= +kmod-mac80211 @PCI_SUPPORT +@DRIVER_11N_SUPPORT +iwlwifi-firmware
  808. + DEPENDS:= +kmod-mac80211 @PCI_SUPPORT +@DRIVER_11N_SUPPORT +iwlwifi-firmware @!LINUX_3_18
  809. TITLE:=Intel AGN Wireless support
  810. FILES:= \
  811. $(PKG_BUILD_DIR)/drivers/net/wireless/intel/iwlwifi/iwlwifi.ko \
  812. @@ -870,7 +896,7 @@ endef
  813. define KernelPackage/lib80211
  814. $(call KernelPackage/mac80211/Default)
  815. TITLE:=802.11 Networking stack
  816. - DEPENDS:=+kmod-cfg80211
  817. + DEPENDS:=+kmod-cfg80211 +kmod-crypto-hash
  818. FILES:= \
  819. $(PKG_BUILD_DIR)/net/wireless/lib80211.ko \
  820. $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_wep.ko \
  821. @@ -897,7 +923,7 @@ endef
  822. define KernelPackage/libipw
  823. $(call KernelPackage/mac80211/Default)
  824. TITLE:=libipw for ipw2100 and ipw2200
  825. - DEPENDS:=@PCI_SUPPORT +kmod-crypto-michael-mic +kmod-crypto-core +kmod-crypto-arc4 +kmod-lib80211 +kmod-cfg80211 +@DRIVER_WEXT_SUPPORT @!BIG_ENDIAN
  826. + DEPENDS:=@PCI_SUPPORT +kmod-crypto-michael-mic +kmod-lib80211 +kmod-cfg80211 +@DRIVER_WEXT_SUPPORT @!BIG_ENDIAN
  827. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intel/ipw2x00/libipw.ko
  828. AUTOLOAD:=$(call AutoProbe,libipw)
  829. endef
  830. @@ -978,7 +1004,7 @@ endef
  831. define KernelPackage/libertas-spi
  832. $(call KernelPackage/mac80211/Default)
  833. SUBMENU:=Wireless Drivers
  834. - DEPENDS+= +kmod-cfg80211 +kmod-lib80211 +@DRIVER_WEXT_SUPPORT +libertas-spi-firmware
  835. + DEPENDS+= +kmod-cfg80211 +kmod-lib80211 +@DRIVER_WEXT_SUPPORT @!TARGET_uml +libertas-spi-firmware
  836. KCONFIG := \
  837. CONFIG_SPI=y \
  838. CONFIG_SPI_MASTER=y
  839. @@ -1036,33 +1062,6 @@ define KernelPackage/mwifiex-pcie/description
  840. Kernel modules for Marvell 802.11n/802.11ac PCIe Wireless cards
  841. endef
  842. -
  843. -# Prism54 drivers
  844. -P54PCIFW:=2.13.12.0.arm
  845. -P54USBFW:=2.13.24.0.lm87.arm
  846. -P54SPIFW:=2.13.0.0.a.13.14.arm
  847. -
  848. -define Download/p54usb
  849. - FILE:=$(P54USBFW)
  850. - URL:=http://daemonizer.de/prism54/prism54-fw/fw-usb
  851. - MD5SUM:=8e8ab005a4f8f0123bcdc51bc25b47f6
  852. -endef
  853. -$(eval $(call Download,p54usb))
  854. -
  855. -define Download/p54pci
  856. - FILE:=$(P54PCIFW)
  857. - URL:=http://daemonizer.de/prism54/prism54-fw/fw-softmac
  858. - MD5SUM:=ff7536af2092b1c4b21315bd103ef4c4
  859. -endef
  860. -$(eval $(call Download,p54pci))
  861. -
  862. -define Download/p54spi
  863. - FILE:=$(P54SPIFW)
  864. - URL:=http://daemonizer.de/prism54/prism54-fw/stlc4560
  865. - MD5SUM:=42661f8ecbadd88012807493f596081d
  866. -endef
  867. -$(eval $(call Download,p54spi))
  868. -
  869. define KernelPackage/p54/Default
  870. $(call KernelPackage/mac80211/Default)
  871. TITLE:=Prism54 Drivers
  872. @@ -1082,7 +1081,7 @@ endef
  873. define KernelPackage/p54-pci
  874. $(call KernelPackage/p54/Default)
  875. TITLE+= (PCI)
  876. - DEPENDS+= @PCI_SUPPORT +kmod-p54-common
  877. + DEPENDS+= @PCI_SUPPORT +kmod-p54-common +p54-pci-firmware
  878. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/p54/p54pci.ko
  879. AUTOLOAD:=$(call AutoProbe,p54pci)
  880. endef
  881. @@ -1090,7 +1089,7 @@ endef
  882. define KernelPackage/p54-usb
  883. $(call KernelPackage/p54/Default)
  884. TITLE+= (USB)
  885. - DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-p54-common
  886. + DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-p54-common +p54-usb-firmware
  887. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/p54/p54usb.ko
  888. AUTOLOAD:=$(call AutoProbe,p54usb)
  889. endef
  890. @@ -1098,7 +1097,7 @@ endef
  891. define KernelPackage/p54-spi
  892. $(call KernelPackage/p54/Default)
  893. TITLE+= (SPI)
  894. - DEPENDS+= @TARGET_omap24xx +kmod-p54-common
  895. + DEPENDS+= @TARGET_omap24xx +kmod-p54-common +p54-spi-firmware
  896. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/p54/p54spi.ko
  897. AUTOLOAD:=$(call AutoProbe,p54spi)
  898. endef
  899. @@ -1453,6 +1452,7 @@ config-y:= \
  900. WLAN_VENDOR_ATH \
  901. WLAN_VENDOR_ATMEL \
  902. WLAN_VENDOR_BROADCOM \
  903. + WLAN_VENDOR_CISCO \
  904. WLAN_VENDOR_INTEL \
  905. WLAN_VENDOR_INTERSIL \
  906. WLAN_VENDOR_MARVELL \
  907. @@ -1491,6 +1491,8 @@ endif
  908. config-$(call config_package,lib80211) += LIB80211 LIB80211_CRYPT_WEP LIB80211_CRYPT_CCMP LIB80211_CRYPT_TKIP
  909. +config-$(call config_package,airo) += AIRO
  910. +
  911. config-$(call config_package,ath) += ATH_CARDS ATH_COMMON
  912. config-$(CONFIG_PACKAGE_ATH_DEBUG) += ATH_DEBUG ATH10K_DEBUG
  913. config-$(CONFIG_PACKAGE_ATH_DFS) += ATH9K_DFS_CERTIFIED ATH10K_DFS_CERTIFIED
  914. @@ -1501,6 +1503,7 @@ config-$(CONFIG_TARGET_ar71xx) += ATH9K_AHB
  915. config-$(CONFIG_PCI) += ATH9K_PCI
  916. config-$(CONFIG_ATH_USER_REGD) += ATH_USER_REGD
  917. config-$(CONFIG_ATH9K_SUPPORT_PCOEM) += ATH9K_PCOEM
  918. +config-$(CONFIG_ATH9K_TX99) += ATH9K_TX99
  919. config-$(call config_package,ath9k-htc) += ATH9K_HTC
  920. config-$(call config_package,ath10k) += ATH10K ATH10K_PCI
  921. @@ -1742,21 +1745,6 @@ define KernelPackage/ipw2200/install
  922. $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(IPW2200_NAME)-$(IPW2200_VERSION)/ipw2200*.fw $(1)/lib/firmware
  923. endef
  924. -define KernelPackage/p54-pci/install
  925. - $(INSTALL_DIR) $(1)/lib/firmware
  926. - $(INSTALL_DATA) $(DL_DIR)/$(P54PCIFW) $(1)/lib/firmware/isl3886pci
  927. -endef
  928. -
  929. -define KernelPackage/p54-usb/install
  930. - $(INSTALL_DIR) $(1)/lib/firmware
  931. - $(INSTALL_DATA) $(DL_DIR)/$(P54USBFW) $(1)/lib/firmware/isl3887usb
  932. -endef
  933. -
  934. -define KernelPackage/p54-spi/install
  935. - $(INSTALL_DIR) $(1)/lib/firmware
  936. - $(INSTALL_DATA) $(DL_DIR)/$(P54SPIFW) $(1)/lib/firmware/3826.arm
  937. -endef
  938. -
  939. define KernelPackage/zd1211rw/install
  940. $(INSTALL_DIR) $(1)/lib/firmware/zd1211
  941. $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(ZD1211FW_NAME)/zd1211* $(1)/lib/firmware/zd1211
  942. @@ -1764,6 +1752,7 @@ endef
  943. $(eval $(call KernelPackage,adm8211))
  944. +$(eval $(call KernelPackage,airo))
  945. $(eval $(call KernelPackage,ath))
  946. $(eval $(call KernelPackage,ath10k))
  947. $(eval $(call KernelPackage,ath5k))
  948. diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
  949. index fb2f928751a8c7dd282022d64be784cfcca4663b..e3d612e4b2f3d6dc1345bf71311fd31ee3649f1e 100644
  950. --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
  951. +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
  952. @@ -23,6 +23,7 @@ drv_mac80211_init_device_config() {
  953. config_add_int rxantenna txantenna antenna_gain txpower distance
  954. config_add_boolean noscan ht_coex
  955. config_add_array ht_capab
  956. + config_add_array channels
  957. config_add_boolean \
  958. rxldpc \
  959. short_gi_80 \
  960. @@ -89,6 +90,7 @@ mac80211_hostapd_setup_base() {
  961. json_select config
  962. [ "$auto_channel" -gt 0 ] && channel=acs_survey
  963. + [ "$auto_channel" -gt 0 ] && json_get_values channel_list channels
  964. json_get_vars noscan ht_coex
  965. json_get_values ht_capab_list ht_capab
  966. @@ -218,7 +220,6 @@ mac80211_hostapd_setup_base() {
  967. vht_max_a_mpdu_len_exp:7 \
  968. vht_max_mpdu:11454 \
  969. rx_stbc:4 \
  970. - tx_stbc:4 \
  971. vht_link_adapt:3 \
  972. vht160:2
  973. @@ -230,13 +231,13 @@ mac80211_hostapd_setup_base() {
  974. cap_rx_stbc=$((($vht_cap >> 8) & 7))
  975. [ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc="$rx_stbc"
  976. - ht_cap_mask="$(( ($vht_cap & ~(0x700)) | ($cap_rx_stbc << 8) ))"
  977. + vht_cap="$(( ($vht_cap & ~(0x700)) | ($cap_rx_stbc << 8) ))"
  978. mac80211_add_capabilities vht_capab $vht_cap \
  979. RXLDPC:0x10::$rxldpc \
  980. SHORT-GI-80:0x20::$short_gi_80 \
  981. SHORT-GI-160:0x40::$short_gi_160 \
  982. - TX-STBC-2BY1:0x80::$tx_stbc \
  983. + TX-STBC-2BY1:0x80::$tx_stbc_2by1 \
  984. SU-BEAMFORMER:0x800::$su_beamformer \
  985. SU-BEAMFORMEE:0x1000::$su_beamformee \
  986. MU-BEAMFORMER:0x80000::$mu_beamformer \
  987. @@ -245,10 +246,10 @@ mac80211_hostapd_setup_base() {
  988. HTC-VHT:0x400000::$htc_vht \
  989. RX-ANTENNA-PATTERN:0x10000000::$rx_antenna_pattern \
  990. TX-ANTENNA-PATTERN:0x20000000::$tx_antenna_pattern \
  991. - RX-STBC1:0x700:0x100:1 \
  992. - RX-STBC12:0x700:0x200:1 \
  993. - RX-STBC123:0x700:0x300:1 \
  994. - RX-STBC1234:0x700:0x400:1 \
  995. + RX-STBC-1:0x700:0x100:1 \
  996. + RX-STBC-12:0x700:0x200:1 \
  997. + RX-STBC-123:0x700:0x300:1 \
  998. + RX-STBC-1234:0x700:0x400:1 \
  999. # supported Channel widths
  1000. vht160_hw=0
  1001. @@ -301,6 +302,7 @@ mac80211_hostapd_setup_base() {
  1002. hostapd_prepare_device_config "$hostapd_conf_file" nl80211
  1003. cat >> "$hostapd_conf_file" <<EOF
  1004. ${channel:+channel=$channel}
  1005. +${channel_list:+chanlist=$channel_list}
  1006. ${noscan:+noscan=$noscan}
  1007. $base_cfg
  1008. @@ -391,11 +393,10 @@ mac80211_generate_mac() {
  1009. find_phy() {
  1010. [ -n "$phy" -a -d /sys/class/ieee80211/$phy ] && return 0
  1011. [ -n "$path" ] && {
  1012. - for phy in /sys/devices/$path/ieee80211/phy*; do
  1013. - [ -e "$phy" ] && {
  1014. - phy="${phy##*/}"
  1015. - return 0
  1016. - }
  1017. + for phy in $(ls /sys/class/ieee80211 2>/dev/null); do
  1018. + case "$(readlink -f /sys/class/ieee80211/$phy/device)" in
  1019. + *$path) return 0;;
  1020. + esac
  1021. done
  1022. }
  1023. [ -n "$macaddr" ] && {
  1024. @@ -481,7 +482,7 @@ mac80211_prepare_vif() {
  1025. # All interfaces must have unique mac addresses
  1026. # which can either be explicitly set in the device
  1027. # section, or automatically generated
  1028. - ifconfig "$ifname" hw ether "$macaddr"
  1029. + ip link set dev "$ifname" address "$macaddr"
  1030. fi
  1031. json_select ..
  1032. @@ -496,7 +497,7 @@ mac80211_setup_supplicant() {
  1033. mac80211_setup_adhoc_htmode() {
  1034. case "$htmode" in
  1035. VHT20|HT20) ibss_htmode=HT20;;
  1036. - HT40*|VHT40|VHT80|VHT160)
  1037. + HT40*|VHT40|VHT160)
  1038. case "$hwmode" in
  1039. a)
  1040. case "$(( ($channel / 4) % 2 ))" in
  1041. @@ -520,6 +521,9 @@ mac80211_setup_adhoc_htmode() {
  1042. esac
  1043. [ "$auto_channel" -gt 0 ] && ibss_htmode="HT40+"
  1044. ;;
  1045. + VHT80)
  1046. + ibss_htmode="80MHZ"
  1047. + ;;
  1048. NONE|NOHT)
  1049. ibss_htmode="NOHT"
  1050. ;;
  1051. @@ -580,7 +584,7 @@ mac80211_setup_vif() {
  1052. json_get_vars mode
  1053. json_get_var vif_txpower txpower
  1054. - ifconfig "$ifname" up || {
  1055. + ip link set dev "$ifname" up || {
  1056. wireless_setup_vif_failed IFUP_ERROR
  1057. json_select ..
  1058. return
  1059. @@ -643,7 +647,7 @@ mac80211_interface_cleanup() {
  1060. local phy="$1"
  1061. for wdev in $(list_phy_interfaces "$phy"); do
  1062. - ifconfig "$wdev" down 2>/dev/null
  1063. + ip link set dev "$wdev" down 2>/dev/null
  1064. iw dev "$wdev" del
  1065. done
  1066. }
  1067. diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
  1068. index ea229d6c03393d4673c733c99ead4c24ff92817d..06f3b8b449fbf482d42123fd3d21f8c5b0d315bf 100644
  1069. --- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh
  1070. +++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
  1071. @@ -9,11 +9,10 @@ lookup_phy() {
  1072. local devpath
  1073. config_get devpath "$device" path
  1074. [ -n "$devpath" ] && {
  1075. - for _phy in /sys/devices/$devpath/ieee80211/phy*; do
  1076. - [ -e "$_phy" ] && {
  1077. - phy="${_phy##*/}"
  1078. - return
  1079. - }
  1080. + for phy in $(ls /sys/class/ieee80211 2>/dev/null); do
  1081. + case "$(readlink -f /sys/class/ieee80211/$phy/device)" in
  1082. + *$devpath) return;;
  1083. + esac
  1084. done
  1085. }
  1086. @@ -102,6 +101,9 @@ detect_mac80211() {
  1087. fi
  1088. if [ -n "$path" ]; then
  1089. path="${path##/sys/devices/}"
  1090. + case "$path" in
  1091. + platform*/pci*) path="${path##platform/}";;
  1092. + esac
  1093. dev_id=" option path '$path'"
  1094. else
  1095. dev_id=" option macaddr $(cat /sys/class/ieee80211/${dev}/macaddress)"
  1096. 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
  1097. deleted file mode 100644
  1098. index 9adfd8f719805961fb06d4fc3bc104b668e4fd41..0000000000000000000000000000000000000000
  1099. --- a/package/kernel/mac80211/patches/004-backports-add-skb_free_frag.patch
  1100. +++ /dev/null
  1101. @@ -1,21 +0,0 @@
  1102. -From: Felix Fietkau <nbd@openwrt.org>
  1103. -Date: Thu, 28 Jan 2016 15:16:35 +0100
  1104. -Subject: [PATCH] backports: add skb_free_frag()
  1105. -
  1106. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  1107. ----
  1108. -
  1109. ---- a/backport-include/linux/skbuff.h
  1110. -+++ b/backport-include/linux/skbuff.h
  1111. -@@ -300,4 +300,11 @@ int skb_ensure_writable(struct sk_buff *
  1112. -
  1113. - #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) */
  1114. -
  1115. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
  1116. -+static inline void skb_free_frag(void *data)
  1117. -+{
  1118. -+ put_page(virt_to_head_page(data));
  1119. -+}
  1120. -+#endif
  1121. -+
  1122. - #endif /* __BACKPORT_SKBUFF_H */
  1123. diff --git a/package/kernel/mac80211/patches/004-fix_duplicate_skcipher_backport.patch b/package/kernel/mac80211/patches/004-fix_duplicate_skcipher_backport.patch
  1124. new file mode 100644
  1125. index 0000000000000000000000000000000000000000..38b31795a4ee0f3c5f0ad4895554117a63c2f037
  1126. --- /dev/null
  1127. +++ b/package/kernel/mac80211/patches/004-fix_duplicate_skcipher_backport.patch
  1128. @@ -0,0 +1,11 @@
  1129. +--- a/compat/Makefile
  1130. ++++ b/compat/Makefile
  1131. +@@ -35,8 +35,6 @@ compat-$(CPTCFG_KERNEL_4_6) += backport-
  1132. +
  1133. + compat-$(CPTCFG_BPAUTO_BUILD_CRYPTO_CCM) += crypto-ccm.o
  1134. + compat-$(CPTCFG_BPAUTO_CRYPTO_SKCIPHER) += crypto-skcipher.o
  1135. +-skcipher-objs += crypto-skcipher.o
  1136. +-obj-$(CPTCFG_BPAUTO_CRYPTO_SKCIPHER) += skcipher.o
  1137. + compat-$(CPTCFG_BPAUTO_BUILD_WANT_DEV_COREDUMP) += drivers-base-devcoredump.o
  1138. + compat-$(CPTCFG_BPAUTO_RHASHTABLE) += lib-rhashtable.o
  1139. + cordic-objs += lib-cordic.o
  1140. 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
  1141. new file mode 100644
  1142. index 0000000000000000000000000000000000000000..29bccc1e995f910ff6d1aeaf0829e9bdfe4f72d7
  1143. --- /dev/null
  1144. +++ b/package/kernel/mac80211/patches/005-backport_skb_get_hash_perturb.patch
  1145. @@ -0,0 +1,22 @@
  1146. +--- a/backport-include/linux/skbuff.h
  1147. ++++ b/backport-include/linux/skbuff.h
  1148. +@@ -305,6 +305,19 @@ static inline void skb_free_frag(void *d
  1149. + {
  1150. + put_page(virt_to_head_page(data));
  1151. + }
  1152. ++
  1153. ++#include <net/flow_keys.h>
  1154. ++#include <linux/jhash.h>
  1155. ++
  1156. ++static inline u32 skb_get_hash_perturb(struct sk_buff *skb, u32 key)
  1157. ++{
  1158. ++ struct flow_keys keys;
  1159. ++
  1160. ++ skb_flow_dissect(skb, &keys);
  1161. ++ return jhash_3words((__force u32)keys.dst,
  1162. ++ (__force u32)keys.src ^ keys.ip_proto,
  1163. ++ (__force u32)keys.ports, key);
  1164. ++}
  1165. + #endif
  1166. +
  1167. + #endif /* __BACKPORT_SKBUFF_H */
  1168. 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
  1169. deleted file mode 100644
  1170. index 9b672a8d14ec4e27c7d14bd6018059520ae8296c..0000000000000000000000000000000000000000
  1171. --- a/package/kernel/mac80211/patches/005-backports-add-napi_alloc_frag.patch
  1172. +++ /dev/null
  1173. @@ -1,20 +0,0 @@
  1174. -From: Felix Fietkau <nbd@openwrt.org>
  1175. -Date: Thu, 28 Jan 2016 15:19:22 +0100
  1176. -Subject: [PATCH] backports: add napi_alloc_frag
  1177. -
  1178. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  1179. ----
  1180. -
  1181. ---- a/backport-include/linux/netdevice.h
  1182. -+++ b/backport-include/linux/netdevice.h
  1183. -@@ -232,6 +232,10 @@ static inline void backport_unregister_n
  1184. - #define unregister_netdevice_many LINUX_BACKPORT(unregister_netdevice_many)
  1185. - #endif
  1186. -
  1187. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
  1188. -+#define napi_alloc_frag netdev_alloc_frag
  1189. -+#endif
  1190. -+
  1191. - /*
  1192. - * Complicated way of saying: We only backport netdev_rss_key stuff on kernels
  1193. - * that either already have net_get_random_once() (>= 3.13) or where we've been
  1194. diff --git a/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch b/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
  1195. index fd1e1cff3020078b5529982d5868ec65b8b4c9da..8be5fa15e92b747bfeedb3360b62cb139ae5257a 100644
  1196. --- a/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
  1197. +++ b/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
  1198. @@ -1,6 +1,6 @@
  1199. --- a/.local-symbols
  1200. +++ b/.local-symbols
  1201. -@@ -476,44 +476,6 @@ USB_IPHETH=
  1202. +@@ -481,45 +481,6 @@ USB_IPHETH=
  1203. USB_SIERRA_NET=
  1204. USB_VL600=
  1205. USB_NET_CH9200=
  1206. @@ -37,6 +37,7 @@
  1207. -BCMA_DRIVER_PCI=
  1208. -BCMA_DRIVER_PCI_HOSTMODE=
  1209. -BCMA_DRIVER_MIPS=
  1210. +-BCMA_PFLASH=
  1211. -BCMA_SFLASH=
  1212. -BCMA_NFLASH=
  1213. -BCMA_DRIVER_GMAC_CMN=
  1214. @@ -56,7 +57,7 @@
  1215. return (bus->chipco.dev ? bus->chipco.dev : bus->pcicore.dev);
  1216. #else
  1217. return bus->chipco.dev;
  1218. -@@ -4903,7 +4903,7 @@ static int b43_wireless_core_init(struct
  1219. +@@ -4883,7 +4883,7 @@ static int b43_wireless_core_init(struct
  1220. }
  1221. if (sprom->boardflags_lo & B43_BFL_XTAL_NOSLOW)
  1222. hf |= B43_HF_DSCRQ; /* Disable slowclock requests from ucode. */
  1223. diff --git a/package/kernel/mac80211/patches/080-disable_clk_backport.patch b/package/kernel/mac80211/patches/080-disable_clk_backport.patch
  1224. deleted file mode 100644
  1225. index 3765591ebb8c5863e552417c3fb36275c711b118..0000000000000000000000000000000000000000
  1226. --- a/package/kernel/mac80211/patches/080-disable_clk_backport.patch
  1227. +++ /dev/null
  1228. @@ -1,20 +0,0 @@
  1229. ---- a/compat/compat-3.6.c
  1230. -+++ b/compat/compat-3.6.c
  1231. -@@ -147,17 +147,3 @@ int sg_alloc_table_from_pages(struct sg_
  1232. - return 0;
  1233. - }
  1234. - EXPORT_SYMBOL_GPL(sg_alloc_table_from_pages);
  1235. --
  1236. --/* whoopsie ! */
  1237. --#ifndef CONFIG_COMMON_CLK
  1238. --int clk_enable(struct clk *clk)
  1239. --{
  1240. -- return 0;
  1241. --}
  1242. --EXPORT_SYMBOL_GPL(clk_enable);
  1243. --
  1244. --void clk_disable(struct clk *clk)
  1245. --{
  1246. --}
  1247. --EXPORT_SYMBOL_GPL(clk_disable);
  1248. --#endif
  1249. diff --git a/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch b/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
  1250. index 02f46c778d8cd704b96af062ea73c2cffbf2c19a..fbe22e51b71eb513e3612d021b7c8ab62415d583 100644
  1251. --- a/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
  1252. +++ b/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
  1253. @@ -309,7 +309,7 @@
  1254. #endif /* AES_GMAC_H */
  1255. --- a/net/mac80211/key.h
  1256. +++ b/net/mac80211/key.h
  1257. -@@ -84,7 +84,7 @@ struct ieee80211_key {
  1258. +@@ -88,7 +88,7 @@ struct ieee80211_key {
  1259. * Management frames.
  1260. */
  1261. u8 rx_pn[IEEE80211_NUM_TIDS + 1][IEEE80211_CCMP_PN_LEN];
  1262. @@ -320,7 +320,7 @@
  1263. struct {
  1264. --- a/net/mac80211/wpa.c
  1265. +++ b/net/mac80211/wpa.c
  1266. -@@ -307,7 +307,8 @@ ieee80211_crypto_tkip_decrypt(struct iee
  1267. +@@ -304,7 +304,8 @@ ieee80211_crypto_tkip_decrypt(struct iee
  1268. }
  1269. @@ -330,7 +330,7 @@
  1270. {
  1271. __le16 mask_fc;
  1272. int a4_included, mgmt;
  1273. -@@ -337,14 +338,8 @@ static void ccmp_special_blocks(struct s
  1274. +@@ -334,14 +335,8 @@ static void ccmp_special_blocks(struct s
  1275. else
  1276. qos_tid = 0;
  1277. @@ -347,7 +347,7 @@
  1278. /* Nonce: Nonce Flags | A2 | PN
  1279. * Nonce Flags: Priority (b0..b3) | Management (b4) | Reserved (b5..b7)
  1280. -@@ -352,6 +347,8 @@ static void ccmp_special_blocks(struct s
  1281. +@@ -349,6 +344,8 @@ static void ccmp_special_blocks(struct s
  1282. b_0[1] = qos_tid | (mgmt << 4);
  1283. memcpy(&b_0[2], hdr->addr2, ETH_ALEN);
  1284. memcpy(&b_0[8], pn, IEEE80211_CCMP_PN_LEN);
  1285. @@ -356,7 +356,7 @@
  1286. /* AAD (extra authenticate-only data) / masked 802.11 header
  1287. * FC | A1 | A2 | A3 | SC | [A4] | [QC] */
  1288. -@@ -463,7 +460,7 @@ static int ccmp_encrypt_skb(struct ieee8
  1289. +@@ -460,7 +457,7 @@ static int ccmp_encrypt_skb(struct ieee8
  1290. return 0;
  1291. pos += IEEE80211_CCMP_HDR_LEN;
  1292. @@ -365,7 +365,7 @@
  1293. ieee80211_aes_ccm_encrypt(key->u.ccmp.tfm, b_0, aad, pos, len,
  1294. skb_put(skb, mic_len), mic_len);
  1295. -@@ -534,7 +531,7 @@ ieee80211_crypto_ccmp_decrypt(struct iee
  1296. +@@ -537,7 +534,7 @@ ieee80211_crypto_ccmp_decrypt(struct iee
  1297. u8 aad[2 * AES_BLOCK_SIZE];
  1298. u8 b_0[AES_BLOCK_SIZE];
  1299. /* hardware didn't decrypt/verify MIC */
  1300. 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
  1301. index d1d9fbd9b157c5b888797ab650db04064dfa7d31..3ca166ff45552c1c544e301fd2833b06ffd9f8a1 100644
  1302. --- a/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch
  1303. +++ b/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch
  1304. @@ -2,7 +2,7 @@ Used for AP+STA support in OpenWrt - preserve AP mode keys across STA reconnects
  1305. --- a/net/mac80211/cfg.c
  1306. +++ b/net/mac80211/cfg.c
  1307. -@@ -846,7 +846,6 @@ static int ieee80211_stop_ap(struct wiph
  1308. +@@ -850,7 +850,6 @@ static int ieee80211_stop_ap(struct wiph
  1309. sdata->u.ap.driver_smps_mode = IEEE80211_SMPS_OFF;
  1310. __sta_info_flush(sdata, true);
  1311. diff --git a/package/kernel/mac80211/patches/150-disable_addr_notifier.patch b/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
  1312. index 2855a88af7b4017f8dfeebeb34ea430a0ad51914..16fab845356343480dd706bfe558a08420a6be90 100644
  1313. --- a/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
  1314. +++ b/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
  1315. @@ -18,9 +18,9 @@
  1316. static int ieee80211_ifa6_changed(struct notifier_block *nb,
  1317. unsigned long data, void *arg)
  1318. {
  1319. -@@ -1087,14 +1087,14 @@ int ieee80211_register_hw(struct ieee802
  1320. -
  1321. - rtnl_unlock();
  1322. +@@ -1090,14 +1090,14 @@ int ieee80211_register_hw(struct ieee802
  1323. + if (result)
  1324. + goto fail_flows;
  1325. -#ifdef CONFIG_INET
  1326. +#ifdef __disabled__CONFIG_INET
  1327. @@ -35,7 +35,7 @@
  1328. local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed;
  1329. result = register_inet6addr_notifier(&local->ifa6_notifier);
  1330. if (result)
  1331. -@@ -1103,13 +1103,13 @@ int ieee80211_register_hw(struct ieee802
  1332. +@@ -1106,13 +1106,13 @@ int ieee80211_register_hw(struct ieee802
  1333. return 0;
  1334. @@ -51,8 +51,8 @@
  1335. +#if defined(__disabled__CONFIG_INET) || defined(__disabled__CONFIG_IPV6)
  1336. fail_ifa:
  1337. #endif
  1338. - rtnl_lock();
  1339. -@@ -1137,10 +1137,10 @@ void ieee80211_unregister_hw(struct ieee
  1340. + ieee80211_txq_teardown_flows(local);
  1341. +@@ -1142,10 +1142,10 @@ void ieee80211_unregister_hw(struct ieee
  1342. tasklet_kill(&local->tx_pending_tasklet);
  1343. tasklet_kill(&local->tasklet);
  1344. diff --git a/package/kernel/mac80211/patches/210-ap_scan.patch b/package/kernel/mac80211/patches/210-ap_scan.patch
  1345. index a99cbd2bee913d292310e258c15c94050e90db71..29f05c44d6e205fe0a7f20009899f1de690ada5a 100644
  1346. --- a/package/kernel/mac80211/patches/210-ap_scan.patch
  1347. +++ b/package/kernel/mac80211/patches/210-ap_scan.patch
  1348. @@ -1,6 +1,6 @@
  1349. --- a/net/mac80211/cfg.c
  1350. +++ b/net/mac80211/cfg.c
  1351. -@@ -1999,7 +1999,7 @@ static int ieee80211_scan(struct wiphy *
  1352. +@@ -2008,7 +2008,7 @@ static int ieee80211_scan(struct wiphy *
  1353. * the frames sent while scanning on other channel will be
  1354. * lost)
  1355. */
  1356. diff --git a/package/kernel/mac80211/patches/220-fq_disable_hack.patch b/package/kernel/mac80211/patches/220-fq_disable_hack.patch
  1357. new file mode 100644
  1358. index 0000000000000000000000000000000000000000..7f420beea56335d5043de6fd71b5febae3e9bd79
  1359. --- /dev/null
  1360. +++ b/package/kernel/mac80211/patches/220-fq_disable_hack.patch
  1361. @@ -0,0 +1,15 @@
  1362. +mac80211 fq has been found to cause a regression in multi-stream TCP
  1363. +performance. Disable it until the cause has been found and fixed
  1364. +
  1365. +--- a/include/net/fq_impl.h
  1366. ++++ b/include/net/fq_impl.h
  1367. +@@ -104,6 +104,9 @@ static struct fq_flow *fq_flow_classify(
  1368. +
  1369. + lockdep_assert_held(&fq->lock);
  1370. +
  1371. ++ /* HACK: disable fq for now until TCP issues are fixed */
  1372. ++ return get_default_func(fq, tin, 0, skb);
  1373. ++
  1374. + hash = skb_get_hash_perturb(skb, fq->perturbation);
  1375. + idx = reciprocal_scale(hash, fq->flows_cnt);
  1376. + flow = &fq->flows[idx];
  1377. 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
  1378. index bddb15ad1a6bbcfcd0903c8b063c8289e5b6c43f..098bda7e93aa4453aa282eb170b2bc502bc85edd 100644
  1379. --- a/package/kernel/mac80211/patches/300-ath9k-force-rx_clear-when-disabling-rx.patch
  1380. +++ b/package/kernel/mac80211/patches/300-ath9k-force-rx_clear-when-disabling-rx.patch
  1381. @@ -3,15 +3,16 @@ Date: Sun, 7 Jun 2015 13:53:35 +0200
  1382. Subject: [PATCH] ath9k: force rx_clear when disabling rx
  1383. This makes stopping Rx more reliable and should reduce the frequency of
  1384. -Rx related DMA stop warnings
  1385. +Rx related DMA stop warnings. Don't use rx_clear in TX99 mode.
  1386. Cc: stable@vger.kernel.org
  1387. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  1388. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  1389. +Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
  1390. ---
  1391. --- a/drivers/net/wireless/ath/ath9k/mac.c
  1392. +++ b/drivers/net/wireless/ath/ath9k/mac.c
  1393. -@@ -677,13 +677,15 @@ void ath9k_hw_startpcureceive(struct ath
  1394. +@@ -677,13 +677,18 @@ void ath9k_hw_startpcureceive(struct ath
  1395. ath9k_ani_reset(ah, is_scanning);
  1396. @@ -24,8 +25,11 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  1397. void ath9k_hw_abortpcurecv(struct ath_hw *ah)
  1398. {
  1399. - REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_ABORT | AR_DIAG_RX_DIS);
  1400. -+ REG_SET_BIT(ah, AR_DIAG_SW,
  1401. -+ AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT | AR_DIAG_FORCE_RX_CLEAR);
  1402. ++ u32 reg = AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT;
  1403. ++
  1404. ++ if (!config_enabled(CPTCFG_ATH9K_TX99))
  1405. ++ reg |= AR_DIAG_FORCE_RX_CLEAR;
  1406. ++ REG_SET_BIT(ah, AR_DIAG_SW, reg);
  1407. ath9k_hw_disable_mib_counters(ah);
  1408. }
  1409. 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
  1410. new file mode 100644
  1411. index 0000000000000000000000000000000000000000..7caa9be5a8b963b6199bf1a29cc370899d30b291
  1412. --- /dev/null
  1413. +++ b/package/kernel/mac80211/patches/302-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch
  1414. @@ -0,0 +1,37 @@
  1415. +From: Felix Fietkau <nbd@nbd.name>
  1416. +Date: Sat, 14 May 2016 14:51:02 +0200
  1417. +Subject: [PATCH] Revert "ath9k: interpret requested txpower in EIRP
  1418. + domain"
  1419. +
  1420. +This reverts commit 71f5137bf010c6faffab50c0ec15374c59c4a411.
  1421. +---
  1422. +
  1423. +--- a/drivers/net/wireless/ath/ath9k/hw.c
  1424. ++++ b/drivers/net/wireless/ath/ath9k/hw.c
  1425. +@@ -2914,7 +2914,8 @@ void ath9k_hw_apply_txpower(struct ath_h
  1426. + {
  1427. + struct ath_regulatory *reg = ath9k_hw_regulatory(ah);
  1428. + struct ieee80211_channel *channel;
  1429. +- int chan_pwr, new_pwr;
  1430. ++ int chan_pwr, new_pwr, max_gain;
  1431. ++ int ant_gain, ant_reduction = 0;
  1432. +
  1433. + if (!chan)
  1434. + return;
  1435. +@@ -2922,10 +2923,15 @@ void ath9k_hw_apply_txpower(struct ath_h
  1436. + channel = chan->chan;
  1437. + chan_pwr = min_t(int, channel->max_power * 2, MAX_RATE_POWER);
  1438. + new_pwr = min_t(int, chan_pwr, reg->power_limit);
  1439. ++ max_gain = chan_pwr - new_pwr + channel->max_antenna_gain * 2;
  1440. ++
  1441. ++ ant_gain = get_antenna_gain(ah, chan);
  1442. ++ if (ant_gain > max_gain)
  1443. ++ ant_reduction = ant_gain - max_gain;
  1444. +
  1445. + ah->eep_ops->set_txpower(ah, chan,
  1446. + ath9k_regd_get_ctl(reg, chan),
  1447. +- get_antenna_gain(ah, chan), new_pwr, test);
  1448. ++ ant_reduction, new_pwr, test);
  1449. + }
  1450. +
  1451. + void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test)
  1452. 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
  1453. deleted file mode 100644
  1454. index 22b987aa7aaae92f889adc938ca88042d3edfdf6..0000000000000000000000000000000000000000
  1455. --- a/package/kernel/mac80211/patches/302-ath9k_hw-add-low-power-tx-gain-table-for-AR953x.patch
  1456. +++ /dev/null
  1457. @@ -1,95 +0,0 @@
  1458. -From: Felix Fietkau <nbd@openwrt.org>
  1459. -Date: Thu, 14 Jan 2016 03:14:03 +0100
  1460. -Subject: [PATCH] ath9k_hw: add low power tx gain table for AR953x
  1461. -
  1462. -Used in some newer TP-Link AR9533 devices.
  1463. -
  1464. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  1465. ----
  1466. -
  1467. ---- a/drivers/net/wireless/ath/ath9k/ar9003_hw.c
  1468. -+++ b/drivers/net/wireless/ath/ath9k/ar9003_hw.c
  1469. -@@ -698,6 +698,9 @@ static void ar9003_tx_gain_table_mode2(s
  1470. - else if (AR_SREV_9340(ah))
  1471. - INIT_INI_ARRAY(&ah->iniModesTxGain,
  1472. - ar9340Modes_low_ob_db_tx_gain_table_1p0);
  1473. -+ else if (AR_SREV_9531_11(ah))
  1474. -+ INIT_INI_ARRAY(&ah->iniModesTxGain,
  1475. -+ qca953x_1p1_modes_no_xpa_low_power_tx_gain_table);
  1476. - else if (AR_SREV_9485_11_OR_LATER(ah))
  1477. - INIT_INI_ARRAY(&ah->iniModesTxGain,
  1478. - ar9485Modes_low_ob_db_tx_gain_1_1);
  1479. ---- a/drivers/net/wireless/ath/ath9k/ar953x_initvals.h
  1480. -+++ b/drivers/net/wireless/ath/ath9k/ar953x_initvals.h
  1481. -@@ -757,6 +757,71 @@ static const u32 qca953x_1p1_modes_xpa_t
  1482. - {0x00016448, 0x6c927a70},
  1483. - };
  1484. -
  1485. -+static const u32 qca953x_1p1_modes_no_xpa_low_power_tx_gain_table[][2] = {
  1486. -+ /* Addr allmodes */
  1487. -+ {0x0000a2dc, 0xfff55592},
  1488. -+ {0x0000a2e0, 0xfff99924},
  1489. -+ {0x0000a2e4, 0xfffe1e00},
  1490. -+ {0x0000a2e8, 0xffffe000},
  1491. -+ {0x0000a410, 0x000050d6},
  1492. -+ {0x0000a500, 0x00000069},
  1493. -+ {0x0000a504, 0x0400006b},
  1494. -+ {0x0000a508, 0x0800006d},
  1495. -+ {0x0000a50c, 0x0c000269},
  1496. -+ {0x0000a510, 0x1000026b},
  1497. -+ {0x0000a514, 0x1400026d},
  1498. -+ {0x0000a518, 0x18000669},
  1499. -+ {0x0000a51c, 0x1c00066b},
  1500. -+ {0x0000a520, 0x1d000a68},
  1501. -+ {0x0000a524, 0x21000a6a},
  1502. -+ {0x0000a528, 0x25000a6c},
  1503. -+ {0x0000a52c, 0x29000a6e},
  1504. -+ {0x0000a530, 0x2d0012a9},
  1505. -+ {0x0000a534, 0x310012ab},
  1506. -+ {0x0000a538, 0x350012ad},
  1507. -+ {0x0000a53c, 0x39001b0a},
  1508. -+ {0x0000a540, 0x3d001b0c},
  1509. -+ {0x0000a544, 0x41001b0e},
  1510. -+ {0x0000a548, 0x43001bae},
  1511. -+ {0x0000a54c, 0x45001914},
  1512. -+ {0x0000a550, 0x47001916},
  1513. -+ {0x0000a554, 0x49001b96},
  1514. -+ {0x0000a558, 0x49001b96},
  1515. -+ {0x0000a55c, 0x49001b96},
  1516. -+ {0x0000a560, 0x49001b96},
  1517. -+ {0x0000a564, 0x49001b96},
  1518. -+ {0x0000a568, 0x49001b96},
  1519. -+ {0x0000a56c, 0x49001b96},
  1520. -+ {0x0000a570, 0x49001b96},
  1521. -+ {0x0000a574, 0x49001b96},
  1522. -+ {0x0000a578, 0x49001b96},
  1523. -+ {0x0000a57c, 0x49001b96},
  1524. -+ {0x0000a600, 0x00000000},
  1525. -+ {0x0000a604, 0x00000000},
  1526. -+ {0x0000a608, 0x00000000},
  1527. -+ {0x0000a60c, 0x00000000},
  1528. -+ {0x0000a610, 0x00000000},
  1529. -+ {0x0000a614, 0x00000000},
  1530. -+ {0x0000a618, 0x00804201},
  1531. -+ {0x0000a61c, 0x01408201},
  1532. -+ {0x0000a620, 0x01408502},
  1533. -+ {0x0000a624, 0x01408502},
  1534. -+ {0x0000a628, 0x01408502},
  1535. -+ {0x0000a62c, 0x01408502},
  1536. -+ {0x0000a630, 0x01408502},
  1537. -+ {0x0000a634, 0x01408502},
  1538. -+ {0x0000a638, 0x01408502},
  1539. -+ {0x0000a63c, 0x01408502},
  1540. -+ {0x0000b2dc, 0xfff55592},
  1541. -+ {0x0000b2e0, 0xfff99924},
  1542. -+ {0x0000b2e4, 0xfffe1e00},
  1543. -+ {0x0000b2e8, 0xffffe000},
  1544. -+ {0x00016044, 0x044922db},
  1545. -+ {0x00016048, 0x6c927a70},
  1546. -+ {0x00016444, 0x044922db},
  1547. -+ {0x00016448, 0x6c927a70},
  1548. -+};
  1549. -+
  1550. - static const u32 qca953x_2p0_baseband_core[][2] = {
  1551. - /* Addr allmodes */
  1552. - {0x00009800, 0xafe68e30},
  1553. 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
  1554. new file mode 100644
  1555. index 0000000000000000000000000000000000000000..73accd866b91e84bfc42684daa3804b0a3bbc563
  1556. --- /dev/null
  1557. +++ b/package/kernel/mac80211/patches/303-ath10k-Ensure-txrx-compl-task-is-stopped-when-cleani.patch
  1558. @@ -0,0 +1,21 @@
  1559. +From: Ben Greear <greearb@candelatech.com>
  1560. +Date: Fri, 1 Apr 2016 14:12:08 -0700
  1561. +Subject: [PATCH] ath10k: Ensure txrx-compl-task is stopped when cleaning
  1562. + htt-tx.
  1563. +
  1564. +Otherwise, the txrx-compl-task may access some bad memory?
  1565. +
  1566. +Signed-off-by: Ben Greear <greearb@candelatech.com>
  1567. +---
  1568. +
  1569. +--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
  1570. ++++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
  1571. +@@ -388,6 +388,8 @@ void ath10k_htt_tx_free(struct ath10k_ht
  1572. + {
  1573. + int size;
  1574. +
  1575. ++ tasklet_kill(&htt->txrx_compl_task);
  1576. ++
  1577. + idr_for_each(&htt->pending_tx, ath10k_htt_tx_clean_up_pending, htt->ar);
  1578. + idr_destroy(&htt->pending_tx);
  1579. +
  1580. 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
  1581. deleted file mode 100644
  1582. index 7bb74353eb128442bf26bc098d62a89c32cfc9d4..0000000000000000000000000000000000000000
  1583. --- a/package/kernel/mac80211/patches/303-rt2x00-fix-monitor-mode-regression.patch
  1584. +++ /dev/null
  1585. @@ -1,156 +0,0 @@
  1586. -From: Eli Cooper <elicooper@gmx.com>
  1587. -Date: Thu, 14 Jan 2016 00:07:12 +0800
  1588. -Subject: [PATCH] rt2x00: fix monitor mode regression
  1589. -
  1590. -Since commit df1404650ccbfeb76a84f301f22316be0d00a864 monitor mode for rt2x00
  1591. -has been made effectively useless because the hardware filter is configured to
  1592. -drop packets whose intended recipient is not the device, regardless of the
  1593. -presence of monitor mode interfaces.
  1594. -
  1595. -This patch fixes this regression by adding explicit monitor mode support, and
  1596. -configuring the hardware filter accordingly.
  1597. -
  1598. -Signed-off-by: Eli Cooper <elicooper@gmx.com>
  1599. ----
  1600. -
  1601. ---- a/drivers/net/wireless/ralink/rt2x00/rt2400pci.c
  1602. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2400pci.c
  1603. -@@ -273,8 +273,10 @@ static void rt2400pci_config_filter(stru
  1604. - !(filter_flags & FIF_PLCPFAIL));
  1605. - rt2x00_set_field32(&reg, RXCSR0_DROP_CONTROL,
  1606. - !(filter_flags & FIF_CONTROL));
  1607. -- rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME, 1);
  1608. -+ rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME,
  1609. -+ !rt2x00dev->is_monitoring);
  1610. - rt2x00_set_field32(&reg, RXCSR0_DROP_TODS,
  1611. -+ !rt2x00dev->is_monitoring &&
  1612. - !rt2x00dev->intf_ap_count);
  1613. - rt2x00_set_field32(&reg, RXCSR0_DROP_VERSION_ERROR, 1);
  1614. - rt2x00mmio_register_write(rt2x00dev, RXCSR0, reg);
  1615. ---- a/drivers/net/wireless/ralink/rt2x00/rt2500pci.c
  1616. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2500pci.c
  1617. -@@ -274,8 +274,10 @@ static void rt2500pci_config_filter(stru
  1618. - !(filter_flags & FIF_PLCPFAIL));
  1619. - rt2x00_set_field32(&reg, RXCSR0_DROP_CONTROL,
  1620. - !(filter_flags & FIF_CONTROL));
  1621. -- rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME, 1);
  1622. -+ rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME,
  1623. -+ !rt2x00dev->is_monitoring);
  1624. - rt2x00_set_field32(&reg, RXCSR0_DROP_TODS,
  1625. -+ !rt2x00dev->is_monitoring &&
  1626. - !rt2x00dev->intf_ap_count);
  1627. - rt2x00_set_field32(&reg, RXCSR0_DROP_VERSION_ERROR, 1);
  1628. - rt2x00_set_field32(&reg, RXCSR0_DROP_MCAST,
  1629. ---- a/drivers/net/wireless/ralink/rt2x00/rt2500usb.c
  1630. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2500usb.c
  1631. -@@ -437,8 +437,10 @@ static void rt2500usb_config_filter(stru
  1632. - !(filter_flags & FIF_PLCPFAIL));
  1633. - rt2x00_set_field16(&reg, TXRX_CSR2_DROP_CONTROL,
  1634. - !(filter_flags & FIF_CONTROL));
  1635. -- rt2x00_set_field16(&reg, TXRX_CSR2_DROP_NOT_TO_ME, 1);
  1636. -+ rt2x00_set_field16(&reg, TXRX_CSR2_DROP_NOT_TO_ME,
  1637. -+ !rt2x00dev->is_monitoring);
  1638. - rt2x00_set_field16(&reg, TXRX_CSR2_DROP_TODS,
  1639. -+ !rt2x00dev->is_monitoring &&
  1640. - !rt2x00dev->intf_ap_count);
  1641. - rt2x00_set_field16(&reg, TXRX_CSR2_DROP_VERSION_ERROR, 1);
  1642. - rt2x00_set_field16(&reg, TXRX_CSR2_DROP_MULTICAST,
  1643. ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  1644. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  1645. -@@ -1490,7 +1490,8 @@ void rt2800_config_filter(struct rt2x00_
  1646. - !(filter_flags & FIF_FCSFAIL));
  1647. - rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_PHY_ERROR,
  1648. - !(filter_flags & FIF_PLCPFAIL));
  1649. -- rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_TO_ME, 1);
  1650. -+ rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_TO_ME,
  1651. -+ !rt2x00dev->is_monitoring);
  1652. - rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_MY_BSSD, 0);
  1653. - rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_VER_ERROR, 1);
  1654. - rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_MULTICAST,
  1655. ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  1656. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  1657. -@@ -844,11 +844,13 @@ struct rt2x00_dev {
  1658. - * - Open sta interface count.
  1659. - * - Association count.
  1660. - * - Beaconing enabled count.
  1661. -+ * - Whether the device is monitoring.
  1662. - */
  1663. - unsigned int intf_ap_count;
  1664. - unsigned int intf_sta_count;
  1665. - unsigned int intf_associated;
  1666. - unsigned int intf_beaconing;
  1667. -+ bool is_monitoring;
  1668. -
  1669. - /*
  1670. - * Interface combinations
  1671. ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00config.c
  1672. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00config.c
  1673. -@@ -244,6 +244,16 @@ void rt2x00lib_config(struct rt2x00_dev
  1674. - (ieee80211_flags & IEEE80211_CONF_CHANGE_PS))
  1675. - cancel_delayed_work_sync(&rt2x00dev->autowakeup_work);
  1676. -
  1677. -+ if (ieee80211_flags & IEEE80211_CONF_CHANGE_MONITOR) {
  1678. -+ if (conf->flags & IEEE80211_CONF_MONITOR) {
  1679. -+ rt2x00_dbg(rt2x00dev, "Monitor mode is enabled\n");
  1680. -+ rt2x00dev->is_monitoring = true;
  1681. -+ } else {
  1682. -+ rt2x00_dbg(rt2x00dev, "Monitor mode is disabled\n");
  1683. -+ rt2x00dev->is_monitoring = false;
  1684. -+ }
  1685. -+ }
  1686. -+
  1687. - /*
  1688. - * Start configuration.
  1689. - */
  1690. ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  1691. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  1692. -@@ -1204,6 +1204,7 @@ int rt2x00lib_start(struct rt2x00_dev *r
  1693. - rt2x00dev->intf_ap_count = 0;
  1694. - rt2x00dev->intf_sta_count = 0;
  1695. - rt2x00dev->intf_associated = 0;
  1696. -+ rt2x00dev->is_monitoring = false;
  1697. -
  1698. - /* Enable the radio */
  1699. - retval = rt2x00lib_enable_radio(rt2x00dev);
  1700. ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
  1701. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
  1702. -@@ -385,11 +385,6 @@ void rt2x00mac_configure_filter(struct i
  1703. - *total_flags |= FIF_PSPOLL;
  1704. - }
  1705. -
  1706. -- /*
  1707. -- * Check if there is any work left for us.
  1708. -- */
  1709. -- if (rt2x00dev->packet_filter == *total_flags)
  1710. -- return;
  1711. - rt2x00dev->packet_filter = *total_flags;
  1712. -
  1713. - rt2x00dev->ops->lib->config_filter(rt2x00dev, *total_flags);
  1714. ---- a/drivers/net/wireless/ralink/rt2x00/rt61pci.c
  1715. -+++ b/drivers/net/wireless/ralink/rt2x00/rt61pci.c
  1716. -@@ -530,8 +530,10 @@ static void rt61pci_config_filter(struct
  1717. - !(filter_flags & FIF_PLCPFAIL));
  1718. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_CONTROL,
  1719. - !(filter_flags & (FIF_CONTROL | FIF_PSPOLL)));
  1720. -- rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME, 1);
  1721. -+ rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME,
  1722. -+ !rt2x00dev->is_monitoring);
  1723. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_TO_DS,
  1724. -+ !rt2x00dev->is_monitoring &&
  1725. - !rt2x00dev->intf_ap_count);
  1726. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_VERSION_ERROR, 1);
  1727. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_MULTICAST,
  1728. ---- a/drivers/net/wireless/ralink/rt2x00/rt73usb.c
  1729. -+++ b/drivers/net/wireless/ralink/rt2x00/rt73usb.c
  1730. -@@ -480,8 +480,10 @@ static void rt73usb_config_filter(struct
  1731. - !(filter_flags & FIF_PLCPFAIL));
  1732. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_CONTROL,
  1733. - !(filter_flags & (FIF_CONTROL | FIF_PSPOLL)));
  1734. -- rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME, 1);
  1735. -+ rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME,
  1736. -+ !rt2x00dev->is_monitoring);
  1737. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_TO_DS,
  1738. -+ !rt2x00dev->is_monitoring &&
  1739. - !rt2x00dev->intf_ap_count);
  1740. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_VERSION_ERROR, 1);
  1741. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_MULTICAST,
  1742. 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
  1743. new file mode 100644
  1744. index 0000000000000000000000000000000000000000..7dec1fb55ab64fed606c9162d39f90902a20d4e0
  1745. --- /dev/null
  1746. +++ b/package/kernel/mac80211/patches/304-ath10k-Ensure-peer_map-references-are-cleaned-up.patch
  1747. @@ -0,0 +1,60 @@
  1748. +From: Ben Greear <greearb@candelatech.com>
  1749. +Date: Fri, 1 Apr 2016 14:12:09 -0700
  1750. +Subject: [PATCH] ath10k: Ensure peer_map references are cleaned up.
  1751. +
  1752. +While debugging OS crashes due to firmware crashes, I enabled
  1753. +kasan, and it noticed that peer objects were being used-after-freed.
  1754. +
  1755. +Looks like there are two places we could be leaving stale references
  1756. +in the peer-map, so clean that up.
  1757. +
  1758. +Signed-off-by: Ben Greear <greearb@candelatech.com>
  1759. +---
  1760. +
  1761. +--- a/drivers/net/wireless/ath/ath10k/mac.c
  1762. ++++ b/drivers/net/wireless/ath/ath10k/mac.c
  1763. +@@ -802,6 +802,7 @@ static void ath10k_peer_cleanup(struct a
  1764. + {
  1765. + struct ath10k_peer *peer, *tmp;
  1766. + int peer_id;
  1767. ++ int i;
  1768. +
  1769. + lockdep_assert_held(&ar->conf_mutex);
  1770. +
  1771. +@@ -818,6 +819,17 @@ static void ath10k_peer_cleanup(struct a
  1772. + ar->peer_map[peer_id] = NULL;
  1773. + }
  1774. +
  1775. ++ /* Double check that peer is properly un-referenced from
  1776. ++ * the peer_map
  1777. ++ */
  1778. ++ for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) {
  1779. ++ if (ar->peer_map[i] == peer) {
  1780. ++ ath10k_warn(ar, "removing stale peer_map entry for %pM (ptr %p idx %d)\n",
  1781. ++ peer->addr, peer, i);
  1782. ++ ar->peer_map[i] = NULL;
  1783. ++ }
  1784. ++ }
  1785. ++
  1786. + list_del(&peer->list);
  1787. + kfree(peer);
  1788. + ar->num_peers--;
  1789. +@@ -828,6 +840,7 @@ static void ath10k_peer_cleanup(struct a
  1790. + static void ath10k_peer_cleanup_all(struct ath10k *ar)
  1791. + {
  1792. + struct ath10k_peer *peer, *tmp;
  1793. ++ int i;
  1794. +
  1795. + lockdep_assert_held(&ar->conf_mutex);
  1796. +
  1797. +@@ -836,6 +849,10 @@ static void ath10k_peer_cleanup_all(stru
  1798. + list_del(&peer->list);
  1799. + kfree(peer);
  1800. + }
  1801. ++
  1802. ++ for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++)
  1803. ++ ar->peer_map[i] = NULL;
  1804. ++
  1805. + spin_unlock_bh(&ar->data_lock);
  1806. +
  1807. + ar->num_peers = 0;
  1808. 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
  1809. deleted file mode 100644
  1810. index 049059aa24b50e71636336e3928bc66e64c39ae1..0000000000000000000000000000000000000000
  1811. --- a/package/kernel/mac80211/patches/304-ath9k-avoid-ANI-restart-if-no-trigger.patch
  1812. +++ /dev/null
  1813. @@ -1,32 +0,0 @@
  1814. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  1815. -Date: Fri, 15 Jan 2016 18:17:17 +0800
  1816. -Subject: [PATCH] ath9k: avoid ANI restart if no trigger
  1817. -
  1818. -Fixes commit 54da20d83f0e ("ath9k_hw: improve ANI processing and rx desensitizing parameters")
  1819. -
  1820. -Call ath9k_ani_restart() only when the phy error rate reach the
  1821. -ANI immunity threshold. Sync the logic with internal code base.
  1822. -
  1823. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  1824. ----
  1825. -
  1826. ---- a/drivers/net/wireless/ath/ath9k/ani.c
  1827. -+++ b/drivers/net/wireless/ath/ath9k/ani.c
  1828. -@@ -444,14 +444,16 @@ void ath9k_hw_ani_monitor(struct ath_hw
  1829. - ofdmPhyErrRate < ah->config.ofdm_trig_low) {
  1830. - ath9k_hw_ani_lower_immunity(ah);
  1831. - aniState->ofdmsTurn = !aniState->ofdmsTurn;
  1832. -+ ath9k_ani_restart(ah);
  1833. - } else if (ofdmPhyErrRate > ah->config.ofdm_trig_high) {
  1834. - ath9k_hw_ani_ofdm_err_trigger(ah);
  1835. - aniState->ofdmsTurn = false;
  1836. -+ ath9k_ani_restart(ah);
  1837. - } else if (cckPhyErrRate > ah->config.cck_trig_high) {
  1838. - ath9k_hw_ani_cck_err_trigger(ah);
  1839. - aniState->ofdmsTurn = true;
  1840. -+ ath9k_ani_restart(ah);
  1841. - }
  1842. -- ath9k_ani_restart(ah);
  1843. - }
  1844. - }
  1845. - EXPORT_SYMBOL(ath9k_hw_ani_monitor);
  1846. 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
  1847. new file mode 100644
  1848. index 0000000000000000000000000000000000000000..7248a8cecf6b0798d354aa3fd44386f2e1f1b52d
  1849. --- /dev/null
  1850. +++ b/package/kernel/mac80211/patches/305-ath10k-Clean-up-peer-when-sta-goes-away.patch
  1851. @@ -0,0 +1,32 @@
  1852. +From: Ben Greear <greearb@candelatech.com>
  1853. +Date: Fri, 1 Apr 2016 14:12:11 -0700
  1854. +Subject: [PATCH] ath10k: Clean up peer when sta goes away.
  1855. +
  1856. +If WMI and/or firmware has issues removing the peer object,
  1857. +then we still need to clean up the peer object in the driver.
  1858. +
  1859. +Signed-off-by: Ben Greear <greearb@candelatech.com>
  1860. +---
  1861. +
  1862. +--- a/drivers/net/wireless/ath/ath10k/mac.c
  1863. ++++ b/drivers/net/wireless/ath/ath10k/mac.c
  1864. +@@ -5992,9 +5992,17 @@ static int ath10k_sta_state(struct ieee8
  1865. + continue;
  1866. +
  1867. + if (peer->sta == sta) {
  1868. +- ath10k_warn(ar, "found sta peer %pM entry on vdev %i after it was supposedly removed\n",
  1869. +- sta->addr, arvif->vdev_id);
  1870. ++ ath10k_warn(ar, "found sta peer %pM (ptr %p id %d) entry on vdev %i after it was supposedly removed\n",
  1871. ++ sta->addr, peer, i, arvif->vdev_id);
  1872. + peer->sta = NULL;
  1873. ++
  1874. ++ /* Clean up the peer object as well since we
  1875. ++ * must have failed to do this above.
  1876. ++ */
  1877. ++ list_del(&peer->list);
  1878. ++ ar->peer_map[i] = NULL;
  1879. ++ kfree(peer);
  1880. ++ ar->num_peers--;
  1881. + }
  1882. + }
  1883. + spin_unlock_bh(&ar->data_lock);
  1884. 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
  1885. deleted file mode 100644
  1886. index a1ac67c828deb429af4ba4db0e8c18e87a3e12b6..0000000000000000000000000000000000000000
  1887. --- a/package/kernel/mac80211/patches/305-ath9k-clean-up-ANI-per-channel-pointer-checking.patch
  1888. +++ /dev/null
  1889. @@ -1,91 +0,0 @@
  1890. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  1891. -Date: Fri, 15 Jan 2016 18:17:18 +0800
  1892. -Subject: [PATCH] ath9k: clean up ANI per-channel pointer checking
  1893. -
  1894. -commit c24bd3620c50 ("ath9k: Do not maintain ANI state per-channel")
  1895. -removed per-channel handling, the code to check 'curchan' also
  1896. -should be removed as never used.
  1897. -
  1898. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  1899. ----
  1900. -
  1901. ---- a/drivers/net/wireless/ath/ath9k/ani.c
  1902. -+++ b/drivers/net/wireless/ath/ath9k/ani.c
  1903. -@@ -126,12 +126,8 @@ static void ath9k_hw_update_mibstats(str
  1904. -
  1905. - static void ath9k_ani_restart(struct ath_hw *ah)
  1906. - {
  1907. -- struct ar5416AniState *aniState;
  1908. --
  1909. -- if (!ah->curchan)
  1910. -- return;
  1911. -+ struct ar5416AniState *aniState = &ah->ani;
  1912. -
  1913. -- aniState = &ah->ani;
  1914. - aniState->listenTime = 0;
  1915. -
  1916. - ENABLE_REGWRITE_BUFFER(ah);
  1917. -@@ -221,12 +217,7 @@ static void ath9k_hw_set_ofdm_nil(struct
  1918. -
  1919. - static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hw *ah)
  1920. - {
  1921. -- struct ar5416AniState *aniState;
  1922. --
  1923. -- if (!ah->curchan)
  1924. -- return;
  1925. --
  1926. -- aniState = &ah->ani;
  1927. -+ struct ar5416AniState *aniState = &ah->ani;
  1928. -
  1929. - if (aniState->ofdmNoiseImmunityLevel < ATH9K_ANI_OFDM_MAX_LEVEL)
  1930. - ath9k_hw_set_ofdm_nil(ah, aniState->ofdmNoiseImmunityLevel + 1, false);
  1931. -@@ -281,12 +272,7 @@ static void ath9k_hw_set_cck_nil(struct
  1932. -
  1933. - static void ath9k_hw_ani_cck_err_trigger(struct ath_hw *ah)
  1934. - {
  1935. -- struct ar5416AniState *aniState;
  1936. --
  1937. -- if (!ah->curchan)
  1938. -- return;
  1939. --
  1940. -- aniState = &ah->ani;
  1941. -+ struct ar5416AniState *aniState = &ah->ani;
  1942. -
  1943. - if (aniState->cckNoiseImmunityLevel < ATH9K_ANI_CCK_MAX_LEVEL)
  1944. - ath9k_hw_set_cck_nil(ah, aniState->cckNoiseImmunityLevel + 1,
  1945. -@@ -299,9 +285,7 @@ static void ath9k_hw_ani_cck_err_trigger
  1946. - */
  1947. - static void ath9k_hw_ani_lower_immunity(struct ath_hw *ah)
  1948. - {
  1949. -- struct ar5416AniState *aniState;
  1950. --
  1951. -- aniState = &ah->ani;
  1952. -+ struct ar5416AniState *aniState = &ah->ani;
  1953. -
  1954. - /* lower OFDM noise immunity */
  1955. - if (aniState->ofdmNoiseImmunityLevel > 0 &&
  1956. -@@ -329,7 +313,7 @@ void ath9k_ani_reset(struct ath_hw *ah,
  1957. - struct ath_common *common = ath9k_hw_common(ah);
  1958. - int ofdm_nil, cck_nil;
  1959. -
  1960. -- if (!ah->curchan)
  1961. -+ if (!chan)
  1962. - return;
  1963. -
  1964. - BUG_ON(aniState == NULL);
  1965. -@@ -416,14 +400,10 @@ static bool ath9k_hw_ani_read_counters(s
  1966. -
  1967. - void ath9k_hw_ani_monitor(struct ath_hw *ah, struct ath9k_channel *chan)
  1968. - {
  1969. -- struct ar5416AniState *aniState;
  1970. -+ struct ar5416AniState *aniState = &ah->ani;
  1971. - struct ath_common *common = ath9k_hw_common(ah);
  1972. - u32 ofdmPhyErrRate, cckPhyErrRate;
  1973. -
  1974. -- if (!ah->curchan)
  1975. -- return;
  1976. --
  1977. -- aniState = &ah->ani;
  1978. - if (!ath9k_hw_ani_read_counters(ah))
  1979. - return;
  1980. -
  1981. 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
  1982. deleted file mode 100644
  1983. index cf8194aa334c7b85e26404ec3a104dff5431d4e9..0000000000000000000000000000000000000000
  1984. --- a/package/kernel/mac80211/patches/306-ath9k-do-not-reset-while-BB-panic-0x4000409-on-ar956.patch
  1985. +++ /dev/null
  1986. @@ -1,31 +0,0 @@
  1987. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  1988. -Date: Fri, 15 Jan 2016 18:17:19 +0800
  1989. -Subject: [PATCH] ath9k: do not reset while BB panic(0x4000409) on ar9561
  1990. -
  1991. -BB panic(0x4000409) observed while AP enabling/disabling
  1992. -bursting.
  1993. -
  1994. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  1995. ----
  1996. -
  1997. ---- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  1998. -+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  1999. -@@ -2071,7 +2071,8 @@ void ar9003_hw_attach_phy_ops(struct ath
  2000. - * to be disabled.
  2001. - *
  2002. - * 0x04000409: Packet stuck on receive.
  2003. -- * Full chip reset is required for all chips except AR9340.
  2004. -+ * Full chip reset is required for all chips except
  2005. -+ * AR9340, AR9531 and AR9561.
  2006. - */
  2007. -
  2008. - /*
  2009. -@@ -2100,7 +2101,7 @@ bool ar9003_hw_bb_watchdog_check(struct
  2010. - case 0x04000b09:
  2011. - return true;
  2012. - case 0x04000409:
  2013. -- if (AR_SREV_9340(ah) || AR_SREV_9531(ah))
  2014. -+ if (AR_SREV_9340(ah) || AR_SREV_9531(ah) || AR_SREV_9561(ah))
  2015. - return false;
  2016. - else
  2017. - return true;
  2018. 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
  2019. new file mode 100644
  2020. index 0000000000000000000000000000000000000000..4a8f14394640020ae7b32aa3e295cfb9494896df
  2021. --- /dev/null
  2022. +++ b/package/kernel/mac80211/patches/306-mac80211-add-hdrlen-to-ieee80211_tx_data.patch
  2023. @@ -0,0 +1,203 @@
  2024. +From: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  2025. +Date: Fri, 19 Feb 2016 11:01:49 +0100
  2026. +Subject: [PATCH] mac80211: add hdrlen to ieee80211_tx_data
  2027. +
  2028. +Add hdrlen to ieee80211_tx_data and use this
  2029. +when wep/ccmd/tkip. This is preparation for
  2030. +aligned4 code.
  2031. +
  2032. +Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  2033. +---
  2034. +
  2035. +--- a/net/mac80211/ieee80211_i.h
  2036. ++++ b/net/mac80211/ieee80211_i.h
  2037. +@@ -173,6 +173,7 @@ struct ieee80211_tx_data {
  2038. + struct ieee80211_tx_rate rate;
  2039. +
  2040. + unsigned int flags;
  2041. ++ unsigned int hdrlen;
  2042. + };
  2043. +
  2044. +
  2045. +--- a/net/mac80211/tx.c
  2046. ++++ b/net/mac80211/tx.c
  2047. +@@ -922,7 +922,7 @@ ieee80211_tx_h_fragment(struct ieee80211
  2048. + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  2049. + struct ieee80211_hdr *hdr = (void *)skb->data;
  2050. + int frag_threshold = tx->local->hw.wiphy->frag_threshold;
  2051. +- int hdrlen;
  2052. ++ int hdrlen = tx->hdrlen;
  2053. + int fragnum;
  2054. +
  2055. + /* no matter what happens, tx->skb moves to tx->skbs */
  2056. +@@ -943,8 +943,6 @@ ieee80211_tx_h_fragment(struct ieee80211
  2057. + if (WARN_ON(info->flags & IEEE80211_TX_CTL_AMPDU))
  2058. + return TX_DROP;
  2059. +
  2060. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2061. +-
  2062. + /* internal error, why isn't DONTFRAG set? */
  2063. + if (WARN_ON(skb->len + FCS_LEN <= frag_threshold))
  2064. + return TX_DROP;
  2065. +@@ -1176,6 +1174,8 @@ ieee80211_tx_prepare(struct ieee80211_su
  2066. +
  2067. + hdr = (struct ieee80211_hdr *) skb->data;
  2068. +
  2069. ++ tx->hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2070. ++
  2071. + if (likely(sta)) {
  2072. + if (!IS_ERR(sta))
  2073. + tx->sta = sta;
  2074. +--- a/net/mac80211/util.c
  2075. ++++ b/net/mac80211/util.c
  2076. +@@ -1226,6 +1226,7 @@ void ieee80211_send_auth(struct ieee8021
  2077. + struct ieee80211_local *local = sdata->local;
  2078. + struct sk_buff *skb;
  2079. + struct ieee80211_mgmt *mgmt;
  2080. ++ unsigned int hdrlen;
  2081. + int err;
  2082. +
  2083. + /* 24 + 6 = header + auth_algo + auth_transaction + status_code */
  2084. +@@ -1250,8 +1251,10 @@ void ieee80211_send_auth(struct ieee8021
  2085. + memcpy(skb_put(skb, extra_len), extra, extra_len);
  2086. +
  2087. + if (auth_alg == WLAN_AUTH_SHARED_KEY && transaction == 3) {
  2088. ++ hdrlen = ieee80211_hdrlen(mgmt->frame_control);
  2089. + mgmt->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
  2090. +- err = ieee80211_wep_encrypt(local, skb, key, key_len, key_idx);
  2091. ++ err = ieee80211_wep_encrypt(local, skb, hdrlen, key,
  2092. ++ key_len, key_idx);
  2093. + WARN_ON(err);
  2094. + }
  2095. +
  2096. +--- a/net/mac80211/wep.c
  2097. ++++ b/net/mac80211/wep.c
  2098. +@@ -89,11 +89,11 @@ static void ieee80211_wep_get_iv(struct
  2099. +
  2100. + static u8 *ieee80211_wep_add_iv(struct ieee80211_local *local,
  2101. + struct sk_buff *skb,
  2102. ++ unsigned int hdrlen,
  2103. + int keylen, int keyidx)
  2104. + {
  2105. + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  2106. + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  2107. +- unsigned int hdrlen;
  2108. + u8 *newhdr;
  2109. +
  2110. + hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
  2111. +@@ -101,7 +101,6 @@ static u8 *ieee80211_wep_add_iv(struct i
  2112. + if (WARN_ON(skb_headroom(skb) < IEEE80211_WEP_IV_LEN))
  2113. + return NULL;
  2114. +
  2115. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2116. + newhdr = skb_push(skb, IEEE80211_WEP_IV_LEN);
  2117. + memmove(newhdr, newhdr + IEEE80211_WEP_IV_LEN, hdrlen);
  2118. +
  2119. +@@ -160,6 +159,7 @@ int ieee80211_wep_encrypt_data(struct cr
  2120. + */
  2121. + int ieee80211_wep_encrypt(struct ieee80211_local *local,
  2122. + struct sk_buff *skb,
  2123. ++ unsigned int hdrlen,
  2124. + const u8 *key, int keylen, int keyidx)
  2125. + {
  2126. + u8 *iv;
  2127. +@@ -169,7 +169,7 @@ int ieee80211_wep_encrypt(struct ieee802
  2128. + if (WARN_ON(skb_tailroom(skb) < IEEE80211_WEP_ICV_LEN))
  2129. + return -1;
  2130. +
  2131. +- iv = ieee80211_wep_add_iv(local, skb, keylen, keyidx);
  2132. ++ iv = ieee80211_wep_add_iv(local, skb, hdrlen, keylen, keyidx);
  2133. + if (!iv)
  2134. + return -1;
  2135. +
  2136. +@@ -306,13 +306,14 @@ static int wep_encrypt_skb(struct ieee80
  2137. + struct ieee80211_key_conf *hw_key = info->control.hw_key;
  2138. +
  2139. + if (!hw_key) {
  2140. +- if (ieee80211_wep_encrypt(tx->local, skb, tx->key->conf.key,
  2141. ++ if (ieee80211_wep_encrypt(tx->local, skb, tx->hdrlen,
  2142. ++ tx->key->conf.key,
  2143. + tx->key->conf.keylen,
  2144. + tx->key->conf.keyidx))
  2145. + return -1;
  2146. + } else if ((hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV) ||
  2147. + (hw_key->flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE)) {
  2148. +- if (!ieee80211_wep_add_iv(tx->local, skb,
  2149. ++ if (!ieee80211_wep_add_iv(tx->local, skb, tx->hdrlen,
  2150. + tx->key->conf.keylen,
  2151. + tx->key->conf.keyidx))
  2152. + return -1;
  2153. +--- a/net/mac80211/wep.h
  2154. ++++ b/net/mac80211/wep.h
  2155. +@@ -22,6 +22,7 @@ int ieee80211_wep_encrypt_data(struct cr
  2156. + size_t klen, u8 *data, size_t data_len);
  2157. + int ieee80211_wep_encrypt(struct ieee80211_local *local,
  2158. + struct sk_buff *skb,
  2159. ++ unsigned int hdrlen,
  2160. + const u8 *key, int keylen, int keyidx);
  2161. + int ieee80211_wep_decrypt_data(struct crypto_cipher *tfm, u8 *rc4key,
  2162. + size_t klen, u8 *data, size_t data_len);
  2163. +--- a/net/mac80211/wpa.c
  2164. ++++ b/net/mac80211/wpa.c
  2165. +@@ -43,7 +43,7 @@ ieee80211_tx_h_michael_mic_add(struct ie
  2166. + skb->len < 24 || !ieee80211_is_data_present(hdr->frame_control))
  2167. + return TX_CONTINUE;
  2168. +
  2169. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2170. ++ hdrlen = tx->hdrlen;
  2171. + if (skb->len < hdrlen)
  2172. + return TX_DROP;
  2173. +
  2174. +@@ -186,7 +186,6 @@ mic_fail_no_key:
  2175. +
  2176. + static int tkip_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
  2177. + {
  2178. +- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
  2179. + struct ieee80211_key *key = tx->key;
  2180. + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  2181. + unsigned int hdrlen;
  2182. +@@ -201,7 +200,7 @@ static int tkip_encrypt_skb(struct ieee8
  2183. + return 0;
  2184. + }
  2185. +
  2186. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2187. ++ hdrlen = tx->hdrlen;
  2188. + len = skb->len - hdrlen;
  2189. +
  2190. + if (info->control.hw_key)
  2191. +@@ -418,7 +417,7 @@ static int ccmp_encrypt_skb(struct ieee8
  2192. + return 0;
  2193. + }
  2194. +
  2195. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2196. ++ hdrlen = tx->hdrlen;
  2197. + len = skb->len - hdrlen;
  2198. +
  2199. + if (info->control.hw_key)
  2200. +@@ -651,7 +650,7 @@ static int gcmp_encrypt_skb(struct ieee8
  2201. + return 0;
  2202. + }
  2203. +
  2204. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2205. ++ hdrlen = tx->hdrlen;
  2206. + len = skb->len - hdrlen;
  2207. +
  2208. + if (info->control.hw_key)
  2209. +@@ -791,7 +790,6 @@ static ieee80211_tx_result
  2210. + ieee80211_crypto_cs_encrypt(struct ieee80211_tx_data *tx,
  2211. + struct sk_buff *skb)
  2212. + {
  2213. +- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  2214. + struct ieee80211_key *key = tx->key;
  2215. + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  2216. + int hdrlen;
  2217. +@@ -807,8 +805,7 @@ ieee80211_crypto_cs_encrypt(struct ieee8
  2218. + pskb_expand_head(skb, iv_len, 0, GFP_ATOMIC)))
  2219. + return TX_DROP;
  2220. +
  2221. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2222. +-
  2223. ++ hdrlen = tx->hdrlen;
  2224. + pos = skb_push(skb, iv_len);
  2225. + memmove(pos, pos + iv_len, hdrlen);
  2226. +
  2227. 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
  2228. deleted file mode 100644
  2229. index 80b781ca54dc8c217ffe5fa304bf2bc515cf1c90..0000000000000000000000000000000000000000
  2230. --- a/package/kernel/mac80211/patches/307-ath9k-fix-inconsistent-use-of-tab-and-space-in-inden.patch
  2231. +++ /dev/null
  2232. @@ -1,27 +0,0 @@
  2233. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  2234. -Date: Fri, 15 Jan 2016 18:17:20 +0800
  2235. -Subject: [PATCH] ath9k: fix inconsistent use of tab and space in
  2236. - indentation
  2237. -
  2238. -Minor changes for indenting.
  2239. -
  2240. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  2241. ----
  2242. -
  2243. ---- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
  2244. -+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
  2245. -@@ -5485,11 +5485,11 @@ unsigned int ar9003_get_paprd_scale_fact
  2246. - AR9300_PAPRD_SCALE_1);
  2247. - else {
  2248. - if (chan->channel >= 5700)
  2249. -- return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt20),
  2250. -- AR9300_PAPRD_SCALE_1);
  2251. -+ return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt20),
  2252. -+ AR9300_PAPRD_SCALE_1);
  2253. - else if (chan->channel >= 5400)
  2254. - return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt40),
  2255. -- AR9300_PAPRD_SCALE_2);
  2256. -+ AR9300_PAPRD_SCALE_2);
  2257. - else
  2258. - return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt40),
  2259. - AR9300_PAPRD_SCALE_1);
  2260. 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
  2261. new file mode 100644
  2262. index 0000000000000000000000000000000000000000..eeb881e03064fc7b0fdbcb5dbb5ffc2600c9754e
  2263. --- /dev/null
  2264. +++ b/package/kernel/mac80211/patches/307-mac80211-add-NEED_ALIGNED4_SKBS-hw-flag.patch
  2265. @@ -0,0 +1,235 @@
  2266. +From: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  2267. +Date: Fri, 19 Feb 2016 11:01:50 +0100
  2268. +Subject: [PATCH] mac80211: add NEED_ALIGNED4_SKBS hw flag
  2269. +
  2270. +HW/driver should set NEED_ALIGNED4_SKBS flag in case
  2271. +require aligned skbs to four-byte boundaries.
  2272. +This affect only TX direction.
  2273. +
  2274. +Padding is added after ieee80211_hdr, before IV/LLC.
  2275. +
  2276. +Before we have to do memmove(hdrlen) twice in the
  2277. +dirver. Once before we pass this to HW and next
  2278. +in tx completion (to be sure monitor will report
  2279. +this tx frame correctly).
  2280. +
  2281. +With this patch we can skip this memmove() and save CPU.
  2282. +
  2283. +Currently this was tested with ath9k, both hw/sw crypt for
  2284. +wep/tkip/ccmp.
  2285. +
  2286. +Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  2287. +---
  2288. +
  2289. +--- a/include/net/mac80211.h
  2290. ++++ b/include/net/mac80211.h
  2291. +@@ -2014,6 +2014,9 @@ struct ieee80211_txq {
  2292. + * @IEEE80211_HW_TX_FRAG_LIST: Hardware (or driver) supports sending frag_list
  2293. + * skbs, needed for zero-copy software A-MSDU.
  2294. + *
  2295. ++ * @IEEE80211_HW_NEEDS_ALIGNED4_SKBS: Driver need aligned skbs to four-byte.
  2296. ++ * Padding will be added after ieee80211_hdr, before IV/LLC.
  2297. ++ *
  2298. + * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
  2299. + */
  2300. + enum ieee80211_hw_flags {
  2301. +@@ -2054,6 +2057,7 @@ enum ieee80211_hw_flags {
  2302. + IEEE80211_HW_USES_RSS,
  2303. + IEEE80211_HW_TX_AMSDU,
  2304. + IEEE80211_HW_TX_FRAG_LIST,
  2305. ++ IEEE80211_HW_NEEDS_ALIGNED4_SKBS,
  2306. +
  2307. + /* keep last, obviously */
  2308. + NUM_IEEE80211_HW_FLAGS
  2309. +--- a/net/mac80211/debugfs.c
  2310. ++++ b/net/mac80211/debugfs.c
  2311. +@@ -302,6 +302,7 @@ static const char *hw_flag_names[] = {
  2312. + FLAG(USES_RSS),
  2313. + FLAG(TX_AMSDU),
  2314. + FLAG(TX_FRAG_LIST),
  2315. ++ FLAG(NEEDS_ALIGNED4_SKBS),
  2316. + #undef FLAG
  2317. + };
  2318. +
  2319. +--- a/net/mac80211/ieee80211_i.h
  2320. ++++ b/net/mac80211/ieee80211_i.h
  2321. +@@ -1497,6 +1497,29 @@ ieee80211_have_rx_timestamp(struct ieee8
  2322. + return false;
  2323. + }
  2324. +
  2325. ++static inline unsigned int
  2326. ++ieee80211_hdr_padsize(struct ieee80211_hw *hw, unsigned int hdrlen)
  2327. ++{
  2328. ++ /*
  2329. ++ * While hdrlen is already aligned to two-byte boundaries,
  2330. ++ * simple check with & 2 will return correct padsize.
  2331. ++ */
  2332. ++ if (ieee80211_hw_check(hw, NEEDS_ALIGNED4_SKBS))
  2333. ++ return hdrlen & 2;
  2334. ++ return 0;
  2335. ++}
  2336. ++
  2337. ++static inline unsigned int
  2338. ++ieee80211_padded_hdrlen(struct ieee80211_hw *hw, __le16 fc)
  2339. ++{
  2340. ++ unsigned int hdrlen;
  2341. ++
  2342. ++ hdrlen = ieee80211_hdrlen(fc);
  2343. ++ hdrlen += ieee80211_hdr_padsize(hw, hdrlen);
  2344. ++
  2345. ++ return hdrlen;
  2346. ++}
  2347. ++
  2348. + u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local,
  2349. + struct ieee80211_rx_status *status,
  2350. + unsigned int mpdu_len,
  2351. +--- a/net/mac80211/sta_info.h
  2352. ++++ b/net/mac80211/sta_info.h
  2353. +@@ -279,7 +279,7 @@ struct ieee80211_fast_tx {
  2354. + u8 hdr_len;
  2355. + u8 sa_offs, da_offs, pn_offs;
  2356. + u8 band;
  2357. +- u8 hdr[30 + 2 + IEEE80211_FAST_XMIT_MAX_IV +
  2358. ++ u8 hdr[30 + 2 + 2 + IEEE80211_FAST_XMIT_MAX_IV +
  2359. + sizeof(rfc1042_header)] __aligned(2);
  2360. +
  2361. + struct rcu_head rcu_head;
  2362. +--- a/net/mac80211/status.c
  2363. ++++ b/net/mac80211/status.c
  2364. +@@ -683,9 +683,22 @@ void ieee80211_tx_monitor(struct ieee802
  2365. + struct sk_buff *skb2;
  2366. + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  2367. + struct ieee80211_sub_if_data *sdata;
  2368. ++ struct ieee80211_hdr *hdr = (void *)skb->data;
  2369. + struct net_device *prev_dev = NULL;
  2370. ++ unsigned int hdrlen, padsize;
  2371. + int rtap_len;
  2372. +
  2373. ++ /* Remove padding if was added */
  2374. ++ if (ieee80211_hw_check(&local->hw, NEEDS_ALIGNED4_SKBS)) {
  2375. ++ hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2376. ++ padsize = ieee80211_hdr_padsize(&local->hw, hdrlen);
  2377. ++
  2378. ++ if (padsize && skb->len > hdrlen + padsize) {
  2379. ++ memmove(skb->data + padsize, skb->data, hdrlen);
  2380. ++ skb_pull(skb, padsize);
  2381. ++ }
  2382. ++ }
  2383. ++
  2384. + /* send frame to monitor interfaces now */
  2385. + rtap_len = ieee80211_tx_radiotap_len(info);
  2386. + if (WARN_ON_ONCE(skb_headroom(skb) < rtap_len)) {
  2387. +--- a/net/mac80211/tkip.c
  2388. ++++ b/net/mac80211/tkip.c
  2389. +@@ -201,10 +201,12 @@ void ieee80211_get_tkip_p2k(struct ieee8
  2390. + {
  2391. + struct ieee80211_key *key = (struct ieee80211_key *)
  2392. + container_of(keyconf, struct ieee80211_key, conf);
  2393. ++ struct ieee80211_hw *hw = &key->local->hw;
  2394. + const u8 *tk = &key->conf.key[NL80211_TKIP_DATA_OFFSET_ENCR_KEY];
  2395. + struct tkip_ctx *ctx = &key->u.tkip.tx;
  2396. + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  2397. +- const u8 *data = (u8 *)hdr + ieee80211_hdrlen(hdr->frame_control);
  2398. ++ const u8 *data = (u8 *)hdr + ieee80211_padded_hdrlen(hw,
  2399. ++ hdr->frame_control);
  2400. + u32 iv32 = get_unaligned_le32(&data[4]);
  2401. + u16 iv16 = data[2] | (data[0] << 8);
  2402. +
  2403. +--- a/net/mac80211/tx.c
  2404. ++++ b/net/mac80211/tx.c
  2405. +@@ -1173,8 +1173,7 @@ ieee80211_tx_prepare(struct ieee80211_su
  2406. + info->flags &= ~IEEE80211_TX_INTFL_NEED_TXPROCESSING;
  2407. +
  2408. + hdr = (struct ieee80211_hdr *) skb->data;
  2409. +-
  2410. +- tx->hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2411. ++ tx->hdrlen = ieee80211_padded_hdrlen(&local->hw, hdr->frame_control);
  2412. +
  2413. + if (likely(sta)) {
  2414. + if (!IS_ERR(sta))
  2415. +@@ -2108,7 +2107,7 @@ netdev_tx_t ieee80211_monitor_start_xmit
  2416. + goto fail;
  2417. +
  2418. + hdr = (struct ieee80211_hdr *)(skb->data + len_rthdr);
  2419. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2420. ++ hdrlen = ieee80211_padded_hdrlen(&local->hw, hdr->frame_control);
  2421. +
  2422. + if (skb->len < len_rthdr + hdrlen)
  2423. + goto fail;
  2424. +@@ -2334,7 +2333,7 @@ static struct sk_buff *ieee80211_build_h
  2425. + struct ieee80211_chanctx_conf *chanctx_conf;
  2426. + struct ieee80211_sub_if_data *ap_sdata;
  2427. + enum nl80211_band band;
  2428. +- int ret;
  2429. ++ int padsize, ret;
  2430. +
  2431. + if (IS_ERR(sta))
  2432. + sta = NULL;
  2433. +@@ -2554,6 +2553,9 @@ static struct sk_buff *ieee80211_build_h
  2434. + hdrlen += 2;
  2435. + }
  2436. +
  2437. ++ /* Check aligned4 skb required */
  2438. ++ padsize = ieee80211_hdr_padsize(&sdata->local->hw, hdrlen);
  2439. ++
  2440. + /*
  2441. + * Drop unicast frames to unauthorised stations unless they are
  2442. + * EAPOL frames from the local station.
  2443. +@@ -2640,6 +2642,7 @@ static struct sk_buff *ieee80211_build_h
  2444. + h_pos -= skip_header_bytes;
  2445. +
  2446. + head_need = hdrlen + encaps_len + meshhdrlen - skb_headroom(skb);
  2447. ++ head_need += padsize;
  2448. +
  2449. + /*
  2450. + * So we need to modify the skb header and hence need a copy of
  2451. +@@ -2678,6 +2681,9 @@ static struct sk_buff *ieee80211_build_h
  2452. + }
  2453. + #endif
  2454. +
  2455. ++ if (padsize)
  2456. ++ memset(skb_push(skb, padsize), 0, padsize);
  2457. ++
  2458. + if (ieee80211_is_data_qos(fc)) {
  2459. + __le16 *qos_control;
  2460. +
  2461. +@@ -2691,8 +2697,8 @@ static struct sk_buff *ieee80211_build_h
  2462. + } else
  2463. + memcpy(skb_push(skb, hdrlen), &hdr, hdrlen);
  2464. +
  2465. +- nh_pos += hdrlen;
  2466. +- h_pos += hdrlen;
  2467. ++ nh_pos += hdrlen + padsize;
  2468. ++ h_pos += hdrlen + padsize;
  2469. +
  2470. + /* Update skb pointers to various headers since this modified frame
  2471. + * is going to go through Linux networking code that may potentially
  2472. +@@ -2861,6 +2867,9 @@ void ieee80211_check_fast_xmit(struct st
  2473. + fc |= cpu_to_le16(IEEE80211_STYPE_QOS_DATA);
  2474. + }
  2475. +
  2476. ++ /* Check aligned4 skb required */
  2477. ++ build.hdr_len += ieee80211_hdr_padsize(&local->hw, build.hdr_len);
  2478. ++
  2479. + /* We store the key here so there's no point in using rcu_dereference()
  2480. + * but that's fine because the code that changes the pointers will call
  2481. + * this function after doing so. For a single CPU that would be enough,
  2482. +--- a/net/mac80211/util.c
  2483. ++++ b/net/mac80211/util.c
  2484. +@@ -1224,6 +1224,7 @@ void ieee80211_send_auth(struct ieee8021
  2485. + u32 tx_flags)
  2486. + {
  2487. + struct ieee80211_local *local = sdata->local;
  2488. ++ struct ieee80211_hw *hw = &local->hw;
  2489. + struct sk_buff *skb;
  2490. + struct ieee80211_mgmt *mgmt;
  2491. + unsigned int hdrlen;
  2492. +@@ -1251,7 +1252,7 @@ void ieee80211_send_auth(struct ieee8021
  2493. + memcpy(skb_put(skb, extra_len), extra, extra_len);
  2494. +
  2495. + if (auth_alg == WLAN_AUTH_SHARED_KEY && transaction == 3) {
  2496. +- hdrlen = ieee80211_hdrlen(mgmt->frame_control);
  2497. ++ hdrlen = ieee80211_padded_hdrlen(hw, mgmt->frame_control);
  2498. + mgmt->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
  2499. + err = ieee80211_wep_encrypt(local, skb, hdrlen, key,
  2500. + key_len, key_idx);
  2501. 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
  2502. new file mode 100644
  2503. index 0000000000000000000000000000000000000000..8590aadabe8d622a9691e13c17af23bd5d91886c
  2504. --- /dev/null
  2505. +++ b/package/kernel/mac80211/patches/308-ath10k-Fix-sending-NULL-Qos-NULL-data-frames-for-QCA.patch
  2506. @@ -0,0 +1,72 @@
  2507. +From: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
  2508. +Date: Thu, 23 Jun 2016 22:10:01 +0530
  2509. +Subject: [PATCH] ath10k: Fix sending NULL/ Qos NULL data frames for
  2510. + QCA99X0 and later
  2511. +
  2512. +For chipsets like QCA99X0, IPQ4019 and later we are not getting proper
  2513. +NULL func status (always acked/successs !!) when hostapd does a
  2514. +PROBE_CLIENT via nullfunc frames when the station is powered off
  2515. +abruptly (inactive timer probes client via null func after the inactive
  2516. +time reaches beyond the threshold). Fix this by disabling the workaround
  2517. +(getting the ACK status of NULL func frames by sending via HTT mgmt-tx
  2518. + path) introduced by the change ("ath10k: fix beacon loss handling ")
  2519. +for QCA99X0 and later chipsets. The normal tx path provides the proper
  2520. +ACK status for NULL data frames. As of now disable this workaround for
  2521. +chipsets QCA99X0 and later, once the 10.1 firmware is obselete we can
  2522. +completely get rid of this workaround for all the chipsets
  2523. +
  2524. +Signed-off-by: Tamizh chelvam <c_traja@qti.qualcomm.com>
  2525. +Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
  2526. +---
  2527. +
  2528. +--- a/drivers/net/wireless/ath/ath10k/core.c
  2529. ++++ b/drivers/net/wireless/ath/ath10k/core.c
  2530. +@@ -181,6 +181,7 @@ static const struct ath10k_hw_params ath
  2531. + .board = QCA99X0_HW_2_0_BOARD_DATA_FILE,
  2532. + .board_size = QCA99X0_BOARD_DATA_SZ,
  2533. + .board_ext_size = QCA99X0_BOARD_EXT_DATA_SZ,
  2534. ++ .disable_null_func_workaround = true,
  2535. + },
  2536. + },
  2537. + {
  2538. +@@ -204,6 +205,7 @@ static const struct ath10k_hw_params ath
  2539. + .board = QCA9984_HW_1_0_BOARD_DATA_FILE,
  2540. + .board_size = QCA99X0_BOARD_DATA_SZ,
  2541. + .board_ext_size = QCA99X0_BOARD_EXT_DATA_SZ,
  2542. ++ .disable_null_func_workaround = true,
  2543. + },
  2544. + },
  2545. + {
  2546. +@@ -262,6 +264,7 @@ static const struct ath10k_hw_params ath
  2547. + .board = QCA4019_HW_1_0_BOARD_DATA_FILE,
  2548. + .board_size = QCA4019_BOARD_DATA_SZ,
  2549. + .board_ext_size = QCA4019_BOARD_EXT_DATA_SZ,
  2550. ++ .disable_null_func_workaround = true,
  2551. + },
  2552. + },
  2553. + };
  2554. +--- a/drivers/net/wireless/ath/ath10k/core.h
  2555. ++++ b/drivers/net/wireless/ath/ath10k/core.h
  2556. +@@ -750,6 +750,12 @@ struct ath10k {
  2557. + const char *board;
  2558. + size_t board_size;
  2559. + size_t board_ext_size;
  2560. ++ /* Workaround of sending NULL data frames via
  2561. ++ * HTT mgmt TX and getting the proper ACK status does
  2562. ++ * not works for chipsets QCA99X0 and later, while
  2563. ++ * Tx data path reports the ACK status properly.
  2564. ++ */
  2565. ++ bool disable_null_func_workaround;
  2566. + } fw;
  2567. + } hw_params;
  2568. +
  2569. +--- a/drivers/net/wireless/ath/ath10k/mac.c
  2570. ++++ b/drivers/net/wireless/ath/ath10k/mac.c
  2571. +@@ -3253,6 +3253,7 @@ ath10k_mac_tx_h_get_txmode(struct ath10k
  2572. + * mode though because AP don't sleep.
  2573. + */
  2574. + if (ar->htt.target_version_major < 3 &&
  2575. ++ !ar->hw_params.fw.disable_null_func_workaround &&
  2576. + (ieee80211_is_nullfunc(fc) || ieee80211_is_qos_nullfunc(fc)) &&
  2577. + !test_bit(ATH10K_FW_FEATURE_HAS_WMI_MGMT_TX,
  2578. + ar->running_fw->fw_file.fw_features))
  2579. 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
  2580. deleted file mode 100644
  2581. index d4088664bf68166ecf5c25a9ac727578805da176..0000000000000000000000000000000000000000
  2582. --- a/package/kernel/mac80211/patches/308-ath9k-fix-data-bus-error-on-ar9300-and-ar9580.patch
  2583. +++ /dev/null
  2584. @@ -1,65 +0,0 @@
  2585. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  2586. -Date: Fri, 15 Jan 2016 18:17:21 +0800
  2587. -Subject: [PATCH] ath9k: fix data bus error on ar9300 and ar9580
  2588. -
  2589. -One crash issue be found on ar9300: RTC_RC reg read leads crash, leading
  2590. -the data bus error, due to RTC_RC reg write not happen properly.
  2591. -
  2592. -Warm Reset trigger in continuous beacon stuck for one of the customer for
  2593. -other chip, noticed the MAC was stuck in RTC reset. After analysis noticed
  2594. -DMA did not complete when RTC was put in reset.
  2595. -
  2596. -So, before resetting the MAC need to make sure there are no pending DMA
  2597. -transactions because this reset does not reset all parts of the chip.
  2598. -
  2599. -The 12th and 11th bit of MAC _DMA_CFG register used to do that.
  2600. - 12 cfg_halt_ack 0x0
  2601. - 0 DMA has not yet halted
  2602. - 1 DMA has halted
  2603. - 11 cfg_halt_req 0x0
  2604. - 0 DMA logic operates normally
  2605. - 1 Request DMA logic to stop so software can reset the MAC
  2606. -
  2607. -The Bit [12] of this register indicates when the halt has taken effect or
  2608. -not. the DMA halt IS NOT recoverable; once software sets bit [11] to
  2609. -request a DMA halt, software must wait for bit [12] to be set and reset
  2610. -the MAC.
  2611. -
  2612. -So, the same thing we implemented for ar9580 chip.
  2613. -
  2614. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  2615. ----
  2616. -
  2617. ---- a/drivers/net/wireless/ath/ath9k/hw.c
  2618. -+++ b/drivers/net/wireless/ath/ath9k/hw.c
  2619. -@@ -1368,6 +1368,16 @@ static bool ath9k_hw_set_reset(struct at
  2620. - if (ath9k_hw_mci_is_enabled(ah))
  2621. - ar9003_mci_check_gpm_offset(ah);
  2622. -
  2623. -+ /* DMA HALT added to resolve ar9300 and ar9580 bus error during
  2624. -+ * RTC_RC reg read
  2625. -+ */
  2626. -+ if (AR_SREV_9300(ah) || AR_SREV_9580(ah)) {
  2627. -+ REG_SET_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  2628. -+ ath9k_hw_wait(ah, AR_CFG, AR_CFG_HALT_ACK, AR_CFG_HALT_ACK,
  2629. -+ 20 * AH_WAIT_TIMEOUT);
  2630. -+ REG_CLR_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  2631. -+ }
  2632. -+
  2633. - REG_WRITE(ah, AR_RTC_RC, rst_flags);
  2634. -
  2635. - REGWRITE_BUFFER_FLUSH(ah);
  2636. ---- a/drivers/net/wireless/ath/ath9k/reg.h
  2637. -+++ b/drivers/net/wireless/ath/ath9k/reg.h
  2638. -@@ -34,8 +34,10 @@
  2639. - #define AR_CFG_SWRG 0x00000010
  2640. - #define AR_CFG_AP_ADHOC_INDICATION 0x00000020
  2641. - #define AR_CFG_PHOK 0x00000100
  2642. --#define AR_CFG_CLK_GATE_DIS 0x00000400
  2643. - #define AR_CFG_EEBS 0x00000200
  2644. -+#define AR_CFG_CLK_GATE_DIS 0x00000400
  2645. -+#define AR_CFG_HALT_REQ 0x00000800
  2646. -+#define AR_CFG_HALT_ACK 0x00001000
  2647. - #define AR_CFG_PCI_MASTER_REQ_Q_THRESH 0x00060000
  2648. - #define AR_CFG_PCI_MASTER_REQ_Q_THRESH_S 17
  2649. -
  2650. 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
  2651. deleted file mode 100644
  2652. index d9511c8d5f5c8051bf2ed9c1cd408911c0ba02d9..0000000000000000000000000000000000000000
  2653. --- a/package/kernel/mac80211/patches/309-01-brcmfmac-add-missing-include.patch
  2654. +++ /dev/null
  2655. @@ -1,19 +0,0 @@
  2656. -From: Felix Fietkau <nbd@openwrt.org>
  2657. -Date: Fri, 15 Jan 2016 15:59:45 +0100
  2658. -Subject: [PATCH] brcmfmac: add missing include
  2659. -
  2660. -linux/module.h is required for defining module parameters
  2661. -
  2662. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  2663. ----
  2664. -
  2665. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  2666. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  2667. -@@ -17,6 +17,7 @@
  2668. - #include <linux/kernel.h>
  2669. - #include <linux/string.h>
  2670. - #include <linux/netdevice.h>
  2671. -+#include <linux/module.h>
  2672. - #include <brcmu_wifi.h>
  2673. - #include <brcmu_utils.h>
  2674. - #include "core.h"
  2675. 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
  2676. deleted file mode 100644
  2677. index 711e019e2b6836c6907a614fc3a3b1c17693f2cf..0000000000000000000000000000000000000000
  2678. --- a/package/kernel/mac80211/patches/309-02-brcmfmac-fix-sdio-sg-table-alloc-crash.patch
  2679. +++ /dev/null
  2680. @@ -1,118 +0,0 @@
  2681. -From: Hante Meuleman <meuleman@broadcom.com>
  2682. -Date: Tue, 19 Jan 2016 12:39:24 +0100
  2683. -Subject: [PATCH] brcmfmac: fix sdio sg table alloc crash
  2684. -
  2685. -With commit 7d34b0560567 ("brcmfmac: Move all module parameters to
  2686. -one place") a bug was introduced causing a null pointer exception.
  2687. -This patch fixes the bug by initializing the sg table till after
  2688. -the settings have been initialized.
  2689. -
  2690. -Fixes: 7d34b0560567 ("brcmfmac: Move all module parameters to one place")
  2691. -Reported-by: Marc Zyngier <marc.zyngier@arm.com>
  2692. -Tested-by: Marc Zyngier <marc.zyngier@arm.com>
  2693. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  2694. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  2695. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  2696. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  2697. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  2698. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  2699. ----
  2700. -
  2701. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  2702. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  2703. -@@ -879,11 +879,24 @@ int brcmf_sdiod_abort(struct brcmf_sdio_
  2704. - return 0;
  2705. - }
  2706. -
  2707. --static void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev)
  2708. -+void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev)
  2709. - {
  2710. -+ struct sdio_func *func;
  2711. -+ struct mmc_host *host;
  2712. -+ uint max_blocks;
  2713. - uint nents;
  2714. - int err;
  2715. -
  2716. -+ func = sdiodev->func[2];
  2717. -+ host = func->card->host;
  2718. -+ sdiodev->sg_support = host->max_segs > 1;
  2719. -+ max_blocks = min_t(uint, host->max_blk_count, 511u);
  2720. -+ sdiodev->max_request_size = min_t(uint, host->max_req_size,
  2721. -+ max_blocks * func->cur_blksize);
  2722. -+ sdiodev->max_segment_count = min_t(uint, host->max_segs,
  2723. -+ SG_MAX_SINGLE_ALLOC);
  2724. -+ sdiodev->max_segment_size = host->max_seg_size;
  2725. -+
  2726. - if (!sdiodev->sg_support)
  2727. - return;
  2728. -
  2729. -@@ -1021,9 +1034,6 @@ static void brcmf_sdiod_host_fixup(struc
  2730. -
  2731. - static int brcmf_sdiod_probe(struct brcmf_sdio_dev *sdiodev)
  2732. - {
  2733. -- struct sdio_func *func;
  2734. -- struct mmc_host *host;
  2735. -- uint max_blocks;
  2736. - int ret = 0;
  2737. -
  2738. - sdiodev->num_funcs = 2;
  2739. -@@ -1054,26 +1064,6 @@ static int brcmf_sdiod_probe(struct brcm
  2740. - goto out;
  2741. - }
  2742. -
  2743. -- /*
  2744. -- * determine host related variables after brcmf_sdiod_probe()
  2745. -- * as func->cur_blksize is properly set and F2 init has been
  2746. -- * completed successfully.
  2747. -- */
  2748. -- func = sdiodev->func[2];
  2749. -- host = func->card->host;
  2750. -- sdiodev->sg_support = host->max_segs > 1;
  2751. -- max_blocks = min_t(uint, host->max_blk_count, 511u);
  2752. -- sdiodev->max_request_size = min_t(uint, host->max_req_size,
  2753. -- max_blocks * func->cur_blksize);
  2754. -- sdiodev->max_segment_count = min_t(uint, host->max_segs,
  2755. -- SG_MAX_SINGLE_ALLOC);
  2756. -- sdiodev->max_segment_size = host->max_seg_size;
  2757. --
  2758. -- /* allocate scatter-gather table. sg support
  2759. -- * will be disabled upon allocation failure.
  2760. -- */
  2761. -- brcmf_sdiod_sgtable_alloc(sdiodev);
  2762. --
  2763. - ret = brcmf_sdiod_freezer_attach(sdiodev);
  2764. - if (ret)
  2765. - goto out;
  2766. -@@ -1084,7 +1074,7 @@ static int brcmf_sdiod_probe(struct brcm
  2767. - ret = -ENODEV;
  2768. - goto out;
  2769. - }
  2770. -- brcmf_sdiod_host_fixup(host);
  2771. -+ brcmf_sdiod_host_fixup(sdiodev->func[2]->card->host);
  2772. - out:
  2773. - if (ret)
  2774. - brcmf_sdiod_remove(sdiodev);
  2775. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  2776. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  2777. -@@ -4114,6 +4114,11 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
  2778. - goto fail;
  2779. - }
  2780. -
  2781. -+ /* allocate scatter-gather table. sg support
  2782. -+ * will be disabled upon allocation failure.
  2783. -+ */
  2784. -+ brcmf_sdiod_sgtable_alloc(bus->sdiodev);
  2785. -+
  2786. - /* Query the F2 block size, set roundup accordingly */
  2787. - bus->blocksize = bus->sdiodev->func[2]->cur_blksize;
  2788. - bus->roundup = min(max_roundup, bus->blocksize);
  2789. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
  2790. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
  2791. -@@ -342,6 +342,7 @@ int brcmf_sdiod_ramrw(struct brcmf_sdio_
  2792. -
  2793. - /* Issue an abort to the specified function */
  2794. - int brcmf_sdiod_abort(struct brcmf_sdio_dev *sdiodev, uint fn);
  2795. -+void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev);
  2796. - void brcmf_sdiod_change_state(struct brcmf_sdio_dev *sdiodev,
  2797. - enum brcmf_sdiod_state state);
  2798. - #ifdef CONFIG_PM_SLEEP
  2799. 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
  2800. new file mode 100644
  2801. index 0000000000000000000000000000000000000000..41c27cac4129547e1e6df0f4ed96d61279c13a44
  2802. --- /dev/null
  2803. +++ b/package/kernel/mac80211/patches/309-cfg80211-fix-proto-in-ieee80211_data_to_8023-for-fra.patch
  2804. @@ -0,0 +1,37 @@
  2805. +From: Felix Fietkau <nbd@nbd.name>
  2806. +Date: Wed, 29 Jun 2016 10:02:32 +0200
  2807. +Subject: [PATCH] cfg80211: fix proto in ieee80211_data_to_8023 for frames
  2808. + without LLC header
  2809. +
  2810. +The PDU length of incoming LLC frames is set to the total skb payload size
  2811. +in __ieee80211_data_to_8023() of net/wireless/util.c which incorrectly
  2812. +includes the length of the IEEE 802.11 header.
  2813. +
  2814. +The resulting LLC frame header has a too large PDU length, causing the
  2815. +llc_fixup_skb() function of net/llc/llc_input.c to reject the incoming
  2816. +skb, effectively breaking STP.
  2817. +
  2818. +Solve the problem by properly substracting the IEEE 802.11 frame header size
  2819. +from the PDU length, allowing the LLC processor to pick up the incoming
  2820. +control messages.
  2821. +
  2822. +Special thanks to Gerry Rozema for tracking down the regression and proposing
  2823. +a suitable patch.
  2824. +
  2825. +Fixes: 2d1c304cb2d5 ("cfg80211: add function for 802.3 conversion with separate output buffer")
  2826. +Cc: stable@vger.kernel.org
  2827. +Reported-by: Gerry Rozema <gerryr@rozeware.com>
  2828. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  2829. +---
  2830. +
  2831. +--- a/net/wireless/util.c
  2832. ++++ b/net/wireless/util.c
  2833. +@@ -509,7 +509,7 @@ static int __ieee80211_data_to_8023(stru
  2834. + * replace EtherType */
  2835. + hdrlen += ETH_ALEN + 2;
  2836. + else
  2837. +- tmp.h_proto = htons(skb->len);
  2838. ++ tmp.h_proto = htons(skb->len - hdrlen);
  2839. +
  2840. + pskb_pull(skb, hdrlen);
  2841. +
  2842. 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
  2843. deleted file mode 100644
  2844. index 287d6e13bd4a1dd4132cc2020a626e6bc60083fd..0000000000000000000000000000000000000000
  2845. --- a/package/kernel/mac80211/patches/310-ath9k_hw-ignore-eeprom-magic-mismatch-on-flash-based.patch
  2846. +++ /dev/null
  2847. @@ -1,38 +0,0 @@
  2848. -From: Felix Fietkau <nbd@openwrt.org>
  2849. -Date: Thu, 21 Jan 2016 16:28:44 +0100
  2850. -Subject: [PATCH] ath9k_hw: ignore eeprom magic mismatch on flash based devices
  2851. -
  2852. -Many AR913x based devices (maybe others too) do not have a valid EEPROM
  2853. -magic in their calibration data partition.
  2854. -
  2855. -Fixes: 6fa658fd5ab2 ("ath9k: Simplify and fix eeprom endianness swapping")
  2856. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  2857. ----
  2858. -
  2859. ---- a/drivers/net/wireless/ath/ath9k/eeprom.c
  2860. -+++ b/drivers/net/wireless/ath/ath9k/eeprom.c
  2861. -@@ -150,18 +150,18 @@ int ath9k_hw_nvram_swap_data(struct ath_
  2862. - return -EIO;
  2863. - }
  2864. -
  2865. -- if (magic == AR5416_EEPROM_MAGIC) {
  2866. -- *swap_needed = false;
  2867. -- } else if (swab16(magic) == AR5416_EEPROM_MAGIC) {
  2868. -+ *swap_needed = false;
  2869. -+ if (swab16(magic) == AR5416_EEPROM_MAGIC) {
  2870. - if (ah->ah_flags & AH_NO_EEP_SWAP) {
  2871. - ath_info(common,
  2872. - "Ignoring endianness difference in EEPROM magic bytes.\n");
  2873. --
  2874. -- *swap_needed = false;
  2875. - } else {
  2876. - *swap_needed = true;
  2877. - }
  2878. -- } else {
  2879. -+ } else if (magic != AR5416_EEPROM_MAGIC) {
  2880. -+ if (ath9k_hw_use_flash(ah))
  2881. -+ return 0;
  2882. -+
  2883. - ath_err(common,
  2884. - "Invalid EEPROM Magic (0x%04x).\n", magic);
  2885. - return -EINVAL;
  2886. 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
  2887. new file mode 100644
  2888. index 0000000000000000000000000000000000000000..25929c98136c33e4e18be47c1a4c1f8c756220ba
  2889. --- /dev/null
  2890. +++ b/package/kernel/mac80211/patches/310-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch
  2891. @@ -0,0 +1,81 @@
  2892. +From: Chaitanya T K <chaitanya.mgit@gmail.com>
  2893. +Date: Mon, 27 Jun 2016 15:23:26 +0530
  2894. +Subject: [PATCH] mac80211: minstrel: Enable STBC and LDPC for VHT Rates
  2895. +
  2896. +If peer support reception of STBC and LDPC, enable them for better
  2897. +performance.
  2898. +
  2899. +Signed-off-by: Chaitanya TK <chaitanya.mgit@gmail.com>
  2900. +---
  2901. +
  2902. +--- a/include/linux/ieee80211.h
  2903. ++++ b/include/linux/ieee80211.h
  2904. +@@ -1550,6 +1550,7 @@ struct ieee80211_vht_operation {
  2905. + #define IEEE80211_VHT_CAP_RXSTBC_3 0x00000300
  2906. + #define IEEE80211_VHT_CAP_RXSTBC_4 0x00000400
  2907. + #define IEEE80211_VHT_CAP_RXSTBC_MASK 0x00000700
  2908. ++#define IEEE80211_VHT_CAP_RXSTBC_SHIFT 8
  2909. + #define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800
  2910. + #define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000
  2911. + #define IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT 13
  2912. +--- a/net/mac80211/rc80211_minstrel_ht.c
  2913. ++++ b/net/mac80211/rc80211_minstrel_ht.c
  2914. +@@ -1166,13 +1166,14 @@ minstrel_ht_update_caps(void *priv, stru
  2915. + struct minstrel_ht_sta_priv *msp = priv_sta;
  2916. + struct minstrel_ht_sta *mi = &msp->ht;
  2917. + struct ieee80211_mcs_info *mcs = &sta->ht_cap.mcs;
  2918. +- u16 sta_cap = sta->ht_cap.cap;
  2919. ++ u16 ht_cap = sta->ht_cap.cap;
  2920. + struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap;
  2921. + int use_vht;
  2922. + int n_supported = 0;
  2923. + int ack_dur;
  2924. + int stbc;
  2925. + int i;
  2926. ++ bool ldpc = false;
  2927. +
  2928. + /* fall back to the old minstrel for legacy stations */
  2929. + if (!sta->ht_cap.ht_supported)
  2930. +@@ -1210,16 +1211,24 @@ minstrel_ht_update_caps(void *priv, stru
  2931. + }
  2932. + mi->sample_tries = 4;
  2933. +
  2934. +- /* TODO tx_flags for vht - ATM the RC API is not fine-grained enough */
  2935. + if (!use_vht) {
  2936. +- stbc = (sta_cap & IEEE80211_HT_CAP_RX_STBC) >>
  2937. ++ stbc = (ht_cap & IEEE80211_HT_CAP_RX_STBC) >>
  2938. + IEEE80211_HT_CAP_RX_STBC_SHIFT;
  2939. +- mi->tx_flags |= stbc << IEEE80211_TX_CTL_STBC_SHIFT;
  2940. +
  2941. +- if (sta_cap & IEEE80211_HT_CAP_LDPC_CODING)
  2942. +- mi->tx_flags |= IEEE80211_TX_CTL_LDPC;
  2943. ++ if (ht_cap & IEEE80211_HT_CAP_LDPC_CODING)
  2944. ++ ldpc = true;
  2945. ++ } else {
  2946. ++ stbc = (vht_cap->cap & IEEE80211_VHT_CAP_RXSTBC_MASK) >>
  2947. ++ IEEE80211_VHT_CAP_RXSTBC_SHIFT;
  2948. ++
  2949. ++ if (vht_cap->cap & IEEE80211_VHT_CAP_RXLDPC)
  2950. ++ ldpc = true;
  2951. + }
  2952. +
  2953. ++ mi->tx_flags |= stbc << IEEE80211_TX_CTL_STBC_SHIFT;
  2954. ++ if (ldpc)
  2955. ++ mi->tx_flags |= IEEE80211_TX_CTL_LDPC;
  2956. ++
  2957. + for (i = 0; i < ARRAY_SIZE(mi->groups); i++) {
  2958. + u32 gflags = minstrel_mcs_groups[i].flags;
  2959. + int bw, nss;
  2960. +@@ -1232,10 +1241,10 @@ minstrel_ht_update_caps(void *priv, stru
  2961. +
  2962. + if (gflags & IEEE80211_TX_RC_SHORT_GI) {
  2963. + if (gflags & IEEE80211_TX_RC_40_MHZ_WIDTH) {
  2964. +- if (!(sta_cap & IEEE80211_HT_CAP_SGI_40))
  2965. ++ if (!(ht_cap & IEEE80211_HT_CAP_SGI_40))
  2966. + continue;
  2967. + } else {
  2968. +- if (!(sta_cap & IEEE80211_HT_CAP_SGI_20))
  2969. ++ if (!(ht_cap & IEEE80211_HT_CAP_SGI_20))
  2970. + continue;
  2971. + }
  2972. + }
  2973. 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
  2974. new file mode 100644
  2975. index 0000000000000000000000000000000000000000..4cf26a631f4404b7b3a0c18ab8186203f405a50a
  2976. --- /dev/null
  2977. +++ b/package/kernel/mac80211/patches/311-ath10k-disable-wake_tx_queue-for-older-devices.patch
  2978. @@ -0,0 +1,73 @@
  2979. +From: Michal Kazior <michal.kazior@tieto.com>
  2980. +Date: Tue, 17 May 2016 14:47:01 +0200
  2981. +Subject: [PATCH] ath10k: disable wake_tx_queue for older devices
  2982. +
  2983. +Some setups suffer performance regressions with
  2984. +current wake_tx_queue implementation.
  2985. +
  2986. +Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
  2987. +---
  2988. +
  2989. +--- a/drivers/net/wireless/ath/ath10k/core.h
  2990. ++++ b/drivers/net/wireless/ath/ath10k/core.h
  2991. +@@ -667,6 +667,7 @@ struct ath10k_fw_components {
  2992. + struct ath10k {
  2993. + struct ath_common ath_common;
  2994. + struct ieee80211_hw *hw;
  2995. ++ struct ieee80211_ops *ops;
  2996. + struct device *dev;
  2997. + u8 mac_addr[ETH_ALEN];
  2998. +
  2999. +--- a/drivers/net/wireless/ath/ath10k/mac.c
  3000. ++++ b/drivers/net/wireless/ath/ath10k/mac.c
  3001. +@@ -7497,21 +7497,32 @@ static const struct ieee80211_channel at
  3002. + struct ath10k *ath10k_mac_create(size_t priv_size)
  3003. + {
  3004. + struct ieee80211_hw *hw;
  3005. ++ struct ieee80211_ops *ops;
  3006. + struct ath10k *ar;
  3007. +
  3008. +- hw = ieee80211_alloc_hw(sizeof(struct ath10k) + priv_size, &ath10k_ops);
  3009. +- if (!hw)
  3010. ++ ops = kmemdup(&ath10k_ops, sizeof(ath10k_ops), GFP_KERNEL);
  3011. ++ if (!ops)
  3012. ++ return NULL;
  3013. ++
  3014. ++ hw = ieee80211_alloc_hw(sizeof(struct ath10k) + priv_size, ops);
  3015. ++ if (!hw) {
  3016. ++ kfree(ops);
  3017. + return NULL;
  3018. ++ }
  3019. +
  3020. + ar = hw->priv;
  3021. + ar->hw = hw;
  3022. ++ ar->ops = ops;
  3023. +
  3024. + return ar;
  3025. + }
  3026. +
  3027. + void ath10k_mac_destroy(struct ath10k *ar)
  3028. + {
  3029. ++ struct ieee80211_ops *ops = ar->ops;
  3030. ++
  3031. + ieee80211_free_hw(ar->hw);
  3032. ++ kfree(ops);
  3033. + }
  3034. +
  3035. + static const struct ieee80211_iface_limit ath10k_if_limits[] = {
  3036. +@@ -7945,6 +7956,15 @@ int ath10k_mac_register(struct ath10k *a
  3037. + ath10k_warn(ar, "failed to initialise DFS pattern detector\n");
  3038. + }
  3039. +
  3040. ++ /* Current wake_tx_queue implementation imposes a significant
  3041. ++ * performance penalty in some setups. The tx scheduling code needs
  3042. ++ * more work anyway so disable the wake_tx_queue unless firmware
  3043. ++ * supports the pull-push mechanism.
  3044. ++ */
  3045. ++ if (!test_bit(ATH10K_FW_FEATURE_PEER_FLOW_CONTROL,
  3046. ++ ar->running_fw->fw_file.fw_features))
  3047. ++ ar->ops->wake_tx_queue = NULL;
  3048. ++
  3049. + ret = ath_regd_init(&ar->ath_common.regulatory, ar->hw->wiphy,
  3050. + ath10k_reg_notifier);
  3051. + if (ret) {
  3052. 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
  3053. deleted file mode 100644
  3054. index 070efa98e834e0dfe2334fc0eb9bc433e0f037e8..0000000000000000000000000000000000000000
  3055. --- a/package/kernel/mac80211/patches/311-ath9k-do-not-limit-the-number-of-DFS-interfaces-to-1.patch
  3056. +++ /dev/null
  3057. @@ -1,55 +0,0 @@
  3058. -From: Felix Fietkau <nbd@openwrt.org>
  3059. -Date: Fri, 22 Jan 2016 01:05:56 +0100
  3060. -Subject: [PATCH] ath9k: do not limit the number of DFS interfaces to 1
  3061. -
  3062. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  3063. ----
  3064. -
  3065. ---- a/drivers/net/wireless/ath/ath9k/init.c
  3066. -+++ b/drivers/net/wireless/ath/ath9k/init.c
  3067. -@@ -751,14 +751,6 @@ static const struct ieee80211_iface_comb
  3068. -
  3069. - #endif /* CPTCFG_ATH9K_CHANNEL_CONTEXT */
  3070. -
  3071. --static const struct ieee80211_iface_limit if_dfs_limits[] = {
  3072. -- { .max = 1, .types = BIT(NL80211_IFTYPE_AP) |
  3073. --#ifdef CPTCFG_MAC80211_MESH
  3074. -- BIT(NL80211_IFTYPE_MESH_POINT) |
  3075. --#endif
  3076. -- BIT(NL80211_IFTYPE_ADHOC) },
  3077. --};
  3078. --
  3079. - static const struct ieee80211_iface_combination if_comb[] = {
  3080. - {
  3081. - .limits = if_limits,
  3082. -@@ -766,6 +758,11 @@ static const struct ieee80211_iface_comb
  3083. - .max_interfaces = 2048,
  3084. - .num_different_channels = 1,
  3085. - .beacon_int_infra_match = true,
  3086. -+#ifdef CPTCFG_ATH9K_DFS_CERTIFIED
  3087. -+ .radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) |
  3088. -+ BIT(NL80211_CHAN_WIDTH_20) |
  3089. -+ BIT(NL80211_CHAN_WIDTH_40),
  3090. -+#endif
  3091. - },
  3092. - {
  3093. - .limits = wds_limits,
  3094. -@@ -774,18 +771,6 @@ static const struct ieee80211_iface_comb
  3095. - .num_different_channels = 1,
  3096. - .beacon_int_infra_match = true,
  3097. - },
  3098. --#ifdef CPTCFG_ATH9K_DFS_CERTIFIED
  3099. -- {
  3100. -- .limits = if_dfs_limits,
  3101. -- .n_limits = ARRAY_SIZE(if_dfs_limits),
  3102. -- .max_interfaces = 1,
  3103. -- .num_different_channels = 1,
  3104. -- .beacon_int_infra_match = true,
  3105. -- .radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) |
  3106. -- BIT(NL80211_CHAN_WIDTH_20) |
  3107. -- BIT(NL80211_CHAN_WIDTH_40),
  3108. -- }
  3109. --#endif
  3110. - };
  3111. -
  3112. - #ifdef CPTCFG_ATH9K_CHANNEL_CONTEXT
  3113. 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
  3114. new file mode 100644
  3115. index 0000000000000000000000000000000000000000..df43105cb8233828bef396d500b391731c5c580a
  3116. --- /dev/null
  3117. +++ b/package/kernel/mac80211/patches/312-ath9k-Correct-TSF-adjustment-to-align-the-beacon-tim.patch
  3118. @@ -0,0 +1,45 @@
  3119. +From: Benjamin Berg <benjamin.berg@open-mesh.com>
  3120. +Date: Mon, 4 Jul 2016 14:37:20 +0200
  3121. +Subject: [PATCH] ath9k: Correct TSF adjustment to align the beacon time
  3122. + correctly
  3123. +
  3124. +Beacons were not send out at (timestamp % beacon_time == 0) for interfaces
  3125. +other than the primary one. To send out beacons with the correct timestamp
  3126. +according to 10.1.3.2 of the 802.11 standard the tsf_adjustment has to be
  3127. +set to the negative time difference instead of positive. This way the
  3128. +later beacons get corrected to have a lower (and similar) timestamp with
  3129. +regard to the beacon from slot 0.
  3130. +
  3131. +I am not aware about any issues that have been caused by this.
  3132. +
  3133. +Signed-off-by: Benjamin Berg <benjamin.berg@open-mesh.com>
  3134. +---
  3135. +
  3136. +--- a/drivers/net/wireless/ath/ath9k/beacon.c
  3137. ++++ b/drivers/net/wireless/ath/ath9k/beacon.c
  3138. +@@ -279,17 +279,21 @@ static void ath9k_set_tsfadjust(struct a
  3139. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  3140. + struct ath_vif *avp = (void *)vif->drv_priv;
  3141. + struct ath_beacon_config *cur_conf = &avp->chanctx->beacon;
  3142. +- u32 tsfadjust;
  3143. ++ s64 tsfadjust;
  3144. +
  3145. + if (avp->av_bslot == 0)
  3146. + return;
  3147. +
  3148. ++ /* tsf_adjust is added to the TSF value. We send out the beacon late,
  3149. ++ * so need to adjust the TSF starting point to be later in time (i.e.
  3150. ++ * the theoretical first beacon has a TSF of 0 after correction).
  3151. ++ */
  3152. + tsfadjust = cur_conf->beacon_interval * avp->av_bslot;
  3153. +- tsfadjust = TU_TO_USEC(tsfadjust) / ATH_BCBUF;
  3154. ++ tsfadjust = -TU_TO_USEC(tsfadjust) / ATH_BCBUF;
  3155. + avp->tsf_adjust = cpu_to_le64(tsfadjust);
  3156. +
  3157. +- ath_dbg(common, CONFIG, "tsfadjust is: %llu for bslot: %d\n",
  3158. +- (unsigned long long)tsfadjust, avp->av_bslot);
  3159. ++ ath_dbg(common, CONFIG, "tsfadjust is: %lld for bslot: %d\n",
  3160. ++ (signed long long)tsfadjust, avp->av_bslot);
  3161. + }
  3162. +
  3163. + bool ath9k_csa_is_finished(struct ath_softc *sc, struct ieee80211_vif *vif)
  3164. 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
  3165. deleted file mode 100644
  3166. index 61cafc7625a8f8df5b67558a875794f5d20dbb99..0000000000000000000000000000000000000000
  3167. --- a/package/kernel/mac80211/patches/312-mac80211-fix-txq-queue-related-crashes.patch
  3168. +++ /dev/null
  3169. @@ -1,27 +0,0 @@
  3170. -From: Michal Kazior <michal.kazior@tieto.com>
  3171. -Date: Thu, 21 Jan 2016 14:23:07 +0100
  3172. -Subject: [PATCH] mac80211: fix txq queue related crashes
  3173. -
  3174. -The driver can access the queue simultanously
  3175. -while mac80211 tears down the interface. Without
  3176. -spinlock protection this could lead to corrupting
  3177. -sk_buff_head and subsequently to an invalid
  3178. -pointer dereference.
  3179. -
  3180. -Fixes: ba8c3d6f16a1 ("mac80211: add an intermediate software queue implementation")
  3181. -Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
  3182. ----
  3183. -
  3184. ---- a/net/mac80211/iface.c
  3185. -+++ b/net/mac80211/iface.c
  3186. -@@ -977,7 +977,10 @@ static void ieee80211_do_stop(struct iee
  3187. - if (sdata->vif.txq) {
  3188. - struct txq_info *txqi = to_txq_info(sdata->vif.txq);
  3189. -
  3190. -+ spin_lock_bh(&txqi->queue.lock);
  3191. - ieee80211_purge_tx_queue(&local->hw, &txqi->queue);
  3192. -+ spin_unlock_bh(&txqi->queue.lock);
  3193. -+
  3194. - atomic_set(&sdata->txqs_len[txqi->txq.ac], 0);
  3195. - }
  3196. -
  3197. 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
  3198. new file mode 100644
  3199. index 0000000000000000000000000000000000000000..ef0afbea9c60f69b6a55be1ce1f2dcd4c0d43928
  3200. --- /dev/null
  3201. +++ b/package/kernel/mac80211/patches/313-ath9k-Handle-channel-context-in-get_-set_-reset_tsf.patch
  3202. @@ -0,0 +1,70 @@
  3203. +From: Benjamin Berg <benjamin.berg@open-mesh.com>
  3204. +Date: Mon, 4 Jul 2016 14:37:21 +0200
  3205. +Subject: [PATCH] ath9k: Handle channel context in get_/set_/reset_tsf
  3206. +
  3207. +The ath9k TSF handling routines need to be aware of the channel context that
  3208. +is being modified. With this change the TSF related values that are stored
  3209. +in each channel context will be correctly tracked and the harware will only
  3210. +be updated if the modified context is currently the active one.
  3211. +
  3212. +Without this change the TSF modifications done using these routines would
  3213. +for example be lost during a hardware reset as done by ath_complete_reset.
  3214. +
  3215. +Signed-off-by: Benjamin Berg <benjamin.berg@open-mesh.com>
  3216. +---
  3217. +
  3218. +--- a/drivers/net/wireless/ath/ath9k/main.c
  3219. ++++ b/drivers/net/wireless/ath/ath9k/main.c
  3220. +@@ -1823,11 +1823,18 @@ static void ath9k_bss_info_changed(struc
  3221. + static u64 ath9k_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
  3222. + {
  3223. + struct ath_softc *sc = hw->priv;
  3224. ++ struct ath_vif *avp = (void *)vif->drv_priv;
  3225. + u64 tsf;
  3226. +
  3227. + mutex_lock(&sc->mutex);
  3228. + ath9k_ps_wakeup(sc);
  3229. +- tsf = ath9k_hw_gettsf64(sc->sc_ah);
  3230. ++ /* Get current TSF either from HW or kernel time. */
  3231. ++ if (sc->cur_chan == avp->chanctx) {
  3232. ++ tsf = ath9k_hw_gettsf64(sc->sc_ah);
  3233. ++ } else {
  3234. ++ tsf = sc->cur_chan->tsf_val +
  3235. ++ ath9k_hw_get_tsf_offset(&sc->cur_chan->tsf_ts, NULL);
  3236. ++ }
  3237. + ath9k_ps_restore(sc);
  3238. + mutex_unlock(&sc->mutex);
  3239. +
  3240. +@@ -1839,10 +1846,14 @@ static void ath9k_set_tsf(struct ieee802
  3241. + u64 tsf)
  3242. + {
  3243. + struct ath_softc *sc = hw->priv;
  3244. ++ struct ath_vif *avp = (void *)vif->drv_priv;
  3245. +
  3246. + mutex_lock(&sc->mutex);
  3247. + ath9k_ps_wakeup(sc);
  3248. +- ath9k_hw_settsf64(sc->sc_ah, tsf);
  3249. ++ getrawmonotonic(&avp->chanctx->tsf_ts);
  3250. ++ if (sc->cur_chan == avp->chanctx)
  3251. ++ ath9k_hw_settsf64(sc->sc_ah, tsf);
  3252. ++ avp->chanctx->tsf_val = tsf;
  3253. + ath9k_ps_restore(sc);
  3254. + mutex_unlock(&sc->mutex);
  3255. + }
  3256. +@@ -1850,11 +1861,15 @@ static void ath9k_set_tsf(struct ieee802
  3257. + static void ath9k_reset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
  3258. + {
  3259. + struct ath_softc *sc = hw->priv;
  3260. ++ struct ath_vif *avp = (void *)vif->drv_priv;
  3261. +
  3262. + mutex_lock(&sc->mutex);
  3263. +
  3264. + ath9k_ps_wakeup(sc);
  3265. +- ath9k_hw_reset_tsf(sc->sc_ah);
  3266. ++ getrawmonotonic(&avp->chanctx->tsf_ts);
  3267. ++ if (sc->cur_chan == avp->chanctx)
  3268. ++ ath9k_hw_reset_tsf(sc->sc_ah);
  3269. ++ avp->chanctx->tsf_val = 0;
  3270. + ath9k_ps_restore(sc);
  3271. +
  3272. + mutex_unlock(&sc->mutex);
  3273. 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
  3274. deleted file mode 100644
  3275. index 844d43bfc7875b937d8c67aba60f1204bcb7020a..0000000000000000000000000000000000000000
  3276. --- a/package/kernel/mac80211/patches/313-mac80211-fix-unnecessary-frame-drops-in-mesh-fwding.patch
  3277. +++ /dev/null
  3278. @@ -1,57 +0,0 @@
  3279. -From: Michal Kazior <michal.kazior@tieto.com>
  3280. -Date: Mon, 25 Jan 2016 14:43:24 +0100
  3281. -Subject: [PATCH] mac80211: fix unnecessary frame drops in mesh fwding
  3282. -
  3283. -The ieee80211_queue_stopped() expects hw queue
  3284. -number but it was given raw WMM AC number instead.
  3285. -
  3286. -This could cause frame drops and problems with
  3287. -traffic in some cases - most notably if driver
  3288. -doesn't map AC numbers to queue numbers 1:1 and
  3289. -uses ieee80211_stop_queues() and
  3290. -ieee80211_wake_queue() only without ever calling
  3291. -ieee80211_wake_queues().
  3292. -
  3293. -On ath10k it was possible to hit this problem in
  3294. -the following case:
  3295. -
  3296. - 1. wlan0 uses queue 0
  3297. - (ath10k maps queues per vif)
  3298. - 2. offchannel uses queue 15
  3299. - 3. queues 1-14 are unused
  3300. - 4. ieee80211_stop_queues()
  3301. - 5. ieee80211_wake_queue(q=0)
  3302. - 6. ieee80211_wake_queue(q=15)
  3303. - (other queues are not woken up because both
  3304. - driver and mac80211 know other queues are
  3305. - unused)
  3306. - 7. ieee80211_rx_h_mesh_fwding()
  3307. - 8. ieee80211_select_queue_80211() returns 2
  3308. - 9. ieee80211_queue_stopped(q=2) returns true
  3309. - 10. frame is dropped (oops!)
  3310. -
  3311. -Fixes: d3c1597b8d1b ("mac80211: fix forwarded mesh frame queue mapping")
  3312. -Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
  3313. ----
  3314. -
  3315. ---- a/net/mac80211/rx.c
  3316. -+++ b/net/mac80211/rx.c
  3317. -@@ -2235,7 +2235,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
  3318. - struct ieee80211_local *local = rx->local;
  3319. - struct ieee80211_sub_if_data *sdata = rx->sdata;
  3320. - struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
  3321. -- u16 q, hdrlen;
  3322. -+ u16 ac, q, hdrlen;
  3323. -
  3324. - hdr = (struct ieee80211_hdr *) skb->data;
  3325. - hdrlen = ieee80211_hdrlen(hdr->frame_control);
  3326. -@@ -2304,7 +2304,8 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
  3327. - ether_addr_equal(sdata->vif.addr, hdr->addr3))
  3328. - return RX_CONTINUE;
  3329. -
  3330. -- q = ieee80211_select_queue_80211(sdata, skb, hdr);
  3331. -+ ac = ieee80211_select_queue_80211(sdata, skb, hdr);
  3332. -+ q = sdata->vif.hw_queue[ac];
  3333. - if (ieee80211_queue_stopped(&local->hw, q)) {
  3334. - IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_congestion);
  3335. - return RX_DROP_MONITOR;
  3336. 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
  3337. new file mode 100644
  3338. index 0000000000000000000000000000000000000000..e725a8bd6099ad12d0151b90241489f063a5196d
  3339. --- /dev/null
  3340. +++ b/package/kernel/mac80211/patches/314-ath9k-Use-tsf-offset-helper-in-ath9k_hw_reset.patch
  3341. @@ -0,0 +1,65 @@
  3342. +From: Benjamin Berg <benjamin.berg@open-mesh.com>
  3343. +Date: Mon, 4 Jul 2016 14:37:22 +0200
  3344. +Subject: [PATCH] ath9k: Use tsf offset helper in ath9k_hw_reset
  3345. +
  3346. +These changes make ath9k_hw_reset more consistent with other places that
  3347. +handle the TSF value by using the same helper routine.
  3348. +
  3349. +A slight improvement is to not assume that a fixed time of 1.5ms has
  3350. +passed for the initval writes when compared to the first write attempt.
  3351. +Instead the TSF value is re-calculated which will yield a higher accuracy
  3352. +of the restored TSF timer.
  3353. +
  3354. +Signed-off-by: Benjamin Berg <benjamin.berg@open-mesh.com>
  3355. +---
  3356. +
  3357. +--- a/drivers/net/wireless/ath/ath9k/hw.c
  3358. ++++ b/drivers/net/wireless/ath/ath9k/hw.c
  3359. +@@ -1832,8 +1832,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  3360. + u32 saveLedState;
  3361. + u32 saveDefAntenna;
  3362. + u32 macStaId1;
  3363. ++ struct timespec tsf_ts;
  3364. ++ u32 tsf_offset;
  3365. + u64 tsf = 0;
  3366. +- s64 usec = 0;
  3367. + int r;
  3368. + bool start_mci_reset = false;
  3369. + bool save_fullsleep = ah->chip_fullsleep;
  3370. +@@ -1877,8 +1878,8 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  3371. + macStaId1 = REG_READ(ah, AR_STA_ID1) & AR_STA_ID1_BASE_RATE_11B;
  3372. +
  3373. + /* Save TSF before chip reset, a cold reset clears it */
  3374. ++ getrawmonotonic(&tsf_ts);
  3375. + tsf = ath9k_hw_gettsf64(ah);
  3376. +- usec = ktime_to_us(ktime_get_raw());
  3377. +
  3378. + saveLedState = REG_READ(ah, AR_CFG_LED) &
  3379. + (AR_CFG_LED_ASSOC_CTL | AR_CFG_LED_MODE_SEL |
  3380. +@@ -1911,8 +1912,8 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  3381. + }
  3382. +
  3383. + /* Restore TSF */
  3384. +- usec = ktime_to_us(ktime_get_raw()) - usec;
  3385. +- ath9k_hw_settsf64(ah, tsf + usec);
  3386. ++ tsf_offset = ath9k_hw_get_tsf_offset(&tsf_ts, NULL);
  3387. ++ ath9k_hw_settsf64(ah, tsf + tsf_offset);
  3388. +
  3389. + if (AR_SREV_9280_20_OR_LATER(ah))
  3390. + REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL, AR_GPIO_JTAG_DISABLE);
  3391. +@@ -1932,12 +1933,11 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  3392. + /*
  3393. + * Some AR91xx SoC devices frequently fail to accept TSF writes
  3394. + * right after the chip reset. When that happens, write a new
  3395. +- * value after the initvals have been applied, with an offset
  3396. +- * based on measured time difference
  3397. ++ * value after the initvals have been applied.
  3398. + */
  3399. + if (AR_SREV_9100(ah) && (ath9k_hw_gettsf64(ah) < tsf)) {
  3400. +- tsf += 1500;
  3401. +- ath9k_hw_settsf64(ah, tsf);
  3402. ++ tsf_offset = ath9k_hw_get_tsf_offset(&tsf_ts, NULL);
  3403. ++ ath9k_hw_settsf64(ah, tsf + tsf_offset);
  3404. + }
  3405. +
  3406. + ath9k_hw_init_mfp(ah);
  3407. 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
  3408. deleted file mode 100644
  3409. index 5b3efbdc5aff65de96b959fbc250f7ddde0c5459..0000000000000000000000000000000000000000
  3410. --- a/package/kernel/mac80211/patches/314-mac80211-Requeue-work-after-scan-complete-for-all-VI.patch
  3411. +++ /dev/null
  3412. @@ -1,103 +0,0 @@
  3413. -From: Sachin Kulkarni <Sachin.Kulkarni@imgtec.com>
  3414. -Date: Tue, 12 Jan 2016 14:30:19 +0530
  3415. -Subject: [PATCH] mac80211: Requeue work after scan complete for all VIF
  3416. - types.
  3417. -
  3418. -During a sw scan ieee80211_iface_work ignores work items for all vifs.
  3419. -However after the scan complete work is requeued only for STA, ADHOC
  3420. -and MESH iftypes.
  3421. -
  3422. -This occasionally results in event processing getting delayed/not
  3423. -processed for iftype AP when it coexists with a STA. This can result
  3424. -in data halt and eventually disconnection on the AP interface.
  3425. -
  3426. -Signed-off-by: Sachin Kulkarni <Sachin.Kulkarni@imgtec.com>
  3427. -Cc: linux-wireless@vger.kernel.org
  3428. -Cc: johannes@sipsolutions.net
  3429. ----
  3430. -
  3431. ---- a/net/mac80211/ibss.c
  3432. -+++ b/net/mac80211/ibss.c
  3433. -@@ -1731,7 +1731,6 @@ void ieee80211_ibss_notify_scan_complete
  3434. - if (sdata->vif.type != NL80211_IFTYPE_ADHOC)
  3435. - continue;
  3436. - sdata->u.ibss.last_scan_completed = jiffies;
  3437. -- ieee80211_queue_work(&local->hw, &sdata->work);
  3438. - }
  3439. - mutex_unlock(&local->iflist_mtx);
  3440. - }
  3441. ---- a/net/mac80211/mesh.c
  3442. -+++ b/net/mac80211/mesh.c
  3443. -@@ -1369,17 +1369,6 @@ out:
  3444. - sdata_unlock(sdata);
  3445. - }
  3446. -
  3447. --void ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local)
  3448. --{
  3449. -- struct ieee80211_sub_if_data *sdata;
  3450. --
  3451. -- rcu_read_lock();
  3452. -- list_for_each_entry_rcu(sdata, &local->interfaces, list)
  3453. -- if (ieee80211_vif_is_mesh(&sdata->vif) &&
  3454. -- ieee80211_sdata_running(sdata))
  3455. -- ieee80211_queue_work(&local->hw, &sdata->work);
  3456. -- rcu_read_unlock();
  3457. --}
  3458. -
  3459. - void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata)
  3460. - {
  3461. ---- a/net/mac80211/mesh.h
  3462. -+++ b/net/mac80211/mesh.h
  3463. -@@ -362,14 +362,10 @@ static inline bool mesh_path_sel_is_hwmp
  3464. - return sdata->u.mesh.mesh_pp_id == IEEE80211_PATH_PROTOCOL_HWMP;
  3465. - }
  3466. -
  3467. --void ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local);
  3468. --
  3469. - void mesh_path_flush_by_iface(struct ieee80211_sub_if_data *sdata);
  3470. - void mesh_sync_adjust_tbtt(struct ieee80211_sub_if_data *sdata);
  3471. - void ieee80211s_stop(void);
  3472. - #else
  3473. --static inline void
  3474. --ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local) {}
  3475. - static inline bool mesh_path_sel_is_hwmp(struct ieee80211_sub_if_data *sdata)
  3476. - { return false; }
  3477. - static inline void mesh_path_flush_by_iface(struct ieee80211_sub_if_data *sdata)
  3478. ---- a/net/mac80211/mlme.c
  3479. -+++ b/net/mac80211/mlme.c
  3480. -@@ -3978,8 +3978,6 @@ static void ieee80211_restart_sta_timer(
  3481. - if (!ieee80211_hw_check(&sdata->local->hw, CONNECTION_MONITOR))
  3482. - ieee80211_queue_work(&sdata->local->hw,
  3483. - &sdata->u.mgd.monitor_work);
  3484. -- /* and do all the other regular work too */
  3485. -- ieee80211_queue_work(&sdata->local->hw, &sdata->work);
  3486. - }
  3487. - }
  3488. -
  3489. ---- a/net/mac80211/scan.c
  3490. -+++ b/net/mac80211/scan.c
  3491. -@@ -314,6 +314,7 @@ static void __ieee80211_scan_completed(s
  3492. - bool was_scanning = local->scanning;
  3493. - struct cfg80211_scan_request *scan_req;
  3494. - struct ieee80211_sub_if_data *scan_sdata;
  3495. -+ struct ieee80211_sub_if_data *sdata;
  3496. -
  3497. - lockdep_assert_held(&local->mtx);
  3498. -
  3499. -@@ -373,7 +374,15 @@ static void __ieee80211_scan_completed(s
  3500. -
  3501. - ieee80211_mlme_notify_scan_completed(local);
  3502. - ieee80211_ibss_notify_scan_completed(local);
  3503. -- ieee80211_mesh_notify_scan_completed(local);
  3504. -+
  3505. -+ /* Requeue all the work that might have been ignored while
  3506. -+ * the scan was in progress
  3507. -+ */
  3508. -+ list_for_each_entry_rcu(sdata, &local->interfaces, list) {
  3509. -+ if (ieee80211_sdata_running(sdata))
  3510. -+ ieee80211_queue_work(&sdata->local->hw, &sdata->work);
  3511. -+ }
  3512. -+
  3513. - if (was_scanning)
  3514. - ieee80211_start_next_roc(local);
  3515. - }
  3516. 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
  3517. new file mode 100644
  3518. index 0000000000000000000000000000000000000000..c95ab7e644c4c932b619ae9b09a16a91347fc8da
  3519. --- /dev/null
  3520. +++ b/package/kernel/mac80211/patches/315-ath9k-Expose-tsf_adjustment-in-mac80211-tsf-getters-.patch
  3521. @@ -0,0 +1,32 @@
  3522. +From: Benjamin Berg <benjamin.berg@open-mesh.com>
  3523. +Date: Mon, 4 Jul 2016 14:37:23 +0200
  3524. +Subject: [PATCH] ath9k: Expose tsf_adjustment in mac80211 tsf getters and
  3525. + setters.
  3526. +
  3527. +The ath9k driver modifies the TSF for VIFs for the purpose of sending
  3528. +beacons in a staggered fashion. This patch exposes this VIF specific
  3529. +adjustment of the TSF value to mac80211. Without the change the TSF
  3530. +routines handle the hardware TSF value instead of the actual TSF value as
  3531. +seen on the air.
  3532. +
  3533. +Signed-off-by: Benjamin Berg <benjamin.berg@open-mesh.com>
  3534. +---
  3535. +
  3536. +--- a/drivers/net/wireless/ath/ath9k/main.c
  3537. ++++ b/drivers/net/wireless/ath/ath9k/main.c
  3538. +@@ -1835,6 +1835,7 @@ static u64 ath9k_get_tsf(struct ieee8021
  3539. + tsf = sc->cur_chan->tsf_val +
  3540. + ath9k_hw_get_tsf_offset(&sc->cur_chan->tsf_ts, NULL);
  3541. + }
  3542. ++ tsf += le64_to_cpu(avp->tsf_adjust);
  3543. + ath9k_ps_restore(sc);
  3544. + mutex_unlock(&sc->mutex);
  3545. +
  3546. +@@ -1850,6 +1851,7 @@ static void ath9k_set_tsf(struct ieee802
  3547. +
  3548. + mutex_lock(&sc->mutex);
  3549. + ath9k_ps_wakeup(sc);
  3550. ++ tsf -= le64_to_cpu(avp->tsf_adjust);
  3551. + getrawmonotonic(&avp->chanctx->tsf_ts);
  3552. + if (sc->cur_chan == avp->chanctx)
  3553. + ath9k_hw_settsf64(sc->sc_ah, tsf);
  3554. 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
  3555. deleted file mode 100644
  3556. index 52fecb96b002de8ed650e2155f846cbcc9ba0900..0000000000000000000000000000000000000000
  3557. --- a/package/kernel/mac80211/patches/315-mac80211-fix-ibss-scan-parameters.patch
  3558. +++ /dev/null
  3559. @@ -1,57 +0,0 @@
  3560. -From: Sara Sharon <sara.sharon@intel.com>
  3561. -Date: Mon, 25 Jan 2016 15:46:35 +0200
  3562. -Subject: [PATCH] mac80211: fix ibss scan parameters
  3563. -
  3564. -When joining IBSS a full scan should be initiated in order to search
  3565. -for existing cell, unless the fixed_channel parameter was set.
  3566. -A default channel to create the IBSS on if no cell was found is
  3567. -provided as well.
  3568. -However - a scan is initiated only on the default channel provided
  3569. -regardless of whether ifibss->fixed_channel is set or not, with the
  3570. -obvious result of the cell not joining existing IBSS cell that is
  3571. -on another channel.
  3572. -
  3573. -Fixes: 76bed0f43b27 ("mac80211: IBSS fix scan request")
  3574. -Signed-off-by: Sara Sharon <sara.sharon@intel.com>
  3575. -Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
  3576. ----
  3577. -
  3578. ---- a/net/mac80211/ibss.c
  3579. -+++ b/net/mac80211/ibss.c
  3580. -@@ -7,6 +7,7 @@
  3581. - * Copyright 2007, Michael Wu <flamingice@sourmilk.net>
  3582. - * Copyright 2009, Johannes Berg <johannes@sipsolutions.net>
  3583. - * Copyright 2013-2014 Intel Mobile Communications GmbH
  3584. -+ * Copyright(c) 2016 Intel Deutschland GmbH
  3585. - *
  3586. - * This program is free software; you can redistribute it and/or modify
  3587. - * it under the terms of the GNU General Public License version 2 as
  3588. -@@ -1483,14 +1484,21 @@ static void ieee80211_sta_find_ibss(stru
  3589. -
  3590. - sdata_info(sdata, "Trigger new scan to find an IBSS to join\n");
  3591. -
  3592. -- num = ieee80211_ibss_setup_scan_channels(local->hw.wiphy,
  3593. -- &ifibss->chandef,
  3594. -- channels,
  3595. -- ARRAY_SIZE(channels));
  3596. - scan_width = cfg80211_chandef_to_scan_width(&ifibss->chandef);
  3597. -- ieee80211_request_ibss_scan(sdata, ifibss->ssid,
  3598. -- ifibss->ssid_len, channels, num,
  3599. -- scan_width);
  3600. -+
  3601. -+ if (ifibss->fixed_channel) {
  3602. -+ num = ieee80211_ibss_setup_scan_channels(local->hw.wiphy,
  3603. -+ &ifibss->chandef,
  3604. -+ channels,
  3605. -+ ARRAY_SIZE(channels));
  3606. -+ ieee80211_request_ibss_scan(sdata, ifibss->ssid,
  3607. -+ ifibss->ssid_len, channels,
  3608. -+ num, scan_width);
  3609. -+ } else {
  3610. -+ ieee80211_request_ibss_scan(sdata, ifibss->ssid,
  3611. -+ ifibss->ssid_len, NULL,
  3612. -+ 0, scan_width);
  3613. -+ }
  3614. - } else {
  3615. - int interval = IEEE80211_SCAN_INTERVAL;
  3616. -
  3617. 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
  3618. new file mode 100644
  3619. index 0000000000000000000000000000000000000000..36aaa1030ea87569202cd109bb59479cbb0b64e5
  3620. --- /dev/null
  3621. +++ b/package/kernel/mac80211/patches/316-ath9k-Remove-some-defined-constants-to-decrease-verb.patch
  3622. @@ -0,0 +1,137 @@
  3623. +From: Benjamin Berg <benjamin.berg@open-mesh.com>
  3624. +Date: Mon, 4 Jul 2016 14:37:24 +0200
  3625. +Subject: [PATCH] ath9k: Remove some #defined constants to decrease
  3626. + verbosity
  3627. +
  3628. +The removed ATH9K_SLOT_TIME_X constants simply map the value in microseconds
  3629. +to the same integer. These constants were not used consistently, so fix the
  3630. +inconsistency issue by replacing all occurances with the integer equivalent.
  3631. +
  3632. +Signed-off-by: Benjamin Berg <benjamin.berg@open-mesh.com>
  3633. +---
  3634. +
  3635. +--- a/drivers/net/wireless/ath/ath9k/beacon.c
  3636. ++++ b/drivers/net/wireless/ath/ath9k/beacon.c
  3637. +@@ -50,7 +50,7 @@ static void ath9k_beaconq_config(struct
  3638. + txq = sc->tx.txq_map[IEEE80211_AC_BE];
  3639. + ath9k_hw_get_txq_props(ah, txq->axq_qnum, &qi_be);
  3640. + qi.tqi_aifs = qi_be.tqi_aifs;
  3641. +- if (ah->slottime == ATH9K_SLOT_TIME_20)
  3642. ++ if (ah->slottime == 20)
  3643. + qi.tqi_cwmin = 2*qi_be.tqi_cwmin;
  3644. + else
  3645. + qi.tqi_cwmin = 4*qi_be.tqi_cwmin;
  3646. +--- a/drivers/net/wireless/ath/ath9k/dynack.c
  3647. ++++ b/drivers/net/wireless/ath/ath9k/dynack.c
  3648. +@@ -280,7 +280,7 @@ EXPORT_SYMBOL(ath_dynack_sample_ack_ts);
  3649. + void ath_dynack_node_init(struct ath_hw *ah, struct ath_node *an)
  3650. + {
  3651. + /* ackto = slottime + sifs + air delay */
  3652. +- u32 ackto = ATH9K_SLOT_TIME_9 + 16 + 64;
  3653. ++ u32 ackto = 9 + 16 + 64;
  3654. + struct ath_dynack *da = &ah->dynack;
  3655. +
  3656. + an->ackto = ackto;
  3657. +@@ -315,7 +315,7 @@ EXPORT_SYMBOL(ath_dynack_node_deinit);
  3658. + void ath_dynack_reset(struct ath_hw *ah)
  3659. + {
  3660. + /* ackto = slottime + sifs + air delay */
  3661. +- u32 ackto = ATH9K_SLOT_TIME_9 + 16 + 64;
  3662. ++ u32 ackto = 9 + 16 + 64;
  3663. + struct ath_dynack *da = &ah->dynack;
  3664. +
  3665. + da->lto = jiffies;
  3666. +--- a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
  3667. ++++ b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
  3668. +@@ -45,7 +45,7 @@ void ath9k_htc_beaconq_config(struct ath
  3669. + * Long slot time : 2x cwmin
  3670. + * Short slot time : 4x cwmin
  3671. + */
  3672. +- if (ah->slottime == ATH9K_SLOT_TIME_20)
  3673. ++ if (ah->slottime == 20)
  3674. + qi.tqi_cwmin = 2*qi_be.tqi_cwmin;
  3675. + else
  3676. + qi.tqi_cwmin = 4*qi_be.tqi_cwmin;
  3677. +--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
  3678. ++++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
  3679. +@@ -678,7 +678,7 @@ static int ath9k_init_priv(struct ath9k_
  3680. +
  3681. + for (i = 0; i < ATH9K_HTC_MAX_BCN_VIF; i++)
  3682. + priv->beacon.bslot[i] = NULL;
  3683. +- priv->beacon.slottime = ATH9K_SLOT_TIME_9;
  3684. ++ priv->beacon.slottime = 9;
  3685. +
  3686. + ath9k_cmn_init_channels_rates(common);
  3687. + ath9k_cmn_init_crypto(ah);
  3688. +--- a/drivers/net/wireless/ath/ath9k/hw.c
  3689. ++++ b/drivers/net/wireless/ath/ath9k/hw.c
  3690. +@@ -454,7 +454,7 @@ static void ath9k_hw_init_defaults(struc
  3691. + if (AR_SREV_9100(ah))
  3692. + ah->sta_id1_defaults |= AR_STA_ID1_AR9100_BA_FIX;
  3693. +
  3694. +- ah->slottime = ATH9K_SLOT_TIME_9;
  3695. ++ ah->slottime = 9;
  3696. + ah->globaltxtimeout = (u32) -1;
  3697. + ah->power_mode = ATH9K_PM_UNDEFINED;
  3698. + ah->htc_reset_init = true;
  3699. +--- a/drivers/net/wireless/ath/ath9k/init.c
  3700. ++++ b/drivers/net/wireless/ath/ath9k/init.c
  3701. +@@ -372,7 +372,7 @@ static void ath9k_init_misc(struct ath_s
  3702. +
  3703. + common->last_rssi = ATH_RSSI_DUMMY_MARKER;
  3704. + memcpy(common->bssidmask, ath_bcast_mac, ETH_ALEN);
  3705. +- sc->beacon.slottime = ATH9K_SLOT_TIME_9;
  3706. ++ sc->beacon.slottime = 9;
  3707. +
  3708. + for (i = 0; i < ARRAY_SIZE(sc->beacon.bslot); i++)
  3709. + sc->beacon.bslot[i] = NULL;
  3710. +--- a/drivers/net/wireless/ath/ath9k/mac.h
  3711. ++++ b/drivers/net/wireless/ath/ath9k/mac.h
  3712. +@@ -65,10 +65,6 @@
  3713. + #define INIT_SSH_RETRY 32
  3714. + #define INIT_SLG_RETRY 32
  3715. +
  3716. +-#define ATH9K_SLOT_TIME_6 6
  3717. +-#define ATH9K_SLOT_TIME_9 9
  3718. +-#define ATH9K_SLOT_TIME_20 20
  3719. +-
  3720. + #define ATH9K_TXERR_XRETRY 0x01
  3721. + #define ATH9K_TXERR_FILT 0x02
  3722. + #define ATH9K_TXERR_FIFO 0x04
  3723. +--- a/drivers/net/wireless/ath/ath9k/main.c
  3724. ++++ b/drivers/net/wireless/ath/ath9k/main.c
  3725. +@@ -926,7 +926,7 @@ static void ath9k_vif_iter(struct ath9k_
  3726. + }
  3727. +
  3728. + if (!vif->bss_conf.use_short_slot)
  3729. +- iter_data->slottime = ATH9K_SLOT_TIME_20;
  3730. ++ iter_data->slottime = 20;
  3731. +
  3732. + switch (vif->type) {
  3733. + case NL80211_IFTYPE_AP:
  3734. +@@ -999,7 +999,7 @@ void ath9k_calculate_iter_data(struct at
  3735. + */
  3736. + memset(iter_data, 0, sizeof(*iter_data));
  3737. + eth_broadcast_addr(iter_data->mask);
  3738. +- iter_data->slottime = ATH9K_SLOT_TIME_9;
  3739. ++ iter_data->slottime = 9;
  3740. +
  3741. + list_for_each_entry(avp, &ctx->vifs, list)
  3742. + ath9k_vif_iter(iter_data, avp->vif->addr, avp->vif);
  3743. +@@ -1061,7 +1061,7 @@ static void ath9k_set_offchannel_state(s
  3744. + ah->opmode = vif->type;
  3745. + ah->imask &= ~ATH9K_INT_SWBA;
  3746. + ah->imask &= ~ATH9K_INT_TSFOOR;
  3747. +- ah->slottime = ATH9K_SLOT_TIME_9;
  3748. ++ ah->slottime = 9;
  3749. +
  3750. + ath_hw_setbssidmask(common);
  3751. + ath9k_hw_setopmode(ah);
  3752. +@@ -1788,6 +1788,7 @@ static void ath9k_bss_info_changed(struc
  3753. + slottime = 9;
  3754. + else
  3755. + slottime = 20;
  3756. ++
  3757. + if (vif->type == NL80211_IFTYPE_AP) {
  3758. + /*
  3759. + * Defer update, so that connected stations can adjust
  3760. 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
  3761. deleted file mode 100644
  3762. index e78df366003ee0d1cb5402e7c0760d96c45a40d7..0000000000000000000000000000000000000000
  3763. --- a/package/kernel/mac80211/patches/316-net-mac80211-agg-rx.c-fix-use-of-uninitialised-value.patch
  3764. +++ /dev/null
  3765. @@ -1,50 +0,0 @@
  3766. -From: Chris Bainbridge <chris.bainbridge@gmail.com>
  3767. -Date: Wed, 27 Jan 2016 15:46:18 +0000
  3768. -Subject: [PATCH] net/mac80211/agg-rx.c: fix use of uninitialised values
  3769. -
  3770. -Use kzalloc instead of kmalloc for struct tid_ampdu_rx. Fixes:
  3771. -
  3772. -[ 7.976605] UBSAN: Undefined behaviour in net/mac80211/rx.c:932:29
  3773. -[ 7.976608] load of value 2 is not a valid value for type '_Bool'
  3774. -[ 7.976611] CPU: 3 PID: 1134 Comm: kworker/u16:7 Not tainted 4.5.0-rc1+ #265
  3775. -[ 7.976613] Hardware name: Apple Inc. MacBookPro10,2/Mac-AFD8A9D944EA4843, BIOS MBP102.88Z.0106.B0A.1509130955 09/13/2015
  3776. -[ 7.976616] Workqueue: phy0 rt2x00usb_work_rxdone
  3777. -[ 7.976619] 0000000000000004 ffff880254a7ba50 ffffffff8181d866 0000000000000007
  3778. -[ 7.976622] ffff880254a7ba78 ffff880254a7ba68 ffffffff8188422d ffffffff8379b500
  3779. -[ 7.976626] ffff880254a7bab8 ffffffff81884747 0000000000000202 0000000348620032
  3780. -[ 7.976629] Call Trace:
  3781. -[ 7.976633] [<ffffffff8181d866>] dump_stack+0x45/0x5f
  3782. -[ 7.976637] [<ffffffff8188422d>] ubsan_epilogue+0xd/0x40
  3783. -[ 7.976642] [<ffffffff81884747>] __ubsan_handle_load_invalid_value+0x67/0x70
  3784. -[ 7.976646] [<ffffffff82227b4d>] ieee80211_sta_reorder_release.isra.16+0x5ed/0x730
  3785. -[ 7.976650] [<ffffffff8222ca14>] ieee80211_prepare_and_rx_handle+0xd04/0x1c00
  3786. -[ 7.976654] [<ffffffff81cb27ce>] ? usb_hcd_map_urb_for_dma+0x65e/0x960
  3787. -[ 7.976659] [<ffffffff8222db03>] __ieee80211_rx_handle_packet+0x1f3/0x750
  3788. -[ 7.976663] [<ffffffff8222e4a7>] ieee80211_rx_napi+0x447/0x990
  3789. -[ 7.976667] [<ffffffff81c5fb85>] rt2x00lib_rxdone+0x305/0xbd0
  3790. -[ 7.976670] [<ffffffff811ac23f>] ? dequeue_task_fair+0x64f/0x1de0
  3791. -[ 7.976674] [<ffffffff811a1516>] ? sched_clock_cpu+0xe6/0x150
  3792. -[ 7.976678] [<ffffffff81c6c45c>] rt2x00usb_work_rxdone+0x7c/0x140
  3793. -[ 7.976682] [<ffffffff8117aef6>] process_one_work+0x226/0x860
  3794. -[ 7.976686] [<ffffffff8117b58c>] worker_thread+0x5c/0x680
  3795. -[ 7.976690] [<ffffffff8117b530>] ? process_one_work+0x860/0x860
  3796. -[ 7.976693] [<ffffffff81184f86>] kthread+0xf6/0x150
  3797. -[ 7.976697] [<ffffffff81184e90>] ? kthread_worker_fn+0x310/0x310
  3798. -[ 7.976700] [<ffffffff822a94df>] ret_from_fork+0x3f/0x70
  3799. -[ 7.976703] [<ffffffff81184e90>] ? kthread_worker_fn+0x310/0x310
  3800. -
  3801. -Link: https://lkml.org/lkml/2016/1/26/230
  3802. -Signed-off-by: Chris Bainbridge <chris.bainbridge@gmail.com>
  3803. ----
  3804. -
  3805. ---- a/net/mac80211/agg-rx.c
  3806. -+++ b/net/mac80211/agg-rx.c
  3807. -@@ -327,7 +327,7 @@ void __ieee80211_start_rx_ba_session(str
  3808. - }
  3809. -
  3810. - /* prepare A-MPDU MLME for Rx aggregation */
  3811. -- tid_agg_rx = kmalloc(sizeof(struct tid_ampdu_rx), GFP_KERNEL);
  3812. -+ tid_agg_rx = kzalloc(sizeof(struct tid_ampdu_rx), GFP_KERNEL);
  3813. - if (!tid_agg_rx)
  3814. - goto end;
  3815. -
  3816. 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
  3817. new file mode 100644
  3818. index 0000000000000000000000000000000000000000..360dfbfafb9b2c98e4b679aa45db5c7a2e747a3b
  3819. --- /dev/null
  3820. +++ b/package/kernel/mac80211/patches/317-ath9k-Fix-beacon-configuration-for-addition-removal-.patch
  3821. @@ -0,0 +1,544 @@
  3822. +From: Benjamin Berg <benjamin.berg@open-mesh.com>
  3823. +Date: Mon, 4 Jul 2016 14:37:25 +0200
  3824. +Subject: [PATCH] ath9k: Fix beacon configuration for addition/removal of
  3825. + interfaces
  3826. +
  3827. +This patch fixes some issues with interface reconfiguration. It could
  3828. +for example happen that an AP interface in beacon slot 0 was removed
  3829. +leaving an IBSS station in one of the other slots. When this happens
  3830. +the driver never sends out the beacon as it only tries to send a beacon
  3831. +from slot 0.
  3832. +
  3833. +Appart from that the tracking of required changes to the beacon config is
  3834. +relatively complicated and prone to errors.
  3835. +
  3836. +The approach taken here is to solve reconfiguration issues is to
  3837. +reconfigure the beacons when any interface changes. This means that
  3838. +the complexity of deciding whether an interface change may modify the
  3839. +beacon configuration is gone. It also means that the beacon config will
  3840. +be reliably updated when an interface is removed.
  3841. +
  3842. +The issue that a single non-AP interface might not be in beacon
  3843. +slot 0 and wouldn't be send out is solved by moving it into the
  3844. +first slot. The TSF value in hardware is adjusted accordingly so
  3845. +that the timestamp of the beacons stay consistent.
  3846. +
  3847. +Signed-off-by: Benjamin Berg <benjamin.berg@open-mesh.com>
  3848. +---
  3849. +
  3850. +--- a/drivers/net/wireless/ath/ath9k/ath9k.h
  3851. ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  3852. +@@ -637,6 +637,8 @@ struct ath9k_vif_iter_data {
  3853. + int nwds; /* number of WDS vifs */
  3854. + int nadhocs; /* number of adhoc vifs */
  3855. + int nocbs; /* number of OCB vifs */
  3856. ++ int nbcnvifs; /* number of beaconing vifs */
  3857. ++ struct ieee80211_vif *primary_beacon_vif;
  3858. + struct ieee80211_vif *primary_sta;
  3859. + };
  3860. +
  3861. +@@ -685,10 +687,11 @@ struct ath_beacon {
  3862. + };
  3863. +
  3864. + void ath9k_beacon_tasklet(unsigned long data);
  3865. +-void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif,
  3866. +- u32 changed);
  3867. ++void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *main_vif,
  3868. ++ bool beacons);
  3869. + void ath9k_beacon_assign_slot(struct ath_softc *sc, struct ieee80211_vif *vif);
  3870. + void ath9k_beacon_remove_slot(struct ath_softc *sc, struct ieee80211_vif *vif);
  3871. ++void ath9k_beacon_ensure_primary_slot(struct ath_softc *sc);
  3872. + void ath9k_set_beacon(struct ath_softc *sc);
  3873. + bool ath9k_csa_is_finished(struct ath_softc *sc, struct ieee80211_vif *vif);
  3874. + void ath9k_csa_update(struct ath_softc *sc);
  3875. +--- a/drivers/net/wireless/ath/ath9k/beacon.c
  3876. ++++ b/drivers/net/wireless/ath/ath9k/beacon.c
  3877. +@@ -209,7 +209,6 @@ void ath9k_beacon_assign_slot(struct ath
  3878. + }
  3879. +
  3880. + sc->beacon.bslot[avp->av_bslot] = vif;
  3881. +- sc->nbcnvifs++;
  3882. +
  3883. + ath_dbg(common, CONFIG, "Added interface at beacon slot: %d\n",
  3884. + avp->av_bslot);
  3885. +@@ -220,15 +219,12 @@ void ath9k_beacon_remove_slot(struct ath
  3886. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  3887. + struct ath_vif *avp = (void *)vif->drv_priv;
  3888. + struct ath_buf *bf = avp->av_bcbuf;
  3889. +- struct ath_beacon_config *cur_conf = &sc->cur_chan->beacon;
  3890. +
  3891. + ath_dbg(common, CONFIG, "Removing interface at beacon slot: %d\n",
  3892. + avp->av_bslot);
  3893. +
  3894. + tasklet_disable(&sc->bcon_tasklet);
  3895. +
  3896. +- cur_conf->enable_beacon &= ~BIT(avp->av_bslot);
  3897. +-
  3898. + if (bf && bf->bf_mpdu) {
  3899. + struct sk_buff *skb = bf->bf_mpdu;
  3900. + dma_unmap_single(sc->dev, bf->bf_buf_addr,
  3901. +@@ -240,12 +236,73 @@ void ath9k_beacon_remove_slot(struct ath
  3902. +
  3903. + avp->av_bcbuf = NULL;
  3904. + sc->beacon.bslot[avp->av_bslot] = NULL;
  3905. +- sc->nbcnvifs--;
  3906. + list_add_tail(&bf->list, &sc->beacon.bbuf);
  3907. +
  3908. + tasklet_enable(&sc->bcon_tasklet);
  3909. + }
  3910. +
  3911. ++void ath9k_beacon_ensure_primary_slot(struct ath_softc *sc)
  3912. ++{
  3913. ++ struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  3914. ++ struct ieee80211_vif *vif;
  3915. ++ struct ath_vif *avp;
  3916. ++ s64 tsfadjust;
  3917. ++ u32 offset;
  3918. ++ int first_slot = ATH_BCBUF;
  3919. ++ int slot;
  3920. ++
  3921. ++ tasklet_disable(&sc->bcon_tasklet);
  3922. ++
  3923. ++ /* Find first taken slot. */
  3924. ++ for (slot = 0; slot < ATH_BCBUF; slot++) {
  3925. ++ if (sc->beacon.bslot[slot]) {
  3926. ++ first_slot = slot;
  3927. ++ break;
  3928. ++ }
  3929. ++ }
  3930. ++ if (first_slot == 0)
  3931. ++ goto out;
  3932. ++
  3933. ++ /* Re-enumarate all slots, moving them forward. */
  3934. ++ for (slot = 0; slot < ATH_BCBUF; slot++) {
  3935. ++ if (slot + first_slot < ATH_BCBUF) {
  3936. ++ vif = sc->beacon.bslot[slot + first_slot];
  3937. ++ sc->beacon.bslot[slot] = vif;
  3938. ++
  3939. ++ if (vif) {
  3940. ++ avp = (void *)vif->drv_priv;
  3941. ++ avp->av_bslot = slot;
  3942. ++ }
  3943. ++ } else {
  3944. ++ sc->beacon.bslot[slot] = NULL;
  3945. ++ }
  3946. ++ }
  3947. ++
  3948. ++ vif = sc->beacon.bslot[0];
  3949. ++ if (WARN_ON(!vif))
  3950. ++ goto out;
  3951. ++
  3952. ++ /* Get the tsf_adjust value for the new first slot. */
  3953. ++ avp = (void *)vif->drv_priv;
  3954. ++ tsfadjust = le64_to_cpu(avp->tsf_adjust);
  3955. ++
  3956. ++ ath_dbg(common, CONFIG,
  3957. ++ "Adjusting global TSF after beacon slot reassignment: %lld\n",
  3958. ++ (signed long long)tsfadjust);
  3959. ++
  3960. ++ /* Modify TSF as required and update the HW. */
  3961. ++ avp->chanctx->tsf_val += tsfadjust;
  3962. ++ if (sc->cur_chan == avp->chanctx) {
  3963. ++ offset = ath9k_hw_get_tsf_offset(&avp->chanctx->tsf_ts, NULL);
  3964. ++ ath9k_hw_settsf64(sc->sc_ah, avp->chanctx->tsf_val + offset);
  3965. ++ }
  3966. ++
  3967. ++ /* The slots tsf_adjust will be updated by ath9k_beacon_config later. */
  3968. ++
  3969. ++out:
  3970. ++ tasklet_enable(&sc->bcon_tasklet);
  3971. ++}
  3972. ++
  3973. + static int ath9k_beacon_choose_slot(struct ath_softc *sc)
  3974. + {
  3975. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  3976. +@@ -274,26 +331,33 @@ static int ath9k_beacon_choose_slot(stru
  3977. + return slot;
  3978. + }
  3979. +
  3980. +-static void ath9k_set_tsfadjust(struct ath_softc *sc, struct ieee80211_vif *vif)
  3981. ++static void ath9k_set_tsfadjust(struct ath_softc *sc,
  3982. ++ struct ath_beacon_config *cur_conf)
  3983. + {
  3984. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  3985. +- struct ath_vif *avp = (void *)vif->drv_priv;
  3986. +- struct ath_beacon_config *cur_conf = &avp->chanctx->beacon;
  3987. + s64 tsfadjust;
  3988. ++ int slot;
  3989. +
  3990. +- if (avp->av_bslot == 0)
  3991. +- return;
  3992. ++ for (slot = 0; slot < ATH_BCBUF; slot++) {
  3993. ++ struct ath_vif *avp;
  3994. +
  3995. +- /* tsf_adjust is added to the TSF value. We send out the beacon late,
  3996. +- * so need to adjust the TSF starting point to be later in time (i.e.
  3997. +- * the theoretical first beacon has a TSF of 0 after correction).
  3998. +- */
  3999. +- tsfadjust = cur_conf->beacon_interval * avp->av_bslot;
  4000. +- tsfadjust = -TU_TO_USEC(tsfadjust) / ATH_BCBUF;
  4001. +- avp->tsf_adjust = cpu_to_le64(tsfadjust);
  4002. ++ if (!sc->beacon.bslot[slot])
  4003. ++ continue;
  4004. +
  4005. +- ath_dbg(common, CONFIG, "tsfadjust is: %lld for bslot: %d\n",
  4006. +- (signed long long)tsfadjust, avp->av_bslot);
  4007. ++ avp = (void *)sc->beacon.bslot[slot]->drv_priv;
  4008. ++
  4009. ++ /* tsf_adjust is added to the TSF value. We send out the
  4010. ++ * beacon late, so need to adjust the TSF starting point to be
  4011. ++ * later in time (i.e. the theoretical first beacon has a TSF
  4012. ++ * of 0 after correction).
  4013. ++ */
  4014. ++ tsfadjust = cur_conf->beacon_interval * avp->av_bslot;
  4015. ++ tsfadjust = -TU_TO_USEC(tsfadjust) / ATH_BCBUF;
  4016. ++ avp->tsf_adjust = cpu_to_le64(tsfadjust);
  4017. ++
  4018. ++ ath_dbg(common, CONFIG, "tsfadjust is: %lld for bslot: %d\n",
  4019. ++ (signed long long)tsfadjust, avp->av_bslot);
  4020. ++ }
  4021. + }
  4022. +
  4023. + bool ath9k_csa_is_finished(struct ath_softc *sc, struct ieee80211_vif *vif)
  4024. +@@ -447,20 +511,28 @@ void ath9k_beacon_tasklet(unsigned long
  4025. + * Both nexttbtt and intval have to be in usecs.
  4026. + */
  4027. + static void ath9k_beacon_init(struct ath_softc *sc, u32 nexttbtt,
  4028. +- u32 intval, bool reset_tsf)
  4029. ++ u32 intval)
  4030. + {
  4031. + struct ath_hw *ah = sc->sc_ah;
  4032. +
  4033. + ath9k_hw_disable_interrupts(ah);
  4034. +- if (reset_tsf)
  4035. +- ath9k_hw_reset_tsf(ah);
  4036. + ath9k_beaconq_config(sc);
  4037. + ath9k_hw_beaconinit(ah, nexttbtt, intval);
  4038. ++ ah->imask |= ATH9K_INT_SWBA;
  4039. + sc->beacon.bmisscnt = 0;
  4040. + ath9k_hw_set_interrupts(ah);
  4041. + ath9k_hw_enable_interrupts(ah);
  4042. + }
  4043. +
  4044. ++static void ath9k_beacon_stop(struct ath_softc *sc)
  4045. ++{
  4046. ++ ath9k_hw_disable_interrupts(sc->sc_ah);
  4047. ++ sc->sc_ah->imask &= ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS);
  4048. ++ sc->beacon.bmisscnt = 0;
  4049. ++ ath9k_hw_set_interrupts(sc->sc_ah);
  4050. ++ ath9k_hw_enable_interrupts(sc->sc_ah);
  4051. ++}
  4052. ++
  4053. + /*
  4054. + * For multi-bss ap support beacons are either staggered evenly over N slots or
  4055. + * burst together. For the former arrange for the SWBA to be delivered for each
  4056. +@@ -472,7 +544,7 @@ static void ath9k_beacon_config_ap(struc
  4057. + struct ath_hw *ah = sc->sc_ah;
  4058. +
  4059. + ath9k_cmn_beacon_config_ap(ah, conf, ATH_BCBUF);
  4060. +- ath9k_beacon_init(sc, conf->nexttbtt, conf->intval, false);
  4061. ++ ath9k_beacon_init(sc, conf->nexttbtt, conf->intval);
  4062. + }
  4063. +
  4064. + static void ath9k_beacon_config_sta(struct ath_hw *ah,
  4065. +@@ -501,7 +573,7 @@ static void ath9k_beacon_config_adhoc(st
  4066. +
  4067. + ath9k_cmn_beacon_config_adhoc(ah, conf);
  4068. +
  4069. +- ath9k_beacon_init(sc, conf->nexttbtt, conf->intval, conf->ibss_creator);
  4070. ++ ath9k_beacon_init(sc, conf->nexttbtt, conf->intval);
  4071. +
  4072. + /*
  4073. + * Set the global 'beacon has been configured' flag for the
  4074. +@@ -511,44 +583,6 @@ static void ath9k_beacon_config_adhoc(st
  4075. + set_bit(ATH_OP_BEACONS, &common->op_flags);
  4076. + }
  4077. +
  4078. +-static bool ath9k_allow_beacon_config(struct ath_softc *sc,
  4079. +- struct ieee80211_vif *vif)
  4080. +-{
  4081. +- struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  4082. +- struct ath_vif *avp = (void *)vif->drv_priv;
  4083. +-
  4084. +- if (ath9k_is_chanctx_enabled()) {
  4085. +- /*
  4086. +- * If the VIF is not present in the current channel context,
  4087. +- * then we can't do the usual opmode checks. Allow the
  4088. +- * beacon config for the VIF to be updated in this case and
  4089. +- * return immediately.
  4090. +- */
  4091. +- if (sc->cur_chan != avp->chanctx)
  4092. +- return true;
  4093. +- }
  4094. +-
  4095. +- if (sc->sc_ah->opmode == NL80211_IFTYPE_AP) {
  4096. +- if (vif->type != NL80211_IFTYPE_AP) {
  4097. +- ath_dbg(common, CONFIG,
  4098. +- "An AP interface is already present !\n");
  4099. +- return false;
  4100. +- }
  4101. +- }
  4102. +-
  4103. +- if (sc->sc_ah->opmode == NL80211_IFTYPE_STATION) {
  4104. +- if ((vif->type == NL80211_IFTYPE_STATION) &&
  4105. +- test_bit(ATH_OP_BEACONS, &common->op_flags) &&
  4106. +- vif != sc->cur_chan->primary_sta) {
  4107. +- ath_dbg(common, CONFIG,
  4108. +- "Beacon already configured for a station interface\n");
  4109. +- return false;
  4110. +- }
  4111. +- }
  4112. +-
  4113. +- return true;
  4114. +-}
  4115. +-
  4116. + static void ath9k_cache_beacon_config(struct ath_softc *sc,
  4117. + struct ath_chanctx *ctx,
  4118. + struct ieee80211_bss_conf *bss_conf)
  4119. +@@ -584,87 +618,79 @@ static void ath9k_cache_beacon_config(st
  4120. + if (cur_conf->dtim_period == 0)
  4121. + cur_conf->dtim_period = 1;
  4122. +
  4123. ++ ath9k_set_tsfadjust(sc, cur_conf);
  4124. + }
  4125. +
  4126. +-void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif,
  4127. +- u32 changed)
  4128. ++void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *main_vif,
  4129. ++ bool beacons)
  4130. + {
  4131. +- struct ieee80211_bss_conf *bss_conf = &vif->bss_conf;
  4132. +- struct ath_hw *ah = sc->sc_ah;
  4133. +- struct ath_common *common = ath9k_hw_common(ah);
  4134. +- struct ath_vif *avp = (void *)vif->drv_priv;
  4135. +- struct ath_chanctx *ctx = avp->chanctx;
  4136. ++ struct ath_hw *ah = sc->sc_ah;
  4137. ++ struct ath_common *common = ath9k_hw_common(ah);
  4138. ++ struct ath_vif *avp;
  4139. ++ struct ath_chanctx *ctx;
  4140. + struct ath_beacon_config *cur_conf;
  4141. + unsigned long flags;
  4142. ++ bool enabled;
  4143. + bool skip_beacon = false;
  4144. +
  4145. +- if (!ctx)
  4146. ++ if (!beacons) {
  4147. ++ clear_bit(ATH_OP_BEACONS, &common->op_flags);
  4148. ++ ath9k_beacon_stop(sc);
  4149. + return;
  4150. ++ }
  4151. +
  4152. +- cur_conf = &avp->chanctx->beacon;
  4153. +- if (vif->type == NL80211_IFTYPE_AP)
  4154. +- ath9k_set_tsfadjust(sc, vif);
  4155. +-
  4156. +- if (!ath9k_allow_beacon_config(sc, vif))
  4157. ++ if (WARN_ON(!main_vif))
  4158. + return;
  4159. +
  4160. +- if (vif->type == NL80211_IFTYPE_STATION) {
  4161. +- ath9k_cache_beacon_config(sc, ctx, bss_conf);
  4162. +- if (ctx != sc->cur_chan)
  4163. +- return;
  4164. ++ avp = (void *)main_vif->drv_priv;
  4165. ++ ctx = avp->chanctx;
  4166. ++ cur_conf = &ctx->beacon;
  4167. ++ enabled = cur_conf->enable_beacon;
  4168. ++ cur_conf->enable_beacon = beacons;
  4169. ++
  4170. ++ if (sc->sc_ah->opmode == NL80211_IFTYPE_STATION) {
  4171. ++ ath9k_cache_beacon_config(sc, ctx, &main_vif->bss_conf);
  4172. +
  4173. + ath9k_set_beacon(sc);
  4174. + set_bit(ATH_OP_BEACONS, &common->op_flags);
  4175. + return;
  4176. + }
  4177. +
  4178. +- /*
  4179. +- * Take care of multiple interfaces when
  4180. +- * enabling/disabling SWBA.
  4181. +- */
  4182. +- if (changed & BSS_CHANGED_BEACON_ENABLED) {
  4183. +- bool enabled = cur_conf->enable_beacon;
  4184. +-
  4185. +- if (!bss_conf->enable_beacon) {
  4186. +- cur_conf->enable_beacon &= ~BIT(avp->av_bslot);
  4187. +- } else {
  4188. +- cur_conf->enable_beacon |= BIT(avp->av_bslot);
  4189. +- if (!enabled)
  4190. +- ath9k_cache_beacon_config(sc, ctx, bss_conf);
  4191. +- }
  4192. +- }
  4193. +-
  4194. +- if (ctx != sc->cur_chan)
  4195. +- return;
  4196. ++ /* Update the beacon configuration. */
  4197. ++ ath9k_cache_beacon_config(sc, ctx, &main_vif->bss_conf);
  4198. +
  4199. + /*
  4200. + * Configure the HW beacon registers only when we have a valid
  4201. + * beacon interval.
  4202. + */
  4203. + if (cur_conf->beacon_interval) {
  4204. +- /*
  4205. +- * If we are joining an existing IBSS network, start beaconing
  4206. +- * only after a TSF-sync has taken place. Ensure that this
  4207. +- * happens by setting the appropriate flags.
  4208. ++ /* Special case to sync the TSF when joining an existing IBSS.
  4209. ++ * This is only done if no AP interface is active.
  4210. ++ * Note that mac80211 always resets the TSF when creating a new
  4211. ++ * IBSS interface.
  4212. + */
  4213. +- if ((changed & BSS_CHANGED_IBSS) && !bss_conf->ibss_creator &&
  4214. +- bss_conf->enable_beacon) {
  4215. ++ if (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC &&
  4216. ++ !enabled && beacons && !main_vif->bss_conf.ibss_creator) {
  4217. + spin_lock_irqsave(&sc->sc_pm_lock, flags);
  4218. + sc->ps_flags |= PS_BEACON_SYNC | PS_WAIT_FOR_BEACON;
  4219. + spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
  4220. + skip_beacon = true;
  4221. +- } else {
  4222. +- ath9k_set_beacon(sc);
  4223. + }
  4224. +
  4225. + /*
  4226. + * Do not set the ATH_OP_BEACONS flag for IBSS joiner mode
  4227. + * here, it is done in ath9k_beacon_config_adhoc().
  4228. + */
  4229. +- if (cur_conf->enable_beacon && !skip_beacon)
  4230. ++ if (beacons && !skip_beacon) {
  4231. + set_bit(ATH_OP_BEACONS, &common->op_flags);
  4232. +- else
  4233. ++ ath9k_set_beacon(sc);
  4234. ++ } else {
  4235. + clear_bit(ATH_OP_BEACONS, &common->op_flags);
  4236. ++ ath9k_beacon_stop(sc);
  4237. ++ }
  4238. ++ } else {
  4239. ++ clear_bit(ATH_OP_BEACONS, &common->op_flags);
  4240. ++ ath9k_beacon_stop(sc);
  4241. + }
  4242. + }
  4243. +
  4244. +--- a/drivers/net/wireless/ath/ath9k/common.h
  4245. ++++ b/drivers/net/wireless/ath/ath9k/common.h
  4246. +@@ -50,6 +50,7 @@
  4247. + #define IEEE80211_MS_TO_TU(x) (((x) * 1000) / 1024)
  4248. +
  4249. + struct ath_beacon_config {
  4250. ++ struct ieee80211_vif *main_vif;
  4251. + int beacon_interval;
  4252. + u16 dtim_period;
  4253. + u16 bmiss_timeout;
  4254. +--- a/drivers/net/wireless/ath/ath9k/main.c
  4255. ++++ b/drivers/net/wireless/ath/ath9k/main.c
  4256. +@@ -910,6 +910,22 @@ static bool ath9k_uses_beacons(int type)
  4257. + }
  4258. + }
  4259. +
  4260. ++static void ath9k_vif_iter_set_beacon(struct ath9k_vif_iter_data *iter_data,
  4261. ++ struct ieee80211_vif *vif)
  4262. ++{
  4263. ++ /* Use the first (configured) interface, but prefering AP interfaces. */
  4264. ++ if (!iter_data->primary_beacon_vif) {
  4265. ++ iter_data->primary_beacon_vif = vif;
  4266. ++ } else {
  4267. ++ if (iter_data->primary_beacon_vif->type != NL80211_IFTYPE_AP &&
  4268. ++ vif->type == NL80211_IFTYPE_AP)
  4269. ++ iter_data->primary_beacon_vif = vif;
  4270. ++ }
  4271. ++
  4272. ++ iter_data->beacons = true;
  4273. ++ iter_data->nbcnvifs += 1;
  4274. ++}
  4275. ++
  4276. + static void ath9k_vif_iter(struct ath9k_vif_iter_data *iter_data,
  4277. + u8 *mac, struct ieee80211_vif *vif)
  4278. + {
  4279. +@@ -931,6 +947,8 @@ static void ath9k_vif_iter(struct ath9k_
  4280. + switch (vif->type) {
  4281. + case NL80211_IFTYPE_AP:
  4282. + iter_data->naps++;
  4283. ++ if (vif->bss_conf.enable_beacon)
  4284. ++ ath9k_vif_iter_set_beacon(iter_data, vif);
  4285. + break;
  4286. + case NL80211_IFTYPE_STATION:
  4287. + iter_data->nstations++;
  4288. +@@ -943,12 +961,12 @@ static void ath9k_vif_iter(struct ath9k_
  4289. + case NL80211_IFTYPE_ADHOC:
  4290. + iter_data->nadhocs++;
  4291. + if (vif->bss_conf.enable_beacon)
  4292. +- iter_data->beacons = true;
  4293. ++ ath9k_vif_iter_set_beacon(iter_data, vif);
  4294. + break;
  4295. + case NL80211_IFTYPE_MESH_POINT:
  4296. + iter_data->nmeshes++;
  4297. + if (vif->bss_conf.enable_beacon)
  4298. +- iter_data->beacons = true;
  4299. ++ ath9k_vif_iter_set_beacon(iter_data, vif);
  4300. + break;
  4301. + case NL80211_IFTYPE_WDS:
  4302. + iter_data->nwds++;
  4303. +@@ -1081,7 +1099,6 @@ void ath9k_calculate_summary_state(struc
  4304. + struct ath_hw *ah = sc->sc_ah;
  4305. + struct ath_common *common = ath9k_hw_common(ah);
  4306. + struct ath9k_vif_iter_data iter_data;
  4307. +- struct ath_beacon_config *cur_conf;
  4308. +
  4309. + ath_chanctx_check_active(sc, ctx);
  4310. +
  4311. +@@ -1103,13 +1120,12 @@ void ath9k_calculate_summary_state(struc
  4312. + ath_hw_setbssidmask(common);
  4313. +
  4314. + if (iter_data.naps > 0) {
  4315. +- cur_conf = &ctx->beacon;
  4316. + ath9k_hw_set_tsfadjust(ah, true);
  4317. + ah->opmode = NL80211_IFTYPE_AP;
  4318. +- if (cur_conf->enable_beacon)
  4319. +- iter_data.beacons = true;
  4320. + } else {
  4321. + ath9k_hw_set_tsfadjust(ah, false);
  4322. ++ if (iter_data.beacons)
  4323. ++ ath9k_beacon_ensure_primary_slot(sc);
  4324. +
  4325. + if (iter_data.nmeshes)
  4326. + ah->opmode = NL80211_IFTYPE_MESH_POINT;
  4327. +@@ -1134,7 +1150,6 @@ void ath9k_calculate_summary_state(struc
  4328. + ctx->switch_after_beacon = true;
  4329. + }
  4330. +
  4331. +- ah->imask &= ~ATH9K_INT_SWBA;
  4332. + if (ah->opmode == NL80211_IFTYPE_STATION) {
  4333. + bool changed = (iter_data.primary_sta != ctx->primary_sta);
  4334. +
  4335. +@@ -1151,16 +1166,12 @@ void ath9k_calculate_summary_state(struc
  4336. + if (ath9k_hw_mci_is_enabled(sc->sc_ah))
  4337. + ath9k_mci_update_wlan_channels(sc, true);
  4338. + }
  4339. +- } else if (iter_data.beacons) {
  4340. +- ah->imask |= ATH9K_INT_SWBA;
  4341. + }
  4342. ++ sc->nbcnvifs = iter_data.nbcnvifs;
  4343. ++ ath9k_beacon_config(sc, iter_data.primary_beacon_vif,
  4344. ++ iter_data.beacons);
  4345. + ath9k_hw_set_interrupts(ah);
  4346. +
  4347. +- if (iter_data.beacons)
  4348. +- set_bit(ATH_OP_BEACONS, &common->op_flags);
  4349. +- else
  4350. +- clear_bit(ATH_OP_BEACONS, &common->op_flags);
  4351. +-
  4352. + if (ah->slottime != iter_data.slottime) {
  4353. + ah->slottime = iter_data.slottime;
  4354. + ath9k_hw_init_global_settings(ah);
  4355. +@@ -1777,9 +1788,7 @@ static void ath9k_bss_info_changed(struc
  4356. + if ((changed & BSS_CHANGED_BEACON_ENABLED) ||
  4357. + (changed & BSS_CHANGED_BEACON_INT) ||
  4358. + (changed & BSS_CHANGED_BEACON_INFO)) {
  4359. +- ath9k_beacon_config(sc, vif, changed);
  4360. +- if (changed & BSS_CHANGED_BEACON_ENABLED)
  4361. +- ath9k_calculate_summary_state(sc, avp->chanctx);
  4362. ++ ath9k_calculate_summary_state(sc, avp->chanctx);
  4363. + }
  4364. +
  4365. + if ((avp->chanctx == sc->cur_chan) &&
  4366. 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
  4367. deleted file mode 100644
  4368. index 5bf53b918c4936c09f65ea8a02f9ac7e93cf686a..0000000000000000000000000000000000000000
  4369. --- a/package/kernel/mac80211/patches/317-mac80211-minstrel_ht-fix-out-of-bound-in-minstrel_ht.patch
  4370. +++ /dev/null
  4371. @@ -1,45 +0,0 @@
  4372. -From: Konstantin Khlebnikov <koct9i@gmail.com>
  4373. -Date: Fri, 29 Jan 2016 11:35:12 +0300
  4374. -Subject: [PATCH] mac80211: minstrel_ht: fix out-of-bound in
  4375. - minstrel_ht_set_best_prob_rate
  4376. -
  4377. -Patch fixes this splat
  4378. -
  4379. -BUG: KASAN: slab-out-of-bounds in minstrel_ht_update_stats.isra.7+0x6e1/0x9e0
  4380. -[mac80211] at addr ffff8800cee640f4 Read of size 4 by task swapper/3/0
  4381. -
  4382. -Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>
  4383. -Link: http://lkml.kernel.org/r/CALYGNiNyJhSaVnE35qS6UCGaSb2Dx1_i5HcRavuOX14oTz2P+w@mail.gmail.com
  4384. ----
  4385. -
  4386. ---- a/net/mac80211/rc80211_minstrel_ht.c
  4387. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  4388. -@@ -414,15 +414,16 @@ minstrel_ht_set_best_prob_rate(struct mi
  4389. - (max_tp_group != MINSTREL_CCK_GROUP))
  4390. - return;
  4391. -
  4392. -+ max_gpr_group = mg->max_group_prob_rate / MCS_GROUP_RATES;
  4393. -+ max_gpr_idx = mg->max_group_prob_rate % MCS_GROUP_RATES;
  4394. -+ max_gpr_prob = mi->groups[max_gpr_group].rates[max_gpr_idx].prob_ewma;
  4395. -+
  4396. - if (mrs->prob_ewma > MINSTREL_FRAC(75, 100)) {
  4397. - cur_tp_avg = minstrel_ht_get_tp_avg(mi, cur_group, cur_idx,
  4398. - mrs->prob_ewma);
  4399. - if (cur_tp_avg > tmp_tp_avg)
  4400. - mi->max_prob_rate = index;
  4401. -
  4402. -- max_gpr_group = mg->max_group_prob_rate / MCS_GROUP_RATES;
  4403. -- max_gpr_idx = mg->max_group_prob_rate % MCS_GROUP_RATES;
  4404. -- max_gpr_prob = mi->groups[max_gpr_group].rates[max_gpr_idx].prob_ewma;
  4405. - max_gpr_tp_avg = minstrel_ht_get_tp_avg(mi, max_gpr_group,
  4406. - max_gpr_idx,
  4407. - max_gpr_prob);
  4408. -@@ -431,7 +432,7 @@ minstrel_ht_set_best_prob_rate(struct mi
  4409. - } else {
  4410. - if (mrs->prob_ewma > tmp_prob)
  4411. - mi->max_prob_rate = index;
  4412. -- if (mrs->prob_ewma > mg->rates[mg->max_group_prob_rate].prob_ewma)
  4413. -+ if (mrs->prob_ewma > max_gpr_prob)
  4414. - mg->max_group_prob_rate = index;
  4415. - }
  4416. - }
  4417. 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
  4418. new file mode 100644
  4419. index 0000000000000000000000000000000000000000..d946ecce19bf4e21355cc2563a58a02575d45f77
  4420. --- /dev/null
  4421. +++ b/package/kernel/mac80211/patches/318-brcmfmac-slightly-simplify-building-interface-combin.patch
  4422. @@ -0,0 +1,108 @@
  4423. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4424. +Date: Tue, 7 Jun 2016 21:10:18 +0200
  4425. +Subject: [PATCH] brcmfmac: slightly simplify building interface combinations
  4426. +MIME-Version: 1.0
  4427. +Content-Type: text/plain; charset=UTF-8
  4428. +Content-Transfer-Encoding: 8bit
  4429. +
  4430. +This change reorders some operations in brcmf_setup_ifmodes in hope to
  4431. +make it simpler:
  4432. +1) It allocates arrays right before filling them. This way it's easier
  4433. + to follow requested array length as it's immediately followed by
  4434. + code filling it. It's easier to check e.g. why we need 4 entries for
  4435. + P2P. Other than that it deduplicates some checks (e.g. for P2P).
  4436. +2) It reorders code to first prepare limits and then define a new combo.
  4437. + Previously this was mixed (e.g. we were setting num of channels
  4438. + before preparing limits).
  4439. +3) It modifies mbss code to use i variable just like other combos do.
  4440. +
  4441. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4442. +Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  4443. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4444. +---
  4445. +
  4446. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  4447. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  4448. +@@ -6284,29 +6284,15 @@ static int brcmf_setup_ifmodes(struct wi
  4449. + if (!combo)
  4450. + goto err;
  4451. +
  4452. +- c0_limits = kcalloc(p2p ? 3 : 2, sizeof(*c0_limits), GFP_KERNEL);
  4453. +- if (!c0_limits)
  4454. +- goto err;
  4455. +-
  4456. +- if (p2p) {
  4457. +- p2p_limits = kcalloc(4, sizeof(*p2p_limits), GFP_KERNEL);
  4458. +- if (!p2p_limits)
  4459. +- goto err;
  4460. +- }
  4461. +-
  4462. +- if (mbss) {
  4463. +- mbss_limits = kcalloc(1, sizeof(*mbss_limits), GFP_KERNEL);
  4464. +- if (!mbss_limits)
  4465. +- goto err;
  4466. +- }
  4467. +-
  4468. + wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
  4469. + BIT(NL80211_IFTYPE_ADHOC) |
  4470. + BIT(NL80211_IFTYPE_AP);
  4471. +
  4472. + c = 0;
  4473. + i = 0;
  4474. +- combo[c].num_different_channels = 1;
  4475. ++ c0_limits = kcalloc(p2p ? 3 : 2, sizeof(*c0_limits), GFP_KERNEL);
  4476. ++ if (!c0_limits)
  4477. ++ goto err;
  4478. + c0_limits[i].max = 1;
  4479. + c0_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  4480. + if (p2p) {
  4481. +@@ -6324,6 +6310,7 @@ static int brcmf_setup_ifmodes(struct wi
  4482. + c0_limits[i].max = 1;
  4483. + c0_limits[i++].types = BIT(NL80211_IFTYPE_AP);
  4484. + }
  4485. ++ combo[c].num_different_channels = 1;
  4486. + combo[c].max_interfaces = i;
  4487. + combo[c].n_limits = i;
  4488. + combo[c].limits = c0_limits;
  4489. +@@ -6331,7 +6318,9 @@ static int brcmf_setup_ifmodes(struct wi
  4490. + if (p2p) {
  4491. + c++;
  4492. + i = 0;
  4493. +- combo[c].num_different_channels = 1;
  4494. ++ p2p_limits = kcalloc(4, sizeof(*p2p_limits), GFP_KERNEL);
  4495. ++ if (!p2p_limits)
  4496. ++ goto err;
  4497. + p2p_limits[i].max = 1;
  4498. + p2p_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  4499. + p2p_limits[i].max = 1;
  4500. +@@ -6340,6 +6329,7 @@ static int brcmf_setup_ifmodes(struct wi
  4501. + p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT);
  4502. + p2p_limits[i].max = 1;
  4503. + p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  4504. ++ combo[c].num_different_channels = 1;
  4505. + combo[c].max_interfaces = i;
  4506. + combo[c].n_limits = i;
  4507. + combo[c].limits = p2p_limits;
  4508. +@@ -6347,14 +6337,19 @@ static int brcmf_setup_ifmodes(struct wi
  4509. +
  4510. + if (mbss) {
  4511. + c++;
  4512. ++ i = 0;
  4513. ++ mbss_limits = kcalloc(1, sizeof(*mbss_limits), GFP_KERNEL);
  4514. ++ if (!mbss_limits)
  4515. ++ goto err;
  4516. ++ mbss_limits[i].max = 4;
  4517. ++ mbss_limits[i++].types = BIT(NL80211_IFTYPE_AP);
  4518. + combo[c].beacon_int_infra_match = true;
  4519. + combo[c].num_different_channels = 1;
  4520. +- mbss_limits[0].max = 4;
  4521. +- mbss_limits[0].types = BIT(NL80211_IFTYPE_AP);
  4522. + combo[c].max_interfaces = 4;
  4523. +- combo[c].n_limits = 1;
  4524. ++ combo[c].n_limits = i;
  4525. + combo[c].limits = mbss_limits;
  4526. + }
  4527. ++
  4528. + wiphy->n_iface_combinations = n_combos;
  4529. + wiphy->iface_combinations = combo;
  4530. + return 0;
  4531. 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
  4532. deleted file mode 100644
  4533. index 655dc4bfa934ca34ac108e54a93626e7d73eeb6e..0000000000000000000000000000000000000000
  4534. --- a/package/kernel/mac80211/patches/318-mac80211-move-A-MSDU-skb_linearize-call-to-ieee80211.patch
  4535. +++ /dev/null
  4536. @@ -1,35 +0,0 @@
  4537. -From: Felix Fietkau <nbd@openwrt.org>
  4538. -Date: Tue, 2 Feb 2016 14:39:08 +0100
  4539. -Subject: [PATCH] mac80211: move A-MSDU skb_linearize call to
  4540. - ieee80211_amsdu_to_8023s
  4541. -
  4542. -Prepararation for zero-copy A-MSDU support with page fragment SKBs
  4543. -
  4544. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  4545. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  4546. ----
  4547. -
  4548. ---- a/net/mac80211/rx.c
  4549. -+++ b/net/mac80211/rx.c
  4550. -@@ -2203,9 +2203,6 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx
  4551. - skb->dev = dev;
  4552. - __skb_queue_head_init(&frame_list);
  4553. -
  4554. -- if (skb_linearize(skb))
  4555. -- return RX_DROP_UNUSABLE;
  4556. --
  4557. - ieee80211_amsdu_to_8023s(skb, &frame_list, dev->dev_addr,
  4558. - rx->sdata->vif.type,
  4559. - rx->local->hw.extra_tx_headroom, true);
  4560. ---- a/net/wireless/util.c
  4561. -+++ b/net/wireless/util.c
  4562. -@@ -657,6 +657,9 @@ void ieee80211_amsdu_to_8023s(struct sk_
  4563. - int remaining, err;
  4564. - u8 dst[ETH_ALEN], src[ETH_ALEN];
  4565. -
  4566. -+ if (skb_linearize(skb))
  4567. -+ goto out;
  4568. -+
  4569. - if (has_80211_header) {
  4570. - err = ieee80211_data_to_8023(skb, addr, iftype);
  4571. - if (err)
  4572. 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
  4573. new file mode 100644
  4574. index 0000000000000000000000000000000000000000..073d012dea37ebfc34ffac98797c5eebc48a6c6d
  4575. --- /dev/null
  4576. +++ b/package/kernel/mac80211/patches/319-0001-brcmfmac-fix-lockup-when-removing-P2P-interface-afte.patch
  4577. @@ -0,0 +1,154 @@
  4578. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4579. +Date: Fri, 17 Jun 2016 12:29:21 +0200
  4580. +Subject: [PATCH] brcmfmac: fix lockup when removing P2P interface after
  4581. + event timeout
  4582. +MIME-Version: 1.0
  4583. +Content-Type: text/plain; charset=UTF-8
  4584. +Content-Transfer-Encoding: 8bit
  4585. +
  4586. +Removing P2P interface is handled by sending a proper request to the
  4587. +firmware. On success firmware triggers an event and driver's handler
  4588. +removes a matching interface.
  4589. +
  4590. +However on event timeout we remove interface directly from the cfg80211
  4591. +callback. Current code doesn't handle this case correctly as it always
  4592. +assumes rtnl to be unlocked.
  4593. +
  4594. +Fix it by adding an extra rtnl_locked parameter to functions and calling
  4595. +unregister_netdevice when needed.
  4596. +
  4597. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4598. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4599. +---
  4600. +
  4601. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  4602. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  4603. +@@ -548,12 +548,16 @@ fail:
  4604. + return -EBADE;
  4605. + }
  4606. +
  4607. +-static void brcmf_net_detach(struct net_device *ndev)
  4608. ++static void brcmf_net_detach(struct net_device *ndev, bool rtnl_locked)
  4609. + {
  4610. +- if (ndev->reg_state == NETREG_REGISTERED)
  4611. +- unregister_netdev(ndev);
  4612. +- else
  4613. ++ if (ndev->reg_state == NETREG_REGISTERED) {
  4614. ++ if (rtnl_locked)
  4615. ++ unregister_netdevice(ndev);
  4616. ++ else
  4617. ++ unregister_netdev(ndev);
  4618. ++ } else {
  4619. + brcmf_cfg80211_free_netdev(ndev);
  4620. ++ }
  4621. + }
  4622. +
  4623. + void brcmf_net_setcarrier(struct brcmf_if *ifp, bool on)
  4624. +@@ -651,7 +655,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  4625. + brcmf_err("ERROR: netdev:%s already exists\n",
  4626. + ifp->ndev->name);
  4627. + netif_stop_queue(ifp->ndev);
  4628. +- brcmf_net_detach(ifp->ndev);
  4629. ++ brcmf_net_detach(ifp->ndev, false);
  4630. + drvr->iflist[bsscfgidx] = NULL;
  4631. + } else {
  4632. + brcmf_dbg(INFO, "netdev:%s ignore IF event\n",
  4633. +@@ -699,7 +703,8 @@ struct brcmf_if *brcmf_add_if(struct brc
  4634. + return ifp;
  4635. + }
  4636. +
  4637. +-static void brcmf_del_if(struct brcmf_pub *drvr, s32 bsscfgidx)
  4638. ++static void brcmf_del_if(struct brcmf_pub *drvr, s32 bsscfgidx,
  4639. ++ bool rtnl_locked)
  4640. + {
  4641. + struct brcmf_if *ifp;
  4642. +
  4643. +@@ -729,7 +734,7 @@ static void brcmf_del_if(struct brcmf_pu
  4644. + cancel_work_sync(&ifp->multicast_work);
  4645. + cancel_work_sync(&ifp->ndoffload_work);
  4646. + }
  4647. +- brcmf_net_detach(ifp->ndev);
  4648. ++ brcmf_net_detach(ifp->ndev, rtnl_locked);
  4649. + } else {
  4650. + /* Only p2p device interfaces which get dynamically created
  4651. + * end up here. In this case the p2p module should be informed
  4652. +@@ -743,14 +748,14 @@ static void brcmf_del_if(struct brcmf_pu
  4653. + }
  4654. + }
  4655. +
  4656. +-void brcmf_remove_interface(struct brcmf_if *ifp)
  4657. ++void brcmf_remove_interface(struct brcmf_if *ifp, bool rtnl_locked)
  4658. + {
  4659. + if (!ifp || WARN_ON(ifp->drvr->iflist[ifp->bsscfgidx] != ifp))
  4660. + return;
  4661. + brcmf_dbg(TRACE, "Enter, bsscfgidx=%d, ifidx=%d\n", ifp->bsscfgidx,
  4662. + ifp->ifidx);
  4663. + brcmf_fws_del_interface(ifp);
  4664. +- brcmf_del_if(ifp->drvr, ifp->bsscfgidx);
  4665. ++ brcmf_del_if(ifp->drvr, ifp->bsscfgidx, rtnl_locked);
  4666. + }
  4667. +
  4668. + #ifdef CONFIG_INET
  4669. +@@ -1057,9 +1062,9 @@ fail:
  4670. + brcmf_fws_deinit(drvr);
  4671. + }
  4672. + if (ifp)
  4673. +- brcmf_net_detach(ifp->ndev);
  4674. ++ brcmf_net_detach(ifp->ndev, false);
  4675. + if (p2p_ifp)
  4676. +- brcmf_net_detach(p2p_ifp->ndev);
  4677. ++ brcmf_net_detach(p2p_ifp->ndev, false);
  4678. + drvr->iflist[0] = NULL;
  4679. + drvr->iflist[1] = NULL;
  4680. + if (drvr->settings->ignore_probe_fail)
  4681. +@@ -1128,7 +1133,7 @@ void brcmf_detach(struct device *dev)
  4682. +
  4683. + /* make sure primary interface removed last */
  4684. + for (i = BRCMF_MAX_IFS-1; i > -1; i--)
  4685. +- brcmf_remove_interface(drvr->iflist[i]);
  4686. ++ brcmf_remove_interface(drvr->iflist[i], false);
  4687. +
  4688. + brcmf_cfg80211_detach(drvr->config);
  4689. +
  4690. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  4691. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  4692. +@@ -216,7 +216,7 @@ struct brcmf_if *brcmf_get_ifp(struct br
  4693. + int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  4694. + struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
  4695. + bool is_p2pdev, char *name, u8 *mac_addr);
  4696. +-void brcmf_remove_interface(struct brcmf_if *ifp);
  4697. ++void brcmf_remove_interface(struct brcmf_if *ifp, bool rtnl_locked);
  4698. + void brcmf_txflowblock_if(struct brcmf_if *ifp,
  4699. + enum brcmf_netif_stop_reason reason, bool state);
  4700. + void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
  4701. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  4702. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  4703. +@@ -183,7 +183,7 @@ static void brcmf_fweh_handle_if_event(s
  4704. + err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data);
  4705. +
  4706. + if (ifp && ifevent->action == BRCMF_E_IF_DEL)
  4707. +- brcmf_remove_interface(ifp);
  4708. ++ brcmf_remove_interface(ifp, false);
  4709. + }
  4710. +
  4711. + /**
  4712. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  4713. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  4714. +@@ -2289,7 +2289,7 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  4715. + err = 0;
  4716. + }
  4717. + if (err)
  4718. +- brcmf_remove_interface(vif->ifp);
  4719. ++ brcmf_remove_interface(vif->ifp, true);
  4720. +
  4721. + brcmf_cfg80211_arm_vif_event(cfg, NULL);
  4722. + if (vif->wdev.iftype != NL80211_IFTYPE_P2P_DEVICE)
  4723. +@@ -2395,7 +2395,7 @@ void brcmf_p2p_detach(struct brcmf_p2p_i
  4724. + if (vif != NULL) {
  4725. + brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  4726. + brcmf_p2p_deinit_discovery(p2p);
  4727. +- brcmf_remove_interface(vif->ifp);
  4728. ++ brcmf_remove_interface(vif->ifp, false);
  4729. + }
  4730. + /* just set it all to zero */
  4731. + memset(p2p, 0, sizeof(*p2p));
  4732. 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
  4733. new file mode 100644
  4734. index 0000000000000000000000000000000000000000..6d3f3c640cc5667adbbf828eab28995e1fc5d88c
  4735. --- /dev/null
  4736. +++ b/package/kernel/mac80211/patches/319-0002-brcmfmac-use-const-char-for-interface-name-in-brcmf_.patch
  4737. @@ -0,0 +1,40 @@
  4738. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4739. +Date: Fri, 17 Jun 2016 12:48:44 +0200
  4740. +Subject: [PATCH] brcmfmac: use const char * for interface name in
  4741. + brcmf_add_if
  4742. +MIME-Version: 1.0
  4743. +Content-Type: text/plain; charset=UTF-8
  4744. +Content-Transfer-Encoding: 8bit
  4745. +
  4746. +This function can work just fine with const pointer, it only calls
  4747. +alloc_netdev which take const as well. Moreover it makes this function
  4748. +more flexible as some cfg80211 callback may provide const char * as
  4749. +well, e.g. add_virtual_intf. This will be needed for more advanced
  4750. +interface management.
  4751. +
  4752. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4753. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4754. +---
  4755. +
  4756. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  4757. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  4758. +@@ -638,7 +638,7 @@ fail:
  4759. + }
  4760. +
  4761. + struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
  4762. +- bool is_p2pdev, char *name, u8 *mac_addr)
  4763. ++ bool is_p2pdev, const char *name, u8 *mac_addr)
  4764. + {
  4765. + struct brcmf_if *ifp;
  4766. + struct net_device *ndev;
  4767. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  4768. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  4769. +@@ -215,7 +215,7 @@ char *brcmf_ifname(struct brcmf_if *ifp)
  4770. + struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx);
  4771. + int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  4772. + struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
  4773. +- bool is_p2pdev, char *name, u8 *mac_addr);
  4774. ++ bool is_p2pdev, const char *name, u8 *mac_addr);
  4775. + void brcmf_remove_interface(struct brcmf_if *ifp, bool rtnl_locked);
  4776. + void brcmf_txflowblock_if(struct brcmf_if *ifp,
  4777. + enum brcmf_netif_stop_reason reason, bool state);
  4778. 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
  4779. new file mode 100644
  4780. index 0000000000000000000000000000000000000000..eeda76661c30388ede4fd96a340af84e7f27d3b2
  4781. --- /dev/null
  4782. +++ b/package/kernel/mac80211/patches/319-0003-brcmfmac-include-also-core.h-header-in-cfg80211.h.patch
  4783. @@ -0,0 +1,33 @@
  4784. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4785. +Date: Sat, 18 Jun 2016 18:49:38 +0200
  4786. +Subject: [PATCH] brcmfmac: include also core.h header in cfg80211.h
  4787. +MIME-Version: 1.0
  4788. +Content-Type: text/plain; charset=UTF-8
  4789. +Content-Transfer-Encoding: 8bit
  4790. +
  4791. +This header provides two inline functions using struct brcmf_if so we
  4792. +need core.h to avoid:
  4793. +
  4794. +drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h: In function ‘ndev_to_prof’:
  4795. +drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h:368:13: error: dereferencing pointer to incomplete type
  4796. + return &ifp->vif->profile;
  4797. + ^
  4798. +drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h: In function ‘ndev_to_vif’:
  4799. +drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h:374:12: error: dereferencing pointer to incomplete type
  4800. + return ifp->vif;
  4801. + ^
  4802. +
  4803. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4804. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4805. +---
  4806. +
  4807. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  4808. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  4809. +@@ -20,6 +20,7 @@
  4810. + /* for brcmu_d11inf */
  4811. + #include <brcmu_d11.h>
  4812. +
  4813. ++#include "core.h"
  4814. + #include "fwil_types.h"
  4815. + #include "p2p.h"
  4816. +
  4817. 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
  4818. new file mode 100644
  4819. index 0000000000000000000000000000000000000000..3819248b0fe94da017e99fba61931703036ad15c
  4820. --- /dev/null
  4821. +++ b/package/kernel/mac80211/patches/319-0004-brcmfmac-add-missing-break-when-deleting-P2P_DEVICE.patch
  4822. @@ -0,0 +1,27 @@
  4823. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4824. +Date: Sun, 19 Jun 2016 01:55:57 +0200
  4825. +Subject: [PATCH] brcmfmac: add missing break when deleting P2P_DEVICE
  4826. +MIME-Version: 1.0
  4827. +Content-Type: text/plain; charset=UTF-8
  4828. +Content-Transfer-Encoding: 8bit
  4829. +
  4830. +We obviously don't want to fall through in that switch. With this change
  4831. +1) We wait for event (triggered by p2p_disc) as expected
  4832. +2) We remove interface manually on timeout
  4833. +3) We return 0 on success instead of -ENOTSUPP
  4834. +
  4835. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4836. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4837. +---
  4838. +
  4839. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  4840. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  4841. +@@ -2263,6 +2263,8 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  4842. + return 0;
  4843. + brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  4844. + brcmf_p2p_deinit_discovery(p2p);
  4845. ++ break;
  4846. ++
  4847. + default:
  4848. + return -ENOTSUPP;
  4849. + }
  4850. 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
  4851. new file mode 100644
  4852. index 0000000000000000000000000000000000000000..12d7eb48877d8f9d9e2eb64c7cfd887c3d1634ae
  4853. --- /dev/null
  4854. +++ b/package/kernel/mac80211/patches/319-0005-brcmfmac-delete-interface-directly-in-code-that-sent.patch
  4855. @@ -0,0 +1,75 @@
  4856. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4857. +Date: Wed, 29 Jun 2016 21:54:26 +0200
  4858. +Subject: [PATCH] brcmfmac: delete interface directly in code that sent fw
  4859. + request
  4860. +MIME-Version: 1.0
  4861. +Content-Type: text/plain; charset=UTF-8
  4862. +Content-Transfer-Encoding: 8bit
  4863. +
  4864. +So far when receiving event about in-firmware-interface removal our
  4865. +event worker was notifying listener and afterwards it was removing Linux
  4866. +interface.
  4867. +
  4868. +First of all it was resulting in slightly unexpected order. The listener
  4869. +(del_virtual_intf callback) was (usually) returning with success before
  4870. +we even called unregister_netdev(ice).
  4871. +
  4872. +Please note this couldn't be simply fixed by changing order of calls in
  4873. +brcmf_fweh_handle_if_event as unregistering interface earlier could free
  4874. +struct brcmf_if.
  4875. +
  4876. +Another problem of current implementation are possible lockups. Focus on
  4877. +the time slot between calling event handler and removing Linux
  4878. +interface. During that time original caller may leave (unlocking rtnl
  4879. +semaphore) *and* another call to the same code may be done (locking it
  4880. +again). If that happens our event handler will stuck at removing Linux
  4881. +interface, it won't handle another event and will block process holding
  4882. +rtnl lock.
  4883. +
  4884. +This can be simply solved by unregistering interface in a proper
  4885. +callback, right after receiving confirmation event from firmware. This
  4886. +only required modifying worker to don't unregister on its own if there
  4887. +is someone waiting for the event.
  4888. +
  4889. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4890. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4891. +---
  4892. +
  4893. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  4894. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  4895. +@@ -18,6 +18,7 @@
  4896. + #include "brcmu_wifi.h"
  4897. + #include "brcmu_utils.h"
  4898. +
  4899. ++#include "cfg80211.h"
  4900. + #include "core.h"
  4901. + #include "debug.h"
  4902. + #include "tracepoint.h"
  4903. +@@ -182,8 +183,13 @@ static void brcmf_fweh_handle_if_event(s
  4904. +
  4905. + err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data);
  4906. +
  4907. +- if (ifp && ifevent->action == BRCMF_E_IF_DEL)
  4908. +- brcmf_remove_interface(ifp, false);
  4909. ++ if (ifp && ifevent->action == BRCMF_E_IF_DEL) {
  4910. ++ bool armed = brcmf_cfg80211_vif_event_armed(drvr->config);
  4911. ++
  4912. ++ /* Default handling in case no-one waits for this event */
  4913. ++ if (!armed)
  4914. ++ brcmf_remove_interface(ifp, false);
  4915. ++ }
  4916. + }
  4917. +
  4918. + /**
  4919. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  4920. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  4921. +@@ -2290,8 +2290,7 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  4922. + else
  4923. + err = 0;
  4924. + }
  4925. +- if (err)
  4926. +- brcmf_remove_interface(vif->ifp, true);
  4927. ++ brcmf_remove_interface(vif->ifp, true);
  4928. +
  4929. + brcmf_cfg80211_arm_vif_event(cfg, NULL);
  4930. + if (vif->wdev.iftype != NL80211_IFTYPE_P2P_DEVICE)
  4931. 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
  4932. new file mode 100644
  4933. index 0000000000000000000000000000000000000000..2f7165eade7c6ffba2b1ed23e71b66e54d6a430b
  4934. --- /dev/null
  4935. +++ b/package/kernel/mac80211/patches/319-0006-brcmfmac-support-removing-AP-interfaces-with-interfa.patch
  4936. @@ -0,0 +1,84 @@
  4937. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4938. +Date: Wed, 29 Jun 2016 21:54:27 +0200
  4939. +Subject: [PATCH] brcmfmac: support removing AP interfaces with
  4940. + "interface_remove"
  4941. +MIME-Version: 1.0
  4942. +Content-Type: text/plain; charset=UTF-8
  4943. +Content-Transfer-Encoding: 8bit
  4944. +
  4945. +New firmwares (e.g. 10.10.69.36 for BCM4366) support "interface_remove"
  4946. +for removing interfaces. Try to use this method on cfg80211 request. In
  4947. +case of older firmwares (e.g. 7.35.177.56 for BCM43602 as I tested) this
  4948. +will just result in firmware rejecting command and this won't change any
  4949. +behavior.
  4950. +
  4951. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4952. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4953. +---
  4954. +
  4955. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  4956. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  4957. +@@ -785,12 +785,48 @@ s32 brcmf_notify_escan_complete(struct b
  4958. + return err;
  4959. + }
  4960. +
  4961. ++static int brcmf_cfg80211_del_ap_iface(struct wiphy *wiphy,
  4962. ++ struct wireless_dev *wdev)
  4963. ++{
  4964. ++ struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy);
  4965. ++ struct net_device *ndev = wdev->netdev;
  4966. ++ struct brcmf_if *ifp = netdev_priv(ndev);
  4967. ++ int ret;
  4968. ++ int err;
  4969. ++
  4970. ++ brcmf_cfg80211_arm_vif_event(cfg, ifp->vif);
  4971. ++
  4972. ++ err = brcmf_fil_bsscfg_data_set(ifp, "interface_remove", NULL, 0);
  4973. ++ if (err) {
  4974. ++ brcmf_err("interface_remove failed %d\n", err);
  4975. ++ goto err_unarm;
  4976. ++ }
  4977. ++
  4978. ++ /* wait for firmware event */
  4979. ++ ret = brcmf_cfg80211_wait_vif_event(cfg, BRCMF_E_IF_DEL,
  4980. ++ BRCMF_VIF_EVENT_TIMEOUT);
  4981. ++ if (!ret) {
  4982. ++ brcmf_err("timeout occurred\n");
  4983. ++ err = -EIO;
  4984. ++ goto err_unarm;
  4985. ++ }
  4986. ++
  4987. ++ brcmf_remove_interface(ifp, true);
  4988. ++
  4989. ++err_unarm:
  4990. ++ brcmf_cfg80211_arm_vif_event(cfg, NULL);
  4991. ++ return err;
  4992. ++}
  4993. ++
  4994. + static
  4995. + int brcmf_cfg80211_del_iface(struct wiphy *wiphy, struct wireless_dev *wdev)
  4996. + {
  4997. + struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy);
  4998. + struct net_device *ndev = wdev->netdev;
  4999. +
  5000. ++ if (ndev && ndev == cfg_to_ndev(cfg))
  5001. ++ return -ENOTSUPP;
  5002. ++
  5003. + /* vif event pending in firmware */
  5004. + if (brcmf_cfg80211_vif_event_armed(cfg))
  5005. + return -EBUSY;
  5006. +@@ -807,12 +843,13 @@ int brcmf_cfg80211_del_iface(struct wiph
  5007. + switch (wdev->iftype) {
  5008. + case NL80211_IFTYPE_ADHOC:
  5009. + case NL80211_IFTYPE_STATION:
  5010. +- case NL80211_IFTYPE_AP:
  5011. + case NL80211_IFTYPE_AP_VLAN:
  5012. + case NL80211_IFTYPE_WDS:
  5013. + case NL80211_IFTYPE_MONITOR:
  5014. + case NL80211_IFTYPE_MESH_POINT:
  5015. + return -EOPNOTSUPP;
  5016. ++ case NL80211_IFTYPE_AP:
  5017. ++ return brcmf_cfg80211_del_ap_iface(wiphy, wdev);
  5018. + case NL80211_IFTYPE_P2P_CLIENT:
  5019. + case NL80211_IFTYPE_P2P_GO:
  5020. + case NL80211_IFTYPE_P2P_DEVICE:
  5021. 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
  5022. deleted file mode 100644
  5023. index b646ab36dd204205735338c394a71f3bb58bd46a..0000000000000000000000000000000000000000
  5024. --- a/package/kernel/mac80211/patches/319-cfg80211-add-function-for-802.3-conversion-with-sepa.patch
  5025. +++ /dev/null
  5026. @@ -1,186 +0,0 @@
  5027. -From: Felix Fietkau <nbd@openwrt.org>
  5028. -Date: Tue, 2 Feb 2016 14:39:09 +0100
  5029. -Subject: [PATCH] cfg80211: add function for 802.3 conversion with separate
  5030. - output buffer
  5031. -
  5032. -Use skb_copy_bits in preparation for allowing fragmented skbs
  5033. -
  5034. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  5035. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  5036. ----
  5037. -
  5038. ---- a/net/wireless/util.c
  5039. -+++ b/net/wireless/util.c
  5040. -@@ -393,9 +393,9 @@ unsigned int ieee80211_get_hdrlen_from_s
  5041. - }
  5042. - EXPORT_SYMBOL(ieee80211_get_hdrlen_from_skb);
  5043. -
  5044. --unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr)
  5045. -+static unsigned int __ieee80211_get_mesh_hdrlen(u8 flags)
  5046. - {
  5047. -- int ae = meshhdr->flags & MESH_FLAGS_AE;
  5048. -+ int ae = flags & MESH_FLAGS_AE;
  5049. - /* 802.11-2012, 8.2.4.7.3 */
  5050. - switch (ae) {
  5051. - default:
  5052. -@@ -407,21 +407,31 @@ unsigned int ieee80211_get_mesh_hdrlen(s
  5053. - return 18;
  5054. - }
  5055. - }
  5056. -+
  5057. -+unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr)
  5058. -+{
  5059. -+ return __ieee80211_get_mesh_hdrlen(meshhdr->flags);
  5060. -+}
  5061. - EXPORT_SYMBOL(ieee80211_get_mesh_hdrlen);
  5062. -
  5063. --int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
  5064. -- enum nl80211_iftype iftype)
  5065. -+static int __ieee80211_data_to_8023(struct sk_buff *skb, struct ethhdr *ehdr,
  5066. -+ const u8 *addr, enum nl80211_iftype iftype)
  5067. - {
  5068. - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
  5069. -- u16 hdrlen, ethertype;
  5070. -- u8 *payload;
  5071. -- u8 dst[ETH_ALEN];
  5072. -- u8 src[ETH_ALEN] __aligned(2);
  5073. -+ struct {
  5074. -+ u8 hdr[ETH_ALEN] __aligned(2);
  5075. -+ __be16 proto;
  5076. -+ } payload;
  5077. -+ struct ethhdr tmp;
  5078. -+ u16 hdrlen;
  5079. -+ u8 mesh_flags = 0;
  5080. -
  5081. - if (unlikely(!ieee80211_is_data_present(hdr->frame_control)))
  5082. - return -1;
  5083. -
  5084. - hdrlen = ieee80211_hdrlen(hdr->frame_control);
  5085. -+ if (skb->len < hdrlen + 8)
  5086. -+ return -1;
  5087. -
  5088. - /* convert IEEE 802.11 header + possible LLC headers into Ethernet
  5089. - * header
  5090. -@@ -432,8 +442,11 @@ int ieee80211_data_to_8023(struct sk_buf
  5091. - * 1 0 BSSID SA DA n/a
  5092. - * 1 1 RA TA DA SA
  5093. - */
  5094. -- memcpy(dst, ieee80211_get_DA(hdr), ETH_ALEN);
  5095. -- memcpy(src, ieee80211_get_SA(hdr), ETH_ALEN);
  5096. -+ memcpy(tmp.h_dest, ieee80211_get_DA(hdr), ETH_ALEN);
  5097. -+ memcpy(tmp.h_source, ieee80211_get_SA(hdr), ETH_ALEN);
  5098. -+
  5099. -+ if (iftype == NL80211_IFTYPE_MESH_POINT)
  5100. -+ skb_copy_bits(skb, hdrlen, &mesh_flags, 1);
  5101. -
  5102. - switch (hdr->frame_control &
  5103. - cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) {
  5104. -@@ -450,44 +463,31 @@ int ieee80211_data_to_8023(struct sk_buf
  5105. - iftype != NL80211_IFTYPE_STATION))
  5106. - return -1;
  5107. - if (iftype == NL80211_IFTYPE_MESH_POINT) {
  5108. -- struct ieee80211s_hdr *meshdr =
  5109. -- (struct ieee80211s_hdr *) (skb->data + hdrlen);
  5110. -- /* make sure meshdr->flags is on the linear part */
  5111. -- if (!pskb_may_pull(skb, hdrlen + 1))
  5112. -- return -1;
  5113. -- if (meshdr->flags & MESH_FLAGS_AE_A4)
  5114. -+ if (mesh_flags & MESH_FLAGS_AE_A4)
  5115. - return -1;
  5116. -- if (meshdr->flags & MESH_FLAGS_AE_A5_A6) {
  5117. -+ if (mesh_flags & MESH_FLAGS_AE_A5_A6) {
  5118. - skb_copy_bits(skb, hdrlen +
  5119. - offsetof(struct ieee80211s_hdr, eaddr1),
  5120. -- dst, ETH_ALEN);
  5121. -- skb_copy_bits(skb, hdrlen +
  5122. -- offsetof(struct ieee80211s_hdr, eaddr2),
  5123. -- src, ETH_ALEN);
  5124. -+ tmp.h_dest, 2 * ETH_ALEN);
  5125. - }
  5126. -- hdrlen += ieee80211_get_mesh_hdrlen(meshdr);
  5127. -+ hdrlen += __ieee80211_get_mesh_hdrlen(mesh_flags);
  5128. - }
  5129. - break;
  5130. - case cpu_to_le16(IEEE80211_FCTL_FROMDS):
  5131. - if ((iftype != NL80211_IFTYPE_STATION &&
  5132. - iftype != NL80211_IFTYPE_P2P_CLIENT &&
  5133. - iftype != NL80211_IFTYPE_MESH_POINT) ||
  5134. -- (is_multicast_ether_addr(dst) &&
  5135. -- ether_addr_equal(src, addr)))
  5136. -+ (is_multicast_ether_addr(tmp.h_dest) &&
  5137. -+ ether_addr_equal(tmp.h_source, addr)))
  5138. - return -1;
  5139. - if (iftype == NL80211_IFTYPE_MESH_POINT) {
  5140. -- struct ieee80211s_hdr *meshdr =
  5141. -- (struct ieee80211s_hdr *) (skb->data + hdrlen);
  5142. -- /* make sure meshdr->flags is on the linear part */
  5143. -- if (!pskb_may_pull(skb, hdrlen + 1))
  5144. -- return -1;
  5145. -- if (meshdr->flags & MESH_FLAGS_AE_A5_A6)
  5146. -+ if (mesh_flags & MESH_FLAGS_AE_A5_A6)
  5147. - return -1;
  5148. -- if (meshdr->flags & MESH_FLAGS_AE_A4)
  5149. -+ if (mesh_flags & MESH_FLAGS_AE_A4)
  5150. - skb_copy_bits(skb, hdrlen +
  5151. - offsetof(struct ieee80211s_hdr, eaddr1),
  5152. -- src, ETH_ALEN);
  5153. -- hdrlen += ieee80211_get_mesh_hdrlen(meshdr);
  5154. -+ tmp.h_source, ETH_ALEN);
  5155. -+ hdrlen += __ieee80211_get_mesh_hdrlen(mesh_flags);
  5156. - }
  5157. - break;
  5158. - case cpu_to_le16(0):
  5159. -@@ -498,33 +498,33 @@ int ieee80211_data_to_8023(struct sk_buf
  5160. - break;
  5161. - }
  5162. -
  5163. -- if (!pskb_may_pull(skb, hdrlen + 8))
  5164. -- return -1;
  5165. --
  5166. -- payload = skb->data + hdrlen;
  5167. -- ethertype = (payload[6] << 8) | payload[7];
  5168. -+ skb_copy_bits(skb, hdrlen, &payload, sizeof(payload));
  5169. -+ tmp.h_proto = payload.proto;
  5170. -
  5171. -- if (likely((ether_addr_equal(payload, rfc1042_header) &&
  5172. -- ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) ||
  5173. -- ether_addr_equal(payload, bridge_tunnel_header))) {
  5174. -+ if (likely((ether_addr_equal(payload.hdr, rfc1042_header) &&
  5175. -+ tmp.h_proto != htons(ETH_P_AARP) &&
  5176. -+ tmp.h_proto != htons(ETH_P_IPX)) ||
  5177. -+ ether_addr_equal(payload.hdr, bridge_tunnel_header)))
  5178. - /* remove RFC1042 or Bridge-Tunnel encapsulation and
  5179. - * replace EtherType */
  5180. -- skb_pull(skb, hdrlen + 6);
  5181. -- memcpy(skb_push(skb, ETH_ALEN), src, ETH_ALEN);
  5182. -- memcpy(skb_push(skb, ETH_ALEN), dst, ETH_ALEN);
  5183. -- } else {
  5184. -- struct ethhdr *ehdr;
  5185. -- __be16 len;
  5186. -+ hdrlen += ETH_ALEN + 2;
  5187. -+ else
  5188. -+ tmp.h_proto = htons(skb->len);
  5189. -
  5190. -- skb_pull(skb, hdrlen);
  5191. -- len = htons(skb->len);
  5192. -+ pskb_pull(skb, hdrlen);
  5193. -+
  5194. -+ if (!ehdr)
  5195. - ehdr = (struct ethhdr *) skb_push(skb, sizeof(struct ethhdr));
  5196. -- memcpy(ehdr->h_dest, dst, ETH_ALEN);
  5197. -- memcpy(ehdr->h_source, src, ETH_ALEN);
  5198. -- ehdr->h_proto = len;
  5199. -- }
  5200. -+ memcpy(ehdr, &tmp, sizeof(tmp));
  5201. -+
  5202. - return 0;
  5203. - }
  5204. -+
  5205. -+int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
  5206. -+ enum nl80211_iftype iftype)
  5207. -+{
  5208. -+ return __ieee80211_data_to_8023(skb, NULL, addr, iftype);
  5209. -+}
  5210. - EXPORT_SYMBOL(ieee80211_data_to_8023);
  5211. -
  5212. - int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr,
  5213. 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
  5214. new file mode 100644
  5215. index 0000000000000000000000000000000000000000..f8b8f86e03ba0786ef410db31d6de2ab691430bd
  5216. --- /dev/null
  5217. +++ b/package/kernel/mac80211/patches/320-ath9k-Switch-to-using-mac80211-intermediate-software.patch
  5218. @@ -0,0 +1,871 @@
  5219. +From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= <toke@toke.dk>
  5220. +Date: Wed, 6 Jul 2016 21:34:17 +0200
  5221. +Subject: [PATCH] ath9k: Switch to using mac80211 intermediate software queues.
  5222. +MIME-Version: 1.0
  5223. +Content-Type: text/plain; charset=UTF-8
  5224. +Content-Transfer-Encoding: 8bit
  5225. +
  5226. +This switches ath9k over to using the mac80211 intermediate software
  5227. +queueing mechanism for data packets. It removes the queueing inside the
  5228. +driver, except for the retry queue, and instead pulls from mac80211 when
  5229. +a packet is needed. The retry queue is used to store a packet that was
  5230. +pulled but can't be sent immediately.
  5231. +
  5232. +The old code path in ath_tx_start that would queue packets has been
  5233. +removed completely, as has the qlen limit tunables (since there's no
  5234. +longer a queue in the driver to limit).
  5235. +
  5236. +Based on Tim's original patch set, but reworked quite thoroughly.
  5237. +
  5238. +Cc: Tim Shepard <shep@alum.mit.edu>
  5239. +Cc: Felix Fietkau <nbd@nbd.name>
  5240. +Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
  5241. +---
  5242. +
  5243. +--- a/drivers/net/wireless/ath/ath9k/ath9k.h
  5244. ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  5245. +@@ -91,7 +91,6 @@ int ath_descdma_setup(struct ath_softc *
  5246. + #define ATH_RXBUF 512
  5247. + #define ATH_TXBUF 512
  5248. + #define ATH_TXBUF_RESERVE 5
  5249. +-#define ATH_MAX_QDEPTH (ATH_TXBUF / 4 - ATH_TXBUF_RESERVE)
  5250. + #define ATH_TXMAXTRY 13
  5251. + #define ATH_MAX_SW_RETRIES 30
  5252. +
  5253. +@@ -145,7 +144,9 @@ int ath_descdma_setup(struct ath_softc *
  5254. + #define BAW_WITHIN(_start, _bawsz, _seqno) \
  5255. + ((((_seqno) - (_start)) & 4095) < (_bawsz))
  5256. +
  5257. +-#define ATH_AN_2_TID(_an, _tidno) (&(_an)->tid[(_tidno)])
  5258. ++#define ATH_STA_2_TID(_sta, _tidno) ((struct ath_atx_tid *)(_sta)->txq[_tidno]->drv_priv)
  5259. ++#define ATH_VIF_2_TID(_vif) ((struct ath_atx_tid *)(_vif)->txq->drv_priv)
  5260. ++#define ATH_AN_2_TID(_an, _tidno) ((_an)->sta ? ATH_STA_2_TID((_an)->sta, _tidno) : ATH_VIF_2_TID((_an)->vif))
  5261. +
  5262. + #define IS_HT_RATE(rate) (rate & 0x80)
  5263. + #define IS_CCK_RATE(rate) ((rate >= 0x18) && (rate <= 0x1e))
  5264. +@@ -164,7 +165,6 @@ struct ath_txq {
  5265. + spinlock_t axq_lock;
  5266. + u32 axq_depth;
  5267. + u32 axq_ampdu_depth;
  5268. +- bool stopped;
  5269. + bool axq_tx_inprogress;
  5270. + struct list_head txq_fifo[ATH_TXFIFO_DEPTH];
  5271. + u8 txq_headidx;
  5272. +@@ -232,7 +232,6 @@ struct ath_buf {
  5273. +
  5274. + struct ath_atx_tid {
  5275. + struct list_head list;
  5276. +- struct sk_buff_head buf_q;
  5277. + struct sk_buff_head retry_q;
  5278. + struct ath_node *an;
  5279. + struct ath_txq *txq;
  5280. +@@ -247,13 +246,13 @@ struct ath_atx_tid {
  5281. + s8 bar_index;
  5282. + bool active;
  5283. + bool clear_ps_filter;
  5284. ++ bool has_queued;
  5285. + };
  5286. +
  5287. + struct ath_node {
  5288. + struct ath_softc *sc;
  5289. + struct ieee80211_sta *sta; /* station struct we're part of */
  5290. + struct ieee80211_vif *vif; /* interface with which we're associated */
  5291. +- struct ath_atx_tid tid[IEEE80211_NUM_TIDS];
  5292. +
  5293. + u16 maxampdu;
  5294. + u8 mpdudensity;
  5295. +@@ -276,7 +275,6 @@ struct ath_tx_control {
  5296. + struct ath_node *an;
  5297. + struct ieee80211_sta *sta;
  5298. + u8 paprd;
  5299. +- bool force_channel;
  5300. + };
  5301. +
  5302. +
  5303. +@@ -293,7 +291,6 @@ struct ath_tx {
  5304. + struct ath_descdma txdma;
  5305. + struct ath_txq *txq_map[IEEE80211_NUM_ACS];
  5306. + struct ath_txq *uapsdq;
  5307. +- u32 txq_max_pending[IEEE80211_NUM_ACS];
  5308. + u16 max_aggr_framelen[IEEE80211_NUM_ACS][4][32];
  5309. + };
  5310. +
  5311. +@@ -585,6 +582,7 @@ void ath9k_release_buffered_frames(struc
  5312. + u16 tids, int nframes,
  5313. + enum ieee80211_frame_release_type reason,
  5314. + bool more_data);
  5315. ++void ath9k_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *queue);
  5316. +
  5317. + /********/
  5318. + /* VIFs */
  5319. +--- a/drivers/net/wireless/ath/ath9k/channel.c
  5320. ++++ b/drivers/net/wireless/ath/ath9k/channel.c
  5321. +@@ -1007,7 +1007,6 @@ static void ath_scan_send_probe(struct a
  5322. + goto error;
  5323. +
  5324. + txctl.txq = sc->tx.txq_map[IEEE80211_AC_VO];
  5325. +- txctl.force_channel = true;
  5326. + if (ath_tx_start(sc->hw, skb, &txctl))
  5327. + goto error;
  5328. +
  5329. +@@ -1130,7 +1129,6 @@ ath_chanctx_send_vif_ps_frame(struct ath
  5330. + memset(&txctl, 0, sizeof(txctl));
  5331. + txctl.txq = sc->tx.txq_map[IEEE80211_AC_VO];
  5332. + txctl.sta = sta;
  5333. +- txctl.force_channel = true;
  5334. + if (ath_tx_start(sc->hw, skb, &txctl)) {
  5335. + ieee80211_free_txskb(sc->hw, skb);
  5336. + return false;
  5337. +--- a/drivers/net/wireless/ath/ath9k/debug.c
  5338. ++++ b/drivers/net/wireless/ath/ath9k/debug.c
  5339. +@@ -600,7 +600,6 @@ static int read_file_xmit(struct seq_fil
  5340. + PR("MPDUs XRetried: ", xretries);
  5341. + PR("Aggregates: ", a_aggr);
  5342. + PR("AMPDUs Queued HW:", a_queued_hw);
  5343. +- PR("AMPDUs Queued SW:", a_queued_sw);
  5344. + PR("AMPDUs Completed:", a_completed);
  5345. + PR("AMPDUs Retried: ", a_retries);
  5346. + PR("AMPDUs XRetried: ", a_xretries);
  5347. +@@ -629,8 +628,7 @@ static void print_queue(struct ath_softc
  5348. + seq_printf(file, "%s: %d ", "qnum", txq->axq_qnum);
  5349. + seq_printf(file, "%s: %2d ", "qdepth", txq->axq_depth);
  5350. + seq_printf(file, "%s: %2d ", "ampdu-depth", txq->axq_ampdu_depth);
  5351. +- seq_printf(file, "%s: %3d ", "pending", txq->pending_frames);
  5352. +- seq_printf(file, "%s: %d\n", "stopped", txq->stopped);
  5353. ++ seq_printf(file, "%s: %3d\n", "pending", txq->pending_frames);
  5354. +
  5355. + ath_txq_unlock(sc, txq);
  5356. + }
  5357. +@@ -1208,7 +1206,6 @@ static const char ath9k_gstrings_stats[]
  5358. + AMKSTR(d_tx_mpdu_xretries),
  5359. + AMKSTR(d_tx_aggregates),
  5360. + AMKSTR(d_tx_ampdus_queued_hw),
  5361. +- AMKSTR(d_tx_ampdus_queued_sw),
  5362. + AMKSTR(d_tx_ampdus_completed),
  5363. + AMKSTR(d_tx_ampdu_retries),
  5364. + AMKSTR(d_tx_ampdu_xretries),
  5365. +@@ -1288,7 +1285,6 @@ void ath9k_get_et_stats(struct ieee80211
  5366. + AWDATA(xretries);
  5367. + AWDATA(a_aggr);
  5368. + AWDATA(a_queued_hw);
  5369. +- AWDATA(a_queued_sw);
  5370. + AWDATA(a_completed);
  5371. + AWDATA(a_retries);
  5372. + AWDATA(a_xretries);
  5373. +@@ -1346,14 +1342,6 @@ int ath9k_init_debug(struct ath_hw *ah)
  5374. + read_file_xmit);
  5375. + debugfs_create_devm_seqfile(sc->dev, "queues", sc->debug.debugfs_phy,
  5376. + read_file_queues);
  5377. +- debugfs_create_u32("qlen_bk", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
  5378. +- &sc->tx.txq_max_pending[IEEE80211_AC_BK]);
  5379. +- debugfs_create_u32("qlen_be", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
  5380. +- &sc->tx.txq_max_pending[IEEE80211_AC_BE]);
  5381. +- debugfs_create_u32("qlen_vi", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
  5382. +- &sc->tx.txq_max_pending[IEEE80211_AC_VI]);
  5383. +- debugfs_create_u32("qlen_vo", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
  5384. +- &sc->tx.txq_max_pending[IEEE80211_AC_VO]);
  5385. + debugfs_create_devm_seqfile(sc->dev, "misc", sc->debug.debugfs_phy,
  5386. + read_file_misc);
  5387. + debugfs_create_devm_seqfile(sc->dev, "reset", sc->debug.debugfs_phy,
  5388. +--- a/drivers/net/wireless/ath/ath9k/debug.h
  5389. ++++ b/drivers/net/wireless/ath/ath9k/debug.h
  5390. +@@ -147,7 +147,6 @@ struct ath_interrupt_stats {
  5391. + * @completed: Total MPDUs (non-aggr) completed
  5392. + * @a_aggr: Total no. of aggregates queued
  5393. + * @a_queued_hw: Total AMPDUs queued to hardware
  5394. +- * @a_queued_sw: Total AMPDUs queued to software queues
  5395. + * @a_completed: Total AMPDUs completed
  5396. + * @a_retries: No. of AMPDUs retried (SW)
  5397. + * @a_xretries: No. of AMPDUs dropped due to xretries
  5398. +@@ -174,7 +173,6 @@ struct ath_tx_stats {
  5399. + u32 xretries;
  5400. + u32 a_aggr;
  5401. + u32 a_queued_hw;
  5402. +- u32 a_queued_sw;
  5403. + u32 a_completed;
  5404. + u32 a_retries;
  5405. + u32 a_xretries;
  5406. +--- a/drivers/net/wireless/ath/ath9k/debug_sta.c
  5407. ++++ b/drivers/net/wireless/ath/ath9k/debug_sta.c
  5408. +@@ -52,8 +52,8 @@ static ssize_t read_file_node_aggr(struc
  5409. + "TID", "SEQ_START", "SEQ_NEXT", "BAW_SIZE",
  5410. + "BAW_HEAD", "BAW_TAIL", "BAR_IDX", "SCHED", "PAUSED");
  5411. +
  5412. +- for (tidno = 0, tid = &an->tid[tidno];
  5413. +- tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
  5414. ++ for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) {
  5415. ++ tid = ATH_STA_2_TID(an->sta, tidno);
  5416. + txq = tid->txq;
  5417. + ath_txq_lock(sc, txq);
  5418. + if (tid->active) {
  5419. +--- a/drivers/net/wireless/ath/ath9k/init.c
  5420. ++++ b/drivers/net/wireless/ath/ath9k/init.c
  5421. +@@ -358,7 +358,6 @@ static int ath9k_init_queues(struct ath_
  5422. + for (i = 0; i < IEEE80211_NUM_ACS; i++) {
  5423. + sc->tx.txq_map[i] = ath_txq_setup(sc, ATH9K_TX_QUEUE_DATA, i);
  5424. + sc->tx.txq_map[i]->mac80211_qnum = i;
  5425. +- sc->tx.txq_max_pending[i] = ATH_MAX_QDEPTH;
  5426. + }
  5427. + return 0;
  5428. + }
  5429. +@@ -873,6 +872,7 @@ static void ath9k_set_hw_capab(struct at
  5430. + hw->max_rate_tries = 10;
  5431. + hw->sta_data_size = sizeof(struct ath_node);
  5432. + hw->vif_data_size = sizeof(struct ath_vif);
  5433. ++ hw->txq_data_size = sizeof(struct ath_atx_tid);
  5434. + hw->extra_tx_headroom = 4;
  5435. +
  5436. + hw->wiphy->available_antennas_rx = BIT(ah->caps.max_rxchains) - 1;
  5437. +--- a/drivers/net/wireless/ath/ath9k/main.c
  5438. ++++ b/drivers/net/wireless/ath/ath9k/main.c
  5439. +@@ -2695,4 +2695,5 @@ struct ieee80211_ops ath9k_ops = {
  5440. + .sw_scan_start = ath9k_sw_scan_start,
  5441. + .sw_scan_complete = ath9k_sw_scan_complete,
  5442. + .get_txpower = ath9k_get_txpower,
  5443. ++ .wake_tx_queue = ath9k_wake_tx_queue,
  5444. + };
  5445. +--- a/drivers/net/wireless/ath/ath9k/xmit.c
  5446. ++++ b/drivers/net/wireless/ath/ath9k/xmit.c
  5447. +@@ -65,6 +65,8 @@ static struct ath_buf *ath_tx_setup_buff
  5448. + struct ath_txq *txq,
  5449. + struct ath_atx_tid *tid,
  5450. + struct sk_buff *skb);
  5451. ++static int ath_tx_prepare(struct ieee80211_hw *hw, struct sk_buff *skb,
  5452. ++ struct ath_tx_control *txctl);
  5453. +
  5454. + enum {
  5455. + MCS_HT20,
  5456. +@@ -118,6 +120,26 @@ static void ath_tx_queue_tid(struct ath_
  5457. + list_add_tail(&tid->list, list);
  5458. + }
  5459. +
  5460. ++void ath9k_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *queue)
  5461. ++{
  5462. ++ struct ath_softc *sc = hw->priv;
  5463. ++ struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  5464. ++ struct ath_atx_tid *tid = (struct ath_atx_tid *) queue->drv_priv;
  5465. ++ struct ath_txq *txq = tid->txq;
  5466. ++
  5467. ++ ath_dbg(common, QUEUE, "Waking TX queue: %pM (%d)\n",
  5468. ++ queue->sta ? queue->sta->addr : queue->vif->addr,
  5469. ++ tid->tidno);
  5470. ++
  5471. ++ ath_txq_lock(sc, txq);
  5472. ++
  5473. ++ tid->has_queued = true;
  5474. ++ ath_tx_queue_tid(sc, txq, tid);
  5475. ++ ath_txq_schedule(sc, txq);
  5476. ++
  5477. ++ ath_txq_unlock(sc, txq);
  5478. ++}
  5479. ++
  5480. + static struct ath_frame_info *get_frame_info(struct sk_buff *skb)
  5481. + {
  5482. + struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
  5483. +@@ -160,7 +182,6 @@ static void ath_set_rates(struct ieee802
  5484. + static void ath_txq_skb_done(struct ath_softc *sc, struct ath_txq *txq,
  5485. + struct sk_buff *skb)
  5486. + {
  5487. +- struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  5488. + struct ath_frame_info *fi = get_frame_info(skb);
  5489. + int q = fi->txq;
  5490. +
  5491. +@@ -171,14 +192,6 @@ static void ath_txq_skb_done(struct ath_
  5492. + if (WARN_ON(--txq->pending_frames < 0))
  5493. + txq->pending_frames = 0;
  5494. +
  5495. +- if (txq->stopped &&
  5496. +- txq->pending_frames < sc->tx.txq_max_pending[q]) {
  5497. +- if (ath9k_is_chanctx_enabled())
  5498. +- ieee80211_wake_queue(sc->hw, info->hw_queue);
  5499. +- else
  5500. +- ieee80211_wake_queue(sc->hw, q);
  5501. +- txq->stopped = false;
  5502. +- }
  5503. + }
  5504. +
  5505. + static struct ath_atx_tid *
  5506. +@@ -188,9 +201,47 @@ ath_get_skb_tid(struct ath_softc *sc, st
  5507. + return ATH_AN_2_TID(an, tidno);
  5508. + }
  5509. +
  5510. ++static struct sk_buff *
  5511. ++ath_tid_pull(struct ath_atx_tid *tid)
  5512. ++{
  5513. ++ struct ath_softc *sc = tid->an->sc;
  5514. ++ struct ieee80211_hw *hw = sc->hw;
  5515. ++ struct ath_tx_control txctl = {
  5516. ++ .txq = tid->txq,
  5517. ++ .sta = tid->an->sta,
  5518. ++ };
  5519. ++ struct sk_buff *skb;
  5520. ++ struct ath_frame_info *fi;
  5521. ++ int q;
  5522. ++
  5523. ++ if (!tid->has_queued)
  5524. ++ return NULL;
  5525. ++
  5526. ++ skb = ieee80211_tx_dequeue(hw, container_of((void*)tid, struct ieee80211_txq, drv_priv));
  5527. ++ if (!skb) {
  5528. ++ tid->has_queued = false;
  5529. ++ return NULL;
  5530. ++ }
  5531. ++
  5532. ++ if (ath_tx_prepare(hw, skb, &txctl)) {
  5533. ++ ieee80211_free_txskb(hw, skb);
  5534. ++ return NULL;
  5535. ++ }
  5536. ++
  5537. ++ q = skb_get_queue_mapping(skb);
  5538. ++ if (tid->txq == sc->tx.txq_map[q]) {
  5539. ++ fi = get_frame_info(skb);
  5540. ++ fi->txq = q;
  5541. ++ ++tid->txq->pending_frames;
  5542. ++ }
  5543. ++
  5544. ++ return skb;
  5545. ++ }
  5546. ++
  5547. ++
  5548. + static bool ath_tid_has_buffered(struct ath_atx_tid *tid)
  5549. + {
  5550. +- return !skb_queue_empty(&tid->buf_q) || !skb_queue_empty(&tid->retry_q);
  5551. ++ return !skb_queue_empty(&tid->retry_q) || tid->has_queued;
  5552. + }
  5553. +
  5554. + static struct sk_buff *ath_tid_dequeue(struct ath_atx_tid *tid)
  5555. +@@ -199,46 +250,11 @@ static struct sk_buff *ath_tid_dequeue(s
  5556. +
  5557. + skb = __skb_dequeue(&tid->retry_q);
  5558. + if (!skb)
  5559. +- skb = __skb_dequeue(&tid->buf_q);
  5560. ++ skb = ath_tid_pull(tid);
  5561. +
  5562. + return skb;
  5563. + }
  5564. +
  5565. +-/*
  5566. +- * ath_tx_tid_change_state:
  5567. +- * - clears a-mpdu flag of previous session
  5568. +- * - force sequence number allocation to fix next BlockAck Window
  5569. +- */
  5570. +-static void
  5571. +-ath_tx_tid_change_state(struct ath_softc *sc, struct ath_atx_tid *tid)
  5572. +-{
  5573. +- struct ath_txq *txq = tid->txq;
  5574. +- struct ieee80211_tx_info *tx_info;
  5575. +- struct sk_buff *skb, *tskb;
  5576. +- struct ath_buf *bf;
  5577. +- struct ath_frame_info *fi;
  5578. +-
  5579. +- skb_queue_walk_safe(&tid->buf_q, skb, tskb) {
  5580. +- fi = get_frame_info(skb);
  5581. +- bf = fi->bf;
  5582. +-
  5583. +- tx_info = IEEE80211_SKB_CB(skb);
  5584. +- tx_info->flags &= ~IEEE80211_TX_CTL_AMPDU;
  5585. +-
  5586. +- if (bf)
  5587. +- continue;
  5588. +-
  5589. +- bf = ath_tx_setup_buffer(sc, txq, tid, skb);
  5590. +- if (!bf) {
  5591. +- __skb_unlink(skb, &tid->buf_q);
  5592. +- ath_txq_skb_done(sc, txq, skb);
  5593. +- ieee80211_free_txskb(sc->hw, skb);
  5594. +- continue;
  5595. +- }
  5596. +- }
  5597. +-
  5598. +-}
  5599. +-
  5600. + static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
  5601. + {
  5602. + struct ath_txq *txq = tid->txq;
  5603. +@@ -873,20 +889,16 @@ static int ath_compute_num_delims(struct
  5604. +
  5605. + static struct ath_buf *
  5606. + ath_tx_get_tid_subframe(struct ath_softc *sc, struct ath_txq *txq,
  5607. +- struct ath_atx_tid *tid, struct sk_buff_head **q)
  5608. ++ struct ath_atx_tid *tid)
  5609. + {
  5610. + struct ieee80211_tx_info *tx_info;
  5611. + struct ath_frame_info *fi;
  5612. +- struct sk_buff *skb;
  5613. ++ struct sk_buff *skb, *first_skb = NULL;
  5614. + struct ath_buf *bf;
  5615. + u16 seqno;
  5616. +
  5617. + while (1) {
  5618. +- *q = &tid->retry_q;
  5619. +- if (skb_queue_empty(*q))
  5620. +- *q = &tid->buf_q;
  5621. +-
  5622. +- skb = skb_peek(*q);
  5623. ++ skb = ath_tid_dequeue(tid);
  5624. + if (!skb)
  5625. + break;
  5626. +
  5627. +@@ -898,7 +910,6 @@ ath_tx_get_tid_subframe(struct ath_softc
  5628. + bf->bf_state.stale = false;
  5629. +
  5630. + if (!bf) {
  5631. +- __skb_unlink(skb, *q);
  5632. + ath_txq_skb_done(sc, txq, skb);
  5633. + ieee80211_free_txskb(sc->hw, skb);
  5634. + continue;
  5635. +@@ -927,8 +938,19 @@ ath_tx_get_tid_subframe(struct ath_softc
  5636. + seqno = bf->bf_state.seqno;
  5637. +
  5638. + /* do not step over block-ack window */
  5639. +- if (!BAW_WITHIN(tid->seq_start, tid->baw_size, seqno))
  5640. ++ if (!BAW_WITHIN(tid->seq_start, tid->baw_size, seqno)) {
  5641. ++ __skb_queue_tail(&tid->retry_q, skb);
  5642. ++
  5643. ++ /* If there are other skbs in the retry q, they are
  5644. ++ * probably within the BAW, so loop immediately to get
  5645. ++ * one of them. Otherwise the queue can get stuck. */
  5646. ++ if (!skb_queue_is_first(&tid->retry_q, skb) && skb != first_skb) {
  5647. ++ if(!first_skb) /* infinite loop prevention */
  5648. ++ first_skb = skb;
  5649. ++ continue;
  5650. ++ }
  5651. + break;
  5652. ++ }
  5653. +
  5654. + if (tid->bar_index > ATH_BA_INDEX(tid->seq_start, seqno)) {
  5655. + struct ath_tx_status ts = {};
  5656. +@@ -936,7 +958,6 @@ ath_tx_get_tid_subframe(struct ath_softc
  5657. +
  5658. + INIT_LIST_HEAD(&bf_head);
  5659. + list_add(&bf->list, &bf_head);
  5660. +- __skb_unlink(skb, *q);
  5661. + ath_tx_update_baw(sc, tid, seqno);
  5662. + ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0);
  5663. + continue;
  5664. +@@ -948,11 +969,10 @@ ath_tx_get_tid_subframe(struct ath_softc
  5665. + return NULL;
  5666. + }
  5667. +
  5668. +-static bool
  5669. ++static int
  5670. + ath_tx_form_aggr(struct ath_softc *sc, struct ath_txq *txq,
  5671. + struct ath_atx_tid *tid, struct list_head *bf_q,
  5672. +- struct ath_buf *bf_first, struct sk_buff_head *tid_q,
  5673. +- int *aggr_len)
  5674. ++ struct ath_buf *bf_first)
  5675. + {
  5676. + #define PADBYTES(_len) ((4 - ((_len) % 4)) % 4)
  5677. + struct ath_buf *bf = bf_first, *bf_prev = NULL;
  5678. +@@ -962,12 +982,13 @@ ath_tx_form_aggr(struct ath_softc *sc, s
  5679. + struct ieee80211_tx_info *tx_info;
  5680. + struct ath_frame_info *fi;
  5681. + struct sk_buff *skb;
  5682. +- bool closed = false;
  5683. ++
  5684. +
  5685. + bf = bf_first;
  5686. + aggr_limit = ath_lookup_rate(sc, bf, tid);
  5687. +
  5688. +- do {
  5689. ++ while (bf)
  5690. ++ {
  5691. + skb = bf->bf_mpdu;
  5692. + fi = get_frame_info(skb);
  5693. +
  5694. +@@ -976,12 +997,12 @@ ath_tx_form_aggr(struct ath_softc *sc, s
  5695. + if (nframes) {
  5696. + if (aggr_limit < al + bpad + al_delta ||
  5697. + ath_lookup_legacy(bf) || nframes >= h_baw)
  5698. +- break;
  5699. ++ goto stop;
  5700. +
  5701. + tx_info = IEEE80211_SKB_CB(bf->bf_mpdu);
  5702. + if ((tx_info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE) ||
  5703. + !(tx_info->flags & IEEE80211_TX_CTL_AMPDU))
  5704. +- break;
  5705. ++ goto stop;
  5706. + }
  5707. +
  5708. + /* add padding for previous frame to aggregation length */
  5709. +@@ -1003,20 +1024,18 @@ ath_tx_form_aggr(struct ath_softc *sc, s
  5710. + ath_tx_addto_baw(sc, tid, bf);
  5711. + bf->bf_state.ndelim = ndelim;
  5712. +
  5713. +- __skb_unlink(skb, tid_q);
  5714. + list_add_tail(&bf->list, bf_q);
  5715. + if (bf_prev)
  5716. + bf_prev->bf_next = bf;
  5717. +
  5718. + bf_prev = bf;
  5719. +
  5720. +- bf = ath_tx_get_tid_subframe(sc, txq, tid, &tid_q);
  5721. +- if (!bf) {
  5722. +- closed = true;
  5723. +- break;
  5724. +- }
  5725. +- } while (ath_tid_has_buffered(tid));
  5726. +-
  5727. ++ bf = ath_tx_get_tid_subframe(sc, txq, tid);
  5728. ++ }
  5729. ++ goto finish;
  5730. ++stop:
  5731. ++ __skb_queue_tail(&tid->retry_q, bf->bf_mpdu);
  5732. ++finish:
  5733. + bf = bf_first;
  5734. + bf->bf_lastbf = bf_prev;
  5735. +
  5736. +@@ -1027,9 +1046,7 @@ ath_tx_form_aggr(struct ath_softc *sc, s
  5737. + TX_STAT_INC(txq->axq_qnum, a_aggr);
  5738. + }
  5739. +
  5740. +- *aggr_len = al;
  5741. +-
  5742. +- return closed;
  5743. ++ return al;
  5744. + #undef PADBYTES
  5745. + }
  5746. +
  5747. +@@ -1406,18 +1423,15 @@ static void ath_tx_fill_desc(struct ath_
  5748. + static void
  5749. + ath_tx_form_burst(struct ath_softc *sc, struct ath_txq *txq,
  5750. + struct ath_atx_tid *tid, struct list_head *bf_q,
  5751. +- struct ath_buf *bf_first, struct sk_buff_head *tid_q)
  5752. ++ struct ath_buf *bf_first)
  5753. + {
  5754. + struct ath_buf *bf = bf_first, *bf_prev = NULL;
  5755. +- struct sk_buff *skb;
  5756. + int nframes = 0;
  5757. +
  5758. + do {
  5759. + struct ieee80211_tx_info *tx_info;
  5760. +- skb = bf->bf_mpdu;
  5761. +
  5762. + nframes++;
  5763. +- __skb_unlink(skb, tid_q);
  5764. + list_add_tail(&bf->list, bf_q);
  5765. + if (bf_prev)
  5766. + bf_prev->bf_next = bf;
  5767. +@@ -1426,13 +1440,15 @@ ath_tx_form_burst(struct ath_softc *sc,
  5768. + if (nframes >= 2)
  5769. + break;
  5770. +
  5771. +- bf = ath_tx_get_tid_subframe(sc, txq, tid, &tid_q);
  5772. ++ bf = ath_tx_get_tid_subframe(sc, txq, tid);
  5773. + if (!bf)
  5774. + break;
  5775. +
  5776. + tx_info = IEEE80211_SKB_CB(bf->bf_mpdu);
  5777. +- if (tx_info->flags & IEEE80211_TX_CTL_AMPDU)
  5778. ++ if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) {
  5779. ++ __skb_queue_tail(&tid->retry_q, bf->bf_mpdu);
  5780. + break;
  5781. ++ }
  5782. +
  5783. + ath_set_rates(tid->an->vif, tid->an->sta, bf, false);
  5784. + } while (1);
  5785. +@@ -1443,34 +1459,33 @@ static bool ath_tx_sched_aggr(struct ath
  5786. + {
  5787. + struct ath_buf *bf;
  5788. + struct ieee80211_tx_info *tx_info;
  5789. +- struct sk_buff_head *tid_q;
  5790. + struct list_head bf_q;
  5791. + int aggr_len = 0;
  5792. +- bool aggr, last = true;
  5793. ++ bool aggr;
  5794. +
  5795. + if (!ath_tid_has_buffered(tid))
  5796. + return false;
  5797. +
  5798. + INIT_LIST_HEAD(&bf_q);
  5799. +
  5800. +- bf = ath_tx_get_tid_subframe(sc, txq, tid, &tid_q);
  5801. ++ bf = ath_tx_get_tid_subframe(sc, txq, tid);
  5802. + if (!bf)
  5803. + return false;
  5804. +
  5805. + tx_info = IEEE80211_SKB_CB(bf->bf_mpdu);
  5806. + aggr = !!(tx_info->flags & IEEE80211_TX_CTL_AMPDU);
  5807. + if ((aggr && txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH) ||
  5808. +- (!aggr && txq->axq_depth >= ATH_NON_AGGR_MIN_QDEPTH)) {
  5809. ++ (!aggr && txq->axq_depth >= ATH_NON_AGGR_MIN_QDEPTH)) {
  5810. ++ __skb_queue_tail(&tid->retry_q, bf->bf_mpdu);
  5811. + *stop = true;
  5812. + return false;
  5813. + }
  5814. +
  5815. + ath_set_rates(tid->an->vif, tid->an->sta, bf, false);
  5816. + if (aggr)
  5817. +- last = ath_tx_form_aggr(sc, txq, tid, &bf_q, bf,
  5818. +- tid_q, &aggr_len);
  5819. ++ aggr_len = ath_tx_form_aggr(sc, txq, tid, &bf_q, bf);
  5820. + else
  5821. +- ath_tx_form_burst(sc, txq, tid, &bf_q, bf, tid_q);
  5822. ++ ath_tx_form_burst(sc, txq, tid, &bf_q, bf);
  5823. +
  5824. + if (list_empty(&bf_q))
  5825. + return false;
  5826. +@@ -1513,9 +1528,6 @@ int ath_tx_aggr_start(struct ath_softc *
  5827. + an->mpdudensity = density;
  5828. + }
  5829. +
  5830. +- /* force sequence number allocation for pending frames */
  5831. +- ath_tx_tid_change_state(sc, txtid);
  5832. +-
  5833. + txtid->active = true;
  5834. + *ssn = txtid->seq_start = txtid->seq_next;
  5835. + txtid->bar_index = -1;
  5836. +@@ -1540,7 +1552,6 @@ void ath_tx_aggr_stop(struct ath_softc *
  5837. + ath_txq_lock(sc, txq);
  5838. + txtid->active = false;
  5839. + ath_tx_flush_tid(sc, txtid);
  5840. +- ath_tx_tid_change_state(sc, txtid);
  5841. + ath_txq_unlock_complete(sc, txq);
  5842. + }
  5843. +
  5844. +@@ -1550,14 +1561,12 @@ void ath_tx_aggr_sleep(struct ieee80211_
  5845. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  5846. + struct ath_atx_tid *tid;
  5847. + struct ath_txq *txq;
  5848. +- bool buffered;
  5849. + int tidno;
  5850. +
  5851. + ath_dbg(common, XMIT, "%s called\n", __func__);
  5852. +
  5853. +- for (tidno = 0, tid = &an->tid[tidno];
  5854. +- tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
  5855. +-
  5856. ++ for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) {
  5857. ++ tid = ATH_AN_2_TID(an, tidno);
  5858. + txq = tid->txq;
  5859. +
  5860. + ath_txq_lock(sc, txq);
  5861. +@@ -1567,13 +1576,12 @@ void ath_tx_aggr_sleep(struct ieee80211_
  5862. + continue;
  5863. + }
  5864. +
  5865. +- buffered = ath_tid_has_buffered(tid);
  5866. ++ if (!skb_queue_empty(&tid->retry_q))
  5867. ++ ieee80211_sta_set_buffered(sta, tid->tidno, true);
  5868. +
  5869. + list_del_init(&tid->list);
  5870. +
  5871. + ath_txq_unlock(sc, txq);
  5872. +-
  5873. +- ieee80211_sta_set_buffered(sta, tidno, buffered);
  5874. + }
  5875. + }
  5876. +
  5877. +@@ -1586,19 +1594,16 @@ void ath_tx_aggr_wakeup(struct ath_softc
  5878. +
  5879. + ath_dbg(common, XMIT, "%s called\n", __func__);
  5880. +
  5881. +- for (tidno = 0, tid = &an->tid[tidno];
  5882. +- tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
  5883. +-
  5884. ++ for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) {
  5885. ++ tid = ATH_AN_2_TID(an, tidno);
  5886. + txq = tid->txq;
  5887. +
  5888. + ath_txq_lock(sc, txq);
  5889. + tid->clear_ps_filter = true;
  5890. +-
  5891. + if (ath_tid_has_buffered(tid)) {
  5892. + ath_tx_queue_tid(sc, txq, tid);
  5893. + ath_txq_schedule(sc, txq);
  5894. + }
  5895. +-
  5896. + ath_txq_unlock_complete(sc, txq);
  5897. + }
  5898. + }
  5899. +@@ -1621,11 +1626,6 @@ void ath_tx_aggr_resume(struct ath_softc
  5900. +
  5901. + tid->baw_size = IEEE80211_MIN_AMPDU_BUF << sta->ht_cap.ampdu_factor;
  5902. +
  5903. +- if (ath_tid_has_buffered(tid)) {
  5904. +- ath_tx_queue_tid(sc, txq, tid);
  5905. +- ath_txq_schedule(sc, txq);
  5906. +- }
  5907. +-
  5908. + ath_txq_unlock_complete(sc, txq);
  5909. + }
  5910. +
  5911. +@@ -1641,7 +1641,6 @@ void ath9k_release_buffered_frames(struc
  5912. + struct ieee80211_tx_info *info;
  5913. + struct list_head bf_q;
  5914. + struct ath_buf *bf_tail = NULL, *bf;
  5915. +- struct sk_buff_head *tid_q;
  5916. + int sent = 0;
  5917. + int i;
  5918. +
  5919. +@@ -1656,11 +1655,10 @@ void ath9k_release_buffered_frames(struc
  5920. +
  5921. + ath_txq_lock(sc, tid->txq);
  5922. + while (nframes > 0) {
  5923. +- bf = ath_tx_get_tid_subframe(sc, sc->tx.uapsdq, tid, &tid_q);
  5924. ++ bf = ath_tx_get_tid_subframe(sc, sc->tx.uapsdq, tid);
  5925. + if (!bf)
  5926. + break;
  5927. +
  5928. +- __skb_unlink(bf->bf_mpdu, tid_q);
  5929. + list_add_tail(&bf->list, &bf_q);
  5930. + ath_set_rates(tid->an->vif, tid->an->sta, bf, true);
  5931. + if (bf_isampdu(bf)) {
  5932. +@@ -1675,7 +1673,7 @@ void ath9k_release_buffered_frames(struc
  5933. + sent++;
  5934. + TX_STAT_INC(txq->axq_qnum, a_queued_hw);
  5935. +
  5936. +- if (an->sta && !ath_tid_has_buffered(tid))
  5937. ++ if (an->sta && skb_queue_empty(&tid->retry_q))
  5938. + ieee80211_sta_set_buffered(an->sta, i, false);
  5939. + }
  5940. + ath_txq_unlock_complete(sc, tid->txq);
  5941. +@@ -1902,13 +1900,7 @@ bool ath_drain_all_txq(struct ath_softc
  5942. + if (!ATH_TXQ_SETUP(sc, i))
  5943. + continue;
  5944. +
  5945. +- /*
  5946. +- * The caller will resume queues with ieee80211_wake_queues.
  5947. +- * Mark the queue as not stopped to prevent ath_tx_complete
  5948. +- * from waking the queue too early.
  5949. +- */
  5950. + txq = &sc->tx.txq[i];
  5951. +- txq->stopped = false;
  5952. + ath_draintxq(sc, txq);
  5953. + }
  5954. +
  5955. +@@ -2308,15 +2300,12 @@ int ath_tx_start(struct ieee80211_hw *hw
  5956. + struct ath_txq *txq = txctl->txq;
  5957. + struct ath_atx_tid *tid = NULL;
  5958. + struct ath_buf *bf;
  5959. +- bool queue, ps_resp;
  5960. ++ bool ps_resp;
  5961. + int q, ret;
  5962. +
  5963. + if (vif)
  5964. + avp = (void *)vif->drv_priv;
  5965. +
  5966. +- if (info->flags & IEEE80211_TX_CTL_TX_OFFCHAN)
  5967. +- txctl->force_channel = true;
  5968. +-
  5969. + ps_resp = !!(info->control.flags & IEEE80211_TX_CTRL_PS_RESPONSE);
  5970. +
  5971. + ret = ath_tx_prepare(hw, skb, txctl);
  5972. +@@ -2331,63 +2320,13 @@ int ath_tx_start(struct ieee80211_hw *hw
  5973. +
  5974. + q = skb_get_queue_mapping(skb);
  5975. +
  5976. ++ if (ps_resp)
  5977. ++ txq = sc->tx.uapsdq;
  5978. ++
  5979. + ath_txq_lock(sc, txq);
  5980. + if (txq == sc->tx.txq_map[q]) {
  5981. + fi->txq = q;
  5982. +- if (++txq->pending_frames > sc->tx.txq_max_pending[q] &&
  5983. +- !txq->stopped) {
  5984. +- if (ath9k_is_chanctx_enabled())
  5985. +- ieee80211_stop_queue(sc->hw, info->hw_queue);
  5986. +- else
  5987. +- ieee80211_stop_queue(sc->hw, q);
  5988. +- txq->stopped = true;
  5989. +- }
  5990. +- }
  5991. +-
  5992. +- queue = ieee80211_is_data_present(hdr->frame_control);
  5993. +-
  5994. +- /* If chanctx, queue all null frames while NOA could be there */
  5995. +- if (ath9k_is_chanctx_enabled() &&
  5996. +- ieee80211_is_nullfunc(hdr->frame_control) &&
  5997. +- !txctl->force_channel)
  5998. +- queue = true;
  5999. +-
  6000. +- /* Force queueing of all frames that belong to a virtual interface on
  6001. +- * a different channel context, to ensure that they are sent on the
  6002. +- * correct channel.
  6003. +- */
  6004. +- if (((avp && avp->chanctx != sc->cur_chan) ||
  6005. +- sc->cur_chan->stopped) && !txctl->force_channel) {
  6006. +- if (!txctl->an)
  6007. +- txctl->an = &avp->mcast_node;
  6008. +- queue = true;
  6009. +- ps_resp = false;
  6010. +- }
  6011. +-
  6012. +- if (txctl->an && queue)
  6013. +- tid = ath_get_skb_tid(sc, txctl->an, skb);
  6014. +-
  6015. +- if (ps_resp) {
  6016. +- ath_txq_unlock(sc, txq);
  6017. +- txq = sc->tx.uapsdq;
  6018. +- ath_txq_lock(sc, txq);
  6019. +- } else if (txctl->an && queue) {
  6020. +- WARN_ON(tid->txq != txctl->txq);
  6021. +-
  6022. +- if (info->flags & IEEE80211_TX_CTL_CLEAR_PS_FILT)
  6023. +- tid->clear_ps_filter = true;
  6024. +-
  6025. +- /*
  6026. +- * Add this frame to software queue for scheduling later
  6027. +- * for aggregation.
  6028. +- */
  6029. +- TX_STAT_INC(txq->axq_qnum, a_queued_sw);
  6030. +- __skb_queue_tail(&tid->buf_q, skb);
  6031. +- if (!txctl->an->sleeping)
  6032. +- ath_tx_queue_tid(sc, txq, tid);
  6033. +-
  6034. +- ath_txq_schedule(sc, txq);
  6035. +- goto out;
  6036. ++ ++txq->pending_frames;
  6037. + }
  6038. +
  6039. + bf = ath_tx_setup_buffer(sc, txq, tid, skb);
  6040. +@@ -2871,9 +2810,8 @@ void ath_tx_node_init(struct ath_softc *
  6041. + struct ath_atx_tid *tid;
  6042. + int tidno, acno;
  6043. +
  6044. +- for (tidno = 0, tid = &an->tid[tidno];
  6045. +- tidno < IEEE80211_NUM_TIDS;
  6046. +- tidno++, tid++) {
  6047. ++ for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) {
  6048. ++ tid = ATH_AN_2_TID(an, tidno);
  6049. + tid->an = an;
  6050. + tid->tidno = tidno;
  6051. + tid->seq_start = tid->seq_next = 0;
  6052. +@@ -2881,11 +2819,14 @@ void ath_tx_node_init(struct ath_softc *
  6053. + tid->baw_head = tid->baw_tail = 0;
  6054. + tid->active = false;
  6055. + tid->clear_ps_filter = true;
  6056. +- __skb_queue_head_init(&tid->buf_q);
  6057. ++ tid->has_queued = false;
  6058. + __skb_queue_head_init(&tid->retry_q);
  6059. + INIT_LIST_HEAD(&tid->list);
  6060. + acno = TID_TO_WME_AC(tidno);
  6061. + tid->txq = sc->tx.txq_map[acno];
  6062. ++
  6063. ++ if (!an->sta)
  6064. ++ break; /* just one multicast ath_atx_tid */
  6065. + }
  6066. + }
  6067. +
  6068. +@@ -2895,9 +2836,8 @@ void ath_tx_node_cleanup(struct ath_soft
  6069. + struct ath_txq *txq;
  6070. + int tidno;
  6071. +
  6072. +- for (tidno = 0, tid = &an->tid[tidno];
  6073. +- tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
  6074. +-
  6075. ++ for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) {
  6076. ++ tid = ATH_AN_2_TID(an, tidno);
  6077. + txq = tid->txq;
  6078. +
  6079. + ath_txq_lock(sc, txq);
  6080. +@@ -2909,6 +2849,9 @@ void ath_tx_node_cleanup(struct ath_soft
  6081. + tid->active = false;
  6082. +
  6083. + ath_txq_unlock(sc, txq);
  6084. ++
  6085. ++ if (!an->sta)
  6086. ++ break; /* just one multicast ath_atx_tid */
  6087. + }
  6088. + }
  6089. +
  6090. 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
  6091. deleted file mode 100644
  6092. index 2eeed22af0adb5e8386f5f5e75af725bbf71ec7b..0000000000000000000000000000000000000000
  6093. --- a/package/kernel/mac80211/patches/320-cfg80211-add-support-for-non-linear-skbs-in-ieee8021.patch
  6094. +++ /dev/null
  6095. @@ -1,159 +0,0 @@
  6096. -From: Felix Fietkau <nbd@openwrt.org>
  6097. -Date: Tue, 2 Feb 2016 14:39:10 +0100
  6098. -Subject: [PATCH] cfg80211: add support for non-linear skbs in
  6099. - ieee80211_amsdu_to_8023s
  6100. -
  6101. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  6102. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  6103. ----
  6104. -
  6105. ---- a/net/wireless/util.c
  6106. -+++ b/net/wireless/util.c
  6107. -@@ -644,73 +644,75 @@ int ieee80211_data_from_8023(struct sk_b
  6108. - }
  6109. - EXPORT_SYMBOL(ieee80211_data_from_8023);
  6110. -
  6111. -+static struct sk_buff *
  6112. -+__ieee80211_amsdu_copy(struct sk_buff *skb, unsigned int hlen,
  6113. -+ int offset, int len)
  6114. -+{
  6115. -+ struct sk_buff *frame;
  6116. -+
  6117. -+ if (skb->len - offset < len)
  6118. -+ return NULL;
  6119. -+
  6120. -+ /*
  6121. -+ * Allocate and reserve two bytes more for payload
  6122. -+ * alignment since sizeof(struct ethhdr) is 14.
  6123. -+ */
  6124. -+ frame = dev_alloc_skb(hlen + sizeof(struct ethhdr) + 2 + len);
  6125. -+
  6126. -+ skb_reserve(frame, hlen + sizeof(struct ethhdr) + 2);
  6127. -+ skb_copy_bits(skb, offset, skb_put(frame, len), len);
  6128. -+
  6129. -+ return frame;
  6130. -+}
  6131. -
  6132. - void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
  6133. - const u8 *addr, enum nl80211_iftype iftype,
  6134. - const unsigned int extra_headroom,
  6135. - bool has_80211_header)
  6136. - {
  6137. -+ unsigned int hlen = ALIGN(extra_headroom, 4);
  6138. - struct sk_buff *frame = NULL;
  6139. - u16 ethertype;
  6140. - u8 *payload;
  6141. -- const struct ethhdr *eth;
  6142. -- int remaining, err;
  6143. -- u8 dst[ETH_ALEN], src[ETH_ALEN];
  6144. --
  6145. -- if (skb_linearize(skb))
  6146. -- goto out;
  6147. -+ int offset = 0, remaining, err;
  6148. -+ struct ethhdr eth;
  6149. -+ bool reuse_skb = true;
  6150. -+ bool last = false;
  6151. -
  6152. - if (has_80211_header) {
  6153. -- err = ieee80211_data_to_8023(skb, addr, iftype);
  6154. -+ err = __ieee80211_data_to_8023(skb, &eth, addr, iftype);
  6155. - if (err)
  6156. - goto out;
  6157. --
  6158. -- /* skip the wrapping header */
  6159. -- eth = (struct ethhdr *) skb_pull(skb, sizeof(struct ethhdr));
  6160. -- if (!eth)
  6161. -- goto out;
  6162. -- } else {
  6163. -- eth = (struct ethhdr *) skb->data;
  6164. - }
  6165. -
  6166. -- while (skb != frame) {
  6167. -+ while (!last) {
  6168. -+ unsigned int subframe_len;
  6169. -+ int len;
  6170. - u8 padding;
  6171. -- __be16 len = eth->h_proto;
  6172. -- unsigned int subframe_len = sizeof(struct ethhdr) + ntohs(len);
  6173. --
  6174. -- remaining = skb->len;
  6175. -- memcpy(dst, eth->h_dest, ETH_ALEN);
  6176. -- memcpy(src, eth->h_source, ETH_ALEN);
  6177. -
  6178. -+ skb_copy_bits(skb, offset, &eth, sizeof(eth));
  6179. -+ len = ntohs(eth.h_proto);
  6180. -+ subframe_len = sizeof(struct ethhdr) + len;
  6181. - padding = (4 - subframe_len) & 0x3;
  6182. -+
  6183. - /* the last MSDU has no padding */
  6184. -+ remaining = skb->len - offset;
  6185. - if (subframe_len > remaining)
  6186. - goto purge;
  6187. -
  6188. -- skb_pull(skb, sizeof(struct ethhdr));
  6189. -+ offset += sizeof(struct ethhdr);
  6190. - /* reuse skb for the last subframe */
  6191. -- if (remaining <= subframe_len + padding)
  6192. -+ last = remaining <= subframe_len + padding;
  6193. -+ if (!skb_is_nonlinear(skb) && last) {
  6194. -+ skb_pull(skb, offset);
  6195. - frame = skb;
  6196. -- else {
  6197. -- unsigned int hlen = ALIGN(extra_headroom, 4);
  6198. -- /*
  6199. -- * Allocate and reserve two bytes more for payload
  6200. -- * alignment since sizeof(struct ethhdr) is 14.
  6201. -- */
  6202. -- frame = dev_alloc_skb(hlen + subframe_len + 2);
  6203. -+ reuse_skb = true;
  6204. -+ } else {
  6205. -+ frame = __ieee80211_amsdu_copy(skb, hlen, offset, len);
  6206. - if (!frame)
  6207. - goto purge;
  6208. -
  6209. -- skb_reserve(frame, hlen + sizeof(struct ethhdr) + 2);
  6210. -- memcpy(skb_put(frame, ntohs(len)), skb->data,
  6211. -- ntohs(len));
  6212. --
  6213. -- eth = (struct ethhdr *)skb_pull(skb, ntohs(len) +
  6214. -- padding);
  6215. -- if (!eth) {
  6216. -- dev_kfree_skb(frame);
  6217. -- goto purge;
  6218. -- }
  6219. -+ offset += len + padding;
  6220. - }
  6221. -
  6222. - skb_reset_network_header(frame);
  6223. -@@ -719,24 +721,20 @@ void ieee80211_amsdu_to_8023s(struct sk_
  6224. -
  6225. - payload = frame->data;
  6226. - ethertype = (payload[6] << 8) | payload[7];
  6227. --
  6228. - if (likely((ether_addr_equal(payload, rfc1042_header) &&
  6229. - ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) ||
  6230. - ether_addr_equal(payload, bridge_tunnel_header))) {
  6231. -- /* remove RFC1042 or Bridge-Tunnel
  6232. -- * encapsulation and replace EtherType */
  6233. -- skb_pull(frame, 6);
  6234. -- memcpy(skb_push(frame, ETH_ALEN), src, ETH_ALEN);
  6235. -- memcpy(skb_push(frame, ETH_ALEN), dst, ETH_ALEN);
  6236. -- } else {
  6237. -- memcpy(skb_push(frame, sizeof(__be16)), &len,
  6238. -- sizeof(__be16));
  6239. -- memcpy(skb_push(frame, ETH_ALEN), src, ETH_ALEN);
  6240. -- memcpy(skb_push(frame, ETH_ALEN), dst, ETH_ALEN);
  6241. -+ eth.h_proto = htons(ethertype);
  6242. -+ skb_pull(frame, ETH_ALEN + 2);
  6243. - }
  6244. -+
  6245. -+ memcpy(skb_push(frame, sizeof(eth)), &eth, sizeof(eth));
  6246. - __skb_queue_tail(list, frame);
  6247. - }
  6248. -
  6249. -+ if (!reuse_skb)
  6250. -+ dev_kfree_skb(skb);
  6251. -+
  6252. - return;
  6253. -
  6254. - purge:
  6255. 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
  6256. new file mode 100644
  6257. index 0000000000000000000000000000000000000000..9caa76dc5d40a2fe2ce332e549bfba762a1431d5
  6258. --- /dev/null
  6259. +++ b/package/kernel/mac80211/patches/321-ath9k_hw-reset-AHB-WMAC-interface-on-AR91xx.patch
  6260. @@ -0,0 +1,25 @@
  6261. +From: Felix Fietkau <nbd@nbd.name>
  6262. +Date: Sat, 9 Jul 2016 15:25:24 +0200
  6263. +Subject: [PATCH] ath9k_hw: reset AHB-WMAC interface on AR91xx
  6264. +
  6265. +Should fix a few stability issues
  6266. +
  6267. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  6268. +---
  6269. +
  6270. +--- a/drivers/net/wireless/ath/ath9k/hw.c
  6271. ++++ b/drivers/net/wireless/ath/ath9k/hw.c
  6272. +@@ -1398,8 +1398,12 @@ static bool ath9k_hw_set_reset(struct at
  6273. + if (!AR_SREV_9100(ah))
  6274. + REG_WRITE(ah, AR_RC, 0);
  6275. +
  6276. +- if (AR_SREV_9100(ah))
  6277. ++ if (AR_SREV_9100(ah)) {
  6278. ++ /* Reset the AHB-WMAC interface */
  6279. ++ if (ah->external_reset)
  6280. ++ ah->external_reset();
  6281. + udelay(50);
  6282. ++ }
  6283. +
  6284. + return true;
  6285. + }
  6286. 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
  6287. deleted file mode 100644
  6288. index c4155a118101fb910100de80f4ac7f6da1787a1c..0000000000000000000000000000000000000000
  6289. --- a/package/kernel/mac80211/patches/321-mac80211-Parse-legacy-and-HT-rate-in-injected-frames.patch
  6290. +++ /dev/null
  6291. @@ -1,155 +0,0 @@
  6292. -From: Sven Eckelmann <sven@narfation.org>
  6293. -Date: Tue, 26 Jan 2016 17:11:13 +0100
  6294. -Subject: [PATCH] mac80211: Parse legacy and HT rate in injected frames
  6295. -
  6296. -Drivers/devices without their own rate control algorithm can get the
  6297. -information what rates they should use from either the radiotap header of
  6298. -injected frames or from the rate control algorithm. But the parsing of the
  6299. -legacy rate information from the radiotap header was removed in commit
  6300. -e6a9854b05c1 ("mac80211/drivers: rewrite the rate control API").
  6301. -
  6302. -The removal of this feature heavily reduced the usefulness of frame
  6303. -injection when wanting to simulate specific transmission behavior. Having
  6304. -rate parsing together with MCS rates and retry support allows a fine
  6305. -grained selection of the tx behavior of injected frames for these kind of
  6306. -tests.
  6307. -
  6308. -Signed-off-by: Sven Eckelmann <sven@narfation.org>
  6309. -Cc: Simon Wunderlich <sw@simonwunderlich.de>
  6310. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  6311. ----
  6312. -
  6313. ---- a/include/net/mac80211.h
  6314. -+++ b/include/net/mac80211.h
  6315. -@@ -708,12 +708,14 @@ enum mac80211_tx_info_flags {
  6316. - * protocol frame (e.g. EAP)
  6317. - * @IEEE80211_TX_CTRL_PS_RESPONSE: This frame is a response to a poll
  6318. - * frame (PS-Poll or uAPSD).
  6319. -+ * @IEEE80211_TX_CTRL_RATE_INJECT: This frame is injected with rate information
  6320. - *
  6321. - * These flags are used in tx_info->control.flags.
  6322. - */
  6323. - enum mac80211_tx_control_flags {
  6324. - IEEE80211_TX_CTRL_PORT_CTRL_PROTO = BIT(0),
  6325. - IEEE80211_TX_CTRL_PS_RESPONSE = BIT(1),
  6326. -+ IEEE80211_TX_CTRL_RATE_INJECT = BIT(2),
  6327. - };
  6328. -
  6329. - /*
  6330. ---- a/net/mac80211/tx.c
  6331. -+++ b/net/mac80211/tx.c
  6332. -@@ -710,6 +710,10 @@ ieee80211_tx_h_rate_ctrl(struct ieee8021
  6333. -
  6334. - info->control.short_preamble = txrc.short_preamble;
  6335. -
  6336. -+ /* don't ask rate control when rate already injected via radiotap */
  6337. -+ if (info->control.flags & IEEE80211_TX_CTRL_RATE_INJECT)
  6338. -+ return TX_CONTINUE;
  6339. -+
  6340. - if (tx->sta)
  6341. - assoc = test_sta_flag(tx->sta, WLAN_STA_ASSOC);
  6342. -
  6343. -@@ -1665,15 +1669,24 @@ void ieee80211_xmit(struct ieee80211_sub
  6344. - ieee80211_tx(sdata, sta, skb, false);
  6345. - }
  6346. -
  6347. --static bool ieee80211_parse_tx_radiotap(struct sk_buff *skb)
  6348. -+static bool ieee80211_parse_tx_radiotap(struct ieee80211_local *local,
  6349. -+ struct sk_buff *skb)
  6350. - {
  6351. - struct ieee80211_radiotap_iterator iterator;
  6352. - struct ieee80211_radiotap_header *rthdr =
  6353. - (struct ieee80211_radiotap_header *) skb->data;
  6354. - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  6355. -+ struct ieee80211_supported_band *sband =
  6356. -+ local->hw.wiphy->bands[info->band];
  6357. - int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len,
  6358. - NULL);
  6359. - u16 txflags;
  6360. -+ u16 rate = 0;
  6361. -+ bool rate_found = false;
  6362. -+ u8 rate_retries = 0;
  6363. -+ u16 rate_flags = 0;
  6364. -+ u8 mcs_known, mcs_flags;
  6365. -+ int i;
  6366. -
  6367. - info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT |
  6368. - IEEE80211_TX_CTL_DONTFRAG;
  6369. -@@ -1724,6 +1737,35 @@ static bool ieee80211_parse_tx_radiotap(
  6370. - info->flags |= IEEE80211_TX_CTL_NO_ACK;
  6371. - break;
  6372. -
  6373. -+ case IEEE80211_RADIOTAP_RATE:
  6374. -+ rate = *iterator.this_arg;
  6375. -+ rate_flags = 0;
  6376. -+ rate_found = true;
  6377. -+ break;
  6378. -+
  6379. -+ case IEEE80211_RADIOTAP_DATA_RETRIES:
  6380. -+ rate_retries = *iterator.this_arg;
  6381. -+ break;
  6382. -+
  6383. -+ case IEEE80211_RADIOTAP_MCS:
  6384. -+ mcs_known = iterator.this_arg[0];
  6385. -+ mcs_flags = iterator.this_arg[1];
  6386. -+ if (!(mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_MCS))
  6387. -+ break;
  6388. -+
  6389. -+ rate_found = true;
  6390. -+ rate = iterator.this_arg[2];
  6391. -+ rate_flags = IEEE80211_TX_RC_MCS;
  6392. -+
  6393. -+ if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_GI &&
  6394. -+ mcs_flags & IEEE80211_RADIOTAP_MCS_SGI)
  6395. -+ rate_flags |= IEEE80211_TX_RC_SHORT_GI;
  6396. -+
  6397. -+ if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_BW &&
  6398. -+ mcs_flags & IEEE80211_RADIOTAP_MCS_BW_40)
  6399. -+ rate_flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
  6400. -+ break;
  6401. -+
  6402. - /*
  6403. - * Please update the file
  6404. - * Documentation/networking/mac80211-injection.txt
  6405. -@@ -1738,6 +1780,32 @@ static bool ieee80211_parse_tx_radiotap(
  6406. - if (ret != -ENOENT) /* ie, if we didn't simply run out of fields */
  6407. - return false;
  6408. -
  6409. -+ if (rate_found) {
  6410. -+ info->control.flags |= IEEE80211_TX_CTRL_RATE_INJECT;
  6411. -+
  6412. -+ for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) {
  6413. -+ info->control.rates[i].idx = -1;
  6414. -+ info->control.rates[i].flags = 0;
  6415. -+ info->control.rates[i].count = 0;
  6416. -+ }
  6417. -+
  6418. -+ if (rate_flags & IEEE80211_TX_RC_MCS) {
  6419. -+ info->control.rates[0].idx = rate;
  6420. -+ } else {
  6421. -+ for (i = 0; i < sband->n_bitrates; i++) {
  6422. -+ if (rate * 5 != sband->bitrates[i].bitrate)
  6423. -+ continue;
  6424. -+
  6425. -+ info->control.rates[0].idx = i;
  6426. -+ break;
  6427. -+ }
  6428. -+ }
  6429. -+
  6430. -+ info->control.rates[0].flags = rate_flags;
  6431. -+ info->control.rates[0].count = min_t(u8, rate_retries + 1,
  6432. -+ local->hw.max_rate_tries);
  6433. -+ }
  6434. -+
  6435. - /*
  6436. - * remove the radiotap header
  6437. - * iterator->_max_length was sanity-checked against
  6438. -@@ -1819,7 +1887,7 @@ netdev_tx_t ieee80211_monitor_start_xmit
  6439. - IEEE80211_TX_CTL_INJECTED;
  6440. -
  6441. - /* process and remove the injection radiotap header */
  6442. -- if (!ieee80211_parse_tx_radiotap(skb))
  6443. -+ if (!ieee80211_parse_tx_radiotap(local, skb))
  6444. - goto fail;
  6445. -
  6446. - rcu_read_lock();
  6447. 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
  6448. new file mode 100644
  6449. index 0000000000000000000000000000000000000000..5d4e849b7fd3e0cf1510e5759c150571864b3c89
  6450. --- /dev/null
  6451. +++ b/package/kernel/mac80211/patches/322-ath9k_hw-issue-external-reset-for-QCA9550.patch
  6452. @@ -0,0 +1,125 @@
  6453. +From: Felix Fietkau <nbd@nbd.name>
  6454. +Date: Sat, 9 Jul 2016 15:26:44 +0200
  6455. +Subject: [PATCH] ath9k_hw: issue external reset for QCA9550
  6456. +
  6457. +The RTC interface on the SoC needs to be reset along with the rest of
  6458. +the WMAC.
  6459. +
  6460. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  6461. +---
  6462. +
  6463. +--- a/drivers/net/wireless/ath/ath9k/hw.c
  6464. ++++ b/drivers/net/wireless/ath/ath9k/hw.c
  6465. +@@ -1275,39 +1275,56 @@ void ath9k_hw_get_delta_slope_vals(struc
  6466. + *coef_exponent = coef_exp - 16;
  6467. + }
  6468. +
  6469. +-/* AR9330 WAR:
  6470. +- * call external reset function to reset WMAC if:
  6471. +- * - doing a cold reset
  6472. +- * - we have pending frames in the TX queues.
  6473. +- */
  6474. +-static bool ath9k_hw_ar9330_reset_war(struct ath_hw *ah, int type)
  6475. ++static bool ath9k_hw_need_external_reset(struct ath_hw *ah, int type)
  6476. + {
  6477. +- int i, npend = 0;
  6478. ++ int i;
  6479. +
  6480. +- for (i = 0; i < AR_NUM_QCU; i++) {
  6481. +- npend = ath9k_hw_numtxpending(ah, i);
  6482. +- if (npend)
  6483. +- break;
  6484. ++ if (type == ATH9K_RESET_COLD)
  6485. ++ return true;
  6486. ++
  6487. ++ if (AR_SREV_9550(ah))
  6488. ++ return true;
  6489. ++
  6490. ++ /* AR9330 WAR:
  6491. ++ * call external reset function to reset WMAC if:
  6492. ++ * - doing a cold reset
  6493. ++ * - we have pending frames in the TX queues.
  6494. ++ */
  6495. ++ if (AR_SREV_9330(ah)) {
  6496. ++ for (i = 0; i < AR_NUM_QCU; i++) {
  6497. ++ if (ath9k_hw_numtxpending(ah, i))
  6498. ++ return true;
  6499. ++ }
  6500. + }
  6501. +
  6502. +- if (ah->external_reset &&
  6503. +- (npend || type == ATH9K_RESET_COLD)) {
  6504. +- int reset_err = 0;
  6505. ++ return false;
  6506. ++}
  6507. +
  6508. +- ath_dbg(ath9k_hw_common(ah), RESET,
  6509. +- "reset MAC via external reset\n");
  6510. ++static bool ath9k_hw_external_reset(struct ath_hw *ah, int type)
  6511. ++{
  6512. ++ int err;
  6513. +
  6514. +- reset_err = ah->external_reset();
  6515. +- if (reset_err) {
  6516. +- ath_err(ath9k_hw_common(ah),
  6517. +- "External reset failed, err=%d\n",
  6518. +- reset_err);
  6519. +- return false;
  6520. +- }
  6521. ++ if (!ah->external_reset || !ath9k_hw_need_external_reset(ah, type))
  6522. ++ return true;
  6523. +
  6524. +- REG_WRITE(ah, AR_RTC_RESET, 1);
  6525. ++ ath_dbg(ath9k_hw_common(ah), RESET,
  6526. ++ "reset MAC via external reset\n");
  6527. ++
  6528. ++ err = ah->external_reset();
  6529. ++ if (err) {
  6530. ++ ath_err(ath9k_hw_common(ah),
  6531. ++ "External reset failed, err=%d\n", err);
  6532. ++ return false;
  6533. ++ }
  6534. ++
  6535. ++ if (AR_SREV_9550(ah)) {
  6536. ++ REG_WRITE(ah, AR_RTC_RESET, 0);
  6537. ++ udelay(10);
  6538. + }
  6539. +
  6540. ++ REG_WRITE(ah, AR_RTC_RESET, 1);
  6541. ++ udelay(10);
  6542. ++
  6543. + return true;
  6544. + }
  6545. +
  6546. +@@ -1360,24 +1377,23 @@ static bool ath9k_hw_set_reset(struct at
  6547. + rst_flags |= AR_RTC_RC_MAC_COLD;
  6548. + }
  6549. +
  6550. +- if (AR_SREV_9330(ah)) {
  6551. +- if (!ath9k_hw_ar9330_reset_war(ah, type))
  6552. +- return false;
  6553. +- }
  6554. +-
  6555. + if (ath9k_hw_mci_is_enabled(ah))
  6556. + ar9003_mci_check_gpm_offset(ah);
  6557. +
  6558. + /* DMA HALT added to resolve ar9300 and ar9580 bus error during
  6559. +- * RTC_RC reg read
  6560. ++ * RTC_RC reg read. Also needed for AR9550 external reset
  6561. + */
  6562. +- if (AR_SREV_9300(ah) || AR_SREV_9580(ah)) {
  6563. ++ if (AR_SREV_9300(ah) || AR_SREV_9580(ah) || AR_SREV_9550(ah)) {
  6564. + REG_SET_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  6565. + ath9k_hw_wait(ah, AR_CFG, AR_CFG_HALT_ACK, AR_CFG_HALT_ACK,
  6566. + 20 * AH_WAIT_TIMEOUT);
  6567. +- REG_CLR_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  6568. + }
  6569. +
  6570. ++ ath9k_hw_external_reset(ah, type);
  6571. ++
  6572. ++ if (AR_SREV_9300(ah) || AR_SREV_9580(ah))
  6573. ++ REG_CLR_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  6574. ++
  6575. + REG_WRITE(ah, AR_RTC_RC, rst_flags);
  6576. +
  6577. + REGWRITE_BUFFER_FLUSH(ah);
  6578. 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
  6579. deleted file mode 100644
  6580. index e7bfb9c83dd406e41e523195fabd0a4611dc86b4..0000000000000000000000000000000000000000
  6581. --- a/package/kernel/mac80211/patches/322-mac80211-add-A-MSDU-tx-support.patch
  6582. +++ /dev/null
  6583. @@ -1,317 +0,0 @@
  6584. -From: Felix Fietkau <nbd@openwrt.org>
  6585. -Date: Fri, 5 Feb 2016 01:38:51 +0100
  6586. -Subject: [PATCH] mac80211: add A-MSDU tx support
  6587. -
  6588. -Requires software tx queueing support. frag_list support (for zero-copy)
  6589. -is optional.
  6590. -
  6591. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  6592. ----
  6593. -
  6594. ---- a/include/net/mac80211.h
  6595. -+++ b/include/net/mac80211.h
  6596. -@@ -709,6 +709,7 @@ enum mac80211_tx_info_flags {
  6597. - * @IEEE80211_TX_CTRL_PS_RESPONSE: This frame is a response to a poll
  6598. - * frame (PS-Poll or uAPSD).
  6599. - * @IEEE80211_TX_CTRL_RATE_INJECT: This frame is injected with rate information
  6600. -+ * @IEEE80211_TX_CTRL_AMSDU: This frame is an A-MSDU frame
  6601. - *
  6602. - * These flags are used in tx_info->control.flags.
  6603. - */
  6604. -@@ -716,6 +717,7 @@ enum mac80211_tx_control_flags {
  6605. - IEEE80211_TX_CTRL_PORT_CTRL_PROTO = BIT(0),
  6606. - IEEE80211_TX_CTRL_PS_RESPONSE = BIT(1),
  6607. - IEEE80211_TX_CTRL_RATE_INJECT = BIT(2),
  6608. -+ IEEE80211_TX_CTRL_AMSDU = BIT(3),
  6609. - };
  6610. -
  6611. - /*
  6612. -@@ -1728,6 +1730,7 @@ struct ieee80211_sta_rates {
  6613. - * size is min(max_amsdu_len, 7935) bytes.
  6614. - * Both additional HT limits must be enforced by the low level driver.
  6615. - * This is defined by the spec (IEEE 802.11-2012 section 8.3.2.2 NOTE 2).
  6616. -+ * @max_rc_amsdu_len: Maximum A-MSDU size in bytes recommended by rate control.
  6617. - * @txq: per-TID data TX queues (if driver uses the TXQ abstraction)
  6618. - */
  6619. - struct ieee80211_sta {
  6620. -@@ -1748,6 +1751,7 @@ struct ieee80211_sta {
  6621. - bool mfp;
  6622. - u8 max_amsdu_subframes;
  6623. - u16 max_amsdu_len;
  6624. -+ u16 max_rc_amsdu_len;
  6625. -
  6626. - struct ieee80211_txq *txq[IEEE80211_NUM_TIDS];
  6627. -
  6628. -@@ -1961,6 +1965,15 @@ struct ieee80211_txq {
  6629. - * order and does not need to manage its own reorder buffer or BA session
  6630. - * timeout.
  6631. - *
  6632. -+ * @IEEE80211_HW_TX_AMSDU: Hardware (or driver) supports software aggregated
  6633. -+ * A-MSDU frames. Requires software tx queueing and fast-xmit support.
  6634. -+ * When not using minstrel/minstrel_ht rate control, the driver should
  6635. -+ * limit the maximum A-MSDU size based on the current tx rate by setting
  6636. -+ * max_rc_amsdu_len in struct ieee80211_sta.
  6637. -+ *
  6638. -+ * @IEEE80211_HW_TX_FRAG_LIST: Hardware (or driver) supports sending frag_list
  6639. -+ * skbs, needed for zero-copy software A-MSDU.
  6640. -+ *
  6641. - * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
  6642. - */
  6643. - enum ieee80211_hw_flags {
  6644. -@@ -1998,6 +2011,8 @@ enum ieee80211_hw_flags {
  6645. - IEEE80211_HW_BEACON_TX_STATUS,
  6646. - IEEE80211_HW_NEEDS_UNIQUE_STA_ADDR,
  6647. - IEEE80211_HW_SUPPORTS_REORDERING_BUFFER,
  6648. -+ IEEE80211_HW_TX_AMSDU,
  6649. -+ IEEE80211_HW_TX_FRAG_LIST,
  6650. -
  6651. - /* keep last, obviously */
  6652. - NUM_IEEE80211_HW_FLAGS
  6653. -@@ -2070,6 +2085,9 @@ enum ieee80211_hw_flags {
  6654. - * size is smaller (an example is LinkSys WRT120N with FW v1.0.07
  6655. - * build 002 Jun 18 2012).
  6656. - *
  6657. -+ * @max_tx_fragments: maximum number of tx buffers per (A)-MSDU, sum
  6658. -+ * of 1 + skb_shinfo(skb)->nr_frags for each skb in the frag_list.
  6659. -+ *
  6660. - * @offchannel_tx_hw_queue: HW queue ID to use for offchannel TX
  6661. - * (if %IEEE80211_HW_QUEUE_CONTROL is set)
  6662. - *
  6663. -@@ -2124,6 +2142,7 @@ struct ieee80211_hw {
  6664. - u8 max_rate_tries;
  6665. - u8 max_rx_aggregation_subframes;
  6666. - u8 max_tx_aggregation_subframes;
  6667. -+ u8 max_tx_fragments;
  6668. - u8 offchannel_tx_hw_queue;
  6669. - u8 radiotap_mcs_details;
  6670. - u16 radiotap_vht_details;
  6671. ---- a/net/mac80211/agg-tx.c
  6672. -+++ b/net/mac80211/agg-tx.c
  6673. -@@ -935,6 +935,7 @@ void ieee80211_process_addba_resp(struct
  6674. - size_t len)
  6675. - {
  6676. - struct tid_ampdu_tx *tid_tx;
  6677. -+ struct ieee80211_txq *txq;
  6678. - u16 capab, tid;
  6679. - u8 buf_size;
  6680. - bool amsdu;
  6681. -@@ -945,6 +946,10 @@ void ieee80211_process_addba_resp(struct
  6682. - buf_size = (capab & IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK) >> 6;
  6683. - buf_size = min(buf_size, local->hw.max_tx_aggregation_subframes);
  6684. -
  6685. -+ txq = sta->sta.txq[tid];
  6686. -+ if (!amsdu && txq)
  6687. -+ set_bit(IEEE80211_TXQ_NO_AMSDU, &to_txq_info(txq)->flags);
  6688. -+
  6689. - mutex_lock(&sta->ampdu_mlme.mtx);
  6690. -
  6691. - tid_tx = rcu_dereference_protected_tid_tx(sta, tid);
  6692. ---- a/net/mac80211/debugfs.c
  6693. -+++ b/net/mac80211/debugfs.c
  6694. -@@ -127,6 +127,8 @@ static const char *hw_flag_names[NUM_IEE
  6695. - FLAG(BEACON_TX_STATUS),
  6696. - FLAG(NEEDS_UNIQUE_STA_ADDR),
  6697. - FLAG(SUPPORTS_REORDERING_BUFFER),
  6698. -+ FLAG(TX_AMSDU),
  6699. -+ FLAG(TX_FRAG_LIST),
  6700. -
  6701. - /* keep last for the build bug below */
  6702. - (void *)0x1
  6703. ---- a/net/mac80211/ieee80211_i.h
  6704. -+++ b/net/mac80211/ieee80211_i.h
  6705. -@@ -799,6 +799,7 @@ struct mac80211_qos_map {
  6706. - enum txq_info_flags {
  6707. - IEEE80211_TXQ_STOP,
  6708. - IEEE80211_TXQ_AMPDU,
  6709. -+ IEEE80211_TXQ_NO_AMSDU,
  6710. - };
  6711. -
  6712. - struct txq_info {
  6713. ---- a/net/mac80211/tx.c
  6714. -+++ b/net/mac80211/tx.c
  6715. -@@ -1318,6 +1318,10 @@ struct sk_buff *ieee80211_tx_dequeue(str
  6716. - out:
  6717. - spin_unlock_bh(&txqi->queue.lock);
  6718. -
  6719. -+ if (skb && skb_has_frag_list(skb) &&
  6720. -+ !ieee80211_hw_check(&local->hw, TX_FRAG_LIST))
  6721. -+ skb_linearize(skb);
  6722. -+
  6723. - return skb;
  6724. - }
  6725. - EXPORT_SYMBOL(ieee80211_tx_dequeue);
  6726. -@@ -2757,6 +2761,163 @@ void ieee80211_clear_fast_xmit(struct st
  6727. - kfree_rcu(fast_tx, rcu_head);
  6728. - }
  6729. -
  6730. -+static bool ieee80211_amsdu_realloc_pad(struct ieee80211_local *local,
  6731. -+ struct sk_buff *skb, int headroom,
  6732. -+ int *subframe_len)
  6733. -+{
  6734. -+ int amsdu_len = *subframe_len + sizeof(struct ethhdr);
  6735. -+ int padding = (4 - amsdu_len) & 3;
  6736. -+
  6737. -+ if (skb_headroom(skb) < headroom || skb_tailroom(skb) < padding) {
  6738. -+ I802_DEBUG_INC(local->tx_expand_skb_head);
  6739. -+
  6740. -+ if (pskb_expand_head(skb, headroom, padding, GFP_ATOMIC)) {
  6741. -+ wiphy_debug(local->hw.wiphy,
  6742. -+ "failed to reallocate TX buffer\n");
  6743. -+ return false;
  6744. -+ }
  6745. -+ }
  6746. -+
  6747. -+ if (padding) {
  6748. -+ *subframe_len += padding;
  6749. -+ memset(skb_put(skb, padding), 0, padding);
  6750. -+ }
  6751. -+
  6752. -+ return true;
  6753. -+}
  6754. -+
  6755. -+static bool ieee80211_amsdu_prepare_head(struct ieee80211_sub_if_data *sdata,
  6756. -+ struct ieee80211_fast_tx *fast_tx,
  6757. -+ struct sk_buff *skb)
  6758. -+{
  6759. -+ struct ieee80211_local *local = sdata->local;
  6760. -+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  6761. -+ struct ieee80211_hdr *hdr;
  6762. -+ struct ethhdr amsdu_hdr;
  6763. -+ int hdr_len = fast_tx->hdr_len - sizeof(rfc1042_header);
  6764. -+ int subframe_len = skb->len - hdr_len;
  6765. -+ void *data;
  6766. -+ u8 *qc;
  6767. -+
  6768. -+ if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE)
  6769. -+ return false;
  6770. -+
  6771. -+ if (info->control.flags & IEEE80211_TX_CTRL_AMSDU)
  6772. -+ return true;
  6773. -+
  6774. -+ if (!ieee80211_amsdu_realloc_pad(local, skb, sizeof(amsdu_hdr),
  6775. -+ &subframe_len))
  6776. -+ return false;
  6777. -+
  6778. -+ amsdu_hdr.h_proto = cpu_to_be16(subframe_len);
  6779. -+ memcpy(amsdu_hdr.h_source, skb->data + fast_tx->sa_offs, ETH_ALEN);
  6780. -+ memcpy(amsdu_hdr.h_dest, skb->data + fast_tx->da_offs, ETH_ALEN);
  6781. -+
  6782. -+ data = skb_push(skb, sizeof(amsdu_hdr));
  6783. -+ memmove(data, data + sizeof(amsdu_hdr), hdr_len);
  6784. -+ memcpy(data + hdr_len, &amsdu_hdr, sizeof(amsdu_hdr));
  6785. -+
  6786. -+ hdr = data;
  6787. -+ qc = ieee80211_get_qos_ctl(hdr);
  6788. -+ *qc |= IEEE80211_QOS_CTL_A_MSDU_PRESENT;
  6789. -+
  6790. -+ info->control.flags |= IEEE80211_TX_CTRL_AMSDU;
  6791. -+
  6792. -+ return true;
  6793. -+}
  6794. -+
  6795. -+static bool ieee80211_amsdu_aggregate(struct ieee80211_sub_if_data *sdata,
  6796. -+ struct sta_info *sta,
  6797. -+ struct ieee80211_fast_tx *fast_tx,
  6798. -+ struct sk_buff *skb)
  6799. -+{
  6800. -+ struct ieee80211_local *local = sdata->local;
  6801. -+ u8 tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK;
  6802. -+ struct ieee80211_txq *txq = sta->sta.txq[tid];
  6803. -+ struct txq_info *txqi;
  6804. -+ struct sk_buff **frag_tail, *head;
  6805. -+ int subframe_len = skb->len - ETH_ALEN;
  6806. -+ u8 max_subframes = sta->sta.max_amsdu_subframes;
  6807. -+ int max_frags = local->hw.max_tx_fragments;
  6808. -+ int max_amsdu_len = sta->sta.max_amsdu_len;
  6809. -+ __be16 len;
  6810. -+ void *data;
  6811. -+ bool ret = false;
  6812. -+ int n = 1, nfrags;
  6813. -+
  6814. -+ if (!ieee80211_hw_check(&local->hw, TX_AMSDU))
  6815. -+ return false;
  6816. -+
  6817. -+ if (!txq)
  6818. -+ return false;
  6819. -+
  6820. -+ txqi = to_txq_info(txq);
  6821. -+ if (test_bit(IEEE80211_TXQ_NO_AMSDU, &txqi->flags))
  6822. -+ return false;
  6823. -+
  6824. -+ if (sta->sta.max_rc_amsdu_len)
  6825. -+ max_amsdu_len = min_t(int, max_amsdu_len,
  6826. -+ sta->sta.max_rc_amsdu_len);
  6827. -+
  6828. -+ spin_lock_bh(&txqi->queue.lock);
  6829. -+
  6830. -+ head = skb_peek_tail(&txqi->queue);
  6831. -+ if (!head)
  6832. -+ goto out;
  6833. -+
  6834. -+ if (skb->len + head->len > max_amsdu_len)
  6835. -+ goto out;
  6836. -+
  6837. -+ /*
  6838. -+ * HT A-MPDU limits maximum MPDU size to 4095 bytes. Since aggregation
  6839. -+ * sessions are started/stopped without txq flush, use the limit here
  6840. -+ * to avoid having to de-aggregate later.
  6841. -+ */
  6842. -+ if (skb->len + head->len > 4095 &&
  6843. -+ !sta->sta.vht_cap.vht_supported)
  6844. -+ goto out;
  6845. -+
  6846. -+ if (!ieee80211_amsdu_prepare_head(sdata, fast_tx, head))
  6847. -+ goto out;
  6848. -+
  6849. -+ nfrags = 1 + skb_shinfo(skb)->nr_frags;
  6850. -+ nfrags += 1 + skb_shinfo(head)->nr_frags;
  6851. -+ frag_tail = &skb_shinfo(head)->frag_list;
  6852. -+ while (*frag_tail) {
  6853. -+ nfrags += 1 + skb_shinfo(*frag_tail)->nr_frags;
  6854. -+ frag_tail = &(*frag_tail)->next;
  6855. -+ n++;
  6856. -+ }
  6857. -+
  6858. -+ if (max_subframes && n > max_subframes)
  6859. -+ goto out;
  6860. -+
  6861. -+ if (max_frags && nfrags > max_frags)
  6862. -+ goto out;
  6863. -+
  6864. -+ if (!ieee80211_amsdu_realloc_pad(local, skb, sizeof(rfc1042_header) + 2,
  6865. -+ &subframe_len))
  6866. -+ return false;
  6867. -+
  6868. -+ ret = true;
  6869. -+ data = skb_push(skb, ETH_ALEN + 2);
  6870. -+ memmove(data, data + ETH_ALEN + 2, 2 * ETH_ALEN);
  6871. -+
  6872. -+ data += 2 * ETH_ALEN;
  6873. -+ len = cpu_to_be16(subframe_len);
  6874. -+ memcpy(data, &len, 2);
  6875. -+ memcpy(data + 2, rfc1042_header, sizeof(rfc1042_header));
  6876. -+
  6877. -+ head->len += skb->len;
  6878. -+ head->data_len += skb->len;
  6879. -+ *frag_tail = skb;
  6880. -+
  6881. -+out:
  6882. -+ spin_unlock_bh(&txqi->queue.lock);
  6883. -+
  6884. -+ return ret;
  6885. -+}
  6886. -+
  6887. - static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata,
  6888. - struct net_device *dev, struct sta_info *sta,
  6889. - struct ieee80211_fast_tx *fast_tx,
  6890. -@@ -2811,6 +2972,10 @@ static bool ieee80211_xmit_fast(struct i
  6891. -
  6892. - ieee80211_tx_stats(dev, skb->len + extra_head);
  6893. -
  6894. -+ if ((hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) &&
  6895. -+ ieee80211_amsdu_aggregate(sdata, sta, fast_tx, skb))
  6896. -+ return true;
  6897. -+
  6898. - /* will not be crypto-handled beyond what we do here, so use false
  6899. - * as the may-encrypt argument for the resize to not account for
  6900. - * more room than we already have in 'extra_head'
  6901. 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
  6902. deleted file mode 100644
  6903. index 9277b2cabcdf6a02fa285b7eef2391b7f575869a..0000000000000000000000000000000000000000
  6904. --- a/package/kernel/mac80211/patches/323-0000-brcmfmac-fix-setting-primary-channel-for-80-MHz-widt.patch
  6905. +++ /dev/null
  6906. @@ -1,64 +0,0 @@
  6907. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  6908. -Date: Wed, 20 Jan 2016 16:46:04 +0100
  6909. -Subject: [PATCH] brcmfmac: fix setting primary channel for 80 MHz width
  6910. -MIME-Version: 1.0
  6911. -Content-Type: text/plain; charset=UTF-8
  6912. -Content-Transfer-Encoding: 8bit
  6913. -
  6914. -First of all it changes the way we calculate primary channel offset. If
  6915. -we use e.g. 80 MHz channel with primary frequency 5180 MHz (which means
  6916. -center frequency is 5210 MHz) it makes sense to calculate primary offset
  6917. -as -30 MHz.
  6918. -Then it fixes values we compare primary_offset with. We were comparing
  6919. -offset in MHz against -2 or 2 which was resulting in picking a wrong
  6920. -primary channel.
  6921. -
  6922. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  6923. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6924. ----
  6925. -
  6926. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  6927. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  6928. -@@ -247,7 +247,7 @@ static u16 chandef_to_chanspec(struct br
  6929. - brcmf_dbg(TRACE, "chandef: control %d center %d width %d\n",
  6930. - ch->chan->center_freq, ch->center_freq1, ch->width);
  6931. - ch_inf.chnum = ieee80211_frequency_to_channel(ch->center_freq1);
  6932. -- primary_offset = ch->center_freq1 - ch->chan->center_freq;
  6933. -+ primary_offset = ch->chan->center_freq - ch->center_freq1;
  6934. - switch (ch->width) {
  6935. - case NL80211_CHAN_WIDTH_20:
  6936. - case NL80211_CHAN_WIDTH_20_NOHT:
  6937. -@@ -256,24 +256,21 @@ static u16 chandef_to_chanspec(struct br
  6938. - break;
  6939. - case NL80211_CHAN_WIDTH_40:
  6940. - ch_inf.bw = BRCMU_CHAN_BW_40;
  6941. -- if (primary_offset < 0)
  6942. -+ if (primary_offset > 0)
  6943. - ch_inf.sb = BRCMU_CHAN_SB_U;
  6944. - else
  6945. - ch_inf.sb = BRCMU_CHAN_SB_L;
  6946. - break;
  6947. - case NL80211_CHAN_WIDTH_80:
  6948. - ch_inf.bw = BRCMU_CHAN_BW_80;
  6949. -- if (primary_offset < 0) {
  6950. -- if (primary_offset < -CH_10MHZ_APART)
  6951. -- ch_inf.sb = BRCMU_CHAN_SB_UU;
  6952. -- else
  6953. -- ch_inf.sb = BRCMU_CHAN_SB_UL;
  6954. -- } else {
  6955. -- if (primary_offset > CH_10MHZ_APART)
  6956. -- ch_inf.sb = BRCMU_CHAN_SB_LL;
  6957. -- else
  6958. -- ch_inf.sb = BRCMU_CHAN_SB_LU;
  6959. -- }
  6960. -+ if (primary_offset == -30)
  6961. -+ ch_inf.sb = BRCMU_CHAN_SB_LL;
  6962. -+ else if (primary_offset == -10)
  6963. -+ ch_inf.sb = BRCMU_CHAN_SB_LU;
  6964. -+ else if (primary_offset == 10)
  6965. -+ ch_inf.sb = BRCMU_CHAN_SB_UL;
  6966. -+ else
  6967. -+ ch_inf.sb = BRCMU_CHAN_SB_UU;
  6968. - break;
  6969. - case NL80211_CHAN_WIDTH_80P80:
  6970. - case NL80211_CHAN_WIDTH_160:
  6971. 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
  6972. deleted file mode 100644
  6973. index d7018dab3d230ab2e342824ff5067d0a24b586a1..0000000000000000000000000000000000000000
  6974. --- a/package/kernel/mac80211/patches/323-0001-brcmfmac-analyze-descriptors-of-current-component-on.patch
  6975. +++ /dev/null
  6976. @@ -1,51 +0,0 @@
  6977. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  6978. -Date: Tue, 26 Jan 2016 17:57:01 +0100
  6979. -Subject: [PATCH] brcmfmac: analyze descriptors of current component only
  6980. -MIME-Version: 1.0
  6981. -Content-Type: text/plain; charset=UTF-8
  6982. -Content-Transfer-Encoding: 8bit
  6983. -
  6984. -So far we were looking for address descriptors without a check for
  6985. -crossing current component border. In case of dealing with unsupported
  6986. -descriptor or descriptor missing at all the code would incorrectly get
  6987. -data from another component.
  6988. -
  6989. -Consider this binary-described component from BCM4366 EROM:
  6990. -4bf83b01 TAG==CI CID==0x83b
  6991. -20080201 TAG==CI PORTS==0+1 WRAPPERS==0+1
  6992. -18400035 TAG==ADDR SZ_SZD TYPE_SLAVE
  6993. -00050000
  6994. -18107085 TAG==ADDR SZ_4K TYPE_SWRAP
  6995. -
  6996. -Driver was assigning invalid base address to this core:
  6997. -brcmfmac: [6 ] core 0x83b:32 base 0x18109000 wrap 0x18107000
  6998. -which came from totally different component defined in EROM:
  6999. -43b36701 TAG==CI CID==0x367
  7000. -00000201 TAG==CI PORTS==0+1 WRAPPERS==0+0
  7001. -18109005 TAG==ADDR SZ_4K TYPE_SLAVE
  7002. -
  7003. -This change will also allow us to support components without wrapper
  7004. -address in the future.
  7005. -
  7006. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  7007. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  7008. ----
  7009. -
  7010. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  7011. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  7012. -@@ -803,7 +803,14 @@ static int brcmf_chip_dmp_get_regaddr(st
  7013. - *eromaddr -= 4;
  7014. - return -EFAULT;
  7015. - }
  7016. -- } while (desc != DMP_DESC_ADDRESS);
  7017. -+ } while (desc != DMP_DESC_ADDRESS &&
  7018. -+ desc != DMP_DESC_COMPONENT);
  7019. -+
  7020. -+ /* stop if we crossed current component border */
  7021. -+ if (desc == DMP_DESC_COMPONENT) {
  7022. -+ *eromaddr -= 4;
  7023. -+ return 0;
  7024. -+ }
  7025. -
  7026. - /* skip upper 32-bit address descriptor */
  7027. - if (val & DMP_DESC_ADDRSIZE_GT32)
  7028. 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
  7029. deleted file mode 100644
  7030. index 045ab4953bb9a43044435baa8e242b3f4794952a..0000000000000000000000000000000000000000
  7031. --- a/package/kernel/mac80211/patches/323-0002-brcmfmac-allow-storing-PMU-core-without-wrapper-addr.patch
  7032. +++ /dev/null
  7033. @@ -1,28 +0,0 @@
  7034. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  7035. -Date: Tue, 26 Jan 2016 17:57:02 +0100
  7036. -Subject: [PATCH] brcmfmac: allow storing PMU core without wrapper address
  7037. -MIME-Version: 1.0
  7038. -Content-Type: text/plain; charset=UTF-8
  7039. -Content-Transfer-Encoding: 8bit
  7040. -
  7041. -Separated PMU core can be found in new devices and should be used for
  7042. -accessing PMU registers (which were routed through ChipCommon so far).
  7043. -This core is one of exceptions that doesn't have or need wrapper address
  7044. -to be still safely accessible.
  7045. -
  7046. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  7047. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  7048. ----
  7049. -
  7050. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  7051. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  7052. -@@ -883,7 +883,8 @@ int brcmf_chip_dmp_erom_scan(struct brcm
  7053. - rev = (val & DMP_COMP_REVISION) >> DMP_COMP_REVISION_S;
  7054. -
  7055. - /* need core with ports */
  7056. -- if (nmw + nsw == 0)
  7057. -+ if (nmw + nsw == 0 &&
  7058. -+ id != BCMA_CORE_PMU)
  7059. - continue;
  7060. -
  7061. - /* try to obtain register address info */
  7062. 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
  7063. deleted file mode 100644
  7064. index 7b7ba4f743b244c0d766efbce7045e00e13e27ed..0000000000000000000000000000000000000000
  7065. --- a/package/kernel/mac80211/patches/323-0003-brcmfmac-read-extended-capabilities-of-ChipCommon-co.patch
  7066. +++ /dev/null
  7067. @@ -1,43 +0,0 @@
  7068. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  7069. -Date: Tue, 26 Jan 2016 17:57:03 +0100
  7070. -Subject: [PATCH] brcmfmac: read extended capabilities of ChipCommon core
  7071. -MIME-Version: 1.0
  7072. -Content-Type: text/plain; charset=UTF-8
  7073. -Content-Transfer-Encoding: 8bit
  7074. -
  7075. -This is an extra bitfield with info about some present hardware.
  7076. -
  7077. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  7078. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  7079. ----
  7080. -
  7081. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  7082. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  7083. -@@ -1025,6 +1025,9 @@ static int brcmf_chip_setup(struct brcmf
  7084. - /* get chipcommon capabilites */
  7085. - pub->cc_caps = chip->ops->read32(chip->ctx,
  7086. - CORE_CC_REG(base, capabilities));
  7087. -+ pub->cc_caps_ext = chip->ops->read32(chip->ctx,
  7088. -+ CORE_CC_REG(base,
  7089. -+ capabilities_ext));
  7090. -
  7091. - /* get pmu caps & rev */
  7092. - if (pub->cc_caps & CC_CAP_PMU) {
  7093. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
  7094. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
  7095. -@@ -27,6 +27,7 @@
  7096. - * @chip: chip identifier.
  7097. - * @chiprev: chip revision.
  7098. - * @cc_caps: chipcommon core capabilities.
  7099. -+ * @cc_caps_ext: chipcommon core extended capabilities.
  7100. - * @pmucaps: PMU capabilities.
  7101. - * @pmurev: PMU revision.
  7102. - * @rambase: RAM base address (only applicable for ARM CR4 chips).
  7103. -@@ -38,6 +39,7 @@ struct brcmf_chip {
  7104. - u32 chip;
  7105. - u32 chiprev;
  7106. - u32 cc_caps;
  7107. -+ u32 cc_caps_ext;
  7108. - u32 pmucaps;
  7109. - u32 pmurev;
  7110. - u32 rambase;
  7111. 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
  7112. deleted file mode 100644
  7113. index 2af6fd93bc06142b459144caf49489d51f7f6304..0000000000000000000000000000000000000000
  7114. --- a/package/kernel/mac80211/patches/323-0004-brcmfmac-access-PMU-registers-using-standalone-PMU-c.patch
  7115. +++ /dev/null
  7116. @@ -1,148 +0,0 @@
  7117. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  7118. -Date: Tue, 26 Jan 2016 17:57:04 +0100
  7119. -Subject: [PATCH] brcmfmac: access PMU registers using standalone PMU core if
  7120. - available
  7121. -MIME-Version: 1.0
  7122. -Content-Type: text/plain; charset=UTF-8
  7123. -Content-Transfer-Encoding: 8bit
  7124. -
  7125. -On recent Broadcom chipsets PMU is present as separated core and it
  7126. -can't be accessed using ChipCommon anymore as it fails with e.g.:
  7127. -[ 18.198412] Unhandled fault: imprecise external abort (0x1406) at 0xb6da200f
  7128. -
  7129. -Add a new helper function that will return a proper core that should be
  7130. -used for accessing PMU registers.
  7131. -
  7132. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  7133. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  7134. ----
  7135. -
  7136. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  7137. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  7138. -@@ -1014,6 +1014,7 @@ static int brcmf_chip_setup(struct brcmf
  7139. - {
  7140. - struct brcmf_chip *pub;
  7141. - struct brcmf_core_priv *cc;
  7142. -+ struct brcmf_core *pmu;
  7143. - u32 base;
  7144. - u32 val;
  7145. - int ret = 0;
  7146. -@@ -1030,9 +1031,10 @@ static int brcmf_chip_setup(struct brcmf
  7147. - capabilities_ext));
  7148. -
  7149. - /* get pmu caps & rev */
  7150. -+ pmu = brcmf_chip_get_pmu(pub); /* after reading cc_caps_ext */
  7151. - if (pub->cc_caps & CC_CAP_PMU) {
  7152. - val = chip->ops->read32(chip->ctx,
  7153. -- CORE_CC_REG(base, pmucapabilities));
  7154. -+ CORE_CC_REG(pmu->base, pmucapabilities));
  7155. - pub->pmurev = val & PCAP_REV_MASK;
  7156. - pub->pmucaps = val;
  7157. - }
  7158. -@@ -1131,6 +1133,23 @@ struct brcmf_core *brcmf_chip_get_chipco
  7159. - return &cc->pub;
  7160. - }
  7161. -
  7162. -+struct brcmf_core *brcmf_chip_get_pmu(struct brcmf_chip *pub)
  7163. -+{
  7164. -+ struct brcmf_core *cc = brcmf_chip_get_chipcommon(pub);
  7165. -+ struct brcmf_core *pmu;
  7166. -+
  7167. -+ /* See if there is separated PMU core available */
  7168. -+ if (cc->rev >= 35 &&
  7169. -+ pub->cc_caps_ext & BCMA_CC_CAP_EXT_AOB_PRESENT) {
  7170. -+ pmu = brcmf_chip_get_core(pub, BCMA_CORE_PMU);
  7171. -+ if (pmu)
  7172. -+ return pmu;
  7173. -+ }
  7174. -+
  7175. -+ /* Fallback to ChipCommon core for older hardware */
  7176. -+ return cc;
  7177. -+}
  7178. -+
  7179. - bool brcmf_chip_iscoreup(struct brcmf_core *pub)
  7180. - {
  7181. - struct brcmf_core_priv *core;
  7182. -@@ -1301,6 +1320,7 @@ bool brcmf_chip_sr_capable(struct brcmf_
  7183. - {
  7184. - u32 base, addr, reg, pmu_cc3_mask = ~0;
  7185. - struct brcmf_chip_priv *chip;
  7186. -+ struct brcmf_core *pmu = brcmf_chip_get_pmu(pub);
  7187. -
  7188. - brcmf_dbg(TRACE, "Enter\n");
  7189. -
  7190. -@@ -1320,9 +1340,9 @@ bool brcmf_chip_sr_capable(struct brcmf_
  7191. - case BRCM_CC_4335_CHIP_ID:
  7192. - case BRCM_CC_4339_CHIP_ID:
  7193. - /* read PMU chipcontrol register 3 */
  7194. -- addr = CORE_CC_REG(base, chipcontrol_addr);
  7195. -+ addr = CORE_CC_REG(pmu->base, chipcontrol_addr);
  7196. - chip->ops->write32(chip->ctx, addr, 3);
  7197. -- addr = CORE_CC_REG(base, chipcontrol_data);
  7198. -+ addr = CORE_CC_REG(pmu->base, chipcontrol_data);
  7199. - reg = chip->ops->read32(chip->ctx, addr);
  7200. - return (reg & pmu_cc3_mask) != 0;
  7201. - case BRCM_CC_43430_CHIP_ID:
  7202. -@@ -1330,12 +1350,12 @@ bool brcmf_chip_sr_capable(struct brcmf_
  7203. - reg = chip->ops->read32(chip->ctx, addr);
  7204. - return reg != 0;
  7205. - default:
  7206. -- addr = CORE_CC_REG(base, pmucapabilities_ext);
  7207. -+ addr = CORE_CC_REG(pmu->base, pmucapabilities_ext);
  7208. - reg = chip->ops->read32(chip->ctx, addr);
  7209. - if ((reg & PCAPEXT_SR_SUPPORTED_MASK) == 0)
  7210. - return false;
  7211. -
  7212. -- addr = CORE_CC_REG(base, retention_ctl);
  7213. -+ addr = CORE_CC_REG(pmu->base, retention_ctl);
  7214. - reg = chip->ops->read32(chip->ctx, addr);
  7215. - return (reg & (PMU_RCTL_MACPHY_DISABLE_MASK |
  7216. - PMU_RCTL_LOGIC_DISABLE_MASK)) == 0;
  7217. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
  7218. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
  7219. -@@ -85,6 +85,7 @@ struct brcmf_chip *brcmf_chip_attach(voi
  7220. - void brcmf_chip_detach(struct brcmf_chip *chip);
  7221. - struct brcmf_core *brcmf_chip_get_core(struct brcmf_chip *chip, u16 coreid);
  7222. - struct brcmf_core *brcmf_chip_get_chipcommon(struct brcmf_chip *chip);
  7223. -+struct brcmf_core *brcmf_chip_get_pmu(struct brcmf_chip *pub);
  7224. - bool brcmf_chip_iscoreup(struct brcmf_core *core);
  7225. - void brcmf_chip_coredisable(struct brcmf_core *core, u32 prereset, u32 reset);
  7226. - void brcmf_chip_resetcore(struct brcmf_core *core, u32 prereset, u32 reset,
  7227. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  7228. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  7229. -@@ -3615,7 +3615,6 @@ brcmf_sdio_drivestrengthinit(struct brcm
  7230. - const struct sdiod_drive_str *str_tab = NULL;
  7231. - u32 str_mask;
  7232. - u32 str_shift;
  7233. -- u32 base;
  7234. - u32 i;
  7235. - u32 drivestrength_sel = 0;
  7236. - u32 cc_data_temp;
  7237. -@@ -3658,14 +3657,15 @@ brcmf_sdio_drivestrengthinit(struct brcm
  7238. - }
  7239. -
  7240. - if (str_tab != NULL) {
  7241. -+ struct brcmf_core *pmu = brcmf_chip_get_pmu(ci);
  7242. -+
  7243. - for (i = 0; str_tab[i].strength != 0; i++) {
  7244. - if (drivestrength >= str_tab[i].strength) {
  7245. - drivestrength_sel = str_tab[i].sel;
  7246. - break;
  7247. - }
  7248. - }
  7249. -- base = brcmf_chip_get_chipcommon(ci)->base;
  7250. -- addr = CORE_CC_REG(base, chipcontrol_addr);
  7251. -+ addr = CORE_CC_REG(pmu->base, chipcontrol_addr);
  7252. - brcmf_sdiod_regwl(sdiodev, addr, 1, NULL);
  7253. - cc_data_temp = brcmf_sdiod_regrl(sdiodev, addr, NULL);
  7254. - cc_data_temp &= ~str_mask;
  7255. -@@ -3835,8 +3835,7 @@ brcmf_sdio_probe_attach(struct brcmf_sdi
  7256. - goto fail;
  7257. -
  7258. - /* set PMUControl so a backplane reset does PMU state reload */
  7259. -- reg_addr = CORE_CC_REG(brcmf_chip_get_chipcommon(bus->ci)->base,
  7260. -- pmucontrol);
  7261. -+ reg_addr = CORE_CC_REG(brcmf_chip_get_pmu(bus->ci)->base, pmucontrol);
  7262. - reg_val = brcmf_sdiod_regrl(bus->sdiodev, reg_addr, &err);
  7263. - if (err)
  7264. - goto fail;
  7265. 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
  7266. deleted file mode 100644
  7267. index 35887fcb59219270e0aedd6c9466956f9ba318f4..0000000000000000000000000000000000000000
  7268. --- a/package/kernel/mac80211/patches/323-0005-brcmfmac-add-support-for-14e4-4365-PCI-ID-with-BCM43.patch
  7269. +++ /dev/null
  7270. @@ -1,38 +0,0 @@
  7271. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  7272. -Date: Tue, 26 Jan 2016 17:57:05 +0100
  7273. -Subject: [PATCH] brcmfmac: add support for 14e4:4365 PCI ID with BCM4366
  7274. - chipset
  7275. -MIME-Version: 1.0
  7276. -Content-Type: text/plain; charset=UTF-8
  7277. -Content-Transfer-Encoding: 8bit
  7278. -
  7279. -On Broadcom ARM routers BCM4366 cards are available with 14e4:4365 ID.
  7280. -Unfortunately this ID was already used by Broadcom for cards with
  7281. -BCM43142, a totally different chipset requiring SoftMAC driver. To avoid
  7282. -a conflict between brcmfmac and bcma use more specific ID entry with
  7283. -subvendor and subdevice specified.
  7284. -
  7285. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  7286. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  7287. ----
  7288. -
  7289. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  7290. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  7291. -@@ -1951,6 +1951,9 @@ static const struct dev_pm_ops brcmf_pci
  7292. -
  7293. - #define BRCMF_PCIE_DEVICE(dev_id) { BRCM_PCIE_VENDOR_ID_BROADCOM, dev_id,\
  7294. - PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_NETWORK_OTHER << 8, 0xffff00, 0 }
  7295. -+#define BRCMF_PCIE_DEVICE_SUB(dev_id, subvend, subdev) { \
  7296. -+ BRCM_PCIE_VENDOR_ID_BROADCOM, dev_id,\
  7297. -+ subvend, subdev, PCI_CLASS_NETWORK_OTHER << 8, 0xffff00, 0 }
  7298. -
  7299. - static struct pci_device_id brcmf_pcie_devid_table[] = {
  7300. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4350_DEVICE_ID),
  7301. -@@ -1966,6 +1969,7 @@ static struct pci_device_id brcmf_pcie_d
  7302. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_DEVICE_ID),
  7303. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_2G_DEVICE_ID),
  7304. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_5G_DEVICE_ID),
  7305. -+ BRCMF_PCIE_DEVICE_SUB(0x4365, BRCM_PCIE_VENDOR_ID_BROADCOM, 0x4365),
  7306. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_DEVICE_ID),
  7307. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_2G_DEVICE_ID),
  7308. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_5G_DEVICE_ID),
  7309. 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
  7310. new file mode 100644
  7311. index 0000000000000000000000000000000000000000..59ac29b1cfd6fa5d6f6cbab595ca0da1508fd077
  7312. --- /dev/null
  7313. +++ b/package/kernel/mac80211/patches/323-ath9k-Fix-programming-of-minCCA-power-threshold.patch
  7314. @@ -0,0 +1,26 @@
  7315. +From: Sven Eckelmann <sven@narfation.org>
  7316. +Date: Fri, 17 Jun 2016 11:58:20 +0200
  7317. +Subject: [PATCH] ath9k: Fix programming of minCCA power threshold
  7318. +
  7319. +The function ar9003_hw_apply_minccapwr_thresh takes as second parameter not
  7320. +a pointer to the channel but a boolean value describing whether the channel
  7321. +is 2.4GHz or not. This broke (according to the origin commit) the ETSI
  7322. +regulatory compliance on 5GHz channels.
  7323. +
  7324. +Fixes: 3533bf6b15a0 ("ath9k: Fix regulatory compliance")
  7325. +Signed-off-by: Sven Eckelmann <sven@narfation.org>
  7326. +Cc: Simon Wunderlich <sw@simonwunderlich.de>
  7327. +Cc: Sujith Manoharan <c_manoha@qca.qualcomm.com>
  7328. +---
  7329. +
  7330. +--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
  7331. ++++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
  7332. +@@ -4175,7 +4175,7 @@ static void ath9k_hw_ar9300_set_board_va
  7333. + if (!AR_SREV_9330(ah) && !AR_SREV_9340(ah) && !AR_SREV_9531(ah))
  7334. + ar9003_hw_internal_regulator_apply(ah);
  7335. + ar9003_hw_apply_tuning_caps(ah);
  7336. +- ar9003_hw_apply_minccapwr_thresh(ah, chan);
  7337. ++ ar9003_hw_apply_minccapwr_thresh(ah, is2ghz);
  7338. + ar9003_hw_txend_to_xpa_off_apply(ah, is2ghz);
  7339. + ar9003_hw_thermometer_apply(ah);
  7340. + ar9003_hw_thermo_cal_apply(ah);
  7341. 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
  7342. new file mode 100644
  7343. index 0000000000000000000000000000000000000000..b6f48680b7b1e2522c53c51834a8ec32638a3dec
  7344. --- /dev/null
  7345. +++ b/package/kernel/mac80211/patches/324-ath9k_hw-fix-spectral-scan-on-AR9285-and-newer.patch
  7346. @@ -0,0 +1,86 @@
  7347. +From: Felix Fietkau <nbd@nbd.name>
  7348. +Date: Mon, 11 Jul 2016 10:34:37 +0200
  7349. +Subject: [PATCH] ath9k_hw: fix spectral scan on AR9285 and newer
  7350. +
  7351. +The register layout of AR_PHY_SPECTRAL_SCAN has changed, only AR9280
  7352. +uses the old layout
  7353. +
  7354. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  7355. +---
  7356. +
  7357. +--- a/drivers/net/wireless/ath/ath9k/ar9002_phy.c
  7358. ++++ b/drivers/net/wireless/ath/ath9k/ar9002_phy.c
  7359. +@@ -476,6 +476,7 @@ static void ar9002_hw_set_bt_ant_diversi
  7360. + static void ar9002_hw_spectral_scan_config(struct ath_hw *ah,
  7361. + struct ath_spec_scan *param)
  7362. + {
  7363. ++ u32 repeat_bit;
  7364. + u8 count;
  7365. +
  7366. + if (!param->enabled) {
  7367. +@@ -486,12 +487,15 @@ static void ar9002_hw_spectral_scan_conf
  7368. + REG_SET_BIT(ah, AR_PHY_RADAR_0, AR_PHY_RADAR_0_FFT_ENA);
  7369. + REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN, AR_PHY_SPECTRAL_SCAN_ENABLE);
  7370. +
  7371. ++ if (AR_SREV_9280(ah))
  7372. ++ repeat_bit = AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT;
  7373. ++ else
  7374. ++ repeat_bit = AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_KIWI;
  7375. ++
  7376. + if (param->short_repeat)
  7377. +- REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN,
  7378. +- AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT);
  7379. ++ REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN, repeat_bit);
  7380. + else
  7381. +- REG_CLR_BIT(ah, AR_PHY_SPECTRAL_SCAN,
  7382. +- AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT);
  7383. ++ REG_CLR_BIT(ah, AR_PHY_SPECTRAL_SCAN, repeat_bit);
  7384. +
  7385. + /* on AR92xx, the highest bit of count will make the the chip send
  7386. + * spectral samples endlessly. Check if this really was intended,
  7387. +@@ -499,15 +503,25 @@ static void ar9002_hw_spectral_scan_conf
  7388. + */
  7389. + count = param->count;
  7390. + if (param->endless) {
  7391. +- if (AR_SREV_9271(ah))
  7392. +- count = 0;
  7393. +- else
  7394. ++ if (AR_SREV_9280(ah))
  7395. + count = 0x80;
  7396. ++ else
  7397. ++ count = 0;
  7398. + } else if (count & 0x80)
  7399. + count = 0x7f;
  7400. ++ else if (!count)
  7401. ++ count = 1;
  7402. ++
  7403. ++ if (AR_SREV_9280(ah)) {
  7404. ++ REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN,
  7405. ++ AR_PHY_SPECTRAL_SCAN_COUNT, count);
  7406. ++ } else {
  7407. ++ REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN,
  7408. ++ AR_PHY_SPECTRAL_SCAN_COUNT_KIWI, count);
  7409. ++ REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN,
  7410. ++ AR_PHY_SPECTRAL_SCAN_PHYERR_MASK_SELECT);
  7411. ++ }
  7412. +
  7413. +- REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN,
  7414. +- AR_PHY_SPECTRAL_SCAN_COUNT, count);
  7415. + REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN,
  7416. + AR_PHY_SPECTRAL_SCAN_PERIOD, param->period);
  7417. + REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN,
  7418. +--- a/drivers/net/wireless/ath/ath9k/ar9002_phy.h
  7419. ++++ b/drivers/net/wireless/ath/ath9k/ar9002_phy.h
  7420. +@@ -177,8 +177,11 @@
  7421. + #define AR_PHY_SPECTRAL_SCAN_PERIOD_S 8
  7422. + #define AR_PHY_SPECTRAL_SCAN_COUNT 0x00FF0000 /* Number of reports, reg 68, bits 16-23*/
  7423. + #define AR_PHY_SPECTRAL_SCAN_COUNT_S 16
  7424. ++#define AR_PHY_SPECTRAL_SCAN_COUNT_KIWI 0x0FFF0000 /* Number of reports, reg 68, bits 16-27*/
  7425. ++#define AR_PHY_SPECTRAL_SCAN_COUNT_KIWI_S 16
  7426. + #define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT 0x01000000 /* Short repeat, reg 68, bit 24*/
  7427. +-#define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_S 24 /* Short repeat, reg 68, bit 24*/
  7428. ++#define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_KIWI 0x10000000 /* Short repeat, reg 68, bit 28*/
  7429. ++#define AR_PHY_SPECTRAL_SCAN_PHYERR_MASK_SELECT 0x40000000
  7430. +
  7431. + #define AR_PHY_RX_DELAY 0x9914
  7432. + #define AR_PHY_SEARCH_START_DELAY 0x9918
  7433. 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
  7434. deleted file mode 100644
  7435. index 6ce60f19608abcc89a27c6cebfbb90806b58a503..0000000000000000000000000000000000000000
  7436. --- a/package/kernel/mac80211/patches/324-brcmfmac-treat-NULL-character-in-NVRAM-as-separator.patch
  7437. +++ /dev/null
  7438. @@ -1,32 +0,0 @@
  7439. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  7440. -Date: Sun, 31 Jan 2016 12:14:34 +0100
  7441. -Subject: [PATCH] brcmfmac: treat NULL character in NVRAM as separator
  7442. -MIME-Version: 1.0
  7443. -Content-Type: text/plain; charset=UTF-8
  7444. -Content-Transfer-Encoding: 8bit
  7445. -
  7446. -Platform NVRAM (stored on a flash partition) has entries separated by a
  7447. -NULL (\0) char. Our parsing code switches from VALUE state to IDLE
  7448. -whenever it meets a NULL (\0). When that happens our IDLE handler should
  7449. -simply consume it and analyze whatever is placed ahead.
  7450. -
  7451. -This fixes harmless warnings spamming debugging output:
  7452. -[ 155.165624] brcmfmac: brcmf_nvram_handle_idle warning: ln=1:col=20: ignoring invalid character
  7453. -[ 155.180806] brcmfmac: brcmf_nvram_handle_idle warning: ln=1:col=44: ignoring invalid character
  7454. -[ 155.195971] brcmfmac: brcmf_nvram_handle_idle warning: ln=1:col=63: ignoring invalid character
  7455. -
  7456. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  7457. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  7458. ----
  7459. -
  7460. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  7461. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  7462. -@@ -93,7 +93,7 @@ static enum nvram_parser_state brcmf_nvr
  7463. - c = nvp->data[nvp->pos];
  7464. - if (c == '\n')
  7465. - return COMMENT;
  7466. -- if (is_whitespace(c))
  7467. -+ if (is_whitespace(c) || c == '\0')
  7468. - goto proceed;
  7469. - if (c == '#')
  7470. - return COMMENT;
  7471. 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
  7472. new file mode 100644
  7473. index 0000000000000000000000000000000000000000..6685f33989dd9c872b817b32bcd5b1ce72f13089
  7474. --- /dev/null
  7475. +++ b/package/kernel/mac80211/patches/325-ath9k_hw-fix-duplicate-and-partially-wrong-definitio.patch
  7476. @@ -0,0 +1,57 @@
  7477. +From: Felix Fietkau <nbd@nbd.name>
  7478. +Date: Mon, 11 Jul 2016 11:31:39 +0200
  7479. +Subject: [PATCH] ath9k_hw: fix duplicate (and partially wrong) definition
  7480. + of AR_CH0_THERM
  7481. +
  7482. +AR_PHY_65NM_CH0_THERM and AR_CH0_THERM were supposed to refer to the
  7483. +same register, however they had different SREV checks.
  7484. +
  7485. +Remove the duplicate and use the checks. Since there were other SREV
  7486. +checks present in the only place that uses this, this will probaby not
  7487. +affect runtime behavior.
  7488. +
  7489. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  7490. +---
  7491. +
  7492. +--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.h
  7493. ++++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.h
  7494. +@@ -689,13 +689,6 @@
  7495. + #define AR_CH0_TOP_XPABIASLVL (AR_SREV_9550(ah) ? 0x3c0 : 0x300)
  7496. + #define AR_CH0_TOP_XPABIASLVL_S (AR_SREV_9550(ah) ? 6 : 8)
  7497. +
  7498. +-#define AR_CH0_THERM (AR_SREV_9300(ah) ? 0x16290 : \
  7499. +- ((AR_SREV_9485(ah) ? 0x1628c : 0x16294)))
  7500. +-#define AR_CH0_THERM_XPABIASLVL_MSB 0x3
  7501. +-#define AR_CH0_THERM_XPABIASLVL_MSB_S 0
  7502. +-#define AR_CH0_THERM_XPASHORT2GND 0x4
  7503. +-#define AR_CH0_THERM_XPASHORT2GND_S 2
  7504. +-
  7505. + #define AR_SWITCH_TABLE_COM_ALL (0xffff)
  7506. + #define AR_SWITCH_TABLE_COM_ALL_S (0)
  7507. + #define AR_SWITCH_TABLE_COM_AR9462_ALL (0xffffff)
  7508. +@@ -712,15 +705,17 @@
  7509. + #define AR_SWITCH_TABLE_ALL (0xfff)
  7510. + #define AR_SWITCH_TABLE_ALL_S (0)
  7511. +
  7512. +-#define AR_PHY_65NM_CH0_THERM (AR_SREV_9300(ah) ? 0x16290 :\
  7513. +- ((AR_SREV_9462(ah) || AR_SREV_9565(ah)) ? 0x16294 : 0x1628c))
  7514. ++#define AR_CH0_THERM (AR_SREV_9300(ah) ? 0x16290 :\
  7515. ++ ((AR_SREV_9462(ah) || AR_SREV_9565(ah)) ? 0x16294 : 0x1628c))
  7516. ++#define AR_CH0_THERM_XPABIASLVL_MSB 0x3
  7517. ++#define AR_CH0_THERM_XPABIASLVL_MSB_S 0
  7518. ++#define AR_CH0_THERM_XPASHORT2GND 0x4
  7519. ++#define AR_CH0_THERM_XPASHORT2GND_S 2
  7520. +
  7521. +-#define AR_PHY_65NM_CH0_THERM_LOCAL 0x80000000
  7522. +-#define AR_PHY_65NM_CH0_THERM_LOCAL_S 31
  7523. +-#define AR_PHY_65NM_CH0_THERM_START 0x20000000
  7524. +-#define AR_PHY_65NM_CH0_THERM_START_S 29
  7525. +-#define AR_PHY_65NM_CH0_THERM_SAR_ADC_OUT 0x0000ff00
  7526. +-#define AR_PHY_65NM_CH0_THERM_SAR_ADC_OUT_S 8
  7527. ++#define AR_CH0_THERM_LOCAL 0x80000000
  7528. ++#define AR_CH0_THERM_START 0x20000000
  7529. ++#define AR_CH0_THERM_SAR_ADC_OUT 0x0000ff00
  7530. ++#define AR_CH0_THERM_SAR_ADC_OUT_S 8
  7531. +
  7532. + #define AR_CH0_TOP2 (AR_SREV_9300(ah) ? 0x1628c : \
  7533. + (AR_SREV_9462(ah) ? 0x16290 : 0x16284))
  7534. 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
  7535. deleted file mode 100644
  7536. index 012dea1e3a995d0118faea99f994da117e16293d..0000000000000000000000000000000000000000
  7537. --- a/package/kernel/mac80211/patches/325-brcmfmac-sdio-Increase-the-default-timeouts-a-bit.patch
  7538. +++ /dev/null
  7539. @@ -1,41 +0,0 @@
  7540. -From: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
  7541. -Date: Mon, 25 Jan 2016 11:47:29 +0100
  7542. -Subject: [PATCH] brcmfmac: sdio: Increase the default timeouts a bit
  7543. -
  7544. -On a Radxa Rock2 board with a Ampak AP6335 (Broadcom 4339 core) it seems
  7545. -the card responds very quickly most of the time, unfortunately during
  7546. -initialisation it sometimes seems to take just a bit over 2 seconds to
  7547. -respond.
  7548. -
  7549. -This results intialization failing with message like:
  7550. - brcmf_c_preinit_dcmds: Retreiving cur_etheraddr failed, -52
  7551. - brcmf_bus_start: failed: -52
  7552. - brcmf_sdio_firmware_callback: dongle is not responding
  7553. -
  7554. -Increasing the timeout to allow for a bit more headroom allows the
  7555. -card to initialize reliably.
  7556. -
  7557. -A quick search online after diagnosing/fixing this showed that Google
  7558. -has a similar patch in their ChromeOS tree, so this doesn't seem
  7559. -specific to the board I'm using.
  7560. -
  7561. -Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
  7562. -Reviewed-by: Julian Calaby <julian.calaby@gmail.com>
  7563. -Acked-by: Arend van Spriel <arend@broadcom.com>
  7564. -Reviewed-by: Douglas Anderson <dianders@chromium.org>
  7565. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  7566. ----
  7567. -
  7568. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  7569. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  7570. -@@ -45,8 +45,8 @@
  7571. - #include "chip.h"
  7572. - #include "firmware.h"
  7573. -
  7574. --#define DCMD_RESP_TIMEOUT msecs_to_jiffies(2000)
  7575. --#define CTL_DONE_TIMEOUT msecs_to_jiffies(2000)
  7576. -+#define DCMD_RESP_TIMEOUT msecs_to_jiffies(2500)
  7577. -+#define CTL_DONE_TIMEOUT msecs_to_jiffies(2500)
  7578. -
  7579. - #ifdef DEBUG
  7580. -
  7581. 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
  7582. deleted file mode 100644
  7583. index 71f7a4043304e4120bfb1fdfa3744a2ebd53ac54..0000000000000000000000000000000000000000
  7584. --- a/package/kernel/mac80211/patches/326-ath9k-make-NF-load-complete-quickly-and-reliably.patch
  7585. +++ /dev/null
  7586. @@ -1,87 +0,0 @@
  7587. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  7588. -Date: Fri, 5 Feb 2016 09:45:50 +0800
  7589. -Subject: [PATCH] ath9k: make NF load complete quickly and reliably
  7590. -
  7591. -Make NF load complete quickly and reliably. NF load execution
  7592. -is delayed by HW to end of frame if frame Rx or Tx is ongoing.
  7593. -Increasing timeout to max frame duration. If NF cal is ongoing
  7594. -before NF load, stop it before load, and restart it afterwards.
  7595. -
  7596. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  7597. ----
  7598. -
  7599. ---- a/drivers/net/wireless/ath/ath9k/calib.c
  7600. -+++ b/drivers/net/wireless/ath/ath9k/calib.c
  7601. -@@ -241,6 +241,7 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  7602. - u8 chainmask = (ah->rxchainmask << 3) | ah->rxchainmask;
  7603. - struct ath_common *common = ath9k_hw_common(ah);
  7604. - s16 default_nf = ath9k_hw_get_default_nf(ah, chan);
  7605. -+ u32 bb_agc_ctl = REG_READ(ah, AR_PHY_AGC_CONTROL);
  7606. -
  7607. - if (ah->caldata)
  7608. - h = ah->caldata->nfCalHist;
  7609. -@@ -264,6 +265,16 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  7610. - }
  7611. -
  7612. - /*
  7613. -+ * stop NF cal if ongoing to ensure NF load completes immediately
  7614. -+ * (or after end rx/tx frame if ongoing)
  7615. -+ */
  7616. -+ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_NF) {
  7617. -+ REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF);
  7618. -+ REG_RMW_BUFFER_FLUSH(ah);
  7619. -+ ENABLE_REG_RMW_BUFFER(ah);
  7620. -+ }
  7621. -+
  7622. -+ /*
  7623. - * Load software filtered NF value into baseband internal minCCApwr
  7624. - * variable.
  7625. - */
  7626. -@@ -276,18 +287,33 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  7627. -
  7628. - /*
  7629. - * Wait for load to complete, should be fast, a few 10s of us.
  7630. -- * The max delay was changed from an original 250us to 10000us
  7631. -- * since 250us often results in NF load timeout and causes deaf
  7632. -- * condition during stress testing 12/12/2009
  7633. -+ * The max delay was changed from an original 250us to 22.2 msec.
  7634. -+ * This would increase timeout to the longest possible frame
  7635. -+ * (11n max length 22.1 msec)
  7636. - */
  7637. -- for (j = 0; j < 10000; j++) {
  7638. -+ for (j = 0; j < 22200; j++) {
  7639. - if ((REG_READ(ah, AR_PHY_AGC_CONTROL) &
  7640. -- AR_PHY_AGC_CONTROL_NF) == 0)
  7641. -+ AR_PHY_AGC_CONTROL_NF) == 0)
  7642. - break;
  7643. - udelay(10);
  7644. - }
  7645. -
  7646. - /*
  7647. -+ * Restart NF so it can continue.
  7648. -+ */
  7649. -+ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_NF) {
  7650. -+ ENABLE_REG_RMW_BUFFER(ah);
  7651. -+ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_ENABLE_NF)
  7652. -+ REG_SET_BIT(ah, AR_PHY_AGC_CONTROL,
  7653. -+ AR_PHY_AGC_CONTROL_ENABLE_NF);
  7654. -+ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_NO_UPDATE_NF)
  7655. -+ REG_SET_BIT(ah, AR_PHY_AGC_CONTROL,
  7656. -+ AR_PHY_AGC_CONTROL_NO_UPDATE_NF);
  7657. -+ REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF);
  7658. -+ REG_RMW_BUFFER_FLUSH(ah);
  7659. -+ }
  7660. -+
  7661. -+ /*
  7662. - * We timed out waiting for the noisefloor to load, probably due to an
  7663. - * in-progress rx. Simply return here and allow the load plenty of time
  7664. - * to complete before the next calibration interval. We need to avoid
  7665. -@@ -296,7 +322,7 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  7666. - * here, the baseband nf cal will just be capped by our present
  7667. - * noisefloor until the next calibration timer.
  7668. - */
  7669. -- if (j == 10000) {
  7670. -+ if (j == 22200) {
  7671. - ath_dbg(common, ANY,
  7672. - "Timeout while waiting for nf to load: AR_PHY_AGC_CONTROL=0x%x\n",
  7673. - REG_READ(ah, AR_PHY_AGC_CONTROL));
  7674. 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
  7675. new file mode 100644
  7676. index 0000000000000000000000000000000000000000..999d9934cd47c41a53e296915139818ba10f9643
  7677. --- /dev/null
  7678. +++ b/package/kernel/mac80211/patches/326-ath9k_hw-simplify-ar9003_hw_per_calibration.patch
  7679. @@ -0,0 +1,88 @@
  7680. +From: Felix Fietkau <nbd@nbd.name>
  7681. +Date: Mon, 11 Jul 2016 11:34:47 +0200
  7682. +Subject: [PATCH] ath9k_hw: simplify ar9003_hw_per_calibration
  7683. +
  7684. +Reduce indentation, use a variable to save a few pointer dereferences
  7685. +
  7686. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  7687. +---
  7688. +
  7689. +--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  7690. ++++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  7691. +@@ -75,50 +75,49 @@ static bool ar9003_hw_per_calibration(st
  7692. + struct ath9k_cal_list *currCal)
  7693. + {
  7694. + struct ath9k_hw_cal_data *caldata = ah->caldata;
  7695. +- /* Cal is assumed not done until explicitly set below */
  7696. +- bool iscaldone = false;
  7697. ++ const struct ath9k_percal_data *cur_caldata = currCal->calData;
  7698. +
  7699. + /* Calibration in progress. */
  7700. + if (currCal->calState == CAL_RUNNING) {
  7701. + /* Check to see if it has finished. */
  7702. +- if (!(REG_READ(ah, AR_PHY_TIMING4) & AR_PHY_TIMING4_DO_CAL)) {
  7703. +- /*
  7704. +- * Accumulate cal measures for active chains
  7705. +- */
  7706. +- currCal->calData->calCollect(ah);
  7707. +- ah->cal_samples++;
  7708. ++ if (REG_READ(ah, AR_PHY_TIMING4) & AR_PHY_TIMING4_DO_CAL)
  7709. ++ return false;
  7710. +
  7711. +- if (ah->cal_samples >=
  7712. +- currCal->calData->calNumSamples) {
  7713. +- unsigned int i, numChains = 0;
  7714. +- for (i = 0; i < AR9300_MAX_CHAINS; i++) {
  7715. +- if (rxchainmask & (1 << i))
  7716. +- numChains++;
  7717. +- }
  7718. ++ /*
  7719. ++ * Accumulate cal measures for active chains
  7720. ++ */
  7721. ++ cur_caldata->calCollect(ah);
  7722. ++ ah->cal_samples++;
  7723. +
  7724. +- /*
  7725. +- * Process accumulated data
  7726. +- */
  7727. +- currCal->calData->calPostProc(ah, numChains);
  7728. ++ if (ah->cal_samples >= cur_caldata->calNumSamples) {
  7729. ++ unsigned int i, numChains = 0;
  7730. ++ for (i = 0; i < AR9300_MAX_CHAINS; i++) {
  7731. ++ if (rxchainmask & (1 << i))
  7732. ++ numChains++;
  7733. ++ }
  7734. +
  7735. +- /* Calibration has finished. */
  7736. +- caldata->CalValid |= currCal->calData->calType;
  7737. +- currCal->calState = CAL_DONE;
  7738. +- iscaldone = true;
  7739. +- } else {
  7740. ++ /*
  7741. ++ * Process accumulated data
  7742. ++ */
  7743. ++ cur_caldata->calPostProc(ah, numChains);
  7744. ++
  7745. ++ /* Calibration has finished. */
  7746. ++ caldata->CalValid |= cur_caldata->calType;
  7747. ++ currCal->calState = CAL_DONE;
  7748. ++ return true;
  7749. ++ } else {
  7750. + /*
  7751. + * Set-up collection of another sub-sample until we
  7752. + * get desired number
  7753. + */
  7754. + ar9003_hw_setup_calibration(ah, currCal);
  7755. +- }
  7756. + }
  7757. +- } else if (!(caldata->CalValid & currCal->calData->calType)) {
  7758. ++ } else if (!(caldata->CalValid & cur_caldata->calType)) {
  7759. + /* If current cal is marked invalid in channel, kick it off */
  7760. + ath9k_hw_reset_calibration(ah, currCal);
  7761. + }
  7762. +
  7763. +- return iscaldone;
  7764. ++ return false;
  7765. + }
  7766. +
  7767. + static int ar9003_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan,
  7768. 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
  7769. new file mode 100644
  7770. index 0000000000000000000000000000000000000000..b7f3823ee625a7e77b84c4e293dbf6ac81fc3db1
  7771. --- /dev/null
  7772. +++ b/package/kernel/mac80211/patches/327-ath9k_hw-get-rid-of-some-duplicate-code-in-calibrati.patch
  7773. @@ -0,0 +1,94 @@
  7774. +From: Felix Fietkau <nbd@nbd.name>
  7775. +Date: Mon, 11 Jul 2016 11:35:20 +0200
  7776. +Subject: [PATCH] ath9k_hw: get rid of some duplicate code in calibration
  7777. + init
  7778. +
  7779. +Remove a misleading debug message as well
  7780. +
  7781. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  7782. +---
  7783. +
  7784. +--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  7785. ++++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  7786. +@@ -1373,6 +1373,26 @@ static void ar9003_hw_cl_cal_post_proc(s
  7787. + }
  7788. + }
  7789. +
  7790. ++static void ar9003_hw_init_cal_common(struct ath_hw *ah)
  7791. ++{
  7792. ++ struct ath9k_hw_cal_data *caldata = ah->caldata;
  7793. ++
  7794. ++ /* Initialize list pointers */
  7795. ++ ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL;
  7796. ++
  7797. ++ INIT_CAL(&ah->iq_caldata);
  7798. ++ INSERT_CAL(ah, &ah->iq_caldata);
  7799. ++
  7800. ++ /* Initialize current pointer to first element in list */
  7801. ++ ah->cal_list_curr = ah->cal_list;
  7802. ++
  7803. ++ if (ah->cal_list_curr)
  7804. ++ ath9k_hw_reset_calibration(ah, ah->cal_list_curr);
  7805. ++
  7806. ++ if (caldata)
  7807. ++ caldata->CalValid = 0;
  7808. ++}
  7809. ++
  7810. + static bool ar9003_hw_init_cal_pcoem(struct ath_hw *ah,
  7811. + struct ath9k_channel *chan)
  7812. + {
  7813. +@@ -1532,21 +1552,7 @@ skip_tx_iqcal:
  7814. + /* Revert chainmask to runtime parameters */
  7815. + ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask);
  7816. +
  7817. +- /* Initialize list pointers */
  7818. +- ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL;
  7819. +-
  7820. +- INIT_CAL(&ah->iq_caldata);
  7821. +- INSERT_CAL(ah, &ah->iq_caldata);
  7822. +- ath_dbg(common, CALIBRATE, "enabling IQ Calibration\n");
  7823. +-
  7824. +- /* Initialize current pointer to first element in list */
  7825. +- ah->cal_list_curr = ah->cal_list;
  7826. +-
  7827. +- if (ah->cal_list_curr)
  7828. +- ath9k_hw_reset_calibration(ah, ah->cal_list_curr);
  7829. +-
  7830. +- if (caldata)
  7831. +- caldata->CalValid = 0;
  7832. ++ ar9003_hw_init_cal_common(ah);
  7833. +
  7834. + return true;
  7835. + }
  7836. +@@ -1577,8 +1583,6 @@ static bool do_ar9003_agc_cal(struct ath
  7837. + static bool ar9003_hw_init_cal_soc(struct ath_hw *ah,
  7838. + struct ath9k_channel *chan)
  7839. + {
  7840. +- struct ath_common *common = ath9k_hw_common(ah);
  7841. +- struct ath9k_hw_cal_data *caldata = ah->caldata;
  7842. + bool txiqcal_done = false;
  7843. + bool status = true;
  7844. + bool run_agc_cal = false, sep_iq_cal = false;
  7845. +@@ -1676,21 +1680,7 @@ skip_tx_iqcal:
  7846. + /* Revert chainmask to runtime parameters */
  7847. + ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask);
  7848. +
  7849. +- /* Initialize list pointers */
  7850. +- ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL;
  7851. +-
  7852. +- INIT_CAL(&ah->iq_caldata);
  7853. +- INSERT_CAL(ah, &ah->iq_caldata);
  7854. +- ath_dbg(common, CALIBRATE, "enabling IQ Calibration\n");
  7855. +-
  7856. +- /* Initialize current pointer to first element in list */
  7857. +- ah->cal_list_curr = ah->cal_list;
  7858. +-
  7859. +- if (ah->cal_list_curr)
  7860. +- ath9k_hw_reset_calibration(ah, ah->cal_list_curr);
  7861. +-
  7862. +- if (caldata)
  7863. +- caldata->CalValid = 0;
  7864. ++ ar9003_hw_init_cal_common(ah);
  7865. +
  7866. + return true;
  7867. + }
  7868. 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
  7869. deleted file mode 100644
  7870. index f7f9df946a462b5ede16dc61f49f2731ae444af6..0000000000000000000000000000000000000000
  7871. --- a/package/kernel/mac80211/patches/327-mac80211-Remove-MPP-table-entries-with-MPath.patch
  7872. +++ /dev/null
  7873. @@ -1,54 +0,0 @@
  7874. -From: Henning Rogge <hrogge@gmail.com>
  7875. -Date: Wed, 3 Feb 2016 13:58:36 +0100
  7876. -Subject: [PATCH] mac80211: Remove MPP table entries with MPath
  7877. -
  7878. -Make the mesh_path_del() function remove all mpp table entries
  7879. -that are proxied by the removed mesh path.
  7880. -
  7881. -Acked-by: Bob Copeland <me@bobcopeland.com>
  7882. -Signed-off-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
  7883. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  7884. ----
  7885. -
  7886. ---- a/net/mac80211/mesh_pathtbl.c
  7887. -+++ b/net/mac80211/mesh_pathtbl.c
  7888. -@@ -835,6 +835,29 @@ void mesh_path_flush_by_nexthop(struct s
  7889. - rcu_read_unlock();
  7890. - }
  7891. -
  7892. -+static void mpp_flush_by_proxy(struct ieee80211_sub_if_data *sdata,
  7893. -+ const u8 *proxy)
  7894. -+{
  7895. -+ struct mesh_table *tbl;
  7896. -+ struct mesh_path *mpp;
  7897. -+ struct mpath_node *node;
  7898. -+ int i;
  7899. -+
  7900. -+ rcu_read_lock();
  7901. -+ read_lock_bh(&pathtbl_resize_lock);
  7902. -+ tbl = resize_dereference_mpp_paths();
  7903. -+ for_each_mesh_entry(tbl, node, i) {
  7904. -+ mpp = node->mpath;
  7905. -+ if (ether_addr_equal(mpp->mpp, proxy)) {
  7906. -+ spin_lock(&tbl->hashwlock[i]);
  7907. -+ __mesh_path_del(tbl, node);
  7908. -+ spin_unlock(&tbl->hashwlock[i]);
  7909. -+ }
  7910. -+ }
  7911. -+ read_unlock_bh(&pathtbl_resize_lock);
  7912. -+ rcu_read_unlock();
  7913. -+}
  7914. -+
  7915. - static void table_flush_by_iface(struct mesh_table *tbl,
  7916. - struct ieee80211_sub_if_data *sdata)
  7917. - {
  7918. -@@ -892,6 +915,9 @@ int mesh_path_del(struct ieee80211_sub_i
  7919. - int hash_idx;
  7920. - int err = 0;
  7921. -
  7922. -+ /* flush relevant mpp entries first */
  7923. -+ mpp_flush_by_proxy(sdata, addr);
  7924. -+
  7925. - read_lock_bh(&pathtbl_resize_lock);
  7926. - tbl = resize_dereference_mesh_paths();
  7927. - hash_idx = mesh_table_hash(addr, sdata, tbl);
  7928. 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
  7929. new file mode 100644
  7930. index 0000000000000000000000000000000000000000..cff32ad47cb0b905d9cfa4eb021258b644b2a47a
  7931. --- /dev/null
  7932. +++ b/package/kernel/mac80211/patches/328-ath9k_hw-implement-temperature-compensation-support-.patch
  7933. @@ -0,0 +1,97 @@
  7934. +From: Felix Fietkau <nbd@nbd.name>
  7935. +Date: Mon, 11 Jul 2016 11:35:55 +0200
  7936. +Subject: [PATCH] ath9k_hw: implement temperature compensation support for
  7937. + AR9003+
  7938. +
  7939. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  7940. +---
  7941. +
  7942. +--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  7943. ++++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  7944. +@@ -33,6 +33,7 @@ struct coeff {
  7945. +
  7946. + enum ar9003_cal_types {
  7947. + IQ_MISMATCH_CAL = BIT(0),
  7948. ++ TEMP_COMP_CAL = BIT(1),
  7949. + };
  7950. +
  7951. + static void ar9003_hw_setup_calibration(struct ath_hw *ah,
  7952. +@@ -58,6 +59,12 @@ static void ar9003_hw_setup_calibration(
  7953. + /* Kick-off cal */
  7954. + REG_SET_BIT(ah, AR_PHY_TIMING4, AR_PHY_TIMING4_DO_CAL);
  7955. + break;
  7956. ++ case TEMP_COMP_CAL:
  7957. ++ ath_dbg(common, CALIBRATE,
  7958. ++ "starting Temperature Compensation Calibration\n");
  7959. ++ REG_SET_BIT(ah, AR_CH0_THERM, AR_CH0_THERM_LOCAL);
  7960. ++ REG_SET_BIT(ah, AR_CH0_THERM, AR_CH0_THERM_START);
  7961. ++ break;
  7962. + default:
  7963. + ath_err(common, "Invalid calibration type\n");
  7964. + break;
  7965. +@@ -86,7 +93,8 @@ static bool ar9003_hw_per_calibration(st
  7966. + /*
  7967. + * Accumulate cal measures for active chains
  7968. + */
  7969. +- cur_caldata->calCollect(ah);
  7970. ++ if (cur_caldata->calCollect)
  7971. ++ cur_caldata->calCollect(ah);
  7972. + ah->cal_samples++;
  7973. +
  7974. + if (ah->cal_samples >= cur_caldata->calNumSamples) {
  7975. +@@ -99,7 +107,8 @@ static bool ar9003_hw_per_calibration(st
  7976. + /*
  7977. + * Process accumulated data
  7978. + */
  7979. +- cur_caldata->calPostProc(ah, numChains);
  7980. ++ if (cur_caldata->calPostProc)
  7981. ++ cur_caldata->calPostProc(ah, numChains);
  7982. +
  7983. + /* Calibration has finished. */
  7984. + caldata->CalValid |= cur_caldata->calType;
  7985. +@@ -314,9 +323,16 @@ static const struct ath9k_percal_data iq
  7986. + ar9003_hw_iqcalibrate
  7987. + };
  7988. +
  7989. ++static const struct ath9k_percal_data temp_cal_single_sample = {
  7990. ++ TEMP_COMP_CAL,
  7991. ++ MIN_CAL_SAMPLES,
  7992. ++ PER_MAX_LOG_COUNT,
  7993. ++};
  7994. ++
  7995. + static void ar9003_hw_init_cal_settings(struct ath_hw *ah)
  7996. + {
  7997. + ah->iq_caldata.calData = &iq_cal_single_sample;
  7998. ++ ah->temp_caldata.calData = &temp_cal_single_sample;
  7999. +
  8000. + if (AR_SREV_9300_20_OR_LATER(ah)) {
  8001. + ah->enabled_cals |= TX_IQ_CAL;
  8002. +@@ -324,7 +340,7 @@ static void ar9003_hw_init_cal_settings(
  8003. + ah->enabled_cals |= TX_IQ_ON_AGC_CAL;
  8004. + }
  8005. +
  8006. +- ah->supp_cals = IQ_MISMATCH_CAL;
  8007. ++ ah->supp_cals = IQ_MISMATCH_CAL | TEMP_COMP_CAL;
  8008. + }
  8009. +
  8010. + #define OFF_UPPER_LT 24
  8011. +@@ -1383,6 +1399,9 @@ static void ar9003_hw_init_cal_common(st
  8012. + INIT_CAL(&ah->iq_caldata);
  8013. + INSERT_CAL(ah, &ah->iq_caldata);
  8014. +
  8015. ++ INIT_CAL(&ah->temp_caldata);
  8016. ++ INSERT_CAL(ah, &ah->temp_caldata);
  8017. ++
  8018. + /* Initialize current pointer to first element in list */
  8019. + ah->cal_list_curr = ah->cal_list;
  8020. +
  8021. +--- a/drivers/net/wireless/ath/ath9k/hw.h
  8022. ++++ b/drivers/net/wireless/ath/ath9k/hw.h
  8023. +@@ -830,6 +830,7 @@ struct ath_hw {
  8024. + /* Calibration */
  8025. + u32 supp_cals;
  8026. + struct ath9k_cal_list iq_caldata;
  8027. ++ struct ath9k_cal_list temp_caldata;
  8028. + struct ath9k_cal_list adcgain_caldata;
  8029. + struct ath9k_cal_list adcdc_caldata;
  8030. + struct ath9k_cal_list *cal_list;
  8031. 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
  8032. deleted file mode 100644
  8033. index 740993c9e0284e5d03a9036ac87fd7548b22ab3b..0000000000000000000000000000000000000000
  8034. --- a/package/kernel/mac80211/patches/328-mac80211-let-unused-MPP-table-entries-timeout.patch
  8035. +++ /dev/null
  8036. @@ -1,104 +0,0 @@
  8037. -From: Henning Rogge <hrogge@gmail.com>
  8038. -Date: Wed, 3 Feb 2016 13:58:37 +0100
  8039. -Subject: [PATCH] mac80211: let unused MPP table entries timeout
  8040. -
  8041. -Remember the last time when a mpp table entry is used for
  8042. -rx or tx and remove them after MESH_PATH_EXPIRE time.
  8043. -
  8044. -Acked-by: Bob Copeland <me@bobcopeland.com>
  8045. -Signed-off-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
  8046. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  8047. ----
  8048. -
  8049. ---- a/net/mac80211/mesh_pathtbl.c
  8050. -+++ b/net/mac80211/mesh_pathtbl.c
  8051. -@@ -942,6 +942,46 @@ enddel:
  8052. - }
  8053. -
  8054. - /**
  8055. -+ * mpp_path_del - delete a mesh proxy path from the table
  8056. -+ *
  8057. -+ * @addr: addr address (ETH_ALEN length)
  8058. -+ * @sdata: local subif
  8059. -+ *
  8060. -+ * Returns: 0 if successful
  8061. -+ */
  8062. -+static int mpp_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr)
  8063. -+{
  8064. -+ struct mesh_table *tbl;
  8065. -+ struct mesh_path *mpath;
  8066. -+ struct mpath_node *node;
  8067. -+ struct hlist_head *bucket;
  8068. -+ int hash_idx;
  8069. -+ int err = 0;
  8070. -+
  8071. -+ read_lock_bh(&pathtbl_resize_lock);
  8072. -+ tbl = resize_dereference_mpp_paths();
  8073. -+ hash_idx = mesh_table_hash(addr, sdata, tbl);
  8074. -+ bucket = &tbl->hash_buckets[hash_idx];
  8075. -+
  8076. -+ spin_lock(&tbl->hashwlock[hash_idx]);
  8077. -+ hlist_for_each_entry(node, bucket, list) {
  8078. -+ mpath = node->mpath;
  8079. -+ if (mpath->sdata == sdata &&
  8080. -+ ether_addr_equal(addr, mpath->dst)) {
  8081. -+ __mesh_path_del(tbl, node);
  8082. -+ goto enddel;
  8083. -+ }
  8084. -+ }
  8085. -+
  8086. -+ err = -ENXIO;
  8087. -+enddel:
  8088. -+ mesh_paths_generation++;
  8089. -+ spin_unlock(&tbl->hashwlock[hash_idx]);
  8090. -+ read_unlock_bh(&pathtbl_resize_lock);
  8091. -+ return err;
  8092. -+}
  8093. -+
  8094. -+/**
  8095. - * mesh_path_tx_pending - sends pending frames in a mesh path queue
  8096. - *
  8097. - * @mpath: mesh path to activate
  8098. -@@ -1157,6 +1197,17 @@ void mesh_path_expire(struct ieee80211_s
  8099. - time_after(jiffies, mpath->exp_time + MESH_PATH_EXPIRE))
  8100. - mesh_path_del(mpath->sdata, mpath->dst);
  8101. - }
  8102. -+
  8103. -+ tbl = rcu_dereference(mpp_paths);
  8104. -+ for_each_mesh_entry(tbl, node, i) {
  8105. -+ if (node->mpath->sdata != sdata)
  8106. -+ continue;
  8107. -+ mpath = node->mpath;
  8108. -+ if ((!(mpath->flags & MESH_PATH_FIXED)) &&
  8109. -+ time_after(jiffies, mpath->exp_time + MESH_PATH_EXPIRE))
  8110. -+ mpp_path_del(mpath->sdata, mpath->dst);
  8111. -+ }
  8112. -+
  8113. - rcu_read_unlock();
  8114. - }
  8115. -
  8116. ---- a/net/mac80211/rx.c
  8117. -+++ b/net/mac80211/rx.c
  8118. -@@ -2291,6 +2291,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
  8119. - spin_lock_bh(&mppath->state_lock);
  8120. - if (!ether_addr_equal(mppath->mpp, mpp_addr))
  8121. - memcpy(mppath->mpp, mpp_addr, ETH_ALEN);
  8122. -+ mppath->exp_time = jiffies;
  8123. - spin_unlock_bh(&mppath->state_lock);
  8124. - }
  8125. - rcu_read_unlock();
  8126. ---- a/net/mac80211/tx.c
  8127. -+++ b/net/mac80211/tx.c
  8128. -@@ -2171,8 +2171,11 @@ static struct sk_buff *ieee80211_build_h
  8129. - mpp_lookup = true;
  8130. - }
  8131. -
  8132. -- if (mpp_lookup)
  8133. -+ if (mpp_lookup) {
  8134. - mppath = mpp_path_lookup(sdata, skb->data);
  8135. -+ if (mppath)
  8136. -+ mppath->exp_time = jiffies;
  8137. -+ }
  8138. -
  8139. - if (mppath && mpath)
  8140. - mesh_path_del(mpath->sdata, mpath->dst);
  8141. 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
  8142. deleted file mode 100644
  8143. index 0c36b1d5687447021eaa560d08b16580351b4a20..0000000000000000000000000000000000000000
  8144. --- a/package/kernel/mac80211/patches/329-mac80211-Unify-mesh-and-mpp-path-removal-function.patch
  8145. +++ /dev/null
  8146. @@ -1,143 +0,0 @@
  8147. -From: Henning Rogge <hrogge@gmail.com>
  8148. -Date: Wed, 3 Feb 2016 13:58:38 +0100
  8149. -Subject: [PATCH] mac80211: Unify mesh and mpp path removal function
  8150. -
  8151. -mpp_path_del() and mesh_path_del() are mostly the same function.
  8152. -Move common code into a new static function.
  8153. -
  8154. -Acked-by: Bob Copeland <me@bobcopeland.com>
  8155. -Signed-off-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
  8156. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  8157. ----
  8158. -
  8159. ---- a/net/mac80211/mesh_pathtbl.c
  8160. -+++ b/net/mac80211/mesh_pathtbl.c
  8161. -@@ -55,16 +55,21 @@ int mpp_paths_generation;
  8162. - static DEFINE_RWLOCK(pathtbl_resize_lock);
  8163. -
  8164. -
  8165. -+static inline struct mesh_table *resize_dereference_paths(
  8166. -+ struct mesh_table __rcu *table)
  8167. -+{
  8168. -+ return rcu_dereference_protected(table,
  8169. -+ lockdep_is_held(&pathtbl_resize_lock));
  8170. -+}
  8171. -+
  8172. - static inline struct mesh_table *resize_dereference_mesh_paths(void)
  8173. - {
  8174. -- return rcu_dereference_protected(mesh_paths,
  8175. -- lockdep_is_held(&pathtbl_resize_lock));
  8176. -+ return resize_dereference_paths(mesh_paths);
  8177. - }
  8178. -
  8179. - static inline struct mesh_table *resize_dereference_mpp_paths(void)
  8180. - {
  8181. -- return rcu_dereference_protected(mpp_paths,
  8182. -- lockdep_is_held(&pathtbl_resize_lock));
  8183. -+ return resize_dereference_paths(mpp_paths);
  8184. - }
  8185. -
  8186. - /*
  8187. -@@ -899,14 +904,17 @@ void mesh_path_flush_by_iface(struct iee
  8188. - }
  8189. -
  8190. - /**
  8191. -- * mesh_path_del - delete a mesh path from the table
  8192. -+ * table_path_del - delete a path from the mesh or mpp table
  8193. - *
  8194. -- * @addr: dst address (ETH_ALEN length)
  8195. -+ * @tbl: mesh or mpp path table
  8196. - * @sdata: local subif
  8197. -+ * @addr: dst address (ETH_ALEN length)
  8198. - *
  8199. - * Returns: 0 if successful
  8200. - */
  8201. --int mesh_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr)
  8202. -+static int table_path_del(struct mesh_table __rcu *rcu_tbl,
  8203. -+ struct ieee80211_sub_if_data *sdata,
  8204. -+ const u8 *addr)
  8205. - {
  8206. - struct mesh_table *tbl;
  8207. - struct mesh_path *mpath;
  8208. -@@ -915,11 +923,7 @@ int mesh_path_del(struct ieee80211_sub_i
  8209. - int hash_idx;
  8210. - int err = 0;
  8211. -
  8212. -- /* flush relevant mpp entries first */
  8213. -- mpp_flush_by_proxy(sdata, addr);
  8214. --
  8215. -- read_lock_bh(&pathtbl_resize_lock);
  8216. -- tbl = resize_dereference_mesh_paths();
  8217. -+ tbl = resize_dereference_paths(rcu_tbl);
  8218. - hash_idx = mesh_table_hash(addr, sdata, tbl);
  8219. - bucket = &tbl->hash_buckets[hash_idx];
  8220. -
  8221. -@@ -935,9 +939,30 @@ int mesh_path_del(struct ieee80211_sub_i
  8222. -
  8223. - err = -ENXIO;
  8224. - enddel:
  8225. -- mesh_paths_generation++;
  8226. - spin_unlock(&tbl->hashwlock[hash_idx]);
  8227. -+ return err;
  8228. -+}
  8229. -+
  8230. -+/**
  8231. -+ * mesh_path_del - delete a mesh path from the table
  8232. -+ *
  8233. -+ * @addr: dst address (ETH_ALEN length)
  8234. -+ * @sdata: local subif
  8235. -+ *
  8236. -+ * Returns: 0 if successful
  8237. -+ */
  8238. -+int mesh_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr)
  8239. -+{
  8240. -+ int err = 0;
  8241. -+
  8242. -+ /* flush relevant mpp entries first */
  8243. -+ mpp_flush_by_proxy(sdata, addr);
  8244. -+
  8245. -+ read_lock_bh(&pathtbl_resize_lock);
  8246. -+ err = table_path_del(mesh_paths, sdata, addr);
  8247. -+ mesh_paths_generation++;
  8248. - read_unlock_bh(&pathtbl_resize_lock);
  8249. -+
  8250. - return err;
  8251. - }
  8252. -
  8253. -@@ -951,33 +976,13 @@ enddel:
  8254. - */
  8255. - static int mpp_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr)
  8256. - {
  8257. -- struct mesh_table *tbl;
  8258. -- struct mesh_path *mpath;
  8259. -- struct mpath_node *node;
  8260. -- struct hlist_head *bucket;
  8261. -- int hash_idx;
  8262. - int err = 0;
  8263. -
  8264. - read_lock_bh(&pathtbl_resize_lock);
  8265. -- tbl = resize_dereference_mpp_paths();
  8266. -- hash_idx = mesh_table_hash(addr, sdata, tbl);
  8267. -- bucket = &tbl->hash_buckets[hash_idx];
  8268. --
  8269. -- spin_lock(&tbl->hashwlock[hash_idx]);
  8270. -- hlist_for_each_entry(node, bucket, list) {
  8271. -- mpath = node->mpath;
  8272. -- if (mpath->sdata == sdata &&
  8273. -- ether_addr_equal(addr, mpath->dst)) {
  8274. -- __mesh_path_del(tbl, node);
  8275. -- goto enddel;
  8276. -- }
  8277. -- }
  8278. --
  8279. -- err = -ENXIO;
  8280. --enddel:
  8281. -- mesh_paths_generation++;
  8282. -- spin_unlock(&tbl->hashwlock[hash_idx]);
  8283. -+ err = table_path_del(mpp_paths, sdata, addr);
  8284. -+ mpp_paths_generation++;
  8285. - read_unlock_bh(&pathtbl_resize_lock);
  8286. -+
  8287. - return err;
  8288. - }
  8289. -
  8290. 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
  8291. new file mode 100644
  8292. index 0000000000000000000000000000000000000000..38e541c7150aaf9b32eed89f8edfdf989d4677f7
  8293. --- /dev/null
  8294. +++ b/package/kernel/mac80211/patches/329-mac80211-fix-check-for-buffered-powersave-frames-wit.patch
  8295. @@ -0,0 +1,21 @@
  8296. +From: Felix Fietkau <nbd@nbd.name>
  8297. +Date: Mon, 11 Jul 2016 15:07:06 +0200
  8298. +Subject: [PATCH] mac80211: fix check for buffered powersave frames with txq
  8299. +
  8300. +The logic was inverted here, set the bit if frames are pending.
  8301. +
  8302. +Fixes: ba8c3d6f16a1 ("mac80211: add an intermediate software queue implementation")
  8303. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  8304. +---
  8305. +
  8306. +--- a/net/mac80211/rx.c
  8307. ++++ b/net/mac80211/rx.c
  8308. +@@ -1268,7 +1268,7 @@ static void sta_ps_start(struct sta_info
  8309. + for (tid = 0; tid < ARRAY_SIZE(sta->sta.txq); tid++) {
  8310. + struct txq_info *txqi = to_txq_info(sta->sta.txq[tid]);
  8311. +
  8312. +- if (!txqi->tin.backlog_packets)
  8313. ++ if (txqi->tin.backlog_packets)
  8314. + set_bit(tid, &sta->txq_buffered_tids);
  8315. + else
  8316. + clear_bit(tid, &sta->txq_buffered_tids);
  8317. 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
  8318. new file mode 100644
  8319. index 0000000000000000000000000000000000000000..a6031b9c265d87656f04a7f7a639233949054818
  8320. --- /dev/null
  8321. +++ b/package/kernel/mac80211/patches/330-ath10k-fix-rx-status-reporting-for-A-MSDU-subframes.patch
  8322. @@ -0,0 +1,36 @@
  8323. +From: Felix Fietkau <nbd@nbd.name>
  8324. +Date: Sun, 17 Jul 2016 12:49:59 +0200
  8325. +Subject: [PATCH] ath10k: fix rx status reporting for A-MSDU subframes
  8326. +
  8327. +Patch by Nagarajan, Ashok Raj <arnagara@qti.qualcomm.com>
  8328. +
  8329. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  8330. +---
  8331. +
  8332. +--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
  8333. ++++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
  8334. +@@ -1525,7 +1525,7 @@ static void ath10k_htt_rx_h_filter(struc
  8335. + static int ath10k_htt_rx_handle_amsdu(struct ath10k_htt *htt)
  8336. + {
  8337. + struct ath10k *ar = htt->ar;
  8338. +- static struct ieee80211_rx_status rx_status;
  8339. ++ struct ieee80211_rx_status *rx_status = &htt->rx_status;
  8340. + struct sk_buff_head amsdu;
  8341. + int ret;
  8342. +
  8343. +@@ -1549,11 +1549,11 @@ static int ath10k_htt_rx_handle_amsdu(st
  8344. + return ret;
  8345. + }
  8346. +
  8347. +- ath10k_htt_rx_h_ppdu(ar, &amsdu, &rx_status, 0xffff);
  8348. ++ ath10k_htt_rx_h_ppdu(ar, &amsdu, rx_status, 0xffff);
  8349. + ath10k_htt_rx_h_unchain(ar, &amsdu, ret > 0);
  8350. +- ath10k_htt_rx_h_filter(ar, &amsdu, &rx_status);
  8351. +- ath10k_htt_rx_h_mpdu(ar, &amsdu, &rx_status);
  8352. +- ath10k_htt_rx_h_deliver(ar, &amsdu, &rx_status);
  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. +
  8357. + return 0;
  8358. + }
  8359. 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
  8360. deleted file mode 100644
  8361. index 4dc6d663ed7af432b5d26338ef74732abe6aa31c..0000000000000000000000000000000000000000
  8362. --- a/package/kernel/mac80211/patches/330-mac80211-minstrel-Change-expected-throughput-unit-ba.patch
  8363. +++ /dev/null
  8364. @@ -1,51 +0,0 @@
  8365. -From: Sven Eckelmann <sven.eckelmann@open-mesh.com>
  8366. -Date: Tue, 2 Feb 2016 08:12:26 +0100
  8367. -Subject: [PATCH] mac80211: minstrel: Change expected throughput unit back to
  8368. - Kbps
  8369. -
  8370. -The change from cur_tp to the function
  8371. -minstrel_get_tp_avg/minstrel_ht_get_tp_avg changed the unit used for the
  8372. -current throughput. For example in minstrel_ht the correct
  8373. -conversion between them would be:
  8374. -
  8375. - mrs->cur_tp / 10 == minstrel_ht_get_tp_avg(..).
  8376. -
  8377. -This factor 10 must also be included in the calculation of
  8378. -minstrel_get_expected_throughput and minstrel_ht_get_expected_throughput to
  8379. -return values with the unit [Kbps] instead of [10Kbps]. Otherwise routing
  8380. -algorithms like B.A.T.M.A.N. V will make incorrect decision based on these
  8381. -values. Its kernel based implementation expects expected_throughput always
  8382. -to have the unit [Kbps] and not sometimes [10Kbps] and sometimes [Kbps].
  8383. -
  8384. -The same requirement has iw or olsrdv2's nl80211 based statistics module
  8385. -which retrieve the same data via NL80211_STA_INFO_TX_BITRATE.
  8386. -
  8387. -Cc: stable@vger.kernel.org
  8388. -Fixes: 6a27b2c40b48 ("mac80211: restructure per-rate throughput calculation into function")
  8389. -Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
  8390. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  8391. ----
  8392. -
  8393. ---- a/net/mac80211/rc80211_minstrel.c
  8394. -+++ b/net/mac80211/rc80211_minstrel.c
  8395. -@@ -711,7 +711,7 @@ static u32 minstrel_get_expected_through
  8396. - * computing cur_tp
  8397. - */
  8398. - tmp_mrs = &mi->r[idx].stats;
  8399. -- tmp_cur_tp = minstrel_get_tp_avg(&mi->r[idx], tmp_mrs->prob_ewma);
  8400. -+ tmp_cur_tp = minstrel_get_tp_avg(&mi->r[idx], tmp_mrs->prob_ewma) * 10;
  8401. - tmp_cur_tp = tmp_cur_tp * 1200 * 8 / 1024;
  8402. -
  8403. - return tmp_cur_tp;
  8404. ---- a/net/mac80211/rc80211_minstrel_ht.c
  8405. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  8406. -@@ -1335,7 +1335,8 @@ static u32 minstrel_ht_get_expected_thro
  8407. - prob = mi->groups[i].rates[j].prob_ewma;
  8408. -
  8409. - /* convert tp_avg from pkt per second in kbps */
  8410. -- tp_avg = minstrel_ht_get_tp_avg(mi, i, j, prob) * AVG_PKT_SIZE * 8 / 1024;
  8411. -+ tp_avg = minstrel_ht_get_tp_avg(mi, i, j, prob) * 10;
  8412. -+ tp_avg = tp_avg * AVG_PKT_SIZE * 8 / 1024;
  8413. -
  8414. - return tp_avg;
  8415. - }
  8416. 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
  8417. deleted file mode 100644
  8418. index 1fd016f7f6bc9ad7bd4265e16a439b4de33b8f9c..0000000000000000000000000000000000000000
  8419. --- a/package/kernel/mac80211/patches/331-brcmfmac-Increase-nr-of-supported-flowrings.patch
  8420. +++ /dev/null
  8421. @@ -1,307 +0,0 @@
  8422. -From: Hante Meuleman <meuleman@broadcom.com>
  8423. -Date: Sun, 7 Feb 2016 18:08:24 +0100
  8424. -Subject: [PATCH] brcmfmac: Increase nr of supported flowrings.
  8425. -MIME-Version: 1.0
  8426. -Content-Type: text/plain; charset=UTF-8
  8427. -Content-Transfer-Encoding: 8bit
  8428. -
  8429. -New generation devices have firmware which has more than 256 flowrings.
  8430. -E.g. following debugging message comes from 14e4:4365 BCM4366:
  8431. -[ 194.606245] brcmfmac: brcmf_pcie_init_ringbuffers Nr of flowrings is 264
  8432. -
  8433. -At various code places (related to flowrings) we were using u8 which
  8434. -could lead to storing wrong number or infinite loops when indexing with
  8435. -this type. This issue was quite easy to spot in brcmf_flowring_detach
  8436. -where it led to infinite loop e.g. on failed initialization.
  8437. -
  8438. -This patch switches code to proper types and increases the maximum
  8439. -number of supported flowrings to 512.
  8440. -
  8441. -Originally this change was sent in September 2015, but back it was
  8442. -causing a regression on BCM43602 resulting in:
  8443. -Unable to handle kernel NULL pointer dereference at virtual address ...
  8444. -
  8445. -The reason for this regression was missing update (s/u8/u16) of struct
  8446. -brcmf_flowring_ring. This problem was handled in 9f64df9 ("brcmfmac: Fix
  8447. -bug in flowring management."). Starting with that it's safe to apply
  8448. -this original patch as it doesn't cause a regression anymore.
  8449. -
  8450. -This patch fixes an infinite loop on BCM4366 which is supported since
  8451. -4.4 so it makes sense to apply it to stable 4.4+.
  8452. -
  8453. -Cc: <stable@vger.kernel.org> # 4.4+
  8454. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  8455. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  8456. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  8457. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  8458. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  8459. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  8460. ----
  8461. -
  8462. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c
  8463. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c
  8464. -@@ -32,7 +32,7 @@
  8465. - #define BRCMF_FLOWRING_LOW (BRCMF_FLOWRING_HIGH - 256)
  8466. - #define BRCMF_FLOWRING_INVALID_IFIDX 0xff
  8467. -
  8468. --#define BRCMF_FLOWRING_HASH_AP(da, fifo, ifidx) (da[5] + fifo + ifidx * 16)
  8469. -+#define BRCMF_FLOWRING_HASH_AP(da, fifo, ifidx) (da[5] * 2 + fifo + ifidx * 16)
  8470. - #define BRCMF_FLOWRING_HASH_STA(fifo, ifidx) (fifo + ifidx * 16)
  8471. -
  8472. - static const u8 brcmf_flowring_prio2fifo[] = {
  8473. -@@ -68,7 +68,7 @@ u32 brcmf_flowring_lookup(struct brcmf_f
  8474. - u8 prio, u8 ifidx)
  8475. - {
  8476. - struct brcmf_flowring_hash *hash;
  8477. -- u8 hash_idx;
  8478. -+ u16 hash_idx;
  8479. - u32 i;
  8480. - bool found;
  8481. - bool sta;
  8482. -@@ -88,6 +88,7 @@ u32 brcmf_flowring_lookup(struct brcmf_f
  8483. - }
  8484. - hash_idx = sta ? BRCMF_FLOWRING_HASH_STA(fifo, ifidx) :
  8485. - BRCMF_FLOWRING_HASH_AP(mac, fifo, ifidx);
  8486. -+ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1);
  8487. - found = false;
  8488. - hash = flow->hash;
  8489. - for (i = 0; i < BRCMF_FLOWRING_HASHSIZE; i++) {
  8490. -@@ -98,6 +99,7 @@ u32 brcmf_flowring_lookup(struct brcmf_f
  8491. - break;
  8492. - }
  8493. - hash_idx++;
  8494. -+ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1);
  8495. - }
  8496. - if (found)
  8497. - return hash[hash_idx].flowid;
  8498. -@@ -111,7 +113,7 @@ u32 brcmf_flowring_create(struct brcmf_f
  8499. - {
  8500. - struct brcmf_flowring_ring *ring;
  8501. - struct brcmf_flowring_hash *hash;
  8502. -- u8 hash_idx;
  8503. -+ u16 hash_idx;
  8504. - u32 i;
  8505. - bool found;
  8506. - u8 fifo;
  8507. -@@ -131,6 +133,7 @@ u32 brcmf_flowring_create(struct brcmf_f
  8508. - }
  8509. - hash_idx = sta ? BRCMF_FLOWRING_HASH_STA(fifo, ifidx) :
  8510. - BRCMF_FLOWRING_HASH_AP(mac, fifo, ifidx);
  8511. -+ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1);
  8512. - found = false;
  8513. - hash = flow->hash;
  8514. - for (i = 0; i < BRCMF_FLOWRING_HASHSIZE; i++) {
  8515. -@@ -140,6 +143,7 @@ u32 brcmf_flowring_create(struct brcmf_f
  8516. - break;
  8517. - }
  8518. - hash_idx++;
  8519. -+ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1);
  8520. - }
  8521. - if (found) {
  8522. - for (i = 0; i < flow->nrofrings; i++) {
  8523. -@@ -169,7 +173,7 @@ u32 brcmf_flowring_create(struct brcmf_f
  8524. - }
  8525. -
  8526. -
  8527. --u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u8 flowid)
  8528. -+u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u16 flowid)
  8529. - {
  8530. - struct brcmf_flowring_ring *ring;
  8531. -
  8532. -@@ -179,7 +183,7 @@ u8 brcmf_flowring_tid(struct brcmf_flowr
  8533. - }
  8534. -
  8535. -
  8536. --static void brcmf_flowring_block(struct brcmf_flowring *flow, u8 flowid,
  8537. -+static void brcmf_flowring_block(struct brcmf_flowring *flow, u16 flowid,
  8538. - bool blocked)
  8539. - {
  8540. - struct brcmf_flowring_ring *ring;
  8541. -@@ -228,10 +232,10 @@ static void brcmf_flowring_block(struct
  8542. - }
  8543. -
  8544. -
  8545. --void brcmf_flowring_delete(struct brcmf_flowring *flow, u8 flowid)
  8546. -+void brcmf_flowring_delete(struct brcmf_flowring *flow, u16 flowid)
  8547. - {
  8548. - struct brcmf_flowring_ring *ring;
  8549. -- u8 hash_idx;
  8550. -+ u16 hash_idx;
  8551. - struct sk_buff *skb;
  8552. -
  8553. - ring = flow->rings[flowid];
  8554. -@@ -253,7 +257,7 @@ void brcmf_flowring_delete(struct brcmf_
  8555. - }
  8556. -
  8557. -
  8558. --u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  8559. -+u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u16 flowid,
  8560. - struct sk_buff *skb)
  8561. - {
  8562. - struct brcmf_flowring_ring *ring;
  8563. -@@ -279,7 +283,7 @@ u32 brcmf_flowring_enqueue(struct brcmf_
  8564. - }
  8565. -
  8566. -
  8567. --struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u8 flowid)
  8568. -+struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u16 flowid)
  8569. - {
  8570. - struct brcmf_flowring_ring *ring;
  8571. - struct sk_buff *skb;
  8572. -@@ -300,7 +304,7 @@ struct sk_buff *brcmf_flowring_dequeue(s
  8573. - }
  8574. -
  8575. -
  8576. --void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u8 flowid,
  8577. -+void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u16 flowid,
  8578. - struct sk_buff *skb)
  8579. - {
  8580. - struct brcmf_flowring_ring *ring;
  8581. -@@ -311,7 +315,7 @@ void brcmf_flowring_reinsert(struct brcm
  8582. - }
  8583. -
  8584. -
  8585. --u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u8 flowid)
  8586. -+u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u16 flowid)
  8587. - {
  8588. - struct brcmf_flowring_ring *ring;
  8589. -
  8590. -@@ -326,7 +330,7 @@ u32 brcmf_flowring_qlen(struct brcmf_flo
  8591. - }
  8592. -
  8593. -
  8594. --void brcmf_flowring_open(struct brcmf_flowring *flow, u8 flowid)
  8595. -+void brcmf_flowring_open(struct brcmf_flowring *flow, u16 flowid)
  8596. - {
  8597. - struct brcmf_flowring_ring *ring;
  8598. -
  8599. -@@ -340,10 +344,10 @@ void brcmf_flowring_open(struct brcmf_fl
  8600. - }
  8601. -
  8602. -
  8603. --u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u8 flowid)
  8604. -+u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u16 flowid)
  8605. - {
  8606. - struct brcmf_flowring_ring *ring;
  8607. -- u8 hash_idx;
  8608. -+ u16 hash_idx;
  8609. -
  8610. - ring = flow->rings[flowid];
  8611. - hash_idx = ring->hash_id;
  8612. -@@ -384,7 +388,7 @@ void brcmf_flowring_detach(struct brcmf_
  8613. - struct brcmf_pub *drvr = bus_if->drvr;
  8614. - struct brcmf_flowring_tdls_entry *search;
  8615. - struct brcmf_flowring_tdls_entry *remove;
  8616. -- u8 flowid;
  8617. -+ u16 flowid;
  8618. -
  8619. - for (flowid = 0; flowid < flow->nrofrings; flowid++) {
  8620. - if (flow->rings[flowid])
  8621. -@@ -408,7 +412,7 @@ void brcmf_flowring_configure_addr_mode(
  8622. - struct brcmf_bus *bus_if = dev_get_drvdata(flow->dev);
  8623. - struct brcmf_pub *drvr = bus_if->drvr;
  8624. - u32 i;
  8625. -- u8 flowid;
  8626. -+ u16 flowid;
  8627. -
  8628. - if (flow->addr_mode[ifidx] != addr_mode) {
  8629. - for (i = 0; i < ARRAY_SIZE(flow->hash); i++) {
  8630. -@@ -434,7 +438,7 @@ void brcmf_flowring_delete_peer(struct b
  8631. - struct brcmf_flowring_tdls_entry *prev;
  8632. - struct brcmf_flowring_tdls_entry *search;
  8633. - u32 i;
  8634. -- u8 flowid;
  8635. -+ u16 flowid;
  8636. - bool sta;
  8637. -
  8638. - sta = (flow->addr_mode[ifidx] == ADDR_INDIRECT);
  8639. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.h
  8640. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.h
  8641. -@@ -16,7 +16,7 @@
  8642. - #define BRCMFMAC_FLOWRING_H
  8643. -
  8644. -
  8645. --#define BRCMF_FLOWRING_HASHSIZE 256
  8646. -+#define BRCMF_FLOWRING_HASHSIZE 512 /* has to be 2^x */
  8647. - #define BRCMF_FLOWRING_INVALID_ID 0xFFFFFFFF
  8648. -
  8649. -
  8650. -@@ -24,7 +24,7 @@ struct brcmf_flowring_hash {
  8651. - u8 mac[ETH_ALEN];
  8652. - u8 fifo;
  8653. - u8 ifidx;
  8654. -- u8 flowid;
  8655. -+ u16 flowid;
  8656. - };
  8657. -
  8658. - enum ring_status {
  8659. -@@ -61,16 +61,16 @@ u32 brcmf_flowring_lookup(struct brcmf_f
  8660. - u8 prio, u8 ifidx);
  8661. - u32 brcmf_flowring_create(struct brcmf_flowring *flow, u8 da[ETH_ALEN],
  8662. - u8 prio, u8 ifidx);
  8663. --void brcmf_flowring_delete(struct brcmf_flowring *flow, u8 flowid);
  8664. --void brcmf_flowring_open(struct brcmf_flowring *flow, u8 flowid);
  8665. --u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u8 flowid);
  8666. --u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  8667. -+void brcmf_flowring_delete(struct brcmf_flowring *flow, u16 flowid);
  8668. -+void brcmf_flowring_open(struct brcmf_flowring *flow, u16 flowid);
  8669. -+u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u16 flowid);
  8670. -+u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u16 flowid,
  8671. - struct sk_buff *skb);
  8672. --struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u8 flowid);
  8673. --void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u8 flowid,
  8674. -+struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u16 flowid);
  8675. -+void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u16 flowid,
  8676. - struct sk_buff *skb);
  8677. --u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u8 flowid);
  8678. --u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u8 flowid);
  8679. -+u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u16 flowid);
  8680. -+u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u16 flowid);
  8681. - struct brcmf_flowring *brcmf_flowring_attach(struct device *dev, u16 nrofrings);
  8682. - void brcmf_flowring_detach(struct brcmf_flowring *flow);
  8683. - void brcmf_flowring_configure_addr_mode(struct brcmf_flowring *flow, int ifidx,
  8684. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  8685. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  8686. -@@ -677,7 +677,7 @@ static u32 brcmf_msgbuf_flowring_create(
  8687. - }
  8688. -
  8689. -
  8690. --static void brcmf_msgbuf_txflow(struct brcmf_msgbuf *msgbuf, u8 flowid)
  8691. -+static void brcmf_msgbuf_txflow(struct brcmf_msgbuf *msgbuf, u16 flowid)
  8692. - {
  8693. - struct brcmf_flowring *flow = msgbuf->flow;
  8694. - struct brcmf_commonring *commonring;
  8695. -@@ -1310,7 +1310,7 @@ int brcmf_proto_msgbuf_rx_trigger(struct
  8696. - }
  8697. -
  8698. -
  8699. --void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u8 flowid)
  8700. -+void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u16 flowid)
  8701. - {
  8702. - struct brcmf_msgbuf *msgbuf = (struct brcmf_msgbuf *)drvr->proto->pd;
  8703. - struct msgbuf_tx_flowring_delete_req *delete;
  8704. -@@ -1415,6 +1415,13 @@ int brcmf_proto_msgbuf_attach(struct brc
  8705. - u32 count;
  8706. -
  8707. - if_msgbuf = drvr->bus_if->msgbuf;
  8708. -+
  8709. -+ if (if_msgbuf->nrof_flowrings >= BRCMF_FLOWRING_HASHSIZE) {
  8710. -+ brcmf_err("driver not configured for this many flowrings %d\n",
  8711. -+ if_msgbuf->nrof_flowrings);
  8712. -+ if_msgbuf->nrof_flowrings = BRCMF_FLOWRING_HASHSIZE - 1;
  8713. -+ }
  8714. -+
  8715. - msgbuf = kzalloc(sizeof(*msgbuf), GFP_KERNEL);
  8716. - if (!msgbuf)
  8717. - goto fail;
  8718. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.h
  8719. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.h
  8720. -@@ -33,7 +33,7 @@
  8721. -
  8722. -
  8723. - int brcmf_proto_msgbuf_rx_trigger(struct device *dev);
  8724. --void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u8 flowid);
  8725. -+void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u16 flowid);
  8726. - int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr);
  8727. - void brcmf_proto_msgbuf_detach(struct brcmf_pub *drvr);
  8728. - #else
  8729. 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
  8730. deleted file mode 100644
  8731. index e414f23784163abfeba59d9e523e3684643c038a..0000000000000000000000000000000000000000
  8732. --- a/package/kernel/mac80211/patches/332-cfg80211-fix-faulty-variable-initialization-in-ieee8.patch
  8733. +++ /dev/null
  8734. @@ -1,22 +0,0 @@
  8735. -From: Felix Fietkau <nbd@openwrt.org>
  8736. -Date: Mon, 8 Feb 2016 14:24:36 +0100
  8737. -Subject: [PATCH] cfg80211: fix faulty variable initialization in
  8738. - ieee80211_amsdu_to_8023s
  8739. -
  8740. -reuse_skb is set to true if the code decides to use the last segment.
  8741. -Fixes a memory leak
  8742. -
  8743. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  8744. ----
  8745. -
  8746. ---- a/net/wireless/util.c
  8747. -+++ b/net/wireless/util.c
  8748. -@@ -676,7 +676,7 @@ void ieee80211_amsdu_to_8023s(struct sk_
  8749. - u8 *payload;
  8750. - int offset = 0, remaining, err;
  8751. - struct ethhdr eth;
  8752. -- bool reuse_skb = true;
  8753. -+ bool reuse_skb = false;
  8754. - bool last = false;
  8755. -
  8756. - if (has_80211_header) {
  8757. 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
  8758. deleted file mode 100644
  8759. index 6e2d0cf5b0783860cb39264e33ecdef622fcc548..0000000000000000000000000000000000000000
  8760. --- a/package/kernel/mac80211/patches/333-cfg80211-reuse-existing-page-fragments-in-A-MSDU-rx.patch
  8761. +++ /dev/null
  8762. @@ -1,132 +0,0 @@
  8763. -From: Felix Fietkau <nbd@openwrt.org>
  8764. -Date: Mon, 8 Feb 2016 14:33:19 +0100
  8765. -Subject: [PATCH] cfg80211: reuse existing page fragments in A-MSDU rx
  8766. -
  8767. -This massively reduces data copying and thus improves rx performance
  8768. -
  8769. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  8770. ----
  8771. -
  8772. ---- a/net/wireless/util.c
  8773. -+++ b/net/wireless/util.c
  8774. -@@ -644,23 +644,93 @@ int ieee80211_data_from_8023(struct sk_b
  8775. - }
  8776. - EXPORT_SYMBOL(ieee80211_data_from_8023);
  8777. -
  8778. -+static void
  8779. -+__frame_add_frag(struct sk_buff *skb, struct page *page,
  8780. -+ void *ptr, int len, int size)
  8781. -+{
  8782. -+ struct skb_shared_info *sh = skb_shinfo(skb);
  8783. -+ int page_offset;
  8784. -+
  8785. -+ atomic_inc(&page->_count);
  8786. -+ page_offset = ptr - page_address(page);
  8787. -+ skb_add_rx_frag(skb, sh->nr_frags, page, page_offset, len, size);
  8788. -+}
  8789. -+
  8790. -+static void
  8791. -+__ieee80211_amsdu_copy_frag(struct sk_buff *skb, struct sk_buff *frame,
  8792. -+ int offset, int len)
  8793. -+{
  8794. -+ struct skb_shared_info *sh = skb_shinfo(skb);
  8795. -+ const skb_frag_t *frag = &sh->frags[-1];
  8796. -+ struct page *frag_page;
  8797. -+ void *frag_ptr;
  8798. -+ int frag_len, frag_size;
  8799. -+ int head_size = skb->len - skb->data_len;
  8800. -+ int cur_len;
  8801. -+
  8802. -+ frag_page = virt_to_head_page(skb->head);
  8803. -+ frag_ptr = skb->data;
  8804. -+ frag_size = head_size;
  8805. -+
  8806. -+ while (offset >= frag_size) {
  8807. -+ offset -= frag_size;
  8808. -+ frag++;
  8809. -+ frag_page = skb_frag_page(frag);
  8810. -+ frag_ptr = skb_frag_address(frag);
  8811. -+ frag_size = skb_frag_size(frag);
  8812. -+ }
  8813. -+
  8814. -+ frag_ptr += offset;
  8815. -+ frag_len = frag_size - offset;
  8816. -+
  8817. -+ cur_len = min(len, frag_len);
  8818. -+
  8819. -+ __frame_add_frag(frame, frag_page, frag_ptr, cur_len, frag_size);
  8820. -+ len -= cur_len;
  8821. -+
  8822. -+ while (len > 0) {
  8823. -+ frag++;
  8824. -+ frag_len = skb_frag_size(frag);
  8825. -+ cur_len = min(len, frag_len);
  8826. -+ __frame_add_frag(frame, skb_frag_page(frag),
  8827. -+ skb_frag_address(frag), cur_len, frag_len);
  8828. -+ len -= cur_len;
  8829. -+ }
  8830. -+}
  8831. -+
  8832. - static struct sk_buff *
  8833. - __ieee80211_amsdu_copy(struct sk_buff *skb, unsigned int hlen,
  8834. -- int offset, int len)
  8835. -+ int offset, int len, bool reuse_frag)
  8836. - {
  8837. - struct sk_buff *frame;
  8838. -+ int cur_len = len;
  8839. -
  8840. - if (skb->len - offset < len)
  8841. - return NULL;
  8842. -
  8843. - /*
  8844. -+ * When reusing framents, copy some data to the head to simplify
  8845. -+ * ethernet header handling and speed up protocol header processing
  8846. -+ * in the stack later.
  8847. -+ */
  8848. -+ if (reuse_frag)
  8849. -+ cur_len = min_t(int, len, 32);
  8850. -+
  8851. -+ /*
  8852. - * Allocate and reserve two bytes more for payload
  8853. - * alignment since sizeof(struct ethhdr) is 14.
  8854. - */
  8855. -- frame = dev_alloc_skb(hlen + sizeof(struct ethhdr) + 2 + len);
  8856. -+ frame = dev_alloc_skb(hlen + sizeof(struct ethhdr) + 2 + cur_len);
  8857. -
  8858. - skb_reserve(frame, hlen + sizeof(struct ethhdr) + 2);
  8859. -- skb_copy_bits(skb, offset, skb_put(frame, len), len);
  8860. -+ skb_copy_bits(skb, offset, skb_put(frame, cur_len), cur_len);
  8861. -+
  8862. -+ len -= cur_len;
  8863. -+ if (!len)
  8864. -+ return frame;
  8865. -+
  8866. -+ offset += cur_len;
  8867. -+ __ieee80211_amsdu_copy_frag(skb, frame, offset, len);
  8868. -
  8869. - return frame;
  8870. - }
  8871. -@@ -676,6 +746,7 @@ void ieee80211_amsdu_to_8023s(struct sk_
  8872. - u8 *payload;
  8873. - int offset = 0, remaining, err;
  8874. - struct ethhdr eth;
  8875. -+ bool reuse_frag = skb->head_frag && !skb_has_frag_list(skb);
  8876. - bool reuse_skb = false;
  8877. - bool last = false;
  8878. -
  8879. -@@ -703,12 +774,13 @@ void ieee80211_amsdu_to_8023s(struct sk_
  8880. - offset += sizeof(struct ethhdr);
  8881. - /* reuse skb for the last subframe */
  8882. - last = remaining <= subframe_len + padding;
  8883. -- if (!skb_is_nonlinear(skb) && last) {
  8884. -+ if (!skb_is_nonlinear(skb) && !reuse_frag && last) {
  8885. - skb_pull(skb, offset);
  8886. - frame = skb;
  8887. - reuse_skb = true;
  8888. - } else {
  8889. -- frame = __ieee80211_amsdu_copy(skb, hlen, offset, len);
  8890. -+ frame = __ieee80211_amsdu_copy(skb, hlen, offset, len,
  8891. -+ reuse_frag);
  8892. - if (!frame)
  8893. - goto purge;
  8894. -
  8895. 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
  8896. deleted file mode 100644
  8897. index f8f4f0999dd2185090fdffef1d80629f15a67dd2..0000000000000000000000000000000000000000
  8898. --- a/package/kernel/mac80211/patches/334-mac80211-fix-wiphy-supported_band-access.patch
  8899. +++ /dev/null
  8900. @@ -1,36 +0,0 @@
  8901. -From: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  8902. -Date: Wed, 10 Feb 2016 16:08:17 +0100
  8903. -Subject: [PATCH] mac80211: fix wiphy supported_band access
  8904. -
  8905. -Fix wiphy supported_band access in tx radiotap parsing. In particular,
  8906. -info->band is always set to 0 (IEEE80211_BAND_2GHZ) since it has not
  8907. -assigned yet. This cause a kernel crash on 5GHz only devices.
  8908. -Move ieee80211_parse_tx_radiotap() after info->band assignment
  8909. -
  8910. -Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  8911. ----
  8912. -
  8913. ---- a/net/mac80211/tx.c
  8914. -+++ b/net/mac80211/tx.c
  8915. -@@ -1890,10 +1890,6 @@ netdev_tx_t ieee80211_monitor_start_xmit
  8916. - info->flags = IEEE80211_TX_CTL_REQ_TX_STATUS |
  8917. - IEEE80211_TX_CTL_INJECTED;
  8918. -
  8919. -- /* process and remove the injection radiotap header */
  8920. -- if (!ieee80211_parse_tx_radiotap(local, skb))
  8921. -- goto fail;
  8922. --
  8923. - rcu_read_lock();
  8924. -
  8925. - /*
  8926. -@@ -1955,6 +1951,10 @@ netdev_tx_t ieee80211_monitor_start_xmit
  8927. - goto fail_rcu;
  8928. -
  8929. - info->band = chandef->chan->band;
  8930. -+ /* process and remove the injection radiotap header */
  8931. -+ if (!ieee80211_parse_tx_radiotap(local, skb))
  8932. -+ goto fail_rcu;
  8933. -+
  8934. - ieee80211_xmit(sdata, NULL, skb);
  8935. - rcu_read_unlock();
  8936. -
  8937. 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
  8938. deleted file mode 100644
  8939. index acaacf7cacc3ecf380dd69794aaa6b07b5403708..0000000000000000000000000000000000000000
  8940. --- a/package/kernel/mac80211/patches/335-mac80211-minstrel_ht-set-A-MSDU-tx-limits-based-on-s.patch
  8941. +++ /dev/null
  8942. @@ -1,61 +0,0 @@
  8943. -From: Felix Fietkau <nbd@openwrt.org>
  8944. -Date: Thu, 18 Feb 2016 19:30:05 +0100
  8945. -Subject: [PATCH] mac80211: minstrel_ht: set A-MSDU tx limits based on selected
  8946. - max_prob_rate
  8947. -
  8948. -Prevents excessive A-MSDU aggregation at low data rates or bad
  8949. -conditions.
  8950. -
  8951. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  8952. ----
  8953. -
  8954. ---- a/net/mac80211/rc80211_minstrel_ht.c
  8955. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  8956. -@@ -883,6 +883,39 @@ minstrel_ht_set_rate(struct minstrel_pri
  8957. - ratetbl->rate[offset].flags = flags;
  8958. - }
  8959. -
  8960. -+static int
  8961. -+minstrel_ht_get_max_amsdu_len(struct minstrel_ht_sta *mi)
  8962. -+{
  8963. -+ int group = mi->max_prob_rate / MCS_GROUP_RATES;
  8964. -+ const struct mcs_group *g = &minstrel_mcs_groups[group];
  8965. -+ int rate = mi->max_prob_rate % MCS_GROUP_RATES;
  8966. -+
  8967. -+ /* Disable A-MSDU if max_prob_rate is bad */
  8968. -+ if (mi->groups[group].rates[rate].prob_ewma < MINSTREL_FRAC(50, 100))
  8969. -+ return 1;
  8970. -+
  8971. -+ /* If the rate is slower than single-stream MCS1, make A-MSDU limit small */
  8972. -+ if (g->duration[rate] > MCS_DURATION(1, 0, 52))
  8973. -+ return 500;
  8974. -+
  8975. -+ /*
  8976. -+ * If the rate is slower than single-stream MCS4, limit A-MSDU to usual
  8977. -+ * data packet size
  8978. -+ */
  8979. -+ if (g->duration[rate] > MCS_DURATION(1, 0, 104))
  8980. -+ return 1500;
  8981. -+
  8982. -+ /*
  8983. -+ * If the rate is slower than single-stream MCS7, limit A-MSDU to twice
  8984. -+ * the usual data packet size
  8985. -+ */
  8986. -+ if (g->duration[rate] > MCS_DURATION(1, 0, 260))
  8987. -+ return 3000;
  8988. -+
  8989. -+ /* unlimited */
  8990. -+ return 0;
  8991. -+}
  8992. -+
  8993. - static void
  8994. - minstrel_ht_update_rates(struct minstrel_priv *mp, struct minstrel_ht_sta *mi)
  8995. - {
  8996. -@@ -907,6 +940,7 @@ minstrel_ht_update_rates(struct minstrel
  8997. - minstrel_ht_set_rate(mp, mi, rates, i++, mi->max_prob_rate);
  8998. - }
  8999. -
  9000. -+ mi->sta->max_rc_amsdu_len = minstrel_ht_get_max_amsdu_len(mi);
  9001. - rates->rate[i].idx = -1;
  9002. - rate_control_set_rates(mp->hw, mi->sta, rates);
  9003. - }
  9004. 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
  9005. deleted file mode 100644
  9006. index 32a2ad6f0bcdafc499f257b6f925aaf0499e24c0..0000000000000000000000000000000000000000
  9007. --- a/package/kernel/mac80211/patches/336-mac80211-minstrel_ht-set-default-tx-aggregation-time.patch
  9008. +++ /dev/null
  9009. @@ -1,31 +0,0 @@
  9010. -From: Felix Fietkau <nbd@openwrt.org>
  9011. -Date: Thu, 18 Feb 2016 19:45:33 +0100
  9012. -Subject: [PATCH] mac80211: minstrel_ht: set default tx aggregation timeout to
  9013. - 0
  9014. -
  9015. -The value 5000 was put here with the addition of the timeout field to
  9016. -ieee80211_start_tx_ba_session. It was originally added in mac80211 to
  9017. -save resources for drivers like iwlwifi, which only supports a limited
  9018. -number of concurrent aggregation sessions.
  9019. -
  9020. -Since iwlwifi does not use minstrel_ht and other drivers don't need
  9021. -this, 0 is a better default - especially since there have been
  9022. -recent reports of aggregation setup related issues reproduced with
  9023. -ath9k. This should improve stability without causing any adverse
  9024. -effects.
  9025. -
  9026. -Cc: stable@vger.kernel.org
  9027. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  9028. ----
  9029. -
  9030. ---- a/net/mac80211/rc80211_minstrel_ht.c
  9031. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  9032. -@@ -692,7 +692,7 @@ minstrel_aggr_check(struct ieee80211_sta
  9033. - if (likely(sta->ampdu_mlme.tid_tx[tid]))
  9034. - return;
  9035. -
  9036. -- ieee80211_start_tx_ba_session(pubsta, tid, 5000);
  9037. -+ ieee80211_start_tx_ba_session(pubsta, tid, 0);
  9038. - }
  9039. -
  9040. - static void
  9041. 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
  9042. deleted file mode 100644
  9043. index 229351ba56802ef44fae5fe5f88a3ffbb0ada098..0000000000000000000000000000000000000000
  9044. --- a/package/kernel/mac80211/patches/337-mac80211-minstrel_ht-fix-a-logic-error-in-RTS-CTS-ha.patch
  9045. +++ /dev/null
  9046. @@ -1,26 +0,0 @@
  9047. -From: Felix Fietkau <nbd@openwrt.org>
  9048. -Date: Wed, 24 Feb 2016 12:03:13 +0100
  9049. -Subject: [PATCH] mac80211: minstrel_ht: fix a logic error in RTS/CTS handling
  9050. -MIME-Version: 1.0
  9051. -Content-Type: text/plain; charset=UTF-8
  9052. -Content-Transfer-Encoding: 8bit
  9053. -
  9054. -RTS/CTS needs to be enabled if the rate is a fallback rate *or* if it's
  9055. -a dual-stream rate and the sta is in dynamic SMPS mode.
  9056. -
  9057. -Fixes: a3ebb4e1b763 ("mac80211: minstrel_ht: handle peers in dynamic SMPS")
  9058. -Reported-by: Matías Richart <mrichart@fing.edu.uy>
  9059. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  9060. ----
  9061. -
  9062. ---- a/net/mac80211/rc80211_minstrel_ht.c
  9063. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  9064. -@@ -872,7 +872,7 @@ minstrel_ht_set_rate(struct minstrel_pri
  9065. - * - if station is in dynamic SMPS (and streams > 1)
  9066. - * - for fallback rates, to increase chances of getting through
  9067. - */
  9068. -- if (offset > 0 &&
  9069. -+ if (offset > 0 ||
  9070. - (mi->sta->smps_mode == IEEE80211_SMPS_DYNAMIC &&
  9071. - group->streams > 1)) {
  9072. - ratetbl->rate[offset].count = ratetbl->rate[offset].count_rts;
  9073. 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
  9074. deleted file mode 100644
  9075. index 56cd94aa152169fa4e98cd16dbf8a251dca4ca8a..0000000000000000000000000000000000000000
  9076. --- a/package/kernel/mac80211/patches/338-mac80211-Fix-Public-Action-frame-RX-in-AP-mode.patch
  9077. +++ /dev/null
  9078. @@ -1,35 +0,0 @@
  9079. -From: Jouni Malinen <jouni@qca.qualcomm.com>
  9080. -Date: Tue, 1 Mar 2016 00:29:00 +0200
  9081. -Subject: [PATCH] mac80211: Fix Public Action frame RX in AP mode
  9082. -
  9083. -Public Action frames use special rules for how the BSSID field (Address
  9084. -3) is set. A wildcard BSSID is used in cases where the transmitter and
  9085. -recipient are not members of the same BSS. As such, we need to accept
  9086. -Public Action frames with wildcard BSSID.
  9087. -
  9088. -Commit db8e17324553 ("mac80211: ignore frames between TDLS peers when
  9089. -operating as AP") added a rule that drops Action frames to TDLS-peers
  9090. -based on an Action frame having different DA (Address 1) and BSSID
  9091. -(Address 3) values. This is not correct since it misses the possibility
  9092. -of BSSID being a wildcard BSSID in which case the Address 1 would not
  9093. -necessarily match.
  9094. -
  9095. -Fix this by allowing mac80211 to accept wildcard BSSID in an Action
  9096. -frame when in AP mode.
  9097. -
  9098. -Fixes: db8e17324553 ("mac80211: ignore frames between TDLS peers when operating as AP")
  9099. -Cc: stable@vger.kernel.org
  9100. -Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
  9101. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  9102. ----
  9103. -
  9104. ---- a/net/mac80211/rx.c
  9105. -+++ b/net/mac80211/rx.c
  9106. -@@ -3374,6 +3374,7 @@ static bool ieee80211_accept_frame(struc
  9107. - return false;
  9108. - /* ignore action frames to TDLS-peers */
  9109. - if (ieee80211_is_action(hdr->frame_control) &&
  9110. -+ !is_broadcast_ether_addr(bssid) &&
  9111. - !ether_addr_equal(bssid, hdr->addr1))
  9112. - return false;
  9113. - }
  9114. 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
  9115. deleted file mode 100644
  9116. index 15d6cd03eae1c5b2380cb718238762cbf5f5a5b6..0000000000000000000000000000000000000000
  9117. --- a/package/kernel/mac80211/patches/339-cfg80211-add-radiotap-VHT-info-to-rtap_namespace_siz.patch
  9118. +++ /dev/null
  9119. @@ -1,21 +0,0 @@
  9120. -From: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  9121. -Date: Fri, 19 Feb 2016 11:43:04 +0100
  9122. -Subject: [PATCH] cfg80211: add radiotap VHT info to rtap_namespace_sizes
  9123. -
  9124. -Add IEEE80211_RADIOTAP_VHT entry to rtap_namespace_sizes array in order to
  9125. -define alignment and size of VHT info in tx radiotap
  9126. -
  9127. -Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  9128. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  9129. ----
  9130. -
  9131. ---- a/net/wireless/radiotap.c
  9132. -+++ b/net/wireless/radiotap.c
  9133. -@@ -43,6 +43,7 @@ static const struct radiotap_align_size
  9134. - [IEEE80211_RADIOTAP_DATA_RETRIES] = { .align = 1, .size = 1, },
  9135. - [IEEE80211_RADIOTAP_MCS] = { .align = 1, .size = 3, },
  9136. - [IEEE80211_RADIOTAP_AMPDU_STATUS] = { .align = 4, .size = 8, },
  9137. -+ [IEEE80211_RADIOTAP_VHT] = { .align = 2, .size = 12, },
  9138. - /*
  9139. - * add more here as they are defined in radiotap.h
  9140. - */
  9141. 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
  9142. deleted file mode 100644
  9143. index de1b38625c3845be51df0f34c2b82290651ca4be..0000000000000000000000000000000000000000
  9144. --- a/package/kernel/mac80211/patches/340-mac80211-fix-parsing-of-40Mhz-in-injected-radiotap-h.patch
  9145. +++ /dev/null
  9146. @@ -1,36 +0,0 @@
  9147. -From: Sven Eckelmann <sven@narfation.org>
  9148. -Date: Wed, 24 Feb 2016 16:25:49 +0100
  9149. -Subject: [PATCH] mac80211: fix parsing of 40Mhz in injected radiotap
  9150. - header
  9151. -
  9152. -The MCS bandwidth part of the radiotap header is 2 bits wide. The full 2
  9153. -bit have to compared against IEEE80211_RADIOTAP_MCS_BW_40 and not only if
  9154. -the first bit is set. Otherwise IEEE80211_RADIOTAP_MCS_BW_40 can be
  9155. -confused with IEEE80211_RADIOTAP_MCS_BW_20U.
  9156. -
  9157. -Fixes: 5ec3aed9ba4c ("mac80211: Parse legacy and HT rate in injected frames")
  9158. -Signed-off-by: Sven Eckelmann <sven@narfation.org>
  9159. ----
  9160. -
  9161. ---- a/net/mac80211/tx.c
  9162. -+++ b/net/mac80211/tx.c
  9163. -@@ -1689,7 +1689,7 @@ static bool ieee80211_parse_tx_radiotap(
  9164. - bool rate_found = false;
  9165. - u8 rate_retries = 0;
  9166. - u16 rate_flags = 0;
  9167. -- u8 mcs_known, mcs_flags;
  9168. -+ u8 mcs_known, mcs_flags, mcs_bw;
  9169. - int i;
  9170. -
  9171. - info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT |
  9172. -@@ -1765,8 +1765,9 @@ static bool ieee80211_parse_tx_radiotap(
  9173. - mcs_flags & IEEE80211_RADIOTAP_MCS_SGI)
  9174. - rate_flags |= IEEE80211_TX_RC_SHORT_GI;
  9175. -
  9176. -+ mcs_bw = mcs_flags & IEEE80211_RADIOTAP_MCS_BW_MASK;
  9177. - if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_BW &&
  9178. -- mcs_flags & IEEE80211_RADIOTAP_MCS_BW_40)
  9179. -+ mcs_bw == IEEE80211_RADIOTAP_MCS_BW_40)
  9180. - rate_flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
  9181. - break;
  9182. -
  9183. 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
  9184. deleted file mode 100644
  9185. index ac1f2517f29973c74cdd32301b32d1be93fcefb1..0000000000000000000000000000000000000000
  9186. --- a/package/kernel/mac80211/patches/341-mac80211-parse-VHT-info-in-injected-frames.patch
  9187. +++ /dev/null
  9188. @@ -1,65 +0,0 @@
  9189. -From: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  9190. -Date: Tue, 23 Feb 2016 15:43:35 +0100
  9191. -Subject: [PATCH] mac80211: parse VHT info in injected frames
  9192. -
  9193. -Add VHT radiotap parsing support to ieee80211_parse_tx_radiotap().
  9194. -That capability has been tested using a d-link dir-860l rev b1 running
  9195. -OpenWrt trunk and mt76 driver
  9196. -
  9197. -Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  9198. ----
  9199. -
  9200. ---- a/net/mac80211/tx.c
  9201. -+++ b/net/mac80211/tx.c
  9202. -@@ -1690,6 +1690,8 @@ static bool ieee80211_parse_tx_radiotap(
  9203. - u8 rate_retries = 0;
  9204. - u16 rate_flags = 0;
  9205. - u8 mcs_known, mcs_flags, mcs_bw;
  9206. -+ u16 vht_known;
  9207. -+ u8 vht_mcs = 0, vht_nss = 0;
  9208. - int i;
  9209. -
  9210. - info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT |
  9211. -@@ -1771,6 +1773,32 @@ static bool ieee80211_parse_tx_radiotap(
  9212. - rate_flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
  9213. - break;
  9214. -
  9215. -+ case IEEE80211_RADIOTAP_VHT:
  9216. -+ vht_known = get_unaligned_le16(iterator.this_arg);
  9217. -+ rate_found = true;
  9218. -+
  9219. -+ rate_flags = IEEE80211_TX_RC_VHT_MCS;
  9220. -+ if ((vht_known & IEEE80211_RADIOTAP_VHT_KNOWN_GI) &&
  9221. -+ (iterator.this_arg[2] &
  9222. -+ IEEE80211_RADIOTAP_VHT_FLAG_SGI))
  9223. -+ rate_flags |= IEEE80211_TX_RC_SHORT_GI;
  9224. -+ if (vht_known &
  9225. -+ IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH) {
  9226. -+ if (iterator.this_arg[3] == 1)
  9227. -+ rate_flags |=
  9228. -+ IEEE80211_TX_RC_40_MHZ_WIDTH;
  9229. -+ else if (iterator.this_arg[3] == 4)
  9230. -+ rate_flags |=
  9231. -+ IEEE80211_TX_RC_80_MHZ_WIDTH;
  9232. -+ else if (iterator.this_arg[3] == 11)
  9233. -+ rate_flags |=
  9234. -+ IEEE80211_TX_RC_160_MHZ_WIDTH;
  9235. -+ }
  9236. -+
  9237. -+ vht_mcs = iterator.this_arg[4] >> 4;
  9238. -+ vht_nss = iterator.this_arg[4] & 0xF;
  9239. -+ break;
  9240. -+
  9241. - /*
  9242. - * Please update the file
  9243. - * Documentation/networking/mac80211-injection.txt
  9244. -@@ -1796,6 +1824,9 @@ static bool ieee80211_parse_tx_radiotap(
  9245. -
  9246. - if (rate_flags & IEEE80211_TX_RC_MCS) {
  9247. - info->control.rates[0].idx = rate;
  9248. -+ } else if (rate_flags & IEEE80211_TX_RC_VHT_MCS) {
  9249. -+ ieee80211_rate_set_vht(info->control.rates, vht_mcs,
  9250. -+ vht_nss);
  9251. - } else {
  9252. - for (i = 0; i < sband->n_bitrates; i++) {
  9253. - if (rate * 5 != sband->bitrates[i].bitrate)
  9254. 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
  9255. deleted file mode 100644
  9256. index d7452c29c1fad9ee170199c33b260161b603032a..0000000000000000000000000000000000000000
  9257. --- a/package/kernel/mac80211/patches/342-mac80211-do-not-pass-injected-frames-without-a-valid.patch
  9258. +++ /dev/null
  9259. @@ -1,23 +0,0 @@
  9260. -From: Felix Fietkau <nbd@openwrt.org>
  9261. -Date: Wed, 2 Mar 2016 15:51:40 +0100
  9262. -Subject: [PATCH] mac80211: do not pass injected frames without a valid rate to
  9263. - the driver
  9264. -
  9265. -Fall back to rate control if the requested bitrate was not found.
  9266. -
  9267. -Fixes: dfdfc2beb0dd ("mac80211: Parse legacy and HT rate in injected frames")
  9268. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  9269. ----
  9270. -
  9271. ---- a/net/mac80211/tx.c
  9272. -+++ b/net/mac80211/tx.c
  9273. -@@ -1837,6 +1837,9 @@ static bool ieee80211_parse_tx_radiotap(
  9274. - }
  9275. - }
  9276. -
  9277. -+ if (info->control.rates[0].idx < 0)
  9278. -+ info->control.flags &= ~IEEE80211_TX_CTRL_RATE_INJECT;
  9279. -+
  9280. - info->control.rates[0].flags = rate_flags;
  9281. - info->control.rates[0].count = min_t(u8, rate_retries + 1,
  9282. - local->hw.max_rate_tries);
  9283. 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
  9284. deleted file mode 100644
  9285. index 55ff817009294fde4c61548f95a49ca506d15b4d..0000000000000000000000000000000000000000
  9286. --- a/package/kernel/mac80211/patches/343-mac80211-minstrel_ht-improve-sample-rate-skip-logic.patch
  9287. +++ /dev/null
  9288. @@ -1,77 +0,0 @@
  9289. -From: Felix Fietkau <nbd@openwrt.org>
  9290. -Date: Thu, 3 Mar 2016 23:20:06 +0100
  9291. -Subject: [PATCH] mac80211: minstrel_ht: improve sample rate skip logic
  9292. -
  9293. -There were a few issues that were slowing down the process of finding
  9294. -the optimal rate, especially on devices with multi-rate retry
  9295. -limitations:
  9296. -
  9297. -When max_tp_rate[0] was slower than max_tp_rate[1], the code did not
  9298. -sample max_tp_rate[1], which would often allow it to switch places with
  9299. -max_tp_rate[0] (e.g. if only the first sampling attempts were bad, but the
  9300. -rate is otherwise good).
  9301. -
  9302. -Also, sample attempts of rates between max_tp_rate[0] and [1] were being
  9303. -ignored in this case, because the code only checked if the rate was
  9304. -slower than [1].
  9305. -
  9306. -Fix this by checking against the fastest / second fastest max_tp_rate
  9307. -instead of assuming a specific order between the two.
  9308. -
  9309. -In my tests this patch significantly reduces the time until minstrel_ht
  9310. -finds the optimal rate right after assoc
  9311. -
  9312. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  9313. ----
  9314. -
  9315. ---- a/net/mac80211/rc80211_minstrel_ht.c
  9316. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  9317. -@@ -958,6 +958,7 @@ minstrel_get_sample_rate(struct minstrel
  9318. - struct minstrel_rate_stats *mrs;
  9319. - struct minstrel_mcs_group_data *mg;
  9320. - unsigned int sample_dur, sample_group, cur_max_tp_streams;
  9321. -+ int tp_rate1, tp_rate2;
  9322. - int sample_idx = 0;
  9323. -
  9324. - if (mi->sample_wait > 0) {
  9325. -@@ -979,14 +980,22 @@ minstrel_get_sample_rate(struct minstrel
  9326. - mrs = &mg->rates[sample_idx];
  9327. - sample_idx += sample_group * MCS_GROUP_RATES;
  9328. -
  9329. -+ /* Set tp_rate1, tp_rate2 to the highest / second highest max_tp_rate */
  9330. -+ if (minstrel_get_duration(mi->max_tp_rate[0]) >
  9331. -+ minstrel_get_duration(mi->max_tp_rate[1])) {
  9332. -+ tp_rate1 = mi->max_tp_rate[1];
  9333. -+ tp_rate2 = mi->max_tp_rate[0];
  9334. -+ } else {
  9335. -+ tp_rate1 = mi->max_tp_rate[0];
  9336. -+ tp_rate2 = mi->max_tp_rate[1];
  9337. -+ }
  9338. -+
  9339. - /*
  9340. - * Sampling might add some overhead (RTS, no aggregation)
  9341. -- * to the frame. Hence, don't use sampling for the currently
  9342. -- * used rates.
  9343. -+ * to the frame. Hence, don't use sampling for the highest currently
  9344. -+ * used highest throughput or probability rate.
  9345. - */
  9346. -- if (sample_idx == mi->max_tp_rate[0] ||
  9347. -- sample_idx == mi->max_tp_rate[1] ||
  9348. -- sample_idx == mi->max_prob_rate)
  9349. -+ if (sample_idx == mi->max_tp_rate[0] || sample_idx == mi->max_prob_rate)
  9350. - return -1;
  9351. -
  9352. - /*
  9353. -@@ -1001,10 +1010,10 @@ minstrel_get_sample_rate(struct minstrel
  9354. - * if the link is working perfectly.
  9355. - */
  9356. -
  9357. -- cur_max_tp_streams = minstrel_mcs_groups[mi->max_tp_rate[0] /
  9358. -+ cur_max_tp_streams = minstrel_mcs_groups[tp_rate1 /
  9359. - MCS_GROUP_RATES].streams;
  9360. - sample_dur = minstrel_get_duration(sample_idx);
  9361. -- if (sample_dur >= minstrel_get_duration(mi->max_tp_rate[1]) &&
  9362. -+ if (sample_dur >= minstrel_get_duration(tp_rate2) &&
  9363. - (cur_max_tp_streams - 1 <
  9364. - minstrel_mcs_groups[sample_group].streams ||
  9365. - sample_dur >= minstrel_get_duration(mi->max_prob_rate))) {
  9366. 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
  9367. deleted file mode 100644
  9368. index e3427de732787befec7f0f738efb3cc85a00aa0d..0000000000000000000000000000000000000000
  9369. --- a/package/kernel/mac80211/patches/344-0001-brcmfmac-change-function-name-for-brcmf_cfg80211_wai.patch
  9370. +++ /dev/null
  9371. @@ -1,99 +0,0 @@
  9372. -From: Arend van Spriel <arend@broadcom.com>
  9373. -Date: Wed, 17 Feb 2016 11:26:50 +0100
  9374. -Subject: [PATCH] brcmfmac: change function name for
  9375. - brcmf_cfg80211_wait_vif_event_timeout()
  9376. -
  9377. -Dropping the '_timeout' from the function name as the fact that a timeout
  9378. -value is passed makes it obvious a timeout is used. Also helps to keep code
  9379. -lines a bit shorter and easier to stick to 80 char boundary.
  9380. -
  9381. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  9382. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  9383. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  9384. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9385. ----
  9386. -
  9387. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  9388. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  9389. -@@ -564,8 +564,8 @@ struct wireless_dev *brcmf_ap_add_vif(st
  9390. - }
  9391. -
  9392. - /* wait for firmware event */
  9393. -- err = brcmf_cfg80211_wait_vif_event_timeout(cfg, BRCMF_E_IF_ADD,
  9394. -- BRCMF_VIF_EVENT_TIMEOUT);
  9395. -+ err = brcmf_cfg80211_wait_vif_event(cfg, BRCMF_E_IF_ADD,
  9396. -+ BRCMF_VIF_EVENT_TIMEOUT);
  9397. - brcmf_cfg80211_arm_vif_event(cfg, NULL);
  9398. - if (!err) {
  9399. - brcmf_err("timeout occurred\n");
  9400. -@@ -6395,8 +6395,9 @@ bool brcmf_cfg80211_vif_event_armed(stru
  9401. -
  9402. - return armed;
  9403. - }
  9404. --int brcmf_cfg80211_wait_vif_event_timeout(struct brcmf_cfg80211_info *cfg,
  9405. -- u8 action, ulong timeout)
  9406. -+
  9407. -+int brcmf_cfg80211_wait_vif_event(struct brcmf_cfg80211_info *cfg,
  9408. -+ u8 action, ulong timeout)
  9409. - {
  9410. - struct brcmf_cfg80211_vif_event *event = &cfg->vif_event;
  9411. -
  9412. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  9413. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  9414. -@@ -402,8 +402,8 @@ bool brcmf_get_vif_state_any(struct brcm
  9415. - void brcmf_cfg80211_arm_vif_event(struct brcmf_cfg80211_info *cfg,
  9416. - struct brcmf_cfg80211_vif *vif);
  9417. - bool brcmf_cfg80211_vif_event_armed(struct brcmf_cfg80211_info *cfg);
  9418. --int brcmf_cfg80211_wait_vif_event_timeout(struct brcmf_cfg80211_info *cfg,
  9419. -- u8 action, ulong timeout);
  9420. -+int brcmf_cfg80211_wait_vif_event(struct brcmf_cfg80211_info *cfg,
  9421. -+ u8 action, ulong timeout);
  9422. - s32 brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg,
  9423. - struct brcmf_if *ifp, bool aborted,
  9424. - bool fw_abort);
  9425. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  9426. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  9427. -@@ -1988,8 +1988,8 @@ int brcmf_p2p_ifchange(struct brcmf_cfg8
  9428. - brcmf_cfg80211_arm_vif_event(cfg, NULL);
  9429. - return err;
  9430. - }
  9431. -- err = brcmf_cfg80211_wait_vif_event_timeout(cfg, BRCMF_E_IF_CHANGE,
  9432. -- BRCMF_VIF_EVENT_TIMEOUT);
  9433. -+ err = brcmf_cfg80211_wait_vif_event(cfg, BRCMF_E_IF_CHANGE,
  9434. -+ BRCMF_VIF_EVENT_TIMEOUT);
  9435. - brcmf_cfg80211_arm_vif_event(cfg, NULL);
  9436. - if (!err) {
  9437. - brcmf_err("No BRCMF_E_IF_CHANGE event received\n");
  9438. -@@ -2090,8 +2090,8 @@ static struct wireless_dev *brcmf_p2p_cr
  9439. - }
  9440. -
  9441. - /* wait for firmware event */
  9442. -- err = brcmf_cfg80211_wait_vif_event_timeout(p2p->cfg, BRCMF_E_IF_ADD,
  9443. -- BRCMF_VIF_EVENT_TIMEOUT);
  9444. -+ err = brcmf_cfg80211_wait_vif_event(p2p->cfg, BRCMF_E_IF_ADD,
  9445. -+ BRCMF_VIF_EVENT_TIMEOUT);
  9446. - brcmf_cfg80211_arm_vif_event(p2p->cfg, NULL);
  9447. - brcmf_fweh_p2pdev_setup(pri_ifp, false);
  9448. - if (!err) {
  9449. -@@ -2180,8 +2180,8 @@ struct wireless_dev *brcmf_p2p_add_vif(s
  9450. - }
  9451. -
  9452. - /* wait for firmware event */
  9453. -- err = brcmf_cfg80211_wait_vif_event_timeout(cfg, BRCMF_E_IF_ADD,
  9454. -- BRCMF_VIF_EVENT_TIMEOUT);
  9455. -+ err = brcmf_cfg80211_wait_vif_event(cfg, BRCMF_E_IF_ADD,
  9456. -+ BRCMF_VIF_EVENT_TIMEOUT);
  9457. - brcmf_cfg80211_arm_vif_event(cfg, NULL);
  9458. - if (!err) {
  9459. - brcmf_err("timeout occurred\n");
  9460. -@@ -2274,8 +2274,8 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  9461. - }
  9462. - if (!err) {
  9463. - /* wait for firmware event */
  9464. -- err = brcmf_cfg80211_wait_vif_event_timeout(cfg, BRCMF_E_IF_DEL,
  9465. -- BRCMF_VIF_EVENT_TIMEOUT);
  9466. -+ err = brcmf_cfg80211_wait_vif_event(cfg, BRCMF_E_IF_DEL,
  9467. -+ BRCMF_VIF_EVENT_TIMEOUT);
  9468. - if (!err)
  9469. - err = -EIO;
  9470. - else
  9471. 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
  9472. deleted file mode 100644
  9473. index 9c336f774fd79a2306dae746d3622db22eee76eb..0000000000000000000000000000000000000000
  9474. --- a/package/kernel/mac80211/patches/344-0002-brcmfmac-Limit-memory-allocs-to-64K.patch
  9475. +++ /dev/null
  9476. @@ -1,127 +0,0 @@
  9477. -From: Hante Meuleman <meuleman@broadcom.com>
  9478. -Date: Wed, 17 Feb 2016 11:26:51 +0100
  9479. -Subject: [PATCH] brcmfmac: Limit memory allocs to <64K
  9480. -
  9481. -Some systems have problems with allocating memory allocation larger
  9482. -then 64K. Often on unload/load or suspend/resume a failure is
  9483. -reported: Could not allocate wiphy device. This patch makes the
  9484. -escan intermediate storage buf dynamically allocated, and smaller
  9485. -than 64K.
  9486. -
  9487. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  9488. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  9489. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  9490. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  9491. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  9492. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9493. ----
  9494. -
  9495. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  9496. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  9497. -@@ -1125,7 +1125,7 @@ brcmf_cfg80211_escan(struct wiphy *wiphy
  9498. -
  9499. - /* Arm scan timeout timer */
  9500. - mod_timer(&cfg->escan_timeout, jiffies +
  9501. -- WL_ESCAN_TIMER_INTERVAL_MS * HZ / 1000);
  9502. -+ BRCMF_ESCAN_TIMER_INTERVAL_MS * HZ / 1000);
  9503. -
  9504. - return 0;
  9505. -
  9506. -@@ -3020,7 +3020,7 @@ brcmf_cfg80211_escan_handler(struct brcm
  9507. -
  9508. - list = (struct brcmf_scan_results *)
  9509. - cfg->escan_info.escan_buf;
  9510. -- if (bi_length > WL_ESCAN_BUF_SIZE - list->buflen) {
  9511. -+ if (bi_length > BRCMF_ESCAN_BUF_SIZE - list->buflen) {
  9512. - brcmf_err("Buffer is too small: ignoring\n");
  9513. - goto exit;
  9514. - }
  9515. -@@ -3033,8 +3033,8 @@ brcmf_cfg80211_escan_handler(struct brcm
  9516. - bss_info_le))
  9517. - goto exit;
  9518. - }
  9519. -- memcpy(&(cfg->escan_info.escan_buf[list->buflen]),
  9520. -- bss_info_le, bi_length);
  9521. -+ memcpy(&cfg->escan_info.escan_buf[list->buflen], bss_info_le,
  9522. -+ bi_length);
  9523. - list->version = le32_to_cpu(bss_info_le->version);
  9524. - list->buflen += bi_length;
  9525. - list->count++;
  9526. -@@ -5402,14 +5402,14 @@ static void brcmf_deinit_priv_mem(struct
  9527. - {
  9528. - kfree(cfg->conf);
  9529. - cfg->conf = NULL;
  9530. -- kfree(cfg->escan_ioctl_buf);
  9531. -- cfg->escan_ioctl_buf = NULL;
  9532. - kfree(cfg->extra_buf);
  9533. - cfg->extra_buf = NULL;
  9534. - kfree(cfg->wowl.nd);
  9535. - cfg->wowl.nd = NULL;
  9536. - kfree(cfg->wowl.nd_info);
  9537. - cfg->wowl.nd_info = NULL;
  9538. -+ kfree(cfg->escan_info.escan_buf);
  9539. -+ cfg->escan_info.escan_buf = NULL;
  9540. - }
  9541. -
  9542. - static s32 brcmf_init_priv_mem(struct brcmf_cfg80211_info *cfg)
  9543. -@@ -5417,9 +5417,6 @@ static s32 brcmf_init_priv_mem(struct br
  9544. - cfg->conf = kzalloc(sizeof(*cfg->conf), GFP_KERNEL);
  9545. - if (!cfg->conf)
  9546. - goto init_priv_mem_out;
  9547. -- cfg->escan_ioctl_buf = kzalloc(BRCMF_DCMD_MEDLEN, GFP_KERNEL);
  9548. -- if (!cfg->escan_ioctl_buf)
  9549. -- goto init_priv_mem_out;
  9550. - cfg->extra_buf = kzalloc(WL_EXTRA_BUF_MAX, GFP_KERNEL);
  9551. - if (!cfg->extra_buf)
  9552. - goto init_priv_mem_out;
  9553. -@@ -5431,6 +5428,9 @@ static s32 brcmf_init_priv_mem(struct br
  9554. - GFP_KERNEL);
  9555. - if (!cfg->wowl.nd_info)
  9556. - goto init_priv_mem_out;
  9557. -+ cfg->escan_info.escan_buf = kzalloc(BRCMF_ESCAN_BUF_SIZE, GFP_KERNEL);
  9558. -+ if (!cfg->escan_info.escan_buf)
  9559. -+ goto init_priv_mem_out;
  9560. -
  9561. - return 0;
  9562. -
  9563. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  9564. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  9565. -@@ -28,8 +28,11 @@
  9566. - #define WL_ROAM_TRIGGER_LEVEL -75
  9567. - #define WL_ROAM_DELTA 20
  9568. -
  9569. --#define WL_ESCAN_BUF_SIZE (1024 * 64)
  9570. --#define WL_ESCAN_TIMER_INTERVAL_MS 10000 /* E-Scan timeout */
  9571. -+/* Keep BRCMF_ESCAN_BUF_SIZE below 64K (65536). Allocing over 64K can be
  9572. -+ * problematic on some systems and should be avoided.
  9573. -+ */
  9574. -+#define BRCMF_ESCAN_BUF_SIZE 65000
  9575. -+#define BRCMF_ESCAN_TIMER_INTERVAL_MS 10000 /* E-Scan timeout */
  9576. -
  9577. - #define WL_ESCAN_ACTION_START 1
  9578. - #define WL_ESCAN_ACTION_CONTINUE 2
  9579. -@@ -205,7 +208,7 @@ enum wl_escan_state {
  9580. -
  9581. - struct escan_info {
  9582. - u32 escan_state;
  9583. -- u8 escan_buf[WL_ESCAN_BUF_SIZE];
  9584. -+ u8 *escan_buf;
  9585. - struct wiphy *wiphy;
  9586. - struct brcmf_if *ifp;
  9587. - s32 (*run)(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp,
  9588. -@@ -278,7 +281,6 @@ struct brcmf_cfg80211_wowl {
  9589. - * @escan_info: escan information.
  9590. - * @escan_timeout: Timer for catch scan timeout.
  9591. - * @escan_timeout_work: scan timeout worker.
  9592. -- * @escan_ioctl_buf: dongle command buffer for escan commands.
  9593. - * @vif_list: linked list of vif instances.
  9594. - * @vif_cnt: number of vif instances.
  9595. - * @vif_event: vif event signalling.
  9596. -@@ -309,7 +311,6 @@ struct brcmf_cfg80211_info {
  9597. - struct escan_info escan_info;
  9598. - struct timer_list escan_timeout;
  9599. - struct work_struct escan_timeout_work;
  9600. -- u8 *escan_ioctl_buf;
  9601. - struct list_head vif_list;
  9602. - struct brcmf_cfg80211_vif_event vif_event;
  9603. - struct completion vif_disabled;
  9604. 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
  9605. deleted file mode 100644
  9606. index ee3d9f37a851cb1d31a53e341614bd7166c2e581..0000000000000000000000000000000000000000
  9607. --- a/package/kernel/mac80211/patches/344-0003-brcmfmac-check-for-wowl-support-before-enumerating-f.patch
  9608. +++ /dev/null
  9609. @@ -1,29 +0,0 @@
  9610. -From: Franky Lin <frankyl@broadcom.com>
  9611. -Date: Wed, 17 Feb 2016 11:26:52 +0100
  9612. -Subject: [PATCH] brcmfmac: check for wowl support before enumerating feature
  9613. - flag
  9614. -
  9615. -In some cases wiphy->wowlan could be NULL if firmware doesn't have the
  9616. -support. Driver should check for support before walking down the feature
  9617. -flags.
  9618. -
  9619. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  9620. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  9621. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  9622. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  9623. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  9624. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9625. ----
  9626. -
  9627. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  9628. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  9629. -@@ -6594,7 +6594,8 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  9630. - if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_SCAN_RANDOM_MAC)) {
  9631. - wiphy->features |= NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR;
  9632. - #ifdef CONFIG_PM
  9633. -- if (wiphy->wowlan->flags & WIPHY_WOWLAN_NET_DETECT)
  9634. -+ if (wiphy->wowlan &&
  9635. -+ wiphy->wowlan->flags & WIPHY_WOWLAN_NET_DETECT)
  9636. - wiphy->features |= NL80211_FEATURE_ND_RANDOM_MAC_ADDR;
  9637. - #endif
  9638. - }
  9639. 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
  9640. deleted file mode 100644
  9641. index c52cac87b979e6da07d24f2e7e119261dceea2ce..0000000000000000000000000000000000000000
  9642. --- a/package/kernel/mac80211/patches/344-0004-brcmfmac-Configure-country-code-using-device-specifi.patch
  9643. +++ /dev/null
  9644. @@ -1,214 +0,0 @@
  9645. -From: Hante Meuleman <meuleman@broadcom.com>
  9646. -Date: Wed, 17 Feb 2016 11:26:53 +0100
  9647. -Subject: [PATCH] brcmfmac: Configure country code using device specific
  9648. - settings
  9649. -
  9650. -Country code configuration in a device is a device specific
  9651. -operation. For this the country code as specified by reg notifier
  9652. -(iso3166 alpha2) needs to be translated to a device specific
  9653. -country locale and revision number. This patch adds this
  9654. -translation and puts a placeholder in the device specific settings
  9655. -where the translation table can be stored. Additional patches will
  9656. -be needed to read these tables from for example device platform
  9657. -data.
  9658. -
  9659. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  9660. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  9661. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  9662. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  9663. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  9664. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9665. ----
  9666. -
  9667. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  9668. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  9669. -@@ -6405,28 +6405,85 @@ int brcmf_cfg80211_wait_vif_event(struct
  9670. - vif_event_equals(event, action), timeout);
  9671. - }
  9672. -
  9673. -+static s32 brcmf_translate_country_code(struct brcmf_pub *drvr, char alpha2[2],
  9674. -+ struct brcmf_fil_country_le *ccreq)
  9675. -+{
  9676. -+ struct cc_translate *country_codes;
  9677. -+ struct cc_entry *cc;
  9678. -+ s32 found_index;
  9679. -+ int i;
  9680. -+
  9681. -+ country_codes = drvr->settings->country_codes;
  9682. -+ if (!country_codes) {
  9683. -+ brcmf_dbg(TRACE, "No country codes configured for device\n");
  9684. -+ return -EINVAL;
  9685. -+ }
  9686. -+
  9687. -+ if ((alpha2[0] == ccreq->country_abbrev[0]) &&
  9688. -+ (alpha2[1] == ccreq->country_abbrev[1])) {
  9689. -+ brcmf_dbg(TRACE, "Country code already set\n");
  9690. -+ return -EAGAIN;
  9691. -+ }
  9692. -+
  9693. -+ found_index = -1;
  9694. -+ for (i = 0; i < country_codes->table_size; i++) {
  9695. -+ cc = &country_codes->table[i];
  9696. -+ if ((cc->iso3166[0] == '\0') && (found_index == -1))
  9697. -+ found_index = i;
  9698. -+ if ((cc->iso3166[0] == alpha2[0]) &&
  9699. -+ (cc->iso3166[1] == alpha2[1])) {
  9700. -+ found_index = i;
  9701. -+ break;
  9702. -+ }
  9703. -+ }
  9704. -+ if (found_index == -1) {
  9705. -+ brcmf_dbg(TRACE, "No country code match found\n");
  9706. -+ return -EINVAL;
  9707. -+ }
  9708. -+ memset(ccreq, 0, sizeof(*ccreq));
  9709. -+ ccreq->rev = cpu_to_le32(country_codes->table[found_index].rev);
  9710. -+ memcpy(ccreq->ccode, country_codes->table[found_index].cc,
  9711. -+ BRCMF_COUNTRY_BUF_SZ);
  9712. -+ ccreq->country_abbrev[0] = alpha2[0];
  9713. -+ ccreq->country_abbrev[1] = alpha2[1];
  9714. -+ ccreq->country_abbrev[2] = 0;
  9715. -+
  9716. -+ return 0;
  9717. -+}
  9718. -+
  9719. - static void brcmf_cfg80211_reg_notifier(struct wiphy *wiphy,
  9720. - struct regulatory_request *req)
  9721. - {
  9722. - struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy);
  9723. - struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg));
  9724. - struct brcmf_fil_country_le ccreq;
  9725. -+ s32 err;
  9726. - int i;
  9727. -
  9728. -- brcmf_dbg(TRACE, "enter: initiator=%d, alpha=%c%c\n", req->initiator,
  9729. -- req->alpha2[0], req->alpha2[1]);
  9730. --
  9731. - /* ignore non-ISO3166 country codes */
  9732. - for (i = 0; i < sizeof(req->alpha2); i++)
  9733. - if (req->alpha2[i] < 'A' || req->alpha2[i] > 'Z') {
  9734. -- brcmf_err("not a ISO3166 code\n");
  9735. -+ brcmf_err("not a ISO3166 code (0x%02x 0x%02x)\n",
  9736. -+ req->alpha2[0], req->alpha2[1]);
  9737. - return;
  9738. - }
  9739. -- memset(&ccreq, 0, sizeof(ccreq));
  9740. -- ccreq.rev = cpu_to_le32(-1);
  9741. -- memcpy(ccreq.ccode, req->alpha2, sizeof(req->alpha2));
  9742. -- if (brcmf_fil_iovar_data_set(ifp, "country", &ccreq, sizeof(ccreq))) {
  9743. -- brcmf_err("firmware rejected country setting\n");
  9744. -+
  9745. -+ brcmf_dbg(TRACE, "Enter: initiator=%d, alpha=%c%c\n", req->initiator,
  9746. -+ req->alpha2[0], req->alpha2[1]);
  9747. -+
  9748. -+ err = brcmf_fil_iovar_data_get(ifp, "country", &ccreq, sizeof(ccreq));
  9749. -+ if (err) {
  9750. -+ brcmf_err("Country code iovar returned err = %d\n", err);
  9751. -+ return;
  9752. -+ }
  9753. -+
  9754. -+ err = brcmf_translate_country_code(ifp->drvr, req->alpha2, &ccreq);
  9755. -+ if (err)
  9756. -+ return;
  9757. -+
  9758. -+ err = brcmf_fil_iovar_data_set(ifp, "country", &ccreq, sizeof(ccreq));
  9759. -+ if (err) {
  9760. -+ brcmf_err("Firmware rejected country setting\n");
  9761. - return;
  9762. - }
  9763. - brcmf_setup_wiphybands(wiphy);
  9764. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  9765. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  9766. -@@ -230,10 +230,8 @@ void brcmf_mp_attach(void)
  9767. - int brcmf_mp_device_attach(struct brcmf_pub *drvr)
  9768. - {
  9769. - drvr->settings = kzalloc(sizeof(*drvr->settings), GFP_ATOMIC);
  9770. -- if (!drvr->settings) {
  9771. -- brcmf_err("Failed to alloca storage space for settings\n");
  9772. -+ if (!drvr->settings)
  9773. - return -ENOMEM;
  9774. -- }
  9775. -
  9776. - drvr->settings->sdiod_txglomsz = brcmf_sdiod_txglomsz;
  9777. - drvr->settings->p2p_enable = !!brcmf_p2p_enable;
  9778. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
  9779. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
  9780. -@@ -15,6 +15,8 @@
  9781. - #ifndef BRCMFMAC_COMMON_H
  9782. - #define BRCMFMAC_COMMON_H
  9783. -
  9784. -+#include "fwil_types.h"
  9785. -+
  9786. - extern const u8 ALLFFMAC[ETH_ALEN];
  9787. -
  9788. - #define BRCMF_FW_ALTPATH_LEN 256
  9789. -@@ -39,6 +41,33 @@ struct brcmf_mp_global_t {
  9790. - extern struct brcmf_mp_global_t brcmf_mp_global;
  9791. -
  9792. - /**
  9793. -+ * struct cc_entry - Struct for translating user space country code (iso3166) to
  9794. -+ * firmware country code and revision.
  9795. -+ *
  9796. -+ * @iso3166: iso3166 alpha 2 country code string.
  9797. -+ * @cc: firmware country code string.
  9798. -+ * @rev: firmware country code revision.
  9799. -+ */
  9800. -+struct cc_entry {
  9801. -+ char iso3166[BRCMF_COUNTRY_BUF_SZ];
  9802. -+ char cc[BRCMF_COUNTRY_BUF_SZ];
  9803. -+ s32 rev;
  9804. -+};
  9805. -+
  9806. -+/**
  9807. -+ * struct cc_translate - Struct for translating country codes as set by user
  9808. -+ * space to a country code and rev which can be used by
  9809. -+ * firmware.
  9810. -+ *
  9811. -+ * @table_size: number of entries in table (> 0)
  9812. -+ * @table: dynamic array of 1 or more elements with translation information.
  9813. -+ */
  9814. -+struct cc_translate {
  9815. -+ int table_size;
  9816. -+ struct cc_entry table[0];
  9817. -+};
  9818. -+
  9819. -+/**
  9820. - * struct brcmf_mp_device - Device module paramaters.
  9821. - *
  9822. - * @sdiod_txglomsz: SDIO txglom size.
  9823. -@@ -47,6 +76,7 @@ extern struct brcmf_mp_global_t brcmf_mp
  9824. - * @feature_disable: Feature_disable bitmask.
  9825. - * @fcmode: FWS flow control.
  9826. - * @roamoff: Firmware roaming off?
  9827. -+ * @country_codes: If available, pointer to struct for translating country codes
  9828. - */
  9829. - struct brcmf_mp_device {
  9830. - int sdiod_txglomsz;
  9831. -@@ -56,6 +86,7 @@ struct brcmf_mp_device {
  9832. - int fcmode;
  9833. - bool roamoff;
  9834. - bool ignore_probe_fail;
  9835. -+ struct cc_translate *country_codes;
  9836. - };
  9837. -
  9838. - void brcmf_mp_attach(void);
  9839. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h
  9840. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h
  9841. -@@ -134,6 +134,8 @@
  9842. - #define BRCMF_PFN_MAC_OUI_ONLY BIT(0)
  9843. - #define BRCMF_PFN_SET_MAC_UNASSOC BIT(1)
  9844. -
  9845. -+#define BRCMF_MCSSET_LEN 16
  9846. -+
  9847. - /* join preference types for join_pref iovar */
  9848. - enum brcmf_join_pref_types {
  9849. - BRCMF_JOIN_PREF_RSSI = 1,
  9850. -@@ -279,7 +281,7 @@ struct brcmf_bss_info_le {
  9851. - __le32 reserved32[1]; /* Reserved for expansion of BSS properties */
  9852. - u8 flags; /* flags */
  9853. - u8 reserved[3]; /* Reserved for expansion of BSS properties */
  9854. -- u8 basic_mcs[MCSSET_LEN]; /* 802.11N BSS required MCS set */
  9855. -+ u8 basic_mcs[BRCMF_MCSSET_LEN]; /* 802.11N BSS required MCS set */
  9856. -
  9857. - __le16 ie_offset; /* offset at which IEs start, from beginning */
  9858. - __le32 ie_length; /* byte length of Information Elements */
  9859. 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
  9860. deleted file mode 100644
  9861. index 3e2e3503b629dbdd6abba44a9c9b24e4a5aea792..0000000000000000000000000000000000000000
  9862. --- a/package/kernel/mac80211/patches/344-0005-brcmfmac-Add-length-checks-on-firmware-events.patch
  9863. +++ /dev/null
  9864. @@ -1,283 +0,0 @@
  9865. -From: Hante Meuleman <meuleman@broadcom.com>
  9866. -Date: Wed, 17 Feb 2016 11:26:54 +0100
  9867. -Subject: [PATCH] brcmfmac: Add length checks on firmware events
  9868. -
  9869. -Add additional length checks on firmware events to create more
  9870. -robust code.
  9871. -
  9872. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  9873. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  9874. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  9875. -Reviewed-by: Lei Zhang <leizh@broadcom.com>
  9876. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  9877. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  9878. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9879. ----
  9880. -
  9881. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  9882. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  9883. -@@ -3092,6 +3092,11 @@ brcmf_notify_sched_scan_results(struct b
  9884. -
  9885. - brcmf_dbg(SCAN, "Enter\n");
  9886. -
  9887. -+ if (e->datalen < (sizeof(*pfn_result) + sizeof(*netinfo))) {
  9888. -+ brcmf_dbg(SCAN, "Event data to small. Ignore\n");
  9889. -+ return 0;
  9890. -+ }
  9891. -+
  9892. - if (e->event_code == BRCMF_E_PFN_NET_LOST) {
  9893. - brcmf_dbg(SCAN, "PFN NET LOST event. Do Nothing\n");
  9894. - return 0;
  9895. -@@ -3415,6 +3420,11 @@ brcmf_wowl_nd_results(struct brcmf_if *i
  9896. -
  9897. - brcmf_dbg(SCAN, "Enter\n");
  9898. -
  9899. -+ if (e->datalen < (sizeof(*pfn_result) + sizeof(*netinfo))) {
  9900. -+ brcmf_dbg(SCAN, "Event data to small. Ignore\n");
  9901. -+ return 0;
  9902. -+ }
  9903. -+
  9904. - pfn_result = (struct brcmf_pno_scanresults_le *)data;
  9905. -
  9906. - if (e->event_code == BRCMF_E_PFN_NET_LOST) {
  9907. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  9908. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  9909. -@@ -26,50 +26,6 @@
  9910. - #include "fwil.h"
  9911. -
  9912. - /**
  9913. -- * struct brcm_ethhdr - broadcom specific ether header.
  9914. -- *
  9915. -- * @subtype: subtype for this packet.
  9916. -- * @length: TODO: length of appended data.
  9917. -- * @version: version indication.
  9918. -- * @oui: OUI of this packet.
  9919. -- * @usr_subtype: subtype for this OUI.
  9920. -- */
  9921. --struct brcm_ethhdr {
  9922. -- __be16 subtype;
  9923. -- __be16 length;
  9924. -- u8 version;
  9925. -- u8 oui[3];
  9926. -- __be16 usr_subtype;
  9927. --} __packed;
  9928. --
  9929. --struct brcmf_event_msg_be {
  9930. -- __be16 version;
  9931. -- __be16 flags;
  9932. -- __be32 event_type;
  9933. -- __be32 status;
  9934. -- __be32 reason;
  9935. -- __be32 auth_type;
  9936. -- __be32 datalen;
  9937. -- u8 addr[ETH_ALEN];
  9938. -- char ifname[IFNAMSIZ];
  9939. -- u8 ifidx;
  9940. -- u8 bsscfgidx;
  9941. --} __packed;
  9942. --
  9943. --/**
  9944. -- * struct brcmf_event - contents of broadcom event packet.
  9945. -- *
  9946. -- * @eth: standard ether header.
  9947. -- * @hdr: broadcom specific ether header.
  9948. -- * @msg: common part of the actual event message.
  9949. -- */
  9950. --struct brcmf_event {
  9951. -- struct ethhdr eth;
  9952. -- struct brcm_ethhdr hdr;
  9953. -- struct brcmf_event_msg_be msg;
  9954. --} __packed;
  9955. --
  9956. --/**
  9957. - * struct brcmf_fweh_queue_item - event item on event queue.
  9958. - *
  9959. - * @q: list element for queuing.
  9960. -@@ -85,6 +41,7 @@ struct brcmf_fweh_queue_item {
  9961. - u8 ifidx;
  9962. - u8 ifaddr[ETH_ALEN];
  9963. - struct brcmf_event_msg_be emsg;
  9964. -+ u32 datalen;
  9965. - u8 data[0];
  9966. - };
  9967. -
  9968. -@@ -294,6 +251,11 @@ static void brcmf_fweh_event_worker(stru
  9969. - brcmf_dbg_hex_dump(BRCMF_EVENT_ON(), event->data,
  9970. - min_t(u32, emsg.datalen, 64),
  9971. - "event payload, len=%d\n", emsg.datalen);
  9972. -+ if (emsg.datalen > event->datalen) {
  9973. -+ brcmf_err("event invalid length header=%d, msg=%d\n",
  9974. -+ event->datalen, emsg.datalen);
  9975. -+ goto event_free;
  9976. -+ }
  9977. -
  9978. - /* special handling of interface event */
  9979. - if (event->code == BRCMF_E_IF) {
  9980. -@@ -439,7 +401,8 @@ int brcmf_fweh_activate_events(struct br
  9981. - * dispatch the event to a registered handler (using worker).
  9982. - */
  9983. - void brcmf_fweh_process_event(struct brcmf_pub *drvr,
  9984. -- struct brcmf_event *event_packet)
  9985. -+ struct brcmf_event *event_packet,
  9986. -+ u32 packet_len)
  9987. - {
  9988. - enum brcmf_fweh_event_code code;
  9989. - struct brcmf_fweh_info *fweh = &drvr->fweh;
  9990. -@@ -459,6 +422,9 @@ void brcmf_fweh_process_event(struct brc
  9991. - if (code != BRCMF_E_IF && !fweh->evt_handler[code])
  9992. - return;
  9993. -
  9994. -+ if (datalen > BRCMF_DCMD_MAXLEN)
  9995. -+ return;
  9996. -+
  9997. - if (in_interrupt())
  9998. - alloc_flag = GFP_ATOMIC;
  9999. -
  10000. -@@ -472,6 +438,7 @@ void brcmf_fweh_process_event(struct brc
  10001. - /* use memcpy to get aligned event message */
  10002. - memcpy(&event->emsg, &event_packet->msg, sizeof(event->emsg));
  10003. - memcpy(event->data, data, datalen);
  10004. -+ event->datalen = datalen;
  10005. - memcpy(event->ifaddr, event_packet->eth.h_dest, ETH_ALEN);
  10006. -
  10007. - brcmf_fweh_queue_event(fweh, event);
  10008. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h
  10009. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h
  10010. -@@ -27,7 +27,6 @@
  10011. - struct brcmf_pub;
  10012. - struct brcmf_if;
  10013. - struct brcmf_cfg80211_info;
  10014. --struct brcmf_event;
  10015. -
  10016. - /* list of firmware events */
  10017. - #define BRCMF_FWEH_EVENT_ENUM_DEFLIST \
  10018. -@@ -180,13 +179,55 @@ enum brcmf_fweh_event_code {
  10019. - /**
  10020. - * definitions for event packet validation.
  10021. - */
  10022. --#define BRCMF_EVENT_OUI_OFFSET 19
  10023. --#define BRCM_OUI "\x00\x10\x18"
  10024. --#define DOT11_OUI_LEN 3
  10025. --#define BCMILCP_BCM_SUBTYPE_EVENT 1
  10026. -+#define BRCM_OUI "\x00\x10\x18"
  10027. -+#define BCMILCP_BCM_SUBTYPE_EVENT 1
  10028. -
  10029. -
  10030. - /**
  10031. -+ * struct brcm_ethhdr - broadcom specific ether header.
  10032. -+ *
  10033. -+ * @subtype: subtype for this packet.
  10034. -+ * @length: TODO: length of appended data.
  10035. -+ * @version: version indication.
  10036. -+ * @oui: OUI of this packet.
  10037. -+ * @usr_subtype: subtype for this OUI.
  10038. -+ */
  10039. -+struct brcm_ethhdr {
  10040. -+ __be16 subtype;
  10041. -+ __be16 length;
  10042. -+ u8 version;
  10043. -+ u8 oui[3];
  10044. -+ __be16 usr_subtype;
  10045. -+} __packed;
  10046. -+
  10047. -+struct brcmf_event_msg_be {
  10048. -+ __be16 version;
  10049. -+ __be16 flags;
  10050. -+ __be32 event_type;
  10051. -+ __be32 status;
  10052. -+ __be32 reason;
  10053. -+ __be32 auth_type;
  10054. -+ __be32 datalen;
  10055. -+ u8 addr[ETH_ALEN];
  10056. -+ char ifname[IFNAMSIZ];
  10057. -+ u8 ifidx;
  10058. -+ u8 bsscfgidx;
  10059. -+} __packed;
  10060. -+
  10061. -+/**
  10062. -+ * struct brcmf_event - contents of broadcom event packet.
  10063. -+ *
  10064. -+ * @eth: standard ether header.
  10065. -+ * @hdr: broadcom specific ether header.
  10066. -+ * @msg: common part of the actual event message.
  10067. -+ */
  10068. -+struct brcmf_event {
  10069. -+ struct ethhdr eth;
  10070. -+ struct brcm_ethhdr hdr;
  10071. -+ struct brcmf_event_msg_be msg;
  10072. -+} __packed;
  10073. -+
  10074. -+/**
  10075. - * struct brcmf_event_msg - firmware event message.
  10076. - *
  10077. - * @version: version information.
  10078. -@@ -256,34 +297,35 @@ void brcmf_fweh_unregister(struct brcmf_
  10079. - enum brcmf_fweh_event_code code);
  10080. - int brcmf_fweh_activate_events(struct brcmf_if *ifp);
  10081. - void brcmf_fweh_process_event(struct brcmf_pub *drvr,
  10082. -- struct brcmf_event *event_packet);
  10083. -+ struct brcmf_event *event_packet,
  10084. -+ u32 packet_len);
  10085. - void brcmf_fweh_p2pdev_setup(struct brcmf_if *ifp, bool ongoing);
  10086. -
  10087. - static inline void brcmf_fweh_process_skb(struct brcmf_pub *drvr,
  10088. - struct sk_buff *skb)
  10089. - {
  10090. - struct brcmf_event *event_packet;
  10091. -- u8 *data;
  10092. - u16 usr_stype;
  10093. -
  10094. - /* only process events when protocol matches */
  10095. - if (skb->protocol != cpu_to_be16(ETH_P_LINK_CTL))
  10096. - return;
  10097. -
  10098. -+ if ((skb->len + ETH_HLEN) < sizeof(*event_packet))
  10099. -+ return;
  10100. -+
  10101. - /* check for BRCM oui match */
  10102. - event_packet = (struct brcmf_event *)skb_mac_header(skb);
  10103. -- data = (u8 *)event_packet;
  10104. -- data += BRCMF_EVENT_OUI_OFFSET;
  10105. -- if (memcmp(BRCM_OUI, data, DOT11_OUI_LEN))
  10106. -+ if (memcmp(BRCM_OUI, &event_packet->hdr.oui[0],
  10107. -+ sizeof(event_packet->hdr.oui)))
  10108. - return;
  10109. -
  10110. - /* final match on usr_subtype */
  10111. -- data += DOT11_OUI_LEN;
  10112. -- usr_stype = get_unaligned_be16(data);
  10113. -+ usr_stype = get_unaligned_be16(&event_packet->hdr.usr_subtype);
  10114. - if (usr_stype != BCMILCP_BCM_SUBTYPE_EVENT)
  10115. - return;
  10116. -
  10117. -- brcmf_fweh_process_event(drvr, event_packet);
  10118. -+ brcmf_fweh_process_event(drvr, event_packet, skb->len + ETH_HLEN);
  10119. - }
  10120. -
  10121. - #endif /* FWEH_H_ */
  10122. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  10123. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  10124. -@@ -1361,6 +1361,11 @@ int brcmf_p2p_notify_action_frame_rx(str
  10125. - u16 mgmt_type;
  10126. - u8 action;
  10127. -
  10128. -+ if (e->datalen < sizeof(*rxframe)) {
  10129. -+ brcmf_dbg(SCAN, "Event data to small. Ignore\n");
  10130. -+ return 0;
  10131. -+ }
  10132. -+
  10133. - ch.chspec = be16_to_cpu(rxframe->chanspec);
  10134. - cfg->d11inf.decchspec(&ch);
  10135. - /* Check if wpa_supplicant has registered for this frame */
  10136. -@@ -1858,6 +1863,11 @@ s32 brcmf_p2p_notify_rx_mgmt_p2p_probere
  10137. - brcmf_dbg(INFO, "Enter: event %d reason %d\n", e->event_code,
  10138. - e->reason);
  10139. -
  10140. -+ if (e->datalen < sizeof(*rxframe)) {
  10141. -+ brcmf_dbg(SCAN, "Event data to small. Ignore\n");
  10142. -+ return 0;
  10143. -+ }
  10144. -+
  10145. - ch.chspec = be16_to_cpu(rxframe->chanspec);
  10146. - cfg->d11inf.decchspec(&ch);
  10147. -
  10148. 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
  10149. deleted file mode 100644
  10150. index 888ad5b05059f1d6712303671a1052f1cbdcf30c..0000000000000000000000000000000000000000
  10151. --- a/package/kernel/mac80211/patches/344-0006-brcmfmac-add-neighbor-discovery-offload-ip-address-t.patch
  10152. +++ /dev/null
  10153. @@ -1,333 +0,0 @@
  10154. -From: Franky Lin <frankyl@broadcom.com>
  10155. -Date: Wed, 17 Feb 2016 11:26:55 +0100
  10156. -Subject: [PATCH] brcmfmac: add neighbor discovery offload ip address table
  10157. - configuration
  10158. -
  10159. -Configure ipv6 address for neighbor discovery offload ip table in
  10160. -firmware obtained through ipv6 address notification callback.
  10161. -
  10162. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  10163. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10164. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  10165. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10166. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10167. ----
  10168. -
  10169. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  10170. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  10171. -@@ -456,7 +456,7 @@ send_key_to_dongle(struct brcmf_if *ifp,
  10172. - }
  10173. -
  10174. - static s32
  10175. --brcmf_configure_arp_offload(struct brcmf_if *ifp, bool enable)
  10176. -+brcmf_configure_arp_nd_offload(struct brcmf_if *ifp, bool enable)
  10177. - {
  10178. - s32 err;
  10179. - u32 mode;
  10180. -@@ -484,6 +484,15 @@ brcmf_configure_arp_offload(struct brcmf
  10181. - enable, mode);
  10182. - }
  10183. -
  10184. -+ err = brcmf_fil_iovar_int_set(ifp, "ndoe", enable);
  10185. -+ if (err) {
  10186. -+ brcmf_dbg(TRACE, "failed to configure (%d) ND offload err = %d\n",
  10187. -+ enable, err);
  10188. -+ err = 0;
  10189. -+ } else
  10190. -+ brcmf_dbg(TRACE, "successfully configured (%d) ND offload to 0x%x\n",
  10191. -+ enable, mode);
  10192. -+
  10193. - return err;
  10194. - }
  10195. -
  10196. -@@ -3543,7 +3552,7 @@ static s32 brcmf_cfg80211_resume(struct
  10197. - brcmf_report_wowl_wakeind(wiphy, ifp);
  10198. - brcmf_fil_iovar_int_set(ifp, "wowl_clear", 0);
  10199. - brcmf_config_wowl_pattern(ifp, "clr", NULL, 0, NULL, 0);
  10200. -- brcmf_configure_arp_offload(ifp, true);
  10201. -+ brcmf_configure_arp_nd_offload(ifp, true);
  10202. - brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM,
  10203. - cfg->wowl.pre_pmmode);
  10204. - cfg->wowl.active = false;
  10205. -@@ -3567,7 +3576,7 @@ static void brcmf_configure_wowl(struct
  10206. -
  10207. - brcmf_dbg(TRACE, "Suspend, wowl config.\n");
  10208. -
  10209. -- brcmf_configure_arp_offload(ifp, false);
  10210. -+ brcmf_configure_arp_nd_offload(ifp, false);
  10211. - brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_PM, &cfg->wowl.pre_pmmode);
  10212. - brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM, PM_MAX);
  10213. -
  10214. -@@ -4336,7 +4345,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  10215. -
  10216. - if (!mbss) {
  10217. - brcmf_set_mpc(ifp, 0);
  10218. -- brcmf_configure_arp_offload(ifp, false);
  10219. -+ brcmf_configure_arp_nd_offload(ifp, false);
  10220. - }
  10221. -
  10222. - /* find the RSN_IE */
  10223. -@@ -4482,7 +4491,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  10224. - exit:
  10225. - if ((err) && (!mbss)) {
  10226. - brcmf_set_mpc(ifp, 1);
  10227. -- brcmf_configure_arp_offload(ifp, true);
  10228. -+ brcmf_configure_arp_nd_offload(ifp, true);
  10229. - }
  10230. - return err;
  10231. - }
  10232. -@@ -4540,7 +4549,7 @@ static int brcmf_cfg80211_stop_ap(struct
  10233. - brcmf_err("bss_enable config failed %d\n", err);
  10234. - }
  10235. - brcmf_set_mpc(ifp, 1);
  10236. -- brcmf_configure_arp_offload(ifp, true);
  10237. -+ brcmf_configure_arp_nd_offload(ifp, true);
  10238. - clear_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state);
  10239. - brcmf_net_setcarrier(ifp, false);
  10240. -
  10241. -@@ -6287,7 +6296,7 @@ static s32 brcmf_config_dongle(struct br
  10242. - if (err)
  10243. - goto default_conf_out;
  10244. -
  10245. -- brcmf_configure_arp_offload(ifp, true);
  10246. -+ brcmf_configure_arp_nd_offload(ifp, true);
  10247. -
  10248. - cfg->dongle_up = true;
  10249. - default_conf_out:
  10250. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  10251. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  10252. -@@ -20,6 +20,8 @@
  10253. - #include <linux/inetdevice.h>
  10254. - #include <net/cfg80211.h>
  10255. - #include <net/rtnetlink.h>
  10256. -+#include <net/addrconf.h>
  10257. -+#include <net/ipv6.h>
  10258. - #include <brcmu_utils.h>
  10259. - #include <brcmu_wifi.h>
  10260. -
  10261. -@@ -172,6 +174,35 @@ _brcmf_set_mac_address(struct work_struc
  10262. - }
  10263. - }
  10264. -
  10265. -+#if IS_ENABLED(CONFIG_IPV6)
  10266. -+static void _brcmf_update_ndtable(struct work_struct *work)
  10267. -+{
  10268. -+ struct brcmf_if *ifp;
  10269. -+ int i, ret;
  10270. -+
  10271. -+ ifp = container_of(work, struct brcmf_if, ndoffload_work);
  10272. -+
  10273. -+ /* clear the table in firmware */
  10274. -+ ret = brcmf_fil_iovar_data_set(ifp, "nd_hostip_clear", NULL, 0);
  10275. -+ if (ret) {
  10276. -+ brcmf_dbg(TRACE, "fail to clear nd ip table err:%d\n", ret);
  10277. -+ return;
  10278. -+ }
  10279. -+
  10280. -+ for (i = 0; i < ifp->ipv6addr_idx; i++) {
  10281. -+ ret = brcmf_fil_iovar_data_set(ifp, "nd_hostip",
  10282. -+ &ifp->ipv6_addr_tbl[i],
  10283. -+ sizeof(struct in6_addr));
  10284. -+ if (ret)
  10285. -+ brcmf_err("add nd ip err %d\n", ret);
  10286. -+ }
  10287. -+}
  10288. -+#else
  10289. -+static void _brcmf_update_ndtable(struct work_struct *work)
  10290. -+{
  10291. -+}
  10292. -+#endif
  10293. -+
  10294. - static int brcmf_netdev_set_mac_address(struct net_device *ndev, void *addr)
  10295. - {
  10296. - struct brcmf_if *ifp = netdev_priv(ndev);
  10297. -@@ -685,6 +716,7 @@ int brcmf_net_attach(struct brcmf_if *if
  10298. -
  10299. - INIT_WORK(&ifp->setmacaddr_work, _brcmf_set_mac_address);
  10300. - INIT_WORK(&ifp->multicast_work, _brcmf_set_multicast_list);
  10301. -+ INIT_WORK(&ifp->ndoffload_work, _brcmf_update_ndtable);
  10302. -
  10303. - if (rtnl_locked)
  10304. - err = register_netdevice(ndev);
  10305. -@@ -884,6 +916,7 @@ static void brcmf_del_if(struct brcmf_pu
  10306. - if (ifp->ndev->netdev_ops == &brcmf_netdev_ops_pri) {
  10307. - cancel_work_sync(&ifp->setmacaddr_work);
  10308. - cancel_work_sync(&ifp->multicast_work);
  10309. -+ cancel_work_sync(&ifp->ndoffload_work);
  10310. - }
  10311. - brcmf_net_detach(ifp->ndev);
  10312. - } else {
  10313. -@@ -1025,6 +1058,56 @@ static int brcmf_inetaddr_changed(struct
  10314. - }
  10315. - #endif
  10316. -
  10317. -+#if IS_ENABLED(CONFIG_IPV6)
  10318. -+static int brcmf_inet6addr_changed(struct notifier_block *nb,
  10319. -+ unsigned long action, void *data)
  10320. -+{
  10321. -+ struct brcmf_pub *drvr = container_of(nb, struct brcmf_pub,
  10322. -+ inet6addr_notifier);
  10323. -+ struct inet6_ifaddr *ifa = data;
  10324. -+ struct brcmf_if *ifp;
  10325. -+ int i;
  10326. -+ struct in6_addr *table;
  10327. -+
  10328. -+ /* Only handle primary interface */
  10329. -+ ifp = drvr->iflist[0];
  10330. -+ if (!ifp)
  10331. -+ return NOTIFY_DONE;
  10332. -+ if (ifp->ndev != ifa->idev->dev)
  10333. -+ return NOTIFY_DONE;
  10334. -+
  10335. -+ table = ifp->ipv6_addr_tbl;
  10336. -+ for (i = 0; i < NDOL_MAX_ENTRIES; i++)
  10337. -+ if (ipv6_addr_equal(&ifa->addr, &table[i]))
  10338. -+ break;
  10339. -+
  10340. -+ switch (action) {
  10341. -+ case NETDEV_UP:
  10342. -+ if (i == NDOL_MAX_ENTRIES) {
  10343. -+ if (ifp->ipv6addr_idx < NDOL_MAX_ENTRIES) {
  10344. -+ table[ifp->ipv6addr_idx++] = ifa->addr;
  10345. -+ } else {
  10346. -+ for (i = 0; i < NDOL_MAX_ENTRIES - 1; i++)
  10347. -+ table[i] = table[i + 1];
  10348. -+ table[NDOL_MAX_ENTRIES - 1] = ifa->addr;
  10349. -+ }
  10350. -+ }
  10351. -+ break;
  10352. -+ case NETDEV_DOWN:
  10353. -+ if (i < NDOL_MAX_ENTRIES)
  10354. -+ for (; i < ifp->ipv6addr_idx; i++)
  10355. -+ table[i] = table[i + 1];
  10356. -+ break;
  10357. -+ default:
  10358. -+ break;
  10359. -+ }
  10360. -+
  10361. -+ schedule_work(&ifp->ndoffload_work);
  10362. -+
  10363. -+ return NOTIFY_OK;
  10364. -+}
  10365. -+#endif
  10366. -+
  10367. - int brcmf_attach(struct device *dev)
  10368. - {
  10369. - struct brcmf_pub *drvr = NULL;
  10370. -@@ -1164,30 +1247,41 @@ int brcmf_bus_start(struct device *dev)
  10371. - #ifdef CONFIG_INET
  10372. - drvr->inetaddr_notifier.notifier_call = brcmf_inetaddr_changed;
  10373. - ret = register_inetaddr_notifier(&drvr->inetaddr_notifier);
  10374. -+ if (ret)
  10375. -+ goto fail;
  10376. -+
  10377. -+#if IS_ENABLED(CONFIG_IPV6)
  10378. -+ drvr->inet6addr_notifier.notifier_call = brcmf_inet6addr_changed;
  10379. -+ ret = register_inet6addr_notifier(&drvr->inet6addr_notifier);
  10380. -+ if (ret) {
  10381. -+ unregister_inetaddr_notifier(&drvr->inetaddr_notifier);
  10382. -+ goto fail;
  10383. -+ }
  10384. - #endif
  10385. -+#endif /* CONFIG_INET */
  10386. -+
  10387. -+ return 0;
  10388. -
  10389. - fail:
  10390. -- if (ret < 0) {
  10391. -- brcmf_err("failed: %d\n", ret);
  10392. -- if (drvr->config) {
  10393. -- brcmf_cfg80211_detach(drvr->config);
  10394. -- drvr->config = NULL;
  10395. -- }
  10396. -- if (drvr->fws) {
  10397. -- brcmf_fws_del_interface(ifp);
  10398. -- brcmf_fws_deinit(drvr);
  10399. -- }
  10400. -- if (ifp)
  10401. -- brcmf_net_detach(ifp->ndev);
  10402. -- if (p2p_ifp)
  10403. -- brcmf_net_detach(p2p_ifp->ndev);
  10404. -- drvr->iflist[0] = NULL;
  10405. -- drvr->iflist[1] = NULL;
  10406. -- if (brcmf_ignoring_probe_fail(drvr))
  10407. -- ret = 0;
  10408. -- return ret;
  10409. -+ brcmf_err("failed: %d\n", ret);
  10410. -+ if (drvr->config) {
  10411. -+ brcmf_cfg80211_detach(drvr->config);
  10412. -+ drvr->config = NULL;
  10413. -+ }
  10414. -+ if (drvr->fws) {
  10415. -+ brcmf_fws_del_interface(ifp);
  10416. -+ brcmf_fws_deinit(drvr);
  10417. - }
  10418. -- return 0;
  10419. -+ if (ifp)
  10420. -+ brcmf_net_detach(ifp->ndev);
  10421. -+ if (p2p_ifp)
  10422. -+ brcmf_net_detach(p2p_ifp->ndev);
  10423. -+ drvr->iflist[0] = NULL;
  10424. -+ drvr->iflist[1] = NULL;
  10425. -+ if (brcmf_ignoring_probe_fail(drvr))
  10426. -+ ret = 0;
  10427. -+
  10428. -+ return ret;
  10429. - }
  10430. -
  10431. - void brcmf_bus_add_txhdrlen(struct device *dev, uint len)
  10432. -@@ -1237,6 +1331,10 @@ void brcmf_detach(struct device *dev)
  10433. - unregister_inetaddr_notifier(&drvr->inetaddr_notifier);
  10434. - #endif
  10435. -
  10436. -+#if IS_ENABLED(CONFIG_IPV6)
  10437. -+ unregister_inet6addr_notifier(&drvr->inet6addr_notifier);
  10438. -+#endif
  10439. -+
  10440. - /* stop firmware event handling */
  10441. - brcmf_fweh_detach(drvr);
  10442. - if (drvr->config)
  10443. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  10444. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  10445. -@@ -48,6 +48,8 @@
  10446. - */
  10447. - #define BRCMF_DRIVER_FIRMWARE_VERSION_LEN 32
  10448. -
  10449. -+#define NDOL_MAX_ENTRIES 8
  10450. -+
  10451. - /**
  10452. - * struct brcmf_ampdu_rx_reorder - AMPDU receive reorder info
  10453. - *
  10454. -@@ -143,6 +145,7 @@ struct brcmf_pub {
  10455. - #endif
  10456. -
  10457. - struct notifier_block inetaddr_notifier;
  10458. -+ struct notifier_block inet6addr_notifier;
  10459. - struct brcmf_mp_device *settings;
  10460. - };
  10461. -
  10462. -@@ -175,6 +178,7 @@ enum brcmf_netif_stop_reason {
  10463. - * @stats: interface specific network statistics.
  10464. - * @setmacaddr_work: worker object for setting mac address.
  10465. - * @multicast_work: worker object for multicast provisioning.
  10466. -+ * @ndoffload_work: worker object for neighbor discovery offload configuration.
  10467. - * @fws_desc: interface specific firmware-signalling descriptor.
  10468. - * @ifidx: interface index in device firmware.
  10469. - * @bsscfgidx: index of bss associated with this interface.
  10470. -@@ -191,6 +195,7 @@ struct brcmf_if {
  10471. - struct net_device_stats stats;
  10472. - struct work_struct setmacaddr_work;
  10473. - struct work_struct multicast_work;
  10474. -+ struct work_struct ndoffload_work;
  10475. - struct brcmf_fws_mac_descriptor *fws_desc;
  10476. - int ifidx;
  10477. - s32 bsscfgidx;
  10478. -@@ -199,6 +204,8 @@ struct brcmf_if {
  10479. - spinlock_t netif_stop_lock;
  10480. - atomic_t pend_8021x_cnt;
  10481. - wait_queue_head_t pend_8021x_wait;
  10482. -+ struct in6_addr ipv6_addr_tbl[NDOL_MAX_ENTRIES];
  10483. -+ u8 ipv6addr_idx;
  10484. - };
  10485. -
  10486. - struct brcmf_skb_reorder_data {
  10487. 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
  10488. deleted file mode 100644
  10489. index 68de8ed2a263a45c4d3e7c4d568801a6925b1a30..0000000000000000000000000000000000000000
  10490. --- a/package/kernel/mac80211/patches/344-0007-brcmfmac-check-return-for-ARP-ip-setting-iovar.patch
  10491. +++ /dev/null
  10492. @@ -1,38 +0,0 @@
  10493. -From: Franky Lin <frankyl@broadcom.com>
  10494. -Date: Wed, 17 Feb 2016 11:26:56 +0100
  10495. -Subject: [PATCH] brcmfmac: check return for ARP ip setting iovar
  10496. -
  10497. -The return value of iovar set function should be saved and checked.
  10498. -
  10499. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10500. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  10501. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  10502. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10503. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10504. ----
  10505. -
  10506. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  10507. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  10508. -@@ -1039,14 +1039,14 @@ static int brcmf_inetaddr_changed(struct
  10509. - return NOTIFY_OK;
  10510. - }
  10511. - for (i = 0; i < ARPOL_MAX_ENTRIES; i++) {
  10512. -- if (addr_table[i] != 0) {
  10513. -- brcmf_fil_iovar_data_set(ifp,
  10514. -- "arp_hostip", &addr_table[i],
  10515. -- sizeof(addr_table[i]));
  10516. -- if (ret)
  10517. -- brcmf_err("add arp ip err %d\n",
  10518. -- ret);
  10519. -- }
  10520. -+ if (addr_table[i] == 0)
  10521. -+ continue;
  10522. -+ ret = brcmf_fil_iovar_data_set(ifp, "arp_hostip",
  10523. -+ &addr_table[i],
  10524. -+ sizeof(addr_table[i]));
  10525. -+ if (ret)
  10526. -+ brcmf_err("add arp ip err %d\n",
  10527. -+ ret);
  10528. - }
  10529. - }
  10530. - break;
  10531. 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
  10532. deleted file mode 100644
  10533. index 3de0f64d560d8a64923f5227e95cbfa2cbfc72df..0000000000000000000000000000000000000000
  10534. --- a/package/kernel/mac80211/patches/344-0008-brcmfmac-use-device-memsize-config-from-fw-if-define.patch
  10535. +++ /dev/null
  10536. @@ -1,73 +0,0 @@
  10537. -From: Hante Meuleman <meuleman@broadcom.com>
  10538. -Date: Wed, 17 Feb 2016 11:26:57 +0100
  10539. -Subject: [PATCH] brcmfmac: use device memsize config from fw if defined
  10540. -
  10541. -Newer type pcie devices have memory which get shared between fw and
  10542. -hw. The division of this memory is done firmware compile time. As a
  10543. -result the ramsize as used by driver needs to be adjusted for this.
  10544. -This is done by reading the memory size from the firmware.
  10545. -
  10546. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  10547. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  10548. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10549. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  10550. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10551. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10552. ----
  10553. -
  10554. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  10555. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  10556. -@@ -207,6 +207,10 @@ static struct brcmf_firmware_mapping brc
  10557. - #define BRCMF_PCIE_CFGREG_REG_BAR3_CONFIG 0x4F4
  10558. - #define BRCMF_PCIE_LINK_STATUS_CTRL_ASPM_ENAB 3
  10559. -
  10560. -+/* Magic number at a magic location to find RAM size */
  10561. -+#define BRCMF_RAMSIZE_MAGIC 0x534d4152 /* SMAR */
  10562. -+#define BRCMF_RAMSIZE_OFFSET 0x6c
  10563. -+
  10564. -
  10565. - struct brcmf_pcie_console {
  10566. - u32 base_addr;
  10567. -@@ -1412,6 +1416,28 @@ static const struct brcmf_bus_ops brcmf_
  10568. - };
  10569. -
  10570. -
  10571. -+static void
  10572. -+brcmf_pcie_adjust_ramsize(struct brcmf_pciedev_info *devinfo, u8 *data,
  10573. -+ u32 data_len)
  10574. -+{
  10575. -+ __le32 *field;
  10576. -+ u32 newsize;
  10577. -+
  10578. -+ if (data_len < BRCMF_RAMSIZE_OFFSET + 8)
  10579. -+ return;
  10580. -+
  10581. -+ field = (__le32 *)&data[BRCMF_RAMSIZE_OFFSET];
  10582. -+ if (le32_to_cpup(field) != BRCMF_RAMSIZE_MAGIC)
  10583. -+ return;
  10584. -+ field++;
  10585. -+ newsize = le32_to_cpup(field);
  10586. -+
  10587. -+ brcmf_dbg(PCIE, "Found ramsize info in FW, adjusting to 0x%x\n",
  10588. -+ newsize);
  10589. -+ devinfo->ci->ramsize = newsize;
  10590. -+}
  10591. -+
  10592. -+
  10593. - static int
  10594. - brcmf_pcie_init_share_ram_info(struct brcmf_pciedev_info *devinfo,
  10595. - u32 sharedram_addr)
  10596. -@@ -1694,6 +1720,13 @@ static void brcmf_pcie_setup(struct devi
  10597. -
  10598. - brcmf_pcie_attach(devinfo);
  10599. -
  10600. -+ /* Some of the firmwares have the size of the memory of the device
  10601. -+ * defined inside the firmware. This is because part of the memory in
  10602. -+ * the device is shared and the devision is determined by FW. Parse
  10603. -+ * the firmware and adjust the chip memory size now.
  10604. -+ */
  10605. -+ brcmf_pcie_adjust_ramsize(devinfo, (u8 *)fw->data, fw->size);
  10606. -+
  10607. - ret = brcmf_pcie_download_fw_nvram(devinfo, fw, nvram, nvram_len);
  10608. - if (ret)
  10609. - goto fail;
  10610. 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
  10611. deleted file mode 100644
  10612. index ca03ffe4b09a5b565b9da2ce4eb13949bb3623b4..0000000000000000000000000000000000000000
  10613. --- a/package/kernel/mac80211/patches/344-0009-brcmfmac-use-bar1-window-size-as-provided-by-pci-sub.patch
  10614. +++ /dev/null
  10615. @@ -1,58 +0,0 @@
  10616. -From: Hante Meuleman <meuleman@broadcom.com>
  10617. -Date: Wed, 17 Feb 2016 11:26:58 +0100
  10618. -Subject: [PATCH] brcmfmac: use bar1 window size as provided by pci subsystem
  10619. -
  10620. -The PCIE bar1 window size is specified by chip. Currently the
  10621. -ioremap of bar1 was using a define which always matched the size
  10622. -of bar1, but newer chips can have a different bar1 sizes. With
  10623. -this patch the ioremap will be called with the by chip provided
  10624. -window size.
  10625. -
  10626. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  10627. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  10628. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10629. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  10630. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10631. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10632. ----
  10633. -
  10634. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  10635. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  10636. -@@ -72,7 +72,6 @@ static struct brcmf_firmware_mapping brc
  10637. -
  10638. - #define BRCMF_PCIE_FW_UP_TIMEOUT 2000 /* msec */
  10639. -
  10640. --#define BRCMF_PCIE_TCM_MAP_SIZE (4096 * 1024)
  10641. - #define BRCMF_PCIE_REG_MAP_SIZE (32 * 1024)
  10642. -
  10643. - /* backplane addres space accessed by BAR0 */
  10644. -@@ -252,7 +251,6 @@ struct brcmf_pciedev_info {
  10645. - char nvram_name[BRCMF_FW_NAME_LEN];
  10646. - void __iomem *regs;
  10647. - void __iomem *tcm;
  10648. -- u32 tcm_size;
  10649. - u32 ram_base;
  10650. - u32 ram_size;
  10651. - struct brcmf_chip *ci;
  10652. -@@ -1592,8 +1590,7 @@ static int brcmf_pcie_get_resource(struc
  10653. - }
  10654. -
  10655. - devinfo->regs = ioremap_nocache(bar0_addr, BRCMF_PCIE_REG_MAP_SIZE);
  10656. -- devinfo->tcm = ioremap_nocache(bar1_addr, BRCMF_PCIE_TCM_MAP_SIZE);
  10657. -- devinfo->tcm_size = BRCMF_PCIE_TCM_MAP_SIZE;
  10658. -+ devinfo->tcm = ioremap_nocache(bar1_addr, bar1_size);
  10659. -
  10660. - if (!devinfo->regs || !devinfo->tcm) {
  10661. - brcmf_err("ioremap() failed (%p,%p)\n", devinfo->regs,
  10662. -@@ -1602,8 +1599,9 @@ static int brcmf_pcie_get_resource(struc
  10663. - }
  10664. - brcmf_dbg(PCIE, "Phys addr : reg space = %p base addr %#016llx\n",
  10665. - devinfo->regs, (unsigned long long)bar0_addr);
  10666. -- brcmf_dbg(PCIE, "Phys addr : mem space = %p base addr %#016llx\n",
  10667. -- devinfo->tcm, (unsigned long long)bar1_addr);
  10668. -+ brcmf_dbg(PCIE, "Phys addr : mem space = %p base addr %#016llx size 0x%x\n",
  10669. -+ devinfo->tcm, (unsigned long long)bar1_addr,
  10670. -+ (unsigned int)bar1_size);
  10671. -
  10672. - return 0;
  10673. - }
  10674. 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
  10675. deleted file mode 100644
  10676. index e4a8f305cf5a8d9029ad5619ef8bcbc10a425ddd..0000000000000000000000000000000000000000
  10677. --- a/package/kernel/mac80211/patches/344-0010-brcmfmac-add-support-for-the-PCIE-4366c0-chip.patch
  10678. +++ /dev/null
  10679. @@ -1,34 +0,0 @@
  10680. -From: Hante Meuleman <meuleman@broadcom.com>
  10681. -Date: Wed, 17 Feb 2016 11:26:59 +0100
  10682. -Subject: [PATCH] brcmfmac: add support for the PCIE 4366c0 chip
  10683. -
  10684. -A newer version of the 4366 PCIE chip has been released. Add
  10685. -support for this version of the chip.
  10686. -
  10687. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  10688. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10689. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  10690. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10691. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10692. ----
  10693. -
  10694. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  10695. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  10696. -@@ -53,6 +53,7 @@ BRCMF_FW_NVRAM_DEF(4358, "brcmfmac4358-p
  10697. - BRCMF_FW_NVRAM_DEF(4359, "brcmfmac4359-pcie.bin", "brcmfmac4359-pcie.txt");
  10698. - BRCMF_FW_NVRAM_DEF(4365B, "brcmfmac4365b-pcie.bin", "brcmfmac4365b-pcie.txt");
  10699. - BRCMF_FW_NVRAM_DEF(4366B, "brcmfmac4366b-pcie.bin", "brcmfmac4366b-pcie.txt");
  10700. -+BRCMF_FW_NVRAM_DEF(4366C, "brcmfmac4366c-pcie.bin", "brcmfmac4366c-pcie.txt");
  10701. - BRCMF_FW_NVRAM_DEF(4371, "brcmfmac4371-pcie.bin", "brcmfmac4371-pcie.txt");
  10702. -
  10703. - static struct brcmf_firmware_mapping brcmf_pcie_fwnames[] = {
  10704. -@@ -66,7 +67,8 @@ static struct brcmf_firmware_mapping brc
  10705. - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4358_CHIP_ID, 0xFFFFFFFF, 4358),
  10706. - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4359_CHIP_ID, 0xFFFFFFFF, 4359),
  10707. - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4365_CHIP_ID, 0xFFFFFFFF, 4365B),
  10708. -- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4366_CHIP_ID, 0xFFFFFFFF, 4366B),
  10709. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4366_CHIP_ID, 0x0000000F, 4366B),
  10710. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4366_CHIP_ID, 0xFFFFFFF0, 4366C),
  10711. - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4371_CHIP_ID, 0xFFFFFFFF, 4371),
  10712. - };
  10713. -
  10714. 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
  10715. deleted file mode 100644
  10716. index f99f6dbf07660777a50fda006c049027ef88b16d..0000000000000000000000000000000000000000
  10717. --- a/package/kernel/mac80211/patches/344-0011-brcmfmac-remove-pcie-gen1-support.patch
  10718. +++ /dev/null
  10719. @@ -1,221 +0,0 @@
  10720. -From: Hante Meuleman <meuleman@broadcom.com>
  10721. -Date: Wed, 17 Feb 2016 11:27:00 +0100
  10722. -Subject: [PATCH] brcmfmac: remove pcie gen1 support
  10723. -
  10724. -The PCIE bus driver supports older gen1 (v1) chips, but there is no
  10725. -actual device which is using this older pcie core which is supported
  10726. -by brcmfmac. Remove all gen1 related code.
  10727. -
  10728. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  10729. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  10730. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10731. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  10732. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10733. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10734. ----
  10735. -
  10736. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  10737. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  10738. -@@ -100,9 +100,6 @@ static struct brcmf_firmware_mapping brc
  10739. - #define BRCMF_PCIE_PCIE2REG_CONFIGDATA 0x124
  10740. - #define BRCMF_PCIE_PCIE2REG_H2D_MAILBOX 0x140
  10741. -
  10742. --#define BRCMF_PCIE_GENREV1 1
  10743. --#define BRCMF_PCIE_GENREV2 2
  10744. --
  10745. - #define BRCMF_PCIE2_INTA 0x01
  10746. - #define BRCMF_PCIE2_INTB 0x02
  10747. -
  10748. -@@ -257,9 +254,7 @@ struct brcmf_pciedev_info {
  10749. - u32 ram_size;
  10750. - struct brcmf_chip *ci;
  10751. - u32 coreid;
  10752. -- u32 generic_corerev;
  10753. - struct brcmf_pcie_shared_info shared;
  10754. -- void (*ringbell)(struct brcmf_pciedev_info *devinfo);
  10755. - wait_queue_head_t mbdata_resp_wait;
  10756. - bool mbdata_completed;
  10757. - bool irq_allocated;
  10758. -@@ -746,68 +741,22 @@ static void brcmf_pcie_bus_console_read(
  10759. - }
  10760. -
  10761. -
  10762. --static __used void brcmf_pcie_ringbell_v1(struct brcmf_pciedev_info *devinfo)
  10763. --{
  10764. -- u32 reg_value;
  10765. --
  10766. -- brcmf_dbg(PCIE, "RING !\n");
  10767. -- reg_value = brcmf_pcie_read_reg32(devinfo,
  10768. -- BRCMF_PCIE_PCIE2REG_MAILBOXINT);
  10769. -- reg_value |= BRCMF_PCIE2_INTB;
  10770. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT,
  10771. -- reg_value);
  10772. --}
  10773. --
  10774. --
  10775. --static void brcmf_pcie_ringbell_v2(struct brcmf_pciedev_info *devinfo)
  10776. --{
  10777. -- brcmf_dbg(PCIE, "RING !\n");
  10778. -- /* Any arbitrary value will do, lets use 1 */
  10779. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_H2D_MAILBOX, 1);
  10780. --}
  10781. --
  10782. --
  10783. - static void brcmf_pcie_intr_disable(struct brcmf_pciedev_info *devinfo)
  10784. - {
  10785. -- if (devinfo->generic_corerev == BRCMF_PCIE_GENREV1)
  10786. -- pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_INTMASK,
  10787. -- 0);
  10788. -- else
  10789. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXMASK,
  10790. -- 0);
  10791. -+ brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXMASK, 0);
  10792. - }
  10793. -
  10794. -
  10795. - static void brcmf_pcie_intr_enable(struct brcmf_pciedev_info *devinfo)
  10796. - {
  10797. -- if (devinfo->generic_corerev == BRCMF_PCIE_GENREV1)
  10798. -- pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_INTMASK,
  10799. -- BRCMF_PCIE_INT_DEF);
  10800. -- else
  10801. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXMASK,
  10802. -- BRCMF_PCIE_MB_INT_D2H_DB |
  10803. -- BRCMF_PCIE_MB_INT_FN0_0 |
  10804. -- BRCMF_PCIE_MB_INT_FN0_1);
  10805. -+ brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXMASK,
  10806. -+ BRCMF_PCIE_MB_INT_D2H_DB |
  10807. -+ BRCMF_PCIE_MB_INT_FN0_0 |
  10808. -+ BRCMF_PCIE_MB_INT_FN0_1);
  10809. - }
  10810. -
  10811. -
  10812. --static irqreturn_t brcmf_pcie_quick_check_isr_v1(int irq, void *arg)
  10813. --{
  10814. -- struct brcmf_pciedev_info *devinfo = (struct brcmf_pciedev_info *)arg;
  10815. -- u32 status;
  10816. --
  10817. -- status = 0;
  10818. -- pci_read_config_dword(devinfo->pdev, BRCMF_PCIE_REG_INTSTATUS, &status);
  10819. -- if (status) {
  10820. -- brcmf_pcie_intr_disable(devinfo);
  10821. -- brcmf_dbg(PCIE, "Enter\n");
  10822. -- return IRQ_WAKE_THREAD;
  10823. -- }
  10824. -- return IRQ_NONE;
  10825. --}
  10826. --
  10827. --
  10828. --static irqreturn_t brcmf_pcie_quick_check_isr_v2(int irq, void *arg)
  10829. -+static irqreturn_t brcmf_pcie_quick_check_isr(int irq, void *arg)
  10830. - {
  10831. - struct brcmf_pciedev_info *devinfo = (struct brcmf_pciedev_info *)arg;
  10832. -
  10833. -@@ -820,29 +769,7 @@ static irqreturn_t brcmf_pcie_quick_chec
  10834. - }
  10835. -
  10836. -
  10837. --static irqreturn_t brcmf_pcie_isr_thread_v1(int irq, void *arg)
  10838. --{
  10839. -- struct brcmf_pciedev_info *devinfo = (struct brcmf_pciedev_info *)arg;
  10840. -- const struct pci_dev *pdev = devinfo->pdev;
  10841. -- u32 status;
  10842. --
  10843. -- devinfo->in_irq = true;
  10844. -- status = 0;
  10845. -- pci_read_config_dword(pdev, BRCMF_PCIE_REG_INTSTATUS, &status);
  10846. -- brcmf_dbg(PCIE, "Enter %x\n", status);
  10847. -- if (status) {
  10848. -- pci_write_config_dword(pdev, BRCMF_PCIE_REG_INTSTATUS, status);
  10849. -- if (devinfo->state == BRCMFMAC_PCIE_STATE_UP)
  10850. -- brcmf_proto_msgbuf_rx_trigger(&devinfo->pdev->dev);
  10851. -- }
  10852. -- if (devinfo->state == BRCMFMAC_PCIE_STATE_UP)
  10853. -- brcmf_pcie_intr_enable(devinfo);
  10854. -- devinfo->in_irq = false;
  10855. -- return IRQ_HANDLED;
  10856. --}
  10857. --
  10858. --
  10859. --static irqreturn_t brcmf_pcie_isr_thread_v2(int irq, void *arg)
  10860. -+static irqreturn_t brcmf_pcie_isr_thread(int irq, void *arg)
  10861. - {
  10862. - struct brcmf_pciedev_info *devinfo = (struct brcmf_pciedev_info *)arg;
  10863. - u32 status;
  10864. -@@ -879,28 +806,14 @@ static int brcmf_pcie_request_irq(struct
  10865. - brcmf_pcie_intr_disable(devinfo);
  10866. -
  10867. - brcmf_dbg(PCIE, "Enter\n");
  10868. -- /* is it a v1 or v2 implementation */
  10869. -+
  10870. - pci_enable_msi(pdev);
  10871. -- if (devinfo->generic_corerev == BRCMF_PCIE_GENREV1) {
  10872. -- if (request_threaded_irq(pdev->irq,
  10873. -- brcmf_pcie_quick_check_isr_v1,
  10874. -- brcmf_pcie_isr_thread_v1,
  10875. -- IRQF_SHARED, "brcmf_pcie_intr",
  10876. -- devinfo)) {
  10877. -- pci_disable_msi(pdev);
  10878. -- brcmf_err("Failed to request IRQ %d\n", pdev->irq);
  10879. -- return -EIO;
  10880. -- }
  10881. -- } else {
  10882. -- if (request_threaded_irq(pdev->irq,
  10883. -- brcmf_pcie_quick_check_isr_v2,
  10884. -- brcmf_pcie_isr_thread_v2,
  10885. -- IRQF_SHARED, "brcmf_pcie_intr",
  10886. -- devinfo)) {
  10887. -- pci_disable_msi(pdev);
  10888. -- brcmf_err("Failed to request IRQ %d\n", pdev->irq);
  10889. -- return -EIO;
  10890. -- }
  10891. -+ if (request_threaded_irq(pdev->irq, brcmf_pcie_quick_check_isr,
  10892. -+ brcmf_pcie_isr_thread, IRQF_SHARED,
  10893. -+ "brcmf_pcie_intr", devinfo)) {
  10894. -+ pci_disable_msi(pdev);
  10895. -+ brcmf_err("Failed to request IRQ %d\n", pdev->irq);
  10896. -+ return -EIO;
  10897. - }
  10898. - devinfo->irq_allocated = true;
  10899. - return 0;
  10900. -@@ -931,16 +844,9 @@ static void brcmf_pcie_release_irq(struc
  10901. - if (devinfo->in_irq)
  10902. - brcmf_err("Still in IRQ (processing) !!!\n");
  10903. -
  10904. -- if (devinfo->generic_corerev == BRCMF_PCIE_GENREV1) {
  10905. -- status = 0;
  10906. -- pci_read_config_dword(pdev, BRCMF_PCIE_REG_INTSTATUS, &status);
  10907. -- pci_write_config_dword(pdev, BRCMF_PCIE_REG_INTSTATUS, status);
  10908. -- } else {
  10909. -- status = brcmf_pcie_read_reg32(devinfo,
  10910. -- BRCMF_PCIE_PCIE2REG_MAILBOXINT);
  10911. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT,
  10912. -- status);
  10913. -- }
  10914. -+ status = brcmf_pcie_read_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT);
  10915. -+ brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT, status);
  10916. -+
  10917. - devinfo->irq_allocated = false;
  10918. - }
  10919. -
  10920. -@@ -989,7 +895,9 @@ static int brcmf_pcie_ring_mb_ring_bell(
  10921. - if (devinfo->state != BRCMFMAC_PCIE_STATE_UP)
  10922. - return -EIO;
  10923. -
  10924. -- devinfo->ringbell(devinfo);
  10925. -+ brcmf_dbg(PCIE, "RING !\n");
  10926. -+ /* Any arbitrary value will do, lets use 1 */
  10927. -+ brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_H2D_MAILBOX, 1);
  10928. -
  10929. - return 0;
  10930. - }
  10931. -@@ -1503,9 +1411,6 @@ static int brcmf_pcie_download_fw_nvram(
  10932. - u32 address;
  10933. - u32 resetintr;
  10934. -
  10935. -- devinfo->ringbell = brcmf_pcie_ringbell_v2;
  10936. -- devinfo->generic_corerev = BRCMF_PCIE_GENREV2;
  10937. --
  10938. - brcmf_dbg(PCIE, "Halt ARM.\n");
  10939. - err = brcmf_pcie_enter_download_state(devinfo);
  10940. - if (err)
  10941. 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
  10942. deleted file mode 100644
  10943. index 4adfc2dc644ab901dae25abcbd2e3c4845802bb5..0000000000000000000000000000000000000000
  10944. --- a/package/kernel/mac80211/patches/344-0012-brcmfmac-increase-timeout-for-tx-eapol.patch
  10945. +++ /dev/null
  10946. @@ -1,30 +0,0 @@
  10947. -From: Hante Meuleman <meuleman@broadcom.com>
  10948. -Date: Wed, 17 Feb 2016 11:27:01 +0100
  10949. -Subject: [PATCH] brcmfmac: increase timeout for tx eapol
  10950. -
  10951. -When keys get set and updated this has to happen after eapol got
  10952. -transmitted (without key or old key) before the key can be updated.
  10953. -To make sure the order of sending eapol and configuring key is done
  10954. -correctly a timeout for tx of eapol is applied. This timeout is set
  10955. -to 50 msec, which is not always enough. Especially in AP mode and
  10956. -key updates the timeout may need to be much longer because client(s)
  10957. -can be in powersave. Increase the timeout from 50 to 950 msec.
  10958. -
  10959. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  10960. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10961. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  10962. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10963. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10964. ----
  10965. -
  10966. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  10967. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  10968. -@@ -42,7 +42,7 @@ MODULE_AUTHOR("Broadcom Corporation");
  10969. - MODULE_DESCRIPTION("Broadcom 802.11 wireless LAN fullmac driver.");
  10970. - MODULE_LICENSE("Dual BSD/GPL");
  10971. -
  10972. --#define MAX_WAIT_FOR_8021X_TX msecs_to_jiffies(50)
  10973. -+#define MAX_WAIT_FOR_8021X_TX msecs_to_jiffies(950)
  10974. -
  10975. - /* AMPDU rx reordering definitions */
  10976. - #define BRCMF_RXREORDER_FLOWID_OFFSET 0
  10977. 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
  10978. deleted file mode 100644
  10979. index bd62781188c37c339ab5eafb8434b6a5d07677bd..0000000000000000000000000000000000000000
  10980. --- a/package/kernel/mac80211/patches/344-0013-brcmfmac-move-module-init-and-exit-to-common.patch
  10981. +++ /dev/null
  10982. @@ -1,135 +0,0 @@
  10983. -From: Hante Meuleman <meuleman@broadcom.com>
  10984. -Date: Wed, 17 Feb 2016 11:27:02 +0100
  10985. -Subject: [PATCH] brcmfmac: move module init and exit to common
  10986. -
  10987. -In preparation of module parameters for all devices the module init
  10988. -and exit routines are moved to the common file.
  10989. -
  10990. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  10991. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  10992. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10993. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  10994. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10995. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10996. ----
  10997. -
  10998. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  10999. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  11000. -@@ -28,6 +28,10 @@
  11001. - #include "tracepoint.h"
  11002. - #include "common.h"
  11003. -
  11004. -+MODULE_AUTHOR("Broadcom Corporation");
  11005. -+MODULE_DESCRIPTION("Broadcom 802.11 wireless LAN fullmac driver.");
  11006. -+MODULE_LICENSE("Dual BSD/GPL");
  11007. -+
  11008. - const u8 ALLFFMAC[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
  11009. -
  11010. - #define BRCMF_DEFAULT_SCAN_CHANNEL_TIME 40
  11011. -@@ -221,7 +225,7 @@ void __brcmf_dbg(u32 level, const char *
  11012. - }
  11013. - #endif
  11014. -
  11015. --void brcmf_mp_attach(void)
  11016. -+static void brcmf_mp_attach(void)
  11017. - {
  11018. - strlcpy(brcmf_mp_global.firmware_path, brcmf_firmware_path,
  11019. - BRCMF_FW_ALTPATH_LEN);
  11020. -@@ -249,3 +253,33 @@ void brcmf_mp_device_detach(struct brcmf
  11021. - kfree(drvr->settings);
  11022. - }
  11023. -
  11024. -+static int __init brcmfmac_module_init(void)
  11025. -+{
  11026. -+ int err;
  11027. -+
  11028. -+ /* Initialize debug system first */
  11029. -+ brcmf_debugfs_init();
  11030. -+
  11031. -+#ifdef CPTCFG_BRCMFMAC_SDIO
  11032. -+ brcmf_sdio_init();
  11033. -+#endif
  11034. -+ /* Initialize global module paramaters */
  11035. -+ brcmf_mp_attach();
  11036. -+
  11037. -+ /* Continue the initialization by registering the different busses */
  11038. -+ err = brcmf_core_init();
  11039. -+ if (err)
  11040. -+ brcmf_debugfs_exit();
  11041. -+
  11042. -+ return err;
  11043. -+}
  11044. -+
  11045. -+static void __exit brcmfmac_module_exit(void)
  11046. -+{
  11047. -+ brcmf_core_exit();
  11048. -+ brcmf_debugfs_exit();
  11049. -+}
  11050. -+
  11051. -+module_init(brcmfmac_module_init);
  11052. -+module_exit(brcmfmac_module_exit);
  11053. -+
  11054. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
  11055. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
  11056. -@@ -89,7 +89,6 @@ struct brcmf_mp_device {
  11057. - struct cc_translate *country_codes;
  11058. - };
  11059. -
  11060. --void brcmf_mp_attach(void);
  11061. - int brcmf_mp_device_attach(struct brcmf_pub *drvr);
  11062. - void brcmf_mp_device_detach(struct brcmf_pub *drvr);
  11063. - #ifdef DEBUG
  11064. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  11065. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  11066. -@@ -38,10 +38,6 @@
  11067. - #include "pcie.h"
  11068. - #include "common.h"
  11069. -
  11070. --MODULE_AUTHOR("Broadcom Corporation");
  11071. --MODULE_DESCRIPTION("Broadcom 802.11 wireless LAN fullmac driver.");
  11072. --MODULE_LICENSE("Dual BSD/GPL");
  11073. --
  11074. - #define MAX_WAIT_FOR_8021X_TX msecs_to_jiffies(950)
  11075. -
  11076. - /* AMPDU rx reordering definitions */
  11077. -@@ -1422,19 +1418,15 @@ static void brcmf_driver_register(struct
  11078. - }
  11079. - static DECLARE_WORK(brcmf_driver_work, brcmf_driver_register);
  11080. -
  11081. --static int __init brcmfmac_module_init(void)
  11082. -+int __init brcmf_core_init(void)
  11083. - {
  11084. -- brcmf_debugfs_init();
  11085. --#ifdef CPTCFG_BRCMFMAC_SDIO
  11086. -- brcmf_sdio_init();
  11087. --#endif
  11088. - if (!schedule_work(&brcmf_driver_work))
  11089. - return -EBUSY;
  11090. -
  11091. - return 0;
  11092. - }
  11093. -
  11094. --static void __exit brcmfmac_module_exit(void)
  11095. -+void __exit brcmf_core_exit(void)
  11096. - {
  11097. - cancel_work_sync(&brcmf_driver_work);
  11098. -
  11099. -@@ -1447,8 +1439,5 @@ static void __exit brcmfmac_module_exit(
  11100. - #ifdef CPTCFG_BRCMFMAC_PCIE
  11101. - brcmf_pcie_exit();
  11102. - #endif
  11103. -- brcmf_debugfs_exit();
  11104. - }
  11105. -
  11106. --module_init(brcmfmac_module_init);
  11107. --module_exit(brcmfmac_module_exit);
  11108. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  11109. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  11110. -@@ -227,5 +227,7 @@ void brcmf_txflowblock_if(struct brcmf_i
  11111. - void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
  11112. - void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb);
  11113. - void brcmf_net_setcarrier(struct brcmf_if *ifp, bool on);
  11114. -+int __init brcmf_core_init(void);
  11115. -+void __exit brcmf_core_exit(void);
  11116. -
  11117. - #endif /* BRCMFMAC_CORE_H */
  11118. 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
  11119. deleted file mode 100644
  11120. index 577ca8ed2837b3c480be022067e7b8389f13af01..0000000000000000000000000000000000000000
  11121. --- a/package/kernel/mac80211/patches/344-0014-brcmfmac-add-wowl-gtk-rekeying-offload-support.patch
  11122. +++ /dev/null
  11123. @@ -1,260 +0,0 @@
  11124. -From: Hante Meuleman <meuleman@broadcom.com>
  11125. -Date: Wed, 17 Feb 2016 11:27:03 +0100
  11126. -Subject: [PATCH] brcmfmac: add wowl gtk rekeying offload support
  11127. -
  11128. -This patch adds support for gtk rekeying offload and for gtk
  11129. -rekeying failure during wowl mode.
  11130. -
  11131. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  11132. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  11133. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11134. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  11135. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11136. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11137. ----
  11138. -
  11139. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  11140. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  11141. -@@ -3526,6 +3526,10 @@ static void brcmf_report_wowl_wakeind(st
  11142. - else
  11143. - wakeup_data.net_detect = cfg->wowl.nd_info;
  11144. - }
  11145. -+ if (wakeind & BRCMF_WOWL_GTK_FAILURE) {
  11146. -+ brcmf_dbg(INFO, "WOWL Wake indicator: BRCMF_WOWL_GTK_FAILURE\n");
  11147. -+ wakeup_data.gtk_rekey_failure = true;
  11148. -+ }
  11149. - } else {
  11150. - wakeup = NULL;
  11151. - }
  11152. -@@ -3607,6 +3611,8 @@ static void brcmf_configure_wowl(struct
  11153. - brcmf_fweh_register(cfg->pub, BRCMF_E_PFN_NET_FOUND,
  11154. - brcmf_wowl_nd_results);
  11155. - }
  11156. -+ if (wowl->gtk_rekey_failure)
  11157. -+ wowl_config |= BRCMF_WOWL_GTK_FAILURE;
  11158. - if (!test_bit(BRCMF_VIF_STATUS_CONNECTED, &ifp->vif->sme_state))
  11159. - wowl_config |= BRCMF_WOWL_UNASSOC;
  11160. -
  11161. -@@ -4874,7 +4880,32 @@ static int brcmf_cfg80211_tdls_oper(stru
  11162. - return ret;
  11163. - }
  11164. -
  11165. --static struct cfg80211_ops wl_cfg80211_ops = {
  11166. -+#ifdef CONFIG_PM
  11167. -+static int
  11168. -+brcmf_cfg80211_set_rekey_data(struct wiphy *wiphy, struct net_device *ndev,
  11169. -+ struct cfg80211_gtk_rekey_data *gtk)
  11170. -+{
  11171. -+ struct brcmf_if *ifp = netdev_priv(ndev);
  11172. -+ struct brcmf_gtk_keyinfo_le gtk_le;
  11173. -+ int ret;
  11174. -+
  11175. -+ brcmf_dbg(TRACE, "Enter, bssidx=%d\n", ifp->bsscfgidx);
  11176. -+
  11177. -+ memcpy(gtk_le.kck, gtk->kck, sizeof(gtk_le.kck));
  11178. -+ memcpy(gtk_le.kek, gtk->kek, sizeof(gtk_le.kek));
  11179. -+ memcpy(gtk_le.replay_counter, gtk->replay_ctr,
  11180. -+ sizeof(gtk_le.replay_counter));
  11181. -+
  11182. -+ ret = brcmf_fil_iovar_data_set(ifp, "gtk_key_info", &gtk_le,
  11183. -+ sizeof(gtk_le));
  11184. -+ if (ret < 0)
  11185. -+ brcmf_err("gtk_key_info iovar failed: ret=%d\n", ret);
  11186. -+
  11187. -+ return ret;
  11188. -+}
  11189. -+#endif
  11190. -+
  11191. -+static struct cfg80211_ops brcmf_cfg80211_ops = {
  11192. - .add_virtual_intf = brcmf_cfg80211_add_iface,
  11193. - .del_virtual_intf = brcmf_cfg80211_del_iface,
  11194. - .change_virtual_intf = brcmf_cfg80211_change_iface,
  11195. -@@ -6139,19 +6170,18 @@ static void brcmf_wiphy_wowl_params(stru
  11196. - {
  11197. - #ifdef CONFIG_PM
  11198. - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
  11199. -- s32 err;
  11200. -- u32 wowl_cap;
  11201. -
  11202. - if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_PNO)) {
  11203. -- err = brcmf_fil_iovar_int_get(ifp, "wowl_cap", &wowl_cap);
  11204. -- if (!err) {
  11205. -- if (wowl_cap & BRCMF_WOWL_PFN_FOUND) {
  11206. -- brcmf_wowlan_support.flags |=
  11207. -- WIPHY_WOWLAN_NET_DETECT;
  11208. -- init_waitqueue_head(&cfg->wowl.nd_data_wait);
  11209. -- }
  11210. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL_ND)) {
  11211. -+ brcmf_wowlan_support.flags |= WIPHY_WOWLAN_NET_DETECT;
  11212. -+ init_waitqueue_head(&cfg->wowl.nd_data_wait);
  11213. - }
  11214. - }
  11215. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL_GTK)) {
  11216. -+ brcmf_wowlan_support.flags |= WIPHY_WOWLAN_SUPPORTS_GTK_REKEY;
  11217. -+ brcmf_wowlan_support.flags |= WIPHY_WOWLAN_GTK_REKEY_FAILURE;
  11218. -+ }
  11219. -+
  11220. - wiphy->wowlan = &brcmf_wowlan_support;
  11221. - #endif
  11222. - }
  11223. -@@ -6538,6 +6568,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  11224. - struct net_device *ndev = brcmf_get_ifp(drvr, 0)->ndev;
  11225. - struct brcmf_cfg80211_info *cfg;
  11226. - struct wiphy *wiphy;
  11227. -+ struct cfg80211_ops *ops;
  11228. - struct brcmf_cfg80211_vif *vif;
  11229. - struct brcmf_if *ifp;
  11230. - s32 err = 0;
  11231. -@@ -6549,8 +6580,17 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  11232. - return NULL;
  11233. - }
  11234. -
  11235. -+ ops = kzalloc(sizeof(*ops), GFP_KERNEL);
  11236. -+ if (!ops)
  11237. -+ return NULL;
  11238. -+
  11239. -+ memcpy(ops, &brcmf_cfg80211_ops, sizeof(*ops));
  11240. - ifp = netdev_priv(ndev);
  11241. -- wiphy = wiphy_new(&wl_cfg80211_ops, sizeof(struct brcmf_cfg80211_info));
  11242. -+#ifdef CONFIG_PM
  11243. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL_GTK))
  11244. -+ ops->set_rekey_data = brcmf_cfg80211_set_rekey_data;
  11245. -+#endif
  11246. -+ wiphy = wiphy_new(ops, sizeof(struct brcmf_cfg80211_info));
  11247. - if (!wiphy) {
  11248. - brcmf_err("Could not allocate wiphy device\n");
  11249. - return NULL;
  11250. -@@ -6560,6 +6600,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  11251. -
  11252. - cfg = wiphy_priv(wiphy);
  11253. - cfg->wiphy = wiphy;
  11254. -+ cfg->ops = ops;
  11255. - cfg->pub = drvr;
  11256. - init_vif_event(&cfg->vif_event);
  11257. - INIT_LIST_HEAD(&cfg->vif_list);
  11258. -@@ -6686,6 +6727,7 @@ priv_out:
  11259. - ifp->vif = NULL;
  11260. - wiphy_out:
  11261. - brcmf_free_wiphy(wiphy);
  11262. -+ kfree(ops);
  11263. - return NULL;
  11264. - }
  11265. -
  11266. -@@ -6696,6 +6738,7 @@ void brcmf_cfg80211_detach(struct brcmf_
  11267. -
  11268. - brcmf_btcoex_detach(cfg);
  11269. - wiphy_unregister(cfg->wiphy);
  11270. -+ kfree(cfg->ops);
  11271. - wl_deinit_priv(cfg);
  11272. - brcmf_free_wiphy(cfg->wiphy);
  11273. - }
  11274. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  11275. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  11276. -@@ -256,6 +256,7 @@ struct brcmf_cfg80211_wowl {
  11277. - * struct brcmf_cfg80211_info - dongle private data of cfg80211 interface
  11278. - *
  11279. - * @wiphy: wiphy object for cfg80211 interface.
  11280. -+ * @ops: pointer to copy of ops as registered with wiphy object.
  11281. - * @conf: dongle configuration.
  11282. - * @p2p: peer-to-peer specific information.
  11283. - * @btcoex: Bluetooth coexistence information.
  11284. -@@ -288,6 +289,7 @@ struct brcmf_cfg80211_wowl {
  11285. - */
  11286. - struct brcmf_cfg80211_info {
  11287. - struct wiphy *wiphy;
  11288. -+ struct cfg80211_ops *ops;
  11289. - struct brcmf_cfg80211_conf *conf;
  11290. - struct brcmf_p2p_info p2p;
  11291. - struct brcmf_btcoex_info *btcoex;
  11292. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
  11293. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
  11294. -@@ -136,6 +136,7 @@ void brcmf_feat_attach(struct brcmf_pub
  11295. - {
  11296. - struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
  11297. - struct brcmf_pno_macaddr_le pfn_mac;
  11298. -+ u32 wowl_cap;
  11299. - s32 err;
  11300. -
  11301. - brcmf_feat_firmware_capabilities(ifp);
  11302. -@@ -143,6 +144,17 @@ void brcmf_feat_attach(struct brcmf_pub
  11303. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_PNO, "pfn");
  11304. - if (drvr->bus_if->wowl_supported)
  11305. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_WOWL, "wowl");
  11306. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL)) {
  11307. -+ err = brcmf_fil_iovar_int_get(ifp, "wowl_cap", &wowl_cap);
  11308. -+ if (!err) {
  11309. -+ if (wowl_cap & BRCMF_WOWL_PFN_FOUND)
  11310. -+ ifp->drvr->feat_flags |=
  11311. -+ BIT(BRCMF_FEAT_WOWL_ND);
  11312. -+ if (wowl_cap & BRCMF_WOWL_GTK_FAILURE)
  11313. -+ ifp->drvr->feat_flags |=
  11314. -+ BIT(BRCMF_FEAT_WOWL_GTK);
  11315. -+ }
  11316. -+ }
  11317. - /* MBSS does not work for 43362 */
  11318. - if (drvr->bus_if->chip == BRCM_CC_43362_CHIP_ID)
  11319. - ifp->drvr->feat_flags &= ~BIT(BRCMF_FEAT_MBSS);
  11320. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h
  11321. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h
  11322. -@@ -27,6 +27,8 @@
  11323. - * RSDB: Real Simultaneous Dual Band
  11324. - * TDLS: Tunneled Direct Link Setup
  11325. - * SCAN_RANDOM_MAC: Random MAC during (net detect) scheduled scan.
  11326. -+ * WOWL_ND: WOWL net detect (PNO)
  11327. -+ * WOWL_GTK: (WOWL) GTK rekeying offload
  11328. - */
  11329. - #define BRCMF_FEAT_LIST \
  11330. - BRCMF_FEAT_DEF(MBSS) \
  11331. -@@ -36,7 +38,9 @@
  11332. - BRCMF_FEAT_DEF(P2P) \
  11333. - BRCMF_FEAT_DEF(RSDB) \
  11334. - BRCMF_FEAT_DEF(TDLS) \
  11335. -- BRCMF_FEAT_DEF(SCAN_RANDOM_MAC)
  11336. -+ BRCMF_FEAT_DEF(SCAN_RANDOM_MAC) \
  11337. -+ BRCMF_FEAT_DEF(WOWL_ND) \
  11338. -+ BRCMF_FEAT_DEF(WOWL_GTK)
  11339. -
  11340. - /*
  11341. - * Quirks:
  11342. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h
  11343. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h
  11344. -@@ -111,7 +111,9 @@
  11345. - /* Wakeup if received matched secured pattern: */
  11346. - #define BRCMF_WOWL_SECURE (1 << 25)
  11347. - /* Wakeup on finding preferred network */
  11348. --#define BRCMF_WOWL_PFN_FOUND (1 << 26)
  11349. -+#define BRCMF_WOWL_PFN_FOUND (1 << 27)
  11350. -+/* Wakeup on receiving pairwise key EAP packets: */
  11351. -+#define WIPHY_WOWL_EAP_PK (1 << 28)
  11352. - /* Link Down indication in WoWL mode: */
  11353. - #define BRCMF_WOWL_LINKDOWN (1 << 31)
  11354. -
  11355. -@@ -136,6 +138,10 @@
  11356. -
  11357. - #define BRCMF_MCSSET_LEN 16
  11358. -
  11359. -+#define BRCMF_RSN_KCK_LENGTH 16
  11360. -+#define BRCMF_RSN_KEK_LENGTH 16
  11361. -+#define BRCMF_RSN_REPLAY_LEN 8
  11362. -+
  11363. - /* join preference types for join_pref iovar */
  11364. - enum brcmf_join_pref_types {
  11365. - BRCMF_JOIN_PREF_RSSI = 1,
  11366. -@@ -789,4 +795,17 @@ struct brcmf_pktcnt_le {
  11367. - __le32 rx_ocast_good_pkt;
  11368. - };
  11369. -
  11370. -+/**
  11371. -+ * struct brcmf_gtk_keyinfo_le - GTP rekey data
  11372. -+ *
  11373. -+ * @kck: key confirmation key.
  11374. -+ * @kek: key encryption key.
  11375. -+ * @replay_counter: replay counter.
  11376. -+ */
  11377. -+struct brcmf_gtk_keyinfo_le {
  11378. -+ u8 kck[BRCMF_RSN_KCK_LENGTH];
  11379. -+ u8 kek[BRCMF_RSN_KEK_LENGTH];
  11380. -+ u8 replay_counter[BRCMF_RSN_REPLAY_LEN];
  11381. -+};
  11382. -+
  11383. - #endif /* FWIL_TYPES_H_ */
  11384. 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
  11385. deleted file mode 100644
  11386. index 2685238925444a4d76cfb14d5ec85e69b9b686f1..0000000000000000000000000000000000000000
  11387. --- a/package/kernel/mac80211/patches/344-0015-brcmfmac-move-platform-data-retrieval-code-to-common.patch
  11388. +++ /dev/null
  11389. @@ -1,385 +0,0 @@
  11390. -From: Hante Meuleman <meuleman@broadcom.com>
  11391. -Date: Wed, 17 Feb 2016 11:27:04 +0100
  11392. -Subject: [PATCH] brcmfmac: move platform data retrieval code to common
  11393. -
  11394. -In preparation of module parameters for all devices the module
  11395. -platform data retrieval is moved from sdio to common. It is still
  11396. -only used for sdio devices.
  11397. -
  11398. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  11399. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  11400. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11401. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  11402. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11403. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11404. ----
  11405. -
  11406. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  11407. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  11408. -@@ -27,8 +27,6 @@
  11409. - #include <linux/mmc/sdio_func.h>
  11410. - #include <linux/mmc/card.h>
  11411. - #include <linux/mmc/host.h>
  11412. --#include <linux/platform_device.h>
  11413. --#include <linux/platform_data/brcmfmac-sdio.h>
  11414. - #include <linux/pm_runtime.h>
  11415. - #include <linux/suspend.h>
  11416. - #include <linux/errno.h>
  11417. -@@ -46,7 +44,6 @@
  11418. - #include "bus.h"
  11419. - #include "debug.h"
  11420. - #include "sdio.h"
  11421. --#include "of.h"
  11422. - #include "core.h"
  11423. - #include "common.h"
  11424. -
  11425. -@@ -106,18 +103,18 @@ static void brcmf_sdiod_dummy_irqhandler
  11426. -
  11427. - int brcmf_sdiod_intr_register(struct brcmf_sdio_dev *sdiodev)
  11428. - {
  11429. -+ struct brcmfmac_sdio_platform_data *pdata;
  11430. - int ret = 0;
  11431. - u8 data;
  11432. - u32 addr, gpiocontrol;
  11433. - unsigned long flags;
  11434. -
  11435. -- if ((sdiodev->pdata) && (sdiodev->pdata->oob_irq_supported)) {
  11436. -+ pdata = sdiodev->pdata;
  11437. -+ if ((pdata) && (pdata->oob_irq_supported)) {
  11438. - brcmf_dbg(SDIO, "Enter, register OOB IRQ %d\n",
  11439. -- sdiodev->pdata->oob_irq_nr);
  11440. -- ret = request_irq(sdiodev->pdata->oob_irq_nr,
  11441. -- brcmf_sdiod_oob_irqhandler,
  11442. -- sdiodev->pdata->oob_irq_flags,
  11443. -- "brcmf_oob_intr",
  11444. -+ pdata->oob_irq_nr);
  11445. -+ ret = request_irq(pdata->oob_irq_nr, brcmf_sdiod_oob_irqhandler,
  11446. -+ pdata->oob_irq_flags, "brcmf_oob_intr",
  11447. - &sdiodev->func[1]->dev);
  11448. - if (ret != 0) {
  11449. - brcmf_err("request_irq failed %d\n", ret);
  11450. -@@ -129,7 +126,7 @@ int brcmf_sdiod_intr_register(struct brc
  11451. - sdiodev->irq_en = true;
  11452. - spin_unlock_irqrestore(&sdiodev->irq_en_lock, flags);
  11453. -
  11454. -- ret = enable_irq_wake(sdiodev->pdata->oob_irq_nr);
  11455. -+ ret = enable_irq_wake(pdata->oob_irq_nr);
  11456. - if (ret != 0) {
  11457. - brcmf_err("enable_irq_wake failed %d\n", ret);
  11458. - return ret;
  11459. -@@ -158,7 +155,7 @@ int brcmf_sdiod_intr_register(struct brc
  11460. -
  11461. - /* redirect, configure and enable io for interrupt signal */
  11462. - data = SDIO_SEPINT_MASK | SDIO_SEPINT_OE;
  11463. -- if (sdiodev->pdata->oob_irq_flags & IRQF_TRIGGER_HIGH)
  11464. -+ if (pdata->oob_irq_flags & IRQF_TRIGGER_HIGH)
  11465. - data |= SDIO_SEPINT_ACT_HI;
  11466. - brcmf_sdiod_regwb(sdiodev, SDIO_CCCR_BRCM_SEPINT, data, &ret);
  11467. -
  11468. -@@ -176,9 +173,12 @@ int brcmf_sdiod_intr_register(struct brc
  11469. -
  11470. - int brcmf_sdiod_intr_unregister(struct brcmf_sdio_dev *sdiodev)
  11471. - {
  11472. -+ struct brcmfmac_sdio_platform_data *pdata;
  11473. -+
  11474. - brcmf_dbg(SDIO, "Entering\n");
  11475. -
  11476. -- if ((sdiodev->pdata) && (sdiodev->pdata->oob_irq_supported)) {
  11477. -+ pdata = sdiodev->pdata;
  11478. -+ if ((pdata) && (pdata->oob_irq_supported)) {
  11479. - sdio_claim_host(sdiodev->func[1]);
  11480. - brcmf_sdiod_regwb(sdiodev, SDIO_CCCR_BRCM_SEPINT, 0, NULL);
  11481. - brcmf_sdiod_regwb(sdiodev, SDIO_CCCR_IENx, 0, NULL);
  11482. -@@ -187,11 +187,10 @@ int brcmf_sdiod_intr_unregister(struct b
  11483. - if (sdiodev->oob_irq_requested) {
  11484. - sdiodev->oob_irq_requested = false;
  11485. - if (sdiodev->irq_wake) {
  11486. -- disable_irq_wake(sdiodev->pdata->oob_irq_nr);
  11487. -+ disable_irq_wake(pdata->oob_irq_nr);
  11488. - sdiodev->irq_wake = false;
  11489. - }
  11490. -- free_irq(sdiodev->pdata->oob_irq_nr,
  11491. -- &sdiodev->func[1]->dev);
  11492. -+ free_irq(pdata->oob_irq_nr, &sdiodev->func[1]->dev);
  11493. - sdiodev->irq_en = false;
  11494. - }
  11495. - } else {
  11496. -@@ -1103,8 +1102,6 @@ static const struct sdio_device_id brcmf
  11497. - };
  11498. - MODULE_DEVICE_TABLE(sdio, brcmf_sdmmc_ids);
  11499. -
  11500. --static struct brcmfmac_sdio_platform_data *brcmfmac_sdio_pdata;
  11501. --
  11502. -
  11503. - static void brcmf_sdiod_acpi_set_power_manageable(struct device *dev,
  11504. - int val)
  11505. -@@ -1167,10 +1164,7 @@ static int brcmf_ops_sdio_probe(struct s
  11506. - dev_set_drvdata(&func->dev, bus_if);
  11507. - dev_set_drvdata(&sdiodev->func[1]->dev, bus_if);
  11508. - sdiodev->dev = &sdiodev->func[1]->dev;
  11509. -- sdiodev->pdata = brcmfmac_sdio_pdata;
  11510. --
  11511. -- if (!sdiodev->pdata)
  11512. -- brcmf_of_probe(sdiodev);
  11513. -+ sdiodev->pdata = brcmf_get_module_param(sdiodev->dev);
  11514. -
  11515. - #ifdef CONFIG_PM_SLEEP
  11516. - /* wowl can be supported when KEEP_POWER is true and (WAKE_SDIO_IRQ
  11517. -@@ -1296,7 +1290,7 @@ static const struct dev_pm_ops brcmf_sdi
  11518. - static struct sdio_driver brcmf_sdmmc_driver = {
  11519. - .probe = brcmf_ops_sdio_probe,
  11520. - .remove = brcmf_ops_sdio_remove,
  11521. -- .name = BRCMFMAC_SDIO_PDATA_NAME,
  11522. -+ .name = KBUILD_MODNAME,
  11523. - .id_table = brcmf_sdmmc_ids,
  11524. - .drv = {
  11525. - .owner = THIS_MODULE,
  11526. -@@ -1306,37 +1300,6 @@ static struct sdio_driver brcmf_sdmmc_dr
  11527. - },
  11528. - };
  11529. -
  11530. --static int __init brcmf_sdio_pd_probe(struct platform_device *pdev)
  11531. --{
  11532. -- brcmf_dbg(SDIO, "Enter\n");
  11533. --
  11534. -- brcmfmac_sdio_pdata = dev_get_platdata(&pdev->dev);
  11535. --
  11536. -- if (brcmfmac_sdio_pdata->power_on)
  11537. -- brcmfmac_sdio_pdata->power_on();
  11538. --
  11539. -- return 0;
  11540. --}
  11541. --
  11542. --static int brcmf_sdio_pd_remove(struct platform_device *pdev)
  11543. --{
  11544. -- brcmf_dbg(SDIO, "Enter\n");
  11545. --
  11546. -- if (brcmfmac_sdio_pdata->power_off)
  11547. -- brcmfmac_sdio_pdata->power_off();
  11548. --
  11549. -- sdio_unregister_driver(&brcmf_sdmmc_driver);
  11550. --
  11551. -- return 0;
  11552. --}
  11553. --
  11554. --static struct platform_driver brcmf_sdio_pd = {
  11555. -- .remove = brcmf_sdio_pd_remove,
  11556. -- .driver = {
  11557. -- .name = BRCMFMAC_SDIO_PDATA_NAME,
  11558. -- }
  11559. --};
  11560. --
  11561. - void brcmf_sdio_register(void)
  11562. - {
  11563. - int ret;
  11564. -@@ -1350,19 +1313,6 @@ void brcmf_sdio_exit(void)
  11565. - {
  11566. - brcmf_dbg(SDIO, "Enter\n");
  11567. -
  11568. -- if (brcmfmac_sdio_pdata)
  11569. -- platform_driver_unregister(&brcmf_sdio_pd);
  11570. -- else
  11571. -- sdio_unregister_driver(&brcmf_sdmmc_driver);
  11572. -+ sdio_unregister_driver(&brcmf_sdmmc_driver);
  11573. - }
  11574. -
  11575. --void __init brcmf_sdio_init(void)
  11576. --{
  11577. -- int ret;
  11578. --
  11579. -- brcmf_dbg(SDIO, "Enter\n");
  11580. --
  11581. -- ret = platform_driver_probe(&brcmf_sdio_pd, brcmf_sdio_pd_probe);
  11582. -- if (ret == -ENODEV)
  11583. -- brcmf_dbg(SDIO, "No platform data available.\n");
  11584. --}
  11585. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  11586. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  11587. -@@ -27,6 +27,7 @@
  11588. - #include "fwil_types.h"
  11589. - #include "tracepoint.h"
  11590. - #include "common.h"
  11591. -+#include "of.h"
  11592. -
  11593. - MODULE_AUTHOR("Broadcom Corporation");
  11594. - MODULE_DESCRIPTION("Broadcom 802.11 wireless LAN fullmac driver.");
  11595. -@@ -79,6 +80,7 @@ module_param_named(ignore_probe_fail, br
  11596. - MODULE_PARM_DESC(ignore_probe_fail, "always succeed probe for debugging");
  11597. - #endif
  11598. -
  11599. -+static struct brcmfmac_sdio_platform_data *brcmfmac_pdata;
  11600. - struct brcmf_mp_global_t brcmf_mp_global;
  11601. -
  11602. - int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
  11603. -@@ -231,6 +233,13 @@ static void brcmf_mp_attach(void)
  11604. - BRCMF_FW_ALTPATH_LEN);
  11605. - }
  11606. -
  11607. -+struct brcmfmac_sdio_platform_data *brcmf_get_module_param(struct device *dev)
  11608. -+{
  11609. -+ if (!brcmfmac_pdata)
  11610. -+ brcmf_of_probe(dev, &brcmfmac_pdata);
  11611. -+ return brcmfmac_pdata;
  11612. -+}
  11613. -+
  11614. - int brcmf_mp_device_attach(struct brcmf_pub *drvr)
  11615. - {
  11616. - drvr->settings = kzalloc(sizeof(*drvr->settings), GFP_ATOMIC);
  11617. -@@ -253,6 +262,35 @@ void brcmf_mp_device_detach(struct brcmf
  11618. - kfree(drvr->settings);
  11619. - }
  11620. -
  11621. -+static int __init brcmf_common_pd_probe(struct platform_device *pdev)
  11622. -+{
  11623. -+ brcmf_dbg(INFO, "Enter\n");
  11624. -+
  11625. -+ brcmfmac_pdata = dev_get_platdata(&pdev->dev);
  11626. -+
  11627. -+ if (brcmfmac_pdata->power_on)
  11628. -+ brcmfmac_pdata->power_on();
  11629. -+
  11630. -+ return 0;
  11631. -+}
  11632. -+
  11633. -+static int brcmf_common_pd_remove(struct platform_device *pdev)
  11634. -+{
  11635. -+ brcmf_dbg(INFO, "Enter\n");
  11636. -+
  11637. -+ if (brcmfmac_pdata->power_off)
  11638. -+ brcmfmac_pdata->power_off();
  11639. -+
  11640. -+ return 0;
  11641. -+}
  11642. -+
  11643. -+static struct platform_driver brcmf_pd = {
  11644. -+ .remove = brcmf_common_pd_remove,
  11645. -+ .driver = {
  11646. -+ .name = BRCMFMAC_SDIO_PDATA_NAME,
  11647. -+ }
  11648. -+};
  11649. -+
  11650. - static int __init brcmfmac_module_init(void)
  11651. - {
  11652. - int err;
  11653. -@@ -260,16 +298,21 @@ static int __init brcmfmac_module_init(v
  11654. - /* Initialize debug system first */
  11655. - brcmf_debugfs_init();
  11656. -
  11657. --#ifdef CPTCFG_BRCMFMAC_SDIO
  11658. -- brcmf_sdio_init();
  11659. --#endif
  11660. -+ /* Get the platform data (if available) for our devices */
  11661. -+ err = platform_driver_probe(&brcmf_pd, brcmf_common_pd_probe);
  11662. -+ if (err == -ENODEV)
  11663. -+ brcmf_dbg(INFO, "No platform data available.\n");
  11664. -+
  11665. - /* Initialize global module paramaters */
  11666. - brcmf_mp_attach();
  11667. -
  11668. - /* Continue the initialization by registering the different busses */
  11669. - err = brcmf_core_init();
  11670. -- if (err)
  11671. -+ if (err) {
  11672. - brcmf_debugfs_exit();
  11673. -+ if (brcmfmac_pdata)
  11674. -+ platform_driver_unregister(&brcmf_pd);
  11675. -+ }
  11676. -
  11677. - return err;
  11678. - }
  11679. -@@ -277,6 +320,8 @@ static int __init brcmfmac_module_init(v
  11680. - static void __exit brcmfmac_module_exit(void)
  11681. - {
  11682. - brcmf_core_exit();
  11683. -+ if (brcmfmac_pdata)
  11684. -+ platform_driver_unregister(&brcmf_pd);
  11685. - brcmf_debugfs_exit();
  11686. - }
  11687. -
  11688. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
  11689. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
  11690. -@@ -15,6 +15,8 @@
  11691. - #ifndef BRCMFMAC_COMMON_H
  11692. - #define BRCMFMAC_COMMON_H
  11693. -
  11694. -+#include <linux/platform_device.h>
  11695. -+#include <linux/platform_data/brcmfmac-sdio.h>
  11696. - #include "fwil_types.h"
  11697. -
  11698. - extern const u8 ALLFFMAC[ETH_ALEN];
  11699. -@@ -89,6 +91,7 @@ struct brcmf_mp_device {
  11700. - struct cc_translate *country_codes;
  11701. - };
  11702. -
  11703. -+struct brcmfmac_sdio_platform_data *brcmf_get_module_param(struct device *dev);
  11704. - int brcmf_mp_device_attach(struct brcmf_pub *drvr);
  11705. - void brcmf_mp_device_detach(struct brcmf_pub *drvr);
  11706. - #ifdef DEBUG
  11707. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
  11708. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
  11709. -@@ -16,17 +16,16 @@
  11710. - #include <linux/init.h>
  11711. - #include <linux/of.h>
  11712. - #include <linux/of_irq.h>
  11713. --#include <linux/mmc/card.h>
  11714. --#include <linux/platform_data/brcmfmac-sdio.h>
  11715. --#include <linux/mmc/sdio_func.h>
  11716. -
  11717. - #include <defs.h>
  11718. - #include "debug.h"
  11719. --#include "sdio.h"
  11720. -+#include "core.h"
  11721. -+#include "common.h"
  11722. -+#include "of.h"
  11723. -
  11724. --void brcmf_of_probe(struct brcmf_sdio_dev *sdiodev)
  11725. -+void
  11726. -+brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_platform_data **sdio)
  11727. - {
  11728. -- struct device *dev = sdiodev->dev;
  11729. - struct device_node *np = dev->of_node;
  11730. - int irq;
  11731. - u32 irqf;
  11732. -@@ -35,12 +34,12 @@ void brcmf_of_probe(struct brcmf_sdio_de
  11733. - if (!np || !of_device_is_compatible(np, "brcm,bcm4329-fmac"))
  11734. - return;
  11735. -
  11736. -- sdiodev->pdata = devm_kzalloc(dev, sizeof(*sdiodev->pdata), GFP_KERNEL);
  11737. -- if (!sdiodev->pdata)
  11738. -+ *sdio = devm_kzalloc(dev, sizeof(*sdio), GFP_KERNEL);
  11739. -+ if (!(*sdio))
  11740. - return;
  11741. -
  11742. - if (of_property_read_u32(np, "brcm,drive-strength", &val) == 0)
  11743. -- sdiodev->pdata->drive_strength = val;
  11744. -+ (*sdio)->drive_strength = val;
  11745. -
  11746. - /* make sure there are interrupts defined in the node */
  11747. - if (!of_find_property(np, "interrupts", NULL))
  11748. -@@ -53,7 +52,7 @@ void brcmf_of_probe(struct brcmf_sdio_de
  11749. - }
  11750. - irqf = irqd_get_trigger_type(irq_get_irq_data(irq));
  11751. -
  11752. -- sdiodev->pdata->oob_irq_supported = true;
  11753. -- sdiodev->pdata->oob_irq_nr = irq;
  11754. -- sdiodev->pdata->oob_irq_flags = irqf;
  11755. -+ (*sdio)->oob_irq_supported = true;
  11756. -+ (*sdio)->oob_irq_nr = irq;
  11757. -+ (*sdio)->oob_irq_flags = irqf;
  11758. - }
  11759. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.h
  11760. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.h
  11761. -@@ -14,9 +14,11 @@
  11762. - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  11763. - */
  11764. - #ifdef CONFIG_OF
  11765. --void brcmf_of_probe(struct brcmf_sdio_dev *sdiodev);
  11766. -+void
  11767. -+brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_platform_data **sdio);
  11768. - #else
  11769. --static void brcmf_of_probe(struct brcmf_sdio_dev *sdiodev)
  11770. -+static void brcmf_of_probe(struct device *dev,
  11771. -+ struct brcmfmac_sdio_platform_data **sdio)
  11772. - {
  11773. - }
  11774. - #endif /* CONFIG_OF */
  11775. 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
  11776. deleted file mode 100644
  11777. index 4e789cfc5a6cfc82c584bb59bd7dd4a7a058377b..0000000000000000000000000000000000000000
  11778. --- a/package/kernel/mac80211/patches/344-0016-brcmfmac-keep-ARP-and-ND-offload-enabled-during-WOWL.patch
  11779. +++ /dev/null
  11780. @@ -1,69 +0,0 @@
  11781. -From: Hante Meuleman <meuleman@broadcom.com>
  11782. -Date: Wed, 17 Feb 2016 11:27:05 +0100
  11783. -Subject: [PATCH] brcmfmac: keep ARP and ND offload enabled during WOWL
  11784. -
  11785. -Currently ARP and ND (IPv6 Neigbor Discovery) offload get disabled
  11786. -on entering suspend. However when firmwares support the wowl_cap
  11787. -iovar then these offload routines can be kept enabled as they
  11788. -will work during WOWL as well.
  11789. -
  11790. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  11791. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  11792. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11793. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  11794. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11795. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11796. ----
  11797. -
  11798. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  11799. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  11800. -@@ -3556,7 +3556,8 @@ static s32 brcmf_cfg80211_resume(struct
  11801. - brcmf_report_wowl_wakeind(wiphy, ifp);
  11802. - brcmf_fil_iovar_int_set(ifp, "wowl_clear", 0);
  11803. - brcmf_config_wowl_pattern(ifp, "clr", NULL, 0, NULL, 0);
  11804. -- brcmf_configure_arp_nd_offload(ifp, true);
  11805. -+ if (!brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL_ARP_ND))
  11806. -+ brcmf_configure_arp_nd_offload(ifp, true);
  11807. - brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM,
  11808. - cfg->wowl.pre_pmmode);
  11809. - cfg->wowl.active = false;
  11810. -@@ -3580,7 +3581,8 @@ static void brcmf_configure_wowl(struct
  11811. -
  11812. - brcmf_dbg(TRACE, "Suspend, wowl config.\n");
  11813. -
  11814. -- brcmf_configure_arp_nd_offload(ifp, false);
  11815. -+ if (!brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL_ARP_ND))
  11816. -+ brcmf_configure_arp_nd_offload(ifp, false);
  11817. - brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_PM, &cfg->wowl.pre_pmmode);
  11818. - brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM, PM_MAX);
  11819. -
  11820. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
  11821. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
  11822. -@@ -147,6 +147,7 @@ void brcmf_feat_attach(struct brcmf_pub
  11823. - if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL)) {
  11824. - err = brcmf_fil_iovar_int_get(ifp, "wowl_cap", &wowl_cap);
  11825. - if (!err) {
  11826. -+ ifp->drvr->feat_flags |= BIT(BRCMF_FEAT_WOWL_ARP_ND);
  11827. - if (wowl_cap & BRCMF_WOWL_PFN_FOUND)
  11828. - ifp->drvr->feat_flags |=
  11829. - BIT(BRCMF_FEAT_WOWL_ND);
  11830. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h
  11831. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h
  11832. -@@ -29,6 +29,7 @@
  11833. - * SCAN_RANDOM_MAC: Random MAC during (net detect) scheduled scan.
  11834. - * WOWL_ND: WOWL net detect (PNO)
  11835. - * WOWL_GTK: (WOWL) GTK rekeying offload
  11836. -+ * WOWL_ARP_ND: ARP and Neighbor Discovery offload support during WOWL.
  11837. - */
  11838. - #define BRCMF_FEAT_LIST \
  11839. - BRCMF_FEAT_DEF(MBSS) \
  11840. -@@ -40,7 +41,8 @@
  11841. - BRCMF_FEAT_DEF(TDLS) \
  11842. - BRCMF_FEAT_DEF(SCAN_RANDOM_MAC) \
  11843. - BRCMF_FEAT_DEF(WOWL_ND) \
  11844. -- BRCMF_FEAT_DEF(WOWL_GTK)
  11845. -+ BRCMF_FEAT_DEF(WOWL_GTK) \
  11846. -+ BRCMF_FEAT_DEF(WOWL_ARP_ND)
  11847. -
  11848. - /*
  11849. - * Quirks:
  11850. 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
  11851. deleted file mode 100644
  11852. index 37b68552cc8ce99d021930f5fc78692a7ba92f06..0000000000000000000000000000000000000000
  11853. --- a/package/kernel/mac80211/patches/344-0017-brcmfmac-switch-to-new-platform-data.patch
  11854. +++ /dev/null
  11855. @@ -1,734 +0,0 @@
  11856. -From: Hante Meuleman <meuleman@broadcom.com>
  11857. -Date: Wed, 17 Feb 2016 11:27:07 +0100
  11858. -Subject: [PATCH] brcmfmac: switch to new platform data
  11859. -
  11860. -Platform data is only available for sdio. With this patch a new
  11861. -platform data structure is being used which allows for platform
  11862. -data for any device and configurable per device. This patch only
  11863. -switches to the new structure and adds support for SDIO devices.
  11864. -
  11865. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  11866. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  11867. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11868. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  11869. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11870. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11871. ----
  11872. -
  11873. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  11874. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  11875. -@@ -103,7 +103,7 @@ static void brcmf_sdiod_dummy_irqhandler
  11876. -
  11877. - int brcmf_sdiod_intr_register(struct brcmf_sdio_dev *sdiodev)
  11878. - {
  11879. -- struct brcmfmac_sdio_platform_data *pdata;
  11880. -+ struct brcmfmac_sdio_pd *pdata;
  11881. - int ret = 0;
  11882. - u8 data;
  11883. - u32 addr, gpiocontrol;
  11884. -@@ -173,7 +173,7 @@ int brcmf_sdiod_intr_register(struct brc
  11885. -
  11886. - int brcmf_sdiod_intr_unregister(struct brcmf_sdio_dev *sdiodev)
  11887. - {
  11888. -- struct brcmfmac_sdio_platform_data *pdata;
  11889. -+ struct brcmfmac_sdio_pd *pdata;
  11890. -
  11891. - brcmf_dbg(SDIO, "Entering\n");
  11892. -
  11893. -@@ -1164,17 +1164,6 @@ static int brcmf_ops_sdio_probe(struct s
  11894. - dev_set_drvdata(&func->dev, bus_if);
  11895. - dev_set_drvdata(&sdiodev->func[1]->dev, bus_if);
  11896. - sdiodev->dev = &sdiodev->func[1]->dev;
  11897. -- sdiodev->pdata = brcmf_get_module_param(sdiodev->dev);
  11898. --
  11899. --#ifdef CONFIG_PM_SLEEP
  11900. -- /* wowl can be supported when KEEP_POWER is true and (WAKE_SDIO_IRQ
  11901. -- * is true or when platform data OOB irq is true).
  11902. -- */
  11903. -- if ((sdio_get_host_pm_caps(sdiodev->func[1]) & MMC_PM_KEEP_POWER) &&
  11904. -- ((sdio_get_host_pm_caps(sdiodev->func[1]) & MMC_PM_WAKE_SDIO_IRQ) ||
  11905. -- (sdiodev->pdata && sdiodev->pdata->oob_irq_supported)))
  11906. -- bus_if->wowl_supported = true;
  11907. --#endif
  11908. -
  11909. - brcmf_sdiod_change_state(sdiodev, BRCMF_SDIOD_DOWN);
  11910. -
  11911. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  11912. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  11913. -@@ -6459,8 +6459,8 @@ int brcmf_cfg80211_wait_vif_event(struct
  11914. - static s32 brcmf_translate_country_code(struct brcmf_pub *drvr, char alpha2[2],
  11915. - struct brcmf_fil_country_le *ccreq)
  11916. - {
  11917. -- struct cc_translate *country_codes;
  11918. -- struct cc_entry *cc;
  11919. -+ struct brcmfmac_pd_cc *country_codes;
  11920. -+ struct brcmfmac_pd_cc_entry *cc;
  11921. - s32 found_index;
  11922. - int i;
  11923. -
  11924. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  11925. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  11926. -@@ -80,7 +80,7 @@ module_param_named(ignore_probe_fail, br
  11927. - MODULE_PARM_DESC(ignore_probe_fail, "always succeed probe for debugging");
  11928. - #endif
  11929. -
  11930. --static struct brcmfmac_sdio_platform_data *brcmfmac_pdata;
  11931. -+static struct brcmfmac_platform_data *brcmfmac_pdata;
  11932. - struct brcmf_mp_global_t brcmf_mp_global;
  11933. -
  11934. - int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
  11935. -@@ -229,15 +229,46 @@ void __brcmf_dbg(u32 level, const char *
  11936. -
  11937. - static void brcmf_mp_attach(void)
  11938. - {
  11939. -+ /* If module param firmware path is set then this will always be used,
  11940. -+ * if not set then if available use the platform data version. To make
  11941. -+ * sure it gets initialized at all, always copy the module param version
  11942. -+ */
  11943. - strlcpy(brcmf_mp_global.firmware_path, brcmf_firmware_path,
  11944. - BRCMF_FW_ALTPATH_LEN);
  11945. -+ if ((brcmfmac_pdata) && (brcmfmac_pdata->fw_alternative_path) &&
  11946. -+ (brcmf_mp_global.firmware_path[0] == '\0')) {
  11947. -+ strlcpy(brcmf_mp_global.firmware_path,
  11948. -+ brcmfmac_pdata->fw_alternative_path,
  11949. -+ BRCMF_FW_ALTPATH_LEN);
  11950. -+ }
  11951. - }
  11952. -
  11953. --struct brcmfmac_sdio_platform_data *brcmf_get_module_param(struct device *dev)
  11954. --{
  11955. -- if (!brcmfmac_pdata)
  11956. -- brcmf_of_probe(dev, &brcmfmac_pdata);
  11957. -- return brcmfmac_pdata;
  11958. -+struct brcmfmac_sdio_pd *brcmf_get_module_param(struct device *dev,
  11959. -+ enum brcmf_bus_type bus_type,
  11960. -+ u32 chip, u32 chiprev)
  11961. -+{
  11962. -+ struct brcmfmac_sdio_pd *pdata;
  11963. -+ struct brcmfmac_pd_device *device_pd;
  11964. -+ int i;
  11965. -+
  11966. -+ if (brcmfmac_pdata) {
  11967. -+ for (i = 0; i < brcmfmac_pdata->device_count; i++) {
  11968. -+ device_pd = &brcmfmac_pdata->devices[i];
  11969. -+ if ((device_pd->bus_type == bus_type) &&
  11970. -+ (device_pd->id == chip) &&
  11971. -+ ((device_pd->rev == chiprev) ||
  11972. -+ (device_pd->rev == -1))) {
  11973. -+ brcmf_dbg(INFO, "Platform data for device found\n");
  11974. -+ if (device_pd->bus_type == BRCMF_BUSTYPE_SDIO)
  11975. -+ return &device_pd->bus.sdio;
  11976. -+ break;
  11977. -+ }
  11978. -+ }
  11979. -+ }
  11980. -+ pdata = NULL;
  11981. -+ brcmf_of_probe(dev, &pdata);
  11982. -+
  11983. -+ return pdata;
  11984. - }
  11985. -
  11986. - int brcmf_mp_device_attach(struct brcmf_pub *drvr)
  11987. -@@ -287,7 +318,7 @@ static int brcmf_common_pd_remove(struct
  11988. - static struct platform_driver brcmf_pd = {
  11989. - .remove = brcmf_common_pd_remove,
  11990. - .driver = {
  11991. -- .name = BRCMFMAC_SDIO_PDATA_NAME,
  11992. -+ .name = BRCMFMAC_PDATA_NAME,
  11993. - }
  11994. - };
  11995. -
  11996. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
  11997. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
  11998. -@@ -16,7 +16,7 @@
  11999. - #define BRCMFMAC_COMMON_H
  12000. -
  12001. - #include <linux/platform_device.h>
  12002. --#include <linux/platform_data/brcmfmac-sdio.h>
  12003. -+#include <linux/platform_data/brcmfmac.h>
  12004. - #include "fwil_types.h"
  12005. -
  12006. - extern const u8 ALLFFMAC[ETH_ALEN];
  12007. -@@ -43,33 +43,6 @@ struct brcmf_mp_global_t {
  12008. - extern struct brcmf_mp_global_t brcmf_mp_global;
  12009. -
  12010. - /**
  12011. -- * struct cc_entry - Struct for translating user space country code (iso3166) to
  12012. -- * firmware country code and revision.
  12013. -- *
  12014. -- * @iso3166: iso3166 alpha 2 country code string.
  12015. -- * @cc: firmware country code string.
  12016. -- * @rev: firmware country code revision.
  12017. -- */
  12018. --struct cc_entry {
  12019. -- char iso3166[BRCMF_COUNTRY_BUF_SZ];
  12020. -- char cc[BRCMF_COUNTRY_BUF_SZ];
  12021. -- s32 rev;
  12022. --};
  12023. --
  12024. --/**
  12025. -- * struct cc_translate - Struct for translating country codes as set by user
  12026. -- * space to a country code and rev which can be used by
  12027. -- * firmware.
  12028. -- *
  12029. -- * @table_size: number of entries in table (> 0)
  12030. -- * @table: dynamic array of 1 or more elements with translation information.
  12031. -- */
  12032. --struct cc_translate {
  12033. -- int table_size;
  12034. -- struct cc_entry table[0];
  12035. --};
  12036. --
  12037. --/**
  12038. - * struct brcmf_mp_device - Device module paramaters.
  12039. - *
  12040. - * @sdiod_txglomsz: SDIO txglom size.
  12041. -@@ -88,10 +61,12 @@ struct brcmf_mp_device {
  12042. - int fcmode;
  12043. - bool roamoff;
  12044. - bool ignore_probe_fail;
  12045. -- struct cc_translate *country_codes;
  12046. -+ struct brcmfmac_pd_cc *country_codes;
  12047. - };
  12048. -
  12049. --struct brcmfmac_sdio_platform_data *brcmf_get_module_param(struct device *dev);
  12050. -+struct brcmfmac_sdio_pd *brcmf_get_module_param(struct device *dev,
  12051. -+ enum brcmf_bus_type bus_type,
  12052. -+ u32 chip, u32 chiprev);
  12053. - int brcmf_mp_device_attach(struct brcmf_pub *drvr);
  12054. - void brcmf_mp_device_detach(struct brcmf_pub *drvr);
  12055. - #ifdef DEBUG
  12056. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
  12057. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
  12058. -@@ -23,8 +23,7 @@
  12059. - #include "common.h"
  12060. - #include "of.h"
  12061. -
  12062. --void
  12063. --brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_platform_data **sdio)
  12064. -+void brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_pd **sdio)
  12065. - {
  12066. - struct device_node *np = dev->of_node;
  12067. - int irq;
  12068. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.h
  12069. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.h
  12070. -@@ -15,10 +15,9 @@
  12071. - */
  12072. - #ifdef CONFIG_OF
  12073. - void
  12074. --brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_platform_data **sdio);
  12075. -+brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_pd **sdio);
  12076. - #else
  12077. --static void brcmf_of_probe(struct device *dev,
  12078. -- struct brcmfmac_sdio_platform_data **sdio)
  12079. -+static void brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_pd **sdio)
  12080. - {
  12081. - }
  12082. - #endif /* CONFIG_OF */
  12083. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  12084. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  12085. -@@ -33,8 +33,6 @@
  12086. - #include <linux/bcma/bcma.h>
  12087. - #include <linux/debugfs.h>
  12088. - #include <linux/vmalloc.h>
  12089. --#include <linux/platform_data/brcmfmac-sdio.h>
  12090. --#include <linux/moduleparam.h>
  12091. - #include <asm/unaligned.h>
  12092. - #include <defs.h>
  12093. - #include <brcmu_wifi.h>
  12094. -@@ -44,6 +42,8 @@
  12095. - #include "sdio.h"
  12096. - #include "chip.h"
  12097. - #include "firmware.h"
  12098. -+#include "core.h"
  12099. -+#include "common.h"
  12100. -
  12101. - #define DCMD_RESP_TIMEOUT msecs_to_jiffies(2500)
  12102. - #define CTL_DONE_TIMEOUT msecs_to_jiffies(2500)
  12103. -@@ -3775,26 +3775,28 @@ static const struct brcmf_buscore_ops br
  12104. - static bool
  12105. - brcmf_sdio_probe_attach(struct brcmf_sdio *bus)
  12106. - {
  12107. -+ struct brcmf_sdio_dev *sdiodev;
  12108. - u8 clkctl = 0;
  12109. - int err = 0;
  12110. - int reg_addr;
  12111. - u32 reg_val;
  12112. - u32 drivestrength;
  12113. -
  12114. -- sdio_claim_host(bus->sdiodev->func[1]);
  12115. -+ sdiodev = bus->sdiodev;
  12116. -+ sdio_claim_host(sdiodev->func[1]);
  12117. -
  12118. - pr_debug("F1 signature read @0x18000000=0x%4x\n",
  12119. -- brcmf_sdiod_regrl(bus->sdiodev, SI_ENUM_BASE, NULL));
  12120. -+ brcmf_sdiod_regrl(sdiodev, SI_ENUM_BASE, NULL));
  12121. -
  12122. - /*
  12123. - * Force PLL off until brcmf_chip_attach()
  12124. - * programs PLL control regs
  12125. - */
  12126. -
  12127. -- brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR,
  12128. -+ brcmf_sdiod_regwb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR,
  12129. - BRCMF_INIT_CLKCTL1, &err);
  12130. - if (!err)
  12131. -- clkctl = brcmf_sdiod_regrb(bus->sdiodev,
  12132. -+ clkctl = brcmf_sdiod_regrb(sdiodev,
  12133. - SBSDIO_FUNC1_CHIPCLKCSR, &err);
  12134. -
  12135. - if (err || ((clkctl & ~SBSDIO_AVBITS) != BRCMF_INIT_CLKCTL1)) {
  12136. -@@ -3803,50 +3805,77 @@ brcmf_sdio_probe_attach(struct brcmf_sdi
  12137. - goto fail;
  12138. - }
  12139. -
  12140. -- bus->ci = brcmf_chip_attach(bus->sdiodev, &brcmf_sdio_buscore_ops);
  12141. -+ bus->ci = brcmf_chip_attach(sdiodev, &brcmf_sdio_buscore_ops);
  12142. - if (IS_ERR(bus->ci)) {
  12143. - brcmf_err("brcmf_chip_attach failed!\n");
  12144. - bus->ci = NULL;
  12145. - goto fail;
  12146. - }
  12147. -+ sdiodev->pdata = brcmf_get_module_param(sdiodev->dev,
  12148. -+ BRCMF_BUSTYPE_SDIO,
  12149. -+ bus->ci->chip,
  12150. -+ bus->ci->chiprev);
  12151. -+ /* platform specific configuration:
  12152. -+ * alignments must be at least 4 bytes for ADMA
  12153. -+ */
  12154. -+ bus->head_align = ALIGNMENT;
  12155. -+ bus->sgentry_align = ALIGNMENT;
  12156. -+ if (sdiodev->pdata) {
  12157. -+ if (sdiodev->pdata->sd_head_align > ALIGNMENT)
  12158. -+ bus->head_align = sdiodev->pdata->sd_head_align;
  12159. -+ if (sdiodev->pdata->sd_sgentry_align > ALIGNMENT)
  12160. -+ bus->sgentry_align = sdiodev->pdata->sd_sgentry_align;
  12161. -+ }
  12162. -+ /* allocate scatter-gather table. sg support
  12163. -+ * will be disabled upon allocation failure.
  12164. -+ */
  12165. -+ brcmf_sdiod_sgtable_alloc(sdiodev);
  12166. -+
  12167. -+#ifdef CONFIG_PM_SLEEP
  12168. -+ /* wowl can be supported when KEEP_POWER is true and (WAKE_SDIO_IRQ
  12169. -+ * is true or when platform data OOB irq is true).
  12170. -+ */
  12171. -+ if ((sdio_get_host_pm_caps(sdiodev->func[1]) & MMC_PM_KEEP_POWER) &&
  12172. -+ ((sdio_get_host_pm_caps(sdiodev->func[1]) & MMC_PM_WAKE_SDIO_IRQ) ||
  12173. -+ (sdiodev->pdata && sdiodev->pdata->oob_irq_supported)))
  12174. -+ sdiodev->bus_if->wowl_supported = true;
  12175. -+#endif
  12176. -
  12177. - if (brcmf_sdio_kso_init(bus)) {
  12178. - brcmf_err("error enabling KSO\n");
  12179. - goto fail;
  12180. - }
  12181. -
  12182. -- if ((bus->sdiodev->pdata) && (bus->sdiodev->pdata->drive_strength))
  12183. -- drivestrength = bus->sdiodev->pdata->drive_strength;
  12184. -+ if ((sdiodev->pdata) && (sdiodev->pdata->drive_strength))
  12185. -+ drivestrength = sdiodev->pdata->drive_strength;
  12186. - else
  12187. - drivestrength = DEFAULT_SDIO_DRIVE_STRENGTH;
  12188. -- brcmf_sdio_drivestrengthinit(bus->sdiodev, bus->ci, drivestrength);
  12189. -+ brcmf_sdio_drivestrengthinit(sdiodev, bus->ci, drivestrength);
  12190. -
  12191. - /* Set card control so an SDIO card reset does a WLAN backplane reset */
  12192. -- reg_val = brcmf_sdiod_regrb(bus->sdiodev,
  12193. -- SDIO_CCCR_BRCM_CARDCTRL, &err);
  12194. -+ reg_val = brcmf_sdiod_regrb(sdiodev, SDIO_CCCR_BRCM_CARDCTRL, &err);
  12195. - if (err)
  12196. - goto fail;
  12197. -
  12198. - reg_val |= SDIO_CCCR_BRCM_CARDCTRL_WLANRESET;
  12199. -
  12200. -- brcmf_sdiod_regwb(bus->sdiodev,
  12201. -- SDIO_CCCR_BRCM_CARDCTRL, reg_val, &err);
  12202. -+ brcmf_sdiod_regwb(sdiodev, SDIO_CCCR_BRCM_CARDCTRL, reg_val, &err);
  12203. - if (err)
  12204. - goto fail;
  12205. -
  12206. - /* set PMUControl so a backplane reset does PMU state reload */
  12207. - reg_addr = CORE_CC_REG(brcmf_chip_get_pmu(bus->ci)->base, pmucontrol);
  12208. -- reg_val = brcmf_sdiod_regrl(bus->sdiodev, reg_addr, &err);
  12209. -+ reg_val = brcmf_sdiod_regrl(sdiodev, reg_addr, &err);
  12210. - if (err)
  12211. - goto fail;
  12212. -
  12213. - reg_val |= (BCMA_CC_PMU_CTL_RES_RELOAD << BCMA_CC_PMU_CTL_RES_SHIFT);
  12214. -
  12215. -- brcmf_sdiod_regwl(bus->sdiodev, reg_addr, reg_val, &err);
  12216. -+ brcmf_sdiod_regwl(sdiodev, reg_addr, reg_val, &err);
  12217. - if (err)
  12218. - goto fail;
  12219. -
  12220. -- sdio_release_host(bus->sdiodev->func[1]);
  12221. -+ sdio_release_host(sdiodev->func[1]);
  12222. -
  12223. - brcmu_pktq_init(&bus->txq, (PRIOMASK + 1), TXQLEN);
  12224. -
  12225. -@@ -3867,7 +3896,7 @@ brcmf_sdio_probe_attach(struct brcmf_sdi
  12226. - return true;
  12227. -
  12228. - fail:
  12229. -- sdio_release_host(bus->sdiodev->func[1]);
  12230. -+ sdio_release_host(sdiodev->func[1]);
  12231. - return false;
  12232. - }
  12233. -
  12234. -@@ -4045,18 +4074,6 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
  12235. - bus->txminmax = BRCMF_TXMINMAX;
  12236. - bus->tx_seq = SDPCM_SEQ_WRAP - 1;
  12237. -
  12238. -- /* platform specific configuration:
  12239. -- * alignments must be at least 4 bytes for ADMA
  12240. -- */
  12241. -- bus->head_align = ALIGNMENT;
  12242. -- bus->sgentry_align = ALIGNMENT;
  12243. -- if (sdiodev->pdata) {
  12244. -- if (sdiodev->pdata->sd_head_align > ALIGNMENT)
  12245. -- bus->head_align = sdiodev->pdata->sd_head_align;
  12246. -- if (sdiodev->pdata->sd_sgentry_align > ALIGNMENT)
  12247. -- bus->sgentry_align = sdiodev->pdata->sd_sgentry_align;
  12248. -- }
  12249. --
  12250. - /* single-threaded workqueue */
  12251. - wq = alloc_ordered_workqueue("brcmf_wq/%s", WQ_MEM_RECLAIM,
  12252. - dev_name(&sdiodev->func[1]->dev));
  12253. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
  12254. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
  12255. -@@ -184,7 +184,7 @@ struct brcmf_sdio_dev {
  12256. - struct brcmf_sdio *bus;
  12257. - struct device *dev;
  12258. - struct brcmf_bus *bus_if;
  12259. -- struct brcmfmac_sdio_platform_data *pdata;
  12260. -+ struct brcmfmac_sdio_pd *pdata;
  12261. - bool oob_irq_requested;
  12262. - bool irq_en; /* irq enable flags */
  12263. - spinlock_t irq_en_lock;
  12264. ---- a/include/linux/platform_data/brcmfmac-sdio.h
  12265. -+++ /dev/null
  12266. -@@ -1,135 +0,0 @@
  12267. --/*
  12268. -- * Copyright (c) 2013 Broadcom Corporation
  12269. -- *
  12270. -- * Permission to use, copy, modify, and/or distribute this software for any
  12271. -- * purpose with or without fee is hereby granted, provided that the above
  12272. -- * copyright notice and this permission notice appear in all copies.
  12273. -- *
  12274. -- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  12275. -- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  12276. -- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
  12277. -- * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12278. -- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  12279. -- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  12280. -- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  12281. -- */
  12282. --
  12283. --#ifndef _LINUX_BRCMFMAC_PLATFORM_H
  12284. --#define _LINUX_BRCMFMAC_PLATFORM_H
  12285. --
  12286. --/*
  12287. -- * Platform specific driver functions and data. Through the platform specific
  12288. -- * device data functions can be provided to help the brcmfmac driver to
  12289. -- * operate with the device in combination with the used platform.
  12290. -- *
  12291. -- * Use the platform data in the following (similar) way:
  12292. -- *
  12293. -- *
  12294. --#include <brcmfmac_platform.h>
  12295. --
  12296. --
  12297. --static void brcmfmac_power_on(void)
  12298. --{
  12299. --}
  12300. --
  12301. --static void brcmfmac_power_off(void)
  12302. --{
  12303. --}
  12304. --
  12305. --static void brcmfmac_reset(void)
  12306. --{
  12307. --}
  12308. --
  12309. --static struct brcmfmac_sdio_platform_data brcmfmac_sdio_pdata = {
  12310. -- .power_on = brcmfmac_power_on,
  12311. -- .power_off = brcmfmac_power_off,
  12312. -- .reset = brcmfmac_reset
  12313. --};
  12314. --
  12315. --static struct platform_device brcmfmac_device = {
  12316. -- .name = BRCMFMAC_SDIO_PDATA_NAME,
  12317. -- .id = PLATFORM_DEVID_NONE,
  12318. -- .dev.platform_data = &brcmfmac_sdio_pdata
  12319. --};
  12320. --
  12321. --void __init brcmfmac_init_pdata(void)
  12322. --{
  12323. -- brcmfmac_sdio_pdata.oob_irq_supported = true;
  12324. -- brcmfmac_sdio_pdata.oob_irq_nr = gpio_to_irq(GPIO_BRCMF_SDIO_OOB);
  12325. -- brcmfmac_sdio_pdata.oob_irq_flags = IORESOURCE_IRQ |
  12326. -- IORESOURCE_IRQ_HIGHLEVEL;
  12327. -- platform_device_register(&brcmfmac_device);
  12328. --}
  12329. -- *
  12330. -- *
  12331. -- * Note: the brcmfmac can be loaded as module or be statically built-in into
  12332. -- * the kernel. If built-in then do note that it uses module_init (and
  12333. -- * module_exit) routines which equal device_initcall. So if you intend to
  12334. -- * create a module with the platform specific data for the brcmfmac and have
  12335. -- * it built-in to the kernel then use a higher initcall then device_initcall
  12336. -- * (see init.h). If this is not done then brcmfmac will load without problems
  12337. -- * but will not pickup the platform data.
  12338. -- *
  12339. -- * When the driver does not "detect" platform driver data then it will continue
  12340. -- * without reporting anything and just assume there is no data needed. Which is
  12341. -- * probably true for most platforms.
  12342. -- *
  12343. -- * Explanation of the platform_data fields:
  12344. -- *
  12345. -- * drive_strength: is the preferred drive_strength to be used for the SDIO
  12346. -- * pins. If 0 then a default value will be used. This is the target drive
  12347. -- * strength, the exact drive strength which will be used depends on the
  12348. -- * capabilities of the device.
  12349. -- *
  12350. -- * oob_irq_supported: does the board have support for OOB interrupts. SDIO
  12351. -- * in-band interrupts are relatively slow and for having less overhead on
  12352. -- * interrupt processing an out of band interrupt can be used. If the HW
  12353. -- * supports this then enable this by setting this field to true and configure
  12354. -- * the oob related fields.
  12355. -- *
  12356. -- * oob_irq_nr, oob_irq_flags: the OOB interrupt information. The values are
  12357. -- * used for registering the irq using request_irq function.
  12358. -- *
  12359. -- * broken_sg_support: flag for broken sg list support of SDIO host controller.
  12360. -- * Set this to true if the SDIO host controller has higher align requirement
  12361. -- * than 32 bytes for each scatterlist item.
  12362. -- *
  12363. -- * sd_head_align: alignment requirement for start of data buffer
  12364. -- *
  12365. -- * sd_sgentry_align: length alignment requirement for each sg entry
  12366. -- *
  12367. -- * power_on: This function is called by the brcmfmac when the module gets
  12368. -- * loaded. This can be particularly useful for low power devices. The platform
  12369. -- * spcific routine may for example decide to power up the complete device.
  12370. -- * If there is no use-case for this function then provide NULL.
  12371. -- *
  12372. -- * power_off: This function is called by the brcmfmac when the module gets
  12373. -- * unloaded. At this point the device can be powered down or otherwise be reset.
  12374. -- * So if an actual power_off is not supported but reset is then reset the device
  12375. -- * when this function gets called. This can be particularly useful for low power
  12376. -- * devices. If there is no use-case for this function (either power-down or
  12377. -- * reset) then provide NULL.
  12378. -- *
  12379. -- * reset: This function can get called if the device communication broke down.
  12380. -- * This functionality is particularly useful in case of SDIO type devices. It is
  12381. -- * possible to reset a dongle via sdio data interface, but it requires that
  12382. -- * this is fully functional. This function is chip/module specific and this
  12383. -- * function should return only after the complete reset has completed.
  12384. -- */
  12385. --
  12386. --#define BRCMFMAC_SDIO_PDATA_NAME "brcmfmac_sdio"
  12387. --
  12388. --struct brcmfmac_sdio_platform_data {
  12389. -- unsigned int drive_strength;
  12390. -- bool oob_irq_supported;
  12391. -- unsigned int oob_irq_nr;
  12392. -- unsigned long oob_irq_flags;
  12393. -- bool broken_sg_support;
  12394. -- unsigned short sd_head_align;
  12395. -- unsigned short sd_sgentry_align;
  12396. -- void (*power_on)(void);
  12397. -- void (*power_off)(void);
  12398. -- void (*reset)(void);
  12399. --};
  12400. --
  12401. --#endif /* _LINUX_BRCMFMAC_PLATFORM_H */
  12402. ---- /dev/null
  12403. -+++ b/include/linux/platform_data/brcmfmac.h
  12404. -@@ -0,0 +1,185 @@
  12405. -+/*
  12406. -+ * Copyright (c) 201 Broadcom Corporation
  12407. -+ *
  12408. -+ * Permission to use, copy, modify, and/or distribute this software for any
  12409. -+ * purpose with or without fee is hereby granted, provided that the above
  12410. -+ * copyright notice and this permission notice appear in all copies.
  12411. -+ *
  12412. -+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  12413. -+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  12414. -+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
  12415. -+ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12416. -+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  12417. -+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  12418. -+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  12419. -+ */
  12420. -+
  12421. -+#ifndef _LINUX_BRCMFMAC_PLATFORM_H
  12422. -+#define _LINUX_BRCMFMAC_PLATFORM_H
  12423. -+
  12424. -+
  12425. -+#define BRCMFMAC_PDATA_NAME "brcmfmac"
  12426. -+
  12427. -+#define BRCMFMAC_COUNTRY_BUF_SZ 4
  12428. -+
  12429. -+
  12430. -+/*
  12431. -+ * Platform specific driver functions and data. Through the platform specific
  12432. -+ * device data functions and data can be provided to help the brcmfmac driver to
  12433. -+ * operate with the device in combination with the used platform.
  12434. -+ */
  12435. -+
  12436. -+
  12437. -+/**
  12438. -+ * Note: the brcmfmac can be loaded as module or be statically built-in into
  12439. -+ * the kernel. If built-in then do note that it uses module_init (and
  12440. -+ * module_exit) routines which equal device_initcall. So if you intend to
  12441. -+ * create a module with the platform specific data for the brcmfmac and have
  12442. -+ * it built-in to the kernel then use a higher initcall then device_initcall
  12443. -+ * (see init.h). If this is not done then brcmfmac will load without problems
  12444. -+ * but will not pickup the platform data.
  12445. -+ *
  12446. -+ * When the driver does not "detect" platform driver data then it will continue
  12447. -+ * without reporting anything and just assume there is no data needed. Which is
  12448. -+ * probably true for most platforms.
  12449. -+ */
  12450. -+
  12451. -+/**
  12452. -+ * enum brcmf_bus_type - Bus type identifier. Currently SDIO, USB and PCIE are
  12453. -+ * supported.
  12454. -+ */
  12455. -+enum brcmf_bus_type {
  12456. -+ BRCMF_BUSTYPE_SDIO,
  12457. -+ BRCMF_BUSTYPE_USB,
  12458. -+ BRCMF_BUSTYPE_PCIE
  12459. -+};
  12460. -+
  12461. -+
  12462. -+/**
  12463. -+ * struct brcmfmac_sdio_pd - SDIO Device specific platform data.
  12464. -+ *
  12465. -+ * @txglomsz: SDIO txglom size. Use 0 if default of driver is to be
  12466. -+ * used.
  12467. -+ * @drive_strength: is the preferred drive_strength to be used for the SDIO
  12468. -+ * pins. If 0 then a default value will be used. This is
  12469. -+ * the target drive strength, the exact drive strength
  12470. -+ * which will be used depends on the capabilities of the
  12471. -+ * device.
  12472. -+ * @oob_irq_supported: does the board have support for OOB interrupts. SDIO
  12473. -+ * in-band interrupts are relatively slow and for having
  12474. -+ * less overhead on interrupt processing an out of band
  12475. -+ * interrupt can be used. If the HW supports this then
  12476. -+ * enable this by setting this field to true and configure
  12477. -+ * the oob related fields.
  12478. -+ * @oob_irq_nr,
  12479. -+ * @oob_irq_flags: the OOB interrupt information. The values are used for
  12480. -+ * registering the irq using request_irq function.
  12481. -+ * @broken_sg_support: flag for broken sg list support of SDIO host controller.
  12482. -+ * Set this to true if the SDIO host controller has higher
  12483. -+ * align requirement than 32 bytes for each scatterlist
  12484. -+ * item.
  12485. -+ * @sd_head_align: alignment requirement for start of data buffer.
  12486. -+ * @sd_sgentry_align: length alignment requirement for each sg entry.
  12487. -+ * @reset: This function can get called if the device communication
  12488. -+ * broke down. This functionality is particularly useful in
  12489. -+ * case of SDIO type devices. It is possible to reset a
  12490. -+ * dongle via sdio data interface, but it requires that
  12491. -+ * this is fully functional. This function is chip/module
  12492. -+ * specific and this function should return only after the
  12493. -+ * complete reset has completed.
  12494. -+ */
  12495. -+struct brcmfmac_sdio_pd {
  12496. -+ int txglomsz;
  12497. -+ unsigned int drive_strength;
  12498. -+ bool oob_irq_supported;
  12499. -+ unsigned int oob_irq_nr;
  12500. -+ unsigned long oob_irq_flags;
  12501. -+ bool broken_sg_support;
  12502. -+ unsigned short sd_head_align;
  12503. -+ unsigned short sd_sgentry_align;
  12504. -+ void (*reset)(void);
  12505. -+};
  12506. -+
  12507. -+/**
  12508. -+ * struct brcmfmac_pd_cc_entry - Struct for translating user space country code
  12509. -+ * (iso3166) to firmware country code and
  12510. -+ * revision.
  12511. -+ *
  12512. -+ * @iso3166: iso3166 alpha 2 country code string.
  12513. -+ * @cc: firmware country code string.
  12514. -+ * @rev: firmware country code revision.
  12515. -+ */
  12516. -+struct brcmfmac_pd_cc_entry {
  12517. -+ char iso3166[BRCMFMAC_COUNTRY_BUF_SZ];
  12518. -+ char cc[BRCMFMAC_COUNTRY_BUF_SZ];
  12519. -+ s32 rev;
  12520. -+};
  12521. -+
  12522. -+/**
  12523. -+ * struct brcmfmac_pd_cc - Struct for translating country codes as set by user
  12524. -+ * space to a country code and rev which can be used by
  12525. -+ * firmware.
  12526. -+ *
  12527. -+ * @table_size: number of entries in table (> 0)
  12528. -+ * @table: array of 1 or more elements with translation information.
  12529. -+ */
  12530. -+struct brcmfmac_pd_cc {
  12531. -+ int table_size;
  12532. -+ struct brcmfmac_pd_cc_entry table[0];
  12533. -+};
  12534. -+
  12535. -+/**
  12536. -+ * struct brcmfmac_pd_device - Device specific platform data. (id/rev/bus_type)
  12537. -+ * is the unique identifier of the device.
  12538. -+ *
  12539. -+ * @id: ID of the device for which this data is. In case of SDIO
  12540. -+ * or PCIE this is the chipid as identified by chip.c In
  12541. -+ * case of USB this is the chipid as identified by the
  12542. -+ * device query.
  12543. -+ * @rev: chip revision, see id.
  12544. -+ * @bus_type: The type of bus. Some chipid/rev exist for different bus
  12545. -+ * types. Each bus type has its own set of settings.
  12546. -+ * @feature_disable: Bitmask of features to disable (override), See feature.c
  12547. -+ * in brcmfmac for details.
  12548. -+ * @country_codes: If available, pointer to struct for translating country
  12549. -+ * codes.
  12550. -+ * @bus: Bus specific (union) device settings. Currently only
  12551. -+ * SDIO.
  12552. -+ */
  12553. -+struct brcmfmac_pd_device {
  12554. -+ unsigned int id;
  12555. -+ unsigned int rev;
  12556. -+ enum brcmf_bus_type bus_type;
  12557. -+ unsigned int feature_disable;
  12558. -+ struct brcmfmac_pd_cc *country_codes;
  12559. -+ union {
  12560. -+ struct brcmfmac_sdio_pd sdio;
  12561. -+ } bus;
  12562. -+};
  12563. -+
  12564. -+/**
  12565. -+ * struct brcmfmac_platform_data - BRCMFMAC specific platform data.
  12566. -+ *
  12567. -+ * @power_on: This function is called by the brcmfmac driver when the module
  12568. -+ * gets loaded. This can be particularly useful for low power
  12569. -+ * devices. The platform spcific routine may for example decide to
  12570. -+ * power up the complete device. If there is no use-case for this
  12571. -+ * function then provide NULL.
  12572. -+ * @power_off: This function is called by the brcmfmac when the module gets
  12573. -+ * unloaded. At this point the devices can be powered down or
  12574. -+ * otherwise be reset. So if an actual power_off is not supported
  12575. -+ * but reset is supported by the devices then reset the devices
  12576. -+ * when this function gets called. This can be particularly useful
  12577. -+ * for low power devices. If there is no use-case for this
  12578. -+ * function then provide NULL.
  12579. -+ */
  12580. -+struct brcmfmac_platform_data {
  12581. -+ void (*power_on)(void);
  12582. -+ void (*power_off)(void);
  12583. -+ char *fw_alternative_path;
  12584. -+ int device_count;
  12585. -+ struct brcmfmac_pd_device devices[0];
  12586. -+};
  12587. -+
  12588. -+
  12589. -+#endif /* _LINUX_BRCMFMAC_PLATFORM_H */
  12590. 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
  12591. deleted file mode 100644
  12592. index 34341d7f1866bde09e839f128d14a2b40e54453f..0000000000000000000000000000000000000000
  12593. --- a/package/kernel/mac80211/patches/344-0018-brcmfmac-merge-platform-data-and-module-paramaters.patch
  12594. +++ /dev/null
  12595. @@ -1,607 +0,0 @@
  12596. -From: Hante Meuleman <meuleman@broadcom.com>
  12597. -Date: Wed, 17 Feb 2016 11:27:08 +0100
  12598. -Subject: [PATCH] brcmfmac: merge platform data and module paramaters
  12599. -
  12600. -Merge module parameters and platform data in one struct. This is the
  12601. -last step to move to the new platform data per device. Now parameters
  12602. -of platform data will be merged with module parameters per device.
  12603. -
  12604. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  12605. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  12606. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  12607. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  12608. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  12609. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12610. ----
  12611. -
  12612. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  12613. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  12614. -@@ -109,8 +109,8 @@ int brcmf_sdiod_intr_register(struct brc
  12615. - u32 addr, gpiocontrol;
  12616. - unsigned long flags;
  12617. -
  12618. -- pdata = sdiodev->pdata;
  12619. -- if ((pdata) && (pdata->oob_irq_supported)) {
  12620. -+ pdata = &sdiodev->settings->bus.sdio;
  12621. -+ if (pdata->oob_irq_supported) {
  12622. - brcmf_dbg(SDIO, "Enter, register OOB IRQ %d\n",
  12623. - pdata->oob_irq_nr);
  12624. - ret = request_irq(pdata->oob_irq_nr, brcmf_sdiod_oob_irqhandler,
  12625. -@@ -177,8 +177,8 @@ int brcmf_sdiod_intr_unregister(struct b
  12626. -
  12627. - brcmf_dbg(SDIO, "Entering\n");
  12628. -
  12629. -- pdata = sdiodev->pdata;
  12630. -- if ((pdata) && (pdata->oob_irq_supported)) {
  12631. -+ pdata = &sdiodev->settings->bus.sdio;
  12632. -+ if (pdata->oob_irq_supported) {
  12633. - sdio_claim_host(sdiodev->func[1]);
  12634. - brcmf_sdiod_regwb(sdiodev, SDIO_CCCR_BRCM_SEPINT, 0, NULL);
  12635. - brcmf_sdiod_regwb(sdiodev, SDIO_CCCR_IENx, 0, NULL);
  12636. -@@ -522,7 +522,7 @@ static int brcmf_sdiod_sglist_rw(struct
  12637. - target_list = pktlist;
  12638. - /* for host with broken sg support, prepare a page aligned list */
  12639. - __skb_queue_head_init(&local_list);
  12640. -- if (sdiodev->pdata && sdiodev->pdata->broken_sg_support && !write) {
  12641. -+ if (!write && sdiodev->settings->bus.sdio.broken_sg_support) {
  12642. - req_sz = 0;
  12643. - skb_queue_walk(pktlist, pkt_next)
  12644. - req_sz += pkt_next->len;
  12645. -@@ -629,7 +629,7 @@ static int brcmf_sdiod_sglist_rw(struct
  12646. - }
  12647. - }
  12648. -
  12649. -- if (sdiodev->pdata && sdiodev->pdata->broken_sg_support && !write) {
  12650. -+ if (!write && sdiodev->settings->bus.sdio.broken_sg_support) {
  12651. - local_pkt_next = local_list.next;
  12652. - orig_offset = 0;
  12653. - skb_queue_walk(pktlist, pkt_next) {
  12654. -@@ -900,7 +900,7 @@ void brcmf_sdiod_sgtable_alloc(struct br
  12655. - return;
  12656. -
  12657. - nents = max_t(uint, BRCMF_DEFAULT_RXGLOM_SIZE,
  12658. -- sdiodev->bus_if->drvr->settings->sdiod_txglomsz);
  12659. -+ sdiodev->settings->bus.sdio.txglomsz);
  12660. - nents += (nents >> 4) + 1;
  12661. -
  12662. - WARN_ON(nents > sdiodev->max_segment_count);
  12663. -@@ -912,7 +912,7 @@ void brcmf_sdiod_sgtable_alloc(struct br
  12664. - sdiodev->sg_support = false;
  12665. - }
  12666. -
  12667. -- sdiodev->txglomsz = sdiodev->bus_if->drvr->settings->sdiod_txglomsz;
  12668. -+ sdiodev->txglomsz = sdiodev->settings->bus.sdio.txglomsz;
  12669. - }
  12670. -
  12671. - #ifdef CONFIG_PM_SLEEP
  12672. -@@ -1246,8 +1246,8 @@ static int brcmf_ops_sdio_suspend(struct
  12673. -
  12674. - sdio_flags = MMC_PM_KEEP_POWER;
  12675. - if (sdiodev->wowl_enabled) {
  12676. -- if (sdiodev->pdata->oob_irq_supported)
  12677. -- enable_irq_wake(sdiodev->pdata->oob_irq_nr);
  12678. -+ if (sdiodev->settings->bus.sdio.oob_irq_supported)
  12679. -+ enable_irq_wake(sdiodev->settings->bus.sdio.oob_irq_nr);
  12680. - else
  12681. - sdio_flags |= MMC_PM_WAKE_SDIO_IRQ;
  12682. - }
  12683. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
  12684. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
  12685. -@@ -43,6 +43,8 @@ enum brcmf_bus_protocol_type {
  12686. - BRCMF_PROTO_MSGBUF
  12687. - };
  12688. -
  12689. -+struct brcmf_mp_device;
  12690. -+
  12691. - struct brcmf_bus_dcmd {
  12692. - char *name;
  12693. - char *param;
  12694. -@@ -217,7 +219,7 @@ bool brcmf_c_prec_enq(struct device *dev
  12695. - void brcmf_rx_frame(struct device *dev, struct sk_buff *rxp);
  12696. -
  12697. - /* Indication from bus module regarding presence/insertion of dongle. */
  12698. --int brcmf_attach(struct device *dev);
  12699. -+int brcmf_attach(struct device *dev, struct brcmf_mp_device *settings);
  12700. - /* Indication from bus module regarding removal/absence of dongle */
  12701. - void brcmf_detach(struct device *dev);
  12702. - /* Indication from bus module that dongle should be reset */
  12703. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  12704. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  12705. -@@ -243,14 +243,35 @@ static void brcmf_mp_attach(void)
  12706. - }
  12707. - }
  12708. -
  12709. --struct brcmfmac_sdio_pd *brcmf_get_module_param(struct device *dev,
  12710. -- enum brcmf_bus_type bus_type,
  12711. -- u32 chip, u32 chiprev)
  12712. -+struct brcmf_mp_device *brcmf_get_module_param(struct device *dev,
  12713. -+ enum brcmf_bus_type bus_type,
  12714. -+ u32 chip, u32 chiprev)
  12715. - {
  12716. -- struct brcmfmac_sdio_pd *pdata;
  12717. -+ struct brcmf_mp_device *settings;
  12718. - struct brcmfmac_pd_device *device_pd;
  12719. -+ bool found;
  12720. - int i;
  12721. -
  12722. -+ brcmf_dbg(INFO, "Enter, bus=%d, chip=%d, rev=%d\n", bus_type, chip,
  12723. -+ chiprev);
  12724. -+ settings = kzalloc(sizeof(*settings), GFP_ATOMIC);
  12725. -+ if (!settings)
  12726. -+ return NULL;
  12727. -+
  12728. -+ /* start by using the module paramaters */
  12729. -+ settings->p2p_enable = !!brcmf_p2p_enable;
  12730. -+ settings->feature_disable = brcmf_feature_disable;
  12731. -+ settings->fcmode = brcmf_fcmode;
  12732. -+ settings->roamoff = !!brcmf_roamoff;
  12733. -+#ifdef DEBUG
  12734. -+ settings->ignore_probe_fail = !!brcmf_ignore_probe_fail;
  12735. -+#endif
  12736. -+
  12737. -+ if (bus_type == BRCMF_BUSTYPE_SDIO)
  12738. -+ settings->bus.sdio.txglomsz = brcmf_sdiod_txglomsz;
  12739. -+
  12740. -+ /* See if there is any device specific platform data configured */
  12741. -+ found = false;
  12742. - if (brcmfmac_pdata) {
  12743. - for (i = 0; i < brcmfmac_pdata->device_count; i++) {
  12744. - device_pd = &brcmfmac_pdata->devices[i];
  12745. -@@ -259,38 +280,29 @@ struct brcmfmac_sdio_pd *brcmf_get_modul
  12746. - ((device_pd->rev == chiprev) ||
  12747. - (device_pd->rev == -1))) {
  12748. - brcmf_dbg(INFO, "Platform data for device found\n");
  12749. -+ settings->country_codes =
  12750. -+ device_pd->country_codes;
  12751. - if (device_pd->bus_type == BRCMF_BUSTYPE_SDIO)
  12752. -- return &device_pd->bus.sdio;
  12753. -+ memcpy(&settings->bus.sdio,
  12754. -+ &device_pd->bus.sdio,
  12755. -+ sizeof(settings->bus.sdio));
  12756. -+ found = true;
  12757. - break;
  12758. - }
  12759. - }
  12760. - }
  12761. -- pdata = NULL;
  12762. -- brcmf_of_probe(dev, &pdata);
  12763. --
  12764. -- return pdata;
  12765. --}
  12766. --
  12767. --int brcmf_mp_device_attach(struct brcmf_pub *drvr)
  12768. --{
  12769. -- drvr->settings = kzalloc(sizeof(*drvr->settings), GFP_ATOMIC);
  12770. -- if (!drvr->settings)
  12771. -- return -ENOMEM;
  12772. --
  12773. -- drvr->settings->sdiod_txglomsz = brcmf_sdiod_txglomsz;
  12774. -- drvr->settings->p2p_enable = !!brcmf_p2p_enable;
  12775. -- drvr->settings->feature_disable = brcmf_feature_disable;
  12776. -- drvr->settings->fcmode = brcmf_fcmode;
  12777. -- drvr->settings->roamoff = !!brcmf_roamoff;
  12778. --#ifdef DEBUG
  12779. -- drvr->settings->ignore_probe_fail = !!brcmf_ignore_probe_fail;
  12780. --#endif
  12781. -- return 0;
  12782. -+ if ((bus_type == BRCMF_BUSTYPE_SDIO) && (!found)) {
  12783. -+ /* No platform data for this device. In case of SDIO try OF
  12784. -+ * (Open Firwmare) Device Tree.
  12785. -+ */
  12786. -+ brcmf_of_probe(dev, &settings->bus.sdio);
  12787. -+ }
  12788. -+ return settings;
  12789. - }
  12790. -
  12791. --void brcmf_mp_device_detach(struct brcmf_pub *drvr)
  12792. -+void brcmf_release_module_param(struct brcmf_mp_device *module_param)
  12793. - {
  12794. -- kfree(drvr->settings);
  12795. -+ kfree(module_param);
  12796. - }
  12797. -
  12798. - static int __init brcmf_common_pd_probe(struct platform_device *pdev)
  12799. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
  12800. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
  12801. -@@ -45,41 +45,30 @@ extern struct brcmf_mp_global_t brcmf_mp
  12802. - /**
  12803. - * struct brcmf_mp_device - Device module paramaters.
  12804. - *
  12805. -- * @sdiod_txglomsz: SDIO txglom size.
  12806. -- * @joinboost_5g_rssi: 5g rssi booost for preferred join selection.
  12807. - * @p2p_enable: Legacy P2P0 enable (old wpa_supplicant).
  12808. - * @feature_disable: Feature_disable bitmask.
  12809. - * @fcmode: FWS flow control.
  12810. - * @roamoff: Firmware roaming off?
  12811. -+ * @ignore_probe_fail: Ignore probe failure.
  12812. - * @country_codes: If available, pointer to struct for translating country codes
  12813. -+ * @bus: Bus specific platform data. Only SDIO at the mmoment.
  12814. - */
  12815. - struct brcmf_mp_device {
  12816. -- int sdiod_txglomsz;
  12817. -- int joinboost_5g_rssi;
  12818. -- bool p2p_enable;
  12819. -- int feature_disable;
  12820. -- int fcmode;
  12821. -- bool roamoff;
  12822. -- bool ignore_probe_fail;
  12823. -+ bool p2p_enable;
  12824. -+ unsigned int feature_disable;
  12825. -+ int fcmode;
  12826. -+ bool roamoff;
  12827. -+ bool ignore_probe_fail;
  12828. - struct brcmfmac_pd_cc *country_codes;
  12829. -+ union {
  12830. -+ struct brcmfmac_sdio_pd sdio;
  12831. -+ } bus;
  12832. - };
  12833. -
  12834. --struct brcmfmac_sdio_pd *brcmf_get_module_param(struct device *dev,
  12835. -- enum brcmf_bus_type bus_type,
  12836. -- u32 chip, u32 chiprev);
  12837. --int brcmf_mp_device_attach(struct brcmf_pub *drvr);
  12838. --void brcmf_mp_device_detach(struct brcmf_pub *drvr);
  12839. --#ifdef DEBUG
  12840. --static inline bool brcmf_ignoring_probe_fail(struct brcmf_pub *drvr)
  12841. --{
  12842. -- return drvr->settings->ignore_probe_fail;
  12843. --}
  12844. --#else
  12845. --static inline bool brcmf_ignoring_probe_fail(struct brcmf_pub *drvr)
  12846. --{
  12847. -- return false;
  12848. --}
  12849. --#endif
  12850. -+struct brcmf_mp_device *brcmf_get_module_param(struct device *dev,
  12851. -+ enum brcmf_bus_type bus_type,
  12852. -+ u32 chip, u32 chiprev);
  12853. -+void brcmf_release_module_param(struct brcmf_mp_device *module_param);
  12854. -
  12855. - /* Sets dongle media info (drv_version, mac address). */
  12856. - int brcmf_c_preinit_dcmds(struct brcmf_if *ifp);
  12857. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  12858. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  12859. -@@ -1104,7 +1104,7 @@ static int brcmf_inet6addr_changed(struc
  12860. - }
  12861. - #endif
  12862. -
  12863. --int brcmf_attach(struct device *dev)
  12864. -+int brcmf_attach(struct device *dev, struct brcmf_mp_device *settings)
  12865. - {
  12866. - struct brcmf_pub *drvr = NULL;
  12867. - int ret = 0;
  12868. -@@ -1126,10 +1126,7 @@ int brcmf_attach(struct device *dev)
  12869. - drvr->hdrlen = 0;
  12870. - drvr->bus_if = dev_get_drvdata(dev);
  12871. - drvr->bus_if->drvr = drvr;
  12872. --
  12873. -- /* Initialize device specific settings */
  12874. -- if (brcmf_mp_device_attach(drvr))
  12875. -- goto fail;
  12876. -+ drvr->settings = settings;
  12877. -
  12878. - /* attach debug facilities */
  12879. - brcmf_debug_attach(drvr);
  12880. -@@ -1274,7 +1271,7 @@ fail:
  12881. - brcmf_net_detach(p2p_ifp->ndev);
  12882. - drvr->iflist[0] = NULL;
  12883. - drvr->iflist[1] = NULL;
  12884. -- if (brcmf_ignoring_probe_fail(drvr))
  12885. -+ if (drvr->settings->ignore_probe_fail)
  12886. - ret = 0;
  12887. -
  12888. - return ret;
  12889. -@@ -1350,8 +1347,6 @@ void brcmf_detach(struct device *dev)
  12890. -
  12891. - brcmf_proto_detach(drvr);
  12892. -
  12893. -- brcmf_mp_device_detach(drvr);
  12894. --
  12895. - brcmf_debug_detach(drvr);
  12896. - bus_if->drvr = NULL;
  12897. - kfree(drvr);
  12898. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
  12899. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
  12900. -@@ -23,7 +23,7 @@
  12901. - #include "common.h"
  12902. - #include "of.h"
  12903. -
  12904. --void brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_pd **sdio)
  12905. -+void brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_pd *sdio)
  12906. - {
  12907. - struct device_node *np = dev->of_node;
  12908. - int irq;
  12909. -@@ -33,12 +33,8 @@ void brcmf_of_probe(struct device *dev,
  12910. - if (!np || !of_device_is_compatible(np, "brcm,bcm4329-fmac"))
  12911. - return;
  12912. -
  12913. -- *sdio = devm_kzalloc(dev, sizeof(*sdio), GFP_KERNEL);
  12914. -- if (!(*sdio))
  12915. -- return;
  12916. --
  12917. - if (of_property_read_u32(np, "brcm,drive-strength", &val) == 0)
  12918. -- (*sdio)->drive_strength = val;
  12919. -+ sdio->drive_strength = val;
  12920. -
  12921. - /* make sure there are interrupts defined in the node */
  12922. - if (!of_find_property(np, "interrupts", NULL))
  12923. -@@ -51,7 +47,7 @@ void brcmf_of_probe(struct device *dev,
  12924. - }
  12925. - irqf = irqd_get_trigger_type(irq_get_irq_data(irq));
  12926. -
  12927. -- (*sdio)->oob_irq_supported = true;
  12928. -- (*sdio)->oob_irq_nr = irq;
  12929. -- (*sdio)->oob_irq_flags = irqf;
  12930. -+ sdio->oob_irq_supported = true;
  12931. -+ sdio->oob_irq_nr = irq;
  12932. -+ sdio->oob_irq_flags = irqf;
  12933. - }
  12934. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.h
  12935. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.h
  12936. -@@ -14,10 +14,9 @@
  12937. - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  12938. - */
  12939. - #ifdef CONFIG_OF
  12940. --void
  12941. --brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_pd **sdio);
  12942. -+void brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_pd *sdio);
  12943. - #else
  12944. --static void brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_pd **sdio)
  12945. -+static void brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_pd *sdio)
  12946. - {
  12947. - }
  12948. - #endif /* CONFIG_OF */
  12949. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  12950. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  12951. -@@ -37,6 +37,8 @@
  12952. - #include "pcie.h"
  12953. - #include "firmware.h"
  12954. - #include "chip.h"
  12955. -+#include "core.h"
  12956. -+#include "common.h"
  12957. -
  12958. -
  12959. - enum brcmf_pcie_state {
  12960. -@@ -266,6 +268,7 @@ struct brcmf_pciedev_info {
  12961. - u16 (*read_ptr)(struct brcmf_pciedev_info *devinfo, u32 mem_offset);
  12962. - void (*write_ptr)(struct brcmf_pciedev_info *devinfo, u32 mem_offset,
  12963. - u16 value);
  12964. -+ struct brcmf_mp_device *settings;
  12965. - };
  12966. -
  12967. - struct brcmf_pcie_ringbuf {
  12968. -@@ -1525,16 +1528,16 @@ static void brcmf_pcie_release_resource(
  12969. - }
  12970. -
  12971. -
  12972. --static int brcmf_pcie_attach_bus(struct device *dev)
  12973. -+static int brcmf_pcie_attach_bus(struct brcmf_pciedev_info *devinfo)
  12974. - {
  12975. - int ret;
  12976. -
  12977. - /* Attach to the common driver interface */
  12978. -- ret = brcmf_attach(dev);
  12979. -+ ret = brcmf_attach(&devinfo->pdev->dev, devinfo->settings);
  12980. - if (ret) {
  12981. - brcmf_err("brcmf_attach failed\n");
  12982. - } else {
  12983. -- ret = brcmf_bus_start(dev);
  12984. -+ ret = brcmf_bus_start(&devinfo->pdev->dev);
  12985. - if (ret)
  12986. - brcmf_err("dongle is not responding\n");
  12987. - }
  12988. -@@ -1672,7 +1675,7 @@ static void brcmf_pcie_setup(struct devi
  12989. - init_waitqueue_head(&devinfo->mbdata_resp_wait);
  12990. -
  12991. - brcmf_pcie_intr_enable(devinfo);
  12992. -- if (brcmf_pcie_attach_bus(bus->dev) == 0)
  12993. -+ if (brcmf_pcie_attach_bus(devinfo) == 0)
  12994. - return;
  12995. -
  12996. - brcmf_pcie_bus_console_read(devinfo);
  12997. -@@ -1716,6 +1719,15 @@ brcmf_pcie_probe(struct pci_dev *pdev, c
  12998. - goto fail;
  12999. - }
  13000. -
  13001. -+ devinfo->settings = brcmf_get_module_param(&devinfo->pdev->dev,
  13002. -+ BRCMF_BUSTYPE_PCIE,
  13003. -+ devinfo->ci->chip,
  13004. -+ devinfo->ci->chiprev);
  13005. -+ if (!devinfo->settings) {
  13006. -+ ret = -ENOMEM;
  13007. -+ goto fail;
  13008. -+ }
  13009. -+
  13010. - bus = kzalloc(sizeof(*bus), GFP_KERNEL);
  13011. - if (!bus) {
  13012. - ret = -ENOMEM;
  13013. -@@ -1760,6 +1772,8 @@ fail:
  13014. - brcmf_pcie_release_resource(devinfo);
  13015. - if (devinfo->ci)
  13016. - brcmf_chip_detach(devinfo->ci);
  13017. -+ if (devinfo->settings)
  13018. -+ brcmf_release_module_param(devinfo->settings);
  13019. - kfree(pcie_bus_dev);
  13020. - kfree(devinfo);
  13021. - return ret;
  13022. -@@ -1799,6 +1813,8 @@ brcmf_pcie_remove(struct pci_dev *pdev)
  13023. -
  13024. - if (devinfo->ci)
  13025. - brcmf_chip_detach(devinfo->ci);
  13026. -+ if (devinfo->settings)
  13027. -+ brcmf_release_module_param(devinfo->settings);
  13028. -
  13029. - kfree(devinfo);
  13030. - dev_set_drvdata(&pdev->dev, NULL);
  13031. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  13032. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  13033. -@@ -2442,15 +2442,17 @@ static void brcmf_sdio_bus_stop(struct d
  13034. -
  13035. - static inline void brcmf_sdio_clrintr(struct brcmf_sdio *bus)
  13036. - {
  13037. -+ struct brcmf_sdio_dev *sdiodev;
  13038. - unsigned long flags;
  13039. -
  13040. -- if (bus->sdiodev->oob_irq_requested) {
  13041. -- spin_lock_irqsave(&bus->sdiodev->irq_en_lock, flags);
  13042. -- if (!bus->sdiodev->irq_en && !atomic_read(&bus->ipend)) {
  13043. -- enable_irq(bus->sdiodev->pdata->oob_irq_nr);
  13044. -- bus->sdiodev->irq_en = true;
  13045. -+ sdiodev = bus->sdiodev;
  13046. -+ if (sdiodev->oob_irq_requested) {
  13047. -+ spin_lock_irqsave(&sdiodev->irq_en_lock, flags);
  13048. -+ if (!sdiodev->irq_en && !atomic_read(&bus->ipend)) {
  13049. -+ enable_irq(sdiodev->settings->bus.sdio.oob_irq_nr);
  13050. -+ sdiodev->irq_en = true;
  13051. - }
  13052. -- spin_unlock_irqrestore(&bus->sdiodev->irq_en_lock, flags);
  13053. -+ spin_unlock_irqrestore(&sdiodev->irq_en_lock, flags);
  13054. - }
  13055. - }
  13056. -
  13057. -@@ -3394,9 +3396,7 @@ static int brcmf_sdio_bus_preinit(struct
  13058. - sizeof(u32));
  13059. - } else {
  13060. - /* otherwise, set txglomalign */
  13061. -- value = 4;
  13062. -- if (sdiodev->pdata)
  13063. -- value = sdiodev->pdata->sd_sgentry_align;
  13064. -+ value = sdiodev->settings->bus.sdio.sd_sgentry_align;
  13065. - /* SDIO ADMA requires at least 32 bit alignment */
  13066. - value = max_t(u32, value, 4);
  13067. - err = brcmf_iovar_data_set(dev, "bus:txglomalign", &value,
  13068. -@@ -3811,21 +3811,25 @@ brcmf_sdio_probe_attach(struct brcmf_sdi
  13069. - bus->ci = NULL;
  13070. - goto fail;
  13071. - }
  13072. -- sdiodev->pdata = brcmf_get_module_param(sdiodev->dev,
  13073. -+ sdiodev->settings = brcmf_get_module_param(sdiodev->dev,
  13074. - BRCMF_BUSTYPE_SDIO,
  13075. - bus->ci->chip,
  13076. - bus->ci->chiprev);
  13077. -+ if (!sdiodev->settings) {
  13078. -+ brcmf_err("Failed to get device parameters\n");
  13079. -+ goto fail;
  13080. -+ }
  13081. - /* platform specific configuration:
  13082. - * alignments must be at least 4 bytes for ADMA
  13083. - */
  13084. - bus->head_align = ALIGNMENT;
  13085. - bus->sgentry_align = ALIGNMENT;
  13086. -- if (sdiodev->pdata) {
  13087. -- if (sdiodev->pdata->sd_head_align > ALIGNMENT)
  13088. -- bus->head_align = sdiodev->pdata->sd_head_align;
  13089. -- if (sdiodev->pdata->sd_sgentry_align > ALIGNMENT)
  13090. -- bus->sgentry_align = sdiodev->pdata->sd_sgentry_align;
  13091. -- }
  13092. -+ if (sdiodev->settings->bus.sdio.sd_head_align > ALIGNMENT)
  13093. -+ bus->head_align = sdiodev->settings->bus.sdio.sd_head_align;
  13094. -+ if (sdiodev->settings->bus.sdio.sd_sgentry_align > ALIGNMENT)
  13095. -+ bus->sgentry_align =
  13096. -+ sdiodev->settings->bus.sdio.sd_sgentry_align;
  13097. -+
  13098. - /* allocate scatter-gather table. sg support
  13099. - * will be disabled upon allocation failure.
  13100. - */
  13101. -@@ -3837,7 +3841,7 @@ brcmf_sdio_probe_attach(struct brcmf_sdi
  13102. - */
  13103. - if ((sdio_get_host_pm_caps(sdiodev->func[1]) & MMC_PM_KEEP_POWER) &&
  13104. - ((sdio_get_host_pm_caps(sdiodev->func[1]) & MMC_PM_WAKE_SDIO_IRQ) ||
  13105. -- (sdiodev->pdata && sdiodev->pdata->oob_irq_supported)))
  13106. -+ (sdiodev->settings->bus.sdio.oob_irq_supported)))
  13107. - sdiodev->bus_if->wowl_supported = true;
  13108. - #endif
  13109. -
  13110. -@@ -3846,8 +3850,8 @@ brcmf_sdio_probe_attach(struct brcmf_sdi
  13111. - goto fail;
  13112. - }
  13113. -
  13114. -- if ((sdiodev->pdata) && (sdiodev->pdata->drive_strength))
  13115. -- drivestrength = sdiodev->pdata->drive_strength;
  13116. -+ if (sdiodev->settings->bus.sdio.drive_strength)
  13117. -+ drivestrength = sdiodev->settings->bus.sdio.drive_strength;
  13118. - else
  13119. - drivestrength = DEFAULT_SDIO_DRIVE_STRENGTH;
  13120. - brcmf_sdio_drivestrengthinit(sdiodev, bus->ci, drivestrength);
  13121. -@@ -4124,7 +4128,7 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
  13122. - bus->tx_hdrlen = SDPCM_HWHDR_LEN + SDPCM_SWHDR_LEN;
  13123. -
  13124. - /* Attach to the common layer, reserve hdr space */
  13125. -- ret = brcmf_attach(bus->sdiodev->dev);
  13126. -+ ret = brcmf_attach(bus->sdiodev->dev, bus->sdiodev->settings);
  13127. - if (ret != 0) {
  13128. - brcmf_err("brcmf_attach failed\n");
  13129. - goto fail;
  13130. -@@ -4228,6 +4232,8 @@ void brcmf_sdio_remove(struct brcmf_sdio
  13131. - }
  13132. - brcmf_chip_detach(bus->ci);
  13133. - }
  13134. -+ if (bus->sdiodev->settings)
  13135. -+ brcmf_release_module_param(bus->sdiodev->settings);
  13136. -
  13137. - kfree(bus->rxbuf);
  13138. - kfree(bus->hdrbuf);
  13139. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
  13140. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
  13141. -@@ -184,7 +184,7 @@ struct brcmf_sdio_dev {
  13142. - struct brcmf_sdio *bus;
  13143. - struct device *dev;
  13144. - struct brcmf_bus *bus_if;
  13145. -- struct brcmfmac_sdio_pd *pdata;
  13146. -+ struct brcmf_mp_device *settings;
  13147. - bool oob_irq_requested;
  13148. - bool irq_en; /* irq enable flags */
  13149. - spinlock_t irq_en_lock;
  13150. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
  13151. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
  13152. -@@ -27,6 +27,8 @@
  13153. - #include "debug.h"
  13154. - #include "firmware.h"
  13155. - #include "usb.h"
  13156. -+#include "core.h"
  13157. -+#include "common.h"
  13158. -
  13159. -
  13160. - #define IOCTL_RESP_TIMEOUT msecs_to_jiffies(2000)
  13161. -@@ -171,6 +173,7 @@ struct brcmf_usbdev_info {
  13162. - struct urb *bulk_urb; /* used for FW download */
  13163. -
  13164. - bool wowl_enabled;
  13165. -+ struct brcmf_mp_device *settings;
  13166. - };
  13167. -
  13168. - static void brcmf_usb_rx_refill(struct brcmf_usbdev_info *devinfo,
  13169. -@@ -1027,6 +1030,9 @@ static void brcmf_usb_detach(struct brcm
  13170. -
  13171. - kfree(devinfo->tx_reqs);
  13172. - kfree(devinfo->rx_reqs);
  13173. -+
  13174. -+ if (devinfo->settings)
  13175. -+ brcmf_release_module_param(devinfo->settings);
  13176. - }
  13177. -
  13178. -
  13179. -@@ -1136,7 +1142,7 @@ static int brcmf_usb_bus_setup(struct br
  13180. - int ret;
  13181. -
  13182. - /* Attach to the common driver interface */
  13183. -- ret = brcmf_attach(devinfo->dev);
  13184. -+ ret = brcmf_attach(devinfo->dev, devinfo->settings);
  13185. - if (ret) {
  13186. - brcmf_err("brcmf_attach failed\n");
  13187. - return ret;
  13188. -@@ -1223,6 +1229,14 @@ static int brcmf_usb_probe_cb(struct brc
  13189. - bus->wowl_supported = true;
  13190. - #endif
  13191. -
  13192. -+ devinfo->settings = brcmf_get_module_param(bus->dev, BRCMF_BUSTYPE_USB,
  13193. -+ bus_pub->devid,
  13194. -+ bus_pub->chiprev);
  13195. -+ if (!devinfo->settings) {
  13196. -+ ret = -ENOMEM;
  13197. -+ goto fail;
  13198. -+ }
  13199. -+
  13200. - if (!brcmf_usb_dlneeded(devinfo)) {
  13201. - ret = brcmf_usb_bus_setup(devinfo);
  13202. - if (ret)
  13203. 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
  13204. deleted file mode 100644
  13205. index eb680fccfc4695e3c676ed39593e57ffd60d908f..0000000000000000000000000000000000000000
  13206. --- a/package/kernel/mac80211/patches/344-0019-brcmfmac-integrate-add_keyext-in-add_key.patch
  13207. +++ /dev/null
  13208. @@ -1,227 +0,0 @@
  13209. -From: Hante Meuleman <hante.meuleman@broadcom.com>
  13210. -Date: Wed, 17 Feb 2016 11:27:09 +0100
  13211. -Subject: [PATCH] brcmfmac: integrate add_keyext in add_key
  13212. -
  13213. -brcmf_add_keyext is called when a key is configured for a specific
  13214. -mac address. This function is very similar to the calling function
  13215. -brcmf_add_key. Integrate this function and also use existing del_key
  13216. -function in case key is to be cleared.
  13217. -
  13218. -Reviewed-by: Arend Van Spriel <arend.van@broadcom.com>
  13219. -Reviewed-by: Franky (Zhenhui) Lin <franky.lin@broadcom.com>
  13220. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  13221. -Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
  13222. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  13223. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13224. ----
  13225. -
  13226. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  13227. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  13228. -@@ -2073,84 +2073,34 @@ done:
  13229. - }
  13230. -
  13231. - static s32
  13232. --brcmf_add_keyext(struct wiphy *wiphy, struct net_device *ndev,
  13233. -- u8 key_idx, const u8 *mac_addr, struct key_params *params)
  13234. -+brcmf_cfg80211_del_key(struct wiphy *wiphy, struct net_device *ndev,
  13235. -+ u8 key_idx, bool pairwise, const u8 *mac_addr)
  13236. - {
  13237. - struct brcmf_if *ifp = netdev_priv(ndev);
  13238. - struct brcmf_wsec_key key;
  13239. - s32 err = 0;
  13240. -- u8 keybuf[8];
  13241. -+
  13242. -+ brcmf_dbg(TRACE, "Enter\n");
  13243. -+ if (!check_vif_up(ifp->vif))
  13244. -+ return -EIO;
  13245. -+
  13246. -+ if (key_idx >= BRCMF_MAX_DEFAULT_KEYS) {
  13247. -+ /* we ignore this key index in this case */
  13248. -+ return -EINVAL;
  13249. -+ }
  13250. -
  13251. - memset(&key, 0, sizeof(key));
  13252. -- key.index = (u32) key_idx;
  13253. -- /* Instead of bcast for ea address for default wep keys,
  13254. -- driver needs it to be Null */
  13255. -- if (!is_multicast_ether_addr(mac_addr))
  13256. -- memcpy((char *)&key.ea, (void *)mac_addr, ETH_ALEN);
  13257. -- key.len = (u32) params->key_len;
  13258. -- /* check for key index change */
  13259. -- if (key.len == 0) {
  13260. -- /* key delete */
  13261. -- err = send_key_to_dongle(ifp, &key);
  13262. -- if (err)
  13263. -- brcmf_err("key delete error (%d)\n", err);
  13264. -- } else {
  13265. -- if (key.len > sizeof(key.data)) {
  13266. -- brcmf_err("Invalid key length (%d)\n", key.len);
  13267. -- return -EINVAL;
  13268. -- }
  13269. -
  13270. -- brcmf_dbg(CONN, "Setting the key index %d\n", key.index);
  13271. -- memcpy(key.data, params->key, key.len);
  13272. -+ key.index = (u32)key_idx;
  13273. -+ key.flags = BRCMF_PRIMARY_KEY;
  13274. -+ key.algo = CRYPTO_ALGO_OFF;
  13275. -
  13276. -- if (!brcmf_is_apmode(ifp->vif) &&
  13277. -- (params->cipher == WLAN_CIPHER_SUITE_TKIP)) {
  13278. -- brcmf_dbg(CONN, "Swapping RX/TX MIC key\n");
  13279. -- memcpy(keybuf, &key.data[24], sizeof(keybuf));
  13280. -- memcpy(&key.data[24], &key.data[16], sizeof(keybuf));
  13281. -- memcpy(&key.data[16], keybuf, sizeof(keybuf));
  13282. -- }
  13283. -+ brcmf_dbg(CONN, "key index (%d)\n", key_idx);
  13284. -
  13285. -- /* if IW_ENCODE_EXT_RX_SEQ_VALID set */
  13286. -- if (params->seq && params->seq_len == 6) {
  13287. -- /* rx iv */
  13288. -- u8 *ivptr;
  13289. -- ivptr = (u8 *) params->seq;
  13290. -- key.rxiv.hi = (ivptr[5] << 24) | (ivptr[4] << 16) |
  13291. -- (ivptr[3] << 8) | ivptr[2];
  13292. -- key.rxiv.lo = (ivptr[1] << 8) | ivptr[0];
  13293. -- key.iv_initialized = true;
  13294. -- }
  13295. -+ /* Set the new key/index */
  13296. -+ err = send_key_to_dongle(ifp, &key);
  13297. -
  13298. -- switch (params->cipher) {
  13299. -- case WLAN_CIPHER_SUITE_WEP40:
  13300. -- key.algo = CRYPTO_ALGO_WEP1;
  13301. -- brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_WEP40\n");
  13302. -- break;
  13303. -- case WLAN_CIPHER_SUITE_WEP104:
  13304. -- key.algo = CRYPTO_ALGO_WEP128;
  13305. -- brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_WEP104\n");
  13306. -- break;
  13307. -- case WLAN_CIPHER_SUITE_TKIP:
  13308. -- key.algo = CRYPTO_ALGO_TKIP;
  13309. -- brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_TKIP\n");
  13310. -- break;
  13311. -- case WLAN_CIPHER_SUITE_AES_CMAC:
  13312. -- key.algo = CRYPTO_ALGO_AES_CCM;
  13313. -- brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_AES_CMAC\n");
  13314. -- break;
  13315. -- case WLAN_CIPHER_SUITE_CCMP:
  13316. -- key.algo = CRYPTO_ALGO_AES_CCM;
  13317. -- brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_CCMP\n");
  13318. -- break;
  13319. -- default:
  13320. -- brcmf_err("Invalid cipher (0x%x)\n", params->cipher);
  13321. -- return -EINVAL;
  13322. -- }
  13323. -- err = send_key_to_dongle(ifp, &key);
  13324. -- if (err)
  13325. -- brcmf_err("wsec_key error (%d)\n", err);
  13326. -- }
  13327. -+ brcmf_dbg(TRACE, "Exit\n");
  13328. - return err;
  13329. - }
  13330. -
  13331. -@@ -2163,8 +2113,9 @@ brcmf_cfg80211_add_key(struct wiphy *wip
  13332. - struct brcmf_wsec_key *key;
  13333. - s32 val;
  13334. - s32 wsec;
  13335. -- s32 err = 0;
  13336. -+ s32 err;
  13337. - u8 keybuf[8];
  13338. -+ bool ext_key;
  13339. -
  13340. - brcmf_dbg(TRACE, "Enter\n");
  13341. - brcmf_dbg(CONN, "key index (%d)\n", key_idx);
  13342. -@@ -2177,27 +2128,32 @@ brcmf_cfg80211_add_key(struct wiphy *wip
  13343. - return -EINVAL;
  13344. - }
  13345. -
  13346. -- if (mac_addr &&
  13347. -- (params->cipher != WLAN_CIPHER_SUITE_WEP40) &&
  13348. -- (params->cipher != WLAN_CIPHER_SUITE_WEP104)) {
  13349. -- brcmf_dbg(TRACE, "Exit");
  13350. -- return brcmf_add_keyext(wiphy, ndev, key_idx, mac_addr, params);
  13351. -- }
  13352. --
  13353. -- key = &ifp->vif->profile.key[key_idx];
  13354. -- memset(key, 0, sizeof(*key));
  13355. -+ if (params->key_len == 0)
  13356. -+ return brcmf_cfg80211_del_key(wiphy, ndev, key_idx, pairwise,
  13357. -+ mac_addr);
  13358. -
  13359. - if (params->key_len > sizeof(key->data)) {
  13360. - brcmf_err("Too long key length (%u)\n", params->key_len);
  13361. -- err = -EINVAL;
  13362. -- goto done;
  13363. -+ return -EINVAL;
  13364. -+ }
  13365. -+
  13366. -+ ext_key = false;
  13367. -+ if (mac_addr && (params->cipher != WLAN_CIPHER_SUITE_WEP40) &&
  13368. -+ (params->cipher != WLAN_CIPHER_SUITE_WEP104)) {
  13369. -+ brcmf_dbg(TRACE, "Ext key, mac %pM", mac_addr);
  13370. -+ ext_key = true;
  13371. - }
  13372. -+
  13373. -+ key = &ifp->vif->profile.key[key_idx];
  13374. -+ memset(key, 0, sizeof(*key));
  13375. -+ if ((ext_key) && (!is_multicast_ether_addr(mac_addr)))
  13376. -+ memcpy((char *)&key->ea, (void *)mac_addr, ETH_ALEN);
  13377. - key->len = params->key_len;
  13378. - key->index = key_idx;
  13379. --
  13380. - memcpy(key->data, params->key, key->len);
  13381. -+ if (!ext_key)
  13382. -+ key->flags = BRCMF_PRIMARY_KEY;
  13383. -
  13384. -- key->flags = BRCMF_PRIMARY_KEY;
  13385. - switch (params->cipher) {
  13386. - case WLAN_CIPHER_SUITE_WEP40:
  13387. - key->algo = CRYPTO_ALGO_WEP1;
  13388. -@@ -2237,7 +2193,7 @@ brcmf_cfg80211_add_key(struct wiphy *wip
  13389. - }
  13390. -
  13391. - err = send_key_to_dongle(ifp, key);
  13392. -- if (err)
  13393. -+ if (ext_key || err)
  13394. - goto done;
  13395. -
  13396. - err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
  13397. -@@ -2256,38 +2212,6 @@ done:
  13398. - brcmf_dbg(TRACE, "Exit\n");
  13399. - return err;
  13400. - }
  13401. --
  13402. --static s32
  13403. --brcmf_cfg80211_del_key(struct wiphy *wiphy, struct net_device *ndev,
  13404. -- u8 key_idx, bool pairwise, const u8 *mac_addr)
  13405. --{
  13406. -- struct brcmf_if *ifp = netdev_priv(ndev);
  13407. -- struct brcmf_wsec_key key;
  13408. -- s32 err = 0;
  13409. --
  13410. -- brcmf_dbg(TRACE, "Enter\n");
  13411. -- if (!check_vif_up(ifp->vif))
  13412. -- return -EIO;
  13413. --
  13414. -- if (key_idx >= BRCMF_MAX_DEFAULT_KEYS) {
  13415. -- /* we ignore this key index in this case */
  13416. -- return -EINVAL;
  13417. -- }
  13418. --
  13419. -- memset(&key, 0, sizeof(key));
  13420. --
  13421. -- key.index = (u32) key_idx;
  13422. -- key.flags = BRCMF_PRIMARY_KEY;
  13423. -- key.algo = CRYPTO_ALGO_OFF;
  13424. --
  13425. -- brcmf_dbg(CONN, "key index (%d)\n", key_idx);
  13426. --
  13427. -- /* Set the new key/index */
  13428. -- err = send_key_to_dongle(ifp, &key);
  13429. --
  13430. -- brcmf_dbg(TRACE, "Exit\n");
  13431. -- return err;
  13432. --}
  13433. -
  13434. - static s32
  13435. - brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev,
  13436. 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
  13437. deleted file mode 100644
  13438. index c20d40c049724d71cf65170872be9e3a0c3ff21a..0000000000000000000000000000000000000000
  13439. --- a/package/kernel/mac80211/patches/344-0020-brcmfmac-add-802.11w-management-frame-protection-sup.patch
  13440. +++ /dev/null
  13441. @@ -1,509 +0,0 @@
  13442. -From: Hante Meuleman <hante.meuleman@broadcom.com>
  13443. -Date: Wed, 17 Feb 2016 11:27:10 +0100
  13444. -Subject: [PATCH] brcmfmac: add 802.11w management frame protection support
  13445. -
  13446. -Add full support for both AP and STA for management frame protection.
  13447. -
  13448. -Reviewed-by: Arend Van Spriel <arend.van@broadcom.com>
  13449. -Reviewed-by: Franky (Zhenhui) Lin <franky.lin@broadcom.com>
  13450. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  13451. -Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
  13452. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  13453. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13454. ----
  13455. -
  13456. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  13457. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  13458. -@@ -72,8 +72,13 @@
  13459. - #define RSN_AKM_NONE 0 /* None (IBSS) */
  13460. - #define RSN_AKM_UNSPECIFIED 1 /* Over 802.1x */
  13461. - #define RSN_AKM_PSK 2 /* Pre-shared Key */
  13462. -+#define RSN_AKM_SHA256_1X 5 /* SHA256, 802.1X */
  13463. -+#define RSN_AKM_SHA256_PSK 6 /* SHA256, Pre-shared Key */
  13464. - #define RSN_CAP_LEN 2 /* Length of RSN capabilities */
  13465. --#define RSN_CAP_PTK_REPLAY_CNTR_MASK 0x000C
  13466. -+#define RSN_CAP_PTK_REPLAY_CNTR_MASK (BIT(2) | BIT(3))
  13467. -+#define RSN_CAP_MFPR_MASK BIT(6)
  13468. -+#define RSN_CAP_MFPC_MASK BIT(7)
  13469. -+#define RSN_PMKID_COUNT_LEN 2
  13470. -
  13471. - #define VNDR_IE_CMD_LEN 4 /* length of the set command
  13472. - * string :"add", "del" (+ NUL)
  13473. -@@ -211,12 +216,19 @@ static const struct ieee80211_regdomain
  13474. - REG_RULE(5470-10, 5850+10, 80, 6, 20, 0), }
  13475. - };
  13476. -
  13477. --static const u32 __wl_cipher_suites[] = {
  13478. -+/* Note: brcmf_cipher_suites is an array of int defining which cipher suites
  13479. -+ * are supported. A pointer to this array and the number of entries is passed
  13480. -+ * on to upper layers. AES_CMAC defines whether or not the driver supports MFP.
  13481. -+ * So the cipher suite AES_CMAC has to be the last one in the array, and when
  13482. -+ * device does not support MFP then the number of suites will be decreased by 1
  13483. -+ */
  13484. -+static const u32 brcmf_cipher_suites[] = {
  13485. - WLAN_CIPHER_SUITE_WEP40,
  13486. - WLAN_CIPHER_SUITE_WEP104,
  13487. - WLAN_CIPHER_SUITE_TKIP,
  13488. - WLAN_CIPHER_SUITE_CCMP,
  13489. -- WLAN_CIPHER_SUITE_AES_CMAC,
  13490. -+ /* Keep as last entry: */
  13491. -+ WLAN_CIPHER_SUITE_AES_CMAC
  13492. - };
  13493. -
  13494. - /* Vendor specific ie. id = 221, oui and type defines exact ie */
  13495. -@@ -1533,7 +1545,7 @@ static s32 brcmf_set_auth_type(struct ne
  13496. -
  13497. - static s32
  13498. - brcmf_set_wsec_mode(struct net_device *ndev,
  13499. -- struct cfg80211_connect_params *sme, bool mfp)
  13500. -+ struct cfg80211_connect_params *sme)
  13501. - {
  13502. - struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
  13503. - struct brcmf_cfg80211_security *sec;
  13504. -@@ -1592,10 +1604,7 @@ brcmf_set_wsec_mode(struct net_device *n
  13505. - sme->privacy)
  13506. - pval = AES_ENABLED;
  13507. -
  13508. -- if (mfp)
  13509. -- wsec = pval | gval | MFP_CAPABLE;
  13510. -- else
  13511. -- wsec = pval | gval;
  13512. -+ wsec = pval | gval;
  13513. - err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "wsec", wsec);
  13514. - if (err) {
  13515. - brcmf_err("error (%d)\n", err);
  13516. -@@ -1612,56 +1621,100 @@ brcmf_set_wsec_mode(struct net_device *n
  13517. - static s32
  13518. - brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme)
  13519. - {
  13520. -- struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
  13521. -- struct brcmf_cfg80211_security *sec;
  13522. -- s32 val = 0;
  13523. -- s32 err = 0;
  13524. -+ struct brcmf_if *ifp = netdev_priv(ndev);
  13525. -+ s32 val;
  13526. -+ s32 err;
  13527. -+ const struct brcmf_tlv *rsn_ie;
  13528. -+ const u8 *ie;
  13529. -+ u32 ie_len;
  13530. -+ u32 offset;
  13531. -+ u16 rsn_cap;
  13532. -+ u32 mfp;
  13533. -+ u16 count;
  13534. -
  13535. -- if (sme->crypto.n_akm_suites) {
  13536. -- err = brcmf_fil_bsscfg_int_get(netdev_priv(ndev),
  13537. -- "wpa_auth", &val);
  13538. -- if (err) {
  13539. -- brcmf_err("could not get wpa_auth (%d)\n", err);
  13540. -- return err;
  13541. -+ if (!sme->crypto.n_akm_suites)
  13542. -+ return 0;
  13543. -+
  13544. -+ err = brcmf_fil_bsscfg_int_get(netdev_priv(ndev), "wpa_auth", &val);
  13545. -+ if (err) {
  13546. -+ brcmf_err("could not get wpa_auth (%d)\n", err);
  13547. -+ return err;
  13548. -+ }
  13549. -+ if (val & (WPA_AUTH_PSK | WPA_AUTH_UNSPECIFIED)) {
  13550. -+ switch (sme->crypto.akm_suites[0]) {
  13551. -+ case WLAN_AKM_SUITE_8021X:
  13552. -+ val = WPA_AUTH_UNSPECIFIED;
  13553. -+ break;
  13554. -+ case WLAN_AKM_SUITE_PSK:
  13555. -+ val = WPA_AUTH_PSK;
  13556. -+ break;
  13557. -+ default:
  13558. -+ brcmf_err("invalid cipher group (%d)\n",
  13559. -+ sme->crypto.cipher_group);
  13560. -+ return -EINVAL;
  13561. - }
  13562. -- if (val & (WPA_AUTH_PSK | WPA_AUTH_UNSPECIFIED)) {
  13563. -- switch (sme->crypto.akm_suites[0]) {
  13564. -- case WLAN_AKM_SUITE_8021X:
  13565. -- val = WPA_AUTH_UNSPECIFIED;
  13566. -- break;
  13567. -- case WLAN_AKM_SUITE_PSK:
  13568. -- val = WPA_AUTH_PSK;
  13569. -- break;
  13570. -- default:
  13571. -- brcmf_err("invalid cipher group (%d)\n",
  13572. -- sme->crypto.cipher_group);
  13573. -- return -EINVAL;
  13574. -- }
  13575. -- } else if (val & (WPA2_AUTH_PSK | WPA2_AUTH_UNSPECIFIED)) {
  13576. -- switch (sme->crypto.akm_suites[0]) {
  13577. -- case WLAN_AKM_SUITE_8021X:
  13578. -- val = WPA2_AUTH_UNSPECIFIED;
  13579. -- break;
  13580. -- case WLAN_AKM_SUITE_PSK:
  13581. -- val = WPA2_AUTH_PSK;
  13582. -- break;
  13583. -- default:
  13584. -- brcmf_err("invalid cipher group (%d)\n",
  13585. -- sme->crypto.cipher_group);
  13586. -- return -EINVAL;
  13587. -- }
  13588. -+ } else if (val & (WPA2_AUTH_PSK | WPA2_AUTH_UNSPECIFIED)) {
  13589. -+ switch (sme->crypto.akm_suites[0]) {
  13590. -+ case WLAN_AKM_SUITE_8021X:
  13591. -+ val = WPA2_AUTH_UNSPECIFIED;
  13592. -+ break;
  13593. -+ case WLAN_AKM_SUITE_8021X_SHA256:
  13594. -+ val = WPA2_AUTH_1X_SHA256;
  13595. -+ break;
  13596. -+ case WLAN_AKM_SUITE_PSK_SHA256:
  13597. -+ val = WPA2_AUTH_PSK_SHA256;
  13598. -+ break;
  13599. -+ case WLAN_AKM_SUITE_PSK:
  13600. -+ val = WPA2_AUTH_PSK;
  13601. -+ break;
  13602. -+ default:
  13603. -+ brcmf_err("invalid cipher group (%d)\n",
  13604. -+ sme->crypto.cipher_group);
  13605. -+ return -EINVAL;
  13606. - }
  13607. -+ }
  13608. -
  13609. -- brcmf_dbg(CONN, "setting wpa_auth to %d\n", val);
  13610. -- err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev),
  13611. -- "wpa_auth", val);
  13612. -- if (err) {
  13613. -- brcmf_err("could not set wpa_auth (%d)\n", err);
  13614. -- return err;
  13615. -- }
  13616. -+ if (!brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MFP))
  13617. -+ goto skip_mfp_config;
  13618. -+ /* The MFP mode (1 or 2) needs to be determined, parse IEs. The
  13619. -+ * IE will not be verified, just a quick search for MFP config
  13620. -+ */
  13621. -+ rsn_ie = brcmf_parse_tlvs((const u8 *)sme->ie, sme->ie_len,
  13622. -+ WLAN_EID_RSN);
  13623. -+ if (!rsn_ie)
  13624. -+ goto skip_mfp_config;
  13625. -+ ie = (const u8 *)rsn_ie;
  13626. -+ ie_len = rsn_ie->len + TLV_HDR_LEN;
  13627. -+ /* Skip unicast suite */
  13628. -+ offset = TLV_HDR_LEN + WPA_IE_VERSION_LEN + WPA_IE_MIN_OUI_LEN;
  13629. -+ if (offset + WPA_IE_SUITE_COUNT_LEN >= ie_len)
  13630. -+ goto skip_mfp_config;
  13631. -+ /* Skip multicast suite */
  13632. -+ count = ie[offset] + (ie[offset + 1] << 8);
  13633. -+ offset += WPA_IE_SUITE_COUNT_LEN + (count * WPA_IE_MIN_OUI_LEN);
  13634. -+ if (offset + WPA_IE_SUITE_COUNT_LEN >= ie_len)
  13635. -+ goto skip_mfp_config;
  13636. -+ /* Skip auth key management suite(s) */
  13637. -+ count = ie[offset] + (ie[offset + 1] << 8);
  13638. -+ offset += WPA_IE_SUITE_COUNT_LEN + (count * WPA_IE_MIN_OUI_LEN);
  13639. -+ if (offset + WPA_IE_SUITE_COUNT_LEN > ie_len)
  13640. -+ goto skip_mfp_config;
  13641. -+ /* Ready to read capabilities */
  13642. -+ mfp = BRCMF_MFP_NONE;
  13643. -+ rsn_cap = ie[offset] + (ie[offset + 1] << 8);
  13644. -+ if (rsn_cap & RSN_CAP_MFPR_MASK)
  13645. -+ mfp = BRCMF_MFP_REQUIRED;
  13646. -+ else if (rsn_cap & RSN_CAP_MFPC_MASK)
  13647. -+ mfp = BRCMF_MFP_CAPABLE;
  13648. -+ brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "mfp", mfp);
  13649. -+
  13650. -+skip_mfp_config:
  13651. -+ brcmf_dbg(CONN, "setting wpa_auth to %d\n", val);
  13652. -+ err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "wpa_auth", val);
  13653. -+ if (err) {
  13654. -+ brcmf_err("could not set wpa_auth (%d)\n", err);
  13655. -+ return err;
  13656. - }
  13657. -- sec = &profile->sec;
  13658. -- sec->wpa_auth = sme->crypto.akm_suites[0];
  13659. -
  13660. - return err;
  13661. - }
  13662. -@@ -1827,7 +1880,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
  13663. - goto done;
  13664. - }
  13665. -
  13666. -- err = brcmf_set_wsec_mode(ndev, sme, sme->mfp == NL80211_MFP_REQUIRED);
  13667. -+ err = brcmf_set_wsec_mode(ndev, sme);
  13668. - if (err) {
  13669. - brcmf_err("wl_set_set_cipher failed (%d)\n", err);
  13670. - goto done;
  13671. -@@ -2077,10 +2130,12 @@ brcmf_cfg80211_del_key(struct wiphy *wip
  13672. - u8 key_idx, bool pairwise, const u8 *mac_addr)
  13673. - {
  13674. - struct brcmf_if *ifp = netdev_priv(ndev);
  13675. -- struct brcmf_wsec_key key;
  13676. -- s32 err = 0;
  13677. -+ struct brcmf_wsec_key *key;
  13678. -+ s32 err;
  13679. -
  13680. - brcmf_dbg(TRACE, "Enter\n");
  13681. -+ brcmf_dbg(CONN, "key index (%d)\n", key_idx);
  13682. -+
  13683. - if (!check_vif_up(ifp->vif))
  13684. - return -EIO;
  13685. -
  13686. -@@ -2089,16 +2144,19 @@ brcmf_cfg80211_del_key(struct wiphy *wip
  13687. - return -EINVAL;
  13688. - }
  13689. -
  13690. -- memset(&key, 0, sizeof(key));
  13691. -+ key = &ifp->vif->profile.key[key_idx];
  13692. -
  13693. -- key.index = (u32)key_idx;
  13694. -- key.flags = BRCMF_PRIMARY_KEY;
  13695. -- key.algo = CRYPTO_ALGO_OFF;
  13696. -+ if (key->algo == CRYPTO_ALGO_OFF) {
  13697. -+ brcmf_dbg(CONN, "Ignore clearing of (never configured) key\n");
  13698. -+ return -EINVAL;
  13699. -+ }
  13700. -
  13701. -- brcmf_dbg(CONN, "key index (%d)\n", key_idx);
  13702. -+ memset(key, 0, sizeof(*key));
  13703. -+ key->index = (u32)key_idx;
  13704. -+ key->flags = BRCMF_PRIMARY_KEY;
  13705. -
  13706. -- /* Set the new key/index */
  13707. -- err = send_key_to_dongle(ifp, &key);
  13708. -+ /* Clear the key/index */
  13709. -+ err = send_key_to_dongle(ifp, key);
  13710. -
  13711. - brcmf_dbg(TRACE, "Exit\n");
  13712. - return err;
  13713. -@@ -2106,8 +2164,8 @@ brcmf_cfg80211_del_key(struct wiphy *wip
  13714. -
  13715. - static s32
  13716. - brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,
  13717. -- u8 key_idx, bool pairwise, const u8 *mac_addr,
  13718. -- struct key_params *params)
  13719. -+ u8 key_idx, bool pairwise, const u8 *mac_addr,
  13720. -+ struct key_params *params)
  13721. - {
  13722. - struct brcmf_if *ifp = netdev_priv(ndev);
  13723. - struct brcmf_wsec_key *key;
  13724. -@@ -2214,9 +2272,10 @@ done:
  13725. - }
  13726. -
  13727. - static s32
  13728. --brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev,
  13729. -- u8 key_idx, bool pairwise, const u8 *mac_addr, void *cookie,
  13730. -- void (*callback) (void *cookie, struct key_params * params))
  13731. -+brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev, u8 key_idx,
  13732. -+ bool pairwise, const u8 *mac_addr, void *cookie,
  13733. -+ void (*callback)(void *cookie,
  13734. -+ struct key_params *params))
  13735. - {
  13736. - struct key_params params;
  13737. - struct brcmf_if *ifp = netdev_priv(ndev);
  13738. -@@ -2268,8 +2327,15 @@ done:
  13739. -
  13740. - static s32
  13741. - brcmf_cfg80211_config_default_mgmt_key(struct wiphy *wiphy,
  13742. -- struct net_device *ndev, u8 key_idx)
  13743. -+ struct net_device *ndev, u8 key_idx)
  13744. - {
  13745. -+ struct brcmf_if *ifp = netdev_priv(ndev);
  13746. -+
  13747. -+ brcmf_dbg(TRACE, "Enter key_idx %d\n", key_idx);
  13748. -+
  13749. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MFP))
  13750. -+ return 0;
  13751. -+
  13752. - brcmf_dbg(INFO, "Not supported\n");
  13753. -
  13754. - return -EOPNOTSUPP;
  13755. -@@ -3769,7 +3835,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
  13756. - u32 auth = 0; /* d11 open authentication */
  13757. - u16 count;
  13758. - s32 err = 0;
  13759. -- s32 len = 0;
  13760. -+ s32 len;
  13761. - u32 i;
  13762. - u32 wsec;
  13763. - u32 pval = 0;
  13764. -@@ -3779,6 +3845,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
  13765. - u8 *data;
  13766. - u16 rsn_cap;
  13767. - u32 wme_bss_disable;
  13768. -+ u32 mfp;
  13769. -
  13770. - brcmf_dbg(TRACE, "Enter\n");
  13771. - if (wpa_ie == NULL)
  13772. -@@ -3893,19 +3960,53 @@ brcmf_configure_wpaie(struct brcmf_if *i
  13773. - is_rsn_ie ? (wpa_auth |= WPA2_AUTH_PSK) :
  13774. - (wpa_auth |= WPA_AUTH_PSK);
  13775. - break;
  13776. -+ case RSN_AKM_SHA256_PSK:
  13777. -+ brcmf_dbg(TRACE, "RSN_AKM_MFP_PSK\n");
  13778. -+ wpa_auth |= WPA2_AUTH_PSK_SHA256;
  13779. -+ break;
  13780. -+ case RSN_AKM_SHA256_1X:
  13781. -+ brcmf_dbg(TRACE, "RSN_AKM_MFP_1X\n");
  13782. -+ wpa_auth |= WPA2_AUTH_1X_SHA256;
  13783. -+ break;
  13784. - default:
  13785. - brcmf_err("Ivalid key mgmt info\n");
  13786. - }
  13787. - offset++;
  13788. - }
  13789. -
  13790. -+ mfp = BRCMF_MFP_NONE;
  13791. - if (is_rsn_ie) {
  13792. - wme_bss_disable = 1;
  13793. - if ((offset + RSN_CAP_LEN) <= len) {
  13794. - rsn_cap = data[offset] + (data[offset + 1] << 8);
  13795. - if (rsn_cap & RSN_CAP_PTK_REPLAY_CNTR_MASK)
  13796. - wme_bss_disable = 0;
  13797. -+ if (rsn_cap & RSN_CAP_MFPR_MASK) {
  13798. -+ brcmf_dbg(TRACE, "MFP Required\n");
  13799. -+ mfp = BRCMF_MFP_REQUIRED;
  13800. -+ /* Firmware only supports mfp required in
  13801. -+ * combination with WPA2_AUTH_PSK_SHA256 or
  13802. -+ * WPA2_AUTH_1X_SHA256.
  13803. -+ */
  13804. -+ if (!(wpa_auth & (WPA2_AUTH_PSK_SHA256 |
  13805. -+ WPA2_AUTH_1X_SHA256))) {
  13806. -+ err = -EINVAL;
  13807. -+ goto exit;
  13808. -+ }
  13809. -+ /* Firmware has requirement that WPA2_AUTH_PSK/
  13810. -+ * WPA2_AUTH_UNSPECIFIED be set, if SHA256 OUI
  13811. -+ * is to be included in the rsn ie.
  13812. -+ */
  13813. -+ if (wpa_auth & WPA2_AUTH_PSK_SHA256)
  13814. -+ wpa_auth |= WPA2_AUTH_PSK;
  13815. -+ else if (wpa_auth & WPA2_AUTH_1X_SHA256)
  13816. -+ wpa_auth |= WPA2_AUTH_UNSPECIFIED;
  13817. -+ } else if (rsn_cap & RSN_CAP_MFPC_MASK) {
  13818. -+ brcmf_dbg(TRACE, "MFP Capable\n");
  13819. -+ mfp = BRCMF_MFP_CAPABLE;
  13820. -+ }
  13821. - }
  13822. -+ offset += RSN_CAP_LEN;
  13823. - /* set wme_bss_disable to sync RSN Capabilities */
  13824. - err = brcmf_fil_bsscfg_int_set(ifp, "wme_bss_disable",
  13825. - wme_bss_disable);
  13826. -@@ -3913,6 +4014,21 @@ brcmf_configure_wpaie(struct brcmf_if *i
  13827. - brcmf_err("wme_bss_disable error %d\n", err);
  13828. - goto exit;
  13829. - }
  13830. -+
  13831. -+ /* Skip PMKID cnt as it is know to be 0 for AP. */
  13832. -+ offset += RSN_PMKID_COUNT_LEN;
  13833. -+
  13834. -+ /* See if there is BIP wpa suite left for MFP */
  13835. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MFP) &&
  13836. -+ ((offset + WPA_IE_MIN_OUI_LEN) <= len)) {
  13837. -+ err = brcmf_fil_bsscfg_data_set(ifp, "bip",
  13838. -+ &data[offset],
  13839. -+ WPA_IE_MIN_OUI_LEN);
  13840. -+ if (err < 0) {
  13841. -+ brcmf_err("bip error %d\n", err);
  13842. -+ goto exit;
  13843. -+ }
  13844. -+ }
  13845. - }
  13846. - /* FOR WPS , set SES_OW_ENABLED */
  13847. - wsec = (pval | gval | SES_OW_ENABLED);
  13848. -@@ -3929,6 +4045,16 @@ brcmf_configure_wpaie(struct brcmf_if *i
  13849. - brcmf_err("wsec error %d\n", err);
  13850. - goto exit;
  13851. - }
  13852. -+ /* Configure MFP, this needs to go after wsec otherwise the wsec command
  13853. -+ * will overwrite the values set by MFP
  13854. -+ */
  13855. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MFP)) {
  13856. -+ err = brcmf_fil_bsscfg_int_set(ifp, "mfp", mfp);
  13857. -+ if (err < 0) {
  13858. -+ brcmf_err("mfp error %d\n", err);
  13859. -+ goto exit;
  13860. -+ }
  13861. -+ }
  13862. - /* set upper-layer auth */
  13863. - err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", wpa_auth);
  13864. - if (err < 0) {
  13865. -@@ -6149,8 +6275,10 @@ static int brcmf_setup_wiphy(struct wiph
  13866. - wiphy->n_addresses = i;
  13867. -
  13868. - wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
  13869. -- wiphy->cipher_suites = __wl_cipher_suites;
  13870. -- wiphy->n_cipher_suites = ARRAY_SIZE(__wl_cipher_suites);
  13871. -+ wiphy->cipher_suites = brcmf_cipher_suites;
  13872. -+ wiphy->n_cipher_suites = ARRAY_SIZE(brcmf_cipher_suites);
  13873. -+ if (!brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MFP))
  13874. -+ wiphy->n_cipher_suites--;
  13875. - wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT |
  13876. - WIPHY_FLAG_OFFCHAN_TX |
  13877. - WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
  13878. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  13879. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  13880. -@@ -72,7 +72,7 @@
  13881. -
  13882. - #define BRCMF_VNDR_IE_P2PAF_SHIFT 12
  13883. -
  13884. --#define BRCMF_MAX_DEFAULT_KEYS 4
  13885. -+#define BRCMF_MAX_DEFAULT_KEYS 6
  13886. -
  13887. - /* beacon loss timeout defaults */
  13888. - #define BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_ON 2
  13889. -@@ -107,7 +107,6 @@ struct brcmf_cfg80211_security {
  13890. - u32 auth_type;
  13891. - u32 cipher_pairwise;
  13892. - u32 cipher_group;
  13893. -- u32 wpa_auth;
  13894. - };
  13895. -
  13896. - /**
  13897. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
  13898. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
  13899. -@@ -161,6 +161,7 @@ void brcmf_feat_attach(struct brcmf_pub
  13900. - ifp->drvr->feat_flags &= ~BIT(BRCMF_FEAT_MBSS);
  13901. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_RSDB, "rsdb_mode");
  13902. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_TDLS, "tdls_enable");
  13903. -+ brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_MFP, "mfp");
  13904. -
  13905. - pfn_mac.version = BRCMF_PFN_MACADDR_CFG_VER;
  13906. - err = brcmf_fil_iovar_data_get(ifp, "pfn_macaddr", &pfn_mac,
  13907. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h
  13908. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h
  13909. -@@ -30,6 +30,7 @@
  13910. - * WOWL_ND: WOWL net detect (PNO)
  13911. - * WOWL_GTK: (WOWL) GTK rekeying offload
  13912. - * WOWL_ARP_ND: ARP and Neighbor Discovery offload support during WOWL.
  13913. -+ * MFP: 802.11w Management Frame Protection.
  13914. - */
  13915. - #define BRCMF_FEAT_LIST \
  13916. - BRCMF_FEAT_DEF(MBSS) \
  13917. -@@ -42,7 +43,8 @@
  13918. - BRCMF_FEAT_DEF(SCAN_RANDOM_MAC) \
  13919. - BRCMF_FEAT_DEF(WOWL_ND) \
  13920. - BRCMF_FEAT_DEF(WOWL_GTK) \
  13921. -- BRCMF_FEAT_DEF(WOWL_ARP_ND)
  13922. -+ BRCMF_FEAT_DEF(WOWL_ARP_ND) \
  13923. -+ BRCMF_FEAT_DEF(MFP)
  13924. -
  13925. - /*
  13926. - * Quirks:
  13927. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h
  13928. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h
  13929. -@@ -142,6 +142,10 @@
  13930. - #define BRCMF_RSN_KEK_LENGTH 16
  13931. - #define BRCMF_RSN_REPLAY_LEN 8
  13932. -
  13933. -+#define BRCMF_MFP_NONE 0
  13934. -+#define BRCMF_MFP_CAPABLE 1
  13935. -+#define BRCMF_MFP_REQUIRED 2
  13936. -+
  13937. - /* join preference types for join_pref iovar */
  13938. - enum brcmf_join_pref_types {
  13939. - BRCMF_JOIN_PREF_RSSI = 1,
  13940. ---- a/drivers/net/wireless/broadcom/brcm80211/include/brcmu_wifi.h
  13941. -+++ b/drivers/net/wireless/broadcom/brcm80211/include/brcmu_wifi.h
  13942. -@@ -236,6 +236,8 @@ static inline bool ac_bitmap_tst(u8 bitm
  13943. - #define WPA2_AUTH_RESERVED3 0x0200
  13944. - #define WPA2_AUTH_RESERVED4 0x0400
  13945. - #define WPA2_AUTH_RESERVED5 0x0800
  13946. -+#define WPA2_AUTH_1X_SHA256 0x1000 /* 1X with SHA256 key derivation */
  13947. -+#define WPA2_AUTH_PSK_SHA256 0x8000 /* PSK with SHA256 key derivation */
  13948. -
  13949. - #define DOT11_DEFAULT_RTS_LEN 2347
  13950. - #define DOT11_DEFAULT_FRAG_LEN 2346
  13951. 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
  13952. deleted file mode 100644
  13953. index 39f438321e833984ef54d3f653f95c01ed041c47..0000000000000000000000000000000000000000
  13954. --- a/package/kernel/mac80211/patches/345-brcmfmac-Remove-waitqueue_active-check.patch
  13955. +++ /dev/null
  13956. @@ -1,54 +0,0 @@
  13957. -From: Hui Wang <hui.wang@canonical.com>
  13958. -Date: Wed, 9 Mar 2016 15:25:26 +0800
  13959. -Subject: [PATCH] brcmfmac: Remove waitqueue_active check
  13960. -
  13961. -We met a problem of pm_suspend when repeated closing/opening the lid
  13962. -on a Lenovo laptop (1/20 reproduce rate), below is the log:
  13963. -
  13964. -[ 199.735876] PM: Entering mem sleep
  13965. -[ 199.750516] e1000e: EEE TX LPI TIMER: 00000011
  13966. -[ 199.856638] Trying to free nonexistent resource <000000000000d000-000000000000d0ff>
  13967. -[ 201.753566] brcmfmac: brcmf_pcie_suspend: Timeout on response for entering D3 substate
  13968. -[ 201.753581] pci_legacy_suspend(): brcmf_pcie_suspend+0x0/0x1f0 [brcmfmac] returns -5
  13969. -[ 201.753585] dpm_run_callback(): pci_pm_suspend+0x0/0x160 returns -5
  13970. -[ 201.753589] PM: Device 0000:04:00.0 failed to suspend async: error -5
  13971. -
  13972. -Through debugging, we found when problem happens, it is not the device
  13973. -fails to enter D3, but the signal D3_ACK comes too early to pass the
  13974. -waitqueue_active() check.
  13975. -
  13976. -Just like this:
  13977. -brcmf_pcie_send_mb_data(devinfo, BRCMF_H2D_HOST_D3_INFORM);
  13978. -// signal is triggered here
  13979. -wait_event_timeout(devinfo->mbdata_resp_wait, devinfo->mbdata_completed,
  13980. - BRCMF_PCIE_MBDATA_TIMEOUT);
  13981. -
  13982. -So far I think it is safe to remove waitqueue_active check since there
  13983. -is only one place to trigger this signal (sending
  13984. -BRCMF_H2D_HOST_D3_INFORM). And it is not a problem calling wake_up
  13985. -event earlier than calling wait_event.
  13986. -
  13987. -Cc: Brett Rudley <brudley@broadcom.com>
  13988. -Cc: Hante Meuleman <meuleman@broadcom.com>
  13989. -Cc: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  13990. -Cc: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  13991. -Cc: Arend van Spriel <arend@broadcom.com>
  13992. -Signed-off-by: Hui Wang <hui.wang@canonical.com>
  13993. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13994. ----
  13995. -
  13996. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  13997. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  13998. -@@ -677,10 +677,8 @@ static void brcmf_pcie_handle_mb_data(st
  13999. - brcmf_dbg(PCIE, "D2H_MB_DATA: DEEP SLEEP EXIT\n");
  14000. - if (dtoh_mb_data & BRCMF_D2H_DEV_D3_ACK) {
  14001. - brcmf_dbg(PCIE, "D2H_MB_DATA: D3 ACK\n");
  14002. -- if (waitqueue_active(&devinfo->mbdata_resp_wait)) {
  14003. -- devinfo->mbdata_completed = true;
  14004. -- wake_up(&devinfo->mbdata_resp_wait);
  14005. -- }
  14006. -+ devinfo->mbdata_completed = true;
  14007. -+ wake_up(&devinfo->mbdata_resp_wait);
  14008. - }
  14009. - }
  14010. -
  14011. diff --git a/package/kernel/mac80211/patches/346-brcmfmac-uninitialized-ret-variable.patch b/package/kernel/mac80211/patches/346-brcmfmac-uninitialized-ret-variable.patch
  14012. deleted file mode 100644
  14013. index 3c9ed425da0cb5140149f2c220d029e792ff41b7..0000000000000000000000000000000000000000
  14014. --- a/package/kernel/mac80211/patches/346-brcmfmac-uninitialized-ret-variable.patch
  14015. +++ /dev/null
  14016. @@ -1,21 +0,0 @@
  14017. -From: Dan Carpenter <dan.carpenter@oracle.com>
  14018. -Date: Tue, 15 Mar 2016 10:06:10 +0300
  14019. -Subject: [PATCH] brcmfmac: uninitialized "ret" variable
  14020. -
  14021. -There is an error path where "ret" isn't initialized.
  14022. -
  14023. -Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
  14024. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14025. ----
  14026. -
  14027. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  14028. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  14029. -@@ -250,7 +250,7 @@ static int brcmf_sdiod_request_data(stru
  14030. - u32 addr, u8 regsz, void *data, bool write)
  14031. - {
  14032. - struct sdio_func *func;
  14033. -- int ret;
  14034. -+ int ret = -EINVAL;
  14035. -
  14036. - brcmf_dbg(SDIO, "rw=%d, func=%d, addr=0x%05x, nbytes=%d\n",
  14037. - write, fn, addr, regsz);
  14038. 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
  14039. deleted file mode 100644
  14040. index d1deb6ee5ce73cb1a6ecc9775360c422113cd0b4..0000000000000000000000000000000000000000
  14041. --- a/package/kernel/mac80211/patches/347-brcmfmac-sdio-remove-unused-variable-retry_limit.patch
  14042. +++ /dev/null
  14043. @@ -1,24 +0,0 @@
  14044. -From: Colin Ian King <colin.king@canonical.com>
  14045. -Date: Sun, 20 Mar 2016 17:34:52 +0000
  14046. -Subject: [PATCH] brcmfmac: sdio: remove unused variable retry_limit
  14047. -
  14048. -retry_limit has never been used during the life of this driver, so
  14049. -we may as well remove it as it is redundant.
  14050. -
  14051. -Signed-off-by: Colin Ian King <colin.king@canonical.com>
  14052. -Reviewed-by: Julian Calaby <julian.calaby@gmail.com>
  14053. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14054. ----
  14055. -
  14056. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  14057. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  14058. -@@ -535,9 +535,6 @@ static int qcount[NUMPRIO];
  14059. -
  14060. - #define RETRYCHAN(chan) ((chan) == SDPCM_EVENT_CHANNEL)
  14061. -
  14062. --/* Retry count for register access failures */
  14063. --static const uint retry_limit = 2;
  14064. --
  14065. - /* Limit on rounding up frames */
  14066. - static const uint max_roundup = 512;
  14067. -
  14068. 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
  14069. deleted file mode 100644
  14070. index d399b264ea9d2ac0d1ba82d725707720b4c0693e..0000000000000000000000000000000000000000
  14071. --- a/package/kernel/mac80211/patches/348-brcmfmac-Delete-unnecessary-variable-initialisation.patch
  14072. +++ /dev/null
  14073. @@ -1,26 +0,0 @@
  14074. -From: Markus Elfring <elfring@users.sourceforge.net>
  14075. -Date: Fri, 18 Mar 2016 13:23:24 +1100
  14076. -Subject: [PATCH] brcmfmac: Delete unnecessary variable initialisation
  14077. -
  14078. -In brcmf_sdio_download_firmware(), bcmerror is set by the call to
  14079. -brcmf_sdio_download_code_file(), before it's checked in the following
  14080. -line.
  14081. -
  14082. -Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
  14083. -Acked-by: Arend van Spriel <arend@broadcom.com>
  14084. -[Rewrote commit message]
  14085. -Signed-off-by: Julian Calaby <julian.calaby@gmail.com>
  14086. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14087. ----
  14088. -
  14089. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  14090. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  14091. -@@ -3258,7 +3258,7 @@ static int brcmf_sdio_download_firmware(
  14092. - const struct firmware *fw,
  14093. - void *nvram, u32 nvlen)
  14094. - {
  14095. -- int bcmerror = -EFAULT;
  14096. -+ int bcmerror;
  14097. - u32 rstvec;
  14098. -
  14099. - sdio_claim_host(bus->sdiodev->func[1]);
  14100. 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
  14101. deleted file mode 100644
  14102. index 0acb4faaf1acb27dd39d11bef81be070c556dcf0..0000000000000000000000000000000000000000
  14103. --- a/package/kernel/mac80211/patches/349-0001-brcmfmac-clear-eventmask-array-before-using-it.patch
  14104. +++ /dev/null
  14105. @@ -1,27 +0,0 @@
  14106. -From: Hante Meuleman <hante.meuleman@broadcom.com>
  14107. -Date: Mon, 11 Apr 2016 11:35:21 +0200
  14108. -Subject: [PATCH] brcmfmac: clear eventmask array before using it
  14109. -
  14110. -When the event_msgs iovar is set an array is used to configure the
  14111. -enabled events. This arrays needs to nulled before configuring
  14112. -otherwise unhandled events will be enabled. This solves a problem
  14113. -where in case of wowl the host got woken by an incorrectly enabled
  14114. -event.
  14115. -
  14116. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  14117. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  14118. -Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
  14119. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14120. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14121. ----
  14122. -
  14123. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  14124. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  14125. -@@ -371,6 +371,7 @@ int brcmf_fweh_activate_events(struct br
  14126. - int i, err;
  14127. - s8 eventmask[BRCMF_EVENTING_MASK_LEN];
  14128. -
  14129. -+ memset(eventmask, 0, sizeof(eventmask));
  14130. - for (i = 0; i < BRCMF_E_LAST; i++) {
  14131. - if (ifp->drvr->fweh.evt_handler[i]) {
  14132. - brcmf_dbg(EVENT, "enable event %s\n",
  14133. 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
  14134. deleted file mode 100644
  14135. index 8d3067890c2fe87f88547d151d3da6d7facd8ea0..0000000000000000000000000000000000000000
  14136. --- a/package/kernel/mac80211/patches/349-0002-brcmfmac-fix-clearing-wowl-wake-indicators.patch
  14137. +++ /dev/null
  14138. @@ -1,27 +0,0 @@
  14139. -From: Hante Meuleman <hante.meuleman@broadcom.com>
  14140. -Date: Mon, 11 Apr 2016 11:35:22 +0200
  14141. -Subject: [PATCH] brcmfmac: fix clearing wowl wake indicators
  14142. -
  14143. -Newer firmwares require the usage of the wowl wakeind struct as size
  14144. -for the iovar to clear the wake indicators. Older firmwares do not
  14145. -care, so change the used size.
  14146. -
  14147. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  14148. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  14149. -Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
  14150. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14151. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14152. ----
  14153. -
  14154. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  14155. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  14156. -@@ -3608,7 +3608,8 @@ static void brcmf_configure_wowl(struct
  14157. - if (!test_bit(BRCMF_VIF_STATUS_CONNECTED, &ifp->vif->sme_state))
  14158. - wowl_config |= BRCMF_WOWL_UNASSOC;
  14159. -
  14160. -- brcmf_fil_iovar_data_set(ifp, "wowl_wakeind", "clear", strlen("clear"));
  14161. -+ brcmf_fil_iovar_data_set(ifp, "wowl_wakeind", "clear",
  14162. -+ sizeof(struct brcmf_wowl_wakeind_le));
  14163. - brcmf_fil_iovar_int_set(ifp, "wowl", wowl_config);
  14164. - brcmf_fil_iovar_int_set(ifp, "wowl_activate", 1);
  14165. - brcmf_bus_wowl_config(cfg->pub->bus_if, true);
  14166. 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
  14167. deleted file mode 100644
  14168. index f293401ca82d37e367600acf2676b18f6fad92ba..0000000000000000000000000000000000000000
  14169. --- a/package/kernel/mac80211/patches/349-0003-brcmfmac-insert-default-boardrev-in-nvram-data-if-mi.patch
  14170. +++ /dev/null
  14171. @@ -1,114 +0,0 @@
  14172. -From: Hante Meuleman <hante.meuleman@broadcom.com>
  14173. -Date: Mon, 11 Apr 2016 11:35:23 +0200
  14174. -Subject: [PATCH] brcmfmac: insert default boardrev in nvram data if
  14175. - missing
  14176. -
  14177. -Some nvram files/stores come without the boardrev information,
  14178. -but firmware requires this to be set. When not found in nvram then
  14179. -add a default boardrev string to the nvram data.
  14180. -
  14181. -Reported-by: Rafal Milecki <zajec5@gmail.com>
  14182. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  14183. -Reviewed-by: Franky (Zhenhui) Lin <franky.lin@broadcom.com>
  14184. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  14185. -Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
  14186. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14187. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14188. ----
  14189. -
  14190. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  14191. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  14192. -@@ -29,6 +29,7 @@
  14193. - #define BRCMF_FW_MAX_NVRAM_SIZE 64000
  14194. - #define BRCMF_FW_NVRAM_DEVPATH_LEN 19 /* devpath0=pcie/1/4/ */
  14195. - #define BRCMF_FW_NVRAM_PCIEDEV_LEN 10 /* pcie/1/4/ + \0 */
  14196. -+#define BRCMF_FW_DEFAULT_BOARDREV "boardrev=0xff"
  14197. -
  14198. - enum nvram_parser_state {
  14199. - IDLE,
  14200. -@@ -51,6 +52,7 @@ enum nvram_parser_state {
  14201. - * @entry: start position of key,value entry.
  14202. - * @multi_dev_v1: detect pcie multi device v1 (compressed).
  14203. - * @multi_dev_v2: detect pcie multi device v2.
  14204. -+ * @boardrev_found: nvram contains boardrev information.
  14205. - */
  14206. - struct nvram_parser {
  14207. - enum nvram_parser_state state;
  14208. -@@ -63,6 +65,7 @@ struct nvram_parser {
  14209. - u32 entry;
  14210. - bool multi_dev_v1;
  14211. - bool multi_dev_v2;
  14212. -+ bool boardrev_found;
  14213. - };
  14214. -
  14215. - /**
  14216. -@@ -125,6 +128,8 @@ static enum nvram_parser_state brcmf_nvr
  14217. - nvp->multi_dev_v1 = true;
  14218. - if (strncmp(&nvp->data[nvp->entry], "pcie/", 5) == 0)
  14219. - nvp->multi_dev_v2 = true;
  14220. -+ if (strncmp(&nvp->data[nvp->entry], "boardrev", 8) == 0)
  14221. -+ nvp->boardrev_found = true;
  14222. - } else if (!is_nvram_char(c) || c == ' ') {
  14223. - brcmf_dbg(INFO, "warning: ln=%d:col=%d: '=' expected, skip invalid key entry\n",
  14224. - nvp->line, nvp->column);
  14225. -@@ -284,6 +289,8 @@ static void brcmf_fw_strip_multi_v1(stru
  14226. - while (i < nvp->nvram_len) {
  14227. - if ((nvp->nvram[i] - '0' == id) && (nvp->nvram[i + 1] == ':')) {
  14228. - i += 2;
  14229. -+ if (strncmp(&nvp->nvram[i], "boardrev", 8) == 0)
  14230. -+ nvp->boardrev_found = true;
  14231. - while (nvp->nvram[i] != 0) {
  14232. - nvram[j] = nvp->nvram[i];
  14233. - i++;
  14234. -@@ -335,6 +342,8 @@ static void brcmf_fw_strip_multi_v2(stru
  14235. - while (i < nvp->nvram_len - len) {
  14236. - if (strncmp(&nvp->nvram[i], prefix, len) == 0) {
  14237. - i += len;
  14238. -+ if (strncmp(&nvp->nvram[i], "boardrev", 8) == 0)
  14239. -+ nvp->boardrev_found = true;
  14240. - while (nvp->nvram[i] != 0) {
  14241. - nvram[j] = nvp->nvram[i];
  14242. - i++;
  14243. -@@ -356,6 +365,18 @@ fail:
  14244. - nvp->nvram_len = 0;
  14245. - }
  14246. -
  14247. -+static void brcmf_fw_add_defaults(struct nvram_parser *nvp)
  14248. -+{
  14249. -+ if (nvp->boardrev_found)
  14250. -+ return;
  14251. -+
  14252. -+ memcpy(&nvp->nvram[nvp->nvram_len], &BRCMF_FW_DEFAULT_BOARDREV,
  14253. -+ strlen(BRCMF_FW_DEFAULT_BOARDREV));
  14254. -+ nvp->nvram_len += strlen(BRCMF_FW_DEFAULT_BOARDREV);
  14255. -+ nvp->nvram[nvp->nvram_len] = '\0';
  14256. -+ nvp->nvram_len++;
  14257. -+}
  14258. -+
  14259. - /* brcmf_nvram_strip :Takes a buffer of "<var>=<value>\n" lines read from a fil
  14260. - * and ending in a NUL. Removes carriage returns, empty lines, comment lines,
  14261. - * and converts newlines to NULs. Shortens buffer as needed and pads with NULs.
  14262. -@@ -377,16 +398,21 @@ static void *brcmf_fw_nvram_strip(const
  14263. - if (nvp.state == END)
  14264. - break;
  14265. - }
  14266. -- if (nvp.multi_dev_v1)
  14267. -+ if (nvp.multi_dev_v1) {
  14268. -+ nvp.boardrev_found = false;
  14269. - brcmf_fw_strip_multi_v1(&nvp, domain_nr, bus_nr);
  14270. -- else if (nvp.multi_dev_v2)
  14271. -+ } else if (nvp.multi_dev_v2) {
  14272. -+ nvp.boardrev_found = false;
  14273. - brcmf_fw_strip_multi_v2(&nvp, domain_nr, bus_nr);
  14274. -+ }
  14275. -
  14276. - if (nvp.nvram_len == 0) {
  14277. - kfree(nvp.nvram);
  14278. - return NULL;
  14279. - }
  14280. -
  14281. -+ brcmf_fw_add_defaults(&nvp);
  14282. -+
  14283. - pad = nvp.nvram_len;
  14284. - *new_length = roundup(nvp.nvram_len + 1, 4);
  14285. - while (pad != *new_length) {
  14286. 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
  14287. deleted file mode 100644
  14288. index ed0c83f9bbc9a2ce4741cfbe5a5cd7fde6938c7b..0000000000000000000000000000000000000000
  14289. --- a/package/kernel/mac80211/patches/349-0004-brcmfmac-fix-p2p-scan-abort-null-pointer-exception.patch
  14290. +++ /dev/null
  14291. @@ -1,29 +0,0 @@
  14292. -From: Hante Meuleman <hante.meuleman@broadcom.com>
  14293. -Date: Mon, 11 Apr 2016 11:35:24 +0200
  14294. -Subject: [PATCH] brcmfmac: fix p2p scan abort null pointer exception
  14295. -
  14296. -When p2p connection setup is performed without having ever done an
  14297. -escan a null pointer exception can occur. This is because the ifp
  14298. -to abort scanning is taken from escan struct while it was never
  14299. -initialized. Fix this by using the primary ifp for scan abort. The
  14300. -abort should still be performed and all scan related commands are
  14301. -performed on primary ifp.
  14302. -
  14303. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  14304. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  14305. -Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
  14306. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14307. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14308. ----
  14309. -
  14310. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  14311. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  14312. -@@ -1266,7 +1266,7 @@ static void
  14313. - brcmf_p2p_stop_wait_next_action_frame(struct brcmf_cfg80211_info *cfg)
  14314. - {
  14315. - struct brcmf_p2p_info *p2p = &cfg->p2p;
  14316. -- struct brcmf_if *ifp = cfg->escan_info.ifp;
  14317. -+ struct brcmf_if *ifp = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif->ifp;
  14318. -
  14319. - if (test_bit(BRCMF_P2P_STATUS_SENDING_ACT_FRAME, &p2p->status) &&
  14320. - (test_bit(BRCMF_P2P_STATUS_ACTION_TX_COMPLETED, &p2p->status) ||
  14321. 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
  14322. deleted file mode 100644
  14323. index 4d26404f51951086da093df1073a2bfd09d14349..0000000000000000000000000000000000000000
  14324. --- a/package/kernel/mac80211/patches/349-0005-brcmfmac-screening-firmware-event-packet.patch
  14325. +++ /dev/null
  14326. @@ -1,297 +0,0 @@
  14327. -From: Franky Lin <franky.lin@broadcom.com>
  14328. -Date: Mon, 11 Apr 2016 11:35:25 +0200
  14329. -Subject: [PATCH] brcmfmac: screening firmware event packet
  14330. -
  14331. -Firmware uses asynchronized events as a communication method to the
  14332. -host. The event packets are marked as ETH_P_LINK_CTL protocol type. For
  14333. -SDIO and PCIe bus, this kind of packets are delivered through virtual
  14334. -event channel not data channel. This patch adds a screening logic to
  14335. -make sure the event handler only processes the events coming from the
  14336. -correct channel.
  14337. -
  14338. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  14339. -Signed-off-by: Franky Lin <franky.lin@broadcom.com>
  14340. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14341. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14342. ----
  14343. -
  14344. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
  14345. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
  14346. -@@ -216,7 +216,9 @@ bool brcmf_c_prec_enq(struct device *dev
  14347. - int prec);
  14348. -
  14349. - /* Receive frame for delivery to OS. Callee disposes of rxp. */
  14350. --void brcmf_rx_frame(struct device *dev, struct sk_buff *rxp);
  14351. -+void brcmf_rx_frame(struct device *dev, struct sk_buff *rxp, bool handle_evnt);
  14352. -+/* Receive async event packet from firmware. Callee disposes of rxp. */
  14353. -+void brcmf_rx_event(struct device *dev, struct sk_buff *rxp);
  14354. -
  14355. - /* Indication from bus module regarding presence/insertion of dongle. */
  14356. - int brcmf_attach(struct device *dev, struct brcmf_mp_device *settings);
  14357. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  14358. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  14359. -@@ -311,16 +311,17 @@ void brcmf_txflowblock(struct device *de
  14360. - brcmf_fws_bus_blocked(drvr, state);
  14361. - }
  14362. -
  14363. --void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb)
  14364. -+void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb,
  14365. -+ bool handle_event)
  14366. - {
  14367. -- skb->dev = ifp->ndev;
  14368. -- skb->protocol = eth_type_trans(skb, skb->dev);
  14369. -+ skb->protocol = eth_type_trans(skb, ifp->ndev);
  14370. -
  14371. - if (skb->pkt_type == PACKET_MULTICAST)
  14372. - ifp->stats.multicast++;
  14373. -
  14374. - /* Process special event packets */
  14375. -- brcmf_fweh_process_skb(ifp->drvr, skb);
  14376. -+ if (handle_event)
  14377. -+ brcmf_fweh_process_skb(ifp->drvr, skb);
  14378. -
  14379. - if (!(ifp->ndev->flags & IFF_UP)) {
  14380. - brcmu_pkt_buf_free_skb(skb);
  14381. -@@ -381,7 +382,7 @@ static void brcmf_rxreorder_process_info
  14382. - /* validate flags and flow id */
  14383. - if (flags == 0xFF) {
  14384. - brcmf_err("invalid flags...so ignore this packet\n");
  14385. -- brcmf_netif_rx(ifp, pkt);
  14386. -+ brcmf_netif_rx(ifp, pkt, false);
  14387. - return;
  14388. - }
  14389. -
  14390. -@@ -393,7 +394,7 @@ static void brcmf_rxreorder_process_info
  14391. - if (rfi == NULL) {
  14392. - brcmf_dbg(INFO, "received flags to cleanup, but no flow (%d) yet\n",
  14393. - flow_id);
  14394. -- brcmf_netif_rx(ifp, pkt);
  14395. -+ brcmf_netif_rx(ifp, pkt, false);
  14396. - return;
  14397. - }
  14398. -
  14399. -@@ -418,7 +419,7 @@ static void brcmf_rxreorder_process_info
  14400. - rfi = kzalloc(buf_size, GFP_ATOMIC);
  14401. - if (rfi == NULL) {
  14402. - brcmf_err("failed to alloc buffer\n");
  14403. -- brcmf_netif_rx(ifp, pkt);
  14404. -+ brcmf_netif_rx(ifp, pkt, false);
  14405. - return;
  14406. - }
  14407. -
  14408. -@@ -532,11 +533,11 @@ static void brcmf_rxreorder_process_info
  14409. - netif_rx:
  14410. - skb_queue_walk_safe(&reorder_list, pkt, pnext) {
  14411. - __skb_unlink(pkt, &reorder_list);
  14412. -- brcmf_netif_rx(ifp, pkt);
  14413. -+ brcmf_netif_rx(ifp, pkt, false);
  14414. - }
  14415. - }
  14416. -
  14417. --void brcmf_rx_frame(struct device *dev, struct sk_buff *skb)
  14418. -+void brcmf_rx_frame(struct device *dev, struct sk_buff *skb, bool handle_evnt)
  14419. - {
  14420. - struct brcmf_if *ifp;
  14421. - struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  14422. -@@ -560,7 +561,32 @@ void brcmf_rx_frame(struct device *dev,
  14423. - if (rd->reorder)
  14424. - brcmf_rxreorder_process_info(ifp, rd->reorder, skb);
  14425. - else
  14426. -- brcmf_netif_rx(ifp, skb);
  14427. -+ brcmf_netif_rx(ifp, skb, handle_evnt);
  14428. -+}
  14429. -+
  14430. -+void brcmf_rx_event(struct device *dev, struct sk_buff *skb)
  14431. -+{
  14432. -+ struct brcmf_if *ifp;
  14433. -+ struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  14434. -+ struct brcmf_pub *drvr = bus_if->drvr;
  14435. -+ int ret;
  14436. -+
  14437. -+ brcmf_dbg(EVENT, "Enter: %s: rxp=%p\n", dev_name(dev), skb);
  14438. -+
  14439. -+ /* process and remove protocol-specific header */
  14440. -+ ret = brcmf_proto_hdrpull(drvr, true, skb, &ifp);
  14441. -+
  14442. -+ if (ret || !ifp || !ifp->ndev) {
  14443. -+ if (ret != -ENODATA && ifp)
  14444. -+ ifp->stats.rx_errors++;
  14445. -+ brcmu_pkt_buf_free_skb(skb);
  14446. -+ return;
  14447. -+ }
  14448. -+
  14449. -+ skb->protocol = eth_type_trans(skb, ifp->ndev);
  14450. -+
  14451. -+ brcmf_fweh_process_skb(ifp->drvr, skb);
  14452. -+ brcmu_pkt_buf_free_skb(skb);
  14453. - }
  14454. -
  14455. - void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success)
  14456. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  14457. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  14458. -@@ -225,7 +225,8 @@ int brcmf_get_next_free_bsscfgidx(struct
  14459. - void brcmf_txflowblock_if(struct brcmf_if *ifp,
  14460. - enum brcmf_netif_stop_reason reason, bool state);
  14461. - void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
  14462. --void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb);
  14463. -+void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb,
  14464. -+ bool handle_event);
  14465. - void brcmf_net_setcarrier(struct brcmf_if *ifp, bool on);
  14466. - int __init brcmf_core_init(void);
  14467. - void __exit brcmf_core_exit(void);
  14468. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  14469. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  14470. -@@ -20,6 +20,7 @@
  14471. -
  14472. - #include <linux/types.h>
  14473. - #include <linux/netdevice.h>
  14474. -+#include <linux/etherdevice.h>
  14475. -
  14476. - #include <brcmu_utils.h>
  14477. - #include <brcmu_wifi.h>
  14478. -@@ -1075,28 +1076,13 @@ static void brcmf_msgbuf_rxbuf_event_pos
  14479. - }
  14480. -
  14481. -
  14482. --static void
  14483. --brcmf_msgbuf_rx_skb(struct brcmf_msgbuf *msgbuf, struct sk_buff *skb,
  14484. -- u8 ifidx)
  14485. --{
  14486. -- struct brcmf_if *ifp;
  14487. --
  14488. -- ifp = brcmf_get_ifp(msgbuf->drvr, ifidx);
  14489. -- if (!ifp || !ifp->ndev) {
  14490. -- brcmf_err("Received pkt for invalid ifidx %d\n", ifidx);
  14491. -- brcmu_pkt_buf_free_skb(skb);
  14492. -- return;
  14493. -- }
  14494. -- brcmf_netif_rx(ifp, skb);
  14495. --}
  14496. --
  14497. --
  14498. - static void brcmf_msgbuf_process_event(struct brcmf_msgbuf *msgbuf, void *buf)
  14499. - {
  14500. - struct msgbuf_rx_event *event;
  14501. - u32 idx;
  14502. - u16 buflen;
  14503. - struct sk_buff *skb;
  14504. -+ struct brcmf_if *ifp;
  14505. -
  14506. - event = (struct msgbuf_rx_event *)buf;
  14507. - idx = le32_to_cpu(event->msg.request_id);
  14508. -@@ -1116,7 +1102,19 @@ static void brcmf_msgbuf_process_event(s
  14509. -
  14510. - skb_trim(skb, buflen);
  14511. -
  14512. -- brcmf_msgbuf_rx_skb(msgbuf, skb, event->msg.ifidx);
  14513. -+ ifp = brcmf_get_ifp(msgbuf->drvr, event->msg.ifidx);
  14514. -+ if (!ifp || !ifp->ndev) {
  14515. -+ brcmf_err("Received pkt for invalid ifidx %d\n",
  14516. -+ event->msg.ifidx);
  14517. -+ goto exit;
  14518. -+ }
  14519. -+
  14520. -+ skb->protocol = eth_type_trans(skb, ifp->ndev);
  14521. -+
  14522. -+ brcmf_fweh_process_skb(ifp->drvr, skb);
  14523. -+
  14524. -+exit:
  14525. -+ brcmu_pkt_buf_free_skb(skb);
  14526. - }
  14527. -
  14528. -
  14529. -@@ -1128,6 +1126,7 @@ brcmf_msgbuf_process_rx_complete(struct
  14530. - u16 data_offset;
  14531. - u16 buflen;
  14532. - u32 idx;
  14533. -+ struct brcmf_if *ifp;
  14534. -
  14535. - brcmf_msgbuf_update_rxbufpost_count(msgbuf, 1);
  14536. -
  14537. -@@ -1148,7 +1147,14 @@ brcmf_msgbuf_process_rx_complete(struct
  14538. -
  14539. - skb_trim(skb, buflen);
  14540. -
  14541. -- brcmf_msgbuf_rx_skb(msgbuf, skb, rx_complete->msg.ifidx);
  14542. -+ ifp = brcmf_get_ifp(msgbuf->drvr, rx_complete->msg.ifidx);
  14543. -+ if (!ifp || !ifp->ndev) {
  14544. -+ brcmf_err("Received pkt for invalid ifidx %d\n",
  14545. -+ rx_complete->msg.ifidx);
  14546. -+ brcmu_pkt_buf_free_skb(skb);
  14547. -+ return;
  14548. -+ }
  14549. -+ brcmf_netif_rx(ifp, skb, false);
  14550. - }
  14551. -
  14552. -
  14553. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  14554. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  14555. -@@ -1294,6 +1294,17 @@ static inline u8 brcmf_sdio_getdatoffset
  14556. - return (u8)((hdrvalue & SDPCM_DOFFSET_MASK) >> SDPCM_DOFFSET_SHIFT);
  14557. - }
  14558. -
  14559. -+static inline bool brcmf_sdio_fromevntchan(u8 *swheader)
  14560. -+{
  14561. -+ u32 hdrvalue;
  14562. -+ u8 ret;
  14563. -+
  14564. -+ hdrvalue = *(u32 *)swheader;
  14565. -+ ret = (u8)((hdrvalue & SDPCM_CHANNEL_MASK) >> SDPCM_CHANNEL_SHIFT);
  14566. -+
  14567. -+ return (ret == SDPCM_EVENT_CHANNEL);
  14568. -+}
  14569. -+
  14570. - static int brcmf_sdio_hdparse(struct brcmf_sdio *bus, u8 *header,
  14571. - struct brcmf_sdio_hdrinfo *rd,
  14572. - enum brcmf_sdio_frmtype type)
  14573. -@@ -1641,7 +1652,11 @@ static u8 brcmf_sdio_rxglom(struct brcmf
  14574. - pfirst->len, pfirst->next,
  14575. - pfirst->prev);
  14576. - skb_unlink(pfirst, &bus->glom);
  14577. -- brcmf_rx_frame(bus->sdiodev->dev, pfirst);
  14578. -+ if (brcmf_sdio_fromevntchan(pfirst->data))
  14579. -+ brcmf_rx_event(bus->sdiodev->dev, pfirst);
  14580. -+ else
  14581. -+ brcmf_rx_frame(bus->sdiodev->dev, pfirst,
  14582. -+ false);
  14583. - bus->sdcnt.rxglompkts++;
  14584. - }
  14585. -
  14586. -@@ -1967,18 +1982,19 @@ static uint brcmf_sdio_readframes(struct
  14587. - __skb_trim(pkt, rd->len);
  14588. - skb_pull(pkt, rd->dat_offset);
  14589. -
  14590. -+ if (pkt->len == 0)
  14591. -+ brcmu_pkt_buf_free_skb(pkt);
  14592. -+ else if (rd->channel == SDPCM_EVENT_CHANNEL)
  14593. -+ brcmf_rx_event(bus->sdiodev->dev, pkt);
  14594. -+ else
  14595. -+ brcmf_rx_frame(bus->sdiodev->dev, pkt,
  14596. -+ false);
  14597. -+
  14598. - /* prepare the descriptor for the next read */
  14599. - rd->len = rd->len_nxtfrm << 4;
  14600. - rd->len_nxtfrm = 0;
  14601. - /* treat all packet as event if we don't know */
  14602. - rd->channel = SDPCM_EVENT_CHANNEL;
  14603. --
  14604. -- if (pkt->len == 0) {
  14605. -- brcmu_pkt_buf_free_skb(pkt);
  14606. -- continue;
  14607. -- }
  14608. --
  14609. -- brcmf_rx_frame(bus->sdiodev->dev, pkt);
  14610. - }
  14611. -
  14612. - rxcount = maxframes - rxleft;
  14613. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
  14614. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
  14615. -@@ -514,7 +514,7 @@ static void brcmf_usb_rx_complete(struct
  14616. -
  14617. - if (devinfo->bus_pub.state == BRCMFMAC_USB_STATE_UP) {
  14618. - skb_put(skb, urb->actual_length);
  14619. -- brcmf_rx_frame(devinfo->dev, skb);
  14620. -+ brcmf_rx_frame(devinfo->dev, skb, true);
  14621. - brcmf_usb_rx_refill(devinfo, req);
  14622. - } else {
  14623. - brcmu_pkt_buf_free_skb(skb);
  14624. 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
  14625. deleted file mode 100644
  14626. index 33b263df3aefc1b00e99860b4b9450a6ff23ad83..0000000000000000000000000000000000000000
  14627. --- a/package/kernel/mac80211/patches/349-0006-brcmfmac-cleanup-ampdu-rx-host-reorder-code.patch
  14628. +++ /dev/null
  14629. @@ -1,585 +0,0 @@
  14630. -From: Arend van Spriel <arend@broadcom.com>
  14631. -Date: Mon, 11 Apr 2016 11:35:26 +0200
  14632. -Subject: [PATCH] brcmfmac: cleanup ampdu-rx host reorder code
  14633. -
  14634. -The code for ampdu-rx host reorder is related to the firmware signalling
  14635. -supported in BCDC protocol. This change moves the code to fwsignal module.
  14636. -
  14637. -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  14638. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  14639. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  14640. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14641. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14642. ----
  14643. -
  14644. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
  14645. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
  14646. -@@ -351,6 +351,12 @@ brcmf_proto_bcdc_add_tdls_peer(struct br
  14647. - {
  14648. - }
  14649. -
  14650. -+static void brcmf_proto_bcdc_rxreorder(struct brcmf_if *ifp,
  14651. -+ struct sk_buff *skb)
  14652. -+{
  14653. -+ brcmf_fws_rxreorder(ifp, skb);
  14654. -+}
  14655. -+
  14656. - int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr)
  14657. - {
  14658. - struct brcmf_bcdc *bcdc;
  14659. -@@ -372,6 +378,7 @@ int brcmf_proto_bcdc_attach(struct brcmf
  14660. - drvr->proto->configure_addr_mode = brcmf_proto_bcdc_configure_addr_mode;
  14661. - drvr->proto->delete_peer = brcmf_proto_bcdc_delete_peer;
  14662. - drvr->proto->add_tdls_peer = brcmf_proto_bcdc_add_tdls_peer;
  14663. -+ drvr->proto->rxreorder = brcmf_proto_bcdc_rxreorder;
  14664. - drvr->proto->pd = bcdc;
  14665. -
  14666. - drvr->hdrlen += BCDC_HEADER_LEN + BRCMF_PROT_FW_SIGNAL_MAX_TXBYTES;
  14667. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  14668. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  14669. -@@ -40,19 +40,6 @@
  14670. -
  14671. - #define MAX_WAIT_FOR_8021X_TX msecs_to_jiffies(950)
  14672. -
  14673. --/* AMPDU rx reordering definitions */
  14674. --#define BRCMF_RXREORDER_FLOWID_OFFSET 0
  14675. --#define BRCMF_RXREORDER_MAXIDX_OFFSET 2
  14676. --#define BRCMF_RXREORDER_FLAGS_OFFSET 4
  14677. --#define BRCMF_RXREORDER_CURIDX_OFFSET 6
  14678. --#define BRCMF_RXREORDER_EXPIDX_OFFSET 8
  14679. --
  14680. --#define BRCMF_RXREORDER_DEL_FLOW 0x01
  14681. --#define BRCMF_RXREORDER_FLUSH_ALL 0x02
  14682. --#define BRCMF_RXREORDER_CURIDX_VALID 0x04
  14683. --#define BRCMF_RXREORDER_EXPIDX_VALID 0x08
  14684. --#define BRCMF_RXREORDER_NEW_HOLE 0x10
  14685. --
  14686. - #define BRCMF_BSSIDX_INVALID -1
  14687. -
  14688. - char *brcmf_ifname(struct brcmf_if *ifp)
  14689. -@@ -342,207 +329,11 @@ void brcmf_netif_rx(struct brcmf_if *ifp
  14690. - netif_rx_ni(skb);
  14691. - }
  14692. -
  14693. --static void brcmf_rxreorder_get_skb_list(struct brcmf_ampdu_rx_reorder *rfi,
  14694. -- u8 start, u8 end,
  14695. -- struct sk_buff_head *skb_list)
  14696. --{
  14697. -- /* initialize return list */
  14698. -- __skb_queue_head_init(skb_list);
  14699. --
  14700. -- if (rfi->pend_pkts == 0) {
  14701. -- brcmf_dbg(INFO, "no packets in reorder queue\n");
  14702. -- return;
  14703. -- }
  14704. --
  14705. -- do {
  14706. -- if (rfi->pktslots[start]) {
  14707. -- __skb_queue_tail(skb_list, rfi->pktslots[start]);
  14708. -- rfi->pktslots[start] = NULL;
  14709. -- }
  14710. -- start++;
  14711. -- if (start > rfi->max_idx)
  14712. -- start = 0;
  14713. -- } while (start != end);
  14714. -- rfi->pend_pkts -= skb_queue_len(skb_list);
  14715. --}
  14716. --
  14717. --static void brcmf_rxreorder_process_info(struct brcmf_if *ifp, u8 *reorder_data,
  14718. -- struct sk_buff *pkt)
  14719. --{
  14720. -- u8 flow_id, max_idx, cur_idx, exp_idx, end_idx;
  14721. -- struct brcmf_ampdu_rx_reorder *rfi;
  14722. -- struct sk_buff_head reorder_list;
  14723. -- struct sk_buff *pnext;
  14724. -- u8 flags;
  14725. -- u32 buf_size;
  14726. --
  14727. -- flow_id = reorder_data[BRCMF_RXREORDER_FLOWID_OFFSET];
  14728. -- flags = reorder_data[BRCMF_RXREORDER_FLAGS_OFFSET];
  14729. --
  14730. -- /* validate flags and flow id */
  14731. -- if (flags == 0xFF) {
  14732. -- brcmf_err("invalid flags...so ignore this packet\n");
  14733. -- brcmf_netif_rx(ifp, pkt, false);
  14734. -- return;
  14735. -- }
  14736. --
  14737. -- rfi = ifp->drvr->reorder_flows[flow_id];
  14738. -- if (flags & BRCMF_RXREORDER_DEL_FLOW) {
  14739. -- brcmf_dbg(INFO, "flow-%d: delete\n",
  14740. -- flow_id);
  14741. --
  14742. -- if (rfi == NULL) {
  14743. -- brcmf_dbg(INFO, "received flags to cleanup, but no flow (%d) yet\n",
  14744. -- flow_id);
  14745. -- brcmf_netif_rx(ifp, pkt, false);
  14746. -- return;
  14747. -- }
  14748. --
  14749. -- brcmf_rxreorder_get_skb_list(rfi, rfi->exp_idx, rfi->exp_idx,
  14750. -- &reorder_list);
  14751. -- /* add the last packet */
  14752. -- __skb_queue_tail(&reorder_list, pkt);
  14753. -- kfree(rfi);
  14754. -- ifp->drvr->reorder_flows[flow_id] = NULL;
  14755. -- goto netif_rx;
  14756. -- }
  14757. -- /* from here on we need a flow reorder instance */
  14758. -- if (rfi == NULL) {
  14759. -- buf_size = sizeof(*rfi);
  14760. -- max_idx = reorder_data[BRCMF_RXREORDER_MAXIDX_OFFSET];
  14761. --
  14762. -- buf_size += (max_idx + 1) * sizeof(pkt);
  14763. --
  14764. -- /* allocate space for flow reorder info */
  14765. -- brcmf_dbg(INFO, "flow-%d: start, maxidx %d\n",
  14766. -- flow_id, max_idx);
  14767. -- rfi = kzalloc(buf_size, GFP_ATOMIC);
  14768. -- if (rfi == NULL) {
  14769. -- brcmf_err("failed to alloc buffer\n");
  14770. -- brcmf_netif_rx(ifp, pkt, false);
  14771. -- return;
  14772. -- }
  14773. --
  14774. -- ifp->drvr->reorder_flows[flow_id] = rfi;
  14775. -- rfi->pktslots = (struct sk_buff **)(rfi+1);
  14776. -- rfi->max_idx = max_idx;
  14777. -- }
  14778. -- if (flags & BRCMF_RXREORDER_NEW_HOLE) {
  14779. -- if (rfi->pend_pkts) {
  14780. -- brcmf_rxreorder_get_skb_list(rfi, rfi->exp_idx,
  14781. -- rfi->exp_idx,
  14782. -- &reorder_list);
  14783. -- WARN_ON(rfi->pend_pkts);
  14784. -- } else {
  14785. -- __skb_queue_head_init(&reorder_list);
  14786. -- }
  14787. -- rfi->cur_idx = reorder_data[BRCMF_RXREORDER_CURIDX_OFFSET];
  14788. -- rfi->exp_idx = reorder_data[BRCMF_RXREORDER_EXPIDX_OFFSET];
  14789. -- rfi->max_idx = reorder_data[BRCMF_RXREORDER_MAXIDX_OFFSET];
  14790. -- rfi->pktslots[rfi->cur_idx] = pkt;
  14791. -- rfi->pend_pkts++;
  14792. -- brcmf_dbg(DATA, "flow-%d: new hole %d (%d), pending %d\n",
  14793. -- flow_id, rfi->cur_idx, rfi->exp_idx, rfi->pend_pkts);
  14794. -- } else if (flags & BRCMF_RXREORDER_CURIDX_VALID) {
  14795. -- cur_idx = reorder_data[BRCMF_RXREORDER_CURIDX_OFFSET];
  14796. -- exp_idx = reorder_data[BRCMF_RXREORDER_EXPIDX_OFFSET];
  14797. --
  14798. -- if ((exp_idx == rfi->exp_idx) && (cur_idx != rfi->exp_idx)) {
  14799. -- /* still in the current hole */
  14800. -- /* enqueue the current on the buffer chain */
  14801. -- if (rfi->pktslots[cur_idx] != NULL) {
  14802. -- brcmf_dbg(INFO, "HOLE: ERROR buffer pending..free it\n");
  14803. -- brcmu_pkt_buf_free_skb(rfi->pktslots[cur_idx]);
  14804. -- rfi->pktslots[cur_idx] = NULL;
  14805. -- }
  14806. -- rfi->pktslots[cur_idx] = pkt;
  14807. -- rfi->pend_pkts++;
  14808. -- rfi->cur_idx = cur_idx;
  14809. -- brcmf_dbg(DATA, "flow-%d: store pkt %d (%d), pending %d\n",
  14810. -- flow_id, cur_idx, exp_idx, rfi->pend_pkts);
  14811. --
  14812. -- /* can return now as there is no reorder
  14813. -- * list to process.
  14814. -- */
  14815. -- return;
  14816. -- }
  14817. -- if (rfi->exp_idx == cur_idx) {
  14818. -- if (rfi->pktslots[cur_idx] != NULL) {
  14819. -- brcmf_dbg(INFO, "error buffer pending..free it\n");
  14820. -- brcmu_pkt_buf_free_skb(rfi->pktslots[cur_idx]);
  14821. -- rfi->pktslots[cur_idx] = NULL;
  14822. -- }
  14823. -- rfi->pktslots[cur_idx] = pkt;
  14824. -- rfi->pend_pkts++;
  14825. --
  14826. -- /* got the expected one. flush from current to expected
  14827. -- * and update expected
  14828. -- */
  14829. -- brcmf_dbg(DATA, "flow-%d: expected %d (%d), pending %d\n",
  14830. -- flow_id, cur_idx, exp_idx, rfi->pend_pkts);
  14831. --
  14832. -- rfi->cur_idx = cur_idx;
  14833. -- rfi->exp_idx = exp_idx;
  14834. --
  14835. -- brcmf_rxreorder_get_skb_list(rfi, cur_idx, exp_idx,
  14836. -- &reorder_list);
  14837. -- brcmf_dbg(DATA, "flow-%d: freeing buffers %d, pending %d\n",
  14838. -- flow_id, skb_queue_len(&reorder_list),
  14839. -- rfi->pend_pkts);
  14840. -- } else {
  14841. -- u8 end_idx;
  14842. --
  14843. -- brcmf_dbg(DATA, "flow-%d (0x%x): both moved, old %d/%d, new %d/%d\n",
  14844. -- flow_id, flags, rfi->cur_idx, rfi->exp_idx,
  14845. -- cur_idx, exp_idx);
  14846. -- if (flags & BRCMF_RXREORDER_FLUSH_ALL)
  14847. -- end_idx = rfi->exp_idx;
  14848. -- else
  14849. -- end_idx = exp_idx;
  14850. --
  14851. -- /* flush pkts first */
  14852. -- brcmf_rxreorder_get_skb_list(rfi, rfi->exp_idx, end_idx,
  14853. -- &reorder_list);
  14854. --
  14855. -- if (exp_idx == ((cur_idx + 1) % (rfi->max_idx + 1))) {
  14856. -- __skb_queue_tail(&reorder_list, pkt);
  14857. -- } else {
  14858. -- rfi->pktslots[cur_idx] = pkt;
  14859. -- rfi->pend_pkts++;
  14860. -- }
  14861. -- rfi->exp_idx = exp_idx;
  14862. -- rfi->cur_idx = cur_idx;
  14863. -- }
  14864. -- } else {
  14865. -- /* explicity window move updating the expected index */
  14866. -- exp_idx = reorder_data[BRCMF_RXREORDER_EXPIDX_OFFSET];
  14867. --
  14868. -- brcmf_dbg(DATA, "flow-%d (0x%x): change expected: %d -> %d\n",
  14869. -- flow_id, flags, rfi->exp_idx, exp_idx);
  14870. -- if (flags & BRCMF_RXREORDER_FLUSH_ALL)
  14871. -- end_idx = rfi->exp_idx;
  14872. -- else
  14873. -- end_idx = exp_idx;
  14874. --
  14875. -- brcmf_rxreorder_get_skb_list(rfi, rfi->exp_idx, end_idx,
  14876. -- &reorder_list);
  14877. -- __skb_queue_tail(&reorder_list, pkt);
  14878. -- /* set the new expected idx */
  14879. -- rfi->exp_idx = exp_idx;
  14880. -- }
  14881. --netif_rx:
  14882. -- skb_queue_walk_safe(&reorder_list, pkt, pnext) {
  14883. -- __skb_unlink(pkt, &reorder_list);
  14884. -- brcmf_netif_rx(ifp, pkt, false);
  14885. -- }
  14886. --}
  14887. --
  14888. - void brcmf_rx_frame(struct device *dev, struct sk_buff *skb, bool handle_evnt)
  14889. - {
  14890. - struct brcmf_if *ifp;
  14891. - struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  14892. - struct brcmf_pub *drvr = bus_if->drvr;
  14893. -- struct brcmf_skb_reorder_data *rd;
  14894. - int ret;
  14895. -
  14896. - brcmf_dbg(DATA, "Enter: %s: rxp=%p\n", dev_name(dev), skb);
  14897. -@@ -557,9 +348,8 @@ void brcmf_rx_frame(struct device *dev,
  14898. - return;
  14899. - }
  14900. -
  14901. -- rd = (struct brcmf_skb_reorder_data *)skb->cb;
  14902. -- if (rd->reorder)
  14903. -- brcmf_rxreorder_process_info(ifp, rd->reorder, skb);
  14904. -+ if (brcmf_proto_is_reorder_skb(skb))
  14905. -+ brcmf_proto_rxreorder(ifp, skb);
  14906. - else
  14907. - brcmf_netif_rx(ifp, skb, handle_evnt);
  14908. - }
  14909. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  14910. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  14911. -@@ -208,10 +208,6 @@ struct brcmf_if {
  14912. - u8 ipv6addr_idx;
  14913. - };
  14914. -
  14915. --struct brcmf_skb_reorder_data {
  14916. -- u8 *reorder;
  14917. --};
  14918. --
  14919. - int brcmf_netdev_wait_pend8021x(struct brcmf_if *ifp);
  14920. -
  14921. - /* Return pointer to interface name */
  14922. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
  14923. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
  14924. -@@ -92,6 +92,19 @@ enum brcmf_fws_tlv_len {
  14925. - };
  14926. - #undef BRCMF_FWS_TLV_DEF
  14927. -
  14928. -+/* AMPDU rx reordering definitions */
  14929. -+#define BRCMF_RXREORDER_FLOWID_OFFSET 0
  14930. -+#define BRCMF_RXREORDER_MAXIDX_OFFSET 2
  14931. -+#define BRCMF_RXREORDER_FLAGS_OFFSET 4
  14932. -+#define BRCMF_RXREORDER_CURIDX_OFFSET 6
  14933. -+#define BRCMF_RXREORDER_EXPIDX_OFFSET 8
  14934. -+
  14935. -+#define BRCMF_RXREORDER_DEL_FLOW 0x01
  14936. -+#define BRCMF_RXREORDER_FLUSH_ALL 0x02
  14937. -+#define BRCMF_RXREORDER_CURIDX_VALID 0x04
  14938. -+#define BRCMF_RXREORDER_EXPIDX_VALID 0x08
  14939. -+#define BRCMF_RXREORDER_NEW_HOLE 0x10
  14940. -+
  14941. - #ifdef DEBUG
  14942. - /*
  14943. - * brcmf_fws_tlv_names - array of tlv names.
  14944. -@@ -1614,6 +1627,202 @@ static int brcmf_fws_notify_bcmc_credit_
  14945. - return 0;
  14946. - }
  14947. -
  14948. -+static void brcmf_rxreorder_get_skb_list(struct brcmf_ampdu_rx_reorder *rfi,
  14949. -+ u8 start, u8 end,
  14950. -+ struct sk_buff_head *skb_list)
  14951. -+{
  14952. -+ /* initialize return list */
  14953. -+ __skb_queue_head_init(skb_list);
  14954. -+
  14955. -+ if (rfi->pend_pkts == 0) {
  14956. -+ brcmf_dbg(INFO, "no packets in reorder queue\n");
  14957. -+ return;
  14958. -+ }
  14959. -+
  14960. -+ do {
  14961. -+ if (rfi->pktslots[start]) {
  14962. -+ __skb_queue_tail(skb_list, rfi->pktslots[start]);
  14963. -+ rfi->pktslots[start] = NULL;
  14964. -+ }
  14965. -+ start++;
  14966. -+ if (start > rfi->max_idx)
  14967. -+ start = 0;
  14968. -+ } while (start != end);
  14969. -+ rfi->pend_pkts -= skb_queue_len(skb_list);
  14970. -+}
  14971. -+
  14972. -+void brcmf_fws_rxreorder(struct brcmf_if *ifp, struct sk_buff *pkt)
  14973. -+{
  14974. -+ u8 *reorder_data;
  14975. -+ u8 flow_id, max_idx, cur_idx, exp_idx, end_idx;
  14976. -+ struct brcmf_ampdu_rx_reorder *rfi;
  14977. -+ struct sk_buff_head reorder_list;
  14978. -+ struct sk_buff *pnext;
  14979. -+ u8 flags;
  14980. -+ u32 buf_size;
  14981. -+
  14982. -+ reorder_data = ((struct brcmf_skb_reorder_data *)pkt->cb)->reorder;
  14983. -+ flow_id = reorder_data[BRCMF_RXREORDER_FLOWID_OFFSET];
  14984. -+ flags = reorder_data[BRCMF_RXREORDER_FLAGS_OFFSET];
  14985. -+
  14986. -+ /* validate flags and flow id */
  14987. -+ if (flags == 0xFF) {
  14988. -+ brcmf_err("invalid flags...so ignore this packet\n");
  14989. -+ brcmf_netif_rx(ifp, pkt, false);
  14990. -+ return;
  14991. -+ }
  14992. -+
  14993. -+ rfi = ifp->drvr->reorder_flows[flow_id];
  14994. -+ if (flags & BRCMF_RXREORDER_DEL_FLOW) {
  14995. -+ brcmf_dbg(INFO, "flow-%d: delete\n",
  14996. -+ flow_id);
  14997. -+
  14998. -+ if (rfi == NULL) {
  14999. -+ brcmf_dbg(INFO, "received flags to cleanup, but no flow (%d) yet\n",
  15000. -+ flow_id);
  15001. -+ brcmf_netif_rx(ifp, pkt, false);
  15002. -+ return;
  15003. -+ }
  15004. -+
  15005. -+ brcmf_rxreorder_get_skb_list(rfi, rfi->exp_idx, rfi->exp_idx,
  15006. -+ &reorder_list);
  15007. -+ /* add the last packet */
  15008. -+ __skb_queue_tail(&reorder_list, pkt);
  15009. -+ kfree(rfi);
  15010. -+ ifp->drvr->reorder_flows[flow_id] = NULL;
  15011. -+ goto netif_rx;
  15012. -+ }
  15013. -+ /* from here on we need a flow reorder instance */
  15014. -+ if (rfi == NULL) {
  15015. -+ buf_size = sizeof(*rfi);
  15016. -+ max_idx = reorder_data[BRCMF_RXREORDER_MAXIDX_OFFSET];
  15017. -+
  15018. -+ buf_size += (max_idx + 1) * sizeof(pkt);
  15019. -+
  15020. -+ /* allocate space for flow reorder info */
  15021. -+ brcmf_dbg(INFO, "flow-%d: start, maxidx %d\n",
  15022. -+ flow_id, max_idx);
  15023. -+ rfi = kzalloc(buf_size, GFP_ATOMIC);
  15024. -+ if (rfi == NULL) {
  15025. -+ brcmf_err("failed to alloc buffer\n");
  15026. -+ brcmf_netif_rx(ifp, pkt, false);
  15027. -+ return;
  15028. -+ }
  15029. -+
  15030. -+ ifp->drvr->reorder_flows[flow_id] = rfi;
  15031. -+ rfi->pktslots = (struct sk_buff **)(rfi + 1);
  15032. -+ rfi->max_idx = max_idx;
  15033. -+ }
  15034. -+ if (flags & BRCMF_RXREORDER_NEW_HOLE) {
  15035. -+ if (rfi->pend_pkts) {
  15036. -+ brcmf_rxreorder_get_skb_list(rfi, rfi->exp_idx,
  15037. -+ rfi->exp_idx,
  15038. -+ &reorder_list);
  15039. -+ WARN_ON(rfi->pend_pkts);
  15040. -+ } else {
  15041. -+ __skb_queue_head_init(&reorder_list);
  15042. -+ }
  15043. -+ rfi->cur_idx = reorder_data[BRCMF_RXREORDER_CURIDX_OFFSET];
  15044. -+ rfi->exp_idx = reorder_data[BRCMF_RXREORDER_EXPIDX_OFFSET];
  15045. -+ rfi->max_idx = reorder_data[BRCMF_RXREORDER_MAXIDX_OFFSET];
  15046. -+ rfi->pktslots[rfi->cur_idx] = pkt;
  15047. -+ rfi->pend_pkts++;
  15048. -+ brcmf_dbg(DATA, "flow-%d: new hole %d (%d), pending %d\n",
  15049. -+ flow_id, rfi->cur_idx, rfi->exp_idx, rfi->pend_pkts);
  15050. -+ } else if (flags & BRCMF_RXREORDER_CURIDX_VALID) {
  15051. -+ cur_idx = reorder_data[BRCMF_RXREORDER_CURIDX_OFFSET];
  15052. -+ exp_idx = reorder_data[BRCMF_RXREORDER_EXPIDX_OFFSET];
  15053. -+
  15054. -+ if ((exp_idx == rfi->exp_idx) && (cur_idx != rfi->exp_idx)) {
  15055. -+ /* still in the current hole */
  15056. -+ /* enqueue the current on the buffer chain */
  15057. -+ if (rfi->pktslots[cur_idx] != NULL) {
  15058. -+ brcmf_dbg(INFO, "HOLE: ERROR buffer pending..free it\n");
  15059. -+ brcmu_pkt_buf_free_skb(rfi->pktslots[cur_idx]);
  15060. -+ rfi->pktslots[cur_idx] = NULL;
  15061. -+ }
  15062. -+ rfi->pktslots[cur_idx] = pkt;
  15063. -+ rfi->pend_pkts++;
  15064. -+ rfi->cur_idx = cur_idx;
  15065. -+ brcmf_dbg(DATA, "flow-%d: store pkt %d (%d), pending %d\n",
  15066. -+ flow_id, cur_idx, exp_idx, rfi->pend_pkts);
  15067. -+
  15068. -+ /* can return now as there is no reorder
  15069. -+ * list to process.
  15070. -+ */
  15071. -+ return;
  15072. -+ }
  15073. -+ if (rfi->exp_idx == cur_idx) {
  15074. -+ if (rfi->pktslots[cur_idx] != NULL) {
  15075. -+ brcmf_dbg(INFO, "error buffer pending..free it\n");
  15076. -+ brcmu_pkt_buf_free_skb(rfi->pktslots[cur_idx]);
  15077. -+ rfi->pktslots[cur_idx] = NULL;
  15078. -+ }
  15079. -+ rfi->pktslots[cur_idx] = pkt;
  15080. -+ rfi->pend_pkts++;
  15081. -+
  15082. -+ /* got the expected one. flush from current to expected
  15083. -+ * and update expected
  15084. -+ */
  15085. -+ brcmf_dbg(DATA, "flow-%d: expected %d (%d), pending %d\n",
  15086. -+ flow_id, cur_idx, exp_idx, rfi->pend_pkts);
  15087. -+
  15088. -+ rfi->cur_idx = cur_idx;
  15089. -+ rfi->exp_idx = exp_idx;
  15090. -+
  15091. -+ brcmf_rxreorder_get_skb_list(rfi, cur_idx, exp_idx,
  15092. -+ &reorder_list);
  15093. -+ brcmf_dbg(DATA, "flow-%d: freeing buffers %d, pending %d\n",
  15094. -+ flow_id, skb_queue_len(&reorder_list),
  15095. -+ rfi->pend_pkts);
  15096. -+ } else {
  15097. -+ u8 end_idx;
  15098. -+
  15099. -+ brcmf_dbg(DATA, "flow-%d (0x%x): both moved, old %d/%d, new %d/%d\n",
  15100. -+ flow_id, flags, rfi->cur_idx, rfi->exp_idx,
  15101. -+ cur_idx, exp_idx);
  15102. -+ if (flags & BRCMF_RXREORDER_FLUSH_ALL)
  15103. -+ end_idx = rfi->exp_idx;
  15104. -+ else
  15105. -+ end_idx = exp_idx;
  15106. -+
  15107. -+ /* flush pkts first */
  15108. -+ brcmf_rxreorder_get_skb_list(rfi, rfi->exp_idx, end_idx,
  15109. -+ &reorder_list);
  15110. -+
  15111. -+ if (exp_idx == ((cur_idx + 1) % (rfi->max_idx + 1))) {
  15112. -+ __skb_queue_tail(&reorder_list, pkt);
  15113. -+ } else {
  15114. -+ rfi->pktslots[cur_idx] = pkt;
  15115. -+ rfi->pend_pkts++;
  15116. -+ }
  15117. -+ rfi->exp_idx = exp_idx;
  15118. -+ rfi->cur_idx = cur_idx;
  15119. -+ }
  15120. -+ } else {
  15121. -+ /* explicity window move updating the expected index */
  15122. -+ exp_idx = reorder_data[BRCMF_RXREORDER_EXPIDX_OFFSET];
  15123. -+
  15124. -+ brcmf_dbg(DATA, "flow-%d (0x%x): change expected: %d -> %d\n",
  15125. -+ flow_id, flags, rfi->exp_idx, exp_idx);
  15126. -+ if (flags & BRCMF_RXREORDER_FLUSH_ALL)
  15127. -+ end_idx = rfi->exp_idx;
  15128. -+ else
  15129. -+ end_idx = exp_idx;
  15130. -+
  15131. -+ brcmf_rxreorder_get_skb_list(rfi, rfi->exp_idx, end_idx,
  15132. -+ &reorder_list);
  15133. -+ __skb_queue_tail(&reorder_list, pkt);
  15134. -+ /* set the new expected idx */
  15135. -+ rfi->exp_idx = exp_idx;
  15136. -+ }
  15137. -+netif_rx:
  15138. -+ skb_queue_walk_safe(&reorder_list, pkt, pnext) {
  15139. -+ __skb_unlink(pkt, &reorder_list);
  15140. -+ brcmf_netif_rx(ifp, pkt, false);
  15141. -+ }
  15142. -+}
  15143. -+
  15144. - void brcmf_fws_hdrpull(struct brcmf_if *ifp, s16 siglen, struct sk_buff *skb)
  15145. - {
  15146. - struct brcmf_skb_reorder_data *rd;
  15147. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.h
  15148. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.h
  15149. -@@ -29,5 +29,6 @@ void brcmf_fws_add_interface(struct brcm
  15150. - void brcmf_fws_del_interface(struct brcmf_if *ifp);
  15151. - void brcmf_fws_bustxfail(struct brcmf_fws_info *fws, struct sk_buff *skb);
  15152. - void brcmf_fws_bus_blocked(struct brcmf_pub *drvr, bool flow_blocked);
  15153. -+void brcmf_fws_rxreorder(struct brcmf_if *ifp, struct sk_buff *skb);
  15154. -
  15155. - #endif /* FWSIGNAL_H_ */
  15156. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  15157. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  15158. -@@ -527,6 +527,9 @@ static int brcmf_msgbuf_hdrpull(struct b
  15159. - return -ENODEV;
  15160. - }
  15161. -
  15162. -+static void brcmf_msgbuf_rxreorder(struct brcmf_if *ifp, struct sk_buff *skb)
  15163. -+{
  15164. -+}
  15165. -
  15166. - static void
  15167. - brcmf_msgbuf_remove_flowring(struct brcmf_msgbuf *msgbuf, u16 flowid)
  15168. -@@ -1466,6 +1469,7 @@ int brcmf_proto_msgbuf_attach(struct brc
  15169. - drvr->proto->configure_addr_mode = brcmf_msgbuf_configure_addr_mode;
  15170. - drvr->proto->delete_peer = brcmf_msgbuf_delete_peer;
  15171. - drvr->proto->add_tdls_peer = brcmf_msgbuf_add_tdls_peer;
  15172. -+ drvr->proto->rxreorder = brcmf_msgbuf_rxreorder;
  15173. - drvr->proto->pd = msgbuf;
  15174. -
  15175. - init_waitqueue_head(&msgbuf->ioctl_resp_wait);
  15176. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h
  15177. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h
  15178. -@@ -22,6 +22,9 @@ enum proto_addr_mode {
  15179. - ADDR_DIRECT
  15180. - };
  15181. -
  15182. -+struct brcmf_skb_reorder_data {
  15183. -+ u8 *reorder;
  15184. -+};
  15185. -
  15186. - struct brcmf_proto {
  15187. - int (*hdrpull)(struct brcmf_pub *drvr, bool do_fws,
  15188. -@@ -38,6 +41,7 @@ struct brcmf_proto {
  15189. - u8 peer[ETH_ALEN]);
  15190. - void (*add_tdls_peer)(struct brcmf_pub *drvr, int ifidx,
  15191. - u8 peer[ETH_ALEN]);
  15192. -+ void (*rxreorder)(struct brcmf_if *ifp, struct sk_buff *skb);
  15193. - void *pd;
  15194. - };
  15195. -
  15196. -@@ -91,6 +95,18 @@ brcmf_proto_add_tdls_peer(struct brcmf_p
  15197. - {
  15198. - drvr->proto->add_tdls_peer(drvr, ifidx, peer);
  15199. - }
  15200. -+static inline bool brcmf_proto_is_reorder_skb(struct sk_buff *skb)
  15201. -+{
  15202. -+ struct brcmf_skb_reorder_data *rd;
  15203. -+
  15204. -+ rd = (struct brcmf_skb_reorder_data *)skb->cb;
  15205. -+ return !!rd->reorder;
  15206. -+}
  15207. -
  15208. -+static inline void
  15209. -+brcmf_proto_rxreorder(struct brcmf_if *ifp, struct sk_buff *skb)
  15210. -+{
  15211. -+ ifp->drvr->proto->rxreorder(ifp, skb);
  15212. -+}
  15213. -
  15214. - #endif /* BRCMFMAC_PROTO_H */
  15215. 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
  15216. deleted file mode 100644
  15217. index a43feffe1792c44e207908c21e314bfcf0378cf1..0000000000000000000000000000000000000000
  15218. --- a/package/kernel/mac80211/patches/349-0007-brcmfmac-revise-handling-events-in-receive-path.patch
  15219. +++ /dev/null
  15220. @@ -1,139 +0,0 @@
  15221. -From: Arend van Spriel <arend@broadcom.com>
  15222. -Date: Mon, 11 Apr 2016 11:35:27 +0200
  15223. -Subject: [PATCH] brcmfmac: revise handling events in receive path
  15224. -
  15225. -Move event handling out of brcmf_netif_rx() avoiding the need
  15226. -to pass a flag. This flag is only ever true for USB hosts as
  15227. -other interface use separate brcmf_rx_event() function.
  15228. -
  15229. -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  15230. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  15231. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  15232. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15233. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15234. ----
  15235. -
  15236. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
  15237. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
  15238. -@@ -216,7 +216,7 @@ bool brcmf_c_prec_enq(struct device *dev
  15239. - int prec);
  15240. -
  15241. - /* Receive frame for delivery to OS. Callee disposes of rxp. */
  15242. --void brcmf_rx_frame(struct device *dev, struct sk_buff *rxp, bool handle_evnt);
  15243. -+void brcmf_rx_frame(struct device *dev, struct sk_buff *rxp, bool handle_event);
  15244. - /* Receive async event packet from firmware. Callee disposes of rxp. */
  15245. - void brcmf_rx_event(struct device *dev, struct sk_buff *rxp);
  15246. -
  15247. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  15248. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  15249. -@@ -298,18 +298,11 @@ void brcmf_txflowblock(struct device *de
  15250. - brcmf_fws_bus_blocked(drvr, state);
  15251. - }
  15252. -
  15253. --void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb,
  15254. -- bool handle_event)
  15255. -+void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb)
  15256. - {
  15257. -- skb->protocol = eth_type_trans(skb, ifp->ndev);
  15258. --
  15259. - if (skb->pkt_type == PACKET_MULTICAST)
  15260. - ifp->stats.multicast++;
  15261. -
  15262. -- /* Process special event packets */
  15263. -- if (handle_event)
  15264. -- brcmf_fweh_process_skb(ifp->drvr, skb);
  15265. --
  15266. - if (!(ifp->ndev->flags & IFF_UP)) {
  15267. - brcmu_pkt_buf_free_skb(skb);
  15268. - return;
  15269. -@@ -329,7 +322,7 @@ void brcmf_netif_rx(struct brcmf_if *ifp
  15270. - netif_rx_ni(skb);
  15271. - }
  15272. -
  15273. --void brcmf_rx_frame(struct device *dev, struct sk_buff *skb, bool handle_evnt)
  15274. -+void brcmf_rx_frame(struct device *dev, struct sk_buff *skb, bool handle_event)
  15275. - {
  15276. - struct brcmf_if *ifp;
  15277. - struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  15278. -@@ -348,10 +341,17 @@ void brcmf_rx_frame(struct device *dev,
  15279. - return;
  15280. - }
  15281. -
  15282. -- if (brcmf_proto_is_reorder_skb(skb))
  15283. -+ skb->protocol = eth_type_trans(skb, ifp->ndev);
  15284. -+
  15285. -+ if (brcmf_proto_is_reorder_skb(skb)) {
  15286. - brcmf_proto_rxreorder(ifp, skb);
  15287. -- else
  15288. -- brcmf_netif_rx(ifp, skb, handle_evnt);
  15289. -+ } else {
  15290. -+ /* Process special event packets */
  15291. -+ if (handle_event)
  15292. -+ brcmf_fweh_process_skb(ifp->drvr, skb);
  15293. -+
  15294. -+ brcmf_netif_rx(ifp, skb);
  15295. -+ }
  15296. - }
  15297. -
  15298. - void brcmf_rx_event(struct device *dev, struct sk_buff *skb)
  15299. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  15300. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  15301. -@@ -221,8 +221,7 @@ int brcmf_get_next_free_bsscfgidx(struct
  15302. - void brcmf_txflowblock_if(struct brcmf_if *ifp,
  15303. - enum brcmf_netif_stop_reason reason, bool state);
  15304. - void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
  15305. --void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb,
  15306. -- bool handle_event);
  15307. -+void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb);
  15308. - void brcmf_net_setcarrier(struct brcmf_if *ifp, bool on);
  15309. - int __init brcmf_core_init(void);
  15310. - void __exit brcmf_core_exit(void);
  15311. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
  15312. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
  15313. -@@ -1668,7 +1668,7 @@ void brcmf_fws_rxreorder(struct brcmf_if
  15314. - /* validate flags and flow id */
  15315. - if (flags == 0xFF) {
  15316. - brcmf_err("invalid flags...so ignore this packet\n");
  15317. -- brcmf_netif_rx(ifp, pkt, false);
  15318. -+ brcmf_netif_rx(ifp, pkt);
  15319. - return;
  15320. - }
  15321. -
  15322. -@@ -1680,7 +1680,7 @@ void brcmf_fws_rxreorder(struct brcmf_if
  15323. - if (rfi == NULL) {
  15324. - brcmf_dbg(INFO, "received flags to cleanup, but no flow (%d) yet\n",
  15325. - flow_id);
  15326. -- brcmf_netif_rx(ifp, pkt, false);
  15327. -+ brcmf_netif_rx(ifp, pkt);
  15328. - return;
  15329. - }
  15330. -
  15331. -@@ -1705,7 +1705,7 @@ void brcmf_fws_rxreorder(struct brcmf_if
  15332. - rfi = kzalloc(buf_size, GFP_ATOMIC);
  15333. - if (rfi == NULL) {
  15334. - brcmf_err("failed to alloc buffer\n");
  15335. -- brcmf_netif_rx(ifp, pkt, false);
  15336. -+ brcmf_netif_rx(ifp, pkt);
  15337. - return;
  15338. - }
  15339. -
  15340. -@@ -1819,7 +1819,7 @@ void brcmf_fws_rxreorder(struct brcmf_if
  15341. - netif_rx:
  15342. - skb_queue_walk_safe(&reorder_list, pkt, pnext) {
  15343. - __skb_unlink(pkt, &reorder_list);
  15344. -- brcmf_netif_rx(ifp, pkt, false);
  15345. -+ brcmf_netif_rx(ifp, pkt);
  15346. - }
  15347. - }
  15348. -
  15349. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  15350. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  15351. -@@ -1157,7 +1157,7 @@ brcmf_msgbuf_process_rx_complete(struct
  15352. - brcmu_pkt_buf_free_skb(skb);
  15353. - return;
  15354. - }
  15355. -- brcmf_netif_rx(ifp, skb, false);
  15356. -+ brcmf_netif_rx(ifp, skb);
  15357. - }
  15358. -
  15359. -
  15360. 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
  15361. deleted file mode 100644
  15362. index 08ea235fddc7caf06eb4b196c51765cd4adbee2f..0000000000000000000000000000000000000000
  15363. --- a/package/kernel/mac80211/patches/349-0008-brcmfmac-create-common-function-for-handling-brcmf_p.patch
  15364. +++ /dev/null
  15365. @@ -1,88 +0,0 @@
  15366. -From: Arend van Spriel <arend@broadcom.com>
  15367. -Date: Mon, 11 Apr 2016 11:35:28 +0200
  15368. -Subject: [PATCH] brcmfmac: create common function for handling
  15369. - brcmf_proto_hdrpull()
  15370. -
  15371. -In receive path brcmf_proto_hdrpull() needs to be called and handled
  15372. -similar in brcmf_rx_frame() and brcmf_rx_event(). Move that duplicated
  15373. -code in separate function.
  15374. -
  15375. -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  15376. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  15377. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  15378. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15379. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15380. ----
  15381. -
  15382. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  15383. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  15384. -@@ -322,26 +322,35 @@ void brcmf_netif_rx(struct brcmf_if *ifp
  15385. - netif_rx_ni(skb);
  15386. - }
  15387. -
  15388. --void brcmf_rx_frame(struct device *dev, struct sk_buff *skb, bool handle_event)
  15389. -+static int brcmf_rx_hdrpull(struct brcmf_pub *drvr, struct sk_buff *skb,
  15390. -+ struct brcmf_if **ifp)
  15391. - {
  15392. -- struct brcmf_if *ifp;
  15393. -- struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  15394. -- struct brcmf_pub *drvr = bus_if->drvr;
  15395. - int ret;
  15396. -
  15397. -- brcmf_dbg(DATA, "Enter: %s: rxp=%p\n", dev_name(dev), skb);
  15398. --
  15399. - /* process and remove protocol-specific header */
  15400. -- ret = brcmf_proto_hdrpull(drvr, true, skb, &ifp);
  15401. -+ ret = brcmf_proto_hdrpull(drvr, true, skb, ifp);
  15402. -
  15403. -- if (ret || !ifp || !ifp->ndev) {
  15404. -+ if (ret || !(*ifp) || !(*ifp)->ndev) {
  15405. - if (ret != -ENODATA && ifp)
  15406. -- ifp->stats.rx_errors++;
  15407. -+ (*ifp)->stats.rx_errors++;
  15408. - brcmu_pkt_buf_free_skb(skb);
  15409. -- return;
  15410. -+ return -ENODATA;
  15411. - }
  15412. -
  15413. -- skb->protocol = eth_type_trans(skb, ifp->ndev);
  15414. -+ skb->protocol = eth_type_trans(skb, (*ifp)->ndev);
  15415. -+ return 0;
  15416. -+}
  15417. -+
  15418. -+void brcmf_rx_frame(struct device *dev, struct sk_buff *skb, bool handle_event)
  15419. -+{
  15420. -+ struct brcmf_if *ifp;
  15421. -+ struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  15422. -+ struct brcmf_pub *drvr = bus_if->drvr;
  15423. -+
  15424. -+ brcmf_dbg(DATA, "Enter: %s: rxp=%p\n", dev_name(dev), skb);
  15425. -+
  15426. -+ if (brcmf_rx_hdrpull(drvr, skb, &ifp))
  15427. -+ return;
  15428. -
  15429. - if (brcmf_proto_is_reorder_skb(skb)) {
  15430. - brcmf_proto_rxreorder(ifp, skb);
  15431. -@@ -359,21 +368,11 @@ void brcmf_rx_event(struct device *dev,
  15432. - struct brcmf_if *ifp;
  15433. - struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  15434. - struct brcmf_pub *drvr = bus_if->drvr;
  15435. -- int ret;
  15436. -
  15437. - brcmf_dbg(EVENT, "Enter: %s: rxp=%p\n", dev_name(dev), skb);
  15438. -
  15439. -- /* process and remove protocol-specific header */
  15440. -- ret = brcmf_proto_hdrpull(drvr, true, skb, &ifp);
  15441. --
  15442. -- if (ret || !ifp || !ifp->ndev) {
  15443. -- if (ret != -ENODATA && ifp)
  15444. -- ifp->stats.rx_errors++;
  15445. -- brcmu_pkt_buf_free_skb(skb);
  15446. -+ if (brcmf_rx_hdrpull(drvr, skb, &ifp))
  15447. - return;
  15448. -- }
  15449. --
  15450. -- skb->protocol = eth_type_trans(skb, ifp->ndev);
  15451. -
  15452. - brcmf_fweh_process_skb(ifp->drvr, skb);
  15453. - brcmu_pkt_buf_free_skb(skb);
  15454. 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
  15455. deleted file mode 100644
  15456. index c602f2272a4a322d9e5246c517eecfc3a00e1db2..0000000000000000000000000000000000000000
  15457. --- a/package/kernel/mac80211/patches/351-0005-brcmfmac-rework-function-picking-free-BSS-index.patch
  15458. +++ /dev/null
  15459. @@ -1,119 +0,0 @@
  15460. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  15461. -Date: Thu, 26 May 2016 01:44:27 +0200
  15462. -Subject: [PATCH] brcmfmac: rework function picking free BSS index
  15463. -MIME-Version: 1.0
  15464. -Content-Type: text/plain; charset=UTF-8
  15465. -Content-Transfer-Encoding: 8bit
  15466. -
  15467. -The old implementation was overcomplicated and slightly bugged in some
  15468. -corner cases.
  15469. -
  15470. -Consider following state of BSS-es (limited to 6 for simplification):
  15471. -drvr->iflist[0]: { bsscfgidx:0, ndev->name:wlan1, }
  15472. -drvr->iflist[1]: (null)
  15473. -drvr->iflist[2]: { bsscfgidx:2, ndev->name:wlan1-1, }
  15474. -drvr->iflist[3]: { bsscfgidx:3, ndev->name:wlan1-2, }
  15475. -drvr->iflist[4]: (null)
  15476. -drvr->iflist[5]: (null)
  15477. -In such case the next AP interface should bsscfgidx 4 (we don't use 1 as
  15478. -it's reserved for P2P).
  15479. -
  15480. -With old code the loop iterations were following:
  15481. -[ifidx = 0] [bsscfgidx = 2] [highest = 2]
  15482. -[ifidx = 1] [bsscfgidx = 2] [highest = 2] available = true
  15483. -[ifidx = 2] [bsscfgidx = 2] [highest = 2] bsscfgidx = highest + 1
  15484. -[ifidx = 3] [bsscfgidx = 3] [highest = 2] bsscfgidx = highest + 1
  15485. -[ifidx = 4] [bsscfgidx = 3] [highest = 2] available = true
  15486. -[ifidx = 5] [bsscfgidx = 3] [highest = 2] available = true
  15487. -There were 2 obvious problems:
  15488. -1) Having empty BSS at index 1 was resulting in available being always
  15489. - set to true, even if we would run out of BSS-es.
  15490. -2) Calculated bsscfgidx was invalid (3 instead of 4) resulting in driver
  15491. - not being able to create the 4th AP interface.
  15492. -
  15493. -New code is simpler, placed in file where it's really used, handles
  15494. -running out of free BSS-es and allows using 4 interfaces at the same
  15495. -time. It also looks for the first free BSS instead of one after the last
  15496. -in use. It works well with current driver (which doesn't allow deleting
  15497. -interfaces) and should be future proof (if we ever allow deleting).
  15498. -
  15499. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  15500. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15501. ----
  15502. -
  15503. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  15504. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  15505. -@@ -527,6 +527,21 @@ brcmf_cfg80211_update_proto_addr_mode(st
  15506. - ADDR_INDIRECT);
  15507. - }
  15508. -
  15509. -+static int brcmf_get_first_free_bsscfgidx(struct brcmf_pub *drvr)
  15510. -+{
  15511. -+ int bsscfgidx;
  15512. -+
  15513. -+ for (bsscfgidx = 0; bsscfgidx < BRCMF_MAX_IFS; bsscfgidx++) {
  15514. -+ /* bsscfgidx 1 is reserved for legacy P2P */
  15515. -+ if (bsscfgidx == 1)
  15516. -+ continue;
  15517. -+ if (!drvr->iflist[bsscfgidx])
  15518. -+ return bsscfgidx;
  15519. -+ }
  15520. -+
  15521. -+ return -ENOMEM;
  15522. -+}
  15523. -+
  15524. - static int brcmf_cfg80211_request_ap_if(struct brcmf_if *ifp)
  15525. - {
  15526. - struct brcmf_mbss_ssid_le mbss_ssid_le;
  15527. -@@ -534,7 +549,7 @@ static int brcmf_cfg80211_request_ap_if(
  15528. - int err;
  15529. -
  15530. - memset(&mbss_ssid_le, 0, sizeof(mbss_ssid_le));
  15531. -- bsscfgidx = brcmf_get_next_free_bsscfgidx(ifp->drvr);
  15532. -+ bsscfgidx = brcmf_get_first_free_bsscfgidx(ifp->drvr);
  15533. - if (bsscfgidx < 0)
  15534. - return bsscfgidx;
  15535. -
  15536. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  15537. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  15538. -@@ -753,30 +753,6 @@ void brcmf_remove_interface(struct brcmf
  15539. - brcmf_del_if(ifp->drvr, ifp->bsscfgidx);
  15540. - }
  15541. -
  15542. --int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr)
  15543. --{
  15544. -- int ifidx;
  15545. -- int bsscfgidx;
  15546. -- bool available;
  15547. -- int highest;
  15548. --
  15549. -- available = false;
  15550. -- bsscfgidx = 2;
  15551. -- highest = 2;
  15552. -- for (ifidx = 0; ifidx < BRCMF_MAX_IFS; ifidx++) {
  15553. -- if (drvr->iflist[ifidx]) {
  15554. -- if (drvr->iflist[ifidx]->bsscfgidx == bsscfgidx)
  15555. -- bsscfgidx = highest + 1;
  15556. -- else if (drvr->iflist[ifidx]->bsscfgidx > highest)
  15557. -- highest = drvr->iflist[ifidx]->bsscfgidx;
  15558. -- } else {
  15559. -- available = true;
  15560. -- }
  15561. -- }
  15562. --
  15563. -- return available ? bsscfgidx : -ENOMEM;
  15564. --}
  15565. --
  15566. - #ifdef CONFIG_INET
  15567. - #define ARPOL_MAX_ENTRIES 8
  15568. - static int brcmf_inetaddr_changed(struct notifier_block *nb,
  15569. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  15570. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  15571. -@@ -217,7 +217,6 @@ int brcmf_net_attach(struct brcmf_if *if
  15572. - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
  15573. - bool is_p2pdev, char *name, u8 *mac_addr);
  15574. - void brcmf_remove_interface(struct brcmf_if *ifp);
  15575. --int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr);
  15576. - void brcmf_txflowblock_if(struct brcmf_if *ifp,
  15577. - enum brcmf_netif_stop_reason reason, bool state);
  15578. - void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
  15579. 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
  15580. deleted file mode 100644
  15581. index a79c9a2e93732d8c4c15af55387e378afd72001a..0000000000000000000000000000000000000000
  15582. --- a/package/kernel/mac80211/patches/351-0007-brcmutil-add-field-storing-control-channel-to-the-st.patch
  15583. +++ /dev/null
  15584. @@ -1,244 +0,0 @@
  15585. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  15586. -Date: Fri, 20 May 2016 13:38:57 +0200
  15587. -Subject: [PATCH] brcmutil: add field storing control channel to the struct
  15588. - brcmu_chan
  15589. -MIME-Version: 1.0
  15590. -Content-Type: text/plain; charset=UTF-8
  15591. -Content-Transfer-Encoding: 8bit
  15592. -
  15593. -Our d11 code supports encoding/decoding channel info into/from chanspec
  15594. -format used by firmware. Current implementation is quite misleading
  15595. -because of the way "chnum" field is used.
  15596. -When encoding channel info, "chnum" has to be filled by a caller with
  15597. -*center* channel number. However when decoding chanspec the same field
  15598. -is filled with a *control* channel number.
  15599. -
  15600. -1) This can be confusing. It's expected for information to be the same
  15601. - after encoding and decoding.
  15602. -2) It doesn't allow accessing all info when decoding. Some functions may
  15603. - need to know both channel numbers, e.g. cfg80211 callback getting
  15604. - current channel.
  15605. -Solve this by adding a separated field for control channel.
  15606. -
  15607. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  15608. -Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  15609. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15610. ----
  15611. -
  15612. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  15613. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  15614. -@@ -2689,7 +2689,7 @@ static s32 brcmf_inform_single_bss(struc
  15615. - if (!bi->ctl_ch) {
  15616. - ch.chspec = le16_to_cpu(bi->chanspec);
  15617. - cfg->d11inf.decchspec(&ch);
  15618. -- bi->ctl_ch = ch.chnum;
  15619. -+ bi->ctl_ch = ch.control_ch_num;
  15620. - }
  15621. - channel = bi->ctl_ch;
  15622. -
  15623. -@@ -2807,7 +2807,7 @@ static s32 brcmf_inform_ibss(struct brcm
  15624. - else
  15625. - band = wiphy->bands[IEEE80211_BAND_5GHZ];
  15626. -
  15627. -- freq = ieee80211_channel_to_frequency(ch.chnum, band->band);
  15628. -+ freq = ieee80211_channel_to_frequency(ch.control_ch_num, band->band);
  15629. - cfg->channel = freq;
  15630. - notify_channel = ieee80211_get_channel(wiphy, freq);
  15631. -
  15632. -@@ -2817,7 +2817,7 @@ static s32 brcmf_inform_ibss(struct brcm
  15633. - notify_ielen = le32_to_cpu(bi->ie_length);
  15634. - notify_signal = (s16)le16_to_cpu(bi->RSSI) * 100;
  15635. -
  15636. -- brcmf_dbg(CONN, "channel: %d(%d)\n", ch.chnum, freq);
  15637. -+ brcmf_dbg(CONN, "channel: %d(%d)\n", ch.control_ch_num, freq);
  15638. - brcmf_dbg(CONN, "capability: %X\n", notify_capability);
  15639. - brcmf_dbg(CONN, "beacon interval: %d\n", notify_interval);
  15640. - brcmf_dbg(CONN, "signal: %d\n", notify_signal);
  15641. -@@ -5235,7 +5235,7 @@ brcmf_bss_roaming_done(struct brcmf_cfg8
  15642. - else
  15643. - band = wiphy->bands[IEEE80211_BAND_5GHZ];
  15644. -
  15645. -- freq = ieee80211_channel_to_frequency(ch.chnum, band->band);
  15646. -+ freq = ieee80211_channel_to_frequency(ch.control_ch_num, band->band);
  15647. - notify_channel = ieee80211_get_channel(wiphy, freq);
  15648. -
  15649. - done:
  15650. -@@ -5757,14 +5757,15 @@ static int brcmf_construct_chaninfo(stru
  15651. - channel = band->channels;
  15652. - index = band->n_channels;
  15653. - for (j = 0; j < band->n_channels; j++) {
  15654. -- if (channel[j].hw_value == ch.chnum) {
  15655. -+ if (channel[j].hw_value == ch.control_ch_num) {
  15656. - index = j;
  15657. - break;
  15658. - }
  15659. - }
  15660. - channel[index].center_freq =
  15661. -- ieee80211_channel_to_frequency(ch.chnum, band->band);
  15662. -- channel[index].hw_value = ch.chnum;
  15663. -+ ieee80211_channel_to_frequency(ch.control_ch_num,
  15664. -+ band->band);
  15665. -+ channel[index].hw_value = ch.control_ch_num;
  15666. -
  15667. - /* assuming the chanspecs order is HT20,
  15668. - * HT40 upper, HT40 lower, and VHT80.
  15669. -@@ -5866,7 +5867,7 @@ static int brcmf_enable_bw40_2g(struct b
  15670. - if (WARN_ON(ch.bw != BRCMU_CHAN_BW_40))
  15671. - continue;
  15672. - for (j = 0; j < band->n_channels; j++) {
  15673. -- if (band->channels[j].hw_value == ch.chnum)
  15674. -+ if (band->channels[j].hw_value == ch.control_ch_num)
  15675. - break;
  15676. - }
  15677. - if (WARN_ON(j == band->n_channels))
  15678. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  15679. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  15680. -@@ -1246,7 +1246,7 @@ bool brcmf_p2p_scan_finding_common_chann
  15681. - if (!bi->ctl_ch) {
  15682. - ch.chspec = le16_to_cpu(bi->chanspec);
  15683. - cfg->d11inf.decchspec(&ch);
  15684. -- bi->ctl_ch = ch.chnum;
  15685. -+ bi->ctl_ch = ch.control_ch_num;
  15686. - }
  15687. - afx_hdl->peer_chan = bi->ctl_ch;
  15688. - brcmf_dbg(TRACE, "ACTION FRAME SCAN : Peer %pM found, channel : %d\n",
  15689. -@@ -1385,7 +1385,7 @@ int brcmf_p2p_notify_action_frame_rx(str
  15690. - if (test_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL,
  15691. - &p2p->status) &&
  15692. - (ether_addr_equal(afx_hdl->tx_dst_addr, e->addr))) {
  15693. -- afx_hdl->peer_chan = ch.chnum;
  15694. -+ afx_hdl->peer_chan = ch.control_ch_num;
  15695. - brcmf_dbg(INFO, "GON request: Peer found, channel=%d\n",
  15696. - afx_hdl->peer_chan);
  15697. - complete(&afx_hdl->act_frm_scan);
  15698. -@@ -1428,7 +1428,7 @@ int brcmf_p2p_notify_action_frame_rx(str
  15699. - memcpy(&mgmt_frame->u, frame, mgmt_frame_len);
  15700. - mgmt_frame_len += offsetof(struct ieee80211_mgmt, u);
  15701. -
  15702. -- freq = ieee80211_channel_to_frequency(ch.chnum,
  15703. -+ freq = ieee80211_channel_to_frequency(ch.control_ch_num,
  15704. - ch.band == BRCMU_CHAN_BAND_2G ?
  15705. - IEEE80211_BAND_2GHZ :
  15706. - IEEE80211_BAND_5GHZ);
  15707. -@@ -1873,7 +1873,7 @@ s32 brcmf_p2p_notify_rx_mgmt_p2p_probere
  15708. -
  15709. - if (test_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL, &p2p->status) &&
  15710. - (ether_addr_equal(afx_hdl->tx_dst_addr, e->addr))) {
  15711. -- afx_hdl->peer_chan = ch.chnum;
  15712. -+ afx_hdl->peer_chan = ch.control_ch_num;
  15713. - brcmf_dbg(INFO, "PROBE REQUEST: Peer found, channel=%d\n",
  15714. - afx_hdl->peer_chan);
  15715. - complete(&afx_hdl->act_frm_scan);
  15716. -@@ -1898,7 +1898,7 @@ s32 brcmf_p2p_notify_rx_mgmt_p2p_probere
  15717. -
  15718. - mgmt_frame = (u8 *)(rxframe + 1);
  15719. - mgmt_frame_len = e->datalen - sizeof(*rxframe);
  15720. -- freq = ieee80211_channel_to_frequency(ch.chnum,
  15721. -+ freq = ieee80211_channel_to_frequency(ch.control_ch_num,
  15722. - ch.band == BRCMU_CHAN_BAND_2G ?
  15723. - IEEE80211_BAND_2GHZ :
  15724. - IEEE80211_BAND_5GHZ);
  15725. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmutil/d11.c
  15726. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmutil/d11.c
  15727. -@@ -107,6 +107,7 @@ static void brcmu_d11n_decchspec(struct
  15728. - u16 val;
  15729. -
  15730. - ch->chnum = (u8)(ch->chspec & BRCMU_CHSPEC_CH_MASK);
  15731. -+ ch->control_ch_num = ch->chnum;
  15732. -
  15733. - switch (ch->chspec & BRCMU_CHSPEC_D11N_BW_MASK) {
  15734. - case BRCMU_CHSPEC_D11N_BW_20:
  15735. -@@ -118,10 +119,10 @@ static void brcmu_d11n_decchspec(struct
  15736. - val = ch->chspec & BRCMU_CHSPEC_D11N_SB_MASK;
  15737. - if (val == BRCMU_CHSPEC_D11N_SB_L) {
  15738. - ch->sb = BRCMU_CHAN_SB_L;
  15739. -- ch->chnum -= CH_10MHZ_APART;
  15740. -+ ch->control_ch_num -= CH_10MHZ_APART;
  15741. - } else {
  15742. - ch->sb = BRCMU_CHAN_SB_U;
  15743. -- ch->chnum += CH_10MHZ_APART;
  15744. -+ ch->control_ch_num += CH_10MHZ_APART;
  15745. - }
  15746. - break;
  15747. - default:
  15748. -@@ -147,6 +148,7 @@ static void brcmu_d11ac_decchspec(struct
  15749. - u16 val;
  15750. -
  15751. - ch->chnum = (u8)(ch->chspec & BRCMU_CHSPEC_CH_MASK);
  15752. -+ ch->control_ch_num = ch->chnum;
  15753. -
  15754. - switch (ch->chspec & BRCMU_CHSPEC_D11AC_BW_MASK) {
  15755. - case BRCMU_CHSPEC_D11AC_BW_20:
  15756. -@@ -158,10 +160,10 @@ static void brcmu_d11ac_decchspec(struct
  15757. - val = ch->chspec & BRCMU_CHSPEC_D11AC_SB_MASK;
  15758. - if (val == BRCMU_CHSPEC_D11AC_SB_L) {
  15759. - ch->sb = BRCMU_CHAN_SB_L;
  15760. -- ch->chnum -= CH_10MHZ_APART;
  15761. -+ ch->control_ch_num -= CH_10MHZ_APART;
  15762. - } else if (val == BRCMU_CHSPEC_D11AC_SB_U) {
  15763. - ch->sb = BRCMU_CHAN_SB_U;
  15764. -- ch->chnum += CH_10MHZ_APART;
  15765. -+ ch->control_ch_num += CH_10MHZ_APART;
  15766. - } else {
  15767. - WARN_ON_ONCE(1);
  15768. - }
  15769. -@@ -172,16 +174,16 @@ static void brcmu_d11ac_decchspec(struct
  15770. - BRCMU_CHSPEC_D11AC_SB_SHIFT);
  15771. - switch (ch->sb) {
  15772. - case BRCMU_CHAN_SB_LL:
  15773. -- ch->chnum -= CH_30MHZ_APART;
  15774. -+ ch->control_ch_num -= CH_30MHZ_APART;
  15775. - break;
  15776. - case BRCMU_CHAN_SB_LU:
  15777. -- ch->chnum -= CH_10MHZ_APART;
  15778. -+ ch->control_ch_num -= CH_10MHZ_APART;
  15779. - break;
  15780. - case BRCMU_CHAN_SB_UL:
  15781. -- ch->chnum += CH_10MHZ_APART;
  15782. -+ ch->control_ch_num += CH_10MHZ_APART;
  15783. - break;
  15784. - case BRCMU_CHAN_SB_UU:
  15785. -- ch->chnum += CH_30MHZ_APART;
  15786. -+ ch->control_ch_num += CH_30MHZ_APART;
  15787. - break;
  15788. - default:
  15789. - WARN_ON_ONCE(1);
  15790. ---- a/drivers/net/wireless/broadcom/brcm80211/include/brcmu_d11.h
  15791. -+++ b/drivers/net/wireless/broadcom/brcm80211/include/brcmu_d11.h
  15792. -@@ -125,14 +125,36 @@ enum brcmu_chan_sb {
  15793. - BRCMU_CHAN_SB_UU = BRCMU_CHAN_SB_LUU,
  15794. - };
  15795. -
  15796. -+/**
  15797. -+ * struct brcmu_chan - stores channel formats
  15798. -+ *
  15799. -+ * This structure can be used with functions translating chanspec into generic
  15800. -+ * channel info and the other way.
  15801. -+ *
  15802. -+ * @chspec: firmware specific format
  15803. -+ * @chnum: center channel number
  15804. -+ * @control_ch_num: control channel number
  15805. -+ * @band: frequency band
  15806. -+ * @bw: channel width
  15807. -+ * @sb: control sideband (location of control channel against the center one)
  15808. -+ */
  15809. - struct brcmu_chan {
  15810. - u16 chspec;
  15811. - u8 chnum;
  15812. -+ u8 control_ch_num;
  15813. - u8 band;
  15814. - enum brcmu_chan_bw bw;
  15815. - enum brcmu_chan_sb sb;
  15816. - };
  15817. -
  15818. -+/**
  15819. -+ * struct brcmu_d11inf - provides functions translating channel format
  15820. -+ *
  15821. -+ * @io_type: determines version of channel format used by firmware
  15822. -+ * @encchspec: encodes channel info into a chanspec, requires center channel
  15823. -+ * number, ignores control one
  15824. -+ * @decchspec: decodes chanspec into generic info
  15825. -+ */
  15826. - struct brcmu_d11inf {
  15827. - u8 io_type;
  15828. -
  15829. 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
  15830. deleted file mode 100644
  15831. index 2c536d178d6746aca311d6ce16421a609061a3ad..0000000000000000000000000000000000000000
  15832. --- a/package/kernel/mac80211/patches/351-0008-brcmfmac-support-get_channel-cfg80211-callback.patch
  15833. +++ /dev/null
  15834. @@ -1,94 +0,0 @@
  15835. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  15836. -Date: Fri, 20 May 2016 13:38:58 +0200
  15837. -Subject: [PATCH] brcmfmac: support get_channel cfg80211 callback
  15838. -MIME-Version: 1.0
  15839. -Content-Type: text/plain; charset=UTF-8
  15840. -Content-Transfer-Encoding: 8bit
  15841. -
  15842. -This is important for brcmfmac as some of released firmwares (e.g.
  15843. -brcmfmac4366b-pcie.bin) may pick different channel than requested. This
  15844. -has been tested with BCM4366B1 in D-Link DIR-885L.
  15845. -
  15846. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  15847. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15848. ----
  15849. -
  15850. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  15851. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  15852. -@@ -4847,6 +4847,68 @@ exit:
  15853. - return err;
  15854. - }
  15855. -
  15856. -+static int brcmf_cfg80211_get_channel(struct wiphy *wiphy,
  15857. -+ struct wireless_dev *wdev,
  15858. -+ struct cfg80211_chan_def *chandef)
  15859. -+{
  15860. -+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
  15861. -+ struct net_device *ndev = wdev->netdev;
  15862. -+ struct brcmf_if *ifp;
  15863. -+ struct brcmu_chan ch;
  15864. -+ enum nl80211_band band = 0;
  15865. -+ enum nl80211_chan_width width = 0;
  15866. -+ u32 chanspec;
  15867. -+ int freq, err;
  15868. -+
  15869. -+ if (!ndev)
  15870. -+ return -ENODEV;
  15871. -+ ifp = netdev_priv(ndev);
  15872. -+
  15873. -+ err = brcmf_fil_iovar_int_get(ifp, "chanspec", &chanspec);
  15874. -+ if (err) {
  15875. -+ brcmf_err("chanspec failed (%d)\n", err);
  15876. -+ return err;
  15877. -+ }
  15878. -+
  15879. -+ ch.chspec = chanspec;
  15880. -+ cfg->d11inf.decchspec(&ch);
  15881. -+
  15882. -+ switch (ch.band) {
  15883. -+ case BRCMU_CHAN_BAND_2G:
  15884. -+ band = NL80211_BAND_2GHZ;
  15885. -+ break;
  15886. -+ case BRCMU_CHAN_BAND_5G:
  15887. -+ band = NL80211_BAND_5GHZ;
  15888. -+ break;
  15889. -+ }
  15890. -+
  15891. -+ switch (ch.bw) {
  15892. -+ case BRCMU_CHAN_BW_80:
  15893. -+ width = NL80211_CHAN_WIDTH_80;
  15894. -+ break;
  15895. -+ case BRCMU_CHAN_BW_40:
  15896. -+ width = NL80211_CHAN_WIDTH_40;
  15897. -+ break;
  15898. -+ case BRCMU_CHAN_BW_20:
  15899. -+ width = NL80211_CHAN_WIDTH_20;
  15900. -+ break;
  15901. -+ case BRCMU_CHAN_BW_80P80:
  15902. -+ width = NL80211_CHAN_WIDTH_80P80;
  15903. -+ break;
  15904. -+ case BRCMU_CHAN_BW_160:
  15905. -+ width = NL80211_CHAN_WIDTH_160;
  15906. -+ break;
  15907. -+ }
  15908. -+
  15909. -+ freq = ieee80211_channel_to_frequency(ch.control_ch_num, band);
  15910. -+ chandef->chan = ieee80211_get_channel(wiphy, freq);
  15911. -+ chandef->width = width;
  15912. -+ chandef->center_freq1 = ieee80211_channel_to_frequency(ch.chnum, band);
  15913. -+ chandef->center_freq2 = 0;
  15914. -+
  15915. -+ return 0;
  15916. -+}
  15917. -+
  15918. - static int brcmf_cfg80211_crit_proto_start(struct wiphy *wiphy,
  15919. - struct wireless_dev *wdev,
  15920. - enum nl80211_crit_proto_id proto,
  15921. -@@ -5009,6 +5071,7 @@ static struct cfg80211_ops brcmf_cfg8021
  15922. - .mgmt_tx = brcmf_cfg80211_mgmt_tx,
  15923. - .remain_on_channel = brcmf_p2p_remain_on_channel,
  15924. - .cancel_remain_on_channel = brcmf_cfg80211_cancel_remain_on_channel,
  15925. -+ .get_channel = brcmf_cfg80211_get_channel,
  15926. - .start_p2p_device = brcmf_p2p_start_device,
  15927. - .stop_p2p_device = brcmf_p2p_stop_device,
  15928. - .crit_proto_start = brcmf_cfg80211_crit_proto_start,
  15929. 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
  15930. deleted file mode 100644
  15931. index 1b119b2c8599e26de399c7d0174b5ef0be02067d..0000000000000000000000000000000000000000
  15932. --- a/package/kernel/mac80211/patches/351-0009-brcmfmac-print-errors-if-creating-interface-fails.patch
  15933. +++ /dev/null
  15934. @@ -1,59 +0,0 @@
  15935. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  15936. -Date: Fri, 27 May 2016 10:54:28 +0200
  15937. -Subject: [PATCH] brcmfmac: print errors if creating interface fails
  15938. -
  15939. -This is helpful for debugging. Without this all I was getting from "iw"
  15940. -command on failed creating of P2P interface was:
  15941. -> command failed: Too many open files in system (-23)
  15942. -
  15943. -Signed-off-by: Rafal Milecki <zajec5@gmail.com>
  15944. -[arend@broadcom.com: reduce error prints upon iface creation]
  15945. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15946. -Reviewed-by: Julian Calaby <julian.calaby@gmail.com>
  15947. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15948. ----
  15949. -
  15950. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  15951. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  15952. -@@ -670,20 +670,24 @@ static struct wireless_dev *brcmf_cfg802
  15953. - return ERR_PTR(-EOPNOTSUPP);
  15954. - case NL80211_IFTYPE_AP:
  15955. - wdev = brcmf_ap_add_vif(wiphy, name, flags, params);
  15956. -- if (!IS_ERR(wdev))
  15957. -- brcmf_cfg80211_update_proto_addr_mode(wdev);
  15958. -- return wdev;
  15959. -+ break;
  15960. - case NL80211_IFTYPE_P2P_CLIENT:
  15961. - case NL80211_IFTYPE_P2P_GO:
  15962. - case NL80211_IFTYPE_P2P_DEVICE:
  15963. - wdev = brcmf_p2p_add_vif(wiphy, name, name_assign_type, type, flags, params);
  15964. -- if (!IS_ERR(wdev))
  15965. -- brcmf_cfg80211_update_proto_addr_mode(wdev);
  15966. -- return wdev;
  15967. -+ break;
  15968. - case NL80211_IFTYPE_UNSPECIFIED:
  15969. - default:
  15970. - return ERR_PTR(-EINVAL);
  15971. - }
  15972. -+
  15973. -+ if (IS_ERR(wdev))
  15974. -+ brcmf_err("add iface %s type %d failed: err=%d\n",
  15975. -+ name, type, (int)PTR_ERR(wdev));
  15976. -+ else
  15977. -+ brcmf_cfg80211_update_proto_addr_mode(wdev);
  15978. -+
  15979. -+ return wdev;
  15980. - }
  15981. -
  15982. - static void brcmf_scan_config_mpc(struct brcmf_if *ifp, int mpc)
  15983. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  15984. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  15985. -@@ -2030,8 +2030,6 @@ static int brcmf_p2p_request_p2p_if(stru
  15986. -
  15987. - err = brcmf_fil_iovar_data_set(ifp, "p2p_ifadd", &if_request,
  15988. - sizeof(if_request));
  15989. -- if (err)
  15990. -- return err;
  15991. -
  15992. - return err;
  15993. - }
  15994. 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
  15995. deleted file mode 100644
  15996. index a2e18a5fe994ed40619f5f12e936765ffeec2314..0000000000000000000000000000000000000000
  15997. --- a/package/kernel/mac80211/patches/351-0010-brcmfmac-fix-setting-AP-channel-with-new-firmwares.patch
  15998. +++ /dev/null
  15999. @@ -1,114 +0,0 @@
  16000. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  16001. -Date: Fri, 27 May 2016 21:07:19 +0200
  16002. -Subject: [PATCH] brcmfmac: fix setting AP channel with new firmwares
  16003. -MIME-Version: 1.0
  16004. -Content-Type: text/plain; charset=UTF-8
  16005. -Content-Transfer-Encoding: 8bit
  16006. -
  16007. -Firmware for new chipsets is based on a new major version of code
  16008. -internally maintained at Broadcom. E.g. brcmfmac4366b-pcie.bin (used for
  16009. -BCM4366B1) is based on 10.10.69.3309 while brcmfmac43602-pcie.ap.bin was
  16010. -based on 7.35.177.56.
  16011. -
  16012. -Currently setting AP 5 GHz channel doesn't work reliably with BCM4366B1.
  16013. -When setting e.g. 36 control channel with VHT80 (center channel 42)
  16014. -firmware may randomly pick one of:
  16015. -1) 52 control channel with 58 as center one
  16016. -2) 100 control channel with 106 as center one
  16017. -3) 116 control channel with 122 as center one
  16018. -4) 149 control channel with 155 as center one
  16019. -
  16020. -It seems new firmwares require setting AP mode (BRCMF_C_SET_AP) before
  16021. -specifying a channel. Changing an order of firmware calls fixes the
  16022. -problem. This requirement resulted in two separated "chanspec" calls,
  16023. -one in AP code path and one in P2P path.
  16024. -
  16025. -This fix was verified with BCM4366B1 and tested for regressions on
  16026. -BCM43602.
  16027. -
  16028. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  16029. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16030. ----
  16031. -
  16032. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  16033. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  16034. -@@ -4382,7 +4382,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  16035. - struct brcmf_join_params join_params;
  16036. - enum nl80211_iftype dev_role;
  16037. - struct brcmf_fil_bss_enable_le bss_enable;
  16038. -- u16 chanspec;
  16039. -+ u16 chanspec = chandef_to_chanspec(&cfg->d11inf, &settings->chandef);
  16040. - bool mbss;
  16041. - int is_11d;
  16042. -
  16043. -@@ -4458,16 +4458,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  16044. -
  16045. - brcmf_config_ap_mgmt_ie(ifp->vif, &settings->beacon);
  16046. -
  16047. -+ /* Parameters shared by all radio interfaces */
  16048. - if (!mbss) {
  16049. -- chanspec = chandef_to_chanspec(&cfg->d11inf,
  16050. -- &settings->chandef);
  16051. -- err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec);
  16052. -- if (err < 0) {
  16053. -- brcmf_err("Set Channel failed: chspec=%d, %d\n",
  16054. -- chanspec, err);
  16055. -- goto exit;
  16056. -- }
  16057. --
  16058. - if (is_11d != ifp->vif->is_11d) {
  16059. - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY,
  16060. - is_11d);
  16061. -@@ -4515,6 +4507,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  16062. - err = -EINVAL;
  16063. - goto exit;
  16064. - }
  16065. -+
  16066. -+ /* Interface specific setup */
  16067. - if (dev_role == NL80211_IFTYPE_AP) {
  16068. - if ((brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) && (!mbss))
  16069. - brcmf_fil_iovar_int_set(ifp, "mbss", 1);
  16070. -@@ -4524,6 +4518,17 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  16071. - brcmf_err("setting AP mode failed %d\n", err);
  16072. - goto exit;
  16073. - }
  16074. -+ if (!mbss) {
  16075. -+ /* Firmware 10.x requires setting channel after enabling
  16076. -+ * AP and before bringing interface up.
  16077. -+ */
  16078. -+ err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec);
  16079. -+ if (err < 0) {
  16080. -+ brcmf_err("Set Channel failed: chspec=%d, %d\n",
  16081. -+ chanspec, err);
  16082. -+ goto exit;
  16083. -+ }
  16084. -+ }
  16085. - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1);
  16086. - if (err < 0) {
  16087. - brcmf_err("BRCMF_C_UP error (%d)\n", err);
  16088. -@@ -4545,7 +4550,13 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  16089. - goto exit;
  16090. - }
  16091. - brcmf_dbg(TRACE, "AP mode configuration complete\n");
  16092. -- } else {
  16093. -+ } else if (dev_role == NL80211_IFTYPE_P2P_GO) {
  16094. -+ err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec);
  16095. -+ if (err < 0) {
  16096. -+ brcmf_err("Set Channel failed: chspec=%d, %d\n",
  16097. -+ chanspec, err);
  16098. -+ goto exit;
  16099. -+ }
  16100. - err = brcmf_fil_bsscfg_data_set(ifp, "ssid", &ssid_le,
  16101. - sizeof(ssid_le));
  16102. - if (err < 0) {
  16103. -@@ -4562,7 +4573,10 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  16104. - }
  16105. -
  16106. - brcmf_dbg(TRACE, "GO mode configuration complete\n");
  16107. -+ } else {
  16108. -+ WARN_ON(1);
  16109. - }
  16110. -+
  16111. - set_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state);
  16112. - brcmf_net_setcarrier(ifp, true);
  16113. -
  16114. 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
  16115. deleted file mode 100644
  16116. index 167e4347d5ff00cf87cf352058723bd58e1468ce..0000000000000000000000000000000000000000
  16117. --- a/package/kernel/mac80211/patches/351-0011-brcmfmac-don-t-remove-interface-on-link-down-firmwar.patch
  16118. +++ /dev/null
  16119. @@ -1,60 +0,0 @@
  16120. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  16121. -Date: Mon, 30 May 2016 06:40:54 +0200
  16122. -Subject: [PATCH] brcmfmac: don't remove interface on link down firmware event
  16123. -MIME-Version: 1.0
  16124. -Content-Type: text/plain; charset=UTF-8
  16125. -Content-Transfer-Encoding: 8bit
  16126. -
  16127. -There are two firmware events we handle similarly in brcmfmac:
  16128. -BRCMF_E_LINK and BRCMF_E_IF. The difference from firmware point of view
  16129. -is that the first one means BSS remains present in the firmware. Trying
  16130. -to (re)create it (e.g. when adding new virtual interface) will result in
  16131. -an error.
  16132. -
  16133. -Current code treats both events in a similar way. It removes Linux
  16134. -interface for each of them. It works OK with e.g. BCM43602. Its firmware
  16135. -generates both events for each interface. It means we get BRCMF_E_LINK
  16136. -and remove interface. That is soon followed by BRCMF_E_IF which means
  16137. -BSS was also removed in a firmware. The only downside of this is a
  16138. -harmless error like:
  16139. -[ 208.643180] brcmfmac: brcmf_fweh_call_event_handler: no interface object
  16140. -
  16141. -Unfortunately BCM4366 firmware doesn't automatically remove BSS and so
  16142. -it doesn't generate BRCMF_E_IF. In such case we incorrectly remove Linux
  16143. -interface on BRCMF_E_LINK as BSS is still present in the firmware. It
  16144. -results in an error when trying to re-create virtual interface, e.g.:
  16145. -> iw phy phy1 interface add wlan1-1 type __ap
  16146. -[ 3602.929199] brcmfmac: brcmf_ap_add_vif: timeout occurred
  16147. -command failed: I/O error (-5)
  16148. -
  16149. -With this patch we don't remove Linux interface while firmware keeps
  16150. -BSS. Thanks to this we keep a consistent states of host driver and
  16151. -device firmware.
  16152. -
  16153. -Further improvement should be to mark BSS as disabled and remove
  16154. -interface on BRCMF_E_LINK. Then we should add support for reusing
  16155. -BSS-es.
  16156. -
  16157. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  16158. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16159. ----
  16160. -
  16161. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  16162. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  16163. -@@ -5372,7 +5372,6 @@ brcmf_notify_connect_status_ap(struct br
  16164. - struct net_device *ndev,
  16165. - const struct brcmf_event_msg *e, void *data)
  16166. - {
  16167. -- struct brcmf_if *ifp = netdev_priv(ndev);
  16168. - static int generation;
  16169. - u32 event = e->event_code;
  16170. - u32 reason = e->reason;
  16171. -@@ -5383,8 +5382,6 @@ brcmf_notify_connect_status_ap(struct br
  16172. - ndev != cfg_to_ndev(cfg)) {
  16173. - brcmf_dbg(CONN, "AP mode link down\n");
  16174. - complete(&cfg->vif_disabled);
  16175. -- if (ifp->vif->mbss)
  16176. -- brcmf_remove_interface(ifp);
  16177. - return 0;
  16178. - }
  16179. -
  16180. 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
  16181. deleted file mode 100644
  16182. index 28ef3a65fd6b28749308521bceb6d150fc42688d..0000000000000000000000000000000000000000
  16183. --- a/package/kernel/mac80211/patches/351-0017-brcmfmac-drop-unused-pm_block-vif-attribute.patch
  16184. +++ /dev/null
  16185. @@ -1,103 +0,0 @@
  16186. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  16187. -Date: Mon, 6 Jun 2016 23:03:55 +0200
  16188. -Subject: [PATCH] brcmfmac: drop unused pm_block vif attribute
  16189. -MIME-Version: 1.0
  16190. -Content-Type: text/plain; charset=UTF-8
  16191. -Content-Transfer-Encoding: 8bit
  16192. -
  16193. -This attribute was added 3 years ago by
  16194. -commit 3eacf866559c ("brcmfmac: introduce brcmf_cfg80211_vif structure")
  16195. -but it remains unused since then. It seems we can safely drop it.
  16196. -
  16197. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  16198. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16199. ----
  16200. -
  16201. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  16202. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  16203. -@@ -587,7 +587,7 @@ struct wireless_dev *brcmf_ap_add_vif(st
  16204. -
  16205. - brcmf_dbg(INFO, "Adding vif \"%s\"\n", name);
  16206. -
  16207. -- vif = brcmf_alloc_vif(cfg, NL80211_IFTYPE_AP, false);
  16208. -+ vif = brcmf_alloc_vif(cfg, NL80211_IFTYPE_AP);
  16209. - if (IS_ERR(vif))
  16210. - return (struct wireless_dev *)vif;
  16211. -
  16212. -@@ -5098,8 +5098,7 @@ static struct cfg80211_ops brcmf_cfg8021
  16213. - };
  16214. -
  16215. - struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg,
  16216. -- enum nl80211_iftype type,
  16217. -- bool pm_block)
  16218. -+ enum nl80211_iftype type)
  16219. - {
  16220. - struct brcmf_cfg80211_vif *vif_walk;
  16221. - struct brcmf_cfg80211_vif *vif;
  16222. -@@ -5114,8 +5113,6 @@ struct brcmf_cfg80211_vif *brcmf_alloc_v
  16223. - vif->wdev.wiphy = cfg->wiphy;
  16224. - vif->wdev.iftype = type;
  16225. -
  16226. -- vif->pm_block = pm_block;
  16227. --
  16228. - brcmf_init_prof(&vif->profile);
  16229. -
  16230. - if (type == NL80211_IFTYPE_AP) {
  16231. -@@ -6754,7 +6751,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  16232. - init_vif_event(&cfg->vif_event);
  16233. - INIT_LIST_HEAD(&cfg->vif_list);
  16234. -
  16235. -- vif = brcmf_alloc_vif(cfg, NL80211_IFTYPE_STATION, false);
  16236. -+ vif = brcmf_alloc_vif(cfg, NL80211_IFTYPE_STATION);
  16237. - if (IS_ERR(vif))
  16238. - goto wiphy_out;
  16239. -
  16240. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  16241. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  16242. -@@ -167,7 +167,6 @@ struct vif_saved_ie {
  16243. - * @wdev: wireless device.
  16244. - * @profile: profile information.
  16245. - * @sme_state: SME state using enum brcmf_vif_status bits.
  16246. -- * @pm_block: power-management blocked.
  16247. - * @list: linked list.
  16248. - * @mgmt_rx_reg: registered rx mgmt frame types.
  16249. - * @mbss: Multiple BSS type, set if not first AP (not relevant for P2P).
  16250. -@@ -177,7 +176,6 @@ struct brcmf_cfg80211_vif {
  16251. - struct wireless_dev wdev;
  16252. - struct brcmf_cfg80211_profile profile;
  16253. - unsigned long sme_state;
  16254. -- bool pm_block;
  16255. - struct vif_saved_ie saved_ie;
  16256. - struct list_head list;
  16257. - u16 mgmt_rx_reg;
  16258. -@@ -388,8 +386,7 @@ s32 brcmf_cfg80211_down(struct net_devic
  16259. - enum nl80211_iftype brcmf_cfg80211_get_iftype(struct brcmf_if *ifp);
  16260. -
  16261. - struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg,
  16262. -- enum nl80211_iftype type,
  16263. -- bool pm_block);
  16264. -+ enum nl80211_iftype type);
  16265. - void brcmf_free_vif(struct brcmf_cfg80211_vif *vif);
  16266. -
  16267. - s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag,
  16268. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  16269. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  16270. -@@ -2074,8 +2074,7 @@ static struct wireless_dev *brcmf_p2p_cr
  16271. - if (p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif)
  16272. - return ERR_PTR(-ENOSPC);
  16273. -
  16274. -- p2p_vif = brcmf_alloc_vif(p2p->cfg, NL80211_IFTYPE_P2P_DEVICE,
  16275. -- false);
  16276. -+ p2p_vif = brcmf_alloc_vif(p2p->cfg, NL80211_IFTYPE_P2P_DEVICE);
  16277. - if (IS_ERR(p2p_vif)) {
  16278. - brcmf_err("could not create discovery vif\n");
  16279. - return (struct wireless_dev *)p2p_vif;
  16280. -@@ -2175,7 +2174,7 @@ struct wireless_dev *brcmf_p2p_add_vif(s
  16281. - return ERR_PTR(-EOPNOTSUPP);
  16282. - }
  16283. -
  16284. -- vif = brcmf_alloc_vif(cfg, type, false);
  16285. -+ vif = brcmf_alloc_vif(cfg, type);
  16286. - if (IS_ERR(vif))
  16287. - return (struct wireless_dev *)vif;
  16288. - brcmf_cfg80211_arm_vif_event(cfg, vif);
  16289. 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
  16290. deleted file mode 100644
  16291. index 09547d8d3b5b021d920963a6280fe80a0a561a59..0000000000000000000000000000000000000000
  16292. --- a/package/kernel/mac80211/patches/351-0018-brcmfmac-include-required-headers-in-cfg80211.h.patch
  16293. +++ /dev/null
  16294. @@ -1,37 +0,0 @@
  16295. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  16296. -Date: Tue, 7 Jun 2016 08:20:21 +0200
  16297. -Subject: [PATCH] brcmfmac: include required headers in cfg80211.h
  16298. -MIME-Version: 1.0
  16299. -Content-Type: text/plain; charset=UTF-8
  16300. -Content-Transfer-Encoding: 8bit
  16301. -
  16302. -Without this including cfg80211.h in a wrong order could result in:
  16303. -
  16304. -drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h:122:24: error: array type has incomplete element type
  16305. - struct brcmf_wsec_key key[BRCMF_MAX_DEFAULT_KEYS];
  16306. - ^
  16307. -drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h:291:24: error: field ‘p2p’ has incomplete type
  16308. - struct brcmf_p2p_info p2p;
  16309. - ^
  16310. -drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h:297:27: error: field ‘pmk_list’ has incomplete type
  16311. - struct brcmf_pmk_list_le pmk_list;
  16312. - ^
  16313. -drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h:317:28: error: field ‘assoclist’ has incomplete type
  16314. - struct brcmf_assoclist_le assoclist;
  16315. -
  16316. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  16317. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16318. ----
  16319. -
  16320. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  16321. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  16322. -@@ -20,6 +20,9 @@
  16323. - /* for brcmu_d11inf */
  16324. - #include <brcmu_d11.h>
  16325. -
  16326. -+#include "fwil_types.h"
  16327. -+#include "p2p.h"
  16328. -+
  16329. - #define WL_NUM_SCAN_MAX 10
  16330. - #define WL_TLV_INFO_MAX 1024
  16331. - #define WL_BSS_INFO_MAX 2048
  16332. 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
  16333. deleted file mode 100644
  16334. index 461e3dba5397f7b48f00ec984d4edfd108dbbbb6..0000000000000000000000000000000000000000
  16335. --- a/package/kernel/mac80211/patches/351-0019-brcmfmac-slightly-simplify-building-interface-combin.patch
  16336. +++ /dev/null
  16337. @@ -1,108 +0,0 @@
  16338. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  16339. -Date: Tue, 7 Jun 2016 21:10:18 +0200
  16340. -Subject: [PATCH] brcmfmac: slightly simplify building interface combinations
  16341. -MIME-Version: 1.0
  16342. -Content-Type: text/plain; charset=UTF-8
  16343. -Content-Transfer-Encoding: 8bit
  16344. -
  16345. -This change reorders some operations in brcmf_setup_ifmodes in hope to
  16346. -make it simpler:
  16347. -1) It allocates arrays right before filling them. This way it's easier
  16348. - to follow requested array length as it's immediately followed by
  16349. - code filling it. It's easier to check e.g. why we need 4 entries for
  16350. - P2P. Other than that it deduplicates some checks (e.g. for P2P).
  16351. -2) It reorders code to first prepare limits and then define a new combo.
  16352. - Previously this was mixed (e.g. we were setting num of channels
  16353. - before preparing limits).
  16354. -3) It modifies mbss code to use i variable just like other combos do.
  16355. -
  16356. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  16357. -Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  16358. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16359. ----
  16360. -
  16361. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  16362. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  16363. -@@ -6208,29 +6208,15 @@ static int brcmf_setup_ifmodes(struct wi
  16364. - if (!combo)
  16365. - goto err;
  16366. -
  16367. -- c0_limits = kcalloc(p2p ? 3 : 2, sizeof(*c0_limits), GFP_KERNEL);
  16368. -- if (!c0_limits)
  16369. -- goto err;
  16370. --
  16371. -- if (p2p) {
  16372. -- p2p_limits = kcalloc(4, sizeof(*p2p_limits), GFP_KERNEL);
  16373. -- if (!p2p_limits)
  16374. -- goto err;
  16375. -- }
  16376. --
  16377. -- if (mbss) {
  16378. -- mbss_limits = kcalloc(1, sizeof(*mbss_limits), GFP_KERNEL);
  16379. -- if (!mbss_limits)
  16380. -- goto err;
  16381. -- }
  16382. --
  16383. - wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
  16384. - BIT(NL80211_IFTYPE_ADHOC) |
  16385. - BIT(NL80211_IFTYPE_AP);
  16386. -
  16387. - c = 0;
  16388. - i = 0;
  16389. -- combo[c].num_different_channels = 1;
  16390. -+ c0_limits = kcalloc(p2p ? 3 : 2, sizeof(*c0_limits), GFP_KERNEL);
  16391. -+ if (!c0_limits)
  16392. -+ goto err;
  16393. - c0_limits[i].max = 1;
  16394. - c0_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  16395. - if (p2p) {
  16396. -@@ -6248,6 +6234,7 @@ static int brcmf_setup_ifmodes(struct wi
  16397. - c0_limits[i].max = 1;
  16398. - c0_limits[i++].types = BIT(NL80211_IFTYPE_AP);
  16399. - }
  16400. -+ combo[c].num_different_channels = 1;
  16401. - combo[c].max_interfaces = i;
  16402. - combo[c].n_limits = i;
  16403. - combo[c].limits = c0_limits;
  16404. -@@ -6255,7 +6242,9 @@ static int brcmf_setup_ifmodes(struct wi
  16405. - if (p2p) {
  16406. - c++;
  16407. - i = 0;
  16408. -- combo[c].num_different_channels = 1;
  16409. -+ p2p_limits = kcalloc(4, sizeof(*p2p_limits), GFP_KERNEL);
  16410. -+ if (!p2p_limits)
  16411. -+ goto err;
  16412. - p2p_limits[i].max = 1;
  16413. - p2p_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  16414. - p2p_limits[i].max = 1;
  16415. -@@ -6264,6 +6253,7 @@ static int brcmf_setup_ifmodes(struct wi
  16416. - p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT);
  16417. - p2p_limits[i].max = 1;
  16418. - p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  16419. -+ combo[c].num_different_channels = 1;
  16420. - combo[c].max_interfaces = i;
  16421. - combo[c].n_limits = i;
  16422. - combo[c].limits = p2p_limits;
  16423. -@@ -6271,14 +6261,19 @@ static int brcmf_setup_ifmodes(struct wi
  16424. -
  16425. - if (mbss) {
  16426. - c++;
  16427. -+ i = 0;
  16428. -+ mbss_limits = kcalloc(1, sizeof(*mbss_limits), GFP_KERNEL);
  16429. -+ if (!mbss_limits)
  16430. -+ goto err;
  16431. -+ mbss_limits[i].max = 4;
  16432. -+ mbss_limits[i++].types = BIT(NL80211_IFTYPE_AP);
  16433. - combo[c].beacon_int_infra_match = true;
  16434. - combo[c].num_different_channels = 1;
  16435. -- mbss_limits[0].max = 4;
  16436. -- mbss_limits[0].types = BIT(NL80211_IFTYPE_AP);
  16437. - combo[c].max_interfaces = 4;
  16438. -- combo[c].n_limits = 1;
  16439. -+ combo[c].n_limits = i;
  16440. - combo[c].limits = mbss_limits;
  16441. - }
  16442. -+
  16443. - wiphy->n_iface_combinations = n_combos;
  16444. - wiphy->iface_combinations = combo;
  16445. - return 0;
  16446. 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
  16447. deleted file mode 100644
  16448. index e991f32327d5fdb7a796ab0f8f3059487b6ebbe1..0000000000000000000000000000000000000000
  16449. --- a/package/kernel/mac80211/patches/351-0020-brcmfmac-fix-lockup-when-removing-P2P-interface-afte.patch
  16450. +++ /dev/null
  16451. @@ -1,160 +0,0 @@
  16452. -From b50ddfa8530e9b5f52e873fdd6ff04f327a88799 Mon Sep 17 00:00:00 2001
  16453. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  16454. -Date: Fri, 17 Jun 2016 12:29:21 +0200
  16455. -Subject: [PATCH] brcmfmac: fix lockup when removing P2P interface after event
  16456. - timeout
  16457. -MIME-Version: 1.0
  16458. -Content-Type: text/plain; charset=UTF-8
  16459. -Content-Transfer-Encoding: 8bit
  16460. -
  16461. -Removing P2P interface is handled by sending a proper request to the
  16462. -firmware. On success firmware triggers an event and driver's handler
  16463. -removes a matching interface.
  16464. -
  16465. -However on event timeout we remove interface directly from the cfg80211
  16466. -callback. Current code doesn't handle this case correctly as it always
  16467. -assumes rtnl to be unlocked.
  16468. -
  16469. -Fix it by adding an extra rtnl_locked parameter to functions and calling
  16470. -unregister_netdevice when needed.
  16471. -
  16472. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  16473. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16474. ----
  16475. - .../wireless/broadcom/brcm80211/brcmfmac/core.c | 29 +++++++++++++---------
  16476. - .../wireless/broadcom/brcm80211/brcmfmac/core.h | 2 +-
  16477. - .../wireless/broadcom/brcm80211/brcmfmac/fweh.c | 2 +-
  16478. - .../net/wireless/broadcom/brcm80211/brcmfmac/p2p.c | 4 +--
  16479. - 4 files changed, 21 insertions(+), 16 deletions(-)
  16480. -
  16481. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  16482. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  16483. -@@ -548,12 +548,16 @@ fail:
  16484. - return -EBADE;
  16485. - }
  16486. -
  16487. --static void brcmf_net_detach(struct net_device *ndev)
  16488. -+static void brcmf_net_detach(struct net_device *ndev, bool rtnl_locked)
  16489. - {
  16490. -- if (ndev->reg_state == NETREG_REGISTERED)
  16491. -- unregister_netdev(ndev);
  16492. -- else
  16493. -+ if (ndev->reg_state == NETREG_REGISTERED) {
  16494. -+ if (rtnl_locked)
  16495. -+ unregister_netdevice(ndev);
  16496. -+ else
  16497. -+ unregister_netdev(ndev);
  16498. -+ } else {
  16499. - brcmf_cfg80211_free_netdev(ndev);
  16500. -+ }
  16501. - }
  16502. -
  16503. - void brcmf_net_setcarrier(struct brcmf_if *ifp, bool on)
  16504. -@@ -651,7 +655,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  16505. - brcmf_err("ERROR: netdev:%s already exists\n",
  16506. - ifp->ndev->name);
  16507. - netif_stop_queue(ifp->ndev);
  16508. -- brcmf_net_detach(ifp->ndev);
  16509. -+ brcmf_net_detach(ifp->ndev, false);
  16510. - drvr->iflist[bsscfgidx] = NULL;
  16511. - } else {
  16512. - brcmf_dbg(INFO, "netdev:%s ignore IF event\n",
  16513. -@@ -699,7 +703,8 @@ struct brcmf_if *brcmf_add_if(struct brc
  16514. - return ifp;
  16515. - }
  16516. -
  16517. --static void brcmf_del_if(struct brcmf_pub *drvr, s32 bsscfgidx)
  16518. -+static void brcmf_del_if(struct brcmf_pub *drvr, s32 bsscfgidx,
  16519. -+ bool rtnl_locked)
  16520. - {
  16521. - struct brcmf_if *ifp;
  16522. -
  16523. -@@ -729,7 +734,7 @@ static void brcmf_del_if(struct brcmf_pu
  16524. - cancel_work_sync(&ifp->multicast_work);
  16525. - cancel_work_sync(&ifp->ndoffload_work);
  16526. - }
  16527. -- brcmf_net_detach(ifp->ndev);
  16528. -+ brcmf_net_detach(ifp->ndev, rtnl_locked);
  16529. - } else {
  16530. - /* Only p2p device interfaces which get dynamically created
  16531. - * end up here. In this case the p2p module should be informed
  16532. -@@ -743,14 +748,14 @@ static void brcmf_del_if(struct brcmf_pu
  16533. - }
  16534. - }
  16535. -
  16536. --void brcmf_remove_interface(struct brcmf_if *ifp)
  16537. -+void brcmf_remove_interface(struct brcmf_if *ifp, bool rtnl_locked)
  16538. - {
  16539. - if (!ifp || WARN_ON(ifp->drvr->iflist[ifp->bsscfgidx] != ifp))
  16540. - return;
  16541. - brcmf_dbg(TRACE, "Enter, bsscfgidx=%d, ifidx=%d\n", ifp->bsscfgidx,
  16542. - ifp->ifidx);
  16543. - brcmf_fws_del_interface(ifp);
  16544. -- brcmf_del_if(ifp->drvr, ifp->bsscfgidx);
  16545. -+ brcmf_del_if(ifp->drvr, ifp->bsscfgidx, rtnl_locked);
  16546. - }
  16547. -
  16548. - #ifdef CONFIG_INET
  16549. -@@ -1057,9 +1062,9 @@ fail:
  16550. - brcmf_fws_deinit(drvr);
  16551. - }
  16552. - if (ifp)
  16553. -- brcmf_net_detach(ifp->ndev);
  16554. -+ brcmf_net_detach(ifp->ndev, false);
  16555. - if (p2p_ifp)
  16556. -- brcmf_net_detach(p2p_ifp->ndev);
  16557. -+ brcmf_net_detach(p2p_ifp->ndev, false);
  16558. - drvr->iflist[0] = NULL;
  16559. - drvr->iflist[1] = NULL;
  16560. - if (drvr->settings->ignore_probe_fail)
  16561. -@@ -1128,7 +1133,7 @@ void brcmf_detach(struct device *dev)
  16562. -
  16563. - /* make sure primary interface removed last */
  16564. - for (i = BRCMF_MAX_IFS-1; i > -1; i--)
  16565. -- brcmf_remove_interface(drvr->iflist[i]);
  16566. -+ brcmf_remove_interface(drvr->iflist[i], false);
  16567. -
  16568. - brcmf_cfg80211_detach(drvr->config);
  16569. -
  16570. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  16571. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  16572. -@@ -216,7 +216,7 @@ struct brcmf_if *brcmf_get_ifp(struct br
  16573. - int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  16574. - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
  16575. - bool is_p2pdev, char *name, u8 *mac_addr);
  16576. --void brcmf_remove_interface(struct brcmf_if *ifp);
  16577. -+void brcmf_remove_interface(struct brcmf_if *ifp, bool rtnl_locked);
  16578. - void brcmf_txflowblock_if(struct brcmf_if *ifp,
  16579. - enum brcmf_netif_stop_reason reason, bool state);
  16580. - void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
  16581. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  16582. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  16583. -@@ -183,7 +183,7 @@ static void brcmf_fweh_handle_if_event(s
  16584. - err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data);
  16585. -
  16586. - if (ifp && ifevent->action == BRCMF_E_IF_DEL)
  16587. -- brcmf_remove_interface(ifp);
  16588. -+ brcmf_remove_interface(ifp, false);
  16589. - }
  16590. -
  16591. - /**
  16592. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  16593. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  16594. -@@ -2289,7 +2289,7 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  16595. - err = 0;
  16596. - }
  16597. - if (err)
  16598. -- brcmf_remove_interface(vif->ifp);
  16599. -+ brcmf_remove_interface(vif->ifp, true);
  16600. -
  16601. - brcmf_cfg80211_arm_vif_event(cfg, NULL);
  16602. - if (vif->wdev.iftype != NL80211_IFTYPE_P2P_DEVICE)
  16603. -@@ -2395,7 +2395,7 @@ void brcmf_p2p_detach(struct brcmf_p2p_i
  16604. - if (vif != NULL) {
  16605. - brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  16606. - brcmf_p2p_deinit_discovery(p2p);
  16607. -- brcmf_remove_interface(vif->ifp);
  16608. -+ brcmf_remove_interface(vif->ifp, false);
  16609. - }
  16610. - /* just set it all to zero */
  16611. - memset(p2p, 0, sizeof(*p2p));
  16612. 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
  16613. deleted file mode 100644
  16614. index ed65f4dc885d936cd7776009b5b04a2376e16dc5..0000000000000000000000000000000000000000
  16615. --- a/package/kernel/mac80211/patches/351-0021-brcmfmac-use-const-char-for-interface-name-in-brcmf_.patch
  16616. +++ /dev/null
  16617. @@ -1,39 +0,0 @@
  16618. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  16619. -Date: Fri, 17 Jun 2016 12:48:44 +0200
  16620. -Subject: [PATCH] brcmfmac: use const char * for interface name in brcmf_add_if
  16621. -MIME-Version: 1.0
  16622. -Content-Type: text/plain; charset=UTF-8
  16623. -Content-Transfer-Encoding: 8bit
  16624. -
  16625. -This function can work just fine with const pointer, it only calls
  16626. -alloc_netdev which take const as well. Moreover it makes this function
  16627. -more flexible as some cfg80211 callback may provide const char * as
  16628. -well, e.g. add_virtual_intf. This will be needed for more advanced
  16629. -interface management.
  16630. -
  16631. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  16632. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16633. ----
  16634. -
  16635. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  16636. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  16637. -@@ -638,7 +638,7 @@ fail:
  16638. - }
  16639. -
  16640. - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
  16641. -- bool is_p2pdev, char *name, u8 *mac_addr)
  16642. -+ bool is_p2pdev, const char *name, u8 *mac_addr)
  16643. - {
  16644. - struct brcmf_if *ifp;
  16645. - struct net_device *ndev;
  16646. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  16647. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  16648. -@@ -215,7 +215,7 @@ char *brcmf_ifname(struct brcmf_if *ifp)
  16649. - struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx);
  16650. - int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  16651. - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
  16652. -- bool is_p2pdev, char *name, u8 *mac_addr);
  16653. -+ bool is_p2pdev, const char *name, u8 *mac_addr);
  16654. - void brcmf_remove_interface(struct brcmf_if *ifp, bool rtnl_locked);
  16655. - void brcmf_txflowblock_if(struct brcmf_if *ifp,
  16656. - enum brcmf_netif_stop_reason reason, bool state);
  16657. 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
  16658. deleted file mode 100644
  16659. index ef35fab7d74b31ab2305ce881a4d45cba73337cc..0000000000000000000000000000000000000000
  16660. --- a/package/kernel/mac80211/patches/351-0022-brcmfmac-include-also-core.h-header-in-cfg80211.h.patch
  16661. +++ /dev/null
  16662. @@ -1,33 +0,0 @@
  16663. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  16664. -Date: Sat, 18 Jun 2016 18:49:38 +0200
  16665. -Subject: [PATCH] brcmfmac: include also core.h header in cfg80211.h
  16666. -MIME-Version: 1.0
  16667. -Content-Type: text/plain; charset=UTF-8
  16668. -Content-Transfer-Encoding: 8bit
  16669. -
  16670. -This header provides two inline functions using struct brcmf_if so we
  16671. -need core.h to avoid:
  16672. -
  16673. -drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h: In function ‘ndev_to_prof’:
  16674. -drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h:368:13: error: dereferencing pointer to incomplete type
  16675. - return &ifp->vif->profile;
  16676. - ^
  16677. -drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h: In function ‘ndev_to_vif’:
  16678. -drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h:374:12: error: dereferencing pointer to incomplete type
  16679. - return ifp->vif;
  16680. - ^
  16681. -
  16682. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  16683. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16684. ----
  16685. -
  16686. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  16687. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  16688. -@@ -20,6 +20,7 @@
  16689. - /* for brcmu_d11inf */
  16690. - #include <brcmu_d11.h>
  16691. -
  16692. -+#include "core.h"
  16693. - #include "fwil_types.h"
  16694. - #include "p2p.h"
  16695. -
  16696. 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
  16697. deleted file mode 100644
  16698. index ab9a63443738dd8979cf415cd06b62ddb1a8d2cf..0000000000000000000000000000000000000000
  16699. --- a/package/kernel/mac80211/patches/351-0023-brcmfmac-add-missing-break-when-deleting-P2P_DEVICE.patch
  16700. +++ /dev/null
  16701. @@ -1,27 +0,0 @@
  16702. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  16703. -Date: Sun, 19 Jun 2016 01:55:57 +0200
  16704. -Subject: [PATCH] brcmfmac: add missing break when deleting P2P_DEVICE
  16705. -MIME-Version: 1.0
  16706. -Content-Type: text/plain; charset=UTF-8
  16707. -Content-Transfer-Encoding: 8bit
  16708. -
  16709. -We obviously don't want to fall through in that switch. With this change
  16710. -1) We wait for event (triggered by p2p_disc) as expected
  16711. -2) We remove interface manually on timeout
  16712. -3) We return 0 on success instead of -ENOTSUPP
  16713. -
  16714. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  16715. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16716. ----
  16717. -
  16718. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  16719. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  16720. -@@ -2263,6 +2263,8 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  16721. - return 0;
  16722. - brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  16723. - brcmf_p2p_deinit_discovery(p2p);
  16724. -+ break;
  16725. -+
  16726. - default:
  16727. - return -ENOTSUPP;
  16728. - }
  16729. 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
  16730. deleted file mode 100644
  16731. index 6dd0c03e3dfe5c5ed3c310931040a14596de79f1..0000000000000000000000000000000000000000
  16732. --- a/package/kernel/mac80211/patches/351-0024-brcmfmac-delete-interface-directly-in-code-that-sent.patch
  16733. +++ /dev/null
  16734. @@ -1,75 +0,0 @@
  16735. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  16736. -Date: Wed, 29 Jun 2016 21:54:26 +0200
  16737. -Subject: [PATCH] brcmfmac: delete interface directly in code that sent fw
  16738. - request
  16739. -MIME-Version: 1.0
  16740. -Content-Type: text/plain; charset=UTF-8
  16741. -Content-Transfer-Encoding: 8bit
  16742. -
  16743. -So far when receiving event about in-firmware-interface removal our
  16744. -event worker was notifying listener and afterwards it was removing Linux
  16745. -interface.
  16746. -
  16747. -First of all it was resulting in slightly unexpected order. The listener
  16748. -(del_virtual_intf callback) was (usually) returning with success before
  16749. -we even called unregister_netdev(ice).
  16750. -
  16751. -Please note this couldn't be simply fixed by changing order of calls in
  16752. -brcmf_fweh_handle_if_event as unregistering interface earlier could free
  16753. -struct brcmf_if.
  16754. -
  16755. -Another problem of current implementation are possible lockups. Focus on
  16756. -the time slot between calling event handler and removing Linux
  16757. -interface. During that time original caller may leave (unlocking rtnl
  16758. -semaphore) *and* another call to the same code may be done (locking it
  16759. -again). If that happens our event handler will stuck at removing Linux
  16760. -interface, it won't handle another event and will block process holding
  16761. -rtnl lock.
  16762. -
  16763. -This can be simply solved by unregistering interface in a proper
  16764. -callback, right after receiving confirmation event from firmware. This
  16765. -only required modifying worker to don't unregister on its own if there
  16766. -is someone waiting for the event.
  16767. -
  16768. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  16769. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16770. ----
  16771. -
  16772. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  16773. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  16774. -@@ -18,6 +18,7 @@
  16775. - #include "brcmu_wifi.h"
  16776. - #include "brcmu_utils.h"
  16777. -
  16778. -+#include "cfg80211.h"
  16779. - #include "core.h"
  16780. - #include "debug.h"
  16781. - #include "tracepoint.h"
  16782. -@@ -182,8 +183,13 @@ static void brcmf_fweh_handle_if_event(s
  16783. -
  16784. - err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data);
  16785. -
  16786. -- if (ifp && ifevent->action == BRCMF_E_IF_DEL)
  16787. -- brcmf_remove_interface(ifp, false);
  16788. -+ if (ifp && ifevent->action == BRCMF_E_IF_DEL) {
  16789. -+ bool armed = brcmf_cfg80211_vif_event_armed(drvr->config);
  16790. -+
  16791. -+ /* Default handling in case no-one waits for this event */
  16792. -+ if (!armed)
  16793. -+ brcmf_remove_interface(ifp, false);
  16794. -+ }
  16795. - }
  16796. -
  16797. - /**
  16798. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  16799. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  16800. -@@ -2290,8 +2290,7 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  16801. - else
  16802. - err = 0;
  16803. - }
  16804. -- if (err)
  16805. -- brcmf_remove_interface(vif->ifp, true);
  16806. -+ brcmf_remove_interface(vif->ifp, true);
  16807. -
  16808. - brcmf_cfg80211_arm_vif_event(cfg, NULL);
  16809. - if (vif->wdev.iftype != NL80211_IFTYPE_P2P_DEVICE)
  16810. 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
  16811. deleted file mode 100644
  16812. index 1929f0b8126ed8659d642019648c4b86cc85ecb6..0000000000000000000000000000000000000000
  16813. --- a/package/kernel/mac80211/patches/351-0025-brcmfmac-support-removing-AP-interfaces-with-interfa.patch
  16814. +++ /dev/null
  16815. @@ -1,84 +0,0 @@
  16816. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  16817. -Date: Wed, 29 Jun 2016 21:54:27 +0200
  16818. -Subject: [PATCH] brcmfmac: support removing AP interfaces with
  16819. - "interface_remove"
  16820. -MIME-Version: 1.0
  16821. -Content-Type: text/plain; charset=UTF-8
  16822. -Content-Transfer-Encoding: 8bit
  16823. -
  16824. -New firmwares (e.g. 10.10.69.36 for BCM4366) support "interface_remove"
  16825. -for removing interfaces. Try to use this method on cfg80211 request. In
  16826. -case of older firmwares (e.g. 7.35.177.56 for BCM43602 as I tested) this
  16827. -will just result in firmware rejecting command and this won't change any
  16828. -behavior.
  16829. -
  16830. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  16831. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16832. ----
  16833. -
  16834. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  16835. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  16836. -@@ -771,12 +771,48 @@ s32 brcmf_notify_escan_complete(struct b
  16837. - return err;
  16838. - }
  16839. -
  16840. -+static int brcmf_cfg80211_del_ap_iface(struct wiphy *wiphy,
  16841. -+ struct wireless_dev *wdev)
  16842. -+{
  16843. -+ struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy);
  16844. -+ struct net_device *ndev = wdev->netdev;
  16845. -+ struct brcmf_if *ifp = netdev_priv(ndev);
  16846. -+ int ret;
  16847. -+ int err;
  16848. -+
  16849. -+ brcmf_cfg80211_arm_vif_event(cfg, ifp->vif);
  16850. -+
  16851. -+ err = brcmf_fil_bsscfg_data_set(ifp, "interface_remove", NULL, 0);
  16852. -+ if (err) {
  16853. -+ brcmf_err("interface_remove failed %d\n", err);
  16854. -+ goto err_unarm;
  16855. -+ }
  16856. -+
  16857. -+ /* wait for firmware event */
  16858. -+ ret = brcmf_cfg80211_wait_vif_event(cfg, BRCMF_E_IF_DEL,
  16859. -+ BRCMF_VIF_EVENT_TIMEOUT);
  16860. -+ if (!ret) {
  16861. -+ brcmf_err("timeout occurred\n");
  16862. -+ err = -EIO;
  16863. -+ goto err_unarm;
  16864. -+ }
  16865. -+
  16866. -+ brcmf_remove_interface(ifp, true);
  16867. -+
  16868. -+err_unarm:
  16869. -+ brcmf_cfg80211_arm_vif_event(cfg, NULL);
  16870. -+ return err;
  16871. -+}
  16872. -+
  16873. - static
  16874. - int brcmf_cfg80211_del_iface(struct wiphy *wiphy, struct wireless_dev *wdev)
  16875. - {
  16876. - struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy);
  16877. - struct net_device *ndev = wdev->netdev;
  16878. -
  16879. -+ if (ndev && ndev == cfg_to_ndev(cfg))
  16880. -+ return -ENOTSUPP;
  16881. -+
  16882. - /* vif event pending in firmware */
  16883. - if (brcmf_cfg80211_vif_event_armed(cfg))
  16884. - return -EBUSY;
  16885. -@@ -793,12 +829,13 @@ int brcmf_cfg80211_del_iface(struct wiph
  16886. - switch (wdev->iftype) {
  16887. - case NL80211_IFTYPE_ADHOC:
  16888. - case NL80211_IFTYPE_STATION:
  16889. -- case NL80211_IFTYPE_AP:
  16890. - case NL80211_IFTYPE_AP_VLAN:
  16891. - case NL80211_IFTYPE_WDS:
  16892. - case NL80211_IFTYPE_MONITOR:
  16893. - case NL80211_IFTYPE_MESH_POINT:
  16894. - return -EOPNOTSUPP;
  16895. -+ case NL80211_IFTYPE_AP:
  16896. -+ return brcmf_cfg80211_del_ap_iface(wiphy, wdev);
  16897. - case NL80211_IFTYPE_P2P_CLIENT:
  16898. - case NL80211_IFTYPE_P2P_GO:
  16899. - case NL80211_IFTYPE_P2P_DEVICE:
  16900. 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
  16901. deleted file mode 100644
  16902. index ae458e7a02608101799f072b4211a01d6d487f96..0000000000000000000000000000000000000000
  16903. --- a/package/kernel/mac80211/patches/351-0026-brcmfmac-respect-hidden_ssid-for-AP-interfaces.patch
  16904. +++ /dev/null
  16905. @@ -1,43 +0,0 @@
  16906. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  16907. -Date: Wed, 6 Jul 2016 12:22:54 +0200
  16908. -Subject: [PATCH] brcmfmac: respect hidden_ssid for AP interfaces
  16909. -MIME-Version: 1.0
  16910. -Content-Type: text/plain; charset=UTF-8
  16911. -Content-Transfer-Encoding: 8bit
  16912. -
  16913. -This was succesfully tested with 4366B1. A small workaround is needed
  16914. -for the main interface otherwise it would stuck at the hidden state.
  16915. -
  16916. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  16917. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16918. ----
  16919. -
  16920. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  16921. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  16922. -@@ -4586,6 +4586,15 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  16923. - brcmf_err("SET SSID error (%d)\n", err);
  16924. - goto exit;
  16925. - }
  16926. -+
  16927. -+ if (settings->hidden_ssid) {
  16928. -+ err = brcmf_fil_iovar_int_set(ifp, "closednet", 1);
  16929. -+ if (err) {
  16930. -+ brcmf_err("closednet error (%d)\n", err);
  16931. -+ goto exit;
  16932. -+ }
  16933. -+ }
  16934. -+
  16935. - brcmf_dbg(TRACE, "AP mode configuration complete\n");
  16936. - } else if (dev_role == NL80211_IFTYPE_P2P_GO) {
  16937. - err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec);
  16938. -@@ -4644,6 +4653,10 @@ static int brcmf_cfg80211_stop_ap(struct
  16939. - return err;
  16940. - }
  16941. -
  16942. -+ /* First BSS doesn't get a full reset */
  16943. -+ if (ifp->bsscfgidx == 0)
  16944. -+ brcmf_fil_iovar_int_set(ifp, "closednet", 0);
  16945. -+
  16946. - memset(&join_params, 0, sizeof(join_params));
  16947. - err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
  16948. - &join_params, sizeof(join_params));
  16949. 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
  16950. deleted file mode 100644
  16951. index fcafa797ef02fa53c05fb5a1dde8f550f02bf9d8..0000000000000000000000000000000000000000
  16952. --- a/package/kernel/mac80211/patches/351-0027-brcmfmac-restore-stopping-netdev-queue-when-bus-clog.patch
  16953. +++ /dev/null
  16954. @@ -1,53 +0,0 @@
  16955. -From: Arend Van Spriel <arend.vanspriel@broadcom.com>
  16956. -Date: Fri, 15 Jul 2016 12:16:12 +0200
  16957. -Subject: [PATCH] brcmfmac: restore stopping netdev queue when bus clogs up
  16958. -MIME-Version: 1.0
  16959. -Content-Type: text/plain; charset=UTF-8
  16960. -Content-Transfer-Encoding: 8bit
  16961. -
  16962. -When the host-interface bus has hard time handling transmit packets
  16963. -it informs higher layer about this and it would stop the netdev
  16964. -queue when needed. However, since commit 9cd18359d31e ("brcmfmac:
  16965. -Make FWS queueing configurable.") this was broken. With this patch
  16966. -the behaviour is restored.
  16967. -
  16968. -Cc: stable@vger.kernel.org # v4.5, v4.6, v4.7
  16969. -Fixes: 9cd18359d31e ("brcmfmac: Make FWS queueing configurable.")
  16970. -Tested-by: Per Förlin <per.forlin@gmail.com>
  16971. -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  16972. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  16973. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  16974. -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  16975. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16976. ----
  16977. -
  16978. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
  16979. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
  16980. -@@ -2469,10 +2469,22 @@ void brcmf_fws_bustxfail(struct brcmf_fw
  16981. - void brcmf_fws_bus_blocked(struct brcmf_pub *drvr, bool flow_blocked)
  16982. - {
  16983. - struct brcmf_fws_info *fws = drvr->fws;
  16984. -+ struct brcmf_if *ifp;
  16985. -+ int i;
  16986. -
  16987. -- fws->bus_flow_blocked = flow_blocked;
  16988. -- if (!flow_blocked)
  16989. -- brcmf_fws_schedule_deq(fws);
  16990. -- else
  16991. -- fws->stats.bus_flow_block++;
  16992. -+ if (fws->avoid_queueing) {
  16993. -+ for (i = 0; i < BRCMF_MAX_IFS; i++) {
  16994. -+ ifp = drvr->iflist[i];
  16995. -+ if (!ifp || !ifp->ndev)
  16996. -+ continue;
  16997. -+ brcmf_txflowblock_if(ifp, BRCMF_NETIF_STOP_REASON_FLOW,
  16998. -+ flow_blocked);
  16999. -+ }
  17000. -+ } else {
  17001. -+ fws->bus_flow_blocked = flow_blocked;
  17002. -+ if (!flow_blocked)
  17003. -+ brcmf_fws_schedule_deq(fws);
  17004. -+ else
  17005. -+ fws->stats.bus_flow_block++;
  17006. -+ }
  17007. - }
  17008. 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
  17009. deleted file mode 100644
  17010. index a24c07f9731916f4bd3ff9bd3cb787d5982a1345..0000000000000000000000000000000000000000
  17011. --- a/package/kernel/mac80211/patches/351-0028-brcmfmac-defer-DPC-processing-during-probe.patch
  17012. +++ /dev/null
  17013. @@ -1,42 +0,0 @@
  17014. -From fd3ed33f51c2a586412d35b4f64803f019ab589f Mon Sep 17 00:00:00 2001
  17015. -From: Arend Van Spriel <arend.vanspriel@broadcom.com>
  17016. -Date: Fri, 15 Jul 2016 12:39:13 +0200
  17017. -Subject: [PATCH] brcmfmac: defer DPC processing during probe
  17018. -
  17019. -The sdio dpc starts processing when in SDIOD_STATE_DATA. This state was
  17020. -entered right after firmware download. This patch moves that transition
  17021. -just before enabling sdio interrupt handling thus avoiding watchdog
  17022. -expiry which would put the bus to sleep while probing.
  17023. -
  17024. -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  17025. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  17026. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  17027. -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  17028. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17029. ----
  17030. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 7 +++----
  17031. - 1 file changed, 3 insertions(+), 4 deletions(-)
  17032. -
  17033. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  17034. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  17035. -@@ -3304,10 +3304,6 @@ static int brcmf_sdio_download_firmware(
  17036. - goto err;
  17037. - }
  17038. -
  17039. -- /* Allow full data communication using DPC from now on. */
  17040. -- brcmf_sdiod_change_state(bus->sdiodev, BRCMF_SDIOD_DATA);
  17041. -- bcmerror = 0;
  17042. --
  17043. - err:
  17044. - brcmf_sdio_clkctl(bus, CLK_SDONLY, false);
  17045. - sdio_release_host(bus->sdiodev->func[1]);
  17046. -@@ -4045,6 +4041,9 @@ static void brcmf_sdio_firmware_callback
  17047. - }
  17048. -
  17049. - if (err == 0) {
  17050. -+ /* Allow full data communication using DPC from now on. */
  17051. -+ brcmf_sdiod_change_state(bus->sdiodev, BRCMF_SDIOD_DATA);
  17052. -+
  17053. - err = brcmf_sdiod_intr_register(sdiodev);
  17054. - if (err != 0)
  17055. - brcmf_err("intr register failed:%d\n", err);
  17056. 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
  17057. deleted file mode 100644
  17058. index ba9a349f0fd1874c5b038e4cc4d7f4cf2097ae47..0000000000000000000000000000000000000000
  17059. --- a/package/kernel/mac80211/patches/351-0029-brcmfmac-Fix-glob_skb-leak-in-brcmf_sdiod_recv_chain.patch
  17060. +++ /dev/null
  17061. @@ -1,32 +0,0 @@
  17062. -From 3bdae810721b33061d2e541bd78a70f86ca42af3 Mon Sep 17 00:00:00 2001
  17063. -From: Florian Fainelli <f.fainelli@gmail.com>
  17064. -Date: Mon, 18 Jul 2016 16:24:34 -0700
  17065. -Subject: [PATCH] brcmfmac: Fix glob_skb leak in brcmf_sdiod_recv_chain
  17066. -
  17067. -In case brcmf_sdiod_recv_chain() cannot complete a succeful call to
  17068. -brcmf_sdiod_buffrw, we would be leaking glom_skb and not free it as we
  17069. -should, fix this.
  17070. -
  17071. -Reported-by: coverity (CID 1164856)
  17072. -Fixes: a413e39a38573 ("brcmfmac: fix brcmf_sdcard_recv_chain() for host without sg support")
  17073. -Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
  17074. -Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  17075. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17076. ----
  17077. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 4 +++-
  17078. - 1 file changed, 3 insertions(+), 1 deletion(-)
  17079. -
  17080. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  17081. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  17082. -@@ -722,8 +722,10 @@ int brcmf_sdiod_recv_chain(struct brcmf_
  17083. - return -ENOMEM;
  17084. - err = brcmf_sdiod_buffrw(sdiodev, SDIO_FUNC_2, false, addr,
  17085. - glom_skb);
  17086. -- if (err)
  17087. -+ if (err) {
  17088. -+ brcmu_pkt_buf_free_skb(glom_skb);
  17089. - goto done;
  17090. -+ }
  17091. -
  17092. - skb_queue_walk(pktq, skb) {
  17093. - memcpy(skb->data, glom_skb->data, skb->len);
  17094. 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
  17095. deleted file mode 100644
  17096. index 540b7f08bf7c6b9c78f5b2ccfdae2a96dbaa4e6f..0000000000000000000000000000000000000000
  17097. --- a/package/kernel/mac80211/patches/351-0030-net-wireless-broadcom-brcm80211-brcmfmac-usb-don-t-p.patch
  17098. +++ /dev/null
  17099. @@ -1,34 +0,0 @@
  17100. -From 938f89e50a41c2d56710805fb019ad7618cef84b Mon Sep 17 00:00:00 2001
  17101. -From: Wolfram Sang <wsa-dev@sang-engineering.com>
  17102. -Date: Thu, 11 Aug 2016 23:05:31 +0200
  17103. -Subject: [PATCH] net: wireless: broadcom: brcm80211: brcmfmac: usb: don't
  17104. - print error when allocating urb fails
  17105. -
  17106. -kmalloc will print enough information in case of failure.
  17107. -
  17108. -Signed-off-by: Wolfram Sang <wsa-dev@sang-engineering.com>
  17109. -Signed-off-by: David S. Miller <davem@davemloft.net>
  17110. ----
  17111. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 8 ++------
  17112. - 1 file changed, 2 insertions(+), 6 deletions(-)
  17113. -
  17114. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
  17115. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
  17116. -@@ -1099,15 +1099,11 @@ struct brcmf_usbdev *brcmf_usb_attach(st
  17117. - devinfo->tx_freecount = ntxq;
  17118. -
  17119. - devinfo->ctl_urb = usb_alloc_urb(0, GFP_ATOMIC);
  17120. -- if (!devinfo->ctl_urb) {
  17121. -- brcmf_err("usb_alloc_urb (ctl) failed\n");
  17122. -+ if (!devinfo->ctl_urb)
  17123. - goto error;
  17124. -- }
  17125. - devinfo->bulk_urb = usb_alloc_urb(0, GFP_ATOMIC);
  17126. -- if (!devinfo->bulk_urb) {
  17127. -- brcmf_err("usb_alloc_urb (bulk) failed\n");
  17128. -+ if (!devinfo->bulk_urb)
  17129. - goto error;
  17130. -- }
  17131. -
  17132. - return &devinfo->bus_pub;
  17133. -
  17134. 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
  17135. deleted file mode 100644
  17136. index b98b68a88a23b85b69092979ac92ebf1e2b1a5d2..0000000000000000000000000000000000000000
  17137. --- a/package/kernel/mac80211/patches/351-0031-brcmfmac-Check-rtnl_lock-is-locked-when-removing-int.patch
  17138. +++ /dev/null
  17139. @@ -1,111 +0,0 @@
  17140. -From 15dacf880e49ce3ecee05eb1a0c6b8e363dbacdc Mon Sep 17 00:00:00 2001
  17141. -From: "mhiramat@kernel.org" <mhiramat@kernel.org>
  17142. -Date: Mon, 15 Aug 2016 18:40:57 +0900
  17143. -Subject: [PATCH] brcmfmac: Check rtnl_lock is locked when removing interface
  17144. -MIME-Version: 1.0
  17145. -Content-Type: text/plain; charset=UTF-8
  17146. -Content-Transfer-Encoding: 8bit
  17147. -
  17148. -Check rtnl_lock is locked in brcmf_p2p_ifp_removed() by passing
  17149. -rtnl_locked flag. Actually the caller brcmf_del_if() checks whether
  17150. -the rtnl_lock is locked, but doesn't pass it to brcmf_p2p_ifp_removed().
  17151. -
  17152. -Without this fix, wpa_supplicant goes softlockup with rtnl_lock
  17153. -holding (this means all other process using netlink are locked up too)
  17154. -
  17155. -e.g.
  17156. -[ 4495.876627] INFO: task wpa_supplicant:7307 blocked for more than 10 seconds.
  17157. -[ 4495.876632] Tainted: G W 4.8.0-rc1+ #8
  17158. -[ 4495.876635] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
  17159. -[ 4495.876638] wpa_supplicant D ffff974c647b39a0 0 7307 1 0x00000000
  17160. -[ 4495.876644] ffff974c647b39a0 0000000000000000 ffff974c00000000 ffff974c7dc59c58
  17161. -[ 4495.876651] ffff974c6b7417c0 ffff974c645017c0 ffff974c647b4000 ffffffff86f16c08
  17162. -[ 4495.876657] ffff974c645017c0 0000000000000246 00000000ffffffff ffff974c647b39b8
  17163. -[ 4495.876664] Call Trace:
  17164. -[ 4495.876671] [<ffffffff868aeccc>] schedule+0x3c/0x90
  17165. -[ 4495.876676] [<ffffffff868af065>] schedule_preempt_disabled+0x15/0x20
  17166. -[ 4495.876682] [<ffffffff868b0996>] mutex_lock_nested+0x176/0x3b0
  17167. -[ 4495.876686] [<ffffffff867a2067>] ? rtnl_lock+0x17/0x20
  17168. -[ 4495.876690] [<ffffffff867a2067>] rtnl_lock+0x17/0x20
  17169. -[ 4495.876720] [<ffffffffc0ae9a5d>] brcmf_p2p_ifp_removed+0x4d/0x70 [brcmfmac]
  17170. -[ 4495.876741] [<ffffffffc0aebde6>] brcmf_remove_interface+0x196/0x1b0 [brcmfmac]
  17171. -[ 4495.876760] [<ffffffffc0ae9901>] brcmf_p2p_del_vif+0x111/0x220 [brcmfmac]
  17172. -[ 4495.876777] [<ffffffffc0adefab>] brcmf_cfg80211_del_iface+0x21b/0x270 [brcmfmac]
  17173. -[ 4495.876820] [<ffffffffc097b39e>] nl80211_del_interface+0xfe/0x3a0 [cfg80211]
  17174. -[ 4495.876825] [<ffffffff867ca335>] genl_family_rcv_msg+0x1b5/0x370
  17175. -[ 4495.876832] [<ffffffff860e5d8d>] ? trace_hardirqs_on+0xd/0x10
  17176. -[ 4495.876836] [<ffffffff867ca56d>] genl_rcv_msg+0x7d/0xb0
  17177. -[ 4495.876839] [<ffffffff867ca4f0>] ? genl_family_rcv_msg+0x370/0x370
  17178. -[ 4495.876846] [<ffffffff867c9a47>] netlink_rcv_skb+0x97/0xb0
  17179. -[ 4495.876849] [<ffffffff867ca168>] genl_rcv+0x28/0x40
  17180. -[ 4495.876854] [<ffffffff867c93c3>] netlink_unicast+0x1d3/0x2f0
  17181. -[ 4495.876860] [<ffffffff867c933b>] ? netlink_unicast+0x14b/0x2f0
  17182. -[ 4495.876866] [<ffffffff867c97cb>] netlink_sendmsg+0x2eb/0x3a0
  17183. -[ 4495.876870] [<ffffffff8676dad8>] sock_sendmsg+0x38/0x50
  17184. -[ 4495.876874] [<ffffffff8676e4df>] ___sys_sendmsg+0x27f/0x290
  17185. -[ 4495.876882] [<ffffffff8628b935>] ? mntput_no_expire+0x5/0x3f0
  17186. -[ 4495.876888] [<ffffffff8628b9be>] ? mntput_no_expire+0x8e/0x3f0
  17187. -[ 4495.876894] [<ffffffff8628b935>] ? mntput_no_expire+0x5/0x3f0
  17188. -[ 4495.876899] [<ffffffff8628bd44>] ? mntput+0x24/0x40
  17189. -[ 4495.876904] [<ffffffff86267830>] ? __fput+0x190/0x200
  17190. -[ 4495.876909] [<ffffffff8676f125>] __sys_sendmsg+0x45/0x80
  17191. -[ 4495.876914] [<ffffffff8676f172>] SyS_sendmsg+0x12/0x20
  17192. -[ 4495.876918] [<ffffffff868b5680>] entry_SYSCALL_64_fastpath+0x23/0xc1
  17193. -[ 4495.876924] [<ffffffff860e2b8f>] ? trace_hardirqs_off_caller+0x1f/0xc0
  17194. -
  17195. -Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
  17196. -Acked-by: Rafał Miłecki <rafal@milecki.pl>
  17197. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17198. ----
  17199. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 2 +-
  17200. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c | 8 +++++---
  17201. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h | 2 +-
  17202. - 3 files changed, 7 insertions(+), 5 deletions(-)
  17203. -
  17204. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  17205. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  17206. -@@ -743,7 +743,7 @@ static void brcmf_del_if(struct brcmf_pu
  17207. - * serious troublesome side effects. The p2p module will clean
  17208. - * up the ifp if needed.
  17209. - */
  17210. -- brcmf_p2p_ifp_removed(ifp);
  17211. -+ brcmf_p2p_ifp_removed(ifp, rtnl_locked);
  17212. - kfree(ifp);
  17213. - }
  17214. - }
  17215. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  17216. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  17217. -@@ -2299,7 +2299,7 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  17218. - return err;
  17219. - }
  17220. -
  17221. --void brcmf_p2p_ifp_removed(struct brcmf_if *ifp)
  17222. -+void brcmf_p2p_ifp_removed(struct brcmf_if *ifp, bool rtnl_locked)
  17223. - {
  17224. - struct brcmf_cfg80211_info *cfg;
  17225. - struct brcmf_cfg80211_vif *vif;
  17226. -@@ -2308,9 +2308,11 @@ void brcmf_p2p_ifp_removed(struct brcmf_
  17227. - vif = ifp->vif;
  17228. - cfg = wdev_to_cfg(&vif->wdev);
  17229. - cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  17230. -- rtnl_lock();
  17231. -+ if (!rtnl_locked)
  17232. -+ rtnl_lock();
  17233. - cfg80211_unregister_wdev(&vif->wdev);
  17234. -- rtnl_unlock();
  17235. -+ if (!rtnl_locked)
  17236. -+ rtnl_unlock();
  17237. - brcmf_free_vif(vif);
  17238. - }
  17239. -
  17240. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h
  17241. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h
  17242. -@@ -155,7 +155,7 @@ struct wireless_dev *brcmf_p2p_add_vif(s
  17243. - int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev);
  17244. - int brcmf_p2p_ifchange(struct brcmf_cfg80211_info *cfg,
  17245. - enum brcmf_fil_p2p_if_types if_type);
  17246. --void brcmf_p2p_ifp_removed(struct brcmf_if *ifp);
  17247. -+void brcmf_p2p_ifp_removed(struct brcmf_if *ifp, bool rtnl_locked);
  17248. - int brcmf_p2p_start_device(struct wiphy *wiphy, struct wireless_dev *wdev);
  17249. - void brcmf_p2p_stop_device(struct wiphy *wiphy, struct wireless_dev *wdev);
  17250. - int brcmf_p2p_scan_prep(struct wiphy *wiphy,
  17251. 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
  17252. deleted file mode 100644
  17253. index 30ca25897d06fb2b26866255721377f5dbccfed0..0000000000000000000000000000000000000000
  17254. --- a/package/kernel/mac80211/patches/351-0032-brcmfmac-Change-vif_event_lock-to-spinlock.patch
  17255. +++ /dev/null
  17256. @@ -1,175 +0,0 @@
  17257. -From b64abcb7dae6060c67ab0e548da3ef923c49641d Mon Sep 17 00:00:00 2001
  17258. -From: "mhiramat@kernel.org" <mhiramat@kernel.org>
  17259. -Date: Mon, 15 Aug 2016 18:41:12 +0900
  17260. -Subject: [PATCH] brcmfmac: Change vif_event_lock to spinlock
  17261. -
  17262. -Change vif_event_lock to spinlock from mutex, since this lock is
  17263. -used in wait_event_timeout() via vif_event_equals(). This caused
  17264. -a warning report as below.
  17265. -
  17266. -As far as I can see, this lock protects regions where updating
  17267. -structure members, not function calls. Also, since those
  17268. -regions are not called from interrupt handlers (of course, it
  17269. -was a mutex), spin_lock is used instead of spin_lock_irqsave.
  17270. -
  17271. -[ 186.678550] ------------[ cut here ]------------
  17272. -[ 186.678556] WARNING: CPU: 2 PID: 7140 at /home/mhiramat/ksrc/linux/kernel/sched/core.c:7545 __might_sleep+0x7c/0x80
  17273. -[ 186.678560] do not call blocking ops when !TASK_RUNNING; state=2 set at [<ffffffff980d9090>] prepare_to_wait_event+0x60/0x100
  17274. -[ 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
  17275. -[ 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
  17276. -[ 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]
  17277. -[ 186.678646] CPU: 2 PID: 7140 Comm: wpa_supplicant Not tainted 4.8.0-rc1+ #8
  17278. -[ 186.678647] Hardware name: Dell Inc. XPS 15 9550/0N7TVV, BIOS 01.02.00 04/07/2016
  17279. -[ 186.678648] 0000000000000000 ffff9d8c64b5b900 ffffffff98442f23 ffff9d8c64b5b950
  17280. -[ 186.678651] 0000000000000000 ffff9d8c64b5b940 ffffffff9808b22b 00001d790000000d
  17281. -[ 186.678653] ffffffff98c75e78 000000000000026c 0000000000000000 ffff9d8c2706d058
  17282. -[ 186.678655] Call Trace:
  17283. -[ 186.678659] [<ffffffff98442f23>] dump_stack+0x85/0xc2
  17284. -[ 186.678666] [<ffffffff9808b22b>] __warn+0xcb/0xf0
  17285. -[ 186.678668] [<ffffffff9808b29f>] warn_slowpath_fmt+0x4f/0x60
  17286. -[ 186.678671] [<ffffffff980d9090>] ? prepare_to_wait_event+0x60/0x100
  17287. -[ 186.678672] [<ffffffff980d9090>] ? prepare_to_wait_event+0x60/0x100
  17288. -[ 186.678674] [<ffffffff980b922c>] __might_sleep+0x7c/0x80
  17289. -[ 186.678680] [<ffffffff988b0853>] mutex_lock_nested+0x33/0x3b0
  17290. -[ 186.678682] [<ffffffff980e5d8d>] ? trace_hardirqs_on+0xd/0x10
  17291. -[ 186.678689] [<ffffffffc0c57d2d>] brcmf_cfg80211_wait_vif_event+0xcd/0x130 [brcmfmac]
  17292. -[ 186.678691] [<ffffffff980d9190>] ? wake_atomic_t_function+0x60/0x60
  17293. -[ 186.678697] [<ffffffffc0c628e9>] brcmf_p2p_del_vif+0xf9/0x220 [brcmfmac]
  17294. -[ 186.678702] [<ffffffffc0c57fab>] brcmf_cfg80211_del_iface+0x21b/0x270 [brcmfmac]
  17295. -[ 186.678716] [<ffffffffc0b0539e>] nl80211_del_interface+0xfe/0x3a0 [cfg80211]
  17296. -[ 186.678718] [<ffffffff987ca335>] genl_family_rcv_msg+0x1b5/0x370
  17297. -[ 186.678720] [<ffffffff980e5d8d>] ? trace_hardirqs_on+0xd/0x10
  17298. -[ 186.678721] [<ffffffff987ca56d>] genl_rcv_msg+0x7d/0xb0
  17299. -[ 186.678722] [<ffffffff987ca4f0>] ? genl_family_rcv_msg+0x370/0x370
  17300. -[ 186.678724] [<ffffffff987c9a47>] netlink_rcv_skb+0x97/0xb0
  17301. -[ 186.678726] [<ffffffff987ca168>] genl_rcv+0x28/0x40
  17302. -[ 186.678727] [<ffffffff987c93c3>] netlink_unicast+0x1d3/0x2f0
  17303. -[ 186.678729] [<ffffffff987c933b>] ? netlink_unicast+0x14b/0x2f0
  17304. -[ 186.678731] [<ffffffff987c97cb>] netlink_sendmsg+0x2eb/0x3a0
  17305. -[ 186.678733] [<ffffffff9876dad8>] sock_sendmsg+0x38/0x50
  17306. -[ 186.678734] [<ffffffff9876e4df>] ___sys_sendmsg+0x27f/0x290
  17307. -[ 186.678737] [<ffffffff9828b935>] ? mntput_no_expire+0x5/0x3f0
  17308. -[ 186.678739] [<ffffffff9828b9be>] ? mntput_no_expire+0x8e/0x3f0
  17309. -[ 186.678741] [<ffffffff9828b935>] ? mntput_no_expire+0x5/0x3f0
  17310. -[ 186.678743] [<ffffffff9828bd44>] ? mntput+0x24/0x40
  17311. -[ 186.678744] [<ffffffff98267830>] ? __fput+0x190/0x200
  17312. -[ 186.678746] [<ffffffff9876f125>] __sys_sendmsg+0x45/0x80
  17313. -[ 186.678748] [<ffffffff9876f172>] SyS_sendmsg+0x12/0x20
  17314. -[ 186.678749] [<ffffffff988b5680>] entry_SYSCALL_64_fastpath+0x23/0xc1
  17315. -[ 186.678751] [<ffffffff980e2b8f>] ? trace_hardirqs_off_caller+0x1f/0xc0
  17316. -[ 186.678752] ---[ end trace e224d66c5d8408b5 ]---
  17317. -
  17318. -Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
  17319. -Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  17320. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17321. ----
  17322. - .../broadcom/brcm80211/brcmfmac/cfg80211.c | 26 +++++++++++-----------
  17323. - .../broadcom/brcm80211/brcmfmac/cfg80211.h | 2 +-
  17324. - 2 files changed, 14 insertions(+), 14 deletions(-)
  17325. -
  17326. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  17327. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  17328. -@@ -5555,7 +5555,7 @@ static s32 brcmf_notify_vif_event(struct
  17329. - ifevent->action, ifevent->flags, ifevent->ifidx,
  17330. - ifevent->bsscfgidx);
  17331. -
  17332. -- mutex_lock(&event->vif_event_lock);
  17333. -+ spin_lock(&event->vif_event_lock);
  17334. - event->action = ifevent->action;
  17335. - vif = event->vif;
  17336. -
  17337. -@@ -5563,7 +5563,7 @@ static s32 brcmf_notify_vif_event(struct
  17338. - case BRCMF_E_IF_ADD:
  17339. - /* waiting process may have timed out */
  17340. - if (!cfg->vif_event.vif) {
  17341. -- mutex_unlock(&event->vif_event_lock);
  17342. -+ spin_unlock(&event->vif_event_lock);
  17343. - return -EBADF;
  17344. - }
  17345. -
  17346. -@@ -5574,24 +5574,24 @@ static s32 brcmf_notify_vif_event(struct
  17347. - ifp->ndev->ieee80211_ptr = &vif->wdev;
  17348. - SET_NETDEV_DEV(ifp->ndev, wiphy_dev(cfg->wiphy));
  17349. - }
  17350. -- mutex_unlock(&event->vif_event_lock);
  17351. -+ spin_unlock(&event->vif_event_lock);
  17352. - wake_up(&event->vif_wq);
  17353. - return 0;
  17354. -
  17355. - case BRCMF_E_IF_DEL:
  17356. -- mutex_unlock(&event->vif_event_lock);
  17357. -+ spin_unlock(&event->vif_event_lock);
  17358. - /* event may not be upon user request */
  17359. - if (brcmf_cfg80211_vif_event_armed(cfg))
  17360. - wake_up(&event->vif_wq);
  17361. - return 0;
  17362. -
  17363. - case BRCMF_E_IF_CHANGE:
  17364. -- mutex_unlock(&event->vif_event_lock);
  17365. -+ spin_unlock(&event->vif_event_lock);
  17366. - wake_up(&event->vif_wq);
  17367. - return 0;
  17368. -
  17369. - default:
  17370. -- mutex_unlock(&event->vif_event_lock);
  17371. -+ spin_unlock(&event->vif_event_lock);
  17372. - break;
  17373. - }
  17374. - return -EINVAL;
  17375. -@@ -5712,7 +5712,7 @@ static void wl_deinit_priv(struct brcmf_
  17376. - static void init_vif_event(struct brcmf_cfg80211_vif_event *event)
  17377. - {
  17378. - init_waitqueue_head(&event->vif_wq);
  17379. -- mutex_init(&event->vif_event_lock);
  17380. -+ spin_lock_init(&event->vif_event_lock);
  17381. - }
  17382. -
  17383. - static s32 brcmf_dongle_roam(struct brcmf_if *ifp)
  17384. -@@ -6607,9 +6607,9 @@ static inline bool vif_event_equals(stru
  17385. - {
  17386. - u8 evt_action;
  17387. -
  17388. -- mutex_lock(&event->vif_event_lock);
  17389. -+ spin_lock(&event->vif_event_lock);
  17390. - evt_action = event->action;
  17391. -- mutex_unlock(&event->vif_event_lock);
  17392. -+ spin_unlock(&event->vif_event_lock);
  17393. - return evt_action == action;
  17394. - }
  17395. -
  17396. -@@ -6618,10 +6618,10 @@ void brcmf_cfg80211_arm_vif_event(struct
  17397. - {
  17398. - struct brcmf_cfg80211_vif_event *event = &cfg->vif_event;
  17399. -
  17400. -- mutex_lock(&event->vif_event_lock);
  17401. -+ spin_lock(&event->vif_event_lock);
  17402. - event->vif = vif;
  17403. - event->action = 0;
  17404. -- mutex_unlock(&event->vif_event_lock);
  17405. -+ spin_unlock(&event->vif_event_lock);
  17406. - }
  17407. -
  17408. - bool brcmf_cfg80211_vif_event_armed(struct brcmf_cfg80211_info *cfg)
  17409. -@@ -6629,9 +6629,9 @@ bool brcmf_cfg80211_vif_event_armed(stru
  17410. - struct brcmf_cfg80211_vif_event *event = &cfg->vif_event;
  17411. - bool armed;
  17412. -
  17413. -- mutex_lock(&event->vif_event_lock);
  17414. -+ spin_lock(&event->vif_event_lock);
  17415. - armed = event->vif != NULL;
  17416. -- mutex_unlock(&event->vif_event_lock);
  17417. -+ spin_unlock(&event->vif_event_lock);
  17418. -
  17419. - return armed;
  17420. - }
  17421. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  17422. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  17423. -@@ -227,7 +227,7 @@ struct escan_info {
  17424. - */
  17425. - struct brcmf_cfg80211_vif_event {
  17426. - wait_queue_head_t vif_wq;
  17427. -- struct mutex vif_event_lock;
  17428. -+ spinlock_t vif_event_lock;
  17429. - u8 action;
  17430. - struct brcmf_cfg80211_vif *vif;
  17431. - };
  17432. 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
  17433. deleted file mode 100644
  17434. index 1a7947b39a5eca626d2c79fecb627c52868f713b..0000000000000000000000000000000000000000
  17435. --- a/package/kernel/mac80211/patches/351-0033-brcmfmac-add-missing-header-dependencies.patch
  17436. +++ /dev/null
  17437. @@ -1,29 +0,0 @@
  17438. -From 8af92af3f2d55db143417a5d401696f4b642009a Mon Sep 17 00:00:00 2001
  17439. -From: Baoyou Xie <baoyou.xie@linaro.org>
  17440. -Date: Mon, 29 Aug 2016 20:39:35 +0800
  17441. -Subject: [PATCH] brcmfmac: add missing header dependencies
  17442. -
  17443. -We get 1 warning when building kernel with W=1:
  17444. -
  17445. -drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.c:23:6: warning: no previous prototype for '__brcmf_err' [-Wmissing-prototypes]
  17446. -
  17447. -In fact, this function is declared in brcmfmac/debug.h, so this patch
  17448. -adds missing header dependencies.
  17449. -
  17450. -Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
  17451. -Acked-by: Arnd Bergmann <arnd@arndb.de>
  17452. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17453. ----
  17454. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.c | 1 +
  17455. - 1 file changed, 1 insertion(+)
  17456. -
  17457. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.c
  17458. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.c
  17459. -@@ -19,6 +19,7 @@
  17460. - #ifndef __CHECKER__
  17461. - #define CREATE_TRACE_POINTS
  17462. - #include "tracepoint.h"
  17463. -+#include "debug.h"
  17464. -
  17465. - void __brcmf_err(const char *func, const char *fmt, ...)
  17466. - {
  17467. 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
  17468. deleted file mode 100644
  17469. index 24cd92a8bebfdffbb0e0d19b53a7c1cae4738ec1..0000000000000000000000000000000000000000
  17470. --- a/package/kernel/mac80211/patches/351-0034-brcmfmac-Add-USB-ID-for-Cisco-Linksys-AE1200.patch
  17471. +++ /dev/null
  17472. @@ -1,51 +0,0 @@
  17473. -From bccf3ffc8c6d8e0251a15541bb4d12b423c4f729 Mon Sep 17 00:00:00 2001
  17474. -From: Ismael Luceno <ismael@iodev.co.uk>
  17475. -Date: Mon, 22 Aug 2016 19:40:07 -0300
  17476. -Subject: [PATCH] brcmfmac: Add USB ID for Cisco Linksys AE1200
  17477. -
  17478. -The AE1200 comes with different revisions of the BCM43235 chipset,
  17479. -but all have the same USB ID. Only revision 3 can be supported.
  17480. -
  17481. -Signed-off-by: Ismael Luceno <ismael@iodev.co.uk>
  17482. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17483. ----
  17484. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 4 ++++
  17485. - drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h | 2 ++
  17486. - 2 files changed, 6 insertions(+)
  17487. -
  17488. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
  17489. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
  17490. -@@ -1456,11 +1456,15 @@ static int brcmf_usb_reset_resume(struct
  17491. - #define BRCMF_USB_DEVICE(dev_id) \
  17492. - { USB_DEVICE(BRCM_USB_VENDOR_ID_BROADCOM, dev_id) }
  17493. -
  17494. -+#define LINKSYS_USB_DEVICE(dev_id) \
  17495. -+ { USB_DEVICE(BRCM_USB_VENDOR_ID_LINKSYS, dev_id) }
  17496. -+
  17497. - static struct usb_device_id brcmf_usb_devid_table[] = {
  17498. - BRCMF_USB_DEVICE(BRCM_USB_43143_DEVICE_ID),
  17499. - BRCMF_USB_DEVICE(BRCM_USB_43236_DEVICE_ID),
  17500. - BRCMF_USB_DEVICE(BRCM_USB_43242_DEVICE_ID),
  17501. - BRCMF_USB_DEVICE(BRCM_USB_43569_DEVICE_ID),
  17502. -+ LINKSYS_USB_DEVICE(BRCM_USB_43235_LINKSYS_DEVICE_ID),
  17503. - { USB_DEVICE(BRCM_USB_VENDOR_ID_LG, BRCM_USB_43242_LG_DEVICE_ID) },
  17504. - /* special entry for device with firmware loaded and running */
  17505. - BRCMF_USB_DEVICE(BRCM_USB_BCMFW_DEVICE_ID),
  17506. ---- a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h
  17507. -+++ b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h
  17508. -@@ -22,6 +22,7 @@
  17509. -
  17510. - #define BRCM_USB_VENDOR_ID_BROADCOM 0x0a5c
  17511. - #define BRCM_USB_VENDOR_ID_LG 0x043e
  17512. -+#define BRCM_USB_VENDOR_ID_LINKSYS 0x13b1
  17513. - #define BRCM_PCIE_VENDOR_ID_BROADCOM PCI_VENDOR_ID_BROADCOM
  17514. -
  17515. - /* Chipcommon Core Chip IDs */
  17516. -@@ -56,6 +57,7 @@
  17517. -
  17518. - /* USB Device IDs */
  17519. - #define BRCM_USB_43143_DEVICE_ID 0xbd1e
  17520. -+#define BRCM_USB_43235_LINKSYS_DEVICE_ID 0x0039
  17521. - #define BRCM_USB_43236_DEVICE_ID 0xbd17
  17522. - #define BRCM_USB_43242_DEVICE_ID 0xbd1f
  17523. - #define BRCM_USB_43242_LG_DEVICE_ID 0x3101
  17524. 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
  17525. deleted file mode 100644
  17526. index b58a266a2542d44cb626ad4eef93dc56130d5900..0000000000000000000000000000000000000000
  17527. --- a/package/kernel/mac80211/patches/351-0035-brcmfmac-fix-pmksa-bssid-usage.patch
  17528. +++ /dev/null
  17529. @@ -1,51 +0,0 @@
  17530. -From 7703773ef1d85b40433902a8da20167331597e4a Mon Sep 17 00:00:00 2001
  17531. -From: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
  17532. -Date: Tue, 23 Aug 2016 11:37:17 +0200
  17533. -Subject: [PATCH] brcmfmac: fix pmksa->bssid usage
  17534. -
  17535. -The struct cfg80211_pmksa defines its bssid field as:
  17536. -
  17537. - const u8 *bssid;
  17538. -
  17539. -contrary to struct brcmf_pmksa, which uses:
  17540. -
  17541. - u8 bssid[ETH_ALEN];
  17542. -
  17543. -Therefore in brcmf_cfg80211_del_pmksa(), &pmksa->bssid takes the address
  17544. -of this field (of type u8**), not the one of its content (which would be
  17545. -u8*). Remove the & operator to make brcmf_dbg("%pM") and memcmp()
  17546. -behave as expected.
  17547. -
  17548. -This bug have been found using a custom static checker (which checks the
  17549. -usage of %p... attributes at build time). It has been introduced in
  17550. -commit 6c404f34f2bd ("brcmfmac: Cleanup pmksa cache handling code"),
  17551. -which replaced pmksa->bssid by &pmksa->bssid while refactoring the code,
  17552. -without modifying struct cfg80211_pmksa definition.
  17553. -
  17554. -Replace &pmk[i].bssid with pmk[i].bssid too to make the code clearer,
  17555. -this change does not affect the semantic.
  17556. -
  17557. -Fixes: 6c404f34f2bd ("brcmfmac: Cleanup pmksa cache handling code")
  17558. -Cc: stable@vger.kernel.org
  17559. -Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
  17560. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17561. ----
  17562. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 4 ++--
  17563. - 1 file changed, 2 insertions(+), 2 deletions(-)
  17564. -
  17565. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  17566. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  17567. -@@ -3804,11 +3804,11 @@ brcmf_cfg80211_del_pmksa(struct wiphy *w
  17568. - if (!check_vif_up(ifp->vif))
  17569. - return -EIO;
  17570. -
  17571. -- brcmf_dbg(CONN, "del_pmksa - PMK bssid = %pM\n", &pmksa->bssid);
  17572. -+ brcmf_dbg(CONN, "del_pmksa - PMK bssid = %pM\n", pmksa->bssid);
  17573. -
  17574. - npmk = le32_to_cpu(cfg->pmk_list.npmk);
  17575. - for (i = 0; i < npmk; i++)
  17576. -- if (!memcmp(&pmksa->bssid, &pmk[i].bssid, ETH_ALEN))
  17577. -+ if (!memcmp(pmksa->bssid, pmk[i].bssid, ETH_ALEN))
  17578. - break;
  17579. -
  17580. - if ((npmk > 0) && (i < npmk)) {
  17581. 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
  17582. deleted file mode 100644
  17583. index 760b6daf25ef57d3b777373b9695a909ec42b1d2..0000000000000000000000000000000000000000
  17584. --- a/package/kernel/mac80211/patches/351-0036-brcmfmac-avoid-potential-stack-overflow-in-brcmf_cfg.patch
  17585. +++ /dev/null
  17586. @@ -1,34 +0,0 @@
  17587. -From ded89912156b1a47d940a0c954c43afbabd0c42c Mon Sep 17 00:00:00 2001
  17588. -From: Arend Van Spriel <arend.vanspriel@broadcom.com>
  17589. -Date: Mon, 5 Sep 2016 10:45:47 +0100
  17590. -Subject: [PATCH] brcmfmac: avoid potential stack overflow in
  17591. - brcmf_cfg80211_start_ap()
  17592. -
  17593. -User-space can choose to omit NL80211_ATTR_SSID and only provide raw
  17594. -IE TLV data. When doing so it can provide SSID IE with length exceeding
  17595. -the allowed size. The driver further processes this IE copying it
  17596. -into a local variable without checking the length. Hence stack can be
  17597. -corrupted and used as exploit.
  17598. -
  17599. -Cc: stable@vger.kernel.org # v4.7
  17600. -Reported-by: Daxing Guo <freener.gdx@gmail.com>
  17601. -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  17602. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  17603. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  17604. -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  17605. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17606. ----
  17607. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 2 +-
  17608. - 1 file changed, 1 insertion(+), 1 deletion(-)
  17609. -
  17610. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  17611. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  17612. -@@ -4447,7 +4447,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  17613. - (u8 *)&settings->beacon.head[ie_offset],
  17614. - settings->beacon.head_len - ie_offset,
  17615. - WLAN_EID_SSID);
  17616. -- if (!ssid_ie)
  17617. -+ if (!ssid_ie || ssid_ie->len > IEEE80211_MAX_SSID_LEN)
  17618. - return -EINVAL;
  17619. -
  17620. - memcpy(ssid_le.SSID, ssid_ie->data, ssid_ie->len);
  17621. 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
  17622. deleted file mode 100644
  17623. index 1285b3096075e85a4c7c99592c73000244f75216..0000000000000000000000000000000000000000
  17624. --- a/package/kernel/mac80211/patches/351-0037-brcmfmac-add-support-for-bcm4339-chip-with-modalias-.patch
  17625. +++ /dev/null
  17626. @@ -1,55 +0,0 @@
  17627. -From 634faf3686900ccdee87b77e2c56df8b2159912b Mon Sep 17 00:00:00 2001
  17628. -From: Arend Van Spriel <arend.vanspriel@broadcom.com>
  17629. -Date: Mon, 5 Sep 2016 11:42:12 +0100
  17630. -Subject: [PATCH] brcmfmac: add support for bcm4339 chip with modalias
  17631. - sdio:c00v02D0d4339
  17632. -
  17633. -The driver already supports the bcm4339 chipset but only for the variant
  17634. -that shares the same modalias as the bcm4335, ie. sdio:c00v02D0d4335.
  17635. -It turns out that there are also bcm4339 devices out there that have a
  17636. -more distiguishable modalias sdio:c00v02D0d4339.
  17637. -
  17638. -Reported-by: Steve deRosier <derosier@gmail.com>
  17639. -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  17640. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  17641. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  17642. -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  17643. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17644. ----
  17645. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 1 +
  17646. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 3 ++-
  17647. - include/linux/mmc/sdio_ids.h | 1 +
  17648. - 3 files changed, 4 insertions(+), 1 deletion(-)
  17649. -
  17650. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  17651. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  17652. -@@ -1097,6 +1097,7 @@ static const struct sdio_device_id brcmf
  17653. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43341),
  17654. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43362),
  17655. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4335_4339),
  17656. -+ BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4339),
  17657. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43430),
  17658. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4345),
  17659. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4354),
  17660. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  17661. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  17662. -@@ -3756,7 +3756,8 @@ static u32 brcmf_sdio_buscore_read32(voi
  17663. - u32 val, rev;
  17664. -
  17665. - val = brcmf_sdiod_regrl(sdiodev, addr, NULL);
  17666. -- if (sdiodev->func[0]->device == SDIO_DEVICE_ID_BROADCOM_4335_4339 &&
  17667. -+ if ((sdiodev->func[0]->device == SDIO_DEVICE_ID_BROADCOM_4335_4339 ||
  17668. -+ sdiodev->func[0]->device == SDIO_DEVICE_ID_BROADCOM_4339) &&
  17669. - addr == CORE_CC_REG(SI_ENUM_BASE, chipid)) {
  17670. - rev = (val & CID_REV_MASK) >> CID_REV_SHIFT;
  17671. - if (rev >= 2) {
  17672. ---- a/include/linux/mmc/sdio_ids.h
  17673. -+++ b/include/linux/mmc/sdio_ids.h
  17674. -@@ -32,6 +32,7 @@
  17675. - #define SDIO_DEVICE_ID_BROADCOM_43340 0xa94c
  17676. - #define SDIO_DEVICE_ID_BROADCOM_43341 0xa94d
  17677. - #define SDIO_DEVICE_ID_BROADCOM_4335_4339 0x4335
  17678. -+#define SDIO_DEVICE_ID_BROADCOM_4339 0x4339
  17679. - #define SDIO_DEVICE_ID_BROADCOM_43362 0xa962
  17680. - #define SDIO_DEVICE_ID_BROADCOM_43430 0xa9a6
  17681. - #define SDIO_DEVICE_ID_BROADCOM_4345 0x4345
  17682. 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
  17683. deleted file mode 100644
  17684. index 1d5667ee6ed705db4dab6175207a9b0284167181..0000000000000000000000000000000000000000
  17685. --- a/package/kernel/mac80211/patches/351-0038-brcmfmac-sdio-shorten-retry-loop-in-brcmf_sdio_kso_c.patch
  17686. +++ /dev/null
  17687. @@ -1,56 +0,0 @@
  17688. -From 5251b6be8bb5c5675bdf12347c7b83937a5c91e5 Mon Sep 17 00:00:00 2001
  17689. -From: Arend Van Spriel <arend.vanspriel@broadcom.com>
  17690. -Date: Mon, 5 Sep 2016 11:42:13 +0100
  17691. -Subject: [PATCH] brcmfmac: sdio: shorten retry loop in
  17692. - brcmf_sdio_kso_control()
  17693. -
  17694. -In brcmf_sdio_kso_control() there is a retry loop as hardware may take
  17695. -time to settle. However, when the call to brcmf_sdiod_regrb() returns
  17696. -an error it is due to SDIO access failure and it makes no sense to wait
  17697. -for hardware to settle. This patch aborts the loop after a number of
  17698. -subsequent access errors.
  17699. -
  17700. -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  17701. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  17702. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  17703. -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  17704. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17705. ----
  17706. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 11 +++++++++--
  17707. - 1 file changed, 9 insertions(+), 2 deletions(-)
  17708. -
  17709. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  17710. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  17711. -@@ -313,6 +313,7 @@ struct rte_console {
  17712. -
  17713. - #define KSO_WAIT_US 50
  17714. - #define MAX_KSO_ATTEMPTS (PMU_MAX_TRANSITION_DLY/KSO_WAIT_US)
  17715. -+#define BRCMF_SDIO_MAX_ACCESS_ERRORS 5
  17716. -
  17717. - /*
  17718. - * Conversion of 802.1D priority to precedence level
  17719. -@@ -675,6 +676,7 @@ brcmf_sdio_kso_control(struct brcmf_sdio
  17720. - {
  17721. - u8 wr_val = 0, rd_val, cmp_val, bmask;
  17722. - int err = 0;
  17723. -+ int err_cnt = 0;
  17724. - int try_cnt = 0;
  17725. -
  17726. - brcmf_dbg(TRACE, "Enter: on=%d\n", on);
  17727. -@@ -710,9 +712,14 @@ brcmf_sdio_kso_control(struct brcmf_sdio
  17728. - */
  17729. - rd_val = brcmf_sdiod_regrb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR,
  17730. - &err);
  17731. -- if (((rd_val & bmask) == cmp_val) && !err)
  17732. -+ if (!err) {
  17733. -+ if ((rd_val & bmask) == cmp_val)
  17734. -+ break;
  17735. -+ err_cnt = 0;
  17736. -+ }
  17737. -+ /* bail out upon subsequent access errors */
  17738. -+ if (err && (err_cnt++ > BRCMF_SDIO_MAX_ACCESS_ERRORS))
  17739. - break;
  17740. --
  17741. - udelay(KSO_WAIT_US);
  17742. - brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR,
  17743. - wr_val, &err);
  17744. 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
  17745. deleted file mode 100644
  17746. index 1620e0022bbe0093c658948ca0b1c70677f61984..0000000000000000000000000000000000000000
  17747. --- a/package/kernel/mac80211/patches/351-0039-brcmfmac-ignore-11d-configuration-errors.patch
  17748. +++ /dev/null
  17749. @@ -1,84 +0,0 @@
  17750. -From b3589dfe02123a0d0ea82076a9f8ef84a46852c0 Mon Sep 17 00:00:00 2001
  17751. -From: Hante Meuleman <hante.meuleman@broadcom.com>
  17752. -Date: Mon, 19 Sep 2016 12:09:51 +0100
  17753. -Subject: [PATCH] brcmfmac: ignore 11d configuration errors
  17754. -
  17755. -802.11d is not always supported by firmware anymore. Currently the
  17756. -AP configuration of 11d will cause an abort if the ioctl set is
  17757. -failing. This behavior is not correct and the error should be
  17758. -ignored.
  17759. -
  17760. -Reviewed-by: Arend Van Spriel <arend.vanspriel@broadcom.com>
  17761. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  17762. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  17763. -Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
  17764. -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  17765. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17766. ----
  17767. - .../broadcom/brcm80211/brcmfmac/cfg80211.c | 27 ++++++++++++----------
  17768. - 1 file changed, 15 insertions(+), 12 deletions(-)
  17769. -
  17770. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  17771. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  17772. -@@ -4422,6 +4422,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  17773. - u16 chanspec = chandef_to_chanspec(&cfg->d11inf, &settings->chandef);
  17774. - bool mbss;
  17775. - int is_11d;
  17776. -+ bool supports_11d;
  17777. -
  17778. - brcmf_dbg(TRACE, "ctrlchn=%d, center=%d, bw=%d, beacon_interval=%d, dtim_period=%d,\n",
  17779. - settings->chandef.chan->hw_value,
  17780. -@@ -4434,11 +4435,16 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  17781. - mbss = ifp->vif->mbss;
  17782. -
  17783. - /* store current 11d setting */
  17784. -- brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_REGULATORY, &ifp->vif->is_11d);
  17785. -- country_ie = brcmf_parse_tlvs((u8 *)settings->beacon.tail,
  17786. -- settings->beacon.tail_len,
  17787. -- WLAN_EID_COUNTRY);
  17788. -- is_11d = country_ie ? 1 : 0;
  17789. -+ if (brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_REGULATORY,
  17790. -+ &ifp->vif->is_11d)) {
  17791. -+ supports_11d = false;
  17792. -+ } else {
  17793. -+ country_ie = brcmf_parse_tlvs((u8 *)settings->beacon.tail,
  17794. -+ settings->beacon.tail_len,
  17795. -+ WLAN_EID_COUNTRY);
  17796. -+ is_11d = country_ie ? 1 : 0;
  17797. -+ supports_11d = true;
  17798. -+ }
  17799. -
  17800. - memset(&ssid_le, 0, sizeof(ssid_le));
  17801. - if (settings->ssid == NULL || settings->ssid_len == 0) {
  17802. -@@ -4497,7 +4503,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  17803. -
  17804. - /* Parameters shared by all radio interfaces */
  17805. - if (!mbss) {
  17806. -- if (is_11d != ifp->vif->is_11d) {
  17807. -+ if ((supports_11d) && (is_11d != ifp->vif->is_11d)) {
  17808. - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY,
  17809. - is_11d);
  17810. - if (err < 0) {
  17811. -@@ -4539,7 +4545,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  17812. - brcmf_err("SET INFRA error %d\n", err);
  17813. - goto exit;
  17814. - }
  17815. -- } else if (WARN_ON(is_11d != ifp->vif->is_11d)) {
  17816. -+ } else if (WARN_ON(supports_11d && (is_11d != ifp->vif->is_11d))) {
  17817. - /* Multiple-BSS should use same 11d configuration */
  17818. - err = -EINVAL;
  17819. - goto exit;
  17820. -@@ -4673,11 +4679,8 @@ static int brcmf_cfg80211_stop_ap(struct
  17821. - brcmf_err("setting INFRA mode failed %d\n", err);
  17822. - if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS))
  17823. - brcmf_fil_iovar_int_set(ifp, "mbss", 0);
  17824. -- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY,
  17825. -- ifp->vif->is_11d);
  17826. -- if (err < 0)
  17827. -- brcmf_err("restoring REGULATORY setting failed %d\n",
  17828. -- err);
  17829. -+ brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY,
  17830. -+ ifp->vif->is_11d);
  17831. - /* Bring device back up so it can be used again */
  17832. - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1);
  17833. - if (err < 0)
  17834. 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
  17835. deleted file mode 100644
  17836. index 9461164523fcc05daa4873274eb7378777612338..0000000000000000000000000000000000000000
  17837. --- a/package/kernel/mac80211/patches/351-0040-brcmfmac-rework-pointer-trickery-in-brcmf_proto_bcdc.patch
  17838. +++ /dev/null
  17839. @@ -1,32 +0,0 @@
  17840. -From 704d1c6b56f4ee2ad6a5f012a72a278d17c1a223 Mon Sep 17 00:00:00 2001
  17841. -From: Arend Van Spriel <arend.vanspriel@broadcom.com>
  17842. -Date: Mon, 19 Sep 2016 12:09:52 +0100
  17843. -Subject: [PATCH] brcmfmac: rework pointer trickery in
  17844. - brcmf_proto_bcdc_query_dcmd()
  17845. -
  17846. -The variable info is assigned to point to bcdc->msg[1], which is the
  17847. -same as pointing to bcdc->buf. As that is what we want to access
  17848. -make it clear by fixing the assignment. This also avoid out-of-bounds
  17849. -errors from static analyzers are bcdc->msg[1] is not in the structure
  17850. -definition.
  17851. -
  17852. -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  17853. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  17854. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  17855. -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  17856. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17857. ----
  17858. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c | 2 +-
  17859. - 1 file changed, 1 insertion(+), 1 deletion(-)
  17860. -
  17861. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
  17862. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
  17863. -@@ -194,7 +194,7 @@ retry:
  17864. - }
  17865. -
  17866. - /* Check info buffer */
  17867. -- info = (void *)&msg[1];
  17868. -+ info = (void *)&bcdc->buf[0];
  17869. -
  17870. - /* Copy info buffer */
  17871. - if (buf) {
  17872. 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
  17873. deleted file mode 100644
  17874. index 2ececdf1972d3e2769f4730bb846866d247d681f..0000000000000000000000000000000000000000
  17875. --- a/package/kernel/mac80211/patches/351-0041-brcmfmac-fix-memory-leak-in-brcmf_flowring_add_tdls_.patch
  17876. +++ /dev/null
  17877. @@ -1,39 +0,0 @@
  17878. -From bc981641360183990de59da17f9f560f9150b801 Mon Sep 17 00:00:00 2001
  17879. -From: Arend Van Spriel <arend.vanspriel@broadcom.com>
  17880. -Date: Mon, 19 Sep 2016 12:09:53 +0100
  17881. -Subject: [PATCH] brcmfmac: fix memory leak in brcmf_flowring_add_tdls_peer()
  17882. -
  17883. -In the error paths in brcmf_flowring_add_tdls_peer() the allocated
  17884. -resource should be freed.
  17885. -
  17886. -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  17887. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  17888. -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  17889. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17890. ----
  17891. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c | 8 ++++++--
  17892. - 1 file changed, 6 insertions(+), 2 deletions(-)
  17893. -
  17894. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c
  17895. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c
  17896. -@@ -495,14 +495,18 @@ void brcmf_flowring_add_tdls_peer(struct
  17897. - } else {
  17898. - search = flow->tdls_entry;
  17899. - if (memcmp(search->mac, peer, ETH_ALEN) == 0)
  17900. -- return;
  17901. -+ goto free_entry;
  17902. - while (search->next) {
  17903. - search = search->next;
  17904. - if (memcmp(search->mac, peer, ETH_ALEN) == 0)
  17905. -- return;
  17906. -+ goto free_entry;
  17907. - }
  17908. - search->next = tdls_entry;
  17909. - }
  17910. -
  17911. - flow->tdls_active = true;
  17912. -+ return;
  17913. -+
  17914. -+free_entry:
  17915. -+ kfree(tdls_entry);
  17916. - }
  17917. 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
  17918. deleted file mode 100644
  17919. index 529cc8df02771a6680f59382278f3d273f512457..0000000000000000000000000000000000000000
  17920. --- a/package/kernel/mac80211/patches/351-0042-brcmfmac-initialize-variable-in-brcmf_sdiod_regrl.patch
  17921. +++ /dev/null
  17922. @@ -1,28 +0,0 @@
  17923. -From 26305d3d7298d1ddf8fd4ce95a382aa90534f0a3 Mon Sep 17 00:00:00 2001
  17924. -From: Arend Van Spriel <arend.vanspriel@broadcom.com>
  17925. -Date: Mon, 19 Sep 2016 12:09:54 +0100
  17926. -Subject: [PATCH] brcmfmac: initialize variable in brcmf_sdiod_regrl()
  17927. -
  17928. -In case of an error the variable returned is uninitialized. The caller
  17929. -will probably check the error code before using it, but better assure
  17930. -it is set to zero.
  17931. -
  17932. -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  17933. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  17934. -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  17935. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17936. ----
  17937. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 2 +-
  17938. - 1 file changed, 1 insertion(+), 1 deletion(-)
  17939. -
  17940. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  17941. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  17942. -@@ -416,7 +416,7 @@ u8 brcmf_sdiod_regrb(struct brcmf_sdio_d
  17943. -
  17944. - u32 brcmf_sdiod_regrl(struct brcmf_sdio_dev *sdiodev, u32 addr, int *ret)
  17945. - {
  17946. -- u32 data;
  17947. -+ u32 data = 0;
  17948. - int retval;
  17949. -
  17950. - brcmf_dbg(SDIO, "addr:0x%08x\n", addr);
  17951. 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
  17952. deleted file mode 100644
  17953. index 67af30e4fd0684d57453e43b2751ac7e853066b5..0000000000000000000000000000000000000000
  17954. --- a/package/kernel/mac80211/patches/351-0043-brcmfmac-remove-worker-from-.ndo_set_mac_address-cal.patch
  17955. +++ /dev/null
  17956. @@ -1,107 +0,0 @@
  17957. -From 8fa5fdec09cd379c9ecb8972f344f8f308e0ccf3 Mon Sep 17 00:00:00 2001
  17958. -From: Arend Van Spriel <arend.vanspriel@broadcom.com>
  17959. -Date: Mon, 19 Sep 2016 12:09:55 +0100
  17960. -Subject: [PATCH] brcmfmac: remove worker from .ndo_set_mac_address() callback
  17961. -
  17962. -As it turns out there is no need to use a worker for the callback
  17963. -because it is not called from atomic context.
  17964. -
  17965. -Reported-by: Dan Williams <dcbw@redhat.com>
  17966. -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  17967. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  17968. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  17969. -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  17970. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17971. ----
  17972. - .../wireless/broadcom/brcm80211/brcmfmac/core.c | 39 ++++++++--------------
  17973. - .../wireless/broadcom/brcm80211/brcmfmac/core.h | 2 --
  17974. - 2 files changed, 13 insertions(+), 28 deletions(-)
  17975. -
  17976. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  17977. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  17978. -@@ -136,27 +136,6 @@ static void _brcmf_set_multicast_list(st
  17979. - err);
  17980. - }
  17981. -
  17982. --static void
  17983. --_brcmf_set_mac_address(struct work_struct *work)
  17984. --{
  17985. -- struct brcmf_if *ifp;
  17986. -- s32 err;
  17987. --
  17988. -- ifp = container_of(work, struct brcmf_if, setmacaddr_work);
  17989. --
  17990. -- brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx);
  17991. --
  17992. -- err = brcmf_fil_iovar_data_set(ifp, "cur_etheraddr", ifp->mac_addr,
  17993. -- ETH_ALEN);
  17994. -- if (err < 0) {
  17995. -- brcmf_err("Setting cur_etheraddr failed, %d\n", err);
  17996. -- } else {
  17997. -- brcmf_dbg(TRACE, "MAC address updated to %pM\n",
  17998. -- ifp->mac_addr);
  17999. -- memcpy(ifp->ndev->dev_addr, ifp->mac_addr, ETH_ALEN);
  18000. -- }
  18001. --}
  18002. --
  18003. - #if IS_ENABLED(CONFIG_IPV6)
  18004. - static void _brcmf_update_ndtable(struct work_struct *work)
  18005. - {
  18006. -@@ -190,10 +169,20 @@ static int brcmf_netdev_set_mac_address(
  18007. - {
  18008. - struct brcmf_if *ifp = netdev_priv(ndev);
  18009. - struct sockaddr *sa = (struct sockaddr *)addr;
  18010. -+ int err;
  18011. -
  18012. -- memcpy(&ifp->mac_addr, sa->sa_data, ETH_ALEN);
  18013. -- schedule_work(&ifp->setmacaddr_work);
  18014. -- return 0;
  18015. -+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx);
  18016. -+
  18017. -+ err = brcmf_fil_iovar_data_set(ifp, "cur_etheraddr", sa->sa_data,
  18018. -+ ETH_ALEN);
  18019. -+ if (err < 0) {
  18020. -+ brcmf_err("Setting cur_etheraddr failed, %d\n", err);
  18021. -+ } else {
  18022. -+ brcmf_dbg(TRACE, "updated to %pM\n", sa->sa_data);
  18023. -+ memcpy(ifp->mac_addr, sa->sa_data, ETH_ALEN);
  18024. -+ memcpy(ifp->ndev->dev_addr, ifp->mac_addr, ETH_ALEN);
  18025. -+ }
  18026. -+ return err;
  18027. - }
  18028. -
  18029. - static void brcmf_netdev_set_multicast_list(struct net_device *ndev)
  18030. -@@ -525,7 +514,6 @@ int brcmf_net_attach(struct brcmf_if *if
  18031. - /* set the mac address */
  18032. - memcpy(ndev->dev_addr, ifp->mac_addr, ETH_ALEN);
  18033. -
  18034. -- INIT_WORK(&ifp->setmacaddr_work, _brcmf_set_mac_address);
  18035. - INIT_WORK(&ifp->multicast_work, _brcmf_set_multicast_list);
  18036. - INIT_WORK(&ifp->ndoffload_work, _brcmf_update_ndtable);
  18037. -
  18038. -@@ -730,7 +718,6 @@ static void brcmf_del_if(struct brcmf_pu
  18039. - }
  18040. -
  18041. - if (ifp->ndev->netdev_ops == &brcmf_netdev_ops_pri) {
  18042. -- cancel_work_sync(&ifp->setmacaddr_work);
  18043. - cancel_work_sync(&ifp->multicast_work);
  18044. - cancel_work_sync(&ifp->ndoffload_work);
  18045. - }
  18046. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  18047. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  18048. -@@ -176,7 +176,6 @@ enum brcmf_netif_stop_reason {
  18049. - * @vif: points to cfg80211 specific interface information.
  18050. - * @ndev: associated network device.
  18051. - * @stats: interface specific network statistics.
  18052. -- * @setmacaddr_work: worker object for setting mac address.
  18053. - * @multicast_work: worker object for multicast provisioning.
  18054. - * @ndoffload_work: worker object for neighbor discovery offload configuration.
  18055. - * @fws_desc: interface specific firmware-signalling descriptor.
  18056. -@@ -193,7 +192,6 @@ struct brcmf_if {
  18057. - struct brcmf_cfg80211_vif *vif;
  18058. - struct net_device *ndev;
  18059. - struct net_device_stats stats;
  18060. -- struct work_struct setmacaddr_work;
  18061. - struct work_struct multicast_work;
  18062. - struct work_struct ndoffload_work;
  18063. - struct brcmf_fws_mac_descriptor *fws_desc;
  18064. 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
  18065. deleted file mode 100644
  18066. index 5a0847932964cbbfec126aacc82cada1624d63f7..0000000000000000000000000000000000000000
  18067. --- a/package/kernel/mac80211/patches/351-0044-brcmfmac-remove-unnecessary-null-pointer-check.patch
  18068. +++ /dev/null
  18069. @@ -1,31 +0,0 @@
  18070. -From 835680b82f029818c813324aed3073cdcf63241f Mon Sep 17 00:00:00 2001
  18071. -From: Hante Meuleman <hante.meuleman@broadcom.com>
  18072. -Date: Mon, 19 Sep 2016 12:09:56 +0100
  18073. -Subject: [PATCH] brcmfmac: remove unnecessary null pointer check
  18074. -
  18075. -in the function brcmf_bus_start() in the exception handling a
  18076. -check is made to dermine whether ifp is null, though this is not
  18077. -possible. Removing the unnessary check.
  18078. -
  18079. -Reviewed-by: Arend Van Spriel <arend.vanspriel@broadcom.com>
  18080. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  18081. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  18082. -Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
  18083. -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  18084. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18085. ----
  18086. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 3 +--
  18087. - 1 file changed, 1 insertion(+), 2 deletions(-)
  18088. -
  18089. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  18090. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  18091. -@@ -1048,8 +1048,7 @@ fail:
  18092. - brcmf_fws_del_interface(ifp);
  18093. - brcmf_fws_deinit(drvr);
  18094. - }
  18095. -- if (ifp)
  18096. -- brcmf_net_detach(ifp->ndev, false);
  18097. -+ brcmf_net_detach(ifp->ndev, false);
  18098. - if (p2p_ifp)
  18099. - brcmf_net_detach(p2p_ifp->ndev, false);
  18100. - drvr->iflist[0] = NULL;
  18101. 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
  18102. deleted file mode 100644
  18103. index 0b3a23edc0839974750b3af21298b3fa20d7fc1b..0000000000000000000000000000000000000000
  18104. --- a/package/kernel/mac80211/patches/351-0045-brcmfmac-fix-clearing-entry-IPv6-address.patch
  18105. +++ /dev/null
  18106. @@ -1,37 +0,0 @@
  18107. -From 2b7425f3629b38c438f890c20c5faeca64b144ff Mon Sep 17 00:00:00 2001
  18108. -From: Hante Meuleman <hante.meuleman@broadcom.com>
  18109. -Date: Mon, 19 Sep 2016 12:09:57 +0100
  18110. -Subject: [PATCH] brcmfmac: fix clearing entry IPv6 address
  18111. -
  18112. -When IPv6 address is to be cleared there is a possible out of
  18113. -bound access. But also the clearing of the last entry and the
  18114. -adjustment of total number of stored IPv6 addresses is not
  18115. -updated. This patch fixes that bug. Bug was found using coverity.
  18116. -
  18117. -Reviewed-by: Arend Van Spriel <arend.vanspriel@broadcom.com>
  18118. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  18119. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  18120. -Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
  18121. -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  18122. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18123. ----
  18124. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 7 +++++--
  18125. - 1 file changed, 5 insertions(+), 2 deletions(-)
  18126. -
  18127. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  18128. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  18129. -@@ -873,9 +873,12 @@ static int brcmf_inet6addr_changed(struc
  18130. - }
  18131. - break;
  18132. - case NETDEV_DOWN:
  18133. -- if (i < NDOL_MAX_ENTRIES)
  18134. -- for (; i < ifp->ipv6addr_idx; i++)
  18135. -+ if (i < NDOL_MAX_ENTRIES) {
  18136. -+ for (; i < ifp->ipv6addr_idx - 1; i++)
  18137. - table[i] = table[i + 1];
  18138. -+ memset(&table[i], 0, sizeof(table[i]));
  18139. -+ ifp->ipv6addr_idx--;
  18140. -+ }
  18141. - break;
  18142. - default:
  18143. - break;
  18144. 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
  18145. deleted file mode 100644
  18146. index a47cb3266fe936dc8d1b30fae76cb54c8811e3e4..0000000000000000000000000000000000000000
  18147. --- a/package/kernel/mac80211/patches/351-0046-brcmfmac-fix-out-of-bound-access-on-clearing-wowl-wa.patch
  18148. +++ /dev/null
  18149. @@ -1,44 +0,0 @@
  18150. -From a7ed7828ecda0c2b5e0d7f55dedd4230afd4b583 Mon Sep 17 00:00:00 2001
  18151. -From: Hante Meuleman <hante.meuleman@broadcom.com>
  18152. -Date: Mon, 19 Sep 2016 12:09:58 +0100
  18153. -Subject: [PATCH] brcmfmac: fix out of bound access on clearing wowl wake
  18154. - indicator
  18155. -
  18156. -Clearing the wowl wakeindicator happens with a rather odd
  18157. -construction where the string "clear" is used to set the iovar
  18158. -wowl_wakeind. This was implemented incorrectly as it caused an
  18159. -out of bound access. Use an intermediate variable of correct
  18160. -length and copy string in that. Problem was found using coverity.
  18161. -
  18162. -Reviewed-by: Arend Van Spriel <arend.vanspriel@broadcom.com>
  18163. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  18164. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  18165. -Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
  18166. -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  18167. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18168. ----
  18169. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 6 ++++--
  18170. - 1 file changed, 4 insertions(+), 2 deletions(-)
  18171. -
  18172. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  18173. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  18174. -@@ -3623,6 +3623,7 @@ static void brcmf_configure_wowl(struct
  18175. - struct cfg80211_wowlan *wowl)
  18176. - {
  18177. - u32 wowl_config;
  18178. -+ struct brcmf_wowl_wakeind_le wowl_wakeind;
  18179. - u32 i;
  18180. -
  18181. - brcmf_dbg(TRACE, "Suspend, wowl config.\n");
  18182. -@@ -3664,8 +3665,9 @@ static void brcmf_configure_wowl(struct
  18183. - if (!test_bit(BRCMF_VIF_STATUS_CONNECTED, &ifp->vif->sme_state))
  18184. - wowl_config |= BRCMF_WOWL_UNASSOC;
  18185. -
  18186. -- brcmf_fil_iovar_data_set(ifp, "wowl_wakeind", "clear",
  18187. -- sizeof(struct brcmf_wowl_wakeind_le));
  18188. -+ memcpy(&wowl_wakeind, "clear", 6);
  18189. -+ brcmf_fil_iovar_data_set(ifp, "wowl_wakeind", &wowl_wakeind,
  18190. -+ sizeof(wowl_wakeind));
  18191. - brcmf_fil_iovar_int_set(ifp, "wowl", wowl_config);
  18192. - brcmf_fil_iovar_int_set(ifp, "wowl_activate", 1);
  18193. - brcmf_bus_wowl_config(cfg->pub->bus_if, true);
  18194. 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
  18195. deleted file mode 100644
  18196. index a652ae60b850540fb4f8996d912b0e8b6af06a9a..0000000000000000000000000000000000000000
  18197. --- a/package/kernel/mac80211/patches/351-0047-brcmfmac-simplify-mapping-of-auth-type.patch
  18198. +++ /dev/null
  18199. @@ -1,39 +0,0 @@
  18200. -From 92c313604711a0976def79dabb9e8da3cc2cc780 Mon Sep 17 00:00:00 2001
  18201. -From: Hante Meuleman <hante.meuleman@broadcom.com>
  18202. -Date: Mon, 19 Sep 2016 12:09:59 +0100
  18203. -Subject: [PATCH] brcmfmac: simplify mapping of auth type
  18204. -
  18205. -The 802.11 standard only has four valid auth type configurations of which
  18206. -our firmware only supports two, ie. Open System and Shared Key. Simplify
  18207. -the mapping falling back to automatic for other types specified by
  18208. -user-space.
  18209. -
  18210. -Reviewed-by: Arend Van Spriel <arend.vanspriel@broadcom.com>
  18211. -Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  18212. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  18213. -Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
  18214. -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  18215. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18216. ----
  18217. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 8 +-------
  18218. - 1 file changed, 1 insertion(+), 7 deletions(-)
  18219. -
  18220. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  18221. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  18222. -@@ -1577,15 +1577,9 @@ static s32 brcmf_set_auth_type(struct ne
  18223. - val = 1;
  18224. - brcmf_dbg(CONN, "shared key\n");
  18225. - break;
  18226. -- case NL80211_AUTHTYPE_AUTOMATIC:
  18227. -- val = 2;
  18228. -- brcmf_dbg(CONN, "automatic\n");
  18229. -- break;
  18230. -- case NL80211_AUTHTYPE_NETWORK_EAP:
  18231. -- brcmf_dbg(CONN, "network eap\n");
  18232. - default:
  18233. - val = 2;
  18234. -- brcmf_err("invalid auth type (%d)\n", sme->auth_type);
  18235. -+ brcmf_dbg(CONN, "automatic, auth type (%d)\n", sme->auth_type);
  18236. - break;
  18237. - }
  18238. -
  18239. 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
  18240. deleted file mode 100644
  18241. index a6fae378038dff7b672b82a21c0ed59f663473df..0000000000000000000000000000000000000000
  18242. --- a/package/kernel/mac80211/patches/351-0048-brcmfmac-fix-memory-leak-in-brcmf_fill_bss_param.patch
  18243. +++ /dev/null
  18244. @@ -1,41 +0,0 @@
  18245. -From 23e9c128adb2038c27a424a5f91136e7fa3e0dc6 Mon Sep 17 00:00:00 2001
  18246. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
  18247. -Date: Wed, 21 Sep 2016 08:23:24 +0200
  18248. -Subject: [PATCH] brcmfmac: fix memory leak in brcmf_fill_bss_param
  18249. -MIME-Version: 1.0
  18250. -Content-Type: text/plain; charset=UTF-8
  18251. -Content-Transfer-Encoding: 8bit
  18252. -
  18253. -This function is called from get_station callback which means that every
  18254. -time user space was getting/dumping station(s) we were leaking 2 KiB.
  18255. -
  18256. -Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
  18257. -Fixes: 1f0dc59a6de ("brcmfmac: rework .get_station() callback")
  18258. -Cc: stable@vger.kernel.org # 4.2+
  18259. -Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  18260. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18261. ----
  18262. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 5 ++++-
  18263. - 1 file changed, 4 insertions(+), 1 deletion(-)
  18264. -
  18265. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  18266. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  18267. -@@ -2463,7 +2463,7 @@ static void brcmf_fill_bss_param(struct
  18268. - WL_BSS_INFO_MAX);
  18269. - if (err) {
  18270. - brcmf_err("Failed to get bss info (%d)\n", err);
  18271. -- return;
  18272. -+ goto out_kfree;
  18273. - }
  18274. - si->filled |= BIT(NL80211_STA_INFO_BSS_PARAM);
  18275. - si->bss_param.beacon_interval = le16_to_cpu(buf->bss_le.beacon_period);
  18276. -@@ -2475,6 +2475,9 @@ static void brcmf_fill_bss_param(struct
  18277. - si->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_PREAMBLE;
  18278. - if (capability & WLAN_CAPABILITY_SHORT_SLOT_TIME)
  18279. - si->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_SLOT_TIME;
  18280. -+
  18281. -+out_kfree:
  18282. -+ kfree(buf);
  18283. - }
  18284. -
  18285. - static s32
  18286. 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
  18287. deleted file mode 100644
  18288. index 47af73ad29115ab80fe22cde35c127b86db8b8f5..0000000000000000000000000000000000000000
  18289. --- a/package/kernel/mac80211/patches/351-0049-brcmfmac-drop-unused-fields-from-struct-brcmf_pub.patch
  18290. +++ /dev/null
  18291. @@ -1,60 +0,0 @@
  18292. -From 2df86ad959c9d1cdbeb2f23a0801857731156692 Mon Sep 17 00:00:00 2001
  18293. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
  18294. -Date: Fri, 23 Sep 2016 15:27:46 +0200
  18295. -Subject: [PATCH] brcmfmac: drop unused fields from struct brcmf_pub
  18296. -MIME-Version: 1.0
  18297. -Content-Type: text/plain; charset=UTF-8
  18298. -Content-Transfer-Encoding: 8bit
  18299. -
  18300. -They seem to be there from the first day. We calculate these values but
  18301. -never use them.
  18302. -
  18303. -Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
  18304. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18305. ----
  18306. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 3 ---
  18307. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h | 4 ----
  18308. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c | 2 --
  18309. - 3 files changed, 9 deletions(-)
  18310. -
  18311. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  18312. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  18313. -@@ -508,9 +508,6 @@ int brcmf_net_attach(struct brcmf_if *if
  18314. - ndev->hard_header_len += drvr->hdrlen;
  18315. - ndev->ethtool_ops = &brcmf_ethtool_ops;
  18316. -
  18317. -- drvr->rxsz = ndev->mtu + ndev->hard_header_len +
  18318. -- drvr->hdrlen;
  18319. --
  18320. - /* set the mac address */
  18321. - memcpy(ndev->dev_addr, ifp->mac_addr, ETH_ALEN);
  18322. -
  18323. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  18324. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  18325. -@@ -112,15 +112,11 @@ struct brcmf_pub {
  18326. -
  18327. - /* Internal brcmf items */
  18328. - uint hdrlen; /* Total BRCMF header length (proto + bus) */
  18329. -- uint rxsz; /* Rx buffer size bus module should use */
  18330. -
  18331. - /* Dongle media info */
  18332. - char fwver[BRCMF_DRIVER_FIRMWARE_VERSION_LEN];
  18333. - u8 mac[ETH_ALEN]; /* MAC address obtained from dongle */
  18334. -
  18335. -- /* Multicast data packets sent to dongle */
  18336. -- unsigned long tx_multicast;
  18337. --
  18338. - struct mac_address addresses[BRCMF_MAX_IFS];
  18339. -
  18340. - struct brcmf_if *iflist[BRCMF_MAX_IFS];
  18341. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
  18342. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
  18343. -@@ -2104,8 +2104,6 @@ int brcmf_fws_process_skb(struct brcmf_i
  18344. - if (!skb->priority)
  18345. - skb->priority = cfg80211_classify8021d(skb, NULL);
  18346. -
  18347. -- drvr->tx_multicast += !!multicast;
  18348. --
  18349. - if (fws->avoid_queueing) {
  18350. - rc = brcmf_proto_txdata(drvr, ifp->ifidx, 0, skb);
  18351. - if (rc < 0)
  18352. 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
  18353. deleted file mode 100644
  18354. index ca4863a19500ccc0d1f7f21b6ef032c48097aeba..0000000000000000000000000000000000000000
  18355. --- a/package/kernel/mac80211/patches/351-0050-brcmfmac-replace-WARNING-on-timeout-with-a-simple-er.patch
  18356. +++ /dev/null
  18357. @@ -1,38 +0,0 @@
  18358. -From 2f0e56fa37cce60a5ac5d451bcadec51cd711436 Mon Sep 17 00:00:00 2001
  18359. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
  18360. -Date: Tue, 27 Sep 2016 12:12:24 +0200
  18361. -Subject: [PATCH] brcmfmac: replace WARNING on timeout with a simple error
  18362. - message
  18363. -MIME-Version: 1.0
  18364. -Content-Type: text/plain; charset=UTF-8
  18365. -Content-Transfer-Encoding: 8bit
  18366. -
  18367. -Even with timeout increased to 950 ms we get WARNINGs from time to time.
  18368. -It mostly happens on A-MPDU stalls (e.g. when station goes out of
  18369. -range). It may take up to 5-10 secods for the firmware to recover and
  18370. -for that time it doesn't process packets.
  18371. -
  18372. -It's still useful to have a message on time out as it may indicate some
  18373. -firmware problem and incorrect key update. Raising a WARNING however
  18374. -wasn't really that necessary, it doesn't point to any driver bug anymore
  18375. -and backtrace wasn't much useful.
  18376. -
  18377. -Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
  18378. -Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  18379. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18380. ----
  18381. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 3 ++-
  18382. - 1 file changed, 2 insertions(+), 1 deletion(-)
  18383. -
  18384. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  18385. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  18386. -@@ -1155,7 +1155,8 @@ int brcmf_netdev_wait_pend8021x(struct b
  18387. - !brcmf_get_pend_8021x_cnt(ifp),
  18388. - MAX_WAIT_FOR_8021X_TX);
  18389. -
  18390. -- WARN_ON(!err);
  18391. -+ if (!err)
  18392. -+ brcmf_err("Timed out waiting for no pending 802.1x packets\n");
  18393. -
  18394. - return !err;
  18395. - }
  18396. 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
  18397. deleted file mode 100644
  18398. index 697635941b6eb28bc99c89e589b4a530107d2fa3..0000000000000000000000000000000000000000
  18399. --- a/package/kernel/mac80211/patches/351-0051-brcmfmac-use-correct-skb-freeing-helper-when-deletin.patch
  18400. +++ /dev/null
  18401. @@ -1,58 +0,0 @@
  18402. -From 7f00ee2bbc630900ba16fc2690473f3e2db0e264 Mon Sep 17 00:00:00 2001
  18403. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
  18404. -Date: Tue, 27 Sep 2016 14:11:04 +0200
  18405. -Subject: [PATCH] brcmfmac: use correct skb freeing helper when deleting
  18406. - flowring
  18407. -MIME-Version: 1.0
  18408. -Content-Type: text/plain; charset=UTF-8
  18409. -Content-Transfer-Encoding: 8bit
  18410. -
  18411. -Flowrings contain skbs waiting for transmission that were passed to us
  18412. -by netif. It means we checked every one of them looking for 802.1x
  18413. -Ethernet type. When deleting flowring we have to use freeing function
  18414. -that will check for 802.1x type as well.
  18415. -
  18416. -Freeing skbs without a proper check was leading to counter not being
  18417. -properly decreased. This was triggering a WARNING every time
  18418. -brcmf_netdev_wait_pend8021x was called.
  18419. -
  18420. -Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
  18421. -Acked-by: Arend van Spriel <arend@broadcom.com>
  18422. -Cc: stable@vger.kernel.org # 4.5+
  18423. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18424. ----
  18425. - drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c | 9 ++++++++-
  18426. - 1 file changed, 8 insertions(+), 1 deletion(-)
  18427. -
  18428. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c
  18429. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c
  18430. -@@ -234,13 +234,20 @@ static void brcmf_flowring_block(struct
  18431. -
  18432. - void brcmf_flowring_delete(struct brcmf_flowring *flow, u16 flowid)
  18433. - {
  18434. -+ struct brcmf_bus *bus_if = dev_get_drvdata(flow->dev);
  18435. - struct brcmf_flowring_ring *ring;
  18436. -+ struct brcmf_if *ifp;
  18437. - u16 hash_idx;
  18438. -+ u8 ifidx;
  18439. - struct sk_buff *skb;
  18440. -
  18441. - ring = flow->rings[flowid];
  18442. - if (!ring)
  18443. - return;
  18444. -+
  18445. -+ ifidx = brcmf_flowring_ifidx_get(flow, flowid);
  18446. -+ ifp = brcmf_get_ifp(bus_if->drvr, ifidx);
  18447. -+
  18448. - brcmf_flowring_block(flow, flowid, false);
  18449. - hash_idx = ring->hash_id;
  18450. - flow->hash[hash_idx].ifidx = BRCMF_FLOWRING_INVALID_IFIDX;
  18451. -@@ -249,7 +256,7 @@ void brcmf_flowring_delete(struct brcmf_
  18452. -
  18453. - skb = skb_dequeue(&ring->skblist);
  18454. - while (skb) {
  18455. -- brcmu_pkt_buf_free_skb(skb);
  18456. -+ brcmf_txfinalize(ifp, skb, false);
  18457. - skb = skb_dequeue(&ring->skblist);
  18458. - }
  18459. -
  18460. diff --git a/package/kernel/mac80211/patches/402-ath_regd_optional.patch b/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  18461. index 735135307631290037afa6a00bab73a50fea78ba..463428371b4c96ee63b6eba1477023ff739c6129 100644
  18462. --- a/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  18463. +++ b/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  18464. @@ -8,7 +8,7 @@
  18465. + return;
  18466. +#endif
  18467. +
  18468. - for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
  18469. + for (band = 0; band < NUM_NL80211_BANDS; band++) {
  18470. if (!wiphy->bands[band])
  18471. continue;
  18472. @@ -374,6 +378,10 @@ ath_reg_apply_ir_flags(struct wiphy *wip
  18473. @@ -19,7 +19,7 @@
  18474. + return;
  18475. +#endif
  18476. +
  18477. - sband = wiphy->bands[IEEE80211_BAND_2GHZ];
  18478. + sband = wiphy->bands[NL80211_BAND_2GHZ];
  18479. if (!sband)
  18480. return;
  18481. @@ -402,6 +410,10 @@ static void ath_reg_apply_radar_flags(st
  18482. @@ -30,7 +30,7 @@
  18483. + return;
  18484. +#endif
  18485. +
  18486. - if (!wiphy->bands[IEEE80211_BAND_5GHZ])
  18487. + if (!wiphy->bands[NL80211_BAND_5GHZ])
  18488. return;
  18489. @@ -633,6 +645,11 @@ ath_regd_init_wiphy(struct ath_regulator
  18490. @@ -59,7 +59,7 @@
  18491. ---help---
  18492. --- a/.local-symbols
  18493. +++ b/.local-symbols
  18494. -@@ -125,6 +125,7 @@ ADM8211=
  18495. +@@ -127,6 +127,7 @@ ADM8211=
  18496. ATH_COMMON=
  18497. WLAN_VENDOR_ATH=
  18498. ATH_DEBUG=
  18499. 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
  18500. index 1a624849546ca40db86f27a5edc3ffe860b2280d..f2f52f93afcd9501df5170dad99905c5baef06bc 100644
  18501. --- a/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch
  18502. +++ b/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch
  18503. @@ -1,6 +1,6 @@
  18504. --- a/drivers/net/wireless/ath/ath9k/init.c
  18505. +++ b/drivers/net/wireless/ath/ath9k/init.c
  18506. -@@ -722,6 +722,7 @@ static const struct ieee80211_iface_limi
  18507. +@@ -727,6 +727,7 @@ static const struct ieee80211_iface_limi
  18508. BIT(NL80211_IFTYPE_AP) },
  18509. { .max = 1, .types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  18510. BIT(NL80211_IFTYPE_P2P_GO) },
  18511. diff --git a/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch b/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch
  18512. index a7f9d9f8b9706b0c2d359e09e3d3ef396764b3d3..f21eed18c3f1ff0ec43f42632bda1fd4c1236faf 100644
  18513. --- a/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch
  18514. +++ b/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch
  18515. @@ -1,6 +1,6 @@
  18516. --- a/drivers/net/wireless/ath/ath9k/debug.c
  18517. +++ b/drivers/net/wireless/ath/ath9k/debug.c
  18518. -@@ -1301,6 +1301,53 @@ void ath9k_deinit_debug(struct ath_softc
  18519. +@@ -1315,6 +1315,53 @@ void ath9k_deinit_debug(struct ath_softc
  18520. ath9k_cmn_spectral_deinit_debug(&sc->spec_priv);
  18521. }
  18522. @@ -54,7 +54,7 @@
  18523. int ath9k_init_debug(struct ath_hw *ah)
  18524. {
  18525. struct ath_common *common = ath9k_hw_common(ah);
  18526. -@@ -1320,6 +1367,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  18527. +@@ -1334,6 +1381,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  18528. ath9k_tx99_init_debug(sc);
  18529. ath9k_cmn_spectral_init_debug(&sc->spec_priv, sc->debug.debugfs_phy);
  18530. diff --git a/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch b/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch
  18531. index 5892c3e17a65ae7eea33fd44906a6eb8cb511c70..1825d77b7f83e4a5cf5922ba6fd314a4c8704759 100644
  18532. --- a/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch
  18533. +++ b/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch
  18534. @@ -1,6 +1,6 @@
  18535. --- a/drivers/net/wireless/ath/ath9k/init.c
  18536. +++ b/drivers/net/wireless/ath/ath9k/init.c
  18537. -@@ -1024,23 +1024,23 @@ static int __init ath9k_init(void)
  18538. +@@ -1030,23 +1030,23 @@ static int __init ath9k_init(void)
  18539. {
  18540. int error;
  18541. diff --git a/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch b/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch
  18542. index 6766111dfd3e43b2251a0248f256e97f8d5cbffa..15b8d7b86b137b9c5ba46ae5a7afc7ac5f455aaf 100644
  18543. --- a/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch
  18544. +++ b/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch
  18545. @@ -8,4 +8,4 @@
  18546. +#define ATH_RXBUF 256
  18547. #define ATH_TXBUF 512
  18548. #define ATH_TXBUF_RESERVE 5
  18549. - #define ATH_MAX_QDEPTH (ATH_TXBUF / 4 - ATH_TXBUF_RESERVE)
  18550. + #define ATH_TXMAXTRY 13
  18551. diff --git a/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch b/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch
  18552. index 5ecf528e598aff996c21b128d7fdcfecc6fa564f..c98072bac9cba922eac5031dede34116485ac435 100644
  18553. --- a/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch
  18554. +++ b/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch
  18555. @@ -1,6 +1,6 @@
  18556. --- a/drivers/net/wireless/ath/ath9k/debug.c
  18557. +++ b/drivers/net/wireless/ath/ath9k/debug.c
  18558. -@@ -1348,6 +1348,52 @@ static const struct file_operations fops
  18559. +@@ -1362,6 +1362,52 @@ static const struct file_operations fops
  18560. .owner = THIS_MODULE
  18561. };
  18562. @@ -53,7 +53,7 @@
  18563. int ath9k_init_debug(struct ath_hw *ah)
  18564. {
  18565. struct ath_common *common = ath9k_hw_common(ah);
  18566. -@@ -1369,6 +1415,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  18567. +@@ -1383,6 +1429,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  18568. debugfs_create_file("eeprom", S_IRUSR, sc->debug.debugfs_phy, sc,
  18569. &fops_eeprom);
  18570. @@ -90,7 +90,7 @@
  18571. ichan->channel = chan->center_freq;
  18572. ichan->chan = chan;
  18573. @@ -308,7 +310,19 @@ static void ath9k_cmn_update_ichannel(st
  18574. - if (chan->band == IEEE80211_BAND_5GHZ)
  18575. + if (chan->band == NL80211_BAND_5GHZ)
  18576. flags |= CHANNEL_5GHZ;
  18577. - switch (chandef->width) {
  18578. diff --git a/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch b/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
  18579. index c84d1bc8290e673d8366e3fcf9b97e84e634726a..167eeff2d2acfd98de87a8275bd56ef1c22928cd 100644
  18580. --- a/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
  18581. +++ b/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
  18582. @@ -20,7 +20,7 @@
  18583. #define AR9160_DEVID_PCI 0x0027
  18584. --- a/drivers/net/wireless/ath/ath9k/pci.c
  18585. +++ b/drivers/net/wireless/ath/ath9k/pci.c
  18586. -@@ -751,6 +751,7 @@ static const struct pci_device_id ath_pc
  18587. +@@ -761,6 +761,7 @@ static const struct pci_device_id ath_pc
  18588. .driver_data = ATH9K_PCI_BT_ANT_DIV },
  18589. #endif
  18590. diff --git a/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
  18591. index e151a12967ccf90d2de7cfde5728803b1069591c..c40598dde63b7c91cef9040e9927274cfd0c358a 100644
  18592. --- a/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
  18593. +++ b/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
  18594. @@ -1,6 +1,6 @@
  18595. --- a/include/net/cfg80211.h
  18596. +++ b/include/net/cfg80211.h
  18597. -@@ -2363,6 +2363,7 @@ struct cfg80211_qos_map {
  18598. +@@ -2410,6 +2410,7 @@ struct cfg80211_qos_map {
  18599. * (as advertised by the nl80211 feature flag.)
  18600. * @get_tx_power: store the current TX power into the dbm variable;
  18601. * return 0 if successful
  18602. @@ -8,7 +8,7 @@
  18603. *
  18604. * @set_wds_peer: set the WDS peer for a WDS interface
  18605. *
  18606. -@@ -2624,6 +2625,7 @@ struct cfg80211_ops {
  18607. +@@ -2671,6 +2672,7 @@ struct cfg80211_ops {
  18608. enum nl80211_tx_power_setting type, int mbm);
  18609. int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
  18610. int *dbm);
  18611. @@ -18,7 +18,7 @@
  18612. const u8 *addr);
  18613. --- a/include/net/mac80211.h
  18614. +++ b/include/net/mac80211.h
  18615. -@@ -1286,6 +1286,7 @@ enum ieee80211_smps_mode {
  18616. +@@ -1317,6 +1317,7 @@ enum ieee80211_smps_mode {
  18617. *
  18618. * @power_level: requested transmit power (in dBm), backward compatibility
  18619. * value only that is set to the minimum of all interfaces
  18620. @@ -26,7 +26,7 @@
  18621. *
  18622. * @chandef: the channel definition to tune to
  18623. * @radar_enabled: whether radar detection is enabled
  18624. -@@ -1306,6 +1307,7 @@ enum ieee80211_smps_mode {
  18625. +@@ -1337,6 +1338,7 @@ enum ieee80211_smps_mode {
  18626. struct ieee80211_conf {
  18627. u32 flags;
  18628. int power_level, dynamic_ps_timeout;
  18629. @@ -36,9 +36,9 @@
  18630. u8 ps_dtim_period;
  18631. --- a/include/uapi/linux/nl80211.h
  18632. +++ b/include/uapi/linux/nl80211.h
  18633. -@@ -1790,6 +1790,9 @@ enum nl80211_commands {
  18634. - * between scans. The scan plans are executed sequentially.
  18635. - * Each scan plan is a nested attribute of &enum nl80211_sched_scan_plan.
  18636. +@@ -1829,6 +1829,9 @@ enum nl80211_commands {
  18637. + * %NL80211_ATTR_EXT_CAPA_MASK, to specify the extended capabilities per
  18638. + * interface type.
  18639. *
  18640. + * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce
  18641. + * transmit power to stay within regulatory limits. u32, dBi.
  18642. @@ -46,9 +46,9 @@
  18643. * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  18644. * @NL80211_ATTR_MAX: highest attribute number currently defined
  18645. * @__NL80211_ATTR_AFTER_LAST: internal use
  18646. -@@ -2164,6 +2167,8 @@ enum nl80211_attrs {
  18647. - NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS,
  18648. - NL80211_ATTR_SCHED_SCAN_PLANS,
  18649. +@@ -2213,6 +2216,8 @@ enum nl80211_attrs {
  18650. +
  18651. + NL80211_ATTR_IFTYPE_EXT_CAPA,
  18652. + NL80211_ATTR_WIPHY_ANTENNA_GAIN,
  18653. +
  18654. @@ -57,7 +57,7 @@
  18655. __NL80211_ATTR_AFTER_LAST,
  18656. --- a/net/mac80211/cfg.c
  18657. +++ b/net/mac80211/cfg.c
  18658. -@@ -2229,6 +2229,19 @@ static int ieee80211_get_tx_power(struct
  18659. +@@ -2238,6 +2238,19 @@ static int ieee80211_get_tx_power(struct
  18660. return 0;
  18661. }
  18662. @@ -77,7 +77,7 @@
  18663. static int ieee80211_set_wds_peer(struct wiphy *wiphy, struct net_device *dev,
  18664. const u8 *addr)
  18665. {
  18666. -@@ -3403,6 +3416,7 @@ const struct cfg80211_ops mac80211_confi
  18667. +@@ -3412,6 +3425,7 @@ const struct cfg80211_ops mac80211_confi
  18668. .set_wiphy_params = ieee80211_set_wiphy_params,
  18669. .set_tx_power = ieee80211_set_tx_power,
  18670. .get_tx_power = ieee80211_get_tx_power,
  18671. @@ -87,7 +87,7 @@
  18672. CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd)
  18673. --- a/net/mac80211/ieee80211_i.h
  18674. +++ b/net/mac80211/ieee80211_i.h
  18675. -@@ -1318,6 +1318,7 @@ struct ieee80211_local {
  18676. +@@ -1338,6 +1338,7 @@ struct ieee80211_local {
  18677. int dynamic_ps_forced_timeout;
  18678. int user_power_level; /* in dBm, for all interfaces */
  18679. @@ -119,7 +119,7 @@
  18680. if (local->hw.conf.power_level != power) {
  18681. changed |= IEEE80211_CONF_CHANGE_POWER;
  18682. local->hw.conf.power_level = power;
  18683. -@@ -586,6 +592,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
  18684. +@@ -588,6 +594,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
  18685. IEEE80211_RADIOTAP_MCS_HAVE_BW;
  18686. local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI |
  18687. IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH;
  18688. @@ -129,15 +129,15 @@
  18689. local->user_power_level = IEEE80211_UNSET_POWER_LEVEL;
  18690. --- a/net/wireless/nl80211.c
  18691. +++ b/net/wireless/nl80211.c
  18692. -@@ -403,6 +403,7 @@ static const struct nla_policy nl80211_p
  18693. - [NL80211_ATTR_NETNS_FD] = { .type = NLA_U32 },
  18694. - [NL80211_ATTR_SCHED_SCAN_DELAY] = { .type = NLA_U32 },
  18695. - [NL80211_ATTR_REG_INDOOR] = { .type = NLA_FLAG },
  18696. +@@ -407,6 +407,7 @@ static const struct nla_policy nl80211_p
  18697. + [NL80211_ATTR_PBSS] = { .type = NLA_FLAG },
  18698. + [NL80211_ATTR_BSS_SELECT] = { .type = NLA_NESTED },
  18699. + [NL80211_ATTR_STA_SUPPORT_P2P_PS] = { .type = NLA_U8 },
  18700. + [NL80211_ATTR_WIPHY_ANTENNA_GAIN] = { .type = NLA_U32 },
  18701. };
  18702. /* policy for the key attributes */
  18703. -@@ -2220,6 +2221,20 @@ static int nl80211_set_wiphy(struct sk_b
  18704. +@@ -2294,6 +2295,20 @@ static int nl80211_set_wiphy(struct sk_b
  18705. if (result)
  18706. return result;
  18707. }
  18708. diff --git a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  18709. index 5a5e4643f5287e1426dd63a662b1f9b75cf22c80..0b257496082bab62ac43daf232f83628888e04ed 100644
  18710. --- a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  18711. +++ b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  18712. @@ -1,16 +1,16 @@
  18713. --- a/drivers/net/wireless/ath/ath9k/ath9k.h
  18714. +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  18715. @@ -814,6 +814,9 @@ static inline int ath9k_dump_btcoex(stru
  18716. + #ifdef CPTCFG_MAC80211_LEDS
  18717. void ath_init_leds(struct ath_softc *sc);
  18718. void ath_deinit_leds(struct ath_softc *sc);
  18719. - void ath_fill_led_pin(struct ath_softc *sc);
  18720. +int ath_create_gpio_led(struct ath_softc *sc, int gpio, const char *name,
  18721. -+ const char *trigger, bool active_low);
  18722. ++ const char *trigger, bool active_low);
  18723. +
  18724. #else
  18725. static inline void ath_init_leds(struct ath_softc *sc)
  18726. {
  18727. -@@ -953,6 +956,13 @@ void ath_ant_comb_scan(struct ath_softc
  18728. +@@ -950,6 +953,13 @@ void ath_ant_comb_scan(struct ath_softc
  18729. #define ATH9K_NUM_CHANCTX 2 /* supports 2 operating channels */
  18730. @@ -24,7 +24,7 @@
  18731. struct ath_softc {
  18732. struct ieee80211_hw *hw;
  18733. struct device *dev;
  18734. -@@ -1005,9 +1015,8 @@ struct ath_softc {
  18735. +@@ -1002,9 +1012,8 @@ struct ath_softc {
  18736. spinlock_t chan_lock;
  18737. #ifdef CPTCFG_MAC80211_LEDS
  18738. @@ -38,24 +38,33 @@
  18739. #ifdef CPTCFG_ATH9K_DEBUGFS
  18740. --- a/drivers/net/wireless/ath/ath9k/gpio.c
  18741. +++ b/drivers/net/wireless/ath/ath9k/gpio.c
  18742. -@@ -24,45 +24,102 @@
  18743. - static void ath_led_brightness(struct led_classdev *led_cdev,
  18744. - enum led_brightness brightness)
  18745. +@@ -22,7 +22,7 @@
  18746. +
  18747. + #ifdef CPTCFG_MAC80211_LEDS
  18748. +
  18749. +-void ath_fill_led_pin(struct ath_softc *sc)
  18750. ++static void ath_fill_led_pin(struct ath_softc *sc)
  18751. {
  18752. -- struct ath_softc *sc = container_of(led_cdev, struct ath_softc, led_cdev);
  18753. -- u32 val = (brightness == LED_OFF);
  18754. + struct ath_hw *ah = sc->sc_ah;
  18755. +
  18756. +@@ -39,61 +39,111 @@ void ath_fill_led_pin(struct ath_softc *
  18757. + else
  18758. + ah->led_pin = ATH_LED_PIN_DEF;
  18759. + }
  18760. ++}
  18761. ++
  18762. ++static void ath_led_brightness(struct led_classdev *led_cdev,
  18763. ++ enum led_brightness brightness)
  18764. ++{
  18765. + struct ath_led *led = container_of(led_cdev, struct ath_led, cdev);
  18766. + struct ath_softc *sc = led->sc;
  18767. -
  18768. -- if (sc->sc_ah->config.led_active_high)
  18769. -- val = !val;
  18770. ++
  18771. + ath9k_ps_wakeup(sc);
  18772. + ath9k_hw_set_gpio(sc->sc_ah, led->gpio->gpio,
  18773. + (brightness != LED_OFF) ^ led->gpio->active_low);
  18774. + ath9k_ps_restore(sc);
  18775. +}
  18776. -
  18777. -- ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, val);
  18778. ++
  18779. +static int ath_add_led(struct ath_softc *sc, struct ath_led *led)
  18780. +{
  18781. + const struct gpio_led *gpio = led->gpio;
  18782. @@ -71,30 +80,40 @@
  18783. +
  18784. + led->sc = sc;
  18785. + list_add(&led->list, &sc->leds);
  18786. -+
  18787. -+ /* Configure gpio for output */
  18788. -+ ath9k_hw_cfg_output(sc->sc_ah, gpio->gpio,
  18789. -+ AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
  18790. -+
  18791. +
  18792. + /* Configure gpio for output */
  18793. +- ath9k_hw_gpio_request_out(ah, ah->led_pin, "ath9k-led",
  18794. ++ ath9k_hw_gpio_request_out(sc->sc_ah, gpio->gpio, gpio->name,
  18795. + AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
  18796. +
  18797. +- /* LED off, active low */
  18798. +- ath9k_hw_set_gpio(ah, ah->led_pin, ah->config.led_active_high ? 0 : 1);
  18799. + /* LED off */
  18800. + ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low);
  18801. +
  18802. + return 0;
  18803. -+}
  18804. -+
  18805. + }
  18806. +
  18807. +-static void ath_led_brightness(struct led_classdev *led_cdev,
  18808. +- enum led_brightness brightness)
  18809. +int ath_create_gpio_led(struct ath_softc *sc, int gpio_num, const char *name,
  18810. + const char *trigger, bool active_low)
  18811. -+{
  18812. + {
  18813. +- struct ath_softc *sc = container_of(led_cdev, struct ath_softc, led_cdev);
  18814. +- u32 val = (brightness == LED_OFF);
  18815. + struct ath_led *led;
  18816. + struct gpio_led *gpio;
  18817. + char *_name;
  18818. + int ret;
  18819. -+
  18820. +
  18821. +- if (sc->sc_ah->config.led_active_high)
  18822. +- val = !val;
  18823. + led = kzalloc(sizeof(*led) + sizeof(*gpio) + strlen(name) + 1,
  18824. + GFP_KERNEL);
  18825. + if (!led)
  18826. + return -ENOMEM;
  18827. -+
  18828. +
  18829. +- ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, val);
  18830. + led->gpio = gpio = (struct gpio_led *) (led + 1);
  18831. + _name = (char *) (led->gpio + 1);
  18832. +
  18833. @@ -115,15 +134,18 @@
  18834. {
  18835. - if (!sc->led_registered)
  18836. - return;
  18837. -+ struct ath_led *led;
  18838. -
  18839. +-
  18840. - ath_led_brightness(&sc->led_cdev, LED_OFF);
  18841. - led_classdev_unregister(&sc->led_cdev);
  18842. ++ struct ath_led *led;
  18843. +
  18844. +- ath9k_hw_gpio_free(sc->sc_ah, sc->sc_ah->led_pin);
  18845. + while (!list_empty(&sc->leds)) {
  18846. + led = list_first_entry(&sc->leds, struct ath_led, list);
  18847. + list_del(&led->list);
  18848. + ath_led_brightness(&led->cdev, LED_OFF);
  18849. + led_classdev_unregister(&led->cdev);
  18850. ++ ath9k_hw_gpio_free(sc->sc_ah, led->gpio->gpio);
  18851. + kfree(led);
  18852. + }
  18853. }
  18854. @@ -139,6 +161,8 @@
  18855. if (AR_SREV_9100(sc->sc_ah))
  18856. return;
  18857. + ath_fill_led_pin(sc);
  18858. +
  18859. - if (!ath9k_led_blink)
  18860. - sc->led_cdev.default_trigger =
  18861. - ieee80211_get_radio_led_name(sc->hw);
  18862. @@ -159,13 +183,14 @@
  18863. + trigger = ieee80211_get_radio_led_name(sc->hw);
  18864. - sc->led_registered = true;
  18865. -+ ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, !sc->sc_ah->config.led_active_high);
  18866. ++ ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger,
  18867. ++ !sc->sc_ah->config.led_active_high);
  18868. }
  18869. + #endif
  18870. - void ath_fill_led_pin(struct ath_softc *sc)
  18871. --- a/drivers/net/wireless/ath/ath9k/init.c
  18872. +++ b/drivers/net/wireless/ath/ath9k/init.c
  18873. -@@ -936,7 +936,7 @@ int ath9k_init_device(u16 devid, struct
  18874. +@@ -942,7 +942,7 @@ int ath9k_init_device(u16 devid, struct
  18875. #ifdef CPTCFG_MAC80211_LEDS
  18876. /* must be initialized before ieee80211_register_hw */
  18877. @@ -176,7 +201,7 @@
  18878. #endif
  18879. --- a/drivers/net/wireless/ath/ath9k/debug.c
  18880. +++ b/drivers/net/wireless/ath/ath9k/debug.c
  18881. -@@ -1393,6 +1393,61 @@ static const struct file_operations fops
  18882. +@@ -1407,6 +1407,61 @@ static const struct file_operations fops
  18883. .llseek = default_llseek,
  18884. };
  18885. @@ -238,7 +263,7 @@
  18886. int ath9k_init_debug(struct ath_hw *ah)
  18887. {
  18888. -@@ -1417,6 +1472,10 @@ int ath9k_init_debug(struct ath_hw *ah)
  18889. +@@ -1431,6 +1486,10 @@ int ath9k_init_debug(struct ath_hw *ah)
  18890. &fops_eeprom);
  18891. debugfs_create_file("chanbw", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
  18892. sc, &fops_chanbw);
  18893. diff --git a/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch b/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch
  18894. index 7c10ea6b0d042db76b703e12356f53bea36e90de..f656697a077a417c7993bd41880f65b7b261fc99 100644
  18895. --- a/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch
  18896. +++ b/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch
  18897. @@ -1,6 +1,6 @@
  18898. --- a/include/linux/ath9k_platform.h
  18899. +++ b/include/linux/ath9k_platform.h
  18900. -@@ -41,6 +41,9 @@ struct ath9k_platform_data {
  18901. +@@ -45,6 +45,9 @@ struct ath9k_platform_data {
  18902. int (*external_reset)(void);
  18903. bool use_eeprom;
  18904. @@ -20,7 +20,7 @@
  18905. /********************************/
  18906. /* LED functions */
  18907. -@@ -88,6 +89,24 @@ int ath_create_gpio_led(struct ath_softc
  18908. +@@ -108,6 +109,24 @@ int ath_create_gpio_led(struct ath_softc
  18909. return ret;
  18910. }
  18911. @@ -45,7 +45,7 @@
  18912. void ath_deinit_leds(struct ath_softc *sc)
  18913. {
  18914. struct ath_led *led;
  18915. -@@ -103,8 +122,10 @@ void ath_deinit_leds(struct ath_softc *s
  18916. +@@ -124,8 +143,10 @@ void ath_deinit_leds(struct ath_softc *s
  18917. void ath_init_leds(struct ath_softc *sc)
  18918. {
  18919. @@ -56,10 +56,10 @@
  18920. INIT_LIST_HEAD(&sc->leds);
  18921. -@@ -120,6 +141,12 @@ void ath_init_leds(struct ath_softc *sc)
  18922. - trigger = ieee80211_get_radio_led_name(sc->hw);
  18923. +@@ -144,6 +165,12 @@ void ath_init_leds(struct ath_softc *sc)
  18924. - ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, !sc->sc_ah->config.led_active_high);
  18925. + ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger,
  18926. + !sc->sc_ah->config.led_active_high);
  18927. +
  18928. + if (!pdata)
  18929. + return;
  18930. @@ -67,5 +67,5 @@
  18931. + for (i = 0; i < pdata->num_leds; i++)
  18932. + ath_create_platform_led(sc, &pdata->leds[i]);
  18933. }
  18934. + #endif
  18935. - void ath_fill_led_pin(struct ath_softc *sc)
  18936. 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
  18937. index 6d62a2b1c2cdb716c9e207e219cad96075b82bac..50d8a7abae686b6b25ad561c71176b5661dbc437 100644
  18938. --- a/package/kernel/mac80211/patches/532-ath9k_get_led_polarity_from_platform_data.patch
  18939. +++ b/package/kernel/mac80211/patches/532-ath9k_get_led_polarity_from_platform_data.patch
  18940. @@ -1,6 +1,6 @@
  18941. --- a/include/linux/ath9k_platform.h
  18942. +++ b/include/linux/ath9k_platform.h
  18943. -@@ -36,6 +36,7 @@ struct ath9k_platform_data {
  18944. +@@ -40,6 +40,7 @@ struct ath9k_platform_data {
  18945. bool tx_gain_buffalo;
  18946. bool disable_2ghz;
  18947. bool disable_5ghz;
  18948. @@ -10,7 +10,7 @@
  18949. int (*external_reset)(void);
  18950. --- a/drivers/net/wireless/ath/ath9k/init.c
  18951. +++ b/drivers/net/wireless/ath/ath9k/init.c
  18952. -@@ -577,6 +577,7 @@ static int ath9k_init_softc(u16 devid, s
  18953. +@@ -580,6 +580,7 @@ static int ath9k_init_softc(u16 devid, s
  18954. ah->external_reset = pdata->external_reset;
  18955. ah->disable_2ghz = pdata->disable_2ghz;
  18956. ah->disable_5ghz = pdata->disable_5ghz;
  18957. 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
  18958. index 3c5e9f5fcda6cc16bcdbfe1a757f8a5c352eed15..c2d27815592ba1e09251e1c581e634c985750c5e 100644
  18959. --- a/package/kernel/mac80211/patches/541-ath9k_rx_dma_stop_check.patch
  18960. +++ b/package/kernel/mac80211/patches/541-ath9k_rx_dma_stop_check.patch
  18961. @@ -1,6 +1,6 @@
  18962. --- a/drivers/net/wireless/ath/ath9k/mac.c
  18963. +++ b/drivers/net/wireless/ath/ath9k/mac.c
  18964. -@@ -695,7 +695,7 @@ bool ath9k_hw_stopdmarecv(struct ath_hw
  18965. +@@ -698,7 +698,7 @@ bool ath9k_hw_stopdmarecv(struct ath_hw
  18966. {
  18967. #define AH_RX_STOP_DMA_TIMEOUT 10000 /* usec */
  18968. struct ath_common *common = ath9k_hw_common(ah);
  18969. @@ -9,7 +9,7 @@
  18970. int i;
  18971. /* Enable access to the DMA observation bus */
  18972. -@@ -725,6 +725,16 @@ bool ath9k_hw_stopdmarecv(struct ath_hw
  18973. +@@ -728,6 +728,16 @@ bool ath9k_hw_stopdmarecv(struct ath_hw
  18974. }
  18975. if (i == 0) {
  18976. diff --git a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  18977. index e83c6bfbf90d18577398c50fca1fa46b46e7822c..461564350feb43410e5c702a8a67514cdfaa3961 100644
  18978. --- a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  18979. +++ b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  18980. @@ -1,6 +1,6 @@
  18981. --- a/drivers/net/wireless/ath/ath9k/debug.c
  18982. +++ b/drivers/net/wireless/ath/ath9k/debug.c
  18983. -@@ -1449,6 +1449,50 @@ static const struct file_operations fops
  18984. +@@ -1463,6 +1463,50 @@ static const struct file_operations fops
  18985. #endif
  18986. @@ -51,7 +51,7 @@
  18987. int ath9k_init_debug(struct ath_hw *ah)
  18988. {
  18989. struct ath_common *common = ath9k_hw_common(ah);
  18990. -@@ -1476,6 +1520,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  18991. +@@ -1490,6 +1534,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  18992. debugfs_create_file("gpio_led", S_IWUSR,
  18993. sc->debug.debugfs_phy, sc, &fops_gpio_led);
  18994. #endif
  18995. @@ -62,7 +62,7 @@
  18996. debugfs_create_devm_seqfile(sc->dev, "interrupt", sc->debug.debugfs_phy,
  18997. --- a/drivers/net/wireless/ath/ath9k/hw.h
  18998. +++ b/drivers/net/wireless/ath/ath9k/hw.h
  18999. -@@ -519,6 +519,12 @@ enum {
  19000. +@@ -520,6 +520,12 @@ enum {
  19001. ATH9K_RESET_COLD,
  19002. };
  19003. @@ -75,7 +75,7 @@
  19004. struct ath9k_hw_version {
  19005. u32 magic;
  19006. u16 devid;
  19007. -@@ -804,6 +810,8 @@ struct ath_hw {
  19008. +@@ -805,6 +811,8 @@ struct ath_hw {
  19009. u32 rfkill_polarity;
  19010. u32 ah_flags;
  19011. @@ -84,7 +84,7 @@
  19012. bool reset_power_on;
  19013. bool htc_reset_init;
  19014. -@@ -1066,6 +1074,7 @@ void ath9k_hw_check_nav(struct ath_hw *a
  19015. +@@ -1068,6 +1076,7 @@ void ath9k_hw_check_nav(struct ath_hw *a
  19016. bool ath9k_hw_check_alive(struct ath_hw *ah);
  19017. bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode);
  19018. @@ -94,7 +94,7 @@
  19019. struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah,
  19020. --- a/drivers/net/wireless/ath/ath9k/hw.c
  19021. +++ b/drivers/net/wireless/ath/ath9k/hw.c
  19022. -@@ -1819,6 +1819,20 @@ u32 ath9k_hw_get_tsf_offset(struct times
  19023. +@@ -1841,6 +1841,20 @@ u32 ath9k_hw_get_tsf_offset(struct times
  19024. }
  19025. EXPORT_SYMBOL(ath9k_hw_get_tsf_offset);
  19026. @@ -115,7 +115,7 @@
  19027. int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
  19028. struct ath9k_hw_cal_data *caldata, bool fastcc)
  19029. {
  19030. -@@ -2027,6 +2041,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  19031. +@@ -2049,6 +2063,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  19032. ar9003_hw_disable_phy_restart(ah);
  19033. ath9k_hw_apply_gpio_override(ah);
  19034. diff --git a/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch b/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  19035. index d7bb5a12ce6f4135cdb7eaa951321cec48d221b8..656ed439b9b8aebd554e91f9963c2f6521651960 100644
  19036. --- a/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  19037. +++ b/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  19038. @@ -1,6 +1,6 @@
  19039. --- a/drivers/net/wireless/ath/ath9k/hw.h
  19040. +++ b/drivers/net/wireless/ath/ath9k/hw.h
  19041. -@@ -720,6 +720,7 @@ struct ath_spec_scan {
  19042. +@@ -721,6 +721,7 @@ struct ath_spec_scan {
  19043. * @config_pci_powersave:
  19044. * @calibrate: periodic calibration for NF, ANI, IQ, ADC gain, ADC-DC
  19045. *
  19046. @@ -8,7 +8,7 @@
  19047. * @spectral_scan_config: set parameters for spectral scan and enable/disable it
  19048. * @spectral_scan_trigger: trigger a spectral scan run
  19049. * @spectral_scan_wait: wait for a spectral scan run to finish
  19050. -@@ -742,6 +743,7 @@ struct ath_hw_ops {
  19051. +@@ -743,6 +744,7 @@ struct ath_hw_ops {
  19052. struct ath_hw_antcomb_conf *antconf);
  19053. void (*antdiv_comb_conf_set)(struct ath_hw *ah,
  19054. struct ath_hw_antcomb_conf *antconf);
  19055. @@ -18,7 +18,7 @@
  19056. void (*spectral_scan_trigger)(struct ath_hw *ah);
  19057. --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  19058. +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  19059. -@@ -1998,6 +1998,26 @@ void ar9003_hw_init_rate_txpower(struct
  19060. +@@ -1945,6 +1945,26 @@ void ar9003_hw_init_rate_txpower(struct
  19061. }
  19062. }
  19063. @@ -45,7 +45,7 @@
  19064. void ar9003_hw_attach_phy_ops(struct ath_hw *ah)
  19065. {
  19066. struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah);
  19067. -@@ -2034,6 +2054,7 @@ void ar9003_hw_attach_phy_ops(struct ath
  19068. +@@ -1981,6 +2001,7 @@ void ar9003_hw_attach_phy_ops(struct ath
  19069. priv_ops->set_radar_params = ar9003_hw_set_radar_params;
  19070. priv_ops->fast_chan_change = ar9003_hw_fast_chan_change;
  19071. @@ -55,9 +55,9 @@
  19072. ops->spectral_scan_config = ar9003_hw_spectral_scan_config;
  19073. --- a/drivers/net/wireless/ath/ath9k/init.c
  19074. +++ b/drivers/net/wireless/ath/ath9k/init.c
  19075. -@@ -711,7 +711,8 @@ static void ath9k_init_txpower_limits(st
  19076. +@@ -716,7 +716,8 @@ static void ath9k_init_txpower_limits(st
  19077. if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)
  19078. - ath9k_init_band_txpower(sc, IEEE80211_BAND_5GHZ);
  19079. + ath9k_init_band_txpower(sc, NL80211_BAND_5GHZ);
  19080. - ah->curchan = curchan;
  19081. + if (curchan)
  19082. @@ -65,7 +65,7 @@
  19083. }
  19084. static const struct ieee80211_iface_limit if_limits[] = {
  19085. -@@ -897,6 +898,18 @@ static void ath9k_set_hw_capab(struct at
  19086. +@@ -903,6 +904,18 @@ static void ath9k_set_hw_capab(struct at
  19087. SET_IEEE80211_PERM_ADDR(hw, common->macaddr);
  19088. }
  19089. @@ -84,7 +84,7 @@
  19090. int ath9k_init_device(u16 devid, struct ath_softc *sc,
  19091. const struct ath_bus_ops *bus_ops)
  19092. {
  19093. -@@ -942,6 +955,8 @@ int ath9k_init_device(u16 devid, struct
  19094. +@@ -948,6 +961,8 @@ int ath9k_init_device(u16 devid, struct
  19095. ARRAY_SIZE(ath9k_tpt_blink));
  19096. #endif
  19097. @@ -110,7 +110,7 @@
  19098. static inline void ath9k_hw_set_bt_ant_diversity(struct ath_hw *ah, bool enable)
  19099. --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  19100. +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  19101. -@@ -1327,9 +1327,30 @@ void ar5008_hw_init_rate_txpower(struct
  19102. +@@ -1325,9 +1325,30 @@ void ar5008_hw_init_rate_txpower(struct
  19103. }
  19104. }
  19105. @@ -141,7 +141,7 @@
  19106. static const u32 ar5416_cca_regs[6] = {
  19107. AR_PHY_CCA,
  19108. AR_PHY_CH1_CCA,
  19109. -@@ -1344,6 +1365,8 @@ int ar5008_hw_attach_phy_ops(struct ath_
  19110. +@@ -1342,6 +1363,8 @@ int ar5008_hw_attach_phy_ops(struct ath_
  19111. if (ret)
  19112. return ret;
  19113. @@ -175,7 +175,7 @@
  19114. #define AR_PHY_TIMING2 0x9810
  19115. #define AR_PHY_TIMING3 0x9814
  19116. #define AR_PHY_TIMING3_DSC_MAN 0xFFFE0000
  19117. -@@ -390,6 +399,8 @@
  19118. +@@ -393,6 +402,8 @@
  19119. #define AR_PHY_RFBUS_GRANT 0x9C20
  19120. #define AR_PHY_RFBUS_GRANT_EN 0x00000001
  19121. 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
  19122. index 8768c5d89a7b38d0e0a3c07dc94bf52edb480732..b9c962e1b5d13338ab4f7ddf6f370dbffeda299a 100644
  19123. --- a/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch
  19124. +++ b/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch
  19125. @@ -20,9 +20,9 @@
  19126. /******************/
  19127. /* Chip Revisions */
  19128. /******************/
  19129. -@@ -1397,6 +1410,9 @@ static bool ath9k_hw_set_reset(struct at
  19130. - if (AR_SREV_9100(ah))
  19131. +@@ -1417,6 +1430,9 @@ static bool ath9k_hw_set_reset(struct at
  19132. udelay(50);
  19133. + }
  19134. + if (AR_SREV_9330(ah) || AR_SREV_9340(ah))
  19135. + ath9k_hw_disable_pll_lock_detect(ah);
  19136. @@ -30,7 +30,7 @@
  19137. return true;
  19138. }
  19139. -@@ -1496,6 +1512,9 @@ static bool ath9k_hw_chip_reset(struct a
  19140. +@@ -1516,6 +1532,9 @@ static bool ath9k_hw_chip_reset(struct a
  19141. ar9003_hw_internal_regulator_apply(ah);
  19142. ath9k_hw_init_pll(ah, chan);
  19143. @@ -40,7 +40,7 @@
  19144. return true;
  19145. }
  19146. -@@ -1797,8 +1816,14 @@ static int ath9k_hw_do_fastcc(struct ath
  19147. +@@ -1819,8 +1838,14 @@ static int ath9k_hw_do_fastcc(struct ath
  19148. if (AR_SREV_9271(ah))
  19149. ar9002_hw_load_ani_reg(ah, chan);
  19150. @@ -55,7 +55,7 @@
  19151. return -EINVAL;
  19152. }
  19153. -@@ -2052,6 +2077,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  19154. +@@ -2074,6 +2099,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  19155. ath9k_hw_set_radar_params(ah);
  19156. }
  19157. diff --git a/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch b/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
  19158. index 3d24ccda1f83daee789973c101bd650df4c1694b..b639f972d83b8966812b98c7b99f546b187001fc 100644
  19159. --- a/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
  19160. +++ b/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
  19161. @@ -1,6 +1,6 @@
  19162. --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  19163. +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  19164. -@@ -956,55 +956,6 @@ static bool ar5008_hw_ani_control_new(st
  19165. +@@ -954,55 +954,6 @@ static bool ar5008_hw_ani_control_new(st
  19166. * on == 0 means more noise imm
  19167. */
  19168. u32 on = param ? 1 : 0;
  19169. @@ -58,7 +58,7 @@
  19170. REG_SET_BIT(ah, AR_PHY_SFCORR_LOW,
  19171. --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  19172. +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  19173. -@@ -41,20 +41,6 @@ static const int cycpwrThr1_table[] =
  19174. +@@ -42,20 +42,6 @@ static const int cycpwrThr1_table[] =
  19175. /* level: 0 1 2 3 4 5 6 7 8 */
  19176. { -6, -4, -2, 0, 2, 4, 6, 8 }; /* lvl 0-7, default 3 */
  19177. @@ -79,7 +79,7 @@
  19178. static const u8 ofdm2pwr[] = {
  19179. ALL_TARGET_LEGACY_6_24,
  19180. ALL_TARGET_LEGACY_6_24,
  19181. -@@ -1089,11 +1075,6 @@ static bool ar9003_hw_ani_control(struct
  19182. +@@ -1095,11 +1081,6 @@ static bool ar9003_hw_ani_control(struct
  19183. struct ath_common *common = ath9k_hw_common(ah);
  19184. struct ath9k_channel *chan = ah->curchan;
  19185. struct ar5416AniState *aniState = &ah->ani;
  19186. @@ -91,7 +91,7 @@
  19187. s32 value, value2;
  19188. switch (cmd & ah->ani_function) {
  19189. -@@ -1107,61 +1088,6 @@ static bool ar9003_hw_ani_control(struct
  19190. +@@ -1113,61 +1094,6 @@ static bool ar9003_hw_ani_control(struct
  19191. */
  19192. u32 on = param ? 1 : 0;
  19193. diff --git a/package/kernel/mac80211/patches/546-ath9k_platform_led_name.patch b/package/kernel/mac80211/patches/546-ath9k_platform_led_name.patch
  19194. new file mode 100644
  19195. index 0000000000000000000000000000000000000000..ced72c6c69fe30ebbc1c416c5e60d95dc985d6db
  19196. --- /dev/null
  19197. +++ b/package/kernel/mac80211/patches/546-ath9k_platform_led_name.patch
  19198. @@ -0,0 +1,39 @@
  19199. +From: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  19200. +Date: Sun, 31 Jan 2016 20:45:57 +0100
  19201. +Subject: [PATCH v4 1/8] mac80211: ath9k: enable platform WLAN LED name
  19202. +
  19203. +Enable platform-supplied WLAN LED name for ath9k device. It replaces generic
  19204. +'ath9k-phy*' label with string set during platform initialization.
  19205. +
  19206. +Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  19207. +---
  19208. + drivers/net/wireless/ath/ath9k/gpio.c | 10 +++++++---
  19209. + include/linux/ath9k_platform.h | 1 +
  19210. + 2 files changed, 8 insertions(+), 3 deletions(-)
  19211. +
  19212. +--- a/drivers/net/wireless/ath/ath9k/gpio.c
  19213. ++++ b/drivers/net/wireless/ath/ath9k/gpio.c
  19214. +@@ -155,8 +155,11 @@ void ath_init_leds(struct ath_softc *sc)
  19215. +
  19216. + ath_fill_led_pin(sc);
  19217. +
  19218. +- snprintf(led_name, sizeof(led_name), "ath9k-%s",
  19219. +- wiphy_name(sc->hw->wiphy));
  19220. ++ if (pdata && pdata->led_name)
  19221. ++ strncpy(led_name, pdata->led_name, sizeof(led_name));
  19222. ++ else
  19223. ++ snprintf(led_name, sizeof(led_name), "ath9k-%s",
  19224. ++ wiphy_name(sc->hw->wiphy));
  19225. +
  19226. + if (ath9k_led_blink)
  19227. + trigger = sc->led_default_trigger;
  19228. +--- a/include/linux/ath9k_platform.h
  19229. ++++ b/include/linux/ath9k_platform.h
  19230. +@@ -49,6 +49,7 @@ struct ath9k_platform_data {
  19231. +
  19232. + int num_leds;
  19233. + const struct gpio_led *leds;
  19234. ++ const char *led_name;
  19235. + };
  19236. +
  19237. + #endif /* _LINUX_ATH9K_PLATFORM_H */
  19238. diff --git a/package/kernel/mac80211/patches/547-ath9k_led_defstate_fix.patch b/package/kernel/mac80211/patches/547-ath9k_led_defstate_fix.patch
  19239. new file mode 100644
  19240. index 0000000000000000000000000000000000000000..5d84cf0c423a6138b0a48305006202f00e4bbdef
  19241. --- /dev/null
  19242. +++ b/package/kernel/mac80211/patches/547-ath9k_led_defstate_fix.patch
  19243. @@ -0,0 +1,29 @@
  19244. +From: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  19245. +Date: Sun, 31 Jan 2016 20:48:49 +0100
  19246. +Subject: [PATCH v4 2/8] mac80211: ath9k: set default state for platform LEDs
  19247. +
  19248. +Support default state for platform LEDs connected to ath9k device.
  19249. +Now LEDs are correctly set on or off at ath9k module initialization.
  19250. +Very useful if power LED is connected to wireless chip.
  19251. +
  19252. +Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  19253. +---
  19254. + gpio.c | 7 +++++--
  19255. + 1 file changed, 5 insertions(+), 2 deletions(-)
  19256. +
  19257. +--- a/drivers/net/wireless/ath/ath9k/gpio.c
  19258. ++++ b/drivers/net/wireless/ath/ath9k/gpio.c
  19259. +@@ -74,8 +74,11 @@ static int ath_add_led(struct ath_softc
  19260. + ath9k_hw_gpio_request_out(sc->sc_ah, gpio->gpio, gpio->name,
  19261. + AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
  19262. +
  19263. +- /* LED off */
  19264. +- ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low);
  19265. ++ /* Set default LED state */
  19266. ++ if (gpio->default_state == LEDS_GPIO_DEFSTATE_ON)
  19267. ++ ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, !gpio->active_low);
  19268. ++ else
  19269. ++ ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low);
  19270. +
  19271. + return 0;
  19272. + }
  19273. diff --git a/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch b/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch
  19274. new file mode 100644
  19275. index 0000000000000000000000000000000000000000..de7c0ac8f034402d6cae563ee3a6b1aafa184ab0
  19276. --- /dev/null
  19277. +++ b/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch
  19278. @@ -0,0 +1,234 @@
  19279. +From: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  19280. +Date: Sun, 31 Jan 2016 21:01:31 +0100
  19281. +Subject: [PATCH v4 4/8] mac80211: ath9k: enable access to GPIO
  19282. +
  19283. +Enable access to GPIO chip and its pins for Atheros AR92xx
  19284. +wireless devices. For now AR9285 and AR9287 are supported.
  19285. +
  19286. +Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  19287. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  19288. +---
  19289. +--- a/drivers/net/wireless/ath/ath9k/ath9k.h
  19290. ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  19291. +@@ -24,6 +24,7 @@
  19292. + #include <linux/completion.h>
  19293. + #include <linux/time.h>
  19294. + #include <linux/hw_random.h>
  19295. ++#include <linux/gpio/driver.h>
  19296. +
  19297. + #include "common.h"
  19298. + #include "debug.h"
  19299. +@@ -960,6 +961,14 @@ struct ath_led {
  19300. + struct led_classdev cdev;
  19301. + };
  19302. +
  19303. ++#ifdef CONFIG_GPIOLIB
  19304. ++struct ath9k_gpio_chip {
  19305. ++ struct ath_softc *sc;
  19306. ++ char label[32];
  19307. ++ struct gpio_chip gchip;
  19308. ++};
  19309. ++#endif
  19310. ++
  19311. + struct ath_softc {
  19312. + struct ieee80211_hw *hw;
  19313. + struct device *dev;
  19314. +@@ -1014,6 +1023,9 @@ struct ath_softc {
  19315. + #ifdef CPTCFG_MAC80211_LEDS
  19316. + const char *led_default_trigger;
  19317. + struct list_head leds;
  19318. ++#ifdef CONFIG_GPIOLIB
  19319. ++ struct ath9k_gpio_chip *gpiochip;
  19320. ++#endif
  19321. + #endif
  19322. +
  19323. + #ifdef CPTCFG_ATH9K_DEBUGFS
  19324. +--- a/drivers/net/wireless/ath/ath9k/gpio.c
  19325. ++++ b/drivers/net/wireless/ath/ath9k/gpio.c
  19326. +@@ -16,13 +16,135 @@
  19327. +
  19328. + #include "ath9k.h"
  19329. + #include <linux/ath9k_platform.h>
  19330. ++#include <linux/gpio.h>
  19331. ++
  19332. ++#ifdef CPTCFG_MAC80211_LEDS
  19333. ++
  19334. ++#ifdef CONFIG_GPIOLIB
  19335. ++
  19336. ++/***************/
  19337. ++/* GPIO Chip */
  19338. ++/***************/
  19339. ++
  19340. ++/* gpio_chip handler : set GPIO to input */
  19341. ++static int ath9k_gpio_pin_cfg_input(struct gpio_chip *chip, unsigned offset)
  19342. ++{
  19343. ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip,
  19344. ++ gchip);
  19345. ++
  19346. ++ ath9k_hw_gpio_request_in(gc->sc->sc_ah, offset, "ath9k-gpio");
  19347. ++
  19348. ++ return 0;
  19349. ++}
  19350. ++
  19351. ++/* gpio_chip handler : set GPIO to output */
  19352. ++static int ath9k_gpio_pin_cfg_output(struct gpio_chip *chip, unsigned offset,
  19353. ++ int value)
  19354. ++{
  19355. ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip,
  19356. ++ gchip);
  19357. ++
  19358. ++ ath9k_hw_gpio_request_out(gc->sc->sc_ah, offset, "ath9k-gpio",
  19359. ++ AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
  19360. ++ ath9k_hw_set_gpio(gc->sc->sc_ah, offset, value);
  19361. ++
  19362. ++ return 0;
  19363. ++}
  19364. ++
  19365. ++/* gpio_chip handler : query GPIO direction (0=out, 1=in) */
  19366. ++static int ath9k_gpio_pin_get_dir(struct gpio_chip *chip, unsigned offset)
  19367. ++{
  19368. ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip,
  19369. ++ gchip);
  19370. ++ struct ath_hw *ah = gc->sc->sc_ah;
  19371. ++
  19372. ++ return !((REG_READ(ah, AR_GPIO_OE_OUT) >> (offset * 2)) & 3);
  19373. ++}
  19374. ++
  19375. ++/* gpio_chip handler : get GPIO pin value */
  19376. ++static int ath9k_gpio_pin_get(struct gpio_chip *chip, unsigned offset)
  19377. ++{
  19378. ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip,
  19379. ++ gchip);
  19380. ++
  19381. ++ return ath9k_hw_gpio_get(gc->sc->sc_ah, offset);
  19382. ++}
  19383. ++
  19384. ++/* gpio_chip handler : set GPIO pin to value */
  19385. ++static void ath9k_gpio_pin_set(struct gpio_chip *chip, unsigned offset,
  19386. ++ int value)
  19387. ++{
  19388. ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip,
  19389. ++ gchip);
  19390. ++
  19391. ++ ath9k_hw_set_gpio(gc->sc->sc_ah, offset, value);
  19392. ++}
  19393. ++
  19394. ++/* register GPIO chip */
  19395. ++static void ath9k_register_gpio_chip(struct ath_softc *sc)
  19396. ++{
  19397. ++ struct ath9k_gpio_chip *gc;
  19398. ++ struct ath_hw *ah = sc->sc_ah;
  19399. ++
  19400. ++ gc = kzalloc(sizeof(struct ath9k_gpio_chip), GFP_KERNEL);
  19401. ++ if (!gc)
  19402. ++ return;
  19403. ++
  19404. ++ snprintf(gc->label, sizeof(gc->label), "ath9k-%s",
  19405. ++ wiphy_name(sc->hw->wiphy));
  19406. ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0)
  19407. ++ gc->gchip.parent = sc->dev;
  19408. ++#else
  19409. ++ gc->gchip.dev = sc->dev;
  19410. ++#endif
  19411. ++ gc->gchip.label = gc->label;
  19412. ++ gc->gchip.base = -1; /* determine base automatically */
  19413. ++ gc->gchip.ngpio = ah->caps.num_gpio_pins;
  19414. ++ gc->gchip.direction_input = ath9k_gpio_pin_cfg_input;
  19415. ++ gc->gchip.direction_output = ath9k_gpio_pin_cfg_output;
  19416. ++ gc->gchip.get_direction = ath9k_gpio_pin_get_dir;
  19417. ++ gc->gchip.get = ath9k_gpio_pin_get;
  19418. ++ gc->gchip.set = ath9k_gpio_pin_set;
  19419. ++
  19420. ++ if (gpiochip_add(&gc->gchip)) {
  19421. ++ kfree(gc);
  19422. ++ return;
  19423. ++ }
  19424. ++
  19425. ++ gc->gchip.owner = NULL;
  19426. ++ sc->gpiochip = gc;
  19427. ++ gc->sc = sc;
  19428. ++}
  19429. ++
  19430. ++/* remove GPIO chip */
  19431. ++static void ath9k_unregister_gpio_chip(struct ath_softc *sc)
  19432. ++{
  19433. ++ struct ath9k_gpio_chip *gc = sc->gpiochip;
  19434. ++
  19435. ++ if (!gc)
  19436. ++ return;
  19437. ++
  19438. ++ gpiochip_remove(&gc->gchip);
  19439. ++ kfree(gc);
  19440. ++ sc->gpiochip = NULL;
  19441. ++}
  19442. ++
  19443. ++#else /* CONFIG_GPIOLIB */
  19444. ++
  19445. ++static inline void ath9k_register_gpio_chip(struct ath_softc *sc)
  19446. ++{
  19447. ++}
  19448. ++
  19449. ++static inline void ath9k_unregister_gpio_chip(struct ath_softc *sc)
  19450. ++{
  19451. ++}
  19452. ++
  19453. ++#endif /* CONFIG_GPIOLIB */
  19454. +
  19455. + /********************************/
  19456. + /* LED functions */
  19457. + /********************************/
  19458. +
  19459. +-#ifdef CPTCFG_MAC80211_LEDS
  19460. +-
  19461. + static void ath_fill_led_pin(struct ath_softc *sc)
  19462. + {
  19463. + struct ath_hw *ah = sc->sc_ah;
  19464. +@@ -80,6 +202,12 @@ static int ath_add_led(struct ath_softc
  19465. + else
  19466. + ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low);
  19467. +
  19468. ++#ifdef CONFIG_GPIOLIB
  19469. ++ /* If there is GPIO chip configured, reserve LED pin */
  19470. ++ if (sc->gpiochip)
  19471. ++ gpio_request(sc->gpiochip->gchip.base + gpio->gpio, gpio->name);
  19472. ++#endif
  19473. ++
  19474. + return 0;
  19475. + }
  19476. +
  19477. +@@ -136,12 +264,18 @@ void ath_deinit_leds(struct ath_softc *s
  19478. +
  19479. + while (!list_empty(&sc->leds)) {
  19480. + led = list_first_entry(&sc->leds, struct ath_led, list);
  19481. ++#ifdef CONFIG_GPIOLIB
  19482. ++ /* If there is GPIO chip configured, free LED pin */
  19483. ++ if (sc->gpiochip)
  19484. ++ gpio_free(sc->gpiochip->gchip.base + led->gpio->gpio);
  19485. ++#endif
  19486. + list_del(&led->list);
  19487. + ath_led_brightness(&led->cdev, LED_OFF);
  19488. + led_classdev_unregister(&led->cdev);
  19489. + ath9k_hw_gpio_free(sc->sc_ah, led->gpio->gpio);
  19490. + kfree(led);
  19491. + }
  19492. ++ ath9k_unregister_gpio_chip(sc);
  19493. + }
  19494. +
  19495. + void ath_init_leds(struct ath_softc *sc)
  19496. +@@ -158,6 +292,8 @@ void ath_init_leds(struct ath_softc *sc)
  19497. +
  19498. + ath_fill_led_pin(sc);
  19499. +
  19500. ++ ath9k_register_gpio_chip(sc);
  19501. ++
  19502. + if (pdata && pdata->led_name)
  19503. + strncpy(led_name, pdata->led_name, sizeof(led_name));
  19504. + else
  19505. +@@ -178,6 +314,7 @@ void ath_init_leds(struct ath_softc *sc)
  19506. + for (i = 0; i < pdata->num_leds; i++)
  19507. + ath_create_platform_led(sc, &pdata->leds[i]);
  19508. + }
  19509. ++
  19510. + #endif
  19511. +
  19512. + /*******************/
  19513. diff --git a/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch b/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch
  19514. new file mode 100644
  19515. index 0000000000000000000000000000000000000000..b9d18834393dca078e444950c77642095a83f401
  19516. --- /dev/null
  19517. +++ b/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch
  19518. @@ -0,0 +1,149 @@
  19519. +From: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  19520. +Subject: [PATCH v5 5/8] mac80211: ath9k: enable GPIO buttons
  19521. +
  19522. +Enable platform-defined GPIO button support for ath9k device.
  19523. +Key poller is activated for attached platform buttons.
  19524. +Requires ath9k GPIO chip access.
  19525. +
  19526. +Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  19527. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  19528. +---
  19529. +--- a/drivers/net/wireless/ath/ath9k/ath9k.h
  19530. ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  19531. +@@ -1025,6 +1025,7 @@ struct ath_softc {
  19532. + struct list_head leds;
  19533. + #ifdef CONFIG_GPIOLIB
  19534. + struct ath9k_gpio_chip *gpiochip;
  19535. ++ struct platform_device *btnpdev; /* gpio-keys-polled */
  19536. + #endif
  19537. + #endif
  19538. +
  19539. +--- a/drivers/net/wireless/ath/ath9k/gpio.c
  19540. ++++ b/drivers/net/wireless/ath/ath9k/gpio.c
  19541. +@@ -17,6 +17,8 @@
  19542. + #include "ath9k.h"
  19543. + #include <linux/ath9k_platform.h>
  19544. + #include <linux/gpio.h>
  19545. ++#include <linux/platform_device.h>
  19546. ++#include <linux/gpio_keys.h>
  19547. +
  19548. + #ifdef CPTCFG_MAC80211_LEDS
  19549. +
  19550. +@@ -129,6 +131,64 @@ static void ath9k_unregister_gpio_chip(s
  19551. + sc->gpiochip = NULL;
  19552. + }
  19553. +
  19554. ++/******************/
  19555. ++/* GPIO Buttons */
  19556. ++/******************/
  19557. ++
  19558. ++/* add GPIO buttons */
  19559. ++static void ath9k_init_buttons(struct ath_softc *sc)
  19560. ++{
  19561. ++ struct ath9k_platform_data *pdata = sc->dev->platform_data;
  19562. ++ struct platform_device *pdev;
  19563. ++ struct gpio_keys_platform_data gkpdata;
  19564. ++ struct gpio_keys_button *bt;
  19565. ++ int i;
  19566. ++
  19567. ++ if (!sc->gpiochip)
  19568. ++ return;
  19569. ++
  19570. ++ if (!pdata || !pdata->btns || !pdata->num_btns)
  19571. ++ return;
  19572. ++
  19573. ++ bt = devm_kmemdup(sc->dev, pdata->btns,
  19574. ++ pdata->num_btns * sizeof(struct gpio_keys_button),
  19575. ++ GFP_KERNEL);
  19576. ++ if (!bt)
  19577. ++ return;
  19578. ++
  19579. ++ for (i = 0; i < pdata->num_btns; i++) {
  19580. ++ ath9k_hw_gpio_request_in(sc->sc_ah, pdata->btns[i].gpio,
  19581. ++ "ath9k-gpio");
  19582. ++ bt[i].gpio = sc->gpiochip->gchip.base + pdata->btns[i].gpio;
  19583. ++ }
  19584. ++
  19585. ++ memset(&gkpdata, 0, sizeof(struct gpio_keys_platform_data));
  19586. ++ gkpdata.buttons = bt;
  19587. ++ gkpdata.nbuttons = pdata->num_btns;
  19588. ++ gkpdata.poll_interval = pdata->btn_poll_interval;
  19589. ++
  19590. ++ pdev = platform_device_register_data(sc->dev, "gpio-keys-polled",
  19591. ++ PLATFORM_DEVID_AUTO, &gkpdata,
  19592. ++ sizeof(gkpdata));
  19593. ++ if (!IS_ERR_OR_NULL(pdev))
  19594. ++ sc->btnpdev = pdev;
  19595. ++ else {
  19596. ++ sc->btnpdev = NULL;
  19597. ++ devm_kfree(sc->dev, bt);
  19598. ++ }
  19599. ++}
  19600. ++
  19601. ++/* remove GPIO buttons */
  19602. ++static void ath9k_deinit_buttons(struct ath_softc *sc)
  19603. ++{
  19604. ++ if (!sc->gpiochip || !sc->btnpdev)
  19605. ++ return;
  19606. ++
  19607. ++ platform_device_unregister(sc->btnpdev);
  19608. ++
  19609. ++ sc->btnpdev = NULL;
  19610. ++}
  19611. ++
  19612. + #else /* CONFIG_GPIOLIB */
  19613. +
  19614. + static inline void ath9k_register_gpio_chip(struct ath_softc *sc)
  19615. +@@ -139,6 +199,14 @@ static inline void ath9k_unregister_gpio
  19616. + {
  19617. + }
  19618. +
  19619. ++static inline void ath9k_init_buttons(struct ath_softc *sc)
  19620. ++{
  19621. ++}
  19622. ++
  19623. ++static inline void ath9k_deinit_buttons(struct ath_softc *sc)
  19624. ++{
  19625. ++}
  19626. ++
  19627. + #endif /* CONFIG_GPIOLIB */
  19628. +
  19629. + /********************************/
  19630. +@@ -262,6 +330,7 @@ void ath_deinit_leds(struct ath_softc *s
  19631. + {
  19632. + struct ath_led *led;
  19633. +
  19634. ++ ath9k_deinit_buttons(sc);
  19635. + while (!list_empty(&sc->leds)) {
  19636. + led = list_first_entry(&sc->leds, struct ath_led, list);
  19637. + #ifdef CONFIG_GPIOLIB
  19638. +@@ -293,6 +362,7 @@ void ath_init_leds(struct ath_softc *sc)
  19639. + ath_fill_led_pin(sc);
  19640. +
  19641. + ath9k_register_gpio_chip(sc);
  19642. ++ ath9k_init_buttons(sc);
  19643. +
  19644. + if (pdata && pdata->led_name)
  19645. + strncpy(led_name, pdata->led_name, sizeof(led_name));
  19646. +@@ -308,7 +378,7 @@ void ath_init_leds(struct ath_softc *sc)
  19647. + ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger,
  19648. + !sc->sc_ah->config.led_active_high);
  19649. +
  19650. +- if (!pdata)
  19651. ++ if (!pdata || !pdata->leds || !pdata->num_leds)
  19652. + return;
  19653. +
  19654. + for (i = 0; i < pdata->num_leds; i++)
  19655. +--- a/include/linux/ath9k_platform.h
  19656. ++++ b/include/linux/ath9k_platform.h
  19657. +@@ -50,6 +50,10 @@ struct ath9k_platform_data {
  19658. + int num_leds;
  19659. + const struct gpio_led *leds;
  19660. + const char *led_name;
  19661. ++
  19662. ++ unsigned num_btns;
  19663. ++ const struct gpio_keys_button *btns;
  19664. ++ unsigned btn_poll_interval;
  19665. + };
  19666. +
  19667. + #endif /* _LINUX_ATH9K_PLATFORM_H */
  19668. 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
  19669. index 82459091fe47c8b2fb17c88ed9cef1c1b9502280..db70a334bde149dd28461161f69b4f36623a9db4 100644
  19670. --- a/package/kernel/mac80211/patches/600-0002-rt2x00-rt2800lib-introduce-RT2800_HAS_HIGH_SHARED_ME.patch
  19671. +++ b/package/kernel/mac80211/patches/600-0002-rt2x00-rt2800lib-introduce-RT2800_HAS_HIGH_SHARED_ME.patch
  19672. @@ -24,7 +24,7 @@ Changes since v1:
  19673. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  19674. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  19675. -@@ -7722,6 +7722,7 @@ static int rt2800_probe_rt(struct rt2x00
  19676. +@@ -7726,6 +7726,7 @@ static int rt2800_probe_rt(struct rt2x00
  19677. int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev)
  19678. {
  19679. @@ -32,7 +32,7 @@ Changes since v1:
  19680. int retval;
  19681. u32 reg;
  19682. -@@ -7729,6 +7730,9 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  19683. +@@ -7733,6 +7734,9 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  19684. if (retval)
  19685. return retval;
  19686. 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
  19687. index 7abfcd16f2e68354cb990b85d75c792fe9468fcb..a3b62bcc14d62f0930e264fc61c7d7668964db88 100644
  19688. --- a/package/kernel/mac80211/patches/600-0003-rt2x00-rt2800-serialize-shared-memory-access.patch
  19689. +++ b/package/kernel/mac80211/patches/600-0003-rt2x00-rt2800-serialize-shared-memory-access.patch
  19690. @@ -239,7 +239,7 @@ Changes since v1: ---
  19691. msleep(1);
  19692. /*
  19693. -@@ -7726,6 +7774,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  19694. +@@ -7730,6 +7778,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  19695. int retval;
  19696. u32 reg;
  19697. @@ -248,7 +248,7 @@ Changes since v1: ---
  19698. retval = rt2800_probe_rt(rt2x00dev);
  19699. if (retval)
  19700. return retval;
  19701. -@@ -7809,8 +7859,11 @@ void rt2800_get_key_seq(struct ieee80211
  19702. +@@ -7813,8 +7863,11 @@ void rt2800_get_key_seq(struct ieee80211
  19703. return;
  19704. offset = MAC_IVEIV_ENTRY(key->hw_key_idx);
  19705. 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
  19706. index 02b2acfeee4c40af3f4739362d12ca0ce7f5e587..f41a160d3f953fca0695d8dadfca589f810a24e6 100644
  19707. --- a/package/kernel/mac80211/patches/600-0005-rt2x00-rt2800lib-add-hw_beacon_count-field-to-struct.patch
  19708. +++ b/package/kernel/mac80211/patches/600-0005-rt2x00-rt2800lib-add-hw_beacon_count-field-to-struct.patch
  19709. @@ -41,7 +41,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19710. rt2800_clear_beacon_register(rt2x00dev, i);
  19711. if (rt2x00_is_usb(rt2x00dev)) {
  19712. -@@ -7827,6 +7828,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  19713. +@@ -7831,6 +7832,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  19714. if (rt2x00_rt(rt2x00dev, RT3593))
  19715. __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  19716. 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
  19717. index e90927271090fafef5f2e1b33be1a43f2a0eeba8..5099c64492e4f1c6f96657d4c738f094a919d7fc 100644
  19718. --- a/package/kernel/mac80211/patches/600-0007-rt2x00-rt2800lib-fix-max-supported-beacon-count-for-.patch
  19719. +++ b/package/kernel/mac80211/patches/600-0007-rt2x00-rt2800lib-fix-max-supported-beacon-count-for-.patch
  19720. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19721. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  19722. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  19723. -@@ -7852,7 +7852,10 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  19724. +@@ -7856,7 +7856,10 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  19725. if (rt2x00_rt(rt2x00dev, RT3593))
  19726. __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  19727. 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
  19728. index 7fe38e0958a170f6f127fedc3764a0df87163180..a2e701527b99a4e9f1f8beb3a0fffd48d07c0bef 100644
  19729. --- a/package/kernel/mac80211/patches/600-0009-rt2x00-rt2800lib-enable-support-for-RT3883.patch
  19730. +++ b/package/kernel/mac80211/patches/600-0009-rt2x00-rt2800lib-enable-support-for-RT3883.patch
  19731. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19732. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  19733. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  19734. -@@ -7822,6 +7822,7 @@ static int rt2800_probe_rt(struct rt2x00
  19735. +@@ -7826,6 +7826,7 @@ static int rt2800_probe_rt(struct rt2x00
  19736. case RT3390:
  19737. case RT3572:
  19738. case RT3593:
  19739. 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
  19740. index 253a0c0c1e67def822917c469a41bea3b2d0c862..89bd0acb87a0599962efd1d82a61512d45890b4c 100644
  19741. --- a/package/kernel/mac80211/patches/600-0010-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch
  19742. +++ b/package/kernel/mac80211/patches/600-0010-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch
  19743. @@ -98,7 +98,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19744. static const struct rf_channel rf_vals_5592_xtal20[] = {
  19745. /* Channel, N, K, mod, R */
  19746. {1, 482, 4, 10, 3},
  19747. -@@ -7669,6 +7729,11 @@ static int rt2800_probe_hw_mode(struct r
  19748. +@@ -7673,6 +7733,11 @@ static int rt2800_probe_hw_mode(struct r
  19749. spec->channels = rf_vals_3x;
  19750. break;
  19751. 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
  19752. index f15c22b30f8e517e10f71c64082e8bea3a2b1d63..b7efc9f31bed7a4afd9a52d9f05b2aa4ca46e320 100644
  19753. --- a/package/kernel/mac80211/patches/600-0011-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch
  19754. +++ b/package/kernel/mac80211/patches/600-0011-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch
  19755. @@ -18,7 +18,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19756. case RF5360:
  19757. case RF5362:
  19758. case RF5370:
  19759. -@@ -7848,6 +7849,7 @@ static int rt2800_probe_hw_mode(struct r
  19760. +@@ -7852,6 +7853,7 @@ static int rt2800_probe_hw_mode(struct r
  19761. case RF3053:
  19762. case RF3070:
  19763. case RF3290:
  19764. 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
  19765. index 6ce224aba27242f5e55030a396ea044d16528653..220e35fe4c201bed6678fb4a8e293563c41c1240 100644
  19766. --- a/package/kernel/mac80211/patches/600-0026-rt2x00-rt2800lib-use-correct-beacon-count-for-RT3883.patch
  19767. +++ b/package/kernel/mac80211/patches/600-0026-rt2x00-rt2800lib-use-correct-beacon-count-for-RT3883.patch
  19768. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19769. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  19770. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  19771. -@@ -8403,7 +8403,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  19772. +@@ -8407,7 +8407,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  19773. if (rt2x00_rt(rt2x00dev, RT3593))
  19774. __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  19775. 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
  19776. index 25753af81b2bf911fec969118e81c90a6c95e975..2ffa5a4162f65c0451e2462842c5801fade1c25d 100644
  19777. --- a/package/kernel/mac80211/patches/600-0032-rt2x00-rt2800lib-enable-RT2800_HAS_HIGH_SHARED_MEM-f.patch
  19778. +++ b/package/kernel/mac80211/patches/600-0032-rt2x00-rt2800lib-enable-RT2800_HAS_HIGH_SHARED_MEM-f.patch
  19779. @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  19780. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  19781. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  19782. -@@ -8416,7 +8416,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  19783. +@@ -8420,7 +8420,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  19784. if (retval)
  19785. return retval;
  19786. 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
  19787. index 7a183a404bae73cdcc120b41e83910ab579974ea..daa5dc61f9db18ba73cc19ea908587bb868bf292 100644
  19788. --- a/package/kernel/mac80211/patches/602-rt2x00-introduce-rt2x00_platform_h.patch
  19789. +++ b/package/kernel/mac80211/patches/602-rt2x00-introduce-rt2x00_platform_h.patch
  19790. @@ -22,10 +22,10 @@
  19791. +#endif /* _RT2X00_PLATFORM_H */
  19792. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  19793. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  19794. -@@ -38,6 +38,7 @@
  19795. - #include <linux/kfifo.h>
  19796. +@@ -39,6 +39,7 @@
  19797. #include <linux/hrtimer.h>
  19798. #include <linux/average.h>
  19799. + #include <linux/usb.h>
  19800. +#include <linux/rt2x00_platform.h>
  19801. #include <net/mac80211.h>
  19802. diff --git a/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch b/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
  19803. index bc056cd7357f57570168e5c1a4dbd4b9acd9a3c3..8ae5da38797df39f8bc13e3eace5f2f9496cde9c 100644
  19804. --- a/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
  19805. +++ b/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
  19806. @@ -1,6 +1,6 @@
  19807. --- a/.local-symbols
  19808. +++ b/.local-symbols
  19809. -@@ -329,6 +329,7 @@ RT2X00_LIB_FIRMWARE=
  19810. +@@ -331,6 +331,7 @@ RT2X00_LIB_FIRMWARE=
  19811. RT2X00_LIB_CRYPTO=
  19812. RT2X00_LIB_LEDS=
  19813. RT2X00_LIB_DEBUGFS=
  19814. @@ -105,7 +105,7 @@
  19815. .drv_init_registers = rt2800mmio_init_registers,
  19816. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  19817. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  19818. -@@ -697,6 +697,7 @@ enum rt2x00_capability_flags {
  19819. +@@ -699,6 +699,7 @@ enum rt2x00_capability_flags {
  19820. REQUIRE_HT_TX_DESC,
  19821. REQUIRE_PS_AUTOWAKE,
  19822. REQUIRE_DELAYED_RFKILL,
  19823. @@ -127,7 +127,7 @@
  19824. DECLARE_KFIFO_PTR(txstatus_fifo, u32);
  19825. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  19826. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  19827. -@@ -1335,6 +1335,10 @@ int rt2x00lib_probe_dev(struct rt2x00_de
  19828. +@@ -1334,6 +1334,10 @@ int rt2x00lib_probe_dev(struct rt2x00_de
  19829. INIT_DELAYED_WORK(&rt2x00dev->autowakeup_work, rt2x00lib_autowakeup);
  19830. INIT_WORK(&rt2x00dev->sleep_work, rt2x00lib_sleep);
  19831. @@ -138,7 +138,7 @@
  19832. /*
  19833. * Let the driver probe the device to detect the capabilities.
  19834. */
  19835. -@@ -1475,6 +1479,11 @@ void rt2x00lib_remove_dev(struct rt2x00_
  19836. +@@ -1477,6 +1481,11 @@ void rt2x00lib_remove_dev(struct rt2x00_
  19837. * Free the driver data.
  19838. */
  19839. kfree(rt2x00dev->drv_data);
  19840. 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
  19841. index d923e05c770f2f325d7b47a9a5c9bcdf63cbbbdc..a2e1faf9c3793b51f912c743a38f7a9afd3bd0a0 100644
  19842. --- a/package/kernel/mac80211/patches/607-rt2x00-allow_disabling_bands_through_platform_data.patch
  19843. +++ b/package/kernel/mac80211/patches/607-rt2x00-allow_disabling_bands_through_platform_data.patch
  19844. @@ -37,7 +37,7 @@
  19845. num_rates += 4;
  19846. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  19847. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  19848. -@@ -405,6 +405,7 @@ struct hw_mode_spec {
  19849. +@@ -406,6 +406,7 @@ struct hw_mode_spec {
  19850. unsigned int supported_bands;
  19851. #define SUPPORT_BAND_2GHZ 0x00000001
  19852. #define SUPPORT_BAND_5GHZ 0x00000002
  19853. 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
  19854. index a645ba176e4ab17046945a87bb97359602b675c6..6704ff835c186b575b79c62ad6d83021fee3ee8a 100644
  19855. --- a/package/kernel/mac80211/patches/608-add_platform_data_mac_addr.patch
  19856. +++ b/package/kernel/mac80211/patches/608-add_platform_data_mac_addr.patch
  19857. @@ -31,7 +31,7 @@
  19858. {
  19859. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  19860. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  19861. -@@ -1414,6 +1414,7 @@ static inline void rt2x00debug_dump_fram
  19862. +@@ -1416,6 +1416,7 @@ static inline void rt2x00debug_dump_fram
  19863. */
  19864. u32 rt2x00lib_get_bssidx(struct rt2x00_dev *rt2x00dev,
  19865. struct ieee80211_vif *vif);
  19866. 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
  19867. index c69d33025d91dfb49ec411cbe2fc506ba67d03ff..9f10fe35c3a5c599bf3fb897583481a0971ef475 100644
  19868. --- a/package/kernel/mac80211/patches/610-rt2x00-fix-rt3352-ext-pa.patch
  19869. +++ b/package/kernel/mac80211/patches/610-rt2x00-fix-rt3352-ext-pa.patch
  19870. @@ -200,7 +200,7 @@
  19871. * EEPROM frequency
  19872. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  19873. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  19874. -@@ -717,6 +717,8 @@ enum rt2x00_capability_flags {
  19875. +@@ -719,6 +719,8 @@ enum rt2x00_capability_flags {
  19876. CAPABILITY_DOUBLE_ANTENNA,
  19877. CAPABILITY_BT_COEXIST,
  19878. CAPABILITY_VCO_RECALIBRATION,
  19879. 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
  19880. index b44fe900d53f87580ab8c0e502bc7f94958e6109..860fdc07ede072fce1cd65b177115dfd4dc30c03 100644
  19881. --- a/package/kernel/mac80211/patches/611-rt2x00-rf_vals-rt3352-xtal20.patch
  19882. +++ b/package/kernel/mac80211/patches/611-rt2x00-rf_vals-rt3352-xtal20.patch
  19883. @@ -28,7 +28,7 @@
  19884. static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
  19885. {
  19886. struct hw_mode_spec *spec = &rt2x00dev->spec;
  19887. -@@ -8272,7 +8293,10 @@ static int rt2800_probe_hw_mode(struct r
  19888. +@@ -8276,7 +8297,10 @@ static int rt2800_probe_hw_mode(struct r
  19889. case RF5390:
  19890. case RF5392:
  19891. spec->num_channels = 14;
  19892. @@ -40,7 +40,7 @@
  19893. break;
  19894. case RF3052:
  19895. -@@ -8456,6 +8480,19 @@ static int rt2800_probe_rt(struct rt2x00
  19896. +@@ -8460,6 +8484,19 @@ static int rt2800_probe_rt(struct rt2x00
  19897. return 0;
  19898. }
  19899. @@ -60,7 +60,7 @@
  19900. int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev)
  19901. {
  19902. struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
  19903. -@@ -8498,6 +8535,15 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  19904. +@@ -8502,6 +8539,15 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  19905. rt2800_register_write(rt2x00dev, GPIO_CTRL, reg);
  19906. /*
  19907. @@ -78,7 +78,7 @@
  19908. retval = rt2800_probe_hw_mode(rt2x00dev);
  19909. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  19910. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  19911. -@@ -400,6 +400,7 @@ static inline struct rt2x00_intf* vif_to
  19912. +@@ -401,6 +401,7 @@ static inline struct rt2x00_intf* vif_to
  19913. * @channels: Device/chipset specific channel values (See &struct rf_channel).
  19914. * @channels_info: Additional information for channels (See &struct channel_info).
  19915. * @ht: Driver HT Capabilities (See &ieee80211_sta_ht_cap).
  19916. @@ -86,7 +86,7 @@
  19917. */
  19918. struct hw_mode_spec {
  19919. unsigned int supported_bands;
  19920. -@@ -416,6 +417,7 @@ struct hw_mode_spec {
  19921. +@@ -417,6 +418,7 @@ struct hw_mode_spec {
  19922. const struct channel_info *channels_info;
  19923. struct ieee80211_sta_ht_cap ht;
  19924. diff --git a/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch b/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
  19925. index 8e3bd2a3622c1954a01ed548c71e436be9e92d8e..e7b2a8ca896118d5733e81a44ffb3a37502aeb42 100644
  19926. --- a/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
  19927. +++ b/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
  19928. @@ -8,7 +8,7 @@
  19929. #include "rt2x00.h"
  19930. #include "rt2800lib.h"
  19931. -@@ -8482,13 +8483,14 @@ static int rt2800_probe_rt(struct rt2x00
  19932. +@@ -8486,13 +8487,14 @@ static int rt2800_probe_rt(struct rt2x00
  19933. int rt2800_probe_clk(struct rt2x00_dev *rt2x00dev)
  19934. {
  19935. diff --git a/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch b/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch
  19936. index faa5879de68b0ec27d0099b51e296cfd7ccf7416..44bd8a194b23f9ef807fb66e99f6695998fc844c 100644
  19937. --- a/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch
  19938. +++ b/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch
  19939. @@ -240,7 +240,7 @@
  19940. case RF5360:
  19941. case RF5362:
  19942. case RF5370:
  19943. -@@ -8287,6 +8398,7 @@ static int rt2800_probe_hw_mode(struct r
  19944. +@@ -8291,6 +8402,7 @@ static int rt2800_probe_hw_mode(struct r
  19945. case RF3290:
  19946. case RF3320:
  19947. case RF3322:
  19948. @@ -248,7 +248,7 @@
  19949. case RF5360:
  19950. case RF5362:
  19951. case RF5370:
  19952. -@@ -8426,6 +8538,7 @@ static int rt2800_probe_hw_mode(struct r
  19953. +@@ -8430,6 +8542,7 @@ static int rt2800_probe_hw_mode(struct r
  19954. case RF3070:
  19955. case RF3290:
  19956. case RF3853:
  19957. @@ -256,7 +256,7 @@
  19958. case RF5360:
  19959. case RF5362:
  19960. case RF5370:
  19961. -@@ -8466,6 +8579,7 @@ static int rt2800_probe_rt(struct rt2x00
  19962. +@@ -8470,6 +8583,7 @@ static int rt2800_probe_rt(struct rt2x00
  19963. case RT3572:
  19964. case RT3593:
  19965. case RT3883:
  19966. @@ -266,7 +266,7 @@
  19967. case RT5592:
  19968. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  19969. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  19970. -@@ -169,6 +169,7 @@ struct rt2x00_chip {
  19971. +@@ -170,6 +170,7 @@ struct rt2x00_chip {
  19972. #define RT3572 0x3572
  19973. #define RT3593 0x3593
  19974. #define RT3883 0x3883 /* WSOC */
  19975. 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
  19976. index 55452b9ebde82e716e9fbf557db07abdde07dce5..dba6033edb83aaec0943a523dc1bf2c8f3ba5b31 100644
  19977. --- a/package/kernel/mac80211/patches/620-rt2x00-add-AP+STA-support.patch
  19978. +++ b/package/kernel/mac80211/patches/620-rt2x00-add-AP+STA-support.patch
  19979. @@ -1,6 +1,6 @@
  19980. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  19981. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  19982. -@@ -1284,7 +1284,7 @@ static inline void rt2x00lib_set_if_comb
  19983. +@@ -1283,7 +1283,7 @@ static inline void rt2x00lib_set_if_comb
  19984. */
  19985. if_limit = &rt2x00dev->if_limits_ap;
  19986. if_limit->max = rt2x00dev->ops->max_ap_intf;
  19987. diff --git a/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch b/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
  19988. index fd885cc002461dbdb4b21f3bc4c5ae97c6609ad3..02f3053b2f34305e5db0a953aee3378fc17f351f 100644
  19989. --- a/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
  19990. +++ b/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
  19991. @@ -1,6 +1,6 @@
  19992. --- a/drivers/net/wireless/marvell/libertas/cfg.c
  19993. +++ b/drivers/net/wireless/marvell/libertas/cfg.c
  19994. -@@ -2084,6 +2084,8 @@ struct wireless_dev *lbs_cfg_alloc(struc
  19995. +@@ -2122,6 +2122,8 @@ struct wireless_dev *lbs_cfg_alloc(struc
  19996. goto err_wiphy_new;
  19997. }
  19998. diff --git a/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch b/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
  19999. index b67a95f948b79b4430799beadbcb98fc6f05e0da..ad306083da6cddff80b36241689cfeb3ba77d072 100644
  20000. --- a/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
  20001. +++ b/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
  20002. @@ -1,6 +1,6 @@
  20003. --- a/drivers/net/wireless/marvell/libertas/cfg.c
  20004. +++ b/drivers/net/wireless/marvell/libertas/cfg.c
  20005. -@@ -2174,6 +2174,8 @@ int lbs_cfg_register(struct lbs_private
  20006. +@@ -2212,6 +2212,8 @@ int lbs_cfg_register(struct lbs_private
  20007. wdev->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
  20008. wdev->wiphy->reg_notifier = lbs_reg_notifier;
  20009. diff --git a/package/kernel/mac80211/patches/804-b43-sync-with-bcma.patch b/package/kernel/mac80211/patches/804-b43-sync-with-bcma.patch
  20010. deleted file mode 100644
  20011. index 74cd4489f15fb1b18a2157441011a4ff68bb60f8..0000000000000000000000000000000000000000
  20012. --- a/package/kernel/mac80211/patches/804-b43-sync-with-bcma.patch
  20013. +++ /dev/null
  20014. @@ -1,17 +0,0 @@
  20015. ---- a/drivers/net/wireless/broadcom/b43/main.c
  20016. -+++ b/drivers/net/wireless/broadcom/b43/main.c
  20017. -@@ -1215,10 +1215,10 @@ void b43_wireless_core_phy_pll_reset(str
  20018. - case B43_BUS_BCMA:
  20019. - bcma_cc = &dev->dev->bdev->bus->drv_cc;
  20020. -
  20021. -- bcma_cc_write32(bcma_cc, BCMA_CC_CHIPCTL_ADDR, 0);
  20022. -- bcma_cc_mask32(bcma_cc, BCMA_CC_CHIPCTL_DATA, ~0x4);
  20023. -- bcma_cc_set32(bcma_cc, BCMA_CC_CHIPCTL_DATA, 0x4);
  20024. -- bcma_cc_mask32(bcma_cc, BCMA_CC_CHIPCTL_DATA, ~0x4);
  20025. -+ bcma_cc_write32(bcma_cc, BCMA_CC_PMU_CHIPCTL_ADDR, 0);
  20026. -+ bcma_cc_mask32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, ~0x4);
  20027. -+ bcma_cc_set32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, 0x4);
  20028. -+ bcma_cc_mask32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, ~0x4);
  20029. - break;
  20030. - #endif
  20031. - #ifdef CPTCFG_B43_SSB
  20032. diff --git a/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch b/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch
  20033. index 06c731fce677f7ea4a29652916c678f6de4dfc7d..f8f555f3e6ec510c333a97e76f47cca92e96a774 100644
  20034. --- a/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch
  20035. +++ b/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch
  20036. @@ -9,7 +9,7 @@
  20037. antenna = b43_antenna_to_phyctl(antenna);
  20038. ctl = b43_shm_read16(dev, B43_SHM_SHARED, B43_SHM_SH_BEACPHYCTL);
  20039. /* We can't send beacons with short preamble. Would get PHY errors. */
  20040. -@@ -3300,8 +3300,8 @@ static int b43_chip_init(struct b43_wlde
  20041. +@@ -3297,8 +3297,8 @@ static int b43_chip_init(struct b43_wlde
  20042. /* Select the antennae */
  20043. if (phy->ops->set_rx_antenna)
  20044. @@ -20,7 +20,7 @@
  20045. if (phy->type == B43_PHYTYPE_B) {
  20046. value16 = b43_read16(dev, 0x005E);
  20047. -@@ -4001,7 +4001,6 @@ static int b43_op_config(struct ieee8021
  20048. +@@ -3998,7 +3998,6 @@ static int b43_op_config(struct ieee8021
  20049. struct b43_wldev *dev = wl->current_dev;
  20050. struct b43_phy *phy = &dev->phy;
  20051. struct ieee80211_conf *conf = &hw->conf;
  20052. @@ -28,7 +28,7 @@
  20053. int err = 0;
  20054. mutex_lock(&wl->mutex);
  20055. -@@ -4044,11 +4043,9 @@ static int b43_op_config(struct ieee8021
  20056. +@@ -4041,11 +4040,9 @@ static int b43_op_config(struct ieee8021
  20057. }
  20058. /* Antennas for RX and management frame TX. */
  20059. @@ -42,7 +42,7 @@
  20060. if (wl->radio_enabled != phy->radio_on) {
  20061. if (wl->radio_enabled) {
  20062. -@@ -5209,6 +5206,47 @@ static int b43_op_get_survey(struct ieee
  20063. +@@ -5189,6 +5186,47 @@ static int b43_op_get_survey(struct ieee
  20064. return 0;
  20065. }
  20066. @@ -90,7 +90,7 @@
  20067. static const struct ieee80211_ops b43_hw_ops = {
  20068. .tx = b43_op_tx,
  20069. .conf_tx = b43_op_conf_tx,
  20070. -@@ -5230,6 +5268,8 @@ static const struct ieee80211_ops b43_hw
  20071. +@@ -5210,6 +5248,8 @@ static const struct ieee80211_ops b43_hw
  20072. .sw_scan_complete = b43_op_sw_scan_complete_notifier,
  20073. .get_survey = b43_op_get_survey,
  20074. .rfkill_poll = b43_rfkill_poll,
  20075. @@ -99,7 +99,7 @@
  20076. };
  20077. /* Hard-reset the chip. Do not call this directly.
  20078. -@@ -5538,6 +5578,8 @@ static int b43_one_core_attach(struct b4
  20079. +@@ -5513,6 +5553,8 @@ static int b43_one_core_attach(struct b4
  20080. if (!wldev)
  20081. goto out;
  20082. @@ -108,7 +108,7 @@
  20083. wldev->use_pio = b43_modparam_pio;
  20084. wldev->dev = dev;
  20085. wldev->wl = wl;
  20086. -@@ -5628,6 +5670,9 @@ static struct b43_wl *b43_wireless_init(
  20087. +@@ -5603,6 +5645,9 @@ static struct b43_wl *b43_wireless_init(
  20088. hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
  20089. 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
  20090. deleted file mode 100644
  20091. index e2653542def01a708c6b3399a78484a322919a57..0000000000000000000000000000000000000000
  20092. --- a/package/kernel/mac80211/patches/860-brcmfmac-add-missing-eth_type_trans-call.patch
  20093. +++ /dev/null
  20094. @@ -1,26 +0,0 @@
  20095. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  20096. -Subject: [PATCH] brcmfmac: add missing eth_type_trans call
  20097. -MIME-Version: 1.0
  20098. -Content-Type: text/plain; charset=UTF-8
  20099. -Content-Transfer-Encoding: 8bit
  20100. -
  20101. -There are 2 protocols supported by brcmfmac and msgbuf one was missing a
  20102. -proper skb setup before passing it to the netif. This was triggering
  20103. -"NULL pointer dereference".
  20104. -
  20105. -Fixes: 9c349892ccc9 ("brcmfmac: revise handling events in receive path")
  20106. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  20107. ----
  20108. -
  20109. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  20110. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  20111. -@@ -1157,6 +1157,9 @@ brcmf_msgbuf_process_rx_complete(struct
  20112. - brcmu_pkt_buf_free_skb(skb);
  20113. - return;
  20114. - }
  20115. -+
  20116. -+ skb->protocol = eth_type_trans(skb, ifp->ndev);
  20117. -+
  20118. - brcmf_netif_rx(ifp, skb);
  20119. - }
  20120. -
  20121. 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
  20122. new file mode 100644
  20123. index 0000000000000000000000000000000000000000..ae571c99ab151245355d0080a6475bcabbb9a2fb
  20124. --- /dev/null
  20125. +++ b/package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch
  20126. @@ -0,0 +1,97 @@
  20127. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  20128. +Date: Mon, 8 Jun 2015 16:11:40 +0200
  20129. +Subject: [PATCH] brcmfmac: register wiphy(s) during module_init
  20130. +MIME-Version: 1.0
  20131. +Content-Type: text/plain; charset=UTF-8
  20132. +Content-Transfer-Encoding: 8bit
  20133. +
  20134. +This is needed by OpenWrt which expects all PHYs to be created after
  20135. +module loads successfully.
  20136. +
  20137. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  20138. +---
  20139. +
  20140. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  20141. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  20142. +@@ -1213,6 +1213,7 @@ int __init brcmf_core_init(void)
  20143. + {
  20144. + if (!schedule_work(&brcmf_driver_work))
  20145. + return -EBUSY;
  20146. ++ flush_work(&brcmf_driver_work);
  20147. +
  20148. + return 0;
  20149. + }
  20150. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  20151. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  20152. +@@ -444,6 +444,7 @@ struct brcmf_fw {
  20153. + u16 bus_nr;
  20154. + void (*done)(struct device *dev, const struct firmware *fw,
  20155. + void *nvram_image, u32 nvram_len);
  20156. ++ struct completion *completion;
  20157. + };
  20158. +
  20159. + static void brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx)
  20160. +@@ -478,6 +479,8 @@ static void brcmf_fw_request_nvram_done(
  20161. + goto fail;
  20162. +
  20163. + fwctx->done(fwctx->dev, fwctx->code, nvram, nvram_length);
  20164. ++ if (fwctx->completion)
  20165. ++ complete(fwctx->completion);
  20166. + kfree(fwctx);
  20167. + return;
  20168. +
  20169. +@@ -485,6 +488,8 @@ fail:
  20170. + brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev));
  20171. + release_firmware(fwctx->code);
  20172. + device_release_driver(fwctx->dev);
  20173. ++ if (fwctx->completion)
  20174. ++ complete(fwctx->completion);
  20175. + kfree(fwctx);
  20176. + }
  20177. +
  20178. +@@ -500,6 +505,8 @@ static void brcmf_fw_request_code_done(c
  20179. + /* only requested code so done here */
  20180. + if (!(fwctx->flags & BRCMF_FW_REQUEST_NVRAM)) {
  20181. + fwctx->done(fwctx->dev, fw, NULL, 0);
  20182. ++ if (fwctx->completion)
  20183. ++ complete(fwctx->completion);
  20184. + kfree(fwctx);
  20185. + return;
  20186. + }
  20187. +@@ -517,6 +524,8 @@ static void brcmf_fw_request_code_done(c
  20188. + fail:
  20189. + brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev));
  20190. + device_release_driver(fwctx->dev);
  20191. ++ if (fwctx->completion)
  20192. ++ complete(fwctx->completion);
  20193. + kfree(fwctx);
  20194. + }
  20195. +
  20196. +@@ -528,6 +537,8 @@ int brcmf_fw_get_firmwares_pcie(struct d
  20197. + u16 domain_nr, u16 bus_nr)
  20198. + {
  20199. + struct brcmf_fw *fwctx;
  20200. ++ struct completion completion;
  20201. ++ int err;
  20202. +
  20203. + brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(dev));
  20204. + if (!fw_cb || !code)
  20205. +@@ -548,9 +559,17 @@ int brcmf_fw_get_firmwares_pcie(struct d
  20206. + fwctx->domain_nr = domain_nr;
  20207. + fwctx->bus_nr = bus_nr;
  20208. +
  20209. +- return request_firmware_nowait(THIS_MODULE, true, code, dev,
  20210. ++ init_completion(&completion);
  20211. ++ fwctx->completion = &completion;
  20212. ++
  20213. ++ err = request_firmware_nowait(THIS_MODULE, true, code, dev,
  20214. + GFP_KERNEL, fwctx,
  20215. + brcmf_fw_request_code_done);
  20216. ++ if (!err)
  20217. ++ wait_for_completion_timeout(fwctx->completion,
  20218. ++ msecs_to_jiffies(5000));
  20219. ++ fwctx->completion = NULL;
  20220. ++ return err;
  20221. + }
  20222. +
  20223. + int brcmf_fw_get_firmwares(struct device *dev, u16 flags,
  20224. 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
  20225. deleted file mode 100644
  20226. index f7f44f513f5e80f18f26c49073f916a435c6c534..0000000000000000000000000000000000000000
  20227. --- a/package/kernel/mac80211/patches/861-brcmfmac-register-wiphy-s-during-module_init.patch
  20228. +++ /dev/null
  20229. @@ -1,97 +0,0 @@
  20230. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  20231. -Date: Mon, 8 Jun 2015 16:11:40 +0200
  20232. -Subject: [PATCH] brcmfmac: register wiphy(s) during module_init
  20233. -MIME-Version: 1.0
  20234. -Content-Type: text/plain; charset=UTF-8
  20235. -Content-Transfer-Encoding: 8bit
  20236. -
  20237. -This is needed by OpenWrt which expects all PHYs to be created after
  20238. -module loads successfully.
  20239. -
  20240. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  20241. ----
  20242. -
  20243. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  20244. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  20245. -@@ -1200,6 +1200,7 @@ int __init brcmf_core_init(void)
  20246. - {
  20247. - if (!schedule_work(&brcmf_driver_work))
  20248. - return -EBUSY;
  20249. -+ flush_work(&brcmf_driver_work);
  20250. -
  20251. - return 0;
  20252. - }
  20253. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  20254. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  20255. -@@ -444,6 +444,7 @@ struct brcmf_fw {
  20256. - u16 bus_nr;
  20257. - void (*done)(struct device *dev, const struct firmware *fw,
  20258. - void *nvram_image, u32 nvram_len);
  20259. -+ struct completion *completion;
  20260. - };
  20261. -
  20262. - static void brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx)
  20263. -@@ -478,6 +479,8 @@ static void brcmf_fw_request_nvram_done(
  20264. - goto fail;
  20265. -
  20266. - fwctx->done(fwctx->dev, fwctx->code, nvram, nvram_length);
  20267. -+ if (fwctx->completion)
  20268. -+ complete(fwctx->completion);
  20269. - kfree(fwctx);
  20270. - return;
  20271. -
  20272. -@@ -485,6 +488,8 @@ fail:
  20273. - brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev));
  20274. - release_firmware(fwctx->code);
  20275. - device_release_driver(fwctx->dev);
  20276. -+ if (fwctx->completion)
  20277. -+ complete(fwctx->completion);
  20278. - kfree(fwctx);
  20279. - }
  20280. -
  20281. -@@ -500,6 +505,8 @@ static void brcmf_fw_request_code_done(c
  20282. - /* only requested code so done here */
  20283. - if (!(fwctx->flags & BRCMF_FW_REQUEST_NVRAM)) {
  20284. - fwctx->done(fwctx->dev, fw, NULL, 0);
  20285. -+ if (fwctx->completion)
  20286. -+ complete(fwctx->completion);
  20287. - kfree(fwctx);
  20288. - return;
  20289. - }
  20290. -@@ -517,6 +524,8 @@ static void brcmf_fw_request_code_done(c
  20291. - fail:
  20292. - brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev));
  20293. - device_release_driver(fwctx->dev);
  20294. -+ if (fwctx->completion)
  20295. -+ complete(fwctx->completion);
  20296. - kfree(fwctx);
  20297. - }
  20298. -
  20299. -@@ -528,6 +537,8 @@ int brcmf_fw_get_firmwares_pcie(struct d
  20300. - u16 domain_nr, u16 bus_nr)
  20301. - {
  20302. - struct brcmf_fw *fwctx;
  20303. -+ struct completion completion;
  20304. -+ int err;
  20305. -
  20306. - brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(dev));
  20307. - if (!fw_cb || !code)
  20308. -@@ -548,9 +559,17 @@ int brcmf_fw_get_firmwares_pcie(struct d
  20309. - fwctx->domain_nr = domain_nr;
  20310. - fwctx->bus_nr = bus_nr;
  20311. -
  20312. -- return request_firmware_nowait(THIS_MODULE, true, code, dev,
  20313. -+ init_completion(&completion);
  20314. -+ fwctx->completion = &completion;
  20315. -+
  20316. -+ err = request_firmware_nowait(THIS_MODULE, true, code, dev,
  20317. - GFP_KERNEL, fwctx,
  20318. - brcmf_fw_request_code_done);
  20319. -+ if (!err)
  20320. -+ wait_for_completion_timeout(fwctx->completion,
  20321. -+ msecs_to_jiffies(5000));
  20322. -+ fwctx->completion = NULL;
  20323. -+ return err;
  20324. - }
  20325. -
  20326. - int brcmf_fw_get_firmwares(struct device *dev, u16 flags,
  20327. 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
  20328. new file mode 100644
  20329. index 0000000000000000000000000000000000000000..87211550f77d6e06bef8f7124940ba30ac4222ef
  20330. --- /dev/null
  20331. +++ b/package/kernel/mac80211/patches/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch
  20332. @@ -0,0 +1,50 @@
  20333. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  20334. +Date: Thu, 9 Jul 2015 00:07:59 +0200
  20335. +Subject: [PATCH] brcmfmac: workaround bug with some inconsistent BSSes state
  20336. +MIME-Version: 1.0
  20337. +Content-Type: text/plain; charset=UTF-8
  20338. +Content-Transfer-Encoding: 8bit
  20339. +
  20340. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  20341. +---
  20342. +
  20343. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  20344. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  20345. +@@ -665,9 +665,37 @@ static struct wireless_dev *brcmf_cfg802
  20346. + u32 *flags,
  20347. + struct vif_params *params)
  20348. + {
  20349. ++ struct net_device *dev;
  20350. + struct wireless_dev *wdev;
  20351. + int err;
  20352. +
  20353. ++ /*
  20354. ++ * There is a bug with in-firmware BSS management. When adding virtual
  20355. ++ * interface brcmfmac first tells firmware to create new BSS and then
  20356. ++ * it creates new struct net_device.
  20357. ++ *
  20358. ++ * If creating/registering netdev(ice) fails, BSS remains in some bugged
  20359. ++ * state. It conflicts with existing BSSes by overtaking their auth
  20360. ++ * requests.
  20361. ++ *
  20362. ++ * It results in one BSS (addresss X) sending beacons and another BSS
  20363. ++ * (address Y) replying to authentication requests. This makes interface
  20364. ++ * unusable as AP.
  20365. ++ *
  20366. ++ * To workaround this bug we may try to guess if register_netdev(ice)
  20367. ++ * will fail. The most obvious case is using interface name that already
  20368. ++ * exists. This is actually quite likely with brcmfmac & some user space
  20369. ++ * scripts as brcmfmac doesn't allow deleting virtual interfaces.
  20370. ++ * So this bug can be triggered even by something trivial like:
  20371. ++ * iw dev wlan0 delete
  20372. ++ * iw phy phy0 interface add wlan0 type __ap
  20373. ++ */
  20374. ++ dev = dev_get_by_name(&init_net, name);
  20375. ++ if (dev) {
  20376. ++ dev_put(dev);
  20377. ++ return ERR_PTR(-ENFILE);
  20378. ++ }
  20379. ++
  20380. + brcmf_dbg(TRACE, "enter: %s type %d\n", name, type);
  20381. + err = brcmf_vif_add_validate(wiphy_to_cfg(wiphy), type);
  20382. + if (err) {
  20383. diff --git a/package/kernel/mac80211/patches/862-brcmfmac-Disable-power-management.patch b/package/kernel/mac80211/patches/862-brcmfmac-Disable-power-management.patch
  20384. new file mode 100644
  20385. index 0000000000000000000000000000000000000000..f301fe1e4e7daa2cabd73aaf869327e2a0fb7d22
  20386. --- /dev/null
  20387. +++ b/package/kernel/mac80211/patches/862-brcmfmac-Disable-power-management.patch
  20388. @@ -0,0 +1,27 @@
  20389. +From 66ae1b1750720a33e29792a177b1e696f4f005fb Mon Sep 17 00:00:00 2001
  20390. +From: Phil Elwell <phil@raspberrypi.org>
  20391. +Date: Wed, 9 Mar 2016 17:25:59 +0000
  20392. +Subject: [PATCH] brcmfmac: Disable power management
  20393. +
  20394. +Disable wireless power saving in the brcmfmac WLAN driver. This is a
  20395. +temporary measure until the connectivity loss resulting from power
  20396. +saving is resolved.
  20397. +
  20398. +Signed-off-by: Phil Elwell <phil@raspberrypi.org>
  20399. +---
  20400. + drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c | 2 ++
  20401. + 1 file changed, 2 insertions(+)
  20402. +
  20403. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  20404. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  20405. +@@ -2783,6 +2783,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip
  20406. + * preference in cfg struct to apply this to
  20407. + * FW later while initializing the dongle
  20408. + */
  20409. ++#if defined(CONFIG_BCM2708) || defined(CONFIG_BCM2709)
  20410. ++ pr_info("power management disabled\n");
  20411. ++ enabled = false;
  20412. ++#endif
  20413. + cfg->pwr_save = enabled;
  20414. + if (!check_vif_up(ifp->vif)) {
  20415. +
  20416. 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
  20417. deleted file mode 100644
  20418. index 1e440c02f33ffa7389837442fde8bdcb21002d61..0000000000000000000000000000000000000000
  20419. --- a/package/kernel/mac80211/patches/862-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch
  20420. +++ /dev/null
  20421. @@ -1,50 +0,0 @@
  20422. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  20423. -Date: Thu, 9 Jul 2015 00:07:59 +0200
  20424. -Subject: [PATCH] brcmfmac: workaround bug with some inconsistent BSSes state
  20425. -MIME-Version: 1.0
  20426. -Content-Type: text/plain; charset=UTF-8
  20427. -Content-Transfer-Encoding: 8bit
  20428. -
  20429. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  20430. ----
  20431. -
  20432. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  20433. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  20434. -@@ -651,9 +651,37 @@ static struct wireless_dev *brcmf_cfg802
  20435. - u32 *flags,
  20436. - struct vif_params *params)
  20437. - {
  20438. -+ struct net_device *dev;
  20439. - struct wireless_dev *wdev;
  20440. - int err;
  20441. -
  20442. -+ /*
  20443. -+ * There is a bug with in-firmware BSS management. When adding virtual
  20444. -+ * interface brcmfmac first tells firmware to create new BSS and then
  20445. -+ * it creates new struct net_device.
  20446. -+ *
  20447. -+ * If creating/registering netdev(ice) fails, BSS remains in some bugged
  20448. -+ * state. It conflicts with existing BSSes by overtaking their auth
  20449. -+ * requests.
  20450. -+ *
  20451. -+ * It results in one BSS (addresss X) sending beacons and another BSS
  20452. -+ * (address Y) replying to authentication requests. This makes interface
  20453. -+ * unusable as AP.
  20454. -+ *
  20455. -+ * To workaround this bug we may try to guess if register_netdev(ice)
  20456. -+ * will fail. The most obvious case is using interface name that already
  20457. -+ * exists. This is actually quite likely with brcmfmac & some user space
  20458. -+ * scripts as brcmfmac doesn't allow deleting virtual interfaces.
  20459. -+ * So this bug can be triggered even by something trivial like:
  20460. -+ * iw dev wlan0 delete
  20461. -+ * iw phy phy0 interface add wlan0 type __ap
  20462. -+ */
  20463. -+ dev = dev_get_by_name(&init_net, name);
  20464. -+ if (dev) {
  20465. -+ dev_put(dev);
  20466. -+ return ERR_PTR(-ENFILE);
  20467. -+ }
  20468. -+
  20469. - brcmf_dbg(TRACE, "enter: %s type %d\n", name, type);
  20470. - err = brcmf_vif_add_validate(wiphy_to_cfg(wiphy), type);
  20471. - if (err) {
  20472. 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
  20473. index f2e21ea49feafaf060846d95746ea6132819536f..be210f2d4bfc22a20b7473012000338e22622bd9 100644
  20474. --- a/package/kernel/mac80211/patches/910-01-add-support-for-mt7620.patch
  20475. +++ b/package/kernel/mac80211/patches/910-01-add-support-for-mt7620.patch
  20476. @@ -1184,7 +1184,7 @@
  20477. break;
  20478. default:
  20479. rt2x00_err(rt2x00dev, "Invalid RF chipset 0x%04x detected\n",
  20480. -@@ -8423,6 +9363,7 @@ static int rt2800_probe_hw_mode(struct r
  20481. +@@ -8427,6 +9367,7 @@ static int rt2800_probe_hw_mode(struct r
  20482. case RF5372:
  20483. case RF5390:
  20484. case RF5392:
  20485. @@ -1192,7 +1192,7 @@
  20486. spec->num_channels = 14;
  20487. if (spec->clk_is_20mhz)
  20488. spec->channels = rf_vals_xtal20mhz_3x;
  20489. -@@ -8563,6 +9504,7 @@ static int rt2800_probe_hw_mode(struct r
  20490. +@@ -8567,6 +9508,7 @@ static int rt2800_probe_hw_mode(struct r
  20491. case RF5372:
  20492. case RF5390:
  20493. case RF5392:
  20494. diff --git a/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch b/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
  20495. index 8c6d720a73cf73e007eeede2829ec9019d5a2d40..e842d612b7b55caaa557c20836ca84e3cd21f906 100644
  20496. --- a/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
  20497. +++ b/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
  20498. @@ -14,7 +14,7 @@ Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
  20499. --- a/drivers/net/wireless/ath/ath10k/core.c
  20500. +++ b/drivers/net/wireless/ath/ath10k/core.c
  20501. -@@ -1914,6 +1914,16 @@ int ath10k_core_register(struct ath10k *
  20502. +@@ -2107,6 +2107,16 @@ int ath10k_core_register(struct ath10k *
  20503. ar->chip_id = chip_id;
  20504. queue_work(ar->workqueue, &ar->register_work);
  20505. 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
  20506. index 281b4475ada3f4388292d930a9fd252b234ec0c5..a501b998d0f279eeac266df9a4cd03e5cb731f98 100644
  20507. --- a/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch
  20508. +++ b/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch
  20509. @@ -1,6 +1,6 @@
  20510. --- a/drivers/net/wireless/ath/ath10k/mac.c
  20511. +++ b/drivers/net/wireless/ath/ath10k/mac.c
  20512. -@@ -7141,6 +7141,21 @@ struct ath10k_vif *ath10k_get_arvif(stru
  20513. +@@ -7742,6 +7742,21 @@ struct ath10k_vif *ath10k_get_arvif(stru
  20514. return arvif_iter.arvif;
  20515. }
  20516. @@ -22,11 +22,11 @@
  20517. int ath10k_mac_register(struct ath10k *ar)
  20518. {
  20519. static const u32 cipher_suites[] = {
  20520. -@@ -7357,6 +7372,12 @@ int ath10k_mac_register(struct ath10k *a
  20521. +@@ -7975,6 +7990,12 @@ int ath10k_mac_register(struct ath10k *a
  20522. ar->hw->wiphy->cipher_suites = cipher_suites;
  20523. ar->hw->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
  20524. -+#if CPTCFG_MAC80211_LEDS
  20525. ++#ifdef CPTCFG_MAC80211_LEDS
  20526. + ieee80211_create_tpt_led_trigger(ar->hw,
  20527. + IEEE80211_TPT_LEDTRIG_FL_RADIO, ath10k_tpt_blink,
  20528. + ARRAY_SIZE(ath10k_tpt_blink));
  20529. diff --git a/package/kernel/mac80211/patches/936-ath10k_skip_otp_check.patch b/package/kernel/mac80211/patches/936-ath10k_skip_otp_check.patch
  20530. new file mode 100644
  20531. index 0000000000000000000000000000000000000000..596ef9863902ecbbd3cdb394c7ffde3ba509414f
  20532. --- /dev/null
  20533. +++ b/package/kernel/mac80211/patches/936-ath10k_skip_otp_check.patch
  20534. @@ -0,0 +1,51 @@
  20535. +--- a/drivers/net/wireless/ath/ath10k/core.c
  20536. ++++ b/drivers/net/wireless/ath/ath10k/core.c
  20537. +@@ -1243,9 +1243,6 @@ static int ath10k_core_fetch_firmware_fi
  20538. + {
  20539. + int ret;
  20540. +
  20541. +- /* calibration file is optional, don't check for any errors */
  20542. +- ath10k_fetch_cal_file(ar);
  20543. +-
  20544. + ar->fw_api = 5;
  20545. + ath10k_dbg(ar, ATH10K_DBG_BOOT, "trying fw api %d\n", ar->fw_api);
  20546. +
  20547. +@@ -1944,7 +1941,7 @@ EXPORT_SYMBOL(ath10k_core_stop);
  20548. + static int ath10k_core_probe_fw(struct ath10k *ar)
  20549. + {
  20550. + struct bmi_target_info target_info;
  20551. +- int ret = 0;
  20552. ++ int calret, ret = 0;
  20553. +
  20554. + ret = ath10k_hif_power_up(ar);
  20555. + if (ret) {
  20556. +@@ -1968,6 +1965,9 @@ static int ath10k_core_probe_fw(struct a
  20557. + goto err_power_down;
  20558. + }
  20559. +
  20560. ++ /* calibration file is optional, don't check for any errors */
  20561. ++ calret = ath10k_fetch_cal_file(ar);
  20562. ++
  20563. + ret = ath10k_core_fetch_firmware_files(ar);
  20564. + if (ret) {
  20565. + ath10k_err(ar, "could not fetch firmware files (%d)\n", ret);
  20566. +@@ -1990,11 +1990,14 @@ static int ath10k_core_probe_fw(struct a
  20567. + "could not load pre cal data: %d\n", ret);
  20568. + }
  20569. +
  20570. +- ret = ath10k_core_get_board_id_from_otp(ar);
  20571. +- if (ret && ret != -EOPNOTSUPP) {
  20572. +- ath10k_err(ar, "failed to get board id from otp: %d\n",
  20573. +- ret);
  20574. +- goto err_free_firmware_files;
  20575. ++ /* otp and board file not needed if calibration data is present */
  20576. ++ if (calret) {
  20577. ++ ret = ath10k_core_get_board_id_from_otp(ar);
  20578. ++ if (ret && ret != -EOPNOTSUPP) {
  20579. ++ ath10k_err(ar, "failed to get board id from otp: %d\n",
  20580. ++ ret);
  20581. ++ goto err_free_firmware_files;
  20582. ++ }
  20583. + }
  20584. +
  20585. + ret = ath10k_core_fetch_board_file(ar);
  20586. diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile
  20587. index e49dd486d2c952f3bc985a02bb131fdc7a03ce4a..bd851e61910c9a57ca45a570855ca22329c9ae4b 100644
  20588. --- a/package/kernel/mt76/Makefile
  20589. +++ b/package/kernel/mt76/Makefile
  20590. @@ -1,7 +1,7 @@
  20591. include $(TOPDIR)/rules.mk
  20592. PKG_NAME:=mt76
  20593. -PKG_VERSION:=2016-03-03
  20594. +PKG_VERSION:=2016-08-25
  20595. PKG_RELEASE=1
  20596. PKG_LICENSE:=GPLv2
  20597. @@ -10,23 +10,26 @@ PKG_LICENSE_FILES:=
  20598. PKG_SOURCE_URL:=https://github.com/openwrt/mt76
  20599. PKG_SOURCE_PROTO:=git
  20600. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  20601. -PKG_SOURCE_VERSION:=310d420178c86e253a172413da30ecf479b64251
  20602. +PKG_SOURCE_VERSION:=c3127d2acc354b4a27c8604716b0591093601971
  20603. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
  20604. -PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  20605. +PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  20606. PKG_BUILD_PARALLEL:=1
  20607. +STAMP_CONFIGURED_DEPENDS := $(STAGING_DIR)/usr/include/mac80211-backport/backport/autoconf.h
  20608. +
  20609. include $(INCLUDE_DIR)/kernel.mk
  20610. include $(INCLUDE_DIR)/package.mk
  20611. define KernelPackage/mt76
  20612. SUBMENU:=Wireless Drivers
  20613. - TITLE:=MediaTek MT76x2 wireless driver
  20614. - DEPENDS:=+kmod-mac80211 +@DRIVER_11N_SUPPORT @PCI_SUPPORT
  20615. + TITLE:=MediaTek MT76x2/MT7603 wireless driver
  20616. + DEPENDS:=+kmod-mac80211 +@DRIVER_11N_SUPPORT @PCI_SUPPORT @!LINUX_3_18
  20617. FILES:=\
  20618. $(PKG_BUILD_DIR)/mt76.ko \
  20619. - $(PKG_BUILD_DIR)/mt76x2e.ko
  20620. - AUTOLOAD:=$(call AutoLoad,50,mac80211 mt76 mt76x2e)
  20621. + $(PKG_BUILD_DIR)/mt76x2e.ko \
  20622. + $(PKG_BUILD_DIR)/mt7603e.ko
  20623. + AUTOLOAD:=$(call AutoLoad,50,mac80211 mt76 mt76x2e mt7603e)
  20624. endef
  20625. NOSTDINC_FLAGS = \
  20626. @@ -54,6 +57,12 @@ endef
  20627. define KernelPackage/mt76/install
  20628. $(INSTALL_DIR) $(1)/lib/firmware
  20629. cp \
  20630. + $(if $(CONFIG_TARGET_ramips_mt7628) || $(CONFIG_TARGET_ramips_mt7688), \
  20631. + $(PKG_BUILD_DIR)/firmware/mt7628_e1.bin \
  20632. + $(PKG_BUILD_DIR)/firmware/mt7628_e2.bin \
  20633. + ) \
  20634. + $(PKG_BUILD_DIR)/firmware/mt7603_e1.bin \
  20635. + $(PKG_BUILD_DIR)/firmware/mt7603_e2.bin \
  20636. $(PKG_BUILD_DIR)/firmware/mt7662_rom_patch.bin \
  20637. $(PKG_BUILD_DIR)/firmware/mt7662.bin \
  20638. $(1)/lib/firmware
  20639. diff --git a/package/network/services/hostapd/Config.in b/package/network/services/hostapd/Config.in
  20640. index aee2a15fd314479ba4d5e29a8bb4ec5855a78342..645888e74510c5c42c21a7208ee0dcc884fb0e2a 100644
  20641. --- a/package/network/services/hostapd/Config.in
  20642. +++ b/package/network/services/hostapd/Config.in
  20643. @@ -10,11 +10,10 @@ config WPA_SUPPLICANT_NO_TIMESTAMP_CHECK
  20644. choice
  20645. prompt "Choose TLS provider"
  20646. default WPA_SUPPLICANT_INTERNAL
  20647. - depends on PACKAGE_wpa-supplicant || PACKAGE_wpa-supplicant-mesh || PACKAGE_wpad || PACKAGE_wpad-mesh
  20648. + depends on PACKAGE_wpa-supplicant || PACKAGE_wpad
  20649. config WPA_SUPPLICANT_INTERNAL
  20650. bool "internal"
  20651. - depends on PACKAGE_wpa-supplicant || PACKAGE_wpad
  20652. config WPA_SUPPLICANT_OPENSSL
  20653. bool "openssl"
  20654. diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile
  20655. index 8e706dc5a3dac630076e32eafbffbee2ba7e2976..5caf3e33786890b9c06a21365356fb39a7b4341d 100644
  20656. --- a/package/network/services/hostapd/Makefile
  20657. +++ b/package/network/services/hostapd/Makefile
  20658. @@ -7,18 +7,18 @@
  20659. include $(TOPDIR)/rules.mk
  20660. PKG_NAME:=hostapd
  20661. -PKG_VERSION:=2015-03-25
  20662. +PKG_VERSION:=2016-06-15
  20663. PKG_RELEASE:=1
  20664. -PKG_REV:=8278138e679174b1ec8af7f169c2810a8888e202
  20665. +PKG_REV:=31d3692fe5d56c05753ed4a70c7943979e1d29e7
  20666. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
  20667. -PKG_SOURCE_URL:=git://w1.fi/srv/git/hostap.git
  20668. +PKG_SOURCE_URL:=http://w1.fi/hostap.git
  20669. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  20670. PKG_SOURCE_VERSION:=$(PKG_REV)
  20671. PKG_SOURCE_PROTO:=git
  20672. # PKG_MIRROR_MD5SUM:=4e7c1f97edd7514535056fce54ae053a
  20673. -PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  20674. +PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  20675. PKG_LICENSE:=BSD-3-Clause
  20676. PKG_BUILD_PARALLEL:=1
  20677. @@ -29,7 +29,6 @@ PKG_CONFIG_DEPENDS:= \
  20678. CONFIG_PACKAGE_kmod-cfg80211 \
  20679. CONFIG_PACKAGE_hostapd \
  20680. CONFIG_PACKAGE_hostapd-mini \
  20681. - CONFIG_PACKAGE_kmod-hostap \
  20682. CONFIG_WPA_RFKILL_SUPPORT \
  20683. CONFIG_DRIVER_WEXT_SUPPORT \
  20684. CONFIG_DRIVER_11N_SUPPORT
  20685. @@ -40,6 +39,10 @@ LOCAL_TYPE=$(strip \
  20686. hostapd \
  20687. )))
  20688. LOCAL_VARIANT=$(patsubst wpad-%,%,$(patsubst supplicant-%,%,$(BUILD_VARIANT)))
  20689. +CONFIG_VARIANT:=$(LOCAL_VARIANT)
  20690. +ifeq ($(LOCAL_VARIANT),mesh)
  20691. + CONFIG_VARIANT:=full
  20692. +endif
  20693. ifeq ($(LOCAL_TYPE),supplicant)
  20694. ifeq ($(LOCAL_VARIANT),full)
  20695. @@ -47,10 +50,6 @@ ifeq ($(LOCAL_TYPE),supplicant)
  20696. CONFIG_WPA_SUPPLICANT_INTERNAL \
  20697. CONFIG_WPA_SUPPLICANT_OPENSSL
  20698. endif
  20699. - ifeq ($(LOCAL_VARIANT),mesh)
  20700. - PKG_CONFIG_DEPENDS += \
  20701. - CONFIG_WPA_SUPPLICANT_OPENSSL
  20702. - endif
  20703. endif
  20704. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
  20705. @@ -66,7 +65,6 @@ endif
  20706. DRIVER_MAKEOPTS= \
  20707. CONFIG_ACS=$(CONFIG_PACKAGE_kmod-cfg80211) \
  20708. CONFIG_DRIVER_NL80211=$(CONFIG_PACKAGE_kmod-cfg80211) \
  20709. - CONFIG_DRIVER_HOSTAP=$(CONFIG_PACKAGE_kmod-hostap) \
  20710. CONFIG_IEEE80211N=$(HOSTAPD_IEEE80211N) \
  20711. CONFIG_DRIVER_WEXT=$(CONFIG_DRIVER_WEXT_SUPPORT) \
  20712. @@ -82,7 +80,7 @@ ifneq ($(LOCAL_TYPE),hostapd)
  20713. endif
  20714. endif
  20715. ifeq ($(LOCAL_VARIANT),mesh)
  20716. - DRIVER_MAKEOPTS += CONFIG_TLS=openssl
  20717. + DRIVER_MAKEOPTS += CONFIG_TLS=openssl CONFIG_AP=y CONFIG_SAE=y CONFIG_MESH=y
  20718. TARGET_LDFLAGS += -lcrypto -lssl
  20719. endif
  20720. ifdef CONFIG_WPA_SUPPLICANT_NO_TIMESTAMP_CHECK
  20721. @@ -177,8 +175,7 @@ endef
  20722. define Package/wpad-mesh
  20723. $(call Package/wpad/Default)
  20724. TITLE+= (with 802.11s mesh and SAE support)
  20725. - DEPENDS:=$(DRV_DEPENDS) +libubus +libopenssl +@CONFIG_WPA_SUPPLICANT_OPENSSL @(!TARGET_uml||BROKEN)
  20726. - CONFLICTS:=@WPA_SUPPLICANT_INTERNAL
  20727. + DEPENDS:=$(DRV_DEPENDS) +libubus +PACKAGE_wpad-mesh:libopenssl @(!TARGET_uml||BROKEN)
  20728. VARIANT:=wpad-mesh
  20729. endef
  20730. @@ -257,12 +254,6 @@ define Package/hostapd-common
  20731. CATEGORY:=Network
  20732. endef
  20733. -define Package/hostapd-common-old
  20734. - TITLE:=hostapd/wpa_supplicant common support files (legacy drivers)
  20735. - SECTION:=net
  20736. - CATEGORY:=Network
  20737. -endef
  20738. -
  20739. define Package/eapol-test
  20740. TITLE:=802.1x authentication test utility
  20741. SECTION:=net
  20742. @@ -284,10 +275,10 @@ endif
  20743. define Build/Configure
  20744. $(Build/Configure/rebuild)
  20745. - $(if $(wildcard ./files/hostapd-$(LOCAL_VARIANT).config), \
  20746. - $(CP) ./files/hostapd-$(LOCAL_VARIANT).config $(PKG_BUILD_DIR)/hostapd/.config \
  20747. + $(if $(wildcard ./files/hostapd-$(CONFIG_VARIANT).config), \
  20748. + $(CP) ./files/hostapd-$(CONFIG_VARIANT).config $(PKG_BUILD_DIR)/hostapd/.config \
  20749. )
  20750. - $(CP) ./files/wpa_supplicant-$(LOCAL_VARIANT).config $(PKG_BUILD_DIR)/wpa_supplicant/.config
  20751. + $(CP) ./files/wpa_supplicant-$(CONFIG_VARIANT).config $(PKG_BUILD_DIR)/wpa_supplicant/.config
  20752. endef
  20753. TARGET_CPPFLAGS := \
  20754. @@ -379,12 +370,6 @@ define Package/hostapd-common/install
  20755. $(INSTALL_DATA) ./files/netifd.sh $(1)/lib/netifd/hostapd.sh
  20756. endef
  20757. -define Package/hostapd-common-old/install
  20758. - $(INSTALL_DIR) $(1)/lib/wifi
  20759. - $(INSTALL_DATA) ./files/hostapd.sh $(1)/lib/wifi/hostapd.sh
  20760. - $(INSTALL_DATA) ./files/wpa_supplicant.sh $(1)/lib/wifi/wpa_supplicant.sh
  20761. -endef
  20762. -
  20763. define Package/hostapd/install
  20764. $(call Install/hostapd,$(1))
  20765. $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd $(1)/usr/sbin/
  20766. @@ -442,5 +427,4 @@ $(eval $(call BuildPackage,wpa-supplicant-p2p))
  20767. $(eval $(call BuildPackage,wpa-cli))
  20768. $(eval $(call BuildPackage,hostapd-utils))
  20769. $(eval $(call BuildPackage,hostapd-common))
  20770. -$(eval $(call BuildPackage,hostapd-common-old))
  20771. $(eval $(call BuildPackage,eapol-test))
  20772. diff --git a/package/network/services/hostapd/files/hostapd-full.config b/package/network/services/hostapd/files/hostapd-full.config
  20773. index f1b2655cfcb7f8cbc61399eb3ffb886770b55a3f..e388109fbb6bac4b965e5fced6e2cc189f883255 100644
  20774. --- a/package/network/services/hostapd/files/hostapd-full.config
  20775. +++ b/package/network/services/hostapd/files/hostapd-full.config
  20776. @@ -10,7 +10,7 @@
  20777. # to override previous values of the variables.
  20778. # Driver interface for Host AP driver
  20779. -CONFIG_DRIVER_HOSTAP=y
  20780. +#CONFIG_DRIVER_HOSTAP=y
  20781. # Driver interface for wired authenticator
  20782. CONFIG_DRIVER_WIRED=y
  20783. @@ -53,6 +53,9 @@ CONFIG_PEERKEY=y
  20784. # Integrated EAP server
  20785. CONFIG_EAP=y
  20786. +# EAP-FAST for the integrated EAP server
  20787. +CONFIG_EAP_FAST=y
  20788. +
  20789. # EAP-MD5 for the integrated EAP server
  20790. CONFIG_EAP_MD5=y
  20791. diff --git a/package/network/services/hostapd/files/hostapd-mini.config b/package/network/services/hostapd/files/hostapd-mini.config
  20792. index 118d97cb3a21c195bc903fde2d4f885699b2425b..8baff18fe47a0322b2c6b3312581635ccf518143 100644
  20793. --- a/package/network/services/hostapd/files/hostapd-mini.config
  20794. +++ b/package/network/services/hostapd/files/hostapd-mini.config
  20795. @@ -10,7 +10,7 @@
  20796. # to override previous values of the variables.
  20797. # Driver interface for Host AP driver
  20798. -CONFIG_DRIVER_HOSTAP=y
  20799. +#CONFIG_DRIVER_HOSTAP=y
  20800. # Driver interface for wired authenticator
  20801. CONFIG_DRIVER_WIRED=y
  20802. diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh
  20803. deleted file mode 100644
  20804. index 7aec7ad8a40ae843453e2c3e8f812a93c9635320..0000000000000000000000000000000000000000
  20805. --- a/package/network/services/hostapd/files/hostapd.sh
  20806. +++ /dev/null
  20807. @@ -1,394 +0,0 @@
  20808. -hostapd_set_bss_options() {
  20809. - local var="$1"
  20810. - local vif="$2"
  20811. - local enc wep_rekey wpa_group_rekey wpa_pair_rekey wpa_master_rekey wps_possible wpa_key_mgmt
  20812. -
  20813. - config_get enc "$vif" encryption "none"
  20814. - config_get wep_rekey "$vif" wep_rekey # 300
  20815. - config_get wpa_group_rekey "$vif" wpa_group_rekey # 300
  20816. - config_get wpa_pair_rekey "$vif" wpa_pair_rekey # 300
  20817. - config_get wpa_master_rekey "$vif" wpa_master_rekey # 640
  20818. - config_get_bool ap_isolate "$vif" isolate 0
  20819. - config_get_bool disassoc_low_ack "$vif" disassoc_low_ack 1
  20820. - config_get max_num_sta "$vif" max_num_sta 0
  20821. - config_get max_inactivity "$vif" max_inactivity 0
  20822. - config_get_bool preamble "$vif" short_preamble 1
  20823. -
  20824. - config_get device "$vif" device
  20825. - config_get hwmode "$device" hwmode
  20826. - config_get phy "$device" phy
  20827. -
  20828. - append "$var" "ctrl_interface=/var/run/hostapd-$phy" "$N"
  20829. -
  20830. - if [ "$ap_isolate" -gt 0 ]; then
  20831. - append "$var" "ap_isolate=$ap_isolate" "$N"
  20832. - fi
  20833. - if [ "$max_num_sta" -gt 0 ]; then
  20834. - append "$var" "max_num_sta=$max_num_sta" "$N"
  20835. - fi
  20836. - if [ "$max_inactivity" -gt 0 ]; then
  20837. - append "$var" "ap_max_inactivity=$max_inactivity" "$N"
  20838. - fi
  20839. - append "$var" "disassoc_low_ack=$disassoc_low_ack" "$N"
  20840. - if [ "$preamble" -gt 0 ]; then
  20841. - append "$var" "preamble=$preamble" "$N"
  20842. - fi
  20843. -
  20844. - # Examples:
  20845. - # psk-mixed/tkip => WPA1+2 PSK, TKIP
  20846. - # wpa-psk2/tkip+aes => WPA2 PSK, CCMP+TKIP
  20847. - # wpa2/tkip+aes => WPA2 RADIUS, CCMP+TKIP
  20848. - # ...
  20849. -
  20850. - # TODO: move this parsing function somewhere generic, so that
  20851. - # later it can be reused by drivers that don't use hostapd
  20852. -
  20853. - # crypto defaults: WPA2 vs WPA1
  20854. - case "$enc" in
  20855. - wpa2*|*psk2*)
  20856. - wpa=2
  20857. - crypto="CCMP"
  20858. - ;;
  20859. - *mixed*)
  20860. - wpa=3
  20861. - crypto="CCMP TKIP"
  20862. - ;;
  20863. - *)
  20864. - wpa=1
  20865. - crypto="TKIP"
  20866. - ;;
  20867. - esac
  20868. -
  20869. - # explicit override for crypto setting
  20870. - case "$enc" in
  20871. - *tkip+aes|*tkip+ccmp|*aes+tkip|*ccmp+tkip) crypto="CCMP TKIP";;
  20872. - *aes|*ccmp) crypto="CCMP";;
  20873. - *tkip) crypto="TKIP";;
  20874. - esac
  20875. -
  20876. - # enforce CCMP for 11ng and 11na
  20877. - case "$hwmode:$crypto" in
  20878. - *ng:TKIP|*na:TKIP) crypto="CCMP TKIP";;
  20879. - esac
  20880. -
  20881. - # use crypto/auth settings for building the hostapd config
  20882. - case "$enc" in
  20883. - none)
  20884. - wps_possible=1
  20885. - wpa=0
  20886. - crypto=
  20887. - # Here we make the assumption that if we're in open mode
  20888. - # with WPS enabled, we got to be in unconfigured state.
  20889. - wps_not_configured=1
  20890. - ;;
  20891. - *psk*)
  20892. - config_get psk "$vif" key
  20893. - if [ ${#psk} -eq 64 ]; then
  20894. - append "$var" "wpa_psk=$psk" "$N"
  20895. - else
  20896. - append "$var" "wpa_passphrase=$psk" "$N"
  20897. - fi
  20898. - wps_possible=1
  20899. - [ -n "$wpa_group_rekey" ] && append "$var" "wpa_group_rekey=$wpa_group_rekey" "$N"
  20900. - [ -n "$wpa_pair_rekey" ] && append "$var" "wpa_ptk_rekey=$wpa_pair_rekey" "$N"
  20901. - [ -n "$wpa_master_rekey" ] && append "$var" "wpa_gmk_rekey=$wpa_master_rekey" "$N"
  20902. - append wpa_key_mgmt "WPA-PSK"
  20903. - ;;
  20904. - *wpa*|*8021x*)
  20905. - # required fields? formats?
  20906. - # hostapd is particular, maybe a default configuration for failures
  20907. - config_get auth_server "$vif" auth_server
  20908. - [ -z "$auth_server" ] && config_get auth_server "$vif" server
  20909. - append "$var" "auth_server_addr=$auth_server" "$N"
  20910. - config_get auth_port "$vif" auth_port
  20911. - [ -z "$auth_port" ] && config_get auth_port "$vif" port
  20912. - auth_port=${auth_port:-1812}
  20913. - append "$var" "auth_server_port=$auth_port" "$N"
  20914. - config_get auth_secret "$vif" auth_secret
  20915. - [ -z "$auth_secret" ] && config_get auth_secret "$vif" key
  20916. - append "$var" "auth_server_shared_secret=$auth_secret" "$N"
  20917. - # You don't really want to enable this unless you are doing
  20918. - # some corner case testing or are using OpenWrt as a work around
  20919. - # for some systematic issues.
  20920. - config_get_bool auth_cache "$vif" auth_cache 0
  20921. - config_get rsn_preauth "$vif" rsn_preauth
  20922. - [ "$auth_cache" -gt 0 ] || [[ "$rsn_preauth" = 1 ]] || append "$var" "disable_pmksa_caching=1" "$N"
  20923. - [ "$auth_cache" -gt 0 ] || [[ "$rsn_preauth" = 1 ]] || append "$var" "okc=0" "$N"
  20924. - config_get acct_server "$vif" acct_server
  20925. - [ -n "$acct_server" ] && append "$var" "acct_server_addr=$acct_server" "$N"
  20926. - config_get acct_port "$vif" acct_port
  20927. - [ -n "$acct_port" ] && acct_port=${acct_port:-1813}
  20928. - [ -n "$acct_port" ] && append "$var" "acct_server_port=$acct_port" "$N"
  20929. - config_get acct_secret "$vif" acct_secret
  20930. - [ -n "$acct_secret" ] && append "$var" "acct_server_shared_secret=$acct_secret" "$N"
  20931. - config_get eap_reauth_period "$vif" eap_reauth_period
  20932. - [ -n "$eap_reauth_period" ] && append "$var" "eap_reauth_period=$eap_reauth_period" "$N"
  20933. - config_get dae_client "$vif" dae_client
  20934. - config_get dae_secret "$vif" dae_secret
  20935. - [ -n "$dae_client" -a -n "$dae_secret" ] && {
  20936. - config_get dae_port "$vif" dae_port
  20937. - append "$var" "radius_das_port=${dae_port:-3799}" "$N"
  20938. - append "$var" "radius_das_client=$dae_client $dae_secret" "$N"
  20939. - }
  20940. - config_get ownip "$vif" ownip
  20941. - append "$var" "own_ip_addr=$ownip" "$N"
  20942. - append "$var" "eapol_key_index_workaround=1" "$N"
  20943. - append "$var" "ieee8021x=1" "$N"
  20944. - append wpa_key_mgmt "WPA-EAP"
  20945. - [ -n "$wpa_group_rekey" ] && append "$var" "wpa_group_rekey=$wpa_group_rekey" "$N"
  20946. - [ -n "$wpa_pair_rekey" ] && append "$var" "wpa_ptk_rekey=$wpa_pair_rekey" "$N"
  20947. - [ -n "$wpa_master_rekey" ] && append "$var" "wpa_gmk_rekey=$wpa_master_rekey" "$N"
  20948. - ;;
  20949. - *wep*)
  20950. - config_get key "$vif" key
  20951. - key="${key:-1}"
  20952. - case "$key" in
  20953. - [1234])
  20954. - for idx in 1 2 3 4; do
  20955. - local zidx
  20956. - zidx=$(($idx - 1))
  20957. - config_get ckey "$vif" "key${idx}"
  20958. - [ -n "$ckey" ] && \
  20959. - append "$var" "wep_key${zidx}=$(prepare_key_wep "$ckey")" "$N"
  20960. - done
  20961. - append "$var" "wep_default_key=$((key - 1))" "$N"
  20962. - ;;
  20963. - *)
  20964. - append "$var" "wep_key0=$(prepare_key_wep "$key")" "$N"
  20965. - append "$var" "wep_default_key=0" "$N"
  20966. - [ -n "$wep_rekey" ] && append "$var" "wep_rekey_period=$wep_rekey" "$N"
  20967. - ;;
  20968. - esac
  20969. - case "$enc" in
  20970. - *shared*)
  20971. - auth_algs=2
  20972. - ;;
  20973. - *mixed*)
  20974. - auth_algs=3
  20975. - ;;
  20976. - esac
  20977. - wpa=0
  20978. - crypto=
  20979. - ;;
  20980. - *)
  20981. - wpa=0
  20982. - crypto=
  20983. - ;;
  20984. - esac
  20985. - append "$var" "auth_algs=${auth_algs:-1}" "$N"
  20986. - append "$var" "wpa=$wpa" "$N"
  20987. - [ -n "$crypto" ] && append "$var" "wpa_pairwise=$crypto" "$N"
  20988. - [ -n "$wpa_group_rekey" ] && append "$var" "wpa_group_rekey=$wpa_group_rekey" "$N"
  20989. -
  20990. - config_get ssid "$vif" ssid
  20991. - config_get bridge "$vif" bridge
  20992. - config_get ieee80211d "$vif" ieee80211d
  20993. - config_get iapp_interface "$vif" iapp_interface
  20994. -
  20995. - config_get_bool wps_pbc "$vif" wps_pushbutton 0
  20996. - config_get_bool wps_label "$vif" wps_label 0
  20997. -
  20998. - config_get config_methods "$vif" wps_config
  20999. - [ "$wps_pbc" -gt 0 ] && append config_methods push_button
  21000. -
  21001. - [ -n "$wps_possible" -a -n "$config_methods" ] && {
  21002. - config_get device_type "$vif" wps_device_type "6-0050F204-1"
  21003. - config_get device_name "$vif" wps_device_name "OpenWrt AP"
  21004. - config_get manufacturer "$vif" wps_manufacturer "openwrt.org"
  21005. - config_get wps_pin "$vif" wps_pin
  21006. -
  21007. - config_get_bool ext_registrar "$vif" ext_registrar 0
  21008. - [ "$ext_registrar" -gt 0 -a -n "$bridge" ] && append "$var" "upnp_iface=$bridge" "$N"
  21009. -
  21010. - append "$var" "eap_server=1" "$N"
  21011. - [ -n "$wps_pin" ] && append "$var" "ap_pin=$wps_pin" "$N"
  21012. - append "$var" "wps_state=${wps_not_configured:-2}" "$N"
  21013. - append "$var" "ap_setup_locked=0" "$N"
  21014. - append "$var" "device_type=$device_type" "$N"
  21015. - append "$var" "device_name=$device_name" "$N"
  21016. - append "$var" "manufacturer=$manufacturer" "$N"
  21017. - append "$var" "config_methods=$config_methods" "$N"
  21018. - }
  21019. -
  21020. - append "$var" "ssid=$ssid" "$N"
  21021. - [ -n "$bridge" ] && append "$var" "bridge=$bridge" "$N"
  21022. - [ -n "$ieee80211d" ] && append "$var" "ieee80211d=$ieee80211d" "$N"
  21023. - [ -n "$iapp_interface" ] && append "$var" iapp_interface=$(uci_get_state network "$iapp_interface" ifname "$iapp_interface") "$N"
  21024. -
  21025. - if [ "$wpa" -ge "1" ]
  21026. - then
  21027. - config_get nasid "$vif" nasid
  21028. - [ -n "$nasid" ] && append "$var" "nas_identifier=$nasid" "$N"
  21029. -
  21030. - config_get_bool ieee80211r "$vif" ieee80211r 0
  21031. - if [ "$ieee80211r" -gt 0 ]
  21032. - then
  21033. - config_get mobility_domain "$vif" mobility_domain "4f57"
  21034. - config_get r0_key_lifetime "$vif" r0_key_lifetime "10000"
  21035. - config_get r1_key_holder "$vif" r1_key_holder "00004f577274"
  21036. - config_get reassociation_deadline "$vif" reassociation_deadline "1000"
  21037. - config_get r0kh "$vif" r0kh
  21038. - config_get r1kh "$vif" r1kh
  21039. - config_get_bool pmk_r1_push "$vif" pmk_r1_push 0
  21040. -
  21041. - append "$var" "mobility_domain=$mobility_domain" "$N"
  21042. - append "$var" "r0_key_lifetime=$r0_key_lifetime" "$N"
  21043. - append "$var" "r1_key_holder=$r1_key_holder" "$N"
  21044. - append "$var" "reassociation_deadline=$reassociation_deadline" "$N"
  21045. - append "$var" "pmk_r1_push=$pmk_r1_push" "$N"
  21046. -
  21047. - for kh in $r0kh; do
  21048. - "$var" "r0kh=${kh//,/ }" "$N"
  21049. - done
  21050. - for kh in $r1kh; do
  21051. - "$var" "r1kh=${kh//,/ }" "$N"
  21052. - done
  21053. -
  21054. - [ "$wpa_key_mgmt" != "${wpa_key_mgmt/EAP/}" ] && append wpa_key_mgmt "FT-EAP"
  21055. - [ "$wpa_key_mgmt" != "${wpa_key_mgmt/PSK/}" ] && append wpa_key_mgmt "FT-PSK"
  21056. - fi
  21057. -
  21058. - [ -n "wpa_key_mgmt" ] && append "$var" "wpa_key_mgmt=$wpa_key_mgmt"
  21059. - fi
  21060. -
  21061. - if [ "$wpa" -ge "2" ]
  21062. - then
  21063. - # RSN -> allow preauthentication. You have two
  21064. - # options, rsn_preauth for production or rsn_preauth_testing
  21065. - # for validation / testing.
  21066. - if [ -n "$bridge" -a "$rsn_preauth" = 1 ]
  21067. - then
  21068. - append "$var" "rsn_preauth=1" "$N"
  21069. - append "$var" "rsn_preauth_interfaces=$bridge" "$N"
  21070. - append "$var" "okc=1" "$N"
  21071. - else
  21072. - # RSN preauthentication testings hould disable
  21073. - # Opportunistic Key Caching (okc) as otherwise the PMKSA
  21074. - # entry for a test could come from the Opportunistic Key Caching
  21075. - config_get rsn_preauth_testing "$vif" rsn_preauth_testing
  21076. - if [ -n "$bridge" -a "$rsn_preauth_testing" = 1 ]
  21077. - then
  21078. - append "$var" "rsn_preauth=1" "$N"
  21079. - append "$var" "rsn_preauth_interfaces=$bridge" "$N"
  21080. - append "$var" "okc=0" "$N"
  21081. - fi
  21082. - fi
  21083. -
  21084. - # RSN -> allow management frame protection
  21085. - config_get ieee80211w "$vif" ieee80211w
  21086. - case "$ieee80211w" in
  21087. - [012])
  21088. - append "$var" "ieee80211w=$ieee80211w" "$N"
  21089. - [ "$ieee80211w" -gt "0" ] && {
  21090. - config_get ieee80211w_max_timeout "$vif" ieee80211w_max_timeout
  21091. - config_get ieee80211w_retry_timeout "$vif" ieee80211w_retry_timeout
  21092. - [ -n "$ieee80211w_max_timeout" ] && \
  21093. - append "$var" "assoc_sa_query_max_timeout=$ieee80211w_max_timeout" "$N"
  21094. - [ -n "$ieee80211w_retry_timeout" ] && \
  21095. - append "$var" "assoc_sa_query_retry_timeout=$ieee80211w_retry_timeout" "$N"
  21096. - }
  21097. - ;;
  21098. - esac
  21099. - fi
  21100. -
  21101. - config_get macfile "$vif" macfile
  21102. - config_get maclist "$vif" maclist
  21103. - if [ -z "$macfile" ]
  21104. - then
  21105. - # if no macfile has been specified, fallback to the default name
  21106. - # and truncate file to avoid aggregating entries over time
  21107. - macfile="/var/run/hostapd-$ifname.maclist"
  21108. - echo "" > "$macfile"
  21109. - else
  21110. - if [ -n "$maclist" ]
  21111. - then
  21112. - # to avoid to overwrite the original file, make a copy
  21113. - # before appending the entries specified by the maclist
  21114. - # option
  21115. - cp $macfile $macfile.maclist
  21116. - macfile=$macfile.maclist
  21117. - fi
  21118. - fi
  21119. -
  21120. - if [ -n "$maclist" ]
  21121. - then
  21122. - for mac in $maclist; do
  21123. - echo "$mac" >> $macfile
  21124. - done
  21125. - fi
  21126. -
  21127. - config_get macfilter "$vif" macfilter
  21128. - case "$macfilter" in
  21129. - allow)
  21130. - append "$var" "macaddr_acl=1" "$N"
  21131. - append "$var" "accept_mac_file=$macfile" "$N"
  21132. - ;;
  21133. - deny)
  21134. - append "$var" "macaddr_acl=0" "$N"
  21135. - append "$var" "deny_mac_file=$macfile" "$N"
  21136. - ;;
  21137. - esac
  21138. -}
  21139. -
  21140. -hostapd_set_log_options() {
  21141. - local var="$1"
  21142. - local cfg="$2"
  21143. - local log_level log_80211 log_8021x log_radius log_wpa log_driver log_iapp log_mlme
  21144. -
  21145. - config_get log_level "$cfg" log_level 2
  21146. -
  21147. - config_get_bool log_80211 "$cfg" log_80211 1
  21148. - config_get_bool log_8021x "$cfg" log_8021x 1
  21149. - config_get_bool log_radius "$cfg" log_radius 1
  21150. - config_get_bool log_wpa "$cfg" log_wpa 1
  21151. - config_get_bool log_driver "$cfg" log_driver 1
  21152. - config_get_bool log_iapp "$cfg" log_iapp 1
  21153. - config_get_bool log_mlme "$cfg" log_mlme 1
  21154. -
  21155. - local log_mask=$(( \
  21156. - ($log_80211 << 0) | \
  21157. - ($log_8021x << 1) | \
  21158. - ($log_radius << 2) | \
  21159. - ($log_wpa << 3) | \
  21160. - ($log_driver << 4) | \
  21161. - ($log_iapp << 5) | \
  21162. - ($log_mlme << 6) \
  21163. - ))
  21164. -
  21165. - append "$var" "logger_syslog=$log_mask" "$N"
  21166. - append "$var" "logger_syslog_level=$log_level" "$N"
  21167. - append "$var" "logger_stdout=$log_mask" "$N"
  21168. - append "$var" "logger_stdout_level=$log_level" "$N"
  21169. -}
  21170. -
  21171. -hostapd_setup_vif() {
  21172. - local vif="$1"
  21173. - local driver="$2"
  21174. - local ifname device channel hwmode
  21175. -
  21176. - hostapd_cfg=
  21177. -
  21178. - config_get ifname "$vif" ifname
  21179. - config_get device "$vif" device
  21180. - config_get channel "$device" channel
  21181. - config_get hwmode "$device" hwmode
  21182. -
  21183. - hostapd_set_log_options hostapd_cfg "$device"
  21184. - hostapd_set_bss_options hostapd_cfg "$vif"
  21185. -
  21186. - case "$hwmode" in
  21187. - *bg|*gdt|*gst|*fh) hwmode=g;;
  21188. - *adt|*ast) hwmode=a;;
  21189. - esac
  21190. - [ "$channel" = auto ] && channel=
  21191. - [ -n "$channel" -a -z "$hwmode" ] && wifi_fixup_hwmode "$device"
  21192. - cat > /var/run/hostapd-$ifname.conf <<EOF
  21193. -driver=$driver
  21194. -interface=$ifname
  21195. -${hwmode:+hw_mode=${hwmode#11}}
  21196. -${channel:+channel=$channel}
  21197. -$hostapd_cfg
  21198. -EOF
  21199. - hostapd -P /var/run/wifi-$ifname.pid -B /var/run/hostapd-$ifname.conf
  21200. -}
  21201. -
  21202. diff --git a/package/network/services/hostapd/files/netifd.sh b/package/network/services/hostapd/files/netifd.sh
  21203. index 23d2e7e83ebe5ca744f40e300fdbfb1014c555c5..e6b0b0d769c6301f05696d4ca963241c3ac11620 100644
  21204. --- a/package/network/services/hostapd/files/netifd.sh
  21205. +++ b/package/network/services/hostapd/files/netifd.sh
  21206. @@ -1,3 +1,5 @@
  21207. +. /lib/functions/network.sh
  21208. +
  21209. wpa_supplicant_add_rate() {
  21210. local var="$1"
  21211. local val="$(($2 / 1000))"
  21212. @@ -120,6 +122,7 @@ hostapd_common_add_bss_config() {
  21213. config_add_boolean rsn_preauth auth_cache
  21214. config_add_int ieee80211w
  21215. + config_add_int eapol_version
  21216. config_add_string 'auth_server:host' 'server:host'
  21217. config_add_string auth_secret
  21218. @@ -136,10 +139,11 @@ hostapd_common_add_bss_config() {
  21219. config_add_string nasid
  21220. config_add_string ownip
  21221. config_add_string iapp_interface
  21222. - config_add_string eap_type ca_cert client_cert identity auth priv_key priv_key_pwd
  21223. + config_add_string eap_type ca_cert client_cert identity anonymous_identity auth priv_key priv_key_pwd
  21224. config_add_int dynamic_vlan vlan_naming
  21225. config_add_string vlan_tagged_interface vlan_bridge
  21226. + config_add_string vlan_file
  21227. config_add_string 'key1:wepkey' 'key2:wepkey' 'key3:wepkey' 'key4:wepkey' 'password:wpakey'
  21228. @@ -182,7 +186,7 @@ hostapd_set_bss_options() {
  21229. wps_pushbutton wps_label ext_registrar wps_pbc_in_m1 \
  21230. wps_device_type wps_device_name wps_manufacturer wps_pin \
  21231. macfilter ssid wmm uapsd hidden short_preamble rsn_preauth \
  21232. - iapp_interface
  21233. + iapp_interface eapol_version acct_server acct_secret acct_port
  21234. set_default isolate 0
  21235. set_default maxassoc 0
  21236. @@ -192,6 +196,8 @@ hostapd_set_bss_options() {
  21237. set_default hidden 0
  21238. set_default wmm 1
  21239. set_default uapsd 1
  21240. + set_default eapol_version 0
  21241. + set_default acct_port 1813
  21242. append bss_conf "ctrl_interface=/var/run/hostapd"
  21243. if [ "$isolate" -gt 0 ]; then
  21244. @@ -216,6 +222,13 @@ hostapd_set_bss_options() {
  21245. [ -n "$wpa_master_rekey" ] && append bss_conf "wpa_gmk_rekey=$wpa_master_rekey" "$N"
  21246. }
  21247. + [ -n "$acct_server" ] && {
  21248. + append bss_conf "acct_server_addr=$acct_server" "$N"
  21249. + append bss_conf "acct_server_port=$acct_port" "$N"
  21250. + [ -n "$acct_secret" ] && \
  21251. + append bss_conf "acct_server_shared_secret=$acct_secret" "$N"
  21252. + }
  21253. +
  21254. case "$auth_type" in
  21255. none)
  21256. wps_possible=1
  21257. @@ -237,18 +250,19 @@ hostapd_set_bss_options() {
  21258. [ -e "$wpa_psk_file" ] || touch "$wpa_psk_file"
  21259. append bss_conf "wpa_psk_file=$wpa_psk_file" "$N"
  21260. }
  21261. + [ "$eapol_version" -ge "1" -a "$eapol_version" -le "2" ] && append bss_conf "eapol_version=$eapol_version" "$N"
  21262. +
  21263. wps_possible=1
  21264. append wpa_key_mgmt "WPA-PSK"
  21265. ;;
  21266. eap)
  21267. json_get_vars \
  21268. auth_server auth_secret auth_port \
  21269. - acct_server acct_secret acct_port \
  21270. dae_client dae_secret dae_port \
  21271. ownip \
  21272. eap_reauth_period dynamic_vlan \
  21273. vlan_naming vlan_tagged_interface \
  21274. - vlan_bridge
  21275. + vlan_bridge vlan_file
  21276. # legacy compatibility
  21277. [ -n "$auth_server" ] || json_get_var auth_server server
  21278. @@ -256,7 +270,6 @@ hostapd_set_bss_options() {
  21279. [ -n "$auth_secret" ] || json_get_var auth_secret key
  21280. set_default auth_port 1812
  21281. - set_default acct_port 1813
  21282. set_default dae_port 3799
  21283. set_default vlan_naming 1
  21284. @@ -265,13 +278,6 @@ hostapd_set_bss_options() {
  21285. append bss_conf "auth_server_port=$auth_port" "$N"
  21286. append bss_conf "auth_server_shared_secret=$auth_secret" "$N"
  21287. - [ -n "$acct_server" ] && {
  21288. - append bss_conf "acct_server_addr=$acct_server" "$N"
  21289. - append bss_conf "acct_server_port=$acct_port" "$N"
  21290. - [ -n "$acct_secret" ] && \
  21291. - append bss_conf "acct_server_shared_secret=$acct_secret" "$N"
  21292. - }
  21293. -
  21294. [ -n "$eap_reauth_period" ] && append bss_conf "eap_reauth_period=$eap_reauth_period" "$N"
  21295. [ -n "$dae_client" -a -n "$dae_secret" ] && {
  21296. @@ -291,7 +297,13 @@ hostapd_set_bss_options() {
  21297. append bss_conf "vlan_bridge=$vlan_bridge" "$N"
  21298. [ -n "$vlan_tagged_interface" ] && \
  21299. append bss_conf "vlan_tagged_interface=$vlan_tagged_interface" "$N"
  21300. + [ -n "$vlan_file" ] && {
  21301. + [ -e "$vlan_file" ] || touch "$vlan_file"
  21302. + append bss_conf "vlan_file=$vlan_file" "$N"
  21303. + }
  21304. }
  21305. +
  21306. + [ "$eapol_version" -ge "1" -a "$eapol_version" -le "2" ] && append bss_conf "eapol_version=$eapol_version" "$N"
  21307. ;;
  21308. wep)
  21309. local wep_keyidx=0
  21310. @@ -318,8 +330,8 @@ hostapd_set_bss_options() {
  21311. [ -n "$wps_possible" -a -n "$config_methods" ] && {
  21312. set_default ext_registrar 0
  21313. set_default wps_device_type "6-0050F204-1"
  21314. - set_default wps_device_name "OpenWrt AP"
  21315. - set_default wps_manufacturer "openwrt.org"
  21316. + set_default wps_device_name "Lede AP"
  21317. + set_default wps_manufacturer "www.lede-project.org"
  21318. wps_state=2
  21319. [ -n "$wps_configured" ] && wps_state=1
  21320. @@ -340,8 +352,9 @@ hostapd_set_bss_options() {
  21321. append bss_conf "ssid=$ssid" "$N"
  21322. [ -n "$network_bridge" ] && append bss_conf "bridge=$network_bridge" "$N"
  21323. [ -n "$iapp_interface" ] && {
  21324. - iapp_interface="$(uci_get_state network "$iapp_interface" ifname "$iapp_interface")"
  21325. - [ -n "$iapp_interface" ] && append bss_conf "iapp_interface=$iapp_interface" "$N"
  21326. + local ifname
  21327. + network_get_device ifname "$iapp_interface" || ifname = "$iapp_interface"
  21328. + append bss_conf "iapp_interface=$ifname" "$N"
  21329. }
  21330. if [ "$wpa" -ge "1" ]; then
  21331. @@ -522,9 +535,15 @@ wpa_supplicant_prepare_interface() {
  21332. _w_modestr="mode=1"
  21333. }
  21334. + local country_str=
  21335. + [ -n "$country" ] && {
  21336. + country_str="country=$country"
  21337. + }
  21338. +
  21339. wpa_supplicant_teardown_interface "$ifname"
  21340. cat > "$_config" <<EOF
  21341. $ap_scan
  21342. +$country_str
  21343. EOF
  21344. return 0
  21345. }
  21346. @@ -538,7 +557,9 @@ wpa_supplicant_add_network() {
  21347. json_get_vars \
  21348. ssid bssid key \
  21349. basic_rate mcast_rate \
  21350. - ieee80211w
  21351. + ieee80211w ieee80211r
  21352. +
  21353. + set_default ieee80211r 0
  21354. local key_mgmt='NONE'
  21355. local enc_str=
  21356. @@ -549,6 +570,8 @@ wpa_supplicant_add_network() {
  21357. local scan_ssid="scan_ssid=1"
  21358. local freq
  21359. + [ "$ieee80211r" -gt 0 ] && wpa_key_mgmt="FT-PSK $wpa_key_mgmt"
  21360. +
  21361. [[ "$_w_mode" = "adhoc" ]] && {
  21362. append network_data "mode=1" "$N$T"
  21363. [ -n "$channel" ] && {
  21364. @@ -563,6 +586,9 @@ wpa_supplicant_add_network() {
  21365. }
  21366. [[ "$_w_mode" = "mesh" ]] && {
  21367. + json_get_vars mesh_id
  21368. + ssid="${mesh_id}"
  21369. +
  21370. append network_data "mode=5" "$N$T"
  21371. [ -n "$channel" ] && {
  21372. freq="$(get_freq "$phy" "$channel")"
  21373. @@ -594,10 +620,12 @@ wpa_supplicant_add_network() {
  21374. ;;
  21375. eap)
  21376. key_mgmt='WPA-EAP'
  21377. + [ "$ieee80211r" -gt 0 ] && key_mgmt="FT-EAP $key_mgmt"
  21378. - json_get_vars eap_type identity ca_cert
  21379. + json_get_vars eap_type identity anonymous_identity ca_cert
  21380. [ -n "$ca_cert" ] && append network_data "ca_cert=\"$ca_cert\"" "$N$T"
  21381. [ -n "$identity" ] && append network_data "identity=\"$identity\"" "$N$T"
  21382. + [ -n "$anonymous_identity" ] && append network_data "anonymous_identity=\"$anonymous_identity\"" "$N$T"
  21383. case "$eap_type" in
  21384. tls)
  21385. json_get_vars client_cert priv_key priv_key_pwd
  21386. @@ -605,11 +633,32 @@ wpa_supplicant_add_network() {
  21387. append network_data "private_key=\"$priv_key\"" "$N$T"
  21388. append network_data "private_key_passwd=\"$priv_key_pwd\"" "$N$T"
  21389. ;;
  21390. - peap|ttls)
  21391. - json_get_vars auth password
  21392. + fast|peap|ttls)
  21393. + json_get_vars auth password ca_cert2 client_cert2 priv_key2 priv_key2_pwd
  21394. set_default auth MSCHAPV2
  21395. - append network_data "phase2=\"$auth\"" "$N$T"
  21396. - append network_data "password=\"$password\"" "$N$T"
  21397. +
  21398. + if [ "$auth" = "EAP-TLS" ]; then
  21399. + [ -n "$ca_cert2" ] &&
  21400. + append network_data "ca_cert2=\"$ca_cert2\"" "$N$T"
  21401. + append network_data "client_cert2=\"$client_cert2\"" "$N$T"
  21402. + append network_data "private_key2=\"$priv_key2\"" "$N$T"
  21403. + append network_data "private_key2_passwd=\"$priv_key2_pwd\"" "$N$T"
  21404. + else
  21405. + append network_data "password=\"$password\"" "$N$T"
  21406. + fi
  21407. +
  21408. + phase2proto="auth="
  21409. + case "$auth" in
  21410. + "auth"*)
  21411. + phase2proto=""
  21412. + ;;
  21413. + "EAP-"*)
  21414. + auth="$(echo $auth | cut -b 5- )"
  21415. + [ "$eap_type" = "ttls" ] &&
  21416. + phase2proto="autheap="
  21417. + ;;
  21418. + esac
  21419. + append network_data "phase2=\"$phase2proto$auth\"" "$N$T"
  21420. ;;
  21421. esac
  21422. append network_data "eap=$(echo $eap_type | tr 'a-z' 'A-Z')" "$N$T"
  21423. diff --git a/package/network/services/hostapd/files/wpa_supplicant-full.config b/package/network/services/hostapd/files/wpa_supplicant-full.config
  21424. index a9d04ab1752bf8cd8a51d5d4a7cb0431463add57..18c3f9a5c142b2eda67ec3136c73114555c4d131 100644
  21425. --- a/package/network/services/hostapd/files/wpa_supplicant-full.config
  21426. +++ b/package/network/services/hostapd/files/wpa_supplicant-full.config
  21427. @@ -41,7 +41,7 @@
  21428. # Driver interface for Host AP driver
  21429. -CONFIG_DRIVER_HOSTAP=y
  21430. +#CONFIG_DRIVER_HOSTAP=y
  21431. # Driver interface for Agere driver
  21432. #CONFIG_DRIVER_HERMES=y
  21433. @@ -121,6 +121,9 @@ CONFIG_DRIVER_WIRED=y
  21434. # included)
  21435. CONFIG_IEEE8021X_EAPOL=y
  21436. +# EAP-FAST
  21437. +CONFIG_EAP_FAST=y
  21438. +
  21439. # EAP-MD5
  21440. CONFIG_EAP_MD5=y
  21441. @@ -367,7 +370,7 @@ CONFIG_INTERNAL_LIBTOMMATH_FAST=y
  21442. #CONFIG_DYNAMIC_EAP_METHODS=y
  21443. # IEEE Std 802.11r-2008 (Fast BSS Transition)
  21444. -#CONFIG_IEEE80211R=y
  21445. +CONFIG_IEEE80211R=y
  21446. # Add support for writing debug log to a file (/tmp/wpa_supplicant-log-#.txt)
  21447. #CONFIG_DEBUG_FILE=y
  21448. diff --git a/package/network/services/hostapd/files/wpa_supplicant-mesh.config b/package/network/services/hostapd/files/wpa_supplicant-mesh.config
  21449. deleted file mode 100644
  21450. index 36e29088c41ab819830e85f2fdadbcf700dc4071..0000000000000000000000000000000000000000
  21451. --- a/package/network/services/hostapd/files/wpa_supplicant-mesh.config
  21452. +++ /dev/null
  21453. @@ -1,407 +0,0 @@
  21454. -# Example wpa_supplicant build time configuration
  21455. -#
  21456. -# This file lists the configuration options that are used when building the
  21457. -# hostapd binary. All lines starting with # are ignored. Configuration option
  21458. -# lines must be commented out complete, if they are not to be included, i.e.,
  21459. -# just setting VARIABLE=n is not disabling that variable.
  21460. -#
  21461. -# This file is included in Makefile, so variables like CFLAGS and LIBS can also
  21462. -# be modified from here. In most cases, these lines should use += in order not
  21463. -# to override previous values of the variables.
  21464. -
  21465. -
  21466. -# Uncomment following two lines and fix the paths if you have installed OpenSSL
  21467. -# or GnuTLS in non-default location
  21468. -#CFLAGS += -I/usr/local/openssl/include
  21469. -#LIBS += -L/usr/local/openssl/lib
  21470. -
  21471. -# Some Red Hat versions seem to include kerberos header files from OpenSSL, but
  21472. -# the kerberos files are not in the default include path. Following line can be
  21473. -# used to fix build issues on such systems (krb5.h not found).
  21474. -#CFLAGS += -I/usr/include/kerberos
  21475. -
  21476. -# Example configuration for various cross-compilation platforms
  21477. -
  21478. -#### sveasoft (e.g., for Linksys WRT54G) ######################################
  21479. -#CC=mipsel-uclibc-gcc
  21480. -#CC=/opt/brcm/hndtools-mipsel-uclibc/bin/mipsel-uclibc-gcc
  21481. -#CFLAGS += -Os
  21482. -#CPPFLAGS += -I../src/include -I../../src/router/openssl/include
  21483. -#LIBS += -L/opt/brcm/hndtools-mipsel-uclibc-0.9.19/lib -lssl
  21484. -###############################################################################
  21485. -
  21486. -#### openwrt (e.g., for Linksys WRT54G) #######################################
  21487. -#CC=mipsel-uclibc-gcc
  21488. -#CC=/opt/brcm/hndtools-mipsel-uclibc/bin/mipsel-uclibc-gcc
  21489. -#CFLAGS += -Os
  21490. -#CPPFLAGS=-I../src/include -I../openssl-0.9.7d/include \
  21491. -# -I../WRT54GS/release/src/include
  21492. -#LIBS = -lssl
  21493. -###############################################################################
  21494. -
  21495. -
  21496. -# Driver interface for Host AP driver
  21497. -CONFIG_DRIVER_HOSTAP=y
  21498. -
  21499. -# Driver interface for Agere driver
  21500. -#CONFIG_DRIVER_HERMES=y
  21501. -# Change include directories to match with the local setup
  21502. -#CFLAGS += -I../../hcf -I../../include -I../../include/hcf
  21503. -#CFLAGS += -I../../include/wireless
  21504. -
  21505. -# Driver interface for ndiswrapper
  21506. -# Deprecated; use CONFIG_DRIVER_WEXT=y instead.
  21507. -#CONFIG_DRIVER_NDISWRAPPER=y
  21508. -
  21509. -# Driver interface for Atmel driver
  21510. -# CONFIG_DRIVER_ATMEL=y
  21511. -
  21512. -# Driver interface for old Broadcom driver
  21513. -# Please note that the newer Broadcom driver ("hybrid Linux driver") supports
  21514. -# Linux wireless extensions and does not need (or even work) with the old
  21515. -# driver wrapper. Use CONFIG_DRIVER_WEXT=y with that driver.
  21516. -#CONFIG_DRIVER_BROADCOM=y
  21517. -# Example path for wlioctl.h; change to match your configuration
  21518. -#CFLAGS += -I/opt/WRT54GS/release/src/include
  21519. -
  21520. -# Driver interface for Intel ipw2100/2200 driver
  21521. -# Deprecated; use CONFIG_DRIVER_WEXT=y instead.
  21522. -#CONFIG_DRIVER_IPW=y
  21523. -
  21524. -# Driver interface for Ralink driver
  21525. -#CONFIG_DRIVER_RALINK=y
  21526. -
  21527. -# Driver interface for generic Linux wireless extensions
  21528. -CONFIG_DRIVER_WEXT=y
  21529. -
  21530. -# Driver interface for Linux drivers using the nl80211 kernel interface
  21531. -CONFIG_DRIVER_NL80211=y
  21532. -
  21533. -# Driver interface for FreeBSD net80211 layer (e.g., Atheros driver)
  21534. -#CONFIG_DRIVER_BSD=y
  21535. -#CFLAGS += -I/usr/local/include
  21536. -#LIBS += -L/usr/local/lib
  21537. -#LIBS_p += -L/usr/local/lib
  21538. -#LIBS_c += -L/usr/local/lib
  21539. -
  21540. -# Driver interface for Windows NDIS
  21541. -#CONFIG_DRIVER_NDIS=y
  21542. -#CFLAGS += -I/usr/include/w32api/ddk
  21543. -#LIBS += -L/usr/local/lib
  21544. -# For native build using mingw
  21545. -#CONFIG_NATIVE_WINDOWS=y
  21546. -# Additional directories for cross-compilation on Linux host for mingw target
  21547. -#CFLAGS += -I/opt/mingw/mingw32/include/ddk
  21548. -#LIBS += -L/opt/mingw/mingw32/lib
  21549. -#CC=mingw32-gcc
  21550. -# By default, driver_ndis uses WinPcap for low-level operations. This can be
  21551. -# replaced with the following option which replaces WinPcap calls with NDISUIO.
  21552. -# However, this requires that WZC is disabled (net stop wzcsvc) before starting
  21553. -# wpa_supplicant.
  21554. -# CONFIG_USE_NDISUIO=y
  21555. -
  21556. -# Driver interface for development testing
  21557. -#CONFIG_DRIVER_TEST=y
  21558. -
  21559. -# Include client MLME (management frame processing) for test driver
  21560. -# This can be used to test MLME operations in hostapd with the test interface.
  21561. -# space.
  21562. -#CONFIG_CLIENT_MLME=y
  21563. -
  21564. -# Driver interface for wired Ethernet drivers
  21565. -CONFIG_DRIVER_WIRED=y
  21566. -
  21567. -# Driver interface for the Broadcom RoboSwitch family
  21568. -#CONFIG_DRIVER_ROBOSWITCH=y
  21569. -
  21570. -# Driver interface for no driver (e.g., WPS ER only)
  21571. -#CONFIG_DRIVER_NONE=y
  21572. -
  21573. -# Enable IEEE 802.1X Supplicant (automatically included if any EAP method is
  21574. -# included)
  21575. -CONFIG_IEEE8021X_EAPOL=y
  21576. -
  21577. -# EAP-MD5
  21578. -CONFIG_EAP_MD5=y
  21579. -
  21580. -# EAP-MSCHAPv2
  21581. -CONFIG_EAP_MSCHAPV2=y
  21582. -
  21583. -# EAP-TLS
  21584. -CONFIG_EAP_TLS=y
  21585. -
  21586. -# EAL-PEAP
  21587. -CONFIG_EAP_PEAP=y
  21588. -
  21589. -# EAP-TTLS
  21590. -CONFIG_EAP_TTLS=y
  21591. -
  21592. -# EAP-FAST
  21593. -# Note: Default OpenSSL package does not include support for all the
  21594. -# functionality needed for EAP-FAST. If EAP-FAST is enabled with OpenSSL,
  21595. -# the OpenSSL library must be patched (openssl-0.9.8d-tls-extensions.patch)
  21596. -# to add the needed functions.
  21597. -#CONFIG_EAP_FAST=y
  21598. -
  21599. -# EAP-GTC
  21600. -CONFIG_EAP_GTC=y
  21601. -
  21602. -# EAP-OTP
  21603. -CONFIG_EAP_OTP=y
  21604. -
  21605. -# EAP-SIM (enable CONFIG_PCSC, if EAP-SIM is used)
  21606. -#CONFIG_EAP_SIM=y
  21607. -
  21608. -# EAP-PSK (experimental; this is _not_ needed for WPA-PSK)
  21609. -#CONFIG_EAP_PSK=y
  21610. -
  21611. -# EAP-PAX
  21612. -#CONFIG_EAP_PAX=y
  21613. -
  21614. -# LEAP
  21615. -CONFIG_EAP_LEAP=y
  21616. -
  21617. -# EAP-AKA (enable CONFIG_PCSC, if EAP-AKA is used)
  21618. -#CONFIG_EAP_AKA=y
  21619. -
  21620. -# EAP-AKA' (enable CONFIG_PCSC, if EAP-AKA' is used).
  21621. -# This requires CONFIG_EAP_AKA to be enabled, too.
  21622. -#CONFIG_EAP_AKA_PRIME=y
  21623. -
  21624. -# Enable USIM simulator (Milenage) for EAP-AKA
  21625. -#CONFIG_USIM_SIMULATOR=y
  21626. -
  21627. -# EAP-SAKE
  21628. -#CONFIG_EAP_SAKE=y
  21629. -
  21630. -# EAP-GPSK
  21631. -#CONFIG_EAP_GPSK=y
  21632. -# Include support for optional SHA256 cipher suite in EAP-GPSK
  21633. -#CONFIG_EAP_GPSK_SHA256=y
  21634. -
  21635. -# EAP-TNC and related Trusted Network Connect support (experimental)
  21636. -#CONFIG_EAP_TNC=y
  21637. -
  21638. -# Wi-Fi Protected Setup (WPS)
  21639. -CONFIG_WPS=y
  21640. -
  21641. -# EAP-IKEv2
  21642. -#CONFIG_EAP_IKEV2=y
  21643. -
  21644. -# PKCS#12 (PFX) support (used to read private key and certificate file from
  21645. -# a file that usually has extension .p12 or .pfx)
  21646. -CONFIG_PKCS12=y
  21647. -
  21648. -# Smartcard support (i.e., private key on a smartcard), e.g., with openssl
  21649. -# engine.
  21650. -CONFIG_SMARTCARD=y
  21651. -
  21652. -# PC/SC interface for smartcards (USIM, GSM SIM)
  21653. -# Enable this if EAP-SIM or EAP-AKA is included
  21654. -#CONFIG_PCSC=y
  21655. -
  21656. -# Development testing
  21657. -#CONFIG_EAPOL_TEST=y
  21658. -
  21659. -# Select control interface backend for external programs, e.g, wpa_cli:
  21660. -# unix = UNIX domain sockets (default for Linux/*BSD)
  21661. -# udp = UDP sockets using localhost (127.0.0.1)
  21662. -# named_pipe = Windows Named Pipe (default for Windows)
  21663. -# y = use default (backwards compatibility)
  21664. -# If this option is commented out, control interface is not included in the
  21665. -# build.
  21666. -CONFIG_CTRL_IFACE=y
  21667. -
  21668. -# Include support for GNU Readline and History Libraries in wpa_cli.
  21669. -# When building a wpa_cli binary for distribution, please note that these
  21670. -# libraries are licensed under GPL and as such, BSD license may not apply for
  21671. -# the resulting binary.
  21672. -#CONFIG_READLINE=y
  21673. -
  21674. -# Remove debugging code that is printing out debug message to stdout.
  21675. -# This can be used to reduce the size of the wpa_supplicant considerably
  21676. -# if debugging code is not needed. The size reduction can be around 35%
  21677. -# (e.g., 90 kB).
  21678. -#CONFIG_NO_STDOUT_DEBUG=y
  21679. -
  21680. -# Remove WPA support, e.g., for wired-only IEEE 802.1X supplicant, to save
  21681. -# 35-50 kB in code size.
  21682. -#CONFIG_NO_WPA=y
  21683. -
  21684. -# Remove WPA2 support. This allows WPA to be used, but removes WPA2 code to
  21685. -# save about 1 kB in code size when building only WPA-Personal (no EAP support)
  21686. -# or 6 kB if building for WPA-Enterprise.
  21687. -#CONFIG_NO_WPA2=y
  21688. -
  21689. -# Remove IEEE 802.11i/WPA-Personal ASCII passphrase support
  21690. -# This option can be used to reduce code size by removing support for
  21691. -# converting ASCII passphrases into PSK. If this functionality is removed, the
  21692. -# PSK can only be configured as the 64-octet hexstring (e.g., from
  21693. -# wpa_passphrase). This saves about 0.5 kB in code size.
  21694. -#CONFIG_NO_WPA_PASSPHRASE=y
  21695. -
  21696. -# Disable scan result processing (ap_mode=1) to save code size by about 1 kB.
  21697. -# This can be used if ap_scan=1 mode is never enabled.
  21698. -#CONFIG_NO_SCAN_PROCESSING=y
  21699. -
  21700. -# Select configuration backend:
  21701. -# file = text file (e.g., wpa_supplicant.conf; note: the configuration file
  21702. -# path is given on command line, not here; this option is just used to
  21703. -# select the backend that allows configuration files to be used)
  21704. -# winreg = Windows registry (see win_example.reg for an example)
  21705. -CONFIG_BACKEND=file
  21706. -
  21707. -# Remove configuration write functionality (i.e., to allow the configuration
  21708. -# file to be updated based on runtime configuration changes). The runtime
  21709. -# configuration can still be changed, the changes are just not going to be
  21710. -# persistent over restarts. This option can be used to reduce code size by
  21711. -# about 3.5 kB.
  21712. -#CONFIG_NO_CONFIG_WRITE=y
  21713. -
  21714. -# Remove support for configuration blobs to reduce code size by about 1.5 kB.
  21715. -#CONFIG_NO_CONFIG_BLOBS=y
  21716. -
  21717. -# Select program entry point implementation:
  21718. -# main = UNIX/POSIX like main() function (default)
  21719. -# main_winsvc = Windows service (read parameters from registry)
  21720. -# main_none = Very basic example (development use only)
  21721. -#CONFIG_MAIN=main
  21722. -
  21723. -# Select wrapper for operatins system and C library specific functions
  21724. -# unix = UNIX/POSIX like systems (default)
  21725. -# win32 = Windows systems
  21726. -# none = Empty template
  21727. -#CONFIG_OS=unix
  21728. -
  21729. -# Select event loop implementation
  21730. -# eloop = select() loop (default)
  21731. -# eloop_win = Windows events and WaitForMultipleObject() loop
  21732. -# eloop_none = Empty template
  21733. -#CONFIG_ELOOP=eloop
  21734. -
  21735. -# Select layer 2 packet implementation
  21736. -# linux = Linux packet socket (default)
  21737. -# pcap = libpcap/libdnet/WinPcap
  21738. -# freebsd = FreeBSD libpcap
  21739. -# winpcap = WinPcap with receive thread
  21740. -# ndis = Windows NDISUIO (note: requires CONFIG_USE_NDISUIO=y)
  21741. -# none = Empty template
  21742. -#CONFIG_L2_PACKET=linux
  21743. -
  21744. -# PeerKey handshake for Station to Station Link (IEEE 802.11e DLS)
  21745. -CONFIG_PEERKEY=y
  21746. -
  21747. -# IEEE 802.11w (management frame protection)
  21748. -# This version is an experimental implementation based on IEEE 802.11w/D1.0
  21749. -# draft and is subject to change since the standard has not yet been finalized.
  21750. -# Driver support is also needed for IEEE 802.11w.
  21751. -CONFIG_IEEE80211W=y
  21752. -
  21753. -# Select TLS implementation
  21754. -# openssl = OpenSSL (default)
  21755. -# gnutls = GnuTLS (needed for TLS/IA, see also CONFIG_GNUTLS_EXTRA)
  21756. -# internal = Internal TLSv1 implementation (experimental)
  21757. -# none = Empty template
  21758. -CONFIG_TLS=internal
  21759. -
  21760. -# Whether to enable TLS/IA support, which is required for EAP-TTLSv1.
  21761. -# You need CONFIG_TLS=gnutls for this to have any effect. Please note that
  21762. -# even though the core GnuTLS library is released under LGPL, this extra
  21763. -# library uses GPL and as such, the terms of GPL apply to the combination
  21764. -# of wpa_supplicant and GnuTLS if this option is enabled. BSD license may not
  21765. -# apply for distribution of the resulting binary.
  21766. -#CONFIG_GNUTLS_EXTRA=y
  21767. -
  21768. -# If CONFIG_TLS=internal is used, additional library and include paths are
  21769. -# needed for LibTomMath. Alternatively, an integrated, minimal version of
  21770. -# LibTomMath can be used. See beginning of libtommath.c for details on benefits
  21771. -# and drawbacks of this option.
  21772. -CONFIG_INTERNAL_LIBTOMMATH=y
  21773. -#ifndef CONFIG_INTERNAL_LIBTOMMATH
  21774. -#LTM_PATH=/usr/src/libtommath-0.39
  21775. -#CFLAGS += -I$(LTM_PATH)
  21776. -#LIBS += -L$(LTM_PATH)
  21777. -#LIBS_p += -L$(LTM_PATH)
  21778. -#endif
  21779. -# At the cost of about 4 kB of additional binary size, the internal LibTomMath
  21780. -# can be configured to include faster routines for exptmod, sqr, and div to
  21781. -# speed up DH and RSA calculation considerably
  21782. -CONFIG_INTERNAL_LIBTOMMATH_FAST=y
  21783. -
  21784. -# Include NDIS event processing through WMI into wpa_supplicant/wpasvc.
  21785. -# This is only for Windows builds and requires WMI-related header files and
  21786. -# WbemUuid.Lib from Platform SDK even when building with MinGW.
  21787. -#CONFIG_NDIS_EVENTS_INTEGRATED=y
  21788. -#PLATFORMSDKLIB="/opt/Program Files/Microsoft Platform SDK/Lib"
  21789. -
  21790. -# Add support for old DBus control interface
  21791. -# (fi.epitest.hostap.WPASupplicant)
  21792. -#CONFIG_CTRL_IFACE_DBUS=y
  21793. -
  21794. -# Add support for new DBus control interface
  21795. -# (fi.w1.hostap.wpa_supplicant1)
  21796. -#CONFIG_CTRL_IFACE_DBUS_NEW=y
  21797. -
  21798. -# Add introspection support for new DBus control interface
  21799. -#CONFIG_CTRL_IFACE_DBUS_INTRO=y
  21800. -
  21801. -# Add support for loading EAP methods dynamically as shared libraries.
  21802. -# When this option is enabled, each EAP method can be either included
  21803. -# statically (CONFIG_EAP_<method>=y) or dynamically (CONFIG_EAP_<method>=dyn).
  21804. -# Dynamic EAP methods are build as shared objects (eap_*.so) and they need to
  21805. -# be loaded in the beginning of the wpa_supplicant configuration file
  21806. -# (see load_dynamic_eap parameter in the example file) before being used in
  21807. -# the network blocks.
  21808. -#
  21809. -# Note that some shared parts of EAP methods are included in the main program
  21810. -# and in order to be able to use dynamic EAP methods using these parts, the
  21811. -# main program must have been build with the EAP method enabled (=y or =dyn).
  21812. -# This means that EAP-TLS/PEAP/TTLS/FAST cannot be added as dynamic libraries
  21813. -# unless at least one of them was included in the main build to force inclusion
  21814. -# of the shared code. Similarly, at least one of EAP-SIM/AKA must be included
  21815. -# in the main build to be able to load these methods dynamically.
  21816. -#
  21817. -# Please also note that using dynamic libraries will increase the total binary
  21818. -# size. Thus, it may not be the best option for targets that have limited
  21819. -# amount of memory/flash.
  21820. -#CONFIG_DYNAMIC_EAP_METHODS=y
  21821. -
  21822. -# IEEE Std 802.11r-2008 (Fast BSS Transition)
  21823. -#CONFIG_IEEE80211R=y
  21824. -
  21825. -# Add support for writing debug log to a file (/tmp/wpa_supplicant-log-#.txt)
  21826. -#CONFIG_DEBUG_FILE=y
  21827. -
  21828. -# Enable privilege separation (see README 'Privilege separation' for details)
  21829. -#CONFIG_PRIVSEP=y
  21830. -
  21831. -# Enable mitigation against certain attacks against TKIP by delaying Michael
  21832. -# MIC error reports by a random amount of time between 0 and 60 seconds
  21833. -#CONFIG_DELAYED_MIC_ERROR_REPORT=y
  21834. -
  21835. -# Enable tracing code for developer debugging
  21836. -# This tracks use of memory allocations and other registrations and reports
  21837. -# incorrect use with a backtrace of call (or allocation) location.
  21838. -#CONFIG_WPA_TRACE=y
  21839. -# For BSD, comment out these.
  21840. -#LIBS += -lexecinfo
  21841. -#LIBS_p += -lexecinfo
  21842. -#LIBS_c += -lexecinfo
  21843. -
  21844. -# Use libbfd to get more details for developer debugging
  21845. -# This enables use of libbfd to get more detailed symbols for the backtraces
  21846. -# generated by CONFIG_WPA_TRACE=y.
  21847. -#CONFIG_WPA_TRACE_BFD=y
  21848. -# For BSD, comment out these.
  21849. -#LIBS += -lbfd -liberty -lz
  21850. -#LIBS_p += -lbfd -liberty -lz
  21851. -#LIBS_c += -lbfd -liberty -lz
  21852. -
  21853. -CONFIG_NO_RANDOM_POOL=y
  21854. -NEED_80211_COMMON=y
  21855. -
  21856. -CONFIG_IBSS_RSN=y
  21857. -
  21858. -CONFIG_MESH=y
  21859. -CONFIG_SAE=y
  21860. -CONFIG_AP=y
  21861. diff --git a/package/network/services/hostapd/files/wpa_supplicant-mini.config b/package/network/services/hostapd/files/wpa_supplicant-mini.config
  21862. index a8d334d942e0618eb1224d093bb5047b1b40577a..c272153b3a9ee52e3dd6370c533fd0d06fac9e20 100644
  21863. --- a/package/network/services/hostapd/files/wpa_supplicant-mini.config
  21864. +++ b/package/network/services/hostapd/files/wpa_supplicant-mini.config
  21865. @@ -41,7 +41,7 @@
  21866. # Driver interface for Host AP driver
  21867. -CONFIG_DRIVER_HOSTAP=y
  21868. +#CONFIG_DRIVER_HOSTAP=y
  21869. # Driver interface for Agere driver
  21870. #CONFIG_DRIVER_HERMES=y
  21871. diff --git a/package/network/services/hostapd/files/wpa_supplicant-p2p.config b/package/network/services/hostapd/files/wpa_supplicant-p2p.config
  21872. index 1c307d0e697b99036cafaed8b923cea0523114c2..563dace352f36e471374d40e37deee171d69094f 100644
  21873. --- a/package/network/services/hostapd/files/wpa_supplicant-p2p.config
  21874. +++ b/package/network/services/hostapd/files/wpa_supplicant-p2p.config
  21875. @@ -41,7 +41,7 @@
  21876. # Driver interface for Host AP driver
  21877. -CONFIG_DRIVER_HOSTAP=y
  21878. +#CONFIG_DRIVER_HOSTAP=y
  21879. # Driver interface for Agere driver
  21880. #CONFIG_DRIVER_HERMES=y
  21881. diff --git a/package/network/services/hostapd/files/wpa_supplicant.sh b/package/network/services/hostapd/files/wpa_supplicant.sh
  21882. deleted file mode 100644
  21883. index b6784843e8ea99763796d9bfe772b004468e7304..0000000000000000000000000000000000000000
  21884. --- a/package/network/services/hostapd/files/wpa_supplicant.sh
  21885. +++ /dev/null
  21886. @@ -1,194 +0,0 @@
  21887. -wpa_supplicant_setup_vif() {
  21888. - local vif="$1"
  21889. - local driver="$2"
  21890. - local key="$key"
  21891. - local options="$3"
  21892. - local freq=""
  21893. - local ht="$5"
  21894. - local ap_scan=""
  21895. - local scan_ssid="1"
  21896. - [ -n "$4" ] && freq="frequency=$4"
  21897. -
  21898. - config_get enc "$vif" encryption
  21899. - config_get key "$vif" key
  21900. -
  21901. - local net_cfg bridge
  21902. - config_get bridge "$vif" bridge
  21903. - [ -z "$bridge" ] && {
  21904. - net_cfg="$(find_net_config "$vif")"
  21905. - [ -z "$net_cfg" ] || bridge="$(bridge_interface "$net_cfg")"
  21906. - config_set "$vif" bridge "$bridge"
  21907. - }
  21908. -
  21909. - local mode ifname wds modestr=""
  21910. - config_get mode "$vif" mode
  21911. - config_get ifname "$vif" ifname
  21912. - config_get_bool wds "$vif" wds 0
  21913. - [ -z "$bridge" ] || [ "$mode" = ap ] || [ "$mode" = sta -a $wds -eq 1 ] || {
  21914. - echo "wpa_supplicant_setup_vif($ifname): Refusing to bridge $mode mode interface"
  21915. - return 1
  21916. - }
  21917. - [ "$mode" = "adhoc" ] && {
  21918. - modestr="mode=1"
  21919. - scan_ssid="0"
  21920. - ap_scan="ap_scan=2"
  21921. - }
  21922. -
  21923. - key_mgmt='NONE'
  21924. - case "$enc" in
  21925. - *none*) ;;
  21926. - *wep*)
  21927. - config_get key "$vif" key
  21928. - key="${key:-1}"
  21929. - case "$key" in
  21930. - [1234])
  21931. - for idx in 1 2 3 4; do
  21932. - local zidx
  21933. - zidx=$(($idx - 1))
  21934. - config_get ckey "$vif" "key${idx}"
  21935. - [ -n "$ckey" ] && \
  21936. - append "wep_key${zidx}" "wep_key${zidx}=$(prepare_key_wep "$ckey")"
  21937. - done
  21938. - wep_tx_keyidx="wep_tx_keyidx=$((key - 1))"
  21939. - ;;
  21940. - *)
  21941. - wep_key0="wep_key0=$(prepare_key_wep "$key")"
  21942. - wep_tx_keyidx="wep_tx_keyidx=0"
  21943. - ;;
  21944. - esac
  21945. - ;;
  21946. - *psk*)
  21947. - key_mgmt='WPA-PSK'
  21948. - # if you want to use PSK with a non-nl80211 driver you
  21949. - # have to use WPA-NONE and wext driver for wpa_s
  21950. - [ "$mode" = "adhoc" -a "$driver" != "nl80211" ] && {
  21951. - key_mgmt='WPA-NONE'
  21952. - driver='wext'
  21953. - }
  21954. - if [ ${#key} -eq 64 ]; then
  21955. - passphrase="psk=${key}"
  21956. - else
  21957. - passphrase="psk=\"${key}\""
  21958. - fi
  21959. - case "$enc" in
  21960. - *psk2*)
  21961. - proto='proto=RSN'
  21962. - config_get ieee80211w "$vif" ieee80211w
  21963. - ;;
  21964. - *psk*)
  21965. - proto='proto=WPA'
  21966. - ;;
  21967. - esac
  21968. - ;;
  21969. - *wpa*|*8021x*)
  21970. - proto='proto=WPA2'
  21971. - key_mgmt='WPA-EAP'
  21972. - config_get ieee80211w "$vif" ieee80211w
  21973. - config_get ca_cert "$vif" ca_cert
  21974. - config_get eap_type "$vif" eap_type
  21975. - ca_cert=${ca_cert:+"ca_cert=\"$ca_cert\""}
  21976. - case "$eap_type" in
  21977. - tls)
  21978. - pairwise='pairwise=CCMP'
  21979. - group='group=CCMP'
  21980. - config_get identity "$vif" identity
  21981. - config_get client_cert "$vif" client_cert
  21982. - config_get priv_key "$vif" priv_key
  21983. - config_get priv_key_pwd "$vif" priv_key_pwd
  21984. - identity="identity=\"$identity\""
  21985. - client_cert="client_cert=\"$client_cert\""
  21986. - priv_key="private_key=\"$priv_key\""
  21987. - priv_key_pwd="private_key_passwd=\"$priv_key_pwd\""
  21988. - ;;
  21989. - peap|ttls)
  21990. - config_get auth "$vif" auth
  21991. - config_get identity "$vif" identity
  21992. - config_get password "$vif" password
  21993. - phase2="phase2=\"auth=${auth:-MSCHAPV2}\""
  21994. - identity="identity=\"$identity\""
  21995. - password="${password:+password=\"$password\"}"
  21996. - ;;
  21997. - esac
  21998. - eap_type="eap=$(echo $eap_type | tr 'a-z' 'A-Z')"
  21999. - ;;
  22000. - esac
  22001. -
  22002. - case "$ieee80211w" in
  22003. - [012])
  22004. - ieee80211w="ieee80211w=$ieee80211w"
  22005. - ;;
  22006. - esac
  22007. -
  22008. - local fixed_freq bssid1 beacon_int brates mrate
  22009. - config_get ifname "$vif" ifname
  22010. - config_get bridge "$vif" bridge
  22011. - config_get ssid "$vif" ssid
  22012. - config_get bssid "$vif" bssid
  22013. - bssid1=${bssid:+"bssid=$bssid"}
  22014. - beacon_int=${beacon_int:+"beacon_int=$beacon_int"}
  22015. -
  22016. - local br brval brsub brstr
  22017. - [ -n "$basic_rate_list" ] && {
  22018. - for br in $basic_rate_list; do
  22019. - brval="$(($br / 1000))"
  22020. - brsub="$((($br / 100) % 10))"
  22021. - [ "$brsub" -gt 0 ] && brval="$brval.$brsub"
  22022. - [ -n "$brstr" ] && brstr="$brstr,"
  22023. - brstr="$brstr$brval"
  22024. - done
  22025. - brates=${basic_rate_list:+"rates=$brstr"}
  22026. - }
  22027. -
  22028. - local mcval=""
  22029. - [ -n "$mcast_rate" ] && {
  22030. - mcval="$(($mcast_rate / 1000))"
  22031. - mcsub="$(( ($mcast_rate / 100) % 10 ))"
  22032. - [ "$mcsub" -gt 0 ] && mcval="$mcval.$mcsub"
  22033. - mrate=${mcast_rate:+"mcast_rate=$mcval"}
  22034. - }
  22035. -
  22036. - local ht_str
  22037. - [ -n "$ht" ] && ht_str="htmode=$ht"
  22038. -
  22039. - rm -rf /var/run/wpa_supplicant-$ifname
  22040. - cat > /var/run/wpa_supplicant-$ifname.conf <<EOF
  22041. -ctrl_interface=/var/run/wpa_supplicant-$ifname
  22042. -$ap_scan
  22043. -network={
  22044. - $modestr
  22045. - scan_ssid=$scan_ssid
  22046. - ssid="$ssid"
  22047. - $bssid1
  22048. - key_mgmt=$key_mgmt
  22049. - $proto
  22050. - $freq
  22051. - ${fixed:+"fixed_freq=1"}
  22052. - $beacon_int
  22053. - $brates
  22054. - $mrate
  22055. - $ht_str
  22056. - $ieee80211w
  22057. - $passphrase
  22058. - $pairwise
  22059. - $group
  22060. - $eap_type
  22061. - $ca_cert
  22062. - $client_cert
  22063. - $priv_key
  22064. - $priv_key_pwd
  22065. - $phase2
  22066. - $identity
  22067. - $password
  22068. - $wep_key0
  22069. - $wep_key1
  22070. - $wep_key2
  22071. - $wep_key3
  22072. - $wep_tx_keyidx
  22073. -}
  22074. -EOF
  22075. - if [ -n "$proto" -o "$key_mgmt" = "NONE" ]; then
  22076. - 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
  22077. - else
  22078. - return 0
  22079. - fi
  22080. -}
  22081. 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
  22082. new file mode 100644
  22083. index 0000000000000000000000000000000000000000..5c8b6622c9a257bee024de6c9db9e3da38312b6f
  22084. --- /dev/null
  22085. +++ b/package/network/services/hostapd/patches/001-4addr-fix-reconnecting-client-on-connection-lost.patch
  22086. @@ -0,0 +1,25 @@
  22087. +From: Matthias May <matthias.may@neratec.com>
  22088. +Date: Tue, 5 Jul 2016 15:00:43 +0200
  22089. +Subject: [PATCH] 4addr: fix reconnecting client on connection lost
  22090. +
  22091. +When a 4addr client suddenly looses its connection (no deauth/deassoc)
  22092. +the AP still thinks it is connected.
  22093. +If the client reconnects before the AP timeoutes the client, traffic
  22094. +cannot flow.
  22095. +
  22096. +Fix this by making sure the WLAN_STA_WDS flag is unset in the sta->flags
  22097. +when the client completes association.
  22098. +
  22099. +Signed-off-by: Matthias May <matthias.may@neratec.com>
  22100. +---
  22101. +
  22102. +--- a/src/ap/ieee802_11.c
  22103. ++++ b/src/ap/ieee802_11.c
  22104. +@@ -2826,6 +2826,7 @@ static void handle_assoc_cb(struct hosta
  22105. + new_assoc = 0;
  22106. + sta->flags |= WLAN_STA_ASSOC;
  22107. + sta->flags &= ~WLAN_STA_WNM_SLEEP_MODE;
  22108. ++ sta->flags &= ~WLAN_STA_WDS;
  22109. + if ((!hapd->conf->ieee802_1x && !hapd->conf->wpa && !hapd->conf->osen) ||
  22110. + sta->auth_alg == WLAN_AUTH_FT) {
  22111. + /*
  22112. 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
  22113. deleted file mode 100644
  22114. index e408fbe3839e07637f526a99cd83e9e7558bc4d2..0000000000000000000000000000000000000000
  22115. --- a/package/network/services/hostapd/patches/001-P2P-Validate-SSID-element-length-before-copying-it-C.patch
  22116. +++ /dev/null
  22117. @@ -1,37 +0,0 @@
  22118. -From 9ed4eee345f85e3025c33c6e20aa25696e341ccd Mon Sep 17 00:00:00 2001
  22119. -From: Jouni Malinen <jouni@qca.qualcomm.com>
  22120. -Date: Tue, 7 Apr 2015 11:32:11 +0300
  22121. -Subject: [PATCH] P2P: Validate SSID element length before copying it
  22122. - (CVE-2015-1863)
  22123. -
  22124. -This fixes a possible memcpy overflow for P2P dev->oper_ssid in
  22125. -p2p_add_device(). The length provided by the peer device (0..255 bytes)
  22126. -was used without proper bounds checking and that could have resulted in
  22127. -arbitrary data of up to 223 bytes being written beyond the end of the
  22128. -dev->oper_ssid[] array (of which about 150 bytes would be beyond the
  22129. -heap allocation) when processing a corrupted management frame for P2P
  22130. -peer discovery purposes.
  22131. -
  22132. -This could result in corrupted state in heap, unexpected program
  22133. -behavior due to corrupted P2P peer device information, denial of service
  22134. -due to process crash, exposure of memory contents during GO Negotiation,
  22135. -and potentially arbitrary code execution.
  22136. -
  22137. -Thanks to Google security team for reporting this issue and smart
  22138. -hardware research group of Alibaba security team for discovering it.
  22139. -
  22140. -Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
  22141. ----
  22142. - src/p2p/p2p.c | 1 +
  22143. - 1 file changed, 1 insertion(+)
  22144. -
  22145. ---- a/src/p2p/p2p.c
  22146. -+++ b/src/p2p/p2p.c
  22147. -@@ -778,6 +778,7 @@ int p2p_add_device(struct p2p_data *p2p,
  22148. - if (os_memcmp(addr, p2p_dev_addr, ETH_ALEN) != 0)
  22149. - os_memcpy(dev->interface_addr, addr, ETH_ALEN);
  22150. - if (msg.ssid &&
  22151. -+ msg.ssid[1] <= sizeof(dev->oper_ssid) &&
  22152. - (msg.ssid[1] != P2P_WILDCARD_SSID_LEN ||
  22153. - os_memcmp(msg.ssid + 2, P2P_WILDCARD_SSID, P2P_WILDCARD_SSID_LEN)
  22154. - != 0)) {
  22155. 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
  22156. deleted file mode 100644
  22157. index bc4d60fcc18c165e11e3a322bc064b6b18eaffed..0000000000000000000000000000000000000000
  22158. --- a/package/network/services/hostapd/patches/002-AP-WMM-Fix-integer-underflow-in-WMM-Action-frame-par.patch
  22159. +++ /dev/null
  22160. @@ -1,36 +0,0 @@
  22161. -From ef566a4d4f74022e1fdb0a2addfe81e6de9f4aae Mon Sep 17 00:00:00 2001
  22162. -From: Jouni Malinen <j@w1.fi>
  22163. -Date: Wed, 29 Apr 2015 02:21:53 +0300
  22164. -Subject: [PATCH] AP WMM: Fix integer underflow in WMM Action frame parser
  22165. -
  22166. -The length of the WMM Action frame was not properly validated and the
  22167. -length of the information elements (int left) could end up being
  22168. -negative. This would result in reading significantly past the stack
  22169. -buffer while parsing the IEs in ieee802_11_parse_elems() and while doing
  22170. -so, resulting in segmentation fault.
  22171. -
  22172. -This can result in an invalid frame being used for a denial of service
  22173. -attack (hostapd process killed) against an AP with a driver that uses
  22174. -hostapd for management frame processing (e.g., all mac80211-based
  22175. -drivers).
  22176. -
  22177. -Thanks to Kostya Kortchinsky of Google security team for discovering and
  22178. -reporting this issue.
  22179. -
  22180. -Signed-off-by: Jouni Malinen <j@w1.fi>
  22181. ----
  22182. - src/ap/wmm.c | 3 +++
  22183. - 1 file changed, 3 insertions(+)
  22184. -
  22185. ---- a/src/ap/wmm.c
  22186. -+++ b/src/ap/wmm.c
  22187. -@@ -274,6 +274,9 @@ void hostapd_wmm_action(struct hostapd_d
  22188. - return;
  22189. - }
  22190. -
  22191. -+ if (left < 0)
  22192. -+ return; /* not a valid WMM Action frame */
  22193. -+
  22194. - /* extract the tspec info element */
  22195. - if (ieee802_11_parse_elems(pos, left, &elems, 1) == ParseFailed) {
  22196. - hostapd_logger(hapd, mgmt->sa, HOSTAPD_MODULE_IEEE80211,
  22197. 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
  22198. new file mode 100644
  22199. index 0000000000000000000000000000000000000000..243922002a856c1910bdccdaee62304d78f27868
  22200. --- /dev/null
  22201. +++ b/package/network/services/hostapd/patches/002-mesh-Set-correct-secondary-channel-offset-if-HT40-is.patch
  22202. @@ -0,0 +1,61 @@
  22203. +From: Masashi Honma <masashi.honma@gmail.com>
  22204. +Date: Tue, 26 Jul 2016 11:45:40 +0900
  22205. +Subject: [PATCH] mesh: Set correct secondary channel offset if HT40 is
  22206. + disabled
  22207. +
  22208. +Previously, secondary channel offset could be non zero even though
  22209. +disable_ht40=1. This patch fixes it.
  22210. +
  22211. +Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
  22212. +---
  22213. +
  22214. +--- a/wpa_supplicant/wpa_supplicant.c
  22215. ++++ b/wpa_supplicant/wpa_supplicant.c
  22216. +@@ -1901,20 +1901,27 @@ void ibss_mesh_setup_freq(struct wpa_sup
  22217. + break;
  22218. + }
  22219. + }
  22220. ++#ifdef CONFIG_HT_OVERRIDES
  22221. ++ if (ssid->disable_ht40)
  22222. ++ ht40 = 0;
  22223. ++#endif /* CONFIG_HT_OVERRIDES */
  22224. +
  22225. +- /* Find secondary channel */
  22226. +- for (i = 0; i < mode->num_channels; i++) {
  22227. +- sec_chan = &mode->channels[i];
  22228. +- if (sec_chan->chan == channel + ht40 * 4)
  22229. +- break;
  22230. +- sec_chan = NULL;
  22231. +- }
  22232. +- if (!sec_chan)
  22233. +- return;
  22234. ++ if (ht40) {
  22235. ++ /* Find secondary channel */
  22236. ++ for (i = 0; i < mode->num_channels; i++) {
  22237. ++ sec_chan = &mode->channels[i];
  22238. ++ if (sec_chan->chan == channel + ht40 * 4)
  22239. ++ break;
  22240. ++ sec_chan = NULL;
  22241. ++ }
  22242. ++ if (!sec_chan)
  22243. ++ return;
  22244. +
  22245. +- /* Check secondary channel flags */
  22246. +- if (sec_chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR))
  22247. +- return;
  22248. ++ /* Check secondary channel flags */
  22249. ++ if (sec_chan->flag &
  22250. ++ (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR))
  22251. ++ return;
  22252. ++ }
  22253. +
  22254. + freq->channel = pri_chan->chan;
  22255. +
  22256. +@@ -1930,6 +1937,7 @@ void ibss_mesh_setup_freq(struct wpa_sup
  22257. + freq->sec_channel_offset = 1;
  22258. + break;
  22259. + default:
  22260. ++ freq->sec_channel_offset = 0;
  22261. + break;
  22262. + }
  22263. +
  22264. 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
  22265. deleted file mode 100644
  22266. index 36b4ca2946990108d1d294cb15540a6bc3207e99..0000000000000000000000000000000000000000
  22267. --- a/package/network/services/hostapd/patches/003-WPS-Fix-HTTP-chunked-transfer-encoding-parser.patch
  22268. +++ /dev/null
  22269. @@ -1,49 +0,0 @@
  22270. -From 5acd23f4581da58683f3cf5e36cb71bbe4070bd7 Mon Sep 17 00:00:00 2001
  22271. -From: Jouni Malinen <j@w1.fi>
  22272. -Date: Tue, 28 Apr 2015 17:08:33 +0300
  22273. -Subject: [PATCH] WPS: Fix HTTP chunked transfer encoding parser
  22274. -
  22275. -strtoul() return value may end up overflowing the int h->chunk_size and
  22276. -resulting in a negative value to be stored as the chunk_size. This could
  22277. -result in the following memcpy operation using a very large length
  22278. -argument which would result in a buffer overflow and segmentation fault.
  22279. -
  22280. -This could have been used to cause a denial service by any device that
  22281. -has been authorized for network access (either wireless or wired). This
  22282. -would affect both the WPS UPnP functionality in a WPS AP (hostapd with
  22283. -upnp_iface parameter set in the configuration) and WPS ER
  22284. -(wpa_supplicant with WPS_ER_START control interface command used).
  22285. -
  22286. -Validate the parsed chunk length value to avoid this. In addition to
  22287. -rejecting negative values, we can also reject chunk size that would be
  22288. -larger than the maximum configured body length.
  22289. -
  22290. -Thanks to Kostya Kortchinsky of Google security team for discovering and
  22291. -reporting this issue.
  22292. -
  22293. -Signed-off-by: Jouni Malinen <j@w1.fi>
  22294. ----
  22295. - src/wps/httpread.c | 7 +++++++
  22296. - 1 file changed, 7 insertions(+)
  22297. -
  22298. -diff --git a/src/wps/httpread.c b/src/wps/httpread.c
  22299. -index 2f08f37..d2855e3 100644
  22300. ---- a/src/wps/httpread.c
  22301. -+++ b/src/wps/httpread.c
  22302. -@@ -533,6 +533,13 @@ static void httpread_read_handler(int sd, void *eloop_ctx, void *sock_ctx)
  22303. - if (!isxdigit(*cbp))
  22304. - goto bad;
  22305. - h->chunk_size = strtoul(cbp, NULL, 16);
  22306. -+ if (h->chunk_size < 0 ||
  22307. -+ h->chunk_size > h->max_bytes) {
  22308. -+ wpa_printf(MSG_DEBUG,
  22309. -+ "httpread: Invalid chunk size %d",
  22310. -+ h->chunk_size);
  22311. -+ goto bad;
  22312. -+ }
  22313. - /* throw away chunk header
  22314. - * so we have only real data
  22315. - */
  22316. ---
  22317. -1.9.1
  22318. -
  22319. 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
  22320. deleted file mode 100644
  22321. index 91627fb7b7f6bf43b085290cbd135bba18325295..0000000000000000000000000000000000000000
  22322. --- a/package/network/services/hostapd/patches/004-EAP-pwd-peer-Fix-payload-length-validation-for-Commi.patch
  22323. +++ /dev/null
  22324. @@ -1,73 +0,0 @@
  22325. -From dd2f043c9c43d156494e33d7ce22db96e6ef42c7 Mon Sep 17 00:00:00 2001
  22326. -From: Jouni Malinen <j@w1.fi>
  22327. -Date: Fri, 1 May 2015 16:37:45 +0300
  22328. -Subject: [PATCH 1/5] EAP-pwd peer: Fix payload length validation for Commit
  22329. - and Confirm
  22330. -
  22331. -The length of the received Commit and Confirm message payloads was not
  22332. -checked before reading them. This could result in a buffer read
  22333. -overflow when processing an invalid message.
  22334. -
  22335. -Fix this by verifying that the payload is of expected length before
  22336. -processing it. In addition, enforce correct state transition sequence to
  22337. -make sure there is no unexpected behavior if receiving a Commit/Confirm
  22338. -message before the previous exchanges have been completed.
  22339. -
  22340. -Thanks to Kostya Kortchinsky of Google security team for discovering and
  22341. -reporting this issue.
  22342. -
  22343. -Signed-off-by: Jouni Malinen <j@w1.fi>
  22344. ----
  22345. - src/eap_peer/eap_pwd.c | 29 +++++++++++++++++++++++++++++
  22346. - 1 file changed, 29 insertions(+)
  22347. -
  22348. -diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c
  22349. -index f2b0926..a629437 100644
  22350. ---- a/src/eap_peer/eap_pwd.c
  22351. -+++ b/src/eap_peer/eap_pwd.c
  22352. -@@ -355,6 +355,23 @@ eap_pwd_perform_commit_exchange(struct eap_sm *sm, struct eap_pwd_data *data,
  22353. - BIGNUM *mask = NULL, *x = NULL, *y = NULL, *cofactor = NULL;
  22354. - u16 offset;
  22355. - u8 *ptr, *scalar = NULL, *element = NULL;
  22356. -+ size_t prime_len, order_len;
  22357. -+
  22358. -+ if (data->state != PWD_Commit_Req) {
  22359. -+ ret->ignore = TRUE;
  22360. -+ goto fin;
  22361. -+ }
  22362. -+
  22363. -+ prime_len = BN_num_bytes(data->grp->prime);
  22364. -+ order_len = BN_num_bytes(data->grp->order);
  22365. -+
  22366. -+ if (payload_len != 2 * prime_len + order_len) {
  22367. -+ wpa_printf(MSG_INFO,
  22368. -+ "EAP-pwd: Unexpected Commit payload length %u (expected %u)",
  22369. -+ (unsigned int) payload_len,
  22370. -+ (unsigned int) (2 * prime_len + order_len));
  22371. -+ goto fin;
  22372. -+ }
  22373. -
  22374. - if (((data->private_value = BN_new()) == NULL) ||
  22375. - ((data->my_element = EC_POINT_new(data->grp->group)) == NULL) ||
  22376. -@@ -554,6 +571,18 @@ eap_pwd_perform_confirm_exchange(struct eap_sm *sm, struct eap_pwd_data *data,
  22377. - u8 conf[SHA256_MAC_LEN], *cruft = NULL, *ptr;
  22378. - int offset;
  22379. -
  22380. -+ if (data->state != PWD_Confirm_Req) {
  22381. -+ ret->ignore = TRUE;
  22382. -+ goto fin;
  22383. -+ }
  22384. -+
  22385. -+ if (payload_len != SHA256_MAC_LEN) {
  22386. -+ wpa_printf(MSG_INFO,
  22387. -+ "EAP-pwd: Unexpected Confirm payload length %u (expected %u)",
  22388. -+ (unsigned int) payload_len, SHA256_MAC_LEN);
  22389. -+ goto fin;
  22390. -+ }
  22391. -+
  22392. - /*
  22393. - * first build up the ciphersuite which is group | random_function |
  22394. - * prf
  22395. ---
  22396. -1.9.1
  22397. -
  22398. 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
  22399. deleted file mode 100644
  22400. index 5dca20b2771b855ac724ce0b0bf4bee2e377f7bf..0000000000000000000000000000000000000000
  22401. --- a/package/network/services/hostapd/patches/005-EAP-pwd-server-Fix-payload-length-validation-for-Com.patch
  22402. +++ /dev/null
  22403. @@ -1,66 +0,0 @@
  22404. -From e28a58be26184c2a23f80b410e0997ef1bd5d578 Mon Sep 17 00:00:00 2001
  22405. -From: Jouni Malinen <j@w1.fi>
  22406. -Date: Fri, 1 May 2015 16:40:44 +0300
  22407. -Subject: [PATCH 2/5] EAP-pwd server: Fix payload length validation for Commit
  22408. - and Confirm
  22409. -
  22410. -The length of the received Commit and Confirm message payloads was not
  22411. -checked before reading them. This could result in a buffer read
  22412. -overflow when processing an invalid message.
  22413. -
  22414. -Fix this by verifying that the payload is of expected length before
  22415. -processing it. In addition, enforce correct state transition sequence to
  22416. -make sure there is no unexpected behavior if receiving a Commit/Confirm
  22417. -message before the previous exchanges have been completed.
  22418. -
  22419. -Thanks to Kostya Kortchinsky of Google security team for discovering and
  22420. -reporting this issue.
  22421. -
  22422. -Signed-off-by: Jouni Malinen <j@w1.fi>
  22423. ----
  22424. - src/eap_server/eap_server_pwd.c | 19 +++++++++++++++++++
  22425. - 1 file changed, 19 insertions(+)
  22426. -
  22427. -diff --git a/src/eap_server/eap_server_pwd.c b/src/eap_server/eap_server_pwd.c
  22428. -index 66bd5d2..3189105 100644
  22429. ---- a/src/eap_server/eap_server_pwd.c
  22430. -+++ b/src/eap_server/eap_server_pwd.c
  22431. -@@ -656,9 +656,21 @@ eap_pwd_process_commit_resp(struct eap_sm *sm, struct eap_pwd_data *data,
  22432. - BIGNUM *x = NULL, *y = NULL, *cofactor = NULL;
  22433. - EC_POINT *K = NULL, *point = NULL;
  22434. - int res = 0;
  22435. -+ size_t prime_len, order_len;
  22436. -
  22437. - wpa_printf(MSG_DEBUG, "EAP-pwd: Received commit response");
  22438. -
  22439. -+ prime_len = BN_num_bytes(data->grp->prime);
  22440. -+ order_len = BN_num_bytes(data->grp->order);
  22441. -+
  22442. -+ if (payload_len != 2 * prime_len + order_len) {
  22443. -+ wpa_printf(MSG_INFO,
  22444. -+ "EAP-pwd: Unexpected Commit payload length %u (expected %u)",
  22445. -+ (unsigned int) payload_len,
  22446. -+ (unsigned int) (2 * prime_len + order_len));
  22447. -+ goto fin;
  22448. -+ }
  22449. -+
  22450. - if (((data->peer_scalar = BN_new()) == NULL) ||
  22451. - ((data->k = BN_new()) == NULL) ||
  22452. - ((cofactor = BN_new()) == NULL) ||
  22453. -@@ -774,6 +786,13 @@ eap_pwd_process_confirm_resp(struct eap_sm *sm, struct eap_pwd_data *data,
  22454. - u8 conf[SHA256_MAC_LEN], *cruft = NULL, *ptr;
  22455. - int offset;
  22456. -
  22457. -+ if (payload_len != SHA256_MAC_LEN) {
  22458. -+ wpa_printf(MSG_INFO,
  22459. -+ "EAP-pwd: Unexpected Confirm payload length %u (expected %u)",
  22460. -+ (unsigned int) payload_len, SHA256_MAC_LEN);
  22461. -+ goto fin;
  22462. -+ }
  22463. -+
  22464. - /* build up the ciphersuite: group | random_function | prf */
  22465. - grp = htons(data->group_num);
  22466. - ptr = (u8 *) &cs;
  22467. ---
  22468. -1.9.1
  22469. -
  22470. 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
  22471. deleted file mode 100644
  22472. index 4d2f9d8aefebd43813ba55e5f1152cd2120323ca..0000000000000000000000000000000000000000
  22473. --- a/package/network/services/hostapd/patches/006-EAP-pwd-peer-Fix-Total-Length-parsing-for-fragment-r.patch
  22474. +++ /dev/null
  22475. @@ -1,52 +0,0 @@
  22476. -From 477c74395acd0123340457ba6f15ab345d42016e Mon Sep 17 00:00:00 2001
  22477. -From: Jouni Malinen <j@w1.fi>
  22478. -Date: Sat, 2 May 2015 19:23:04 +0300
  22479. -Subject: [PATCH 3/5] EAP-pwd peer: Fix Total-Length parsing for fragment
  22480. - reassembly
  22481. -
  22482. -The remaining number of bytes in the message could be smaller than the
  22483. -Total-Length field size, so the length needs to be explicitly checked
  22484. -prior to reading the field and decrementing the len variable. This could
  22485. -have resulted in the remaining length becoming negative and interpreted
  22486. -as a huge positive integer.
  22487. -
  22488. -In addition, check that there is no already started fragment in progress
  22489. -before allocating a new buffer for reassembling fragments. This avoid a
  22490. -potential memory leak when processing invalid message.
  22491. -
  22492. -Signed-off-by: Jouni Malinen <j@w1.fi>
  22493. ----
  22494. - src/eap_peer/eap_pwd.c | 12 ++++++++++++
  22495. - 1 file changed, 12 insertions(+)
  22496. -
  22497. -diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c
  22498. -index a629437..1d2079b 100644
  22499. ---- a/src/eap_peer/eap_pwd.c
  22500. -+++ b/src/eap_peer/eap_pwd.c
  22501. -@@ -866,11 +866,23 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret,
  22502. - * if it's the first fragment there'll be a length field
  22503. - */
  22504. - if (EAP_PWD_GET_LENGTH_BIT(lm_exch)) {
  22505. -+ if (len < 2) {
  22506. -+ wpa_printf(MSG_DEBUG,
  22507. -+ "EAP-pwd: Frame too short to contain Total-Length field");
  22508. -+ ret->ignore = TRUE;
  22509. -+ return NULL;
  22510. -+ }
  22511. - tot_len = WPA_GET_BE16(pos);
  22512. - wpa_printf(MSG_DEBUG, "EAP-pwd: Incoming fragments whose "
  22513. - "total length = %d", tot_len);
  22514. - if (tot_len > 15000)
  22515. - return NULL;
  22516. -+ if (data->inbuf) {
  22517. -+ wpa_printf(MSG_DEBUG,
  22518. -+ "EAP-pwd: Unexpected new fragment start when previous fragment is still in use");
  22519. -+ ret->ignore = TRUE;
  22520. -+ return NULL;
  22521. -+ }
  22522. - data->inbuf = wpabuf_alloc(tot_len);
  22523. - if (data->inbuf == NULL) {
  22524. - wpa_printf(MSG_INFO, "Out of memory to buffer "
  22525. ---
  22526. -1.9.1
  22527. -
  22528. 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
  22529. deleted file mode 100644
  22530. index 7edef099eb59e2dc92fed9ca10fd0479a965c51c..0000000000000000000000000000000000000000
  22531. --- a/package/network/services/hostapd/patches/007-EAP-pwd-server-Fix-Total-Length-parsing-for-fragment.patch
  22532. +++ /dev/null
  22533. @@ -1,50 +0,0 @@
  22534. -From 3035cc2894e08319b905bd6561e8bddc8c2db9fa Mon Sep 17 00:00:00 2001
  22535. -From: Jouni Malinen <j@w1.fi>
  22536. -Date: Sat, 2 May 2015 19:26:06 +0300
  22537. -Subject: [PATCH 4/5] EAP-pwd server: Fix Total-Length parsing for fragment
  22538. - reassembly
  22539. -
  22540. -The remaining number of bytes in the message could be smaller than the
  22541. -Total-Length field size, so the length needs to be explicitly checked
  22542. -prior to reading the field and decrementing the len variable. This could
  22543. -have resulted in the remaining length becoming negative and interpreted
  22544. -as a huge positive integer.
  22545. -
  22546. -In addition, check that there is no already started fragment in progress
  22547. -before allocating a new buffer for reassembling fragments. This avoid a
  22548. -potential memory leak when processing invalid message.
  22549. -
  22550. -Signed-off-by: Jouni Malinen <j@w1.fi>
  22551. ----
  22552. - src/eap_server/eap_server_pwd.c | 10 ++++++++++
  22553. - 1 file changed, 10 insertions(+)
  22554. -
  22555. -diff --git a/src/eap_server/eap_server_pwd.c b/src/eap_server/eap_server_pwd.c
  22556. -index 3189105..2bfc3c2 100644
  22557. ---- a/src/eap_server/eap_server_pwd.c
  22558. -+++ b/src/eap_server/eap_server_pwd.c
  22559. -@@ -942,11 +942,21 @@ static void eap_pwd_process(struct eap_sm *sm, void *priv,
  22560. - * the first fragment has a total length
  22561. - */
  22562. - if (EAP_PWD_GET_LENGTH_BIT(lm_exch)) {
  22563. -+ if (len < 2) {
  22564. -+ wpa_printf(MSG_DEBUG,
  22565. -+ "EAP-pwd: Frame too short to contain Total-Length field");
  22566. -+ return;
  22567. -+ }
  22568. - tot_len = WPA_GET_BE16(pos);
  22569. - wpa_printf(MSG_DEBUG, "EAP-pwd: Incoming fragments, total "
  22570. - "length = %d", tot_len);
  22571. - if (tot_len > 15000)
  22572. - return;
  22573. -+ if (data->inbuf) {
  22574. -+ wpa_printf(MSG_DEBUG,
  22575. -+ "EAP-pwd: Unexpected new fragment start when previous fragment is still in use");
  22576. -+ return;
  22577. -+ }
  22578. - data->inbuf = wpabuf_alloc(tot_len);
  22579. - if (data->inbuf == NULL) {
  22580. - wpa_printf(MSG_INFO, "EAP-pwd: Out of memory to "
  22581. ---
  22582. -1.9.1
  22583. -
  22584. 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
  22585. deleted file mode 100644
  22586. index a601323f14da8a98f08c6ee02367ac74890059f3..0000000000000000000000000000000000000000
  22587. --- a/package/network/services/hostapd/patches/008-EAP-pwd-peer-Fix-asymmetric-fragmentation-behavior.patch
  22588. +++ /dev/null
  22589. @@ -1,32 +0,0 @@
  22590. -From 28a069a545b06b99eb55ad53f63f2c99e65a98f6 Mon Sep 17 00:00:00 2001
  22591. -From: Jouni Malinen <j@w1.fi>
  22592. -Date: Sat, 2 May 2015 19:26:28 +0300
  22593. -Subject: [PATCH 5/5] EAP-pwd peer: Fix asymmetric fragmentation behavior
  22594. -
  22595. -The L (Length) and M (More) flags needs to be cleared before deciding
  22596. -whether the locally generated response requires fragmentation. This
  22597. -fixes an issue where these flags from the server could have been invalid
  22598. -for the following message. In some cases, this could have resulted in
  22599. -triggering the wpabuf security check that would terminate the process
  22600. -due to invalid buffer allocation.
  22601. -
  22602. -Signed-off-by: Jouni Malinen <j@w1.fi>
  22603. ----
  22604. - src/eap_peer/eap_pwd.c | 1 +
  22605. - 1 file changed, 1 insertion(+)
  22606. -
  22607. -diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c
  22608. -index 1d2079b..e58b13a 100644
  22609. ---- a/src/eap_peer/eap_pwd.c
  22610. -+++ b/src/eap_peer/eap_pwd.c
  22611. -@@ -968,6 +968,7 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret,
  22612. - /*
  22613. - * we have output! Do we need to fragment it?
  22614. - */
  22615. -+ lm_exch = EAP_PWD_GET_EXCHANGE(lm_exch);
  22616. - len = wpabuf_len(data->outbuf);
  22617. - if ((len + EAP_PWD_HDR_SIZE) > data->mtu) {
  22618. - resp = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_PWD, data->mtu,
  22619. ---
  22620. -1.9.1
  22621. -
  22622. 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
  22623. deleted file mode 100644
  22624. index dd3462465ea4ff460c5be5a10379da9b72973007..0000000000000000000000000000000000000000
  22625. --- a/package/network/services/hostapd/patches/009-NFC-Fix-payload-length-validation-in-NDEF-record-par.patch
  22626. +++ /dev/null
  22627. @@ -1,61 +0,0 @@
  22628. -From df9079e72760ceb7ebe7fb11538200c516bdd886 Mon Sep 17 00:00:00 2001
  22629. -From: Jouni Malinen <j@w1.fi>
  22630. -Date: Tue, 7 Jul 2015 21:57:28 +0300
  22631. -Subject: [PATCH] NFC: Fix payload length validation in NDEF record parser
  22632. -
  22633. -It was possible for the 32-bit record->total_length value to end up
  22634. -wrapping around due to integer overflow if the longer form of payload
  22635. -length field is used and record->payload_length gets a value close to
  22636. -2^32. This could result in ndef_parse_record() accepting a too large
  22637. -payload length value and the record type filter reading up to about 20
  22638. -bytes beyond the end of the buffer and potentially killing the process.
  22639. -This could also result in an attempt to allocate close to 2^32 bytes of
  22640. -heap memory and if that were to succeed, a buffer read overflow of the
  22641. -same length which would most likely result in the process termination.
  22642. -In case of record->total_length ending up getting the value 0, there
  22643. -would be no buffer read overflow, but record parsing would result in an
  22644. -infinite loop in ndef_parse_records().
  22645. -
  22646. -Any of these error cases could potentially be used for denial of service
  22647. -attacks over NFC by using a malformed NDEF record on an NFC Tag or
  22648. -sending them during NFC connection handover if the application providing
  22649. -the NDEF message to hostapd/wpa_supplicant did no validation of the
  22650. -received records. While such validation is likely done in the NFC stack
  22651. -that needs to parse the NFC messages before further processing,
  22652. -hostapd/wpa_supplicant better be prepared for any data being included
  22653. -here.
  22654. -
  22655. -Fix this by validating record->payload_length value in a way that
  22656. -detects integer overflow. (CID 122668)
  22657. -
  22658. -Signed-off-by: Jouni Malinen <j@w1.fi>
  22659. ----
  22660. - src/wps/ndef.c | 5 ++++-
  22661. - 1 file changed, 4 insertions(+), 1 deletion(-)
  22662. -
  22663. -diff --git a/src/wps/ndef.c b/src/wps/ndef.c
  22664. -index 5604b0a..50d018f 100644
  22665. ---- a/src/wps/ndef.c
  22666. -+++ b/src/wps/ndef.c
  22667. -@@ -48,6 +48,8 @@ static int ndef_parse_record(const u8 *data, u32 size,
  22668. - if (size < 6)
  22669. - return -1;
  22670. - record->payload_length = ntohl(*(u32 *)pos);
  22671. -+ if (record->payload_length > size - 6)
  22672. -+ return -1;
  22673. - pos += sizeof(u32);
  22674. - }
  22675. -
  22676. -@@ -68,7 +70,8 @@ static int ndef_parse_record(const u8 *data, u32 size,
  22677. - pos += record->payload_length;
  22678. -
  22679. - record->total_length = pos - data;
  22680. -- if (record->total_length > size)
  22681. -+ if (record->total_length > size ||
  22682. -+ record->total_length < record->payload_length)
  22683. - return -1;
  22684. - return 0;
  22685. - }
  22686. ---
  22687. -1.9.1
  22688. -
  22689. 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
  22690. deleted file mode 100644
  22691. index 00e5b7c771df4c8aeec39aafc2b893297667038d..0000000000000000000000000000000000000000
  22692. --- a/package/network/services/hostapd/patches/010-WNM-Ignore-Key-Data-in-WNM-Sleep-Mode-Response-frame.patch
  22693. +++ /dev/null
  22694. @@ -1,32 +0,0 @@
  22695. -From 6b12d93d2c7428a34bfd4b3813ba339ed57b698a Mon Sep 17 00:00:00 2001
  22696. -From: Jouni Malinen <j@w1.fi>
  22697. -Date: Sun, 25 Oct 2015 15:45:50 +0200
  22698. -Subject: [PATCH] WNM: Ignore Key Data in WNM Sleep Mode Response frame if no
  22699. - PMF in use
  22700. -
  22701. -WNM Sleep Mode Response frame is used to update GTK/IGTK only if PMF is
  22702. -enabled. Verify that PMF is in use before using this field on station
  22703. -side to avoid accepting unauthenticated key updates. (CVE-2015-5310)
  22704. -
  22705. -Signed-off-by: Jouni Malinen <j@w1.fi>
  22706. ----
  22707. - wpa_supplicant/wnm_sta.c | 6 ++++++
  22708. - 1 file changed, 6 insertions(+)
  22709. -
  22710. -diff --git a/wpa_supplicant/wnm_sta.c b/wpa_supplicant/wnm_sta.c
  22711. -index 954de67..7d79499 100644
  22712. ---- a/wpa_supplicant/wnm_sta.c
  22713. -+++ b/wpa_supplicant/wnm_sta.c
  22714. -@@ -187,6 +187,12 @@ static void wnm_sleep_mode_exit_success(struct wpa_supplicant *wpa_s,
  22715. - end = ptr + key_len_total;
  22716. - wpa_hexdump_key(MSG_DEBUG, "WNM: Key Data", ptr, key_len_total);
  22717. -
  22718. -+ if (key_len_total && !wpa_sm_pmf_enabled(wpa_s->wpa)) {
  22719. -+ wpa_msg(wpa_s, MSG_INFO,
  22720. -+ "WNM: Ignore Key Data in WNM-Sleep Mode Response - PMF not enabled");
  22721. -+ return;
  22722. -+ }
  22723. -+
  22724. - while (ptr + 1 < end) {
  22725. - if (ptr + 2 + ptr[1] > end) {
  22726. - wpa_printf(MSG_DEBUG, "WNM: Invalid Key Data element "
  22727. 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
  22728. deleted file mode 100644
  22729. index 82c26398b69d4c7b32c4851fdba43630af172c28..0000000000000000000000000000000000000000
  22730. --- a/package/network/services/hostapd/patches/011-EAP-pwd-peer-Fix-last-fragment-length-validation.patch
  22731. +++ /dev/null
  22732. @@ -1,54 +0,0 @@
  22733. -From 8057821706784608b828e769ccefbced95591e50 Mon Sep 17 00:00:00 2001
  22734. -From: Jouni Malinen <j@w1.fi>
  22735. -Date: Sun, 1 Nov 2015 18:18:17 +0200
  22736. -Subject: [PATCH] EAP-pwd peer: Fix last fragment length validation
  22737. -
  22738. -All but the last fragment had their length checked against the remaining
  22739. -room in the reassembly buffer. This allowed a suitably constructed last
  22740. -fragment frame to try to add extra data that would go beyond the buffer.
  22741. -The length validation code in wpabuf_put_data() prevents an actual
  22742. -buffer write overflow from occurring, but this results in process
  22743. -termination. (CVE-2015-5315)
  22744. -
  22745. -Signed-off-by: Jouni Malinen <j@w1.fi>
  22746. ----
  22747. - src/eap_peer/eap_pwd.c | 7 +++----
  22748. - 1 file changed, 3 insertions(+), 4 deletions(-)
  22749. -
  22750. -diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c
  22751. -index 1f78544..75ceef1 100644
  22752. ---- a/src/eap_peer/eap_pwd.c
  22753. -+++ b/src/eap_peer/eap_pwd.c
  22754. -@@ -903,7 +903,7 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret,
  22755. - /*
  22756. - * buffer and ACK the fragment
  22757. - */
  22758. -- if (EAP_PWD_GET_MORE_BIT(lm_exch)) {
  22759. -+ if (EAP_PWD_GET_MORE_BIT(lm_exch) || data->in_frag_pos) {
  22760. - data->in_frag_pos += len;
  22761. - if (data->in_frag_pos > wpabuf_size(data->inbuf)) {
  22762. - wpa_printf(MSG_INFO, "EAP-pwd: Buffer overflow attack "
  22763. -@@ -916,7 +916,8 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret,
  22764. - return NULL;
  22765. - }
  22766. - wpabuf_put_data(data->inbuf, pos, len);
  22767. --
  22768. -+ }
  22769. -+ if (EAP_PWD_GET_MORE_BIT(lm_exch)) {
  22770. - resp = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_PWD,
  22771. - EAP_PWD_HDR_SIZE,
  22772. - EAP_CODE_RESPONSE, eap_get_id(reqData));
  22773. -@@ -930,10 +931,8 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret,
  22774. - * we're buffering and this is the last fragment
  22775. - */
  22776. - if (data->in_frag_pos) {
  22777. -- wpabuf_put_data(data->inbuf, pos, len);
  22778. - wpa_printf(MSG_DEBUG, "EAP-pwd: Last fragment, %d bytes",
  22779. - (int) len);
  22780. -- data->in_frag_pos += len;
  22781. - pos = wpabuf_head_u8(data->inbuf);
  22782. - len = data->in_frag_pos;
  22783. - }
  22784. ---
  22785. -1.9.1
  22786. -
  22787. 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
  22788. deleted file mode 100644
  22789. index bfc4c74e95cad7dae1afe5a315b9e4ff5ab5b920..0000000000000000000000000000000000000000
  22790. --- a/package/network/services/hostapd/patches/012-EAP-pwd-server-Fix-last-fragment-length-validation.patch
  22791. +++ /dev/null
  22792. @@ -1,51 +0,0 @@
  22793. -From bef802ece03f9ae9d52a21f0cf4f1bc2c5a1f8aa Mon Sep 17 00:00:00 2001
  22794. -From: Jouni Malinen <j@w1.fi>
  22795. -Date: Sun, 1 Nov 2015 18:24:16 +0200
  22796. -Subject: [PATCH] EAP-pwd server: Fix last fragment length validation
  22797. -
  22798. -All but the last fragment had their length checked against the remaining
  22799. -room in the reassembly buffer. This allowed a suitably constructed last
  22800. -fragment frame to try to add extra data that would go beyond the buffer.
  22801. -The length validation code in wpabuf_put_data() prevents an actual
  22802. -buffer write overflow from occurring, but this results in process
  22803. -termination. (CVE-2015-5314)
  22804. -
  22805. -Signed-off-by: Jouni Malinen <j@w1.fi>
  22806. ----
  22807. - src/eap_server/eap_server_pwd.c | 6 +++---
  22808. - 1 file changed, 3 insertions(+), 3 deletions(-)
  22809. -
  22810. -diff --git a/src/eap_server/eap_server_pwd.c b/src/eap_server/eap_server_pwd.c
  22811. -index cb83ff7..9f787ab 100644
  22812. ---- a/src/eap_server/eap_server_pwd.c
  22813. -+++ b/src/eap_server/eap_server_pwd.c
  22814. -@@ -970,7 +970,7 @@ static void eap_pwd_process(struct eap_sm *sm, void *priv,
  22815. - /*
  22816. - * the first and all intermediate fragments have the M bit set
  22817. - */
  22818. -- if (EAP_PWD_GET_MORE_BIT(lm_exch)) {
  22819. -+ if (EAP_PWD_GET_MORE_BIT(lm_exch) || data->in_frag_pos) {
  22820. - if ((data->in_frag_pos + len) > wpabuf_size(data->inbuf)) {
  22821. - wpa_printf(MSG_DEBUG, "EAP-pwd: Buffer overflow "
  22822. - "attack detected! (%d+%d > %d)",
  22823. -@@ -981,6 +981,8 @@ static void eap_pwd_process(struct eap_sm *sm, void *priv,
  22824. - }
  22825. - wpabuf_put_data(data->inbuf, pos, len);
  22826. - data->in_frag_pos += len;
  22827. -+ }
  22828. -+ if (EAP_PWD_GET_MORE_BIT(lm_exch)) {
  22829. - wpa_printf(MSG_DEBUG, "EAP-pwd: Got a %d byte fragment",
  22830. - (int) len);
  22831. - return;
  22832. -@@ -990,8 +992,6 @@ static void eap_pwd_process(struct eap_sm *sm, void *priv,
  22833. - * buffering fragments so that's how we know it's the last)
  22834. - */
  22835. - if (data->in_frag_pos) {
  22836. -- wpabuf_put_data(data->inbuf, pos, len);
  22837. -- data->in_frag_pos += len;
  22838. - pos = wpabuf_head_u8(data->inbuf);
  22839. - len = data->in_frag_pos;
  22840. - wpa_printf(MSG_DEBUG, "EAP-pwd: Last fragment, %d bytes",
  22841. ---
  22842. -1.9.1
  22843. -
  22844. 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
  22845. deleted file mode 100644
  22846. index 3088f6a6dcda38dd4d579f020607237780324dc4..0000000000000000000000000000000000000000
  22847. --- a/package/network/services/hostapd/patches/013-EAP-pwd-peer-Fix-error-path-for-unexpected-Confirm-m.patch
  22848. +++ /dev/null
  22849. @@ -1,34 +0,0 @@
  22850. -From 95577884ca4fa76be91344ff7a8d5d1e6dc3da61 Mon Sep 17 00:00:00 2001
  22851. -From: Jouni Malinen <j@w1.fi>
  22852. -Date: Sun, 1 Nov 2015 19:35:44 +0200
  22853. -Subject: [PATCH] EAP-pwd peer: Fix error path for unexpected Confirm message
  22854. -
  22855. -If the Confirm message is received from the server before the Identity
  22856. -exchange has been completed, the group has not yet been determined and
  22857. -data->grp is NULL. The error path in eap_pwd_perform_confirm_exchange()
  22858. -did not take this corner case into account and could end up
  22859. -dereferencing a NULL pointer and terminating the process if invalid
  22860. -message sequence is received. (CVE-2015-5316)
  22861. -
  22862. -Signed-off-by: Jouni Malinen <j@w1.fi>
  22863. ----
  22864. - src/eap_peer/eap_pwd.c | 3 ++-
  22865. - 1 file changed, 2 insertions(+), 1 deletion(-)
  22866. -
  22867. -diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c
  22868. -index 75ceef1..892b590 100644
  22869. ---- a/src/eap_peer/eap_pwd.c
  22870. -+++ b/src/eap_peer/eap_pwd.c
  22871. -@@ -774,7 +774,8 @@ eap_pwd_perform_confirm_exchange(struct eap_sm *sm, struct eap_pwd_data *data,
  22872. - wpabuf_put_data(data->outbuf, conf, SHA256_MAC_LEN);
  22873. -
  22874. - fin:
  22875. -- bin_clear_free(cruft, BN_num_bytes(data->grp->prime));
  22876. -+ if (data->grp)
  22877. -+ bin_clear_free(cruft, BN_num_bytes(data->grp->prime));
  22878. - BN_clear_free(x);
  22879. - BN_clear_free(y);
  22880. - if (data->outbuf == NULL) {
  22881. ---
  22882. -1.9.1
  22883. -
  22884. 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
  22885. deleted file mode 100644
  22886. index 25ba87d8d140ee614253c1ef75921313130c88b2..0000000000000000000000000000000000000000
  22887. --- a/package/network/services/hostapd/patches/014-nl80211-Try-running-without-mgmt-frame-subscription-.patch
  22888. +++ /dev/null
  22889. @@ -1,48 +0,0 @@
  22890. -From f4830bed661f4adff51f50a0d37c64ceb748e780 Mon Sep 17 00:00:00 2001
  22891. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  22892. -Date: Mon, 25 Apr 2016 17:10:47 +0200
  22893. -Subject: [PATCH] nl80211: Try running without mgmt frame subscription (driver
  22894. - AP SME)
  22895. -MIME-Version: 1.0
  22896. -Content-Type: text/plain; charset=UTF-8
  22897. -Content-Transfer-Encoding: 8bit
  22898. -
  22899. -One of supported code paths already allows this scenario. It is used if
  22900. -driver doesn't report NL80211_ATTR_DEVICE_AP_SME and doesn't support
  22901. -monitor interface. In such situation:
  22902. -1) We don't quit if subscribing for WLAN_FC_STYPE_PROBE_REQ fails
  22903. -2) We don't try subscribing for WLAN_FC_STYPE_ACTION
  22904. -3) We fallback to AP SME mode after failing to create monitor interface
  22905. -4) We don't quit if subscribing for WLAN_FC_STYPE_PROBE_REQ fails
  22906. -Above scenario is used, e.g., with brcmfmac. As you can see - thanks to
  22907. -events provided by cfg80211 - it's not really required to receive Probe
  22908. -Request or action frames.
  22909. -
  22910. -However, the previous implementation did not allow using hostapd with
  22911. -drivers that:
  22912. -1) Report NL80211_ATTR_DEVICE_AP_SME
  22913. -2) Don't support subscribing for PROBE_REQ and/or ACTION frames
  22914. -In case of using such a driver hostapd will cancel setup after failing
  22915. -to subscribe for WLAN_FC_STYPE_ACTION. I noticed it after setting flag
  22916. -WIPHY_FLAG_HAVE_AP_SME in brcmfmac driver for my experiments.
  22917. -
  22918. -This patch allows working with such drivers with just a small warning
  22919. -printed as debug message.
  22920. -
  22921. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  22922. ----
  22923. - src/drivers/driver_nl80211.c | 3 ++-
  22924. - 1 file changed, 2 insertions(+), 1 deletion(-)
  22925. -
  22926. ---- a/src/drivers/driver_nl80211.c
  22927. -+++ b/src/drivers/driver_nl80211.c
  22928. -@@ -4108,7 +4108,8 @@ static int nl80211_setup_ap(struct i802_
  22929. -
  22930. - if (drv->device_ap_sme && !drv->use_monitor)
  22931. - if (nl80211_mgmt_subscribe_ap_dev_sme(bss))
  22932. -- return -1;
  22933. -+ wpa_printf(MSG_DEBUG,
  22934. -+ "nl80211: Failed to subscribe for mgmt frames from SME driver - trying to run without it");
  22935. -
  22936. - if (!drv->device_ap_sme && drv->use_monitor &&
  22937. - nl80211_create_monitor_interface(drv) &&
  22938. diff --git a/package/network/services/hostapd/patches/100-mesh_mode_fix.patch b/package/network/services/hostapd/patches/100-mesh_mode_fix.patch
  22939. new file mode 100644
  22940. index 0000000000000000000000000000000000000000..ceb4c53afacfb1dd5430a487147e73b3de4f7239
  22941. --- /dev/null
  22942. +++ b/package/network/services/hostapd/patches/100-mesh_mode_fix.patch
  22943. @@ -0,0 +1,12 @@
  22944. +--- a/src/drivers/driver_nl80211.c
  22945. ++++ b/src/drivers/driver_nl80211.c
  22946. +@@ -2332,7 +2332,8 @@ wpa_driver_nl80211_finish_drv_init(struc
  22947. +
  22948. + if (drv->hostapd || bss->static_ap)
  22949. + nlmode = NL80211_IFTYPE_AP;
  22950. +- else if (bss->if_dynamic)
  22951. ++ else if (bss->if_dynamic ||
  22952. ++ nl80211_get_ifmode(bss) == NL80211_IFTYPE_MESH_POINT)
  22953. + nlmode = nl80211_get_ifmode(bss);
  22954. + else
  22955. + nlmode = NL80211_IFTYPE_STATION;
  22956. diff --git a/package/network/services/hostapd/patches/110-bool_fix.patch b/package/network/services/hostapd/patches/110-bool_fix.patch
  22957. deleted file mode 100644
  22958. index 865c014ee311d3d9ae73575d211d8c8904b0e237..0000000000000000000000000000000000000000
  22959. --- a/package/network/services/hostapd/patches/110-bool_fix.patch
  22960. +++ /dev/null
  22961. @@ -1,14 +0,0 @@
  22962. ---- a/src/ap/ieee802_1x.c
  22963. -+++ b/src/ap/ieee802_1x.c
  22964. -@@ -2332,9 +2332,9 @@ void ieee802_1x_notify_pre_auth(struct e
  22965. - }
  22966. -
  22967. -
  22968. --static const char * bool_txt(Boolean bool)
  22969. -+static const char * bool_txt(Boolean bool_val)
  22970. - {
  22971. -- return bool ? "TRUE" : "FALSE";
  22972. -+ return bool_val ? "TRUE" : "FALSE";
  22973. - }
  22974. -
  22975. -
  22976. 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
  22977. new file mode 100644
  22978. index 0000000000000000000000000000000000000000..67fb899f30a6f9dbd04b89da28a3ed9fd6263fa6
  22979. --- /dev/null
  22980. +++ b/package/network/services/hostapd/patches/110-fix_parse_das_client.patch
  22981. @@ -0,0 +1,10 @@
  22982. +--- a/hostapd/config_file.c
  22983. ++++ b/hostapd/config_file.c
  22984. +@@ -645,6 +645,7 @@ static int hostapd_parse_das_client(stru
  22985. + if (secret == NULL)
  22986. + return -1;
  22987. +
  22988. ++ *secret = 0;
  22989. + secret++;
  22990. +
  22991. + if (hostapd_parse_ip_addr(val, &bss->radius_das_client_addr))
  22992. diff --git a/package/network/services/hostapd/patches/120-daemonize_fix.patch b/package/network/services/hostapd/patches/120-daemonize_fix.patch
  22993. index 032e2072a35770628f96831ab3b6c4bbebdb7cf2..0389406a98a11a9eb4d5df64a30896e57dea103b 100644
  22994. --- a/package/network/services/hostapd/patches/120-daemonize_fix.patch
  22995. +++ b/package/network/services/hostapd/patches/120-daemonize_fix.patch
  22996. @@ -8,7 +8,7 @@
  22997. #ifdef ANDROID
  22998. #include <sys/capability.h>
  22999. -@@ -155,59 +156,46 @@ int os_gmtime(os_time_t t, struct os_tm
  23000. +@@ -179,59 +180,46 @@ int os_gmtime(os_time_t t, struct os_tm
  23001. return 0;
  23002. }
  23003. @@ -60,13 +60,13 @@
  23004. + if (chdir("/") < 0)
  23005. return -1;
  23006. - }
  23007. --
  23008. +
  23009. - return 0;
  23010. -}
  23011. -#else /* __APPLE__ */
  23012. -#define os_daemon daemon
  23013. -#endif /* __APPLE__ */
  23014. -
  23015. +-
  23016. -
  23017. -int os_daemonize(const char *pid_file)
  23018. -{
  23019. diff --git a/package/network/services/hostapd/patches/130-no_eapol_fix.patch b/package/network/services/hostapd/patches/130-no_eapol_fix.patch
  23020. index d23b47b03c7b652cd7fa7b5ca3937633638aac25..5aee3d07f16b1f5665fab1b2a31794c32e18cbac 100644
  23021. --- a/package/network/services/hostapd/patches/130-no_eapol_fix.patch
  23022. +++ b/package/network/services/hostapd/patches/130-no_eapol_fix.patch
  23023. @@ -1,6 +1,6 @@
  23024. --- a/wpa_supplicant/wpa_supplicant.c
  23025. +++ b/wpa_supplicant/wpa_supplicant.c
  23026. -@@ -252,9 +252,10 @@ void wpa_supplicant_cancel_auth_timeout(
  23027. +@@ -257,9 +257,10 @@ void wpa_supplicant_cancel_auth_timeout(
  23028. */
  23029. void wpa_supplicant_initiate_eapol(struct wpa_supplicant *wpa_s)
  23030. {
  23031. 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
  23032. index 6337d8d737bfa3c327d46b8843cbbe72efe4c14d..fdd5da9bf5e99cad1a998f80f435ac26097274cd 100644
  23033. --- a/package/network/services/hostapd/patches/140-disable_bridge_packet_workaround.patch
  23034. +++ b/package/network/services/hostapd/patches/140-disable_bridge_packet_workaround.patch
  23035. @@ -1,6 +1,6 @@
  23036. --- a/src/l2_packet/l2_packet_linux.c
  23037. +++ b/src/l2_packet/l2_packet_linux.c
  23038. -@@ -307,8 +307,7 @@ struct l2_packet_data * l2_packet_init_b
  23039. +@@ -337,8 +337,7 @@ struct l2_packet_data * l2_packet_init_b
  23040. l2 = l2_packet_init(br_ifname, own_addr, protocol, rx_callback,
  23041. rx_callback_ctx, l2_hdr);
  23042. @@ -8,5 +8,5 @@
  23043. - return NULL;
  23044. + return l2;
  23045. + #ifndef CONFIG_NO_LINUX_PACKET_SOCKET_WAR
  23046. /*
  23047. - * The Linux packet socket behavior has changed over the years and there
  23048. 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
  23049. deleted file mode 100644
  23050. index 66c682fbd39c4cad25590534236da3261743ab70..0000000000000000000000000000000000000000
  23051. --- a/package/network/services/hostapd/patches/150-nl80211-Report-disassociated-STA-lost-peer-for-the-c.patch
  23052. +++ /dev/null
  23053. @@ -1,67 +0,0 @@
  23054. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  23055. -Date: Mon, 11 Jan 2016 19:18:06 +0100
  23056. -Subject: [PATCH] nl80211: Report disassociated STA / lost peer for the correct
  23057. - BSS
  23058. -MIME-Version: 1.0
  23059. -Content-Type: text/plain; charset=UTF-8
  23060. -Content-Transfer-Encoding: 8bit
  23061. -
  23062. -We shouldn't use drv->ctx as it always points to the first BSS. When
  23063. -using FullMAC driver with multi-BSS support it resulted in incorrect
  23064. -treating nl80211 events. I noticed with with brcmfmac and BCM43602.
  23065. -
  23066. -Before my change I was getting "disassociated" on a wrong interface:
  23067. -wlan0-1: STA 78:d6:f0:00:11:22 IEEE 802.11: associated
  23068. -wlan0-1: STA 78:d6:f0:00:11:22 WPA: pairwise key handshake completed (RSN)
  23069. -wlan0: STA 78:d6:f0:00:11:22 IEEE 802.11: disassociated
  23070. -
  23071. -With this patch it works as expected:
  23072. -wlan0-1: STA 78:d6:f0:00:11:22 IEEE 802.11: associated
  23073. -wlan0-1: STA 78:d6:f0:00:11:22 WPA: pairwise key handshake completed (RSN)
  23074. -wlan0-1: STA 78:d6:f0:00:11:22 IEEE 802.11: disassociated
  23075. -
  23076. -This doesn't apply to hostapd dealing with SoftMAC drivers when handling
  23077. -AP SME & MLME is done it hostapd not the firmware.
  23078. -
  23079. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  23080. ----
  23081. - src/drivers/driver_nl80211_event.c | 7 ++++---
  23082. - 1 file changed, 4 insertions(+), 3 deletions(-)
  23083. -
  23084. ---- a/src/drivers/driver_nl80211_event.c
  23085. -+++ b/src/drivers/driver_nl80211_event.c
  23086. -@@ -1154,6 +1154,7 @@ static void nl80211_new_station_event(st
  23087. -
  23088. -
  23089. - static void nl80211_del_station_event(struct wpa_driver_nl80211_data *drv,
  23090. -+ struct i802_bss *bss,
  23091. - struct nlattr **tb)
  23092. - {
  23093. - u8 *addr;
  23094. -@@ -1166,7 +1167,7 @@ static void nl80211_del_station_event(st
  23095. - MAC2STR(addr));
  23096. -
  23097. - if (is_ap_interface(drv->nlmode) && drv->device_ap_sme) {
  23098. -- drv_event_disassoc(drv->ctx, addr);
  23099. -+ drv_event_disassoc(bss->ctx, addr);
  23100. - return;
  23101. - }
  23102. -
  23103. -@@ -1175,7 +1176,7 @@ static void nl80211_del_station_event(st
  23104. -
  23105. - os_memset(&data, 0, sizeof(data));
  23106. - os_memcpy(data.ibss_peer_lost.peer, addr, ETH_ALEN);
  23107. -- wpa_supplicant_event(drv->ctx, EVENT_IBSS_PEER_LOST, &data);
  23108. -+ wpa_supplicant_event(bss->ctx, EVENT_IBSS_PEER_LOST, &data);
  23109. - }
  23110. -
  23111. -
  23112. -@@ -1939,7 +1940,7 @@ static void do_process_drv_event(struct
  23113. - nl80211_new_station_event(drv, bss, tb);
  23114. - break;
  23115. - case NL80211_CMD_DEL_STATION:
  23116. -- nl80211_del_station_event(drv, tb);
  23117. -+ nl80211_del_station_event(drv, bss, tb);
  23118. - break;
  23119. - case NL80211_CMD_SET_REKEY_OFFLOAD:
  23120. - nl80211_rekey_offload_event(drv, tb);
  23121. diff --git a/package/network/services/hostapd/patches/200-multicall.patch b/package/network/services/hostapd/patches/200-multicall.patch
  23122. index de4a3a8e7f1ac310bdbf49b84a212b2c2d024c70..40bd7336ec225df892858b2d4a45cd6a3f0debb1 100644
  23123. --- a/package/network/services/hostapd/patches/200-multicall.patch
  23124. +++ b/package/network/services/hostapd/patches/200-multicall.patch
  23125. @@ -1,15 +1,25 @@
  23126. --- a/hostapd/Makefile
  23127. +++ b/hostapd/Makefile
  23128. -@@ -17,6 +17,7 @@ export BINDIR ?= /usr/local/bin/
  23129. - # CFLAGS += -DUSE_KERNEL_HEADERS -I/usr/src/linux/include
  23130. +@@ -28,6 +28,7 @@ CFLAGS += -I$(abspath ../src/utils)
  23131. + export BINDIR ?= /usr/local/bin/
  23132. -include .config
  23133. +-include $(if $(MULTICALL), ../wpa_supplicant/.config)
  23134. - ifdef CONFIG_TESTING_OPTIONS
  23135. - CFLAGS += -DCONFIG_TESTING_OPTIONS
  23136. -@@ -242,10 +243,14 @@ ifdef CONFIG_IEEE80211AC
  23137. - CFLAGS += -DCONFIG_IEEE80211AC
  23138. + ifndef CONFIG_NO_GITVER
  23139. + # Add VERSION_STR postfix for builds from a git repository
  23140. +@@ -190,7 +191,8 @@ endif
  23141. +
  23142. + ifdef CONFIG_NO_VLAN
  23143. + CFLAGS += -DCONFIG_NO_VLAN
  23144. +-else
  23145. ++endif
  23146. ++ifneq ($(findstring CONFIG_NO_VLAN,$(CFLAGS)), CONFIG_NO_VLAN)
  23147. + OBJS += ../src/ap/vlan_init.o
  23148. + OBJS += ../src/ap/vlan_ifconfig.o
  23149. + OBJS += ../src/ap/vlan.o
  23150. +@@ -315,10 +317,14 @@ CFLAGS += -DCONFIG_MBO
  23151. + OBJS += ../src/ap/mbo_ap.o
  23152. endif
  23153. +ifndef MULTICALL
  23154. @@ -26,7 +36,7 @@
  23155. LIBS += $(DRV_AP_LIBS)
  23156. ifdef CONFIG_L2_PACKET
  23157. -@@ -941,6 +946,12 @@ install: $(addprefix $(DESTDIR)$(BINDIR)
  23158. +@@ -1051,6 +1057,12 @@ install: $(addprefix $(DESTDIR)$(BINDIR)
  23159. BCHECK=../src/drivers/build.hostapd
  23160. @@ -39,30 +49,40 @@
  23161. hostapd: $(BCHECK) $(OBJS)
  23162. $(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS)
  23163. @$(E) " LD " $@
  23164. -@@ -980,6 +991,12 @@ HOBJS += ../src/crypto/aes-internal.o
  23165. +@@ -1092,6 +1104,12 @@ HOBJS += ../src/crypto/aes-internal.o
  23166. HOBJS += ../src/crypto/aes-internal-enc.o
  23167. endif
  23168. +dump_cflags:
  23169. -+ @echo -n $(CFLAGS) " "
  23170. ++ @printf "%s " "$(CFLAGS)"
  23171. +
  23172. +dump_ldflags:
  23173. -+ @echo -n $(LDFLAGS) $(LIBS) $(EXTRALIBS) " "
  23174. ++ @printf "%s " "$(LDFLAGS) $(LIBS) $(EXTRALIBS)"
  23175. +
  23176. nt_password_hash: $(NOBJS)
  23177. $(Q)$(CC) $(LDFLAGS) -o nt_password_hash $(NOBJS) $(LIBS_n)
  23178. @$(E) " LD " $@
  23179. --- a/wpa_supplicant/Makefile
  23180. +++ b/wpa_supplicant/Makefile
  23181. -@@ -15,6 +15,7 @@ CFLAGS += -I$(abspath ../src)
  23182. +@@ -27,6 +27,7 @@ CFLAGS += -I$(abspath ../src)
  23183. CFLAGS += -I$(abspath ../src/utils)
  23184. -include .config
  23185. +-include $(if $(MULTICALL),../hostapd/.config)
  23186. - ifdef CONFIG_TESTING_OPTIONS
  23187. - CFLAGS += -DCONFIG_TESTING_OPTIONS
  23188. -@@ -773,6 +774,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS
  23189. + ifndef CONFIG_NO_GITVER
  23190. + # Add VERSION_STR postfix for builds from a git repository
  23191. +@@ -312,7 +313,9 @@ endif
  23192. + ifdef CONFIG_IBSS_RSN
  23193. + NEED_RSN_AUTHENTICATOR=y
  23194. + CFLAGS += -DCONFIG_IBSS_RSN
  23195. ++ifndef MULTICALL
  23196. + CFLAGS += -DCONFIG_NO_VLAN
  23197. ++endif
  23198. + OBJS += ibss_rsn.o
  23199. + endif
  23200. +
  23201. +@@ -803,6 +806,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS
  23202. CFLAGS += -DCONFIG_DYNAMIC_EAP_METHODS
  23203. LIBS += -ldl -rdynamic
  23204. endif
  23205. @@ -73,7 +93,7 @@
  23206. endif
  23207. ifdef CONFIG_MACSEC
  23208. -@@ -793,9 +798,11 @@ NEED_EAP_COMMON=y
  23209. +@@ -823,9 +830,11 @@ NEED_EAP_COMMON=y
  23210. NEED_RSN_AUTHENTICATOR=y
  23211. CFLAGS += -DCONFIG_AP
  23212. OBJS += ap.o
  23213. @@ -85,7 +105,7 @@
  23214. OBJS += ../src/ap/hostapd.o
  23215. OBJS += ../src/ap/wpa_auth_glue.o
  23216. OBJS += ../src/ap/utils.o
  23217. -@@ -858,10 +865,18 @@ endif
  23218. +@@ -898,10 +907,18 @@ endif
  23219. ifdef CONFIG_HS20
  23220. OBJS += ../src/ap/hs20.o
  23221. endif
  23222. @@ -104,7 +124,7 @@
  23223. NEED_AES_WRAP=y
  23224. OBJS += ../src/ap/wpa_auth.o
  23225. OBJS += ../src/ap/wpa_auth_ie.o
  23226. -@@ -1603,6 +1618,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv)
  23227. +@@ -1680,6 +1697,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv)
  23228. $(OBJS_c) $(OBJS_t) $(OBJS_t2) $(OBJS) $(BCHECK) $(EXTRA_progs): .config
  23229. @@ -117,22 +137,22 @@
  23230. wpa_supplicant: $(BCHECK) $(OBJS) $(EXTRA_progs)
  23231. $(Q)$(LDO) $(LDFLAGS) -o wpa_supplicant $(OBJS) $(LIBS) $(EXTRALIBS)
  23232. @$(E) " LD " $@
  23233. -@@ -1694,6 +1715,12 @@ endif
  23234. - $(Q)sed -e 's|\@BINDIR\@|$(BINDIR)|g' $< >$@
  23235. +@@ -1782,6 +1805,12 @@ endif
  23236. + -e 's|\@DBUS_INTERFACE\@|$(DBUS_INTERFACE)|g' $< >$@
  23237. @$(E) " sed" $<
  23238. +dump_cflags:
  23239. -+ @echo -n $(CFLAGS) " "
  23240. ++ @printf "%s " "$(CFLAGS)"
  23241. +
  23242. +dump_ldflags:
  23243. -+ @echo -n $(LDFLAGS) $(LIBS) $(EXTRALIBS) " "
  23244. ++ @printf "%s " "$(LDFLAGS) $(LIBS) $(EXTRALIBS)"
  23245. +
  23246. wpa_supplicant.exe: wpa_supplicant
  23247. mv -f $< $@
  23248. wpa_cli.exe: wpa_cli
  23249. --- a/src/drivers/driver.h
  23250. +++ b/src/drivers/driver.h
  23251. -@@ -4581,8 +4581,8 @@ union wpa_event_data {
  23252. +@@ -4794,8 +4794,8 @@ union wpa_event_data {
  23253. * Driver wrapper code should call this function whenever an event is received
  23254. * from the driver.
  23255. */
  23256. @@ -141,11 +161,20 @@
  23257. +extern void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event,
  23258. + union wpa_event_data *data);
  23259. + /**
  23260. + * wpa_supplicant_event_global - Report a driver event for wpa_supplicant
  23261. +@@ -4807,7 +4807,7 @@ void wpa_supplicant_event(void *ctx, enu
  23262. + * Same as wpa_supplicant_event(), but we search for the interface in
  23263. + * wpa_global.
  23264. + */
  23265. +-void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
  23266. ++extern void (*wpa_supplicant_event_global)(void *ctx, enum wpa_event_type event,
  23267. + union wpa_event_data *data);
  23268. /*
  23269. --- a/src/ap/drv_callbacks.c
  23270. +++ b/src/ap/drv_callbacks.c
  23271. -@@ -1075,8 +1075,8 @@ static void hostapd_event_dfs_cac_starte
  23272. +@@ -1157,8 +1157,8 @@ static void hostapd_event_dfs_cac_starte
  23273. #endif /* NEED_AP_MLME */
  23274. @@ -156,9 +185,18 @@
  23275. {
  23276. struct hostapd_data *hapd = ctx;
  23277. #ifndef CONFIG_NO_STDOUT_DEBUG
  23278. +@@ -1367,7 +1367,7 @@ void wpa_supplicant_event(void *ctx, enu
  23279. + }
  23280. +
  23281. +
  23282. +-void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
  23283. ++void hostapd_wpa_event_global(void *ctx, enum wpa_event_type event,
  23284. + union wpa_event_data *data)
  23285. + {
  23286. + struct hapd_interfaces *interfaces = ctx;
  23287. --- a/wpa_supplicant/wpa_priv.c
  23288. +++ b/wpa_supplicant/wpa_priv.c
  23289. -@@ -819,8 +819,8 @@ static void wpa_priv_send_ft_response(st
  23290. +@@ -940,8 +940,8 @@ static void wpa_priv_send_ft_response(st
  23291. }
  23292. @@ -169,17 +207,27 @@
  23293. {
  23294. struct wpa_priv_interface *iface = ctx;
  23295. -@@ -961,6 +961,7 @@ int main(int argc, char *argv[])
  23296. +@@ -1010,7 +1010,7 @@ void wpa_supplicant_event(void *ctx, enu
  23297. + }
  23298. +
  23299. +
  23300. +-void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
  23301. ++void supplicant_event_global(void *ctx, enum wpa_event_type event,
  23302. + union wpa_event_data *data)
  23303. + {
  23304. + struct wpa_priv_global *global = ctx;
  23305. +@@ -1122,6 +1122,8 @@ int main(int argc, char *argv[])
  23306. if (os_program_init())
  23307. return -1;
  23308. + wpa_supplicant_event = supplicant_event;
  23309. ++ wpa_supplicant_event_global = supplicant_event_global;
  23310. wpa_priv_fd_workaround();
  23311. - for (;;) {
  23312. + os_memset(&global, 0, sizeof(global));
  23313. --- a/wpa_supplicant/events.c
  23314. +++ b/wpa_supplicant/events.c
  23315. -@@ -3138,8 +3138,8 @@ static void wpa_supplicant_event_assoc_a
  23316. +@@ -3384,8 +3384,8 @@ static void wpa_supplicant_event_assoc_a
  23317. }
  23318. @@ -189,88 +237,125 @@
  23319. + union wpa_event_data *data)
  23320. {
  23321. struct wpa_supplicant *wpa_s = ctx;
  23322. + int resched;
  23323. +@@ -4051,7 +4051,7 @@ void wpa_supplicant_event(void *ctx, enu
  23324. + #endif /* CONFIG_AP */
  23325. + break;
  23326. + case EVENT_ACS_CHANNEL_SELECTED:
  23327. +-#ifdef CONFIG_ACS
  23328. ++#if defined(CONFIG_ACS) && defined(CONFIG_AP)
  23329. + if (!wpa_s->ap_iface)
  23330. + break;
  23331. + hostapd_acs_channel_selected(wpa_s->ap_iface->bss[0],
  23332. +@@ -4065,7 +4065,7 @@ void wpa_supplicant_event(void *ctx, enu
  23333. + }
  23334. +
  23335. +-void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
  23336. ++void supplicant_event_global(void *ctx, enum wpa_event_type event,
  23337. + union wpa_event_data *data)
  23338. + {
  23339. + struct wpa_supplicant *wpa_s;
  23340. --- a/wpa_supplicant/wpa_supplicant.c
  23341. +++ b/wpa_supplicant/wpa_supplicant.c
  23342. -@@ -4300,6 +4300,9 @@ static void wpa_supplicant_deinit_iface(
  23343. - os_free(wpa_s);
  23344. +@@ -4990,7 +4990,6 @@ struct wpa_interface * wpa_supplicant_ma
  23345. + return NULL;
  23346. }
  23347. +-
  23348. + /**
  23349. + * wpa_supplicant_match_existing - Match existing interfaces
  23350. + * @global: Pointer to global data from wpa_supplicant_init()
  23351. +@@ -5027,6 +5026,11 @@ static int wpa_supplicant_match_existing
  23352. +
  23353. + #endif /* CONFIG_MATCH_IFACE */
  23354. +
  23355. +extern void supplicant_event(void *ctx, enum wpa_event_type event,
  23356. + union wpa_event_data *data);
  23357. +
  23358. ++extern void supplicant_event_global(void *ctx, enum wpa_event_type event,
  23359. ++ union wpa_event_data *data);
  23360. /**
  23361. * wpa_supplicant_add_iface - Add a new network interface
  23362. -@@ -4526,6 +4529,7 @@ struct wpa_global * wpa_supplicant_init(
  23363. +@@ -5282,6 +5286,8 @@ struct wpa_global * wpa_supplicant_init(
  23364. #ifndef CONFIG_NO_WPA_MSG
  23365. wpa_msg_register_ifname_cb(wpa_supplicant_msg_ifname_cb);
  23366. #endif /* CONFIG_NO_WPA_MSG */
  23367. + wpa_supplicant_event = supplicant_event;
  23368. ++ wpa_supplicant_event_global = supplicant_event_global;
  23369. if (params->wpa_debug_file_path)
  23370. wpa_debug_open_file(params->wpa_debug_file_path);
  23371. --- a/hostapd/main.c
  23372. +++ b/hostapd/main.c
  23373. -@@ -511,6 +511,9 @@ static int hostapd_get_ctrl_iface_group(
  23374. - return 0;
  23375. +@@ -583,6 +583,11 @@ fail:
  23376. + return -1;
  23377. }
  23378. +void hostapd_wpa_event(void *ctx, enum wpa_event_type event,
  23379. + union wpa_event_data *data);
  23380. +
  23381. ++void hostapd_wpa_event_global(void *ctx, enum wpa_event_type event,
  23382. ++ union wpa_event_data *data);
  23383. #ifdef CONFIG_WPS
  23384. static int gen_uuid(const char *txt_addr)
  23385. -@@ -562,6 +565,7 @@ int main(int argc, char *argv[])
  23386. - interfaces.global_iface_name = NULL;
  23387. +@@ -660,6 +665,8 @@ int main(int argc, char *argv[])
  23388. interfaces.global_ctrl_sock = -1;
  23389. + dl_list_init(&interfaces.global_ctrl_dst);
  23390. + wpa_supplicant_event = hostapd_wpa_event;
  23391. ++ wpa_supplicant_event_global = hostapd_wpa_event_global;
  23392. for (;;) {
  23393. - c = getopt(argc, argv, "b:Bde:f:hKP:Ttu:vg:G:");
  23394. + c = getopt(argc, argv, "b:Bde:f:hi:KP:STtu:vg:G:");
  23395. if (c < 0)
  23396. --- a/src/drivers/drivers.c
  23397. +++ b/src/drivers/drivers.c
  23398. -@@ -10,6 +10,9 @@
  23399. +@@ -10,6 +10,11 @@
  23400. #include "utils/common.h"
  23401. #include "driver.h"
  23402. +void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event,
  23403. + union wpa_event_data *data);
  23404. ++void (*wpa_supplicant_event_global)(void *ctx, enum wpa_event_type event,
  23405. ++ union wpa_event_data *data);
  23406. +
  23407. #ifdef CONFIG_DRIVER_WEXT
  23408. extern struct wpa_driver_ops wpa_driver_wext_ops; /* driver_wext.c */
  23409. #endif /* CONFIG_DRIVER_WEXT */
  23410. --- a/wpa_supplicant/eapol_test.c
  23411. +++ b/wpa_supplicant/eapol_test.c
  23412. -@@ -28,8 +28,12 @@
  23413. +@@ -29,7 +29,12 @@
  23414. #include "ctrl_iface.h"
  23415. #include "pcsc_funcs.h"
  23416. #include "wpas_glue.h"
  23417. +#include "drivers/driver.h"
  23418. -
  23419. +void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event,
  23420. + union wpa_event_data *data);
  23421. -+
  23422. - struct wpa_driver_ops *wpa_drivers[] = { NULL };
  23423. ++void (*wpa_supplicant_event_global)(void *ctx, enum wpa_event_type event,
  23424. ++ union wpa_event_data *data);
  23425. + const struct wpa_driver_ops *const wpa_drivers[] = { NULL };
  23426. -@@ -1203,6 +1207,8 @@ static void usage(void)
  23427. +@@ -1295,6 +1300,10 @@ static void usage(void)
  23428. "option several times.\n");
  23429. }
  23430. +extern void supplicant_event(void *ctx, enum wpa_event_type event,
  23431. + union wpa_event_data *data);
  23432. ++extern void supplicant_event_global(void *ctx, enum wpa_event_type event,
  23433. ++ union wpa_event_data *data);
  23434. int main(int argc, char *argv[])
  23435. {
  23436. -@@ -1221,6 +1227,7 @@ int main(int argc, char *argv[])
  23437. +@@ -1315,6 +1324,8 @@ int main(int argc, char *argv[])
  23438. if (os_program_init())
  23439. return -1;
  23440. + wpa_supplicant_event = supplicant_event;
  23441. ++ wpa_supplicant_event_global = supplicant_event_global;
  23442. hostapd_logger_register_cb(hostapd_logger_cb);
  23443. os_memset(&eapol_test, 0, sizeof(eapol_test));
  23444. diff --git a/package/network/services/hostapd/patches/300-noscan.patch b/package/network/services/hostapd/patches/300-noscan.patch
  23445. index 57d8fe27bf681638237e0e8452ec7fbdebe6d036..21d631603b1f4e0af8dc11c3a249fc7d247021f3 100644
  23446. --- a/package/network/services/hostapd/patches/300-noscan.patch
  23447. +++ b/package/network/services/hostapd/patches/300-noscan.patch
  23448. @@ -1,6 +1,6 @@
  23449. --- a/hostapd/config_file.c
  23450. +++ b/hostapd/config_file.c
  23451. -@@ -2771,6 +2771,10 @@ static int hostapd_config_fill(struct ho
  23452. +@@ -2862,6 +2862,10 @@ static int hostapd_config_fill(struct ho
  23453. }
  23454. #endif /* CONFIG_IEEE80211W */
  23455. #ifdef CONFIG_IEEE80211N
  23456. @@ -13,7 +13,7 @@
  23457. } else if (os_strcmp(buf, "ht_capab") == 0) {
  23458. --- a/src/ap/ap_config.h
  23459. +++ b/src/ap/ap_config.h
  23460. -@@ -619,6 +619,8 @@ struct hostapd_config {
  23461. +@@ -655,6 +655,8 @@ struct hostapd_config {
  23462. int ht_op_mode_fixed;
  23463. u16 ht_capab;
  23464. @@ -21,21 +21,22 @@
  23465. + int no_ht_coex;
  23466. int ieee80211n;
  23467. int secondary_channel;
  23468. - int require_ht;
  23469. + int no_pri_sec_switch;
  23470. --- a/src/ap/hw_features.c
  23471. +++ b/src/ap/hw_features.c
  23472. -@@ -461,7 +461,7 @@ static int ieee80211n_check_40mhz(struct
  23473. - struct wpa_driver_scan_params params;
  23474. +@@ -474,7 +474,8 @@ static int ieee80211n_check_40mhz(struct
  23475. int ret;
  23476. -- if (!iface->conf->secondary_channel)
  23477. -+ if (!iface->conf->secondary_channel || iface->conf->noscan)
  23478. - return 0; /* HT40 not used */
  23479. + /* Check that HT40 is used and PRI / SEC switch is allowed */
  23480. +- if (!iface->conf->secondary_channel || iface->conf->no_pri_sec_switch)
  23481. ++ if (!iface->conf->secondary_channel || iface->conf->no_pri_sec_switch ||
  23482. ++ iface->conf->noscan)
  23483. + return 0;
  23484. hostapd_set_state(iface, HAPD_IFACE_HT_SCAN);
  23485. --- a/src/ap/ieee802_11_ht.c
  23486. +++ b/src/ap/ieee802_11_ht.c
  23487. -@@ -221,6 +221,9 @@ void hostapd_2040_coex_action(struct hos
  23488. +@@ -244,6 +244,9 @@ void hostapd_2040_coex_action(struct hos
  23489. if (!(iface->conf->ht_capab & HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET))
  23490. return;
  23491. @@ -45,7 +46,7 @@
  23492. if (len < IEEE80211_HDRLEN + 2 + sizeof(*bc_ie))
  23493. return;
  23494. -@@ -346,6 +349,9 @@ void ht40_intolerant_add(struct hostapd_
  23495. +@@ -368,6 +371,9 @@ void ht40_intolerant_add(struct hostapd_
  23496. if (iface->current_mode->mode != HOSTAPD_MODE_IEEE80211G)
  23497. return;
  23498. diff --git a/package/network/services/hostapd/patches/310-rescan_immediately.patch b/package/network/services/hostapd/patches/310-rescan_immediately.patch
  23499. index 7be8c32e3b17a183238177a5cb9601449382d224..3f46cc4ac1d2ea3a3450b1c70375bc7c37a1ec41 100644
  23500. --- a/package/network/services/hostapd/patches/310-rescan_immediately.patch
  23501. +++ b/package/network/services/hostapd/patches/310-rescan_immediately.patch
  23502. @@ -1,6 +1,6 @@
  23503. --- a/wpa_supplicant/wpa_supplicant.c
  23504. +++ b/wpa_supplicant/wpa_supplicant.c
  23505. -@@ -3249,7 +3249,7 @@ wpa_supplicant_alloc(struct wpa_supplica
  23506. +@@ -3556,7 +3556,7 @@ wpa_supplicant_alloc(struct wpa_supplica
  23507. if (wpa_s == NULL)
  23508. return NULL;
  23509. wpa_s->scan_req = INITIAL_SCAN_REQ;
  23510. @@ -8,4 +8,4 @@
  23511. + wpa_s->scan_interval = 1;
  23512. wpa_s->new_connection = 1;
  23513. wpa_s->parent = parent ? parent : wpa_s;
  23514. - wpa_s->sched_scanning = 0;
  23515. + wpa_s->p2pdev = wpa_s->parent;
  23516. diff --git a/package/network/services/hostapd/patches/320-optional_rfkill.patch b/package/network/services/hostapd/patches/320-optional_rfkill.patch
  23517. index 75b4b07f82115e226fd2f29f2ed19682ed1346f3..cf2a2c108b0c58597c4a10ccd9c7be242a6ae649 100644
  23518. --- a/package/network/services/hostapd/patches/320-optional_rfkill.patch
  23519. +++ b/package/network/services/hostapd/patches/320-optional_rfkill.patch
  23520. @@ -1,14 +1,14 @@
  23521. --- a/src/drivers/drivers.mak
  23522. +++ b/src/drivers/drivers.mak
  23523. -@@ -34,7 +34,6 @@ NEED_SME=y
  23524. +@@ -36,7 +36,6 @@ NEED_SME=y
  23525. NEED_AP_MLME=y
  23526. NEED_NETLINK=y
  23527. NEED_LINUX_IOCTL=y
  23528. -NEED_RFKILL=y
  23529. + NEED_RADIOTAP=y
  23530. ifdef CONFIG_LIBNL32
  23531. - DRV_LIBS += -lnl-3
  23532. -@@ -116,7 +115,6 @@ DRV_WPA_CFLAGS += -DCONFIG_DRIVER_WEXT
  23533. +@@ -123,7 +122,6 @@ DRV_WPA_CFLAGS += -DCONFIG_DRIVER_WEXT
  23534. CONFIG_WIRELESS_EXTENSION=y
  23535. NEED_NETLINK=y
  23536. NEED_LINUX_IOCTL=y
  23537. @@ -16,7 +16,7 @@
  23538. endif
  23539. ifdef CONFIG_DRIVER_NDIS
  23540. -@@ -142,7 +140,6 @@ endif
  23541. +@@ -149,7 +147,6 @@ endif
  23542. ifdef CONFIG_WIRELESS_EXTENSION
  23543. DRV_WPA_CFLAGS += -DCONFIG_WIRELESS_EXTENSION
  23544. DRV_WPA_OBJS += ../src/drivers/driver_wext.o
  23545. @@ -24,14 +24,14 @@
  23546. endif
  23547. ifdef NEED_NETLINK
  23548. -@@ -155,6 +152,7 @@ endif
  23549. +@@ -162,6 +159,7 @@ endif
  23550. ifdef NEED_RFKILL
  23551. DRV_OBJS += ../src/drivers/rfkill.o
  23552. +DRV_WPA_CFLAGS += -DCONFIG_RFKILL
  23553. endif
  23554. - ifdef CONFIG_VLAN_NETLINK
  23555. + ifdef NEED_RADIOTAP
  23556. --- a/src/drivers/rfkill.h
  23557. +++ b/src/drivers/rfkill.h
  23558. @@ -18,8 +18,24 @@ struct rfkill_config {
  23559. 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
  23560. index dd90877e90a2af68aa811e137fc7ccc89b01eff4..ca4601247b9c093a986e543d188726380301263e 100644
  23561. --- a/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch
  23562. +++ b/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch
  23563. @@ -1,6 +1,6 @@
  23564. --- a/src/drivers/driver_nl80211.c
  23565. +++ b/src/drivers/driver_nl80211.c
  23566. -@@ -3616,7 +3616,7 @@ static int nl80211_set_channel(struct i8
  23567. +@@ -3795,7 +3795,7 @@ static int nl80211_set_channel(struct i8
  23568. freq->freq, freq->ht_enabled, freq->vht_enabled,
  23569. freq->bandwidth, freq->center_freq1, freq->center_freq2);
  23570. diff --git a/package/network/services/hostapd/patches/340-reload_freq_change.patch b/package/network/services/hostapd/patches/340-reload_freq_change.patch
  23571. index 91b61964ddf618b245da12dfa11ade4747d66e56..086ade9cedec664ee566764f8f09bd2fd730ba53 100644
  23572. --- a/package/network/services/hostapd/patches/340-reload_freq_change.patch
  23573. +++ b/package/network/services/hostapd/patches/340-reload_freq_change.patch
  23574. @@ -1,6 +1,6 @@
  23575. --- a/src/ap/hostapd.c
  23576. +++ b/src/ap/hostapd.c
  23577. -@@ -76,6 +76,16 @@ static void hostapd_reload_bss(struct ho
  23578. +@@ -80,6 +80,16 @@ static void hostapd_reload_bss(struct ho
  23579. #endif /* CONFIG_NO_RADIUS */
  23580. ssid = &hapd->conf->ssid;
  23581. @@ -17,7 +17,7 @@
  23582. if (!ssid->wpa_psk_set && ssid->wpa_psk && !ssid->wpa_psk->next &&
  23583. ssid->wpa_passphrase_set && ssid->wpa_passphrase) {
  23584. /*
  23585. -@@ -175,21 +185,12 @@ int hostapd_reload_config(struct hostapd
  23586. +@@ -179,21 +189,12 @@ int hostapd_reload_config(struct hostapd
  23587. oldconf = hapd->iconf;
  23588. iface->conf = newconf;
  23589. 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
  23590. index a14fa03527525c03c07875db44fffdba557b0593..247f154e3059aaf25df321b496ff255b50b8ddf4 100644
  23591. --- a/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch
  23592. +++ b/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch
  23593. @@ -1,6 +1,6 @@
  23594. --- a/src/drivers/driver_nl80211.c
  23595. +++ b/src/drivers/driver_nl80211.c
  23596. -@@ -2254,13 +2254,18 @@ wpa_driver_nl80211_finish_drv_init(struc
  23597. +@@ -2394,13 +2394,18 @@ wpa_driver_nl80211_finish_drv_init(struc
  23598. }
  23599. @@ -22,7 +22,7 @@
  23600. return send_and_recv_msgs(drv, msg, NULL, NULL);
  23601. }
  23602. -@@ -2311,7 +2316,7 @@ static void wpa_driver_nl80211_deinit(st
  23603. +@@ -2452,7 +2457,7 @@ static void wpa_driver_nl80211_deinit(st
  23604. nl80211_remove_monitor_interface(drv);
  23605. if (is_ap_interface(drv->nlmode))
  23606. @@ -31,7 +31,7 @@
  23607. if (drv->eapol_sock >= 0) {
  23608. eloop_unregister_read_sock(drv->eapol_sock);
  23609. -@@ -4140,8 +4145,7 @@ static void nl80211_teardown_ap(struct i
  23610. +@@ -4385,8 +4390,7 @@ static void nl80211_teardown_ap(struct i
  23611. nl80211_remove_monitor_interface(drv);
  23612. else
  23613. nl80211_mgmt_unsubscribe(bss, "AP teardown");
  23614. @@ -41,7 +41,7 @@
  23615. }
  23616. -@@ -6066,8 +6070,6 @@ static int wpa_driver_nl80211_if_remove(
  23617. +@@ -6387,8 +6391,6 @@ static int wpa_driver_nl80211_if_remove(
  23618. } else {
  23619. wpa_printf(MSG_DEBUG, "nl80211: First BSS - reassign context");
  23620. nl80211_teardown_ap(bss);
  23621. @@ -50,7 +50,7 @@
  23622. nl80211_destroy_bss(bss);
  23623. if (!bss->added_if)
  23624. i802_set_iface_flags(bss, 0);
  23625. -@@ -6389,8 +6391,7 @@ static int wpa_driver_nl80211_deinit_ap(
  23626. +@@ -6750,8 +6752,7 @@ static int wpa_driver_nl80211_deinit_ap(
  23627. struct wpa_driver_nl80211_data *drv = bss->drv;
  23628. if (!is_ap_interface(drv->nlmode))
  23629. return -1;
  23630. @@ -60,7 +60,7 @@
  23631. /*
  23632. * If the P2P GO interface was dynamically added, then it is
  23633. -@@ -6409,8 +6410,7 @@ static int wpa_driver_nl80211_stop_ap(vo
  23634. +@@ -6770,8 +6771,7 @@ static int wpa_driver_nl80211_stop_ap(vo
  23635. struct wpa_driver_nl80211_data *drv = bss->drv;
  23636. if (!is_ap_interface(drv->nlmode))
  23637. return -1;
  23638. diff --git a/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch b/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch
  23639. index 06b005ea3ac8e3a43d610c2719b4d53a6ceacd73..1e405cbf0edcda8604080f9c00f0eeb35c106218 100644
  23640. --- a/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch
  23641. +++ b/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch
  23642. @@ -1,22 +1,22 @@
  23643. --- a/hostapd/ctrl_iface.c
  23644. +++ b/hostapd/ctrl_iface.c
  23645. -@@ -45,6 +45,7 @@
  23646. - #include "wps/wps.h"
  23647. +@@ -54,6 +54,7 @@
  23648. + #include "fst/fst_ctrl_iface.h"
  23649. #include "config_file.h"
  23650. #include "ctrl_iface.h"
  23651. +#include "config_file.h"
  23652. - struct wpa_ctrl_dst {
  23653. -@@ -55,6 +56,7 @@ struct wpa_ctrl_dst {
  23654. - int errors;
  23655. - };
  23656. + #define HOSTAPD_CLI_DUP_VALUE_MAX_LEN 256
  23657. +@@ -72,6 +73,7 @@ static void hostapd_ctrl_iface_send(stru
  23658. + enum wpa_msg_type type,
  23659. + const char *buf, size_t len);
  23660. +static char *reload_opts = NULL;
  23661. - static void hostapd_ctrl_iface_send(struct hostapd_data *hapd, int level,
  23662. - const char *buf, size_t len);
  23663. -@@ -164,6 +166,61 @@ static int hostapd_ctrl_iface_new_sta(st
  23664. + static int hostapd_ctrl_iface_attach(struct hostapd_data *hapd,
  23665. + struct sockaddr_storage *from,
  23666. +@@ -123,6 +125,61 @@ static int hostapd_ctrl_iface_new_sta(st
  23667. return 0;
  23668. }
  23669. @@ -78,7 +78,7 @@
  23670. #ifdef CONFIG_IEEE80211W
  23671. #ifdef NEED_AP_MLME
  23672. -@@ -2086,6 +2143,8 @@ static void hostapd_ctrl_iface_receive(i
  23673. +@@ -2483,6 +2540,8 @@ static int hostapd_ctrl_iface_receive_pr
  23674. } else if (os_strncmp(buf, "VENDOR ", 7) == 0) {
  23675. reply_len = hostapd_ctrl_iface_vendor(hapd, buf + 7, reply,
  23676. reply_size);
  23677. @@ -89,7 +89,7 @@
  23678. #ifdef RADIUS_SERVER
  23679. --- a/src/ap/ctrl_iface_ap.c
  23680. +++ b/src/ap/ctrl_iface_ap.c
  23681. -@@ -541,5 +541,11 @@ int hostapd_parse_csa_settings(const cha
  23682. +@@ -593,7 +593,13 @@ int hostapd_parse_csa_settings(const cha
  23683. int hostapd_ctrl_iface_stop_ap(struct hostapd_data *hapd)
  23684. {
  23685. @@ -102,3 +102,5 @@
  23686. +
  23687. + return 0;
  23688. }
  23689. +
  23690. +
  23691. diff --git a/package/network/services/hostapd/patches/370-ap_sta_support.patch b/package/network/services/hostapd/patches/370-ap_sta_support.patch
  23692. index ea235e67780366b28dd8e811367d7cb45f2397de..a77d4c92e6d7fa7711338c82aba27b7e44248afe 100644
  23693. --- a/package/network/services/hostapd/patches/370-ap_sta_support.patch
  23694. +++ b/package/network/services/hostapd/patches/370-ap_sta_support.patch
  23695. @@ -1,6 +1,6 @@
  23696. --- a/wpa_supplicant/wpa_supplicant_i.h
  23697. +++ b/wpa_supplicant/wpa_supplicant_i.h
  23698. -@@ -110,6 +110,11 @@ struct wpa_interface {
  23699. +@@ -100,6 +100,11 @@ struct wpa_interface {
  23700. const char *ifname;
  23701. /**
  23702. @@ -12,8 +12,8 @@
  23703. * bridge_ifname - Optional bridge interface name
  23704. *
  23705. * If the driver interface (ifname) is included in a Linux bridge
  23706. -@@ -442,6 +447,8 @@ struct wpa_supplicant {
  23707. - #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
  23708. +@@ -484,6 +489,8 @@ struct wpa_supplicant {
  23709. + #endif /* CONFIG_CTRL_IFACE_BINDER */
  23710. char bridge_ifname[16];
  23711. + struct wpa_ctrl *hostapd;
  23712. @@ -23,7 +23,7 @@
  23713. --- a/wpa_supplicant/Makefile
  23714. +++ b/wpa_supplicant/Makefile
  23715. -@@ -14,6 +14,10 @@ CFLAGS += $(EXTRA_CFLAGS)
  23716. +@@ -26,6 +26,10 @@ CFLAGS += $(EXTRA_CFLAGS)
  23717. CFLAGS += -I$(abspath ../src)
  23718. CFLAGS += -I$(abspath ../src/utils)
  23719. @@ -34,7 +34,7 @@
  23720. -include .config
  23721. -include $(if $(MULTICALL),../hostapd/.config)
  23722. -@@ -84,6 +88,8 @@ OBJS_c += ../src/utils/wpa_debug.o
  23723. +@@ -113,6 +117,8 @@ OBJS_c += ../src/utils/wpa_debug.o
  23724. OBJS_c += ../src/utils/common.o
  23725. OBJS += wmm_ac.o
  23726. @@ -45,7 +45,7 @@
  23727. CONFIG_OS=win32
  23728. --- a/wpa_supplicant/wpa_supplicant.c
  23729. +++ b/wpa_supplicant/wpa_supplicant.c
  23730. -@@ -107,6 +107,55 @@ const char *wpa_supplicant_full_license5
  23731. +@@ -112,6 +112,55 @@ const char *const wpa_supplicant_full_li
  23732. "\n";
  23733. #endif /* CONFIG_NO_STDOUT_DEBUG */
  23734. @@ -73,7 +73,7 @@
  23735. + int ret;
  23736. +
  23737. + if (!bss)
  23738. -+ return;
  23739. ++ return -1;
  23740. +
  23741. + if (bss->ht_param & HT_INFO_HT_PARAM_STA_CHNL_WIDTH) {
  23742. + int sec = bss->ht_param & HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK;
  23743. @@ -101,7 +101,7 @@
  23744. /* Configure default/group WEP keys for static WEP */
  23745. int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
  23746. {
  23747. -@@ -743,8 +792,12 @@ void wpa_supplicant_set_state(struct wpa
  23748. +@@ -812,8 +861,12 @@ void wpa_supplicant_set_state(struct wpa
  23749. wpas_p2p_completed(wpa_s);
  23750. sme_sched_obss_scan(wpa_s, 1);
  23751. @@ -114,7 +114,7 @@
  23752. wpa_s->new_connection = 1;
  23753. wpa_drv_set_operstate(wpa_s, 0);
  23754. #ifndef IEEE8021X_EAPOL
  23755. -@@ -4038,6 +4091,20 @@ static int wpa_supplicant_init_iface(str
  23756. +@@ -4646,6 +4699,20 @@ static int wpa_supplicant_init_iface(str
  23757. sizeof(wpa_s->bridge_ifname));
  23758. }
  23759. @@ -135,7 +135,7 @@
  23760. /* RSNA Supplicant Key Management - INITIALIZE */
  23761. eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE);
  23762. eapol_sm_notify_portValid(wpa_s->eapol, FALSE);
  23763. -@@ -4280,6 +4347,11 @@ static void wpa_supplicant_deinit_iface(
  23764. +@@ -4937,6 +5004,11 @@ static void wpa_supplicant_deinit_iface(
  23765. if (terminate)
  23766. wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_TERMINATING);
  23767. @@ -157,7 +157,7 @@
  23768. #include "drivers/driver.h"
  23769. #include "wpa_supplicant_i.h"
  23770. #include "config.h"
  23771. -@@ -277,6 +278,10 @@ static void calculate_update_time(const
  23772. +@@ -287,6 +288,10 @@ static void calculate_update_time(const
  23773. static void wpa_bss_copy_res(struct wpa_bss *dst, struct wpa_scan_res *src,
  23774. struct os_reltime *fetch_time)
  23775. {
  23776. @@ -168,7 +168,7 @@
  23777. dst->flags = src->flags;
  23778. os_memcpy(dst->bssid, src->bssid, ETH_ALEN);
  23779. dst->freq = src->freq;
  23780. -@@ -289,6 +294,15 @@ static void wpa_bss_copy_res(struct wpa_
  23781. +@@ -299,6 +304,15 @@ static void wpa_bss_copy_res(struct wpa_
  23782. dst->est_throughput = src->est_throughput;
  23783. dst->snr = src->snr;
  23784. @@ -186,7 +186,7 @@
  23785. --- a/wpa_supplicant/main.c
  23786. +++ b/wpa_supplicant/main.c
  23787. -@@ -33,7 +33,7 @@ static void usage(void)
  23788. +@@ -34,7 +34,7 @@ static void usage(void)
  23789. "vW] [-P<pid file>] "
  23790. "[-g<global ctrl>] \\\n"
  23791. " [-G<group>] \\\n"
  23792. @@ -195,24 +195,24 @@
  23793. "[-p<driver_param>] \\\n"
  23794. " [-b<br_ifname>] [-e<entropy file>]"
  23795. #ifdef CONFIG_DEBUG_FILE
  23796. -@@ -84,6 +84,7 @@ static void usage(void)
  23797. - #endif /* CONFIG_DEBUG_LINUX_TRACING */
  23798. - printf(" -t = include timestamp in debug messages\n"
  23799. +@@ -74,6 +74,7 @@ static void usage(void)
  23800. + " -g = global ctrl_interface\n"
  23801. + " -G = global ctrl_interface group\n"
  23802. " -h = show this help text\n"
  23803. -+ " -H = connect to a hostapd instance to manage state changes\n"
  23804. - " -L = show license (BSD)\n"
  23805. - " -o = override driver parameter for new interfaces\n"
  23806. - " -O = override ctrl_interface parameter for new interfaces\n"
  23807. -@@ -175,7 +176,7 @@ int main(int argc, char *argv[])
  23808. ++ " -H = connect to a hostapd instance to manage state changes\n"
  23809. + " -i = interface name\n"
  23810. + " -I = additional configuration file\n"
  23811. + " -K = include keys (passwords, etc.) in debug output\n"
  23812. +@@ -201,7 +202,7 @@ int main(int argc, char *argv[])
  23813. for (;;) {
  23814. c = getopt(argc, argv,
  23815. -- "b:Bc:C:D:de:f:g:G:hi:I:KLm:No:O:p:P:qsTtuvW");
  23816. -+ "b:Bc:C:D:de:f:g:G:hH:i:I:KLm:No:O:p:P:qsTtuvW");
  23817. +- "b:Bc:C:D:de:f:g:G:hi:I:KLMm:No:O:p:P:qsTtuvW");
  23818. ++ "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuvW");
  23819. if (c < 0)
  23820. break;
  23821. switch (c) {
  23822. -@@ -222,6 +223,9 @@ int main(int argc, char *argv[])
  23823. +@@ -248,6 +249,9 @@ int main(int argc, char *argv[])
  23824. usage();
  23825. exitcode = 0;
  23826. goto out;
  23827. @@ -224,11 +224,11 @@
  23828. break;
  23829. --- a/wpa_supplicant/bss.h
  23830. +++ b/wpa_supplicant/bss.h
  23831. -@@ -72,6 +72,10 @@ struct wpa_bss {
  23832. - u8 ssid[32];
  23833. +@@ -79,6 +79,10 @@ struct wpa_bss {
  23834. + u8 ssid[SSID_MAX_LEN];
  23835. /** Length of SSID */
  23836. size_t ssid_len;
  23837. -+ /** HT caapbilities */
  23838. ++ /** HT capabilities */
  23839. + u16 ht_capab;
  23840. + /* Five octets of HT Operation Information */
  23841. + u8 ht_param;
  23842. 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
  23843. index 3a41b8219ea83136b76ad59b0bf79b566d1e7b35..9e815e96a13b2978f4a75e0131e420150dbc7d00 100644
  23844. --- a/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch
  23845. +++ b/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch
  23846. @@ -1,18 +1,18 @@
  23847. --- a/hostapd/Makefile
  23848. +++ b/hostapd/Makefile
  23849. -@@ -168,6 +168,9 @@ endif
  23850. +@@ -212,6 +212,9 @@ endif
  23851. ifdef CONFIG_NO_CTRL_IFACE
  23852. CFLAGS += -DCONFIG_NO_CTRL_IFACE
  23853. else
  23854. +ifdef CONFIG_CTRL_IFACE_MIB
  23855. +CFLAGS += -DCONFIG_CTRL_IFACE_MIB
  23856. +endif
  23857. - OBJS += ctrl_iface.o
  23858. - OBJS += ../src/ap/ctrl_iface_ap.o
  23859. - endif
  23860. + ifeq ($(CONFIG_CTRL_IFACE), udp)
  23861. + CFLAGS += -DCONFIG_CTRL_IFACE_UDP
  23862. + else
  23863. --- a/hostapd/ctrl_iface.c
  23864. +++ b/hostapd/ctrl_iface.c
  23865. -@@ -1953,6 +1953,7 @@ static void hostapd_ctrl_iface_receive(i
  23866. +@@ -2342,6 +2342,7 @@ static int hostapd_ctrl_iface_receive_pr
  23867. reply_size);
  23868. } else if (os_strcmp(buf, "STATUS-DRIVER") == 0) {
  23869. reply_len = hostapd_drv_status(hapd, reply, reply_size);
  23870. @@ -20,18 +20,18 @@
  23871. } else if (os_strcmp(buf, "MIB") == 0) {
  23872. reply_len = ieee802_11_get_mib(hapd, reply, reply_size);
  23873. if (reply_len >= 0) {
  23874. -@@ -1994,6 +1995,7 @@ static void hostapd_ctrl_iface_receive(i
  23875. +@@ -2383,6 +2384,7 @@ static int hostapd_ctrl_iface_receive_pr
  23876. } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) {
  23877. reply_len = hostapd_ctrl_iface_sta_next(hapd, buf + 9, reply,
  23878. reply_size);
  23879. +#endif
  23880. } else if (os_strcmp(buf, "ATTACH") == 0) {
  23881. - if (hostapd_ctrl_iface_attach(hapd, &from, fromlen))
  23882. + if (hostapd_ctrl_iface_attach(hapd, from, fromlen))
  23883. reply_len = -1;
  23884. --- a/wpa_supplicant/Makefile
  23885. +++ b/wpa_supplicant/Makefile
  23886. -@@ -837,6 +837,9 @@ ifdef CONFIG_WNM
  23887. - OBJS += ../src/ap/wnm_ap.o
  23888. +@@ -874,6 +874,9 @@ ifdef CONFIG_MBO
  23889. + OBJS += ../src/ap/mbo_ap.o
  23890. endif
  23891. ifdef CONFIG_CTRL_IFACE
  23892. +ifdef CONFIG_CTRL_IFACE_MIB
  23893. @@ -42,7 +42,7 @@
  23894. --- a/wpa_supplicant/ctrl_iface.c
  23895. +++ b/wpa_supplicant/ctrl_iface.c
  23896. -@@ -1795,7 +1795,7 @@ static int wpa_supplicant_ctrl_iface_sta
  23897. +@@ -1895,7 +1895,7 @@ static int wpa_supplicant_ctrl_iface_sta
  23898. pos += ret;
  23899. }
  23900. @@ -51,7 +51,7 @@
  23901. if (wpa_s->ap_iface) {
  23902. pos += ap_ctrl_iface_wpa_get_status(wpa_s, pos,
  23903. end - pos,
  23904. -@@ -7896,6 +7896,7 @@ char * wpa_supplicant_ctrl_iface_process
  23905. +@@ -8687,6 +8687,7 @@ char * wpa_supplicant_ctrl_iface_process
  23906. reply_len = -1;
  23907. } else if (os_strncmp(buf, "NOTE ", 5) == 0) {
  23908. wpa_printf(MSG_INFO, "NOTE: %s", buf + 5);
  23909. @@ -59,7 +59,7 @@
  23910. } else if (os_strcmp(buf, "MIB") == 0) {
  23911. reply_len = wpa_sm_get_mib(wpa_s->wpa, reply, reply_size);
  23912. if (reply_len >= 0) {
  23913. -@@ -7903,6 +7904,7 @@ char * wpa_supplicant_ctrl_iface_process
  23914. +@@ -8694,6 +8695,7 @@ char * wpa_supplicant_ctrl_iface_process
  23915. reply + reply_len,
  23916. reply_size - reply_len);
  23917. }
  23918. @@ -67,7 +67,7 @@
  23919. } else if (os_strncmp(buf, "STATUS", 6) == 0) {
  23920. reply_len = wpa_supplicant_ctrl_iface_status(
  23921. wpa_s, buf + 6, reply, reply_size);
  23922. -@@ -8353,6 +8355,7 @@ char * wpa_supplicant_ctrl_iface_process
  23923. +@@ -9164,6 +9166,7 @@ char * wpa_supplicant_ctrl_iface_process
  23924. reply_len = wpa_supplicant_ctrl_iface_bss(
  23925. wpa_s, buf + 4, reply, reply_size);
  23926. #ifdef CONFIG_AP
  23927. @@ -75,7 +75,7 @@
  23928. } else if (os_strcmp(buf, "STA-FIRST") == 0) {
  23929. reply_len = ap_ctrl_iface_sta_first(wpa_s, reply, reply_size);
  23930. } else if (os_strncmp(buf, "STA ", 4) == 0) {
  23931. -@@ -8361,12 +8364,15 @@ char * wpa_supplicant_ctrl_iface_process
  23932. +@@ -9172,12 +9175,15 @@ char * wpa_supplicant_ctrl_iface_process
  23933. } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) {
  23934. reply_len = ap_ctrl_iface_sta_next(wpa_s, buf + 9, reply,
  23935. reply_size);
  23936. @@ -93,15 +93,15 @@
  23937. reply_len = -1;
  23938. --- a/src/ap/ctrl_iface_ap.c
  23939. +++ b/src/ap/ctrl_iface_ap.c
  23940. -@@ -22,6 +22,7 @@
  23941. - #include "ctrl_iface_ap.h"
  23942. +@@ -24,6 +24,7 @@
  23943. #include "ap_drv_ops.h"
  23944. + #include "mbo_ap.h"
  23945. +#ifdef CONFIG_CTRL_IFACE_MIB
  23946. static int hostapd_get_sta_tx_rx(struct hostapd_data *hapd,
  23947. struct sta_info *sta,
  23948. -@@ -224,6 +225,7 @@ int hostapd_ctrl_iface_sta_next(struct h
  23949. +@@ -249,6 +250,7 @@ int hostapd_ctrl_iface_sta_next(struct h
  23950. return hostapd_ctrl_iface_sta_mib(hapd, sta->next, buf, buflen);
  23951. }
  23952. @@ -111,33 +111,33 @@
  23953. static int p2p_manager_disconnect(struct hostapd_data *hapd, u16 stype,
  23954. --- a/src/ap/ieee802_1x.c
  23955. +++ b/src/ap/ieee802_1x.c
  23956. -@@ -2337,6 +2337,7 @@ static const char * bool_txt(Boolean boo
  23957. - return bool_val ? "TRUE" : "FALSE";
  23958. +@@ -2441,6 +2441,7 @@ static const char * bool_txt(Boolean val
  23959. + return val ? "TRUE" : "FALSE";
  23960. }
  23961. +#ifdef CONFIG_CTRL_IFACE_MIB
  23962. int ieee802_1x_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen)
  23963. {
  23964. -@@ -2512,6 +2513,7 @@ int ieee802_1x_get_mib_sta(struct hostap
  23965. +@@ -2616,6 +2617,7 @@ int ieee802_1x_get_mib_sta(struct hostap
  23966. return len;
  23967. }
  23968. +#endif
  23969. - static void ieee802_1x_finished(struct hostapd_data *hapd,
  23970. - struct sta_info *sta, int success,
  23971. + #ifdef CONFIG_HS20
  23972. + static void ieee802_1x_wnm_notif_send(void *eloop_ctx, void *timeout_ctx)
  23973. --- a/src/ap/wpa_auth.c
  23974. +++ b/src/ap/wpa_auth.c
  23975. -@@ -2999,6 +2999,7 @@ static const char * wpa_bool_txt(int boo
  23976. - return bool ? "TRUE" : "FALSE";
  23977. +@@ -3069,6 +3069,7 @@ static const char * wpa_bool_txt(int val
  23978. + return val ? "TRUE" : "FALSE";
  23979. }
  23980. +#ifdef CONFIG_CTRL_IFACE_MIB
  23981. #define RSN_SUITE "%02x-%02x-%02x-%d"
  23982. #define RSN_SUITE_ARG(s) \
  23983. -@@ -3143,7 +3144,7 @@ int wpa_get_mib_sta(struct wpa_state_mac
  23984. +@@ -3213,7 +3214,7 @@ int wpa_get_mib_sta(struct wpa_state_mac
  23985. return len;
  23986. }
  23987. @@ -148,7 +148,7 @@
  23988. {
  23989. --- a/src/rsn_supp/wpa.c
  23990. +++ b/src/rsn_supp/wpa.c
  23991. -@@ -2032,6 +2032,8 @@ static u32 wpa_key_mgmt_suite(struct wpa
  23992. +@@ -2108,6 +2108,8 @@ static u32 wpa_key_mgmt_suite(struct wpa
  23993. }
  23994. @@ -157,7 +157,7 @@
  23995. #define RSN_SUITE "%02x-%02x-%02x-%d"
  23996. #define RSN_SUITE_ARG(s) \
  23997. ((s) >> 24) & 0xff, ((s) >> 16) & 0xff, ((s) >> 8) & 0xff, (s) & 0xff
  23998. -@@ -2115,6 +2117,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch
  23999. +@@ -2191,6 +2193,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch
  24000. return (int) len;
  24001. }
  24002. @@ -167,7 +167,7 @@
  24003. --- a/wpa_supplicant/ap.c
  24004. +++ b/wpa_supplicant/ap.c
  24005. -@@ -1015,7 +1015,7 @@ int wpas_ap_wps_nfc_report_handover(stru
  24006. +@@ -1114,7 +1114,7 @@ int wpas_ap_wps_nfc_report_handover(stru
  24007. #endif /* CONFIG_WPS */
  24008. 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
  24009. index 1065a7f125bd0dce8fbd5090afc71f73d2295f16..c9e7bf4209fcde62dd965cd12754e6876067ed01 100644
  24010. --- a/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch
  24011. +++ b/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch
  24012. @@ -1,6 +1,6 @@
  24013. --- a/src/common/wpa_common.c
  24014. +++ b/src/common/wpa_common.c
  24015. -@@ -1228,6 +1228,31 @@ u32 wpa_akm_to_suite(int akm)
  24016. +@@ -1244,6 +1244,31 @@ u32 wpa_akm_to_suite(int akm)
  24017. }
  24018. @@ -32,7 +32,7 @@
  24019. int wpa_compare_rsn_ie(int ft_initial_assoc,
  24020. const u8 *ie1, size_t ie1len,
  24021. const u8 *ie2, size_t ie2len)
  24022. -@@ -1235,8 +1260,19 @@ int wpa_compare_rsn_ie(int ft_initial_as
  24023. +@@ -1251,8 +1276,19 @@ int wpa_compare_rsn_ie(int ft_initial_as
  24024. if (ie1 == NULL || ie2 == NULL)
  24025. return -1;
  24026. 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
  24027. index 083af5b4508e968af5628ad959283dcef24ba41a..f5872cd5979e48aa0f918635af0852f2c1acb027 100644
  24028. --- a/package/network/services/hostapd/patches/400-wps_single_auth_enc_type.patch
  24029. +++ b/package/network/services/hostapd/patches/400-wps_single_auth_enc_type.patch
  24030. @@ -1,25 +1,22 @@
  24031. --- a/src/ap/wps_hostapd.c
  24032. +++ b/src/ap/wps_hostapd.c
  24033. -@@ -1052,11 +1052,9 @@ int hostapd_init_wps(struct hostapd_data
  24034. -
  24035. - if (conf->rsn_pairwise & (WPA_CIPHER_CCMP | WPA_CIPHER_GCMP))
  24036. +@@ -352,8 +352,7 @@ static int hapd_wps_reconfig_in_memory(s
  24037. + bss->wpa_pairwise |= WPA_CIPHER_GCMP;
  24038. + else
  24039. + bss->wpa_pairwise |= WPA_CIPHER_CCMP;
  24040. +- }
  24041. +- if (cred->encr_type & WPS_ENCR_TKIP)
  24042. ++ } else if (cred->encr_type & WPS_ENCR_TKIP)
  24043. + bss->wpa_pairwise |= WPA_CIPHER_TKIP;
  24044. + bss->rsn_pairwise = bss->wpa_pairwise;
  24045. + bss->wpa_group = wpa_select_ap_group_cipher(bss->wpa,
  24046. +@@ -1073,8 +1072,7 @@ int hostapd_init_wps(struct hostapd_data
  24047. + if (conf->rsn_pairwise & (WPA_CIPHER_CCMP | WPA_CIPHER_GCMP)) {
  24048. wps->encr_types |= WPS_ENCR_AES;
  24049. -- if (conf->rsn_pairwise & WPA_CIPHER_TKIP)
  24050. -+ else if (conf->rsn_pairwise & WPA_CIPHER_TKIP)
  24051. + wps->encr_types_rsn |= WPS_ENCR_AES;
  24052. +- }
  24053. +- if (conf->rsn_pairwise & WPA_CIPHER_TKIP) {
  24054. ++ } else if (conf->rsn_pairwise & WPA_CIPHER_TKIP) {
  24055. wps->encr_types |= WPS_ENCR_TKIP;
  24056. -- }
  24057. --
  24058. -- if (conf->wpa & WPA_PROTO_WPA) {
  24059. -+ } else if (conf->wpa & WPA_PROTO_WPA) {
  24060. - if (conf->wpa_key_mgmt & WPA_KEY_MGMT_PSK)
  24061. - wps->auth_types |= WPS_AUTH_WPAPSK;
  24062. - if (conf->wpa_key_mgmt & WPA_KEY_MGMT_IEEE8021X)
  24063. -@@ -1064,7 +1062,7 @@ int hostapd_init_wps(struct hostapd_data
  24064. -
  24065. - if (conf->wpa_pairwise & WPA_CIPHER_CCMP)
  24066. - wps->encr_types |= WPS_ENCR_AES;
  24067. -- if (conf->wpa_pairwise & WPA_CIPHER_TKIP)
  24068. -+ else if (conf->wpa_pairwise & WPA_CIPHER_TKIP)
  24069. - wps->encr_types |= WPS_ENCR_TKIP;
  24070. - }
  24071. -
  24072. + wps->encr_types_rsn |= WPS_ENCR_TKIP;
  24073. + }
  24074. diff --git a/package/network/services/hostapd/patches/410-limit_debug_messages.patch b/package/network/services/hostapd/patches/410-limit_debug_messages.patch
  24075. index da887321c6e96fb42f58e613c77f6501279df2b6..a48b6962ee3e420f4abc79e772b9bcb049559dee 100644
  24076. --- a/package/network/services/hostapd/patches/410-limit_debug_messages.patch
  24077. +++ b/package/network/services/hostapd/patches/410-limit_debug_messages.patch
  24078. @@ -64,7 +64,7 @@
  24079. #ifdef CONFIG_DEBUG_FILE
  24080. static char *last_path = NULL;
  24081. #endif /* CONFIG_DEBUG_FILE */
  24082. -@@ -602,7 +576,7 @@ void wpa_msg_register_ifname_cb(wpa_msg_
  24083. +@@ -604,7 +578,7 @@ void wpa_msg_register_ifname_cb(wpa_msg_
  24084. }
  24085. @@ -73,7 +73,7 @@
  24086. {
  24087. va_list ap;
  24088. char *buf;
  24089. -@@ -640,7 +614,7 @@ void wpa_msg(void *ctx, int level, const
  24090. +@@ -642,7 +616,7 @@ void wpa_msg(void *ctx, int level, const
  24091. }
  24092. @@ -183,7 +183,7 @@
  24093. /*
  24094. * wpa_dbg() behaves like wpa_msg(), but it can be removed from build to reduce
  24095. -@@ -181,7 +222,12 @@ void wpa_hexdump_ascii_key(int level, co
  24096. +@@ -182,7 +223,12 @@ void wpa_hexdump_ascii_key(int level, co
  24097. *
  24098. * Note: New line '\n' is added to the end of the text when printing to stdout.
  24099. */
  24100. @@ -197,7 +197,7 @@
  24101. /**
  24102. * wpa_msg_ctrl - Conditional printf for ctrl_iface monitors
  24103. -@@ -195,8 +241,13 @@ void wpa_msg(void *ctx, int level, const
  24104. +@@ -196,8 +242,13 @@ void wpa_msg(void *ctx, int level, const
  24105. * attached ctrl_iface monitors. In other words, it can be used for frequent
  24106. * events that do not need to be sent to syslog.
  24107. */
  24108. diff --git a/package/network/services/hostapd/patches/420-indicate-features.patch b/package/network/services/hostapd/patches/420-indicate-features.patch
  24109. index 64c92df6bb58d07fb7f1d004b4ddc371e212291d..335e71eb519851305f813b4aa95ca5239b7e46f9 100644
  24110. --- a/package/network/services/hostapd/patches/420-indicate-features.patch
  24111. +++ b/package/network/services/hostapd/patches/420-indicate-features.patch
  24112. @@ -8,16 +8,16 @@
  24113. #include "crypto/random.h"
  24114. #include "crypto/tls.h"
  24115. #include "common/version.h"
  24116. -@@ -567,7 +568,7 @@ int main(int argc, char *argv[])
  24117. -
  24118. +@@ -668,7 +669,7 @@ int main(int argc, char *argv[])
  24119. wpa_supplicant_event = hostapd_wpa_event;
  24120. + wpa_supplicant_event_global = hostapd_wpa_event_global;
  24121. for (;;) {
  24122. -- c = getopt(argc, argv, "b:Bde:f:hKP:Ttu:vg:G:");
  24123. -+ c = getopt(argc, argv, "b:Bde:f:hKP:Ttu:g:G:v::");
  24124. +- c = getopt(argc, argv, "b:Bde:f:hi:KP:STtu:vg:G:");
  24125. ++ c = getopt(argc, argv, "b:Bde:f:hi:KP:STtu:g:G:v::");
  24126. if (c < 0)
  24127. break;
  24128. switch (c) {
  24129. -@@ -604,6 +605,8 @@ int main(int argc, char *argv[])
  24130. +@@ -705,6 +706,8 @@ int main(int argc, char *argv[])
  24131. break;
  24132. #endif /* CONFIG_DEBUG_LINUX_TRACING */
  24133. case 'v':
  24134. @@ -33,19 +33,19 @@
  24135. #include "common.h"
  24136. +#include "build_features.h"
  24137. + #include "fst/fst.h"
  24138. #include "wpa_supplicant_i.h"
  24139. #include "driver_i.h"
  24140. - #include "p2p_supplicant.h"
  24141. -@@ -176,7 +177,7 @@ int main(int argc, char *argv[])
  24142. +@@ -202,7 +203,7 @@ int main(int argc, char *argv[])
  24143. for (;;) {
  24144. c = getopt(argc, argv,
  24145. -- "b:Bc:C:D:de:f:g:G:hH:i:I:KLm:No:O:p:P:qsTtuvW");
  24146. -+ "b:Bc:C:D:de:f:g:G:hH:i:I:KLm:No:O:p:P:qsTtuv::W");
  24147. +- "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuvW");
  24148. ++ "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuv::W");
  24149. if (c < 0)
  24150. break;
  24151. switch (c) {
  24152. -@@ -279,8 +280,12 @@ int main(int argc, char *argv[])
  24153. +@@ -305,8 +306,12 @@ int main(int argc, char *argv[])
  24154. break;
  24155. #endif /* CONFIG_DBUS */
  24156. case 'v':
  24157. diff --git a/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch b/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch
  24158. index 85d2e1603bfb56eb8f9b62c8ea602020c3170883..d07b747c3d299dd1561251fcfd5a89a41214edb5 100644
  24159. --- a/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch
  24160. +++ b/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch
  24161. @@ -1,6 +1,6 @@
  24162. --- a/hostapd/hostapd_cli.c
  24163. +++ b/hostapd/hostapd_cli.c
  24164. -@@ -67,7 +67,6 @@ static const char *commands_help =
  24165. +@@ -69,7 +69,6 @@ static const char *const commands_help =
  24166. #ifdef CONFIG_IEEE80211W
  24167. " sa_query <addr> send SA Query to a station\n"
  24168. #endif /* CONFIG_IEEE80211W */
  24169. @@ -8,7 +8,7 @@
  24170. " wps_pin <uuid> <pin> [timeout] [addr] add WPS Enrollee PIN\n"
  24171. " wps_check_pin <PIN> verify PIN checksum\n"
  24172. " wps_pbc indicate button pushed to initiate PBC\n"
  24173. -@@ -80,7 +79,6 @@ static const char *commands_help =
  24174. +@@ -82,7 +81,6 @@ static const char *const commands_help =
  24175. " wps_ap_pin <cmd> [params..] enable/disable AP PIN\n"
  24176. " wps_config <SSID> <auth> <encr> <key> configure AP\n"
  24177. " wps_get_status show current WPS status\n"
  24178. @@ -16,7 +16,7 @@
  24179. " get_config show current configuration\n"
  24180. " help show this usage help\n"
  24181. " interface [ifname] show interfaces/select interface\n"
  24182. -@@ -353,7 +351,6 @@ static int hostapd_cli_cmd_sa_query(stru
  24183. +@@ -418,7 +416,6 @@ static int hostapd_cli_cmd_sa_query(stru
  24184. #endif /* CONFIG_IEEE80211W */
  24185. @@ -24,7 +24,7 @@
  24186. static int hostapd_cli_cmd_wps_pin(struct wpa_ctrl *ctrl, int argc,
  24187. char *argv[])
  24188. {
  24189. -@@ -579,7 +576,6 @@ static int hostapd_cli_cmd_wps_config(st
  24190. +@@ -644,7 +641,6 @@ static int hostapd_cli_cmd_wps_config(st
  24191. ssid_hex, argv[1]);
  24192. return wpa_ctrl_command(ctrl, buf);
  24193. }
  24194. @@ -32,7 +32,7 @@
  24195. static int hostapd_cli_cmd_disassoc_imminent(struct wpa_ctrl *ctrl, int argc,
  24196. -@@ -1027,7 +1023,6 @@ static struct hostapd_cli_cmd hostapd_cl
  24197. +@@ -1236,7 +1232,6 @@ static const struct hostapd_cli_cmd host
  24198. #ifdef CONFIG_IEEE80211W
  24199. { "sa_query", hostapd_cli_cmd_sa_query },
  24200. #endif /* CONFIG_IEEE80211W */
  24201. @@ -40,7 +40,7 @@
  24202. { "wps_pin", hostapd_cli_cmd_wps_pin },
  24203. { "wps_check_pin", hostapd_cli_cmd_wps_check_pin },
  24204. { "wps_pbc", hostapd_cli_cmd_wps_pbc },
  24205. -@@ -1041,7 +1036,6 @@ static struct hostapd_cli_cmd hostapd_cl
  24206. +@@ -1250,7 +1245,6 @@ static const struct hostapd_cli_cmd host
  24207. { "wps_ap_pin", hostapd_cli_cmd_wps_ap_pin },
  24208. { "wps_config", hostapd_cli_cmd_wps_config },
  24209. { "wps_get_status", hostapd_cli_cmd_wps_get_status },
  24210. diff --git a/package/network/services/hostapd/patches/431-wpa_cli_ifdef.patch b/package/network/services/hostapd/patches/431-wpa_cli_ifdef.patch
  24211. index 874ff4bccc0b152ce5a2f2b9e3a0ba1097128126..256f6b5977323b00215927a0051738eda376eef7 100644
  24212. --- a/package/network/services/hostapd/patches/431-wpa_cli_ifdef.patch
  24213. +++ b/package/network/services/hostapd/patches/431-wpa_cli_ifdef.patch
  24214. @@ -1,13 +1,12 @@
  24215. --- a/wpa_supplicant/wpa_cli.c
  24216. +++ b/wpa_supplicant/wpa_cli.c
  24217. -@@ -26,6 +26,10 @@
  24218. +@@ -25,6 +25,9 @@
  24219. + #include <cutils/properties.h>
  24220. #endif /* ANDROID */
  24221. -
  24222. +#ifndef CONFIG_P2P
  24223. +#define CONFIG_P2P
  24224. +#endif
  24225. -+
  24226. - static const char *wpa_cli_version =
  24227. +
  24228. + static const char *const wpa_cli_version =
  24229. "wpa_cli v" VERSION_STR "\n"
  24230. - "Copyright (c) 2004-2015, Jouni Malinen <j@w1.fi> and contributors";
  24231. diff --git a/package/network/services/hostapd/patches/432-missing-typedef.patch b/package/network/services/hostapd/patches/432-missing-typedef.patch
  24232. new file mode 100644
  24233. index 0000000000000000000000000000000000000000..7a100f1a0d25e4e1e63524025dcd36d532122843
  24234. --- /dev/null
  24235. +++ b/package/network/services/hostapd/patches/432-missing-typedef.patch
  24236. @@ -0,0 +1,10 @@
  24237. +--- a/src/drivers/linux_wext.h
  24238. ++++ b/src/drivers/linux_wext.h
  24239. +@@ -26,6 +26,7 @@ typedef int32_t __s32;
  24240. + typedef uint16_t __u16;
  24241. + typedef int16_t __s16;
  24242. + typedef uint8_t __u8;
  24243. ++typedef int8_t __s8;
  24244. + #ifndef __user
  24245. + #define __user
  24246. + #endif /* __user */
  24247. 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
  24248. deleted file mode 100644
  24249. index 74aef26d64fb82fad3826b64024e9500f2353542..0000000000000000000000000000000000000000
  24250. --- a/package/network/services/hostapd/patches/440-max_num_sta_probe.patch
  24251. +++ /dev/null
  24252. @@ -1,13 +0,0 @@
  24253. ---- a/src/ap/beacon.c
  24254. -+++ b/src/ap/beacon.c
  24255. -@@ -664,6 +664,10 @@ void handle_probe_req(struct hostapd_dat
  24256. - return;
  24257. - }
  24258. -
  24259. -+ if (!sta && hapd->num_sta >= hapd->conf->max_num_sta)
  24260. -+ wpa_printf(MSG_MSGDUMP, "Probe Request from " MACSTR " ignored,"
  24261. -+ " too many connected stations.", MAC2STR(mgmt->sa));
  24262. -+
  24263. - #ifdef CONFIG_INTERWORKING
  24264. - if (hapd->conf->interworking &&
  24265. - elems.interworking && elems.interworking_len >= 1) {
  24266. diff --git a/package/network/services/hostapd/patches/450-scan_wait.patch b/package/network/services/hostapd/patches/450-scan_wait.patch
  24267. index 87ebd4552f4d22dfcb2c3bd9947e6c2f16e9e115..78cf3064fa6fbf5abf89d5c7388e8a99e8ba988e 100644
  24268. --- a/package/network/services/hostapd/patches/450-scan_wait.patch
  24269. +++ b/package/network/services/hostapd/patches/450-scan_wait.patch
  24270. @@ -1,6 +1,6 @@
  24271. --- a/hostapd/main.c
  24272. +++ b/hostapd/main.c
  24273. -@@ -36,6 +36,8 @@ struct hapd_global {
  24274. +@@ -37,6 +37,8 @@ struct hapd_global {
  24275. };
  24276. static struct hapd_global global;
  24277. @@ -9,7 +9,7 @@
  24278. #ifndef CONFIG_NO_HOSTAPD_LOGGER
  24279. -@@ -142,6 +144,14 @@ static void hostapd_logger_cb(void *ctx,
  24280. +@@ -143,6 +145,14 @@ static void hostapd_logger_cb(void *ctx,
  24281. }
  24282. #endif /* CONFIG_NO_HOSTAPD_LOGGER */
  24283. @@ -24,7 +24,7 @@
  24284. /**
  24285. * hostapd_driver_init - Preparate driver interface
  24286. -@@ -160,6 +170,8 @@ static int hostapd_driver_init(struct ho
  24287. +@@ -161,6 +171,8 @@ static int hostapd_driver_init(struct ho
  24288. return -1;
  24289. }
  24290. @@ -33,7 +33,7 @@
  24291. /* Initialize the driver interface */
  24292. if (!(b[0] | b[1] | b[2] | b[3] | b[4] | b[5]))
  24293. b = NULL;
  24294. -@@ -381,8 +393,6 @@ static void hostapd_global_deinit(const
  24295. +@@ -401,8 +413,6 @@ static void hostapd_global_deinit(const
  24296. #endif /* CONFIG_NATIVE_WINDOWS */
  24297. eap_server_unregister_methods();
  24298. @@ -42,19 +42,26 @@
  24299. }
  24300. -@@ -408,11 +418,6 @@ static int hostapd_global_run(struct hap
  24301. +@@ -428,18 +438,6 @@ static int hostapd_global_run(struct hap
  24302. }
  24303. #endif /* EAP_SERVER_TNC */
  24304. -- if (daemonize && os_daemonize(pid_file)) {
  24305. -- wpa_printf(MSG_ERROR, "daemon: %s", strerror(errno));
  24306. -- return -1;
  24307. +- if (daemonize) {
  24308. +- if (os_daemonize(pid_file)) {
  24309. +- wpa_printf(MSG_ERROR, "daemon: %s", strerror(errno));
  24310. +- return -1;
  24311. +- }
  24312. +- if (eloop_sock_requeue()) {
  24313. +- wpa_printf(MSG_ERROR, "eloop_sock_requeue: %s",
  24314. +- strerror(errno));
  24315. +- return -1;
  24316. +- }
  24317. - }
  24318. -
  24319. eloop_run();
  24320. return 0;
  24321. -@@ -542,8 +547,7 @@ int main(int argc, char *argv[])
  24322. +@@ -638,8 +636,7 @@ int main(int argc, char *argv[])
  24323. struct hapd_interfaces interfaces;
  24324. int ret = 1;
  24325. size_t i, j;
  24326. 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
  24327. index 217e7015010848fd441003776afcbae04038d02d..6a5866e17c0305e92c9ca20f7b09768d60dfafab 100644
  24328. --- a/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch
  24329. +++ b/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch
  24330. @@ -18,15 +18,15 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  24331. #define WPA_SUPPLICANT_DRIVER_VERSION 4
  24332. -+#include "drivers/nl80211_copy.h"
  24333. ++#include "ap/sta_info.h"
  24334. #include "common/defs.h"
  24335. + #include "common/ieee802_11_defs.h"
  24336. #include "utils/list.h"
  24337. -
  24338. -@@ -538,6 +539,9 @@ struct wpa_driver_associate_params {
  24339. +@@ -587,6 +588,9 @@ struct wpa_driver_associate_params {
  24340. * responsible for selecting with which BSS to associate. */
  24341. const u8 *bssid;
  24342. -+ unsigned char rates[NL80211_MAX_SUPP_RATES];
  24343. ++ unsigned char rates[WLAN_SUPP_RATES_MAX];
  24344. + int mcast_rate;
  24345. +
  24346. /**
  24347. @@ -34,15 +34,15 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  24348. *
  24349. --- a/wpa_supplicant/config.c
  24350. +++ b/wpa_supplicant/config.c
  24351. -@@ -15,6 +15,7 @@
  24352. - #include "rsn_supp/wpa.h"
  24353. +@@ -16,6 +16,7 @@
  24354. #include "eap_peer/eap.h"
  24355. #include "p2p/p2p.h"
  24356. -+#include "drivers/nl80211_copy.h"
  24357. + #include "fst/fst.h"
  24358. ++#include "ap/sta_info.h"
  24359. #include "config.h"
  24360. -@@ -1722,6 +1723,97 @@ static char * wpa_config_write_mesh_basi
  24361. +@@ -1816,6 +1817,97 @@ static char * wpa_config_write_mesh_basi
  24362. #endif /* CONFIG_MESH */
  24363. @@ -88,7 +88,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  24364. + pos = (char *)value;
  24365. + r = strtok_r(pos, ",", &sptr);
  24366. + i = 0;
  24367. -+ while (pos && i < NL80211_MAX_SUPP_RATES) {
  24368. ++ while (pos && i < WLAN_SUPP_RATES_MAX) {
  24369. + rate = 0.0;
  24370. + if (r)
  24371. + rate = strtod(r, &end);
  24372. @@ -113,11 +113,11 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  24373. + if (ssid->rates[0] <= 0)
  24374. + return NULL;
  24375. +
  24376. -+ value = os_malloc(6 * NL80211_MAX_SUPP_RATES + 1);
  24377. ++ value = os_malloc(6 * WLAN_SUPP_RATES_MAX + 1);
  24378. + if (value == NULL)
  24379. + return NULL;
  24380. + pos = value;
  24381. -+ for (i = 0; i < NL80211_MAX_SUPP_RATES - 1; i++) {
  24382. ++ for (i = 0; i < WLAN_SUPP_RATES_MAX - 1; i++) {
  24383. + res = os_snprintf(pos, 6, "%.1f,", (double)ssid->rates[i] / 2);
  24384. + if (res < 0) {
  24385. + os_free(value);
  24386. @@ -126,13 +126,13 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  24387. + pos += res;
  24388. + }
  24389. + res = os_snprintf(pos, 6, "%.1f",
  24390. -+ (double)ssid->rates[NL80211_MAX_SUPP_RATES - 1] / 2);
  24391. ++ (double)ssid->rates[WLAN_SUPP_RATES_MAX - 1] / 2);
  24392. + if (res < 0) {
  24393. + os_free(value);
  24394. + return NULL;
  24395. + }
  24396. +
  24397. -+ value[6 * NL80211_MAX_SUPP_RATES] = '\0';
  24398. ++ value[6 * WLAN_SUPP_RATES_MAX] = '\0';
  24399. + return value;
  24400. +}
  24401. +#endif /* NO_CONFIG_WRITE */
  24402. @@ -140,7 +140,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  24403. /* Helper macros for network block parser */
  24404. #ifdef OFFSET
  24405. -@@ -1947,6 +2039,9 @@ static const struct parse_data ssid_fiel
  24406. +@@ -2047,6 +2139,9 @@ static const struct parse_data ssid_fiel
  24407. { INT(ap_max_inactivity) },
  24408. { INT(dtim_period) },
  24409. { INT(beacon_int) },
  24410. @@ -152,19 +152,22 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  24411. #endif /* CONFIG_MACSEC */
  24412. --- a/wpa_supplicant/config_ssid.h
  24413. +++ b/wpa_supplicant/config_ssid.h
  24414. -@@ -12,6 +12,7 @@
  24415. +@@ -10,8 +10,10 @@
  24416. + #define CONFIG_SSID_H
  24417. +
  24418. #include "common/defs.h"
  24419. ++#include "ap/sta_info.h"
  24420. #include "utils/list.h"
  24421. #include "eap_peer/eap_config.h"
  24422. +#include "drivers/nl80211_copy.h"
  24423. - #define MAX_SSID_LEN 32
  24424. -@@ -675,6 +676,9 @@ struct wpa_ssid {
  24425. + #define DEFAULT_EAP_WORKAROUND ((unsigned int) -1)
  24426. +@@ -711,6 +713,9 @@ struct wpa_ssid {
  24427. */
  24428. void *parent_cred;
  24429. -+ unsigned char rates[NL80211_MAX_SUPP_RATES];
  24430. ++ unsigned char rates[WLAN_SUPP_RATES_MAX];
  24431. + double mcast_rate;
  24432. +
  24433. #ifdef CONFIG_MACSEC
  24434. @@ -172,13 +175,13 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  24435. * macsec_policy - Determines the policy for MACsec secure session
  24436. --- a/wpa_supplicant/wpa_supplicant.c
  24437. +++ b/wpa_supplicant/wpa_supplicant.c
  24438. -@@ -2266,6 +2266,13 @@ static void wpas_start_assoc_cb(struct w
  24439. +@@ -2518,6 +2518,13 @@ static void wpas_start_assoc_cb(struct w
  24440. params.beacon_int = ssid->beacon_int;
  24441. else
  24442. params.beacon_int = wpa_s->conf->beacon_int;
  24443. + params.fixed_freq = ssid->fixed_freq;
  24444. + i = 0;
  24445. -+ while (i < NL80211_MAX_SUPP_RATES) {
  24446. ++ while (i < WLAN_SUPP_RATES_MAX) {
  24447. + params.rates[i] = ssid->rates[i];
  24448. + i++;
  24449. + }
  24450. 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
  24451. index 730cc316503965639f87111b43be49ea3ee66f79..459bdb944ae2d5f6820594b261ccfc77b52ab5d3 100644
  24452. --- a/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch
  24453. +++ b/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch
  24454. @@ -10,7 +10,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  24455. --- a/src/drivers/driver_nl80211.c
  24456. +++ b/src/drivers/driver_nl80211.c
  24457. -@@ -4398,7 +4398,7 @@ static int wpa_driver_nl80211_ibss(struc
  24458. +@@ -4644,7 +4644,7 @@ static int wpa_driver_nl80211_ibss(struc
  24459. struct wpa_driver_associate_params *params)
  24460. {
  24461. struct nl_msg *msg;
  24462. @@ -19,7 +19,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  24463. int count = 0;
  24464. wpa_printf(MSG_DEBUG, "nl80211: Join IBSS (ifindex=%d)", drv->ifindex);
  24465. -@@ -4425,6 +4425,37 @@ retry:
  24466. +@@ -4671,6 +4671,37 @@ retry:
  24467. nl80211_put_beacon_int(msg, params->beacon_int))
  24468. goto fail;
  24469. 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
  24470. index 30bb2dc14c44d7ee85df46b9f203f8ca2e26557d..80fe49ccb20f0e9caf5e690fe18f3c31fe351a8e 100644
  24471. --- a/package/network/services/hostapd/patches/462-wpa_s-support-htmode-param.patch
  24472. +++ b/package/network/services/hostapd/patches/462-wpa_s-support-htmode-param.patch
  24473. @@ -16,9 +16,9 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  24474. --- a/src/drivers/driver.h
  24475. +++ b/src/drivers/driver.h
  24476. -@@ -541,6 +541,8 @@ struct wpa_driver_associate_params {
  24477. +@@ -590,6 +590,8 @@ struct wpa_driver_associate_params {
  24478. - unsigned char rates[NL80211_MAX_SUPP_RATES];
  24479. + unsigned char rates[WLAN_SUPP_RATES_MAX];
  24480. int mcast_rate;
  24481. + int ht_set;
  24482. + unsigned int htmode;
  24483. @@ -27,7 +27,7 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  24484. * bssid_hint - BSSID of a proposed AP
  24485. --- a/src/drivers/driver_nl80211.c
  24486. +++ b/src/drivers/driver_nl80211.c
  24487. -@@ -4456,6 +4456,22 @@ retry:
  24488. +@@ -4702,6 +4702,22 @@ retry:
  24489. nla_put_u32(msg, NL80211_ATTR_MCAST_RATE, params->mcast_rate);
  24490. }
  24491. @@ -52,7 +52,7 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  24492. goto fail;
  24493. --- a/wpa_supplicant/config.c
  24494. +++ b/wpa_supplicant/config.c
  24495. -@@ -1754,6 +1754,71 @@ static char * wpa_config_write_mcast_rat
  24496. +@@ -1848,6 +1848,71 @@ static char * wpa_config_write_mcast_rat
  24497. }
  24498. #endif /* NO_CONFIG_WRITE */
  24499. @@ -124,7 +124,7 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  24500. static int wpa_config_parse_rates(const struct parse_data *data,
  24501. struct wpa_ssid *ssid, int line,
  24502. const char *value)
  24503. -@@ -2042,6 +2107,7 @@ static const struct parse_data ssid_fiel
  24504. +@@ -2142,6 +2207,7 @@ static const struct parse_data ssid_fiel
  24505. { INT_RANGE(fixed_freq, 0, 1) },
  24506. { FUNC(rates) },
  24507. { FUNC(mcast_rate) },
  24508. @@ -134,9 +134,9 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  24509. #endif /* CONFIG_MACSEC */
  24510. --- a/wpa_supplicant/config_ssid.h
  24511. +++ b/wpa_supplicant/config_ssid.h
  24512. -@@ -678,6 +678,8 @@ struct wpa_ssid {
  24513. +@@ -715,6 +715,8 @@ struct wpa_ssid {
  24514. - unsigned char rates[NL80211_MAX_SUPP_RATES];
  24515. + unsigned char rates[WLAN_SUPP_RATES_MAX];
  24516. double mcast_rate;
  24517. + int ht_set;
  24518. + unsigned int htmode;
  24519. @@ -145,7 +145,7 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  24520. /**
  24521. --- a/wpa_supplicant/wpa_supplicant.c
  24522. +++ b/wpa_supplicant/wpa_supplicant.c
  24523. -@@ -2273,6 +2273,8 @@ static void wpas_start_assoc_cb(struct w
  24524. +@@ -2525,6 +2525,8 @@ static void wpas_start_assoc_cb(struct w
  24525. i++;
  24526. }
  24527. params.mcast_rate = ssid->mcast_rate;
  24528. diff --git a/package/network/services/hostapd/patches/470-survey_data_fallback.patch b/package/network/services/hostapd/patches/470-survey_data_fallback.patch
  24529. new file mode 100644
  24530. index 0000000000000000000000000000000000000000..4e40a87558949483954950f72d30ac30a17877e9
  24531. --- /dev/null
  24532. +++ b/package/network/services/hostapd/patches/470-survey_data_fallback.patch
  24533. @@ -0,0 +1,45 @@
  24534. +--- a/src/ap/acs.c
  24535. ++++ b/src/ap/acs.c
  24536. +@@ -292,18 +292,12 @@ static void acs_fail(struct hostapd_ifac
  24537. + static long double
  24538. + acs_survey_interference_factor(struct freq_survey *survey, s8 min_nf)
  24539. + {
  24540. +- long double factor, busy, total;
  24541. ++ long double factor, busy = 0, total;
  24542. +
  24543. + if (survey->filled & SURVEY_HAS_CHAN_TIME_BUSY)
  24544. + busy = survey->channel_time_busy;
  24545. + else if (survey->filled & SURVEY_HAS_CHAN_TIME_RX)
  24546. + busy = survey->channel_time_rx;
  24547. +- else {
  24548. +- /* This shouldn't really happen as survey data is checked in
  24549. +- * acs_sanity_check() */
  24550. +- wpa_printf(MSG_ERROR, "ACS: Survey data missing");
  24551. +- return 0;
  24552. +- }
  24553. +
  24554. + total = survey->channel_time;
  24555. +
  24556. +@@ -395,20 +389,19 @@ static int acs_usable_vht80_chan(struct
  24557. + static int acs_survey_is_sufficient(struct freq_survey *survey)
  24558. + {
  24559. + if (!(survey->filled & SURVEY_HAS_NF)) {
  24560. ++ survey->nf = -95;
  24561. + wpa_printf(MSG_INFO, "ACS: Survey is missing noise floor");
  24562. +- return 0;
  24563. + }
  24564. +
  24565. + if (!(survey->filled & SURVEY_HAS_CHAN_TIME)) {
  24566. ++ survey->channel_time = 0;
  24567. + wpa_printf(MSG_INFO, "ACS: Survey is missing channel time");
  24568. +- return 0;
  24569. + }
  24570. +
  24571. + if (!(survey->filled & SURVEY_HAS_CHAN_TIME_BUSY) &&
  24572. + !(survey->filled & SURVEY_HAS_CHAN_TIME_RX)) {
  24573. + wpa_printf(MSG_INFO,
  24574. + "ACS: Survey is missing RX and busy time (at least one is required)");
  24575. +- return 0;
  24576. + }
  24577. +
  24578. + return 1;
  24579. 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
  24580. deleted file mode 100644
  24581. index e6bbdddc50cc293f4feb0d91abbca597e02902dc..0000000000000000000000000000000000000000
  24582. --- a/package/network/services/hostapd/patches/470-wait-for-nullfunc-longer.patch
  24583. +++ /dev/null
  24584. @@ -1,11 +0,0 @@
  24585. ---- a/src/ap/sta_info.h
  24586. -+++ b/src/ap/sta_info.h
  24587. -@@ -179,7 +179,7 @@ struct sta_info {
  24588. - * AP_DISASSOC_DELAY seconds. Similarly, the station will be deauthenticated
  24589. - * after AP_DEAUTH_DELAY seconds has passed after disassociation. */
  24590. - #define AP_MAX_INACTIVITY (5 * 60)
  24591. --#define AP_DISASSOC_DELAY (1)
  24592. -+#define AP_DISASSOC_DELAY (3)
  24593. - #define AP_DEAUTH_DELAY (1)
  24594. - /* Number of seconds to keep STA entry with Authenticated flag after it has
  24595. - * been disassociated. */
  24596. diff --git a/package/network/services/hostapd/patches/600-ubus_support.patch b/package/network/services/hostapd/patches/600-ubus_support.patch
  24597. index df2eac873c306728b05c8b96e2a464592944d181..feacdf2c08b07d5eba7c99efe629e64dd93f2c00 100644
  24598. --- a/package/network/services/hostapd/patches/600-ubus_support.patch
  24599. +++ b/package/network/services/hostapd/patches/600-ubus_support.patch
  24600. @@ -1,6 +1,6 @@
  24601. --- a/hostapd/Makefile
  24602. +++ b/hostapd/Makefile
  24603. -@@ -121,6 +121,11 @@ OBJS += ../src/common/hw_features_common
  24604. +@@ -157,6 +157,11 @@ OBJS += ../src/common/hw_features_common
  24605. OBJS += ../src/eapol_auth/eapol_auth_sm.o
  24606. @@ -22,7 +22,7 @@
  24607. struct wpa_ctrl_dst;
  24608. struct radius_server_data;
  24609. -@@ -103,6 +104,7 @@ struct hostapd_data {
  24610. +@@ -118,6 +119,7 @@ struct hostapd_data {
  24611. struct hostapd_iface *iface;
  24612. struct hostapd_config *iconf;
  24613. struct hostapd_bss_config *conf;
  24614. @@ -30,7 +30,7 @@
  24615. int interface_added; /* virtual interface added for this BSS */
  24616. unsigned int started:1;
  24617. unsigned int disabled:1;
  24618. -@@ -286,6 +288,8 @@ struct hostapd_iface {
  24619. +@@ -323,6 +325,8 @@ struct hostapd_iface {
  24620. struct hostapd_config *conf;
  24621. char phy[16]; /* Name of the PHY (radio) */
  24622. @@ -41,10 +41,10 @@
  24623. HAPD_IFACE_DISABLED,
  24624. --- /dev/null
  24625. +++ b/src/ap/ubus.c
  24626. -@@ -0,0 +1,511 @@
  24627. +@@ -0,0 +1,536 @@
  24628. +/*
  24629. + * hostapd / ubus support
  24630. -+ * Copyright (c) 2013, Felix Fietkau <nbd@openwrt.org>
  24631. ++ * Copyright (c) 2013, Felix Fietkau <nbd@nbd.name>
  24632. + *
  24633. + * This software may be distributed under the terms of the BSD license.
  24634. + * See README for more details.
  24635. @@ -58,6 +58,8 @@
  24636. +#include "wps_hostapd.h"
  24637. +#include "sta_info.h"
  24638. +#include "ubus.h"
  24639. ++#include "ap_drv_ops.h"
  24640. ++#include "beacon.h"
  24641. +
  24642. +static struct ubus_context *ctx;
  24643. +static struct blob_buf b;
  24644. @@ -417,6 +419,10 @@
  24645. +{
  24646. + struct blob_attr *tb[__VENDOR_ELEMENTS_MAX];
  24647. + struct hostapd_data *hapd = get_hapd_from_object(obj);
  24648. ++ struct hostapd_bss_config *bss = hapd->conf;
  24649. ++ struct wpabuf *elems;
  24650. ++ const char *pos;
  24651. ++ size_t len;
  24652. +
  24653. + blobmsg_parse(ve_policy, __VENDOR_ELEMENTS_MAX, tb,
  24654. + blob_data(msg), blob_len(msg));
  24655. @@ -424,10 +430,29 @@
  24656. + if (!tb[VENDOR_ELEMENTS])
  24657. + return UBUS_STATUS_INVALID_ARGUMENT;
  24658. +
  24659. -+ const char *vendor_elements = blobmsg_data(tb[VENDOR_ELEMENTS]);
  24660. -+ if (hostapd_set_iface(hapd->iconf, hapd->conf, "vendor_elements",
  24661. -+ vendor_elements) != 0)
  24662. -+ return UBUS_STATUS_NOT_SUPPORTED;
  24663. ++ pos = blobmsg_data(tb[VENDOR_ELEMENTS]);
  24664. ++ len = os_strlen(pos);
  24665. ++ if (len & 0x01)
  24666. ++ return UBUS_STATUS_INVALID_ARGUMENT;
  24667. ++
  24668. ++ len /= 2;
  24669. ++ if (len == 0) {
  24670. ++ wpabuf_free(bss->vendor_elements);
  24671. ++ bss->vendor_elements = NULL;
  24672. ++ return 0;
  24673. ++ }
  24674. ++
  24675. ++ elems = wpabuf_alloc(len);
  24676. ++ if (elems == NULL)
  24677. ++ return 1;
  24678. ++
  24679. ++ if (hexstr2bin(pos, wpabuf_put(elems, len), len)) {
  24680. ++ wpabuf_free(elems);
  24681. ++ return UBUS_STATUS_INVALID_ARGUMENT;
  24682. ++ }
  24683. ++
  24684. ++ wpabuf_free(bss->vendor_elements);
  24685. ++ bss->vendor_elements = elems;
  24686. +
  24687. + /* update beacons if vendor elements were set successfully */
  24688. + if (ieee802_11_update_beacons(hapd->iface) != 0)
  24689. @@ -558,7 +583,7 @@
  24690. @@ -0,0 +1,78 @@
  24691. +/*
  24692. + * hostapd / ubus support
  24693. -+ * Copyright (c) 2013, Felix Fietkau <nbd@openwrt.org>
  24694. ++ * Copyright (c) 2013, Felix Fietkau <nbd@nbd.name>
  24695. + *
  24696. + * This software may be distributed under the terms of the BSD license.
  24697. + * See README for more details.
  24698. @@ -636,7 +661,7 @@
  24699. +#endif
  24700. --- a/src/ap/hostapd.c
  24701. +++ b/src/ap/hostapd.c
  24702. -@@ -277,6 +277,7 @@ static void hostapd_free_hapd_data(struc
  24703. +@@ -284,6 +284,7 @@ static void hostapd_free_hapd_data(struc
  24704. hapd->started = 0;
  24705. wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface);
  24706. @@ -644,7 +669,7 @@
  24707. iapp_deinit(hapd->iapp);
  24708. hapd->iapp = NULL;
  24709. accounting_deinit(hapd);
  24710. -@@ -1098,6 +1099,8 @@ static int hostapd_setup_bss(struct host
  24711. +@@ -1139,6 +1140,8 @@ static int hostapd_setup_bss(struct host
  24712. if (hapd->driver && hapd->driver->set_operstate)
  24713. hapd->driver->set_operstate(hapd->drv_priv, 1);
  24714. @@ -653,7 +678,7 @@
  24715. return 0;
  24716. }
  24717. -@@ -1384,6 +1387,7 @@ int hostapd_setup_interface_complete(str
  24718. +@@ -1664,6 +1667,7 @@ static int hostapd_setup_interface_compl
  24719. if (err)
  24720. goto fail;
  24721. @@ -661,15 +686,15 @@
  24722. wpa_printf(MSG_DEBUG, "Completing interface initialization");
  24723. if (iface->conf->channel) {
  24724. #ifdef NEED_AP_MLME
  24725. -@@ -1544,6 +1548,7 @@ dfs_offload:
  24726. +@@ -1844,6 +1848,7 @@ dfs_offload:
  24727. fail:
  24728. wpa_printf(MSG_ERROR, "Interface initialization failed");
  24729. + hostapd_ubus_free_iface(iface);
  24730. hostapd_set_state(iface, HAPD_IFACE_DISABLED);
  24731. wpa_msg(hapd->msg_ctx, MSG_INFO, AP_EVENT_DISABLED);
  24732. - if (iface->interfaces && iface->interfaces->terminate_on_error)
  24733. -@@ -1873,6 +1878,7 @@ void hostapd_interface_deinit_free(struc
  24734. + #ifdef CONFIG_FST
  24735. +@@ -2277,6 +2282,7 @@ void hostapd_interface_deinit_free(struc
  24736. (unsigned int) iface->conf->num_bss);
  24737. driver = iface->bss[0]->driver;
  24738. drv_priv = iface->bss[0]->drv_priv;
  24739. @@ -679,7 +704,7 @@
  24740. __func__, driver, drv_priv);
  24741. --- a/src/ap/ieee802_11.c
  24742. +++ b/src/ap/ieee802_11.c
  24743. -@@ -881,7 +881,8 @@ int auth_sae_init_committed(struct hosta
  24744. +@@ -980,7 +980,8 @@ int auth_sae_init_committed(struct hosta
  24745. static void handle_auth(struct hostapd_data *hapd,
  24746. @@ -689,7 +714,7 @@
  24747. {
  24748. u16 auth_alg, auth_transaction, status_code;
  24749. u16 resp = WLAN_STATUS_SUCCESS;
  24750. -@@ -897,6 +898,11 @@ static void handle_auth(struct hostapd_d
  24751. +@@ -996,6 +997,11 @@ static void handle_auth(struct hostapd_d
  24752. char *identity = NULL;
  24753. char *radius_cui = NULL;
  24754. u16 seq_ctrl;
  24755. @@ -699,9 +724,9 @@
  24756. + .frame_info = fi,
  24757. + };
  24758. - if (len < IEEE80211_HDRLEN + sizeof(mgmt->u.auth)) {
  24759. - wpa_printf(MSG_INFO, "handle_auth - too short payload (len=%lu)",
  24760. -@@ -983,6 +989,14 @@ static void handle_auth(struct hostapd_d
  24761. + os_memset(&vlan_id, 0, sizeof(vlan_id));
  24762. +
  24763. +@@ -1149,6 +1155,14 @@ static void handle_auth(struct hostapd_d
  24764. resp = WLAN_STATUS_UNSPECIFIED_FAILURE;
  24765. goto fail;
  24766. }
  24767. @@ -716,7 +741,7 @@
  24768. if (res == HOSTAPD_ACL_PENDING) {
  24769. wpa_printf(MSG_DEBUG, "Authentication frame from " MACSTR
  24770. " waiting for an external authentication",
  24771. -@@ -1694,13 +1708,18 @@ static void send_assoc_resp(struct hosta
  24772. +@@ -2033,13 +2047,18 @@ static u16 send_assoc_resp(struct hostap
  24773. static void handle_assoc(struct hostapd_data *hapd,
  24774. const struct ieee80211_mgmt *mgmt, size_t len,
  24775. @@ -724,7 +749,7 @@
  24776. + int reassoc, struct hostapd_frame_info *fi)
  24777. {
  24778. u16 capab_info, listen_interval, seq_ctrl, fc;
  24779. - u16 resp = WLAN_STATUS_SUCCESS;
  24780. + u16 resp = WLAN_STATUS_SUCCESS, reply_res;
  24781. const u8 *pos;
  24782. int left, i;
  24783. struct sta_info *sta;
  24784. @@ -736,9 +761,9 @@
  24785. if (len < IEEE80211_HDRLEN + (reassoc ? sizeof(mgmt->u.reassoc_req) :
  24786. sizeof(mgmt->u.assoc_req))) {
  24787. -@@ -1820,6 +1839,13 @@ static void handle_assoc(struct hostapd_
  24788. - goto fail;
  24789. +@@ -2159,6 +2178,13 @@ static void handle_assoc(struct hostapd_
  24790. }
  24791. + #endif /* CONFIG_MBO */
  24792. + if (hostapd_ubus_handle_event(hapd, &req)) {
  24793. + wpa_printf(MSG_DEBUG, "Station " MACSTR " assoc rejected by ubus handler.\n",
  24794. @@ -747,10 +772,10 @@
  24795. + goto fail;
  24796. + }
  24797. +
  24798. - sta->capability = capab_info;
  24799. - sta->listen_interval = listen_interval;
  24800. -
  24801. -@@ -2236,7 +2262,7 @@ int ieee802_11_mgmt(struct hostapd_data
  24802. + /*
  24803. + * sta->capability is used in check_assoc_ies() for RRM enabled
  24804. + * capability element.
  24805. +@@ -2639,7 +2665,7 @@ int ieee802_11_mgmt(struct hostapd_data
  24806. if (stype == WLAN_FC_STYPE_PROBE_REQ) {
  24807. @@ -759,7 +784,7 @@
  24808. return 1;
  24809. }
  24810. -@@ -2251,17 +2277,17 @@ int ieee802_11_mgmt(struct hostapd_data
  24811. +@@ -2657,17 +2683,17 @@ int ieee802_11_mgmt(struct hostapd_data
  24812. switch (stype) {
  24813. case WLAN_FC_STYPE_AUTH:
  24814. wpa_printf(MSG_DEBUG, "mgmt::auth");
  24815. @@ -782,7 +807,7 @@
  24816. case WLAN_FC_STYPE_DISASSOC:
  24817. --- a/src/ap/beacon.c
  24818. +++ b/src/ap/beacon.c
  24819. -@@ -542,7 +542,7 @@ static enum ssid_match_result ssid_match
  24820. +@@ -675,7 +675,7 @@ sta_track_seen_on(struct hostapd_iface *
  24821. void handle_probe_req(struct hostapd_data *hapd,
  24822. const struct ieee80211_mgmt *mgmt, size_t len,
  24823. @@ -791,22 +816,23 @@
  24824. {
  24825. u8 *resp;
  24826. struct ieee802_11_elems elems;
  24827. -@@ -550,8 +550,14 @@ void handle_probe_req(struct hostapd_dat
  24828. - size_t ie_len;
  24829. - struct sta_info *sta = NULL;
  24830. +@@ -684,9 +684,15 @@ void handle_probe_req(struct hostapd_dat
  24831. size_t i, resp_len;
  24832. -+ int ssi_signal = fi->ssi_signal;
  24833. int noack;
  24834. enum ssid_match_result res;
  24835. ++ int ssi_signal = fi->ssi_signal;
  24836. + int ret;
  24837. + u16 csa_offs[2];
  24838. + size_t csa_offs_len;
  24839. + struct hostapd_ubus_request req = {
  24840. + .type = HOSTAPD_UBUS_PROBE_REQ,
  24841. + .mgmt_frame = mgmt,
  24842. + .frame_info = fi,
  24843. + };
  24844. - ie = mgmt->u.probe_req.variable;
  24845. - if (len < IEEE80211_HDRLEN + sizeof(mgmt->u.probe_req))
  24846. -@@ -710,6 +716,12 @@ void handle_probe_req(struct hostapd_dat
  24847. + if (len < IEEE80211_HDRLEN)
  24848. + return;
  24849. +@@ -838,6 +844,12 @@ void handle_probe_req(struct hostapd_dat
  24850. }
  24851. #endif /* CONFIG_P2P */
  24852. @@ -832,7 +858,7 @@
  24853. int ieee802_11_update_beacons(struct hostapd_iface *iface);
  24854. --- a/src/ap/drv_callbacks.c
  24855. +++ b/src/ap/drv_callbacks.c
  24856. -@@ -49,6 +49,10 @@ int hostapd_notif_assoc(struct hostapd_d
  24857. +@@ -52,6 +52,10 @@ int hostapd_notif_assoc(struct hostapd_d
  24858. u16 reason = WLAN_REASON_UNSPECIFIED;
  24859. u16 status = WLAN_STATUS_SUCCESS;
  24860. const u8 *p2p_dev_addr = NULL;
  24861. @@ -843,9 +869,9 @@
  24862. if (addr == NULL) {
  24863. /*
  24864. -@@ -113,6 +117,12 @@ int hostapd_notif_assoc(struct hostapd_d
  24865. +@@ -124,6 +128,12 @@ int hostapd_notif_assoc(struct hostapd_d
  24866. + goto fail;
  24867. }
  24868. - sta->flags &= ~(WLAN_STA_WPS | WLAN_STA_MAYBE_WPS | WLAN_STA_WPS2);
  24869. + if (hostapd_ubus_handle_event(hapd, &req)) {
  24870. + wpa_printf(MSG_DEBUG, "Station " MACSTR " assoc rejected by ubus handler.\n",
  24871. diff --git a/package/network/utils/iw/Makefile b/package/network/utils/iw/Makefile
  24872. index ad82081570395bfba8d60428996194d834f73321..d17cbca0df391a287fb9d80a3d9c1ca1355c1774 100644
  24873. --- a/package/network/utils/iw/Makefile
  24874. +++ b/package/network/utils/iw/Makefile
  24875. @@ -12,10 +12,10 @@ PKG_VERSION:=4.3
  24876. PKG_RELEASE:=1
  24877. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  24878. -PKG_SOURCE_URL:=https://www.kernel.org/pub/software/network/iw
  24879. +PKG_SOURCE_URL:=@KERNEL/software/network/iw
  24880. PKG_MD5SUM:=7adec72e91ebdd9c55429fa34a23a6f5
  24881. -PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  24882. +PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  24883. PKG_LICENSE:=GPL-2.0
  24884. include $(INCLUDE_DIR)/package.mk
  24885. diff --git a/package/network/utils/iw/patches/001-nl80211_h_sync.patch b/package/network/utils/iw/patches/001-nl80211_h_sync.patch
  24886. index 7de225859b71c2bb7627503b676aa7f2a122ccd9..e5ea8f7c8ad8eeb73f793ad6c536bb31d76d6868 100644
  24887. --- a/package/network/utils/iw/patches/001-nl80211_h_sync.patch
  24888. +++ b/package/network/utils/iw/patches/001-nl80211_h_sync.patch
  24889. @@ -8,7 +8,17 @@
  24890. *
  24891. * Permission to use, copy, modify, and/or distribute this software for any
  24892. * purpose with or without fee is hereby granted, provided that the above
  24893. -@@ -328,7 +329,15 @@
  24894. +@@ -321,14 +322,24 @@
  24895. + * @NL80211_CMD_GET_SCAN: get scan results
  24896. + * @NL80211_CMD_TRIGGER_SCAN: trigger a new scan with the given parameters
  24897. + * %NL80211_ATTR_TX_NO_CCK_RATE is used to decide whether to send the
  24898. +- * probe requests at CCK rate or not.
  24899. ++ * probe requests at CCK rate or not. %NL80211_ATTR_MAC can be used to
  24900. ++ * specify a BSSID to scan for; if not included, the wildcard BSSID will
  24901. ++ * be used.
  24902. + * @NL80211_CMD_NEW_SCAN_RESULTS: scan notification (as a reply to
  24903. + * NL80211_CMD_GET_SCAN and on the "scan" multicast group)
  24904. + * @NL80211_CMD_SCAN_ABORTED: scan was aborted, for unspecified reasons,
  24905. * partial scan results may be available
  24906. *
  24907. * @NL80211_CMD_START_SCHED_SCAN: start a scheduled scan at certain
  24908. @@ -25,7 +35,82 @@
  24909. * Like with normal scans, if SSIDs (%NL80211_ATTR_SCAN_SSIDS)
  24910. * are passed, they are used in the probe requests. For
  24911. * broadcast, a broadcast SSID must be passed (ie. an empty
  24912. -@@ -1761,6 +1770,22 @@ enum nl80211_commands {
  24913. +@@ -418,7 +429,11 @@
  24914. + * @NL80211_CMD_ASSOCIATE: association request and notification; like
  24915. + * NL80211_CMD_AUTHENTICATE but for Association and Reassociation
  24916. + * (similar to MLME-ASSOCIATE.request, MLME-REASSOCIATE.request,
  24917. +- * MLME-ASSOCIATE.confirm or MLME-REASSOCIATE.confirm primitives).
  24918. ++ * MLME-ASSOCIATE.confirm or MLME-REASSOCIATE.confirm primitives). The
  24919. ++ * %NL80211_ATTR_PREV_BSSID attribute is used to specify whether the
  24920. ++ * request is for the initial association to an ESS (that attribute not
  24921. ++ * included) or for reassociation within the ESS (that attribute is
  24922. ++ * included).
  24923. + * @NL80211_CMD_DEAUTHENTICATE: deauthentication request and notification; like
  24924. + * NL80211_CMD_AUTHENTICATE but for Deauthentication frames (similar to
  24925. + * MLME-DEAUTHENTICATION.request and MLME-DEAUTHENTICATE.indication
  24926. +@@ -468,6 +483,9 @@
  24927. + * set of BSSID,frequency parameters is used (i.e., either the enforcing
  24928. + * %NL80211_ATTR_MAC,%NL80211_ATTR_WIPHY_FREQ or the less strict
  24929. + * %NL80211_ATTR_MAC_HINT and %NL80211_ATTR_WIPHY_FREQ_HINT).
  24930. ++ * %NL80211_ATTR_PREV_BSSID can be used to request a reassociation within
  24931. ++ * the ESS in case the device is already associated and an association with
  24932. ++ * a different BSS is desired.
  24933. + * Background scan period can optionally be
  24934. + * specified in %NL80211_ATTR_BG_SCAN_PERIOD,
  24935. + * if not specified default background scan configuration
  24936. +@@ -811,6 +829,10 @@
  24937. + * as an event to indicate changes for devices with wiphy-specific regdom
  24938. + * management.
  24939. + *
  24940. ++ * @NL80211_CMD_ABORT_SCAN: Stop an ongoing scan. Returns -ENOENT if a scan is
  24941. ++ * not running. The driver indicates the status of the scan through
  24942. ++ * cfg80211_scan_done().
  24943. ++ *
  24944. + * @NL80211_CMD_MAX: highest used command number
  24945. + * @__NL80211_CMD_AFTER_LAST: internal use
  24946. + */
  24947. +@@ -997,6 +1019,8 @@ enum nl80211_commands {
  24948. +
  24949. + NL80211_CMD_WIPHY_REG_CHANGE,
  24950. +
  24951. ++ NL80211_CMD_ABORT_SCAN,
  24952. ++
  24953. + /* add new commands above here */
  24954. +
  24955. + /* used to define NL80211_CMD_MAX below */
  24956. +@@ -1270,8 +1294,11 @@ enum nl80211_commands {
  24957. + * @NL80211_ATTR_RESP_IE: (Re)association response information elements as
  24958. + * sent by peer, for ROAM and successful CONNECT events.
  24959. + *
  24960. +- * @NL80211_ATTR_PREV_BSSID: previous BSSID, to be used by in ASSOCIATE
  24961. +- * commands to specify using a reassociate frame
  24962. ++ * @NL80211_ATTR_PREV_BSSID: previous BSSID, to be used in ASSOCIATE and CONNECT
  24963. ++ * commands to specify a request to reassociate within an ESS, i.e., to use
  24964. ++ * Reassociate Request frame (with the value of this attribute in the
  24965. ++ * Current AP address field) instead of Association Request frame which is
  24966. ++ * used for the initial association to an ESS.
  24967. + *
  24968. + * @NL80211_ATTR_KEY: key information in a nested attribute with
  24969. + * %NL80211_KEY_* sub-attributes
  24970. +@@ -1712,6 +1739,8 @@ enum nl80211_commands {
  24971. + * underlying device supports these minimal RRM features:
  24972. + * %NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES,
  24973. + * %NL80211_FEATURE_QUIET,
  24974. ++ * Or, if global RRM is supported, see:
  24975. ++ * %NL80211_EXT_FEATURE_RRM
  24976. + * If this flag is used, driver must add the Power Capabilities IE to the
  24977. + * association request. In addition, it must also set the RRM capability
  24978. + * flag in the association request's Capability Info field.
  24979. +@@ -1755,12 +1784,44 @@ enum nl80211_commands {
  24980. + * over all channels.
  24981. + *
  24982. + * @NL80211_ATTR_SCHED_SCAN_DELAY: delay before the first cycle of a
  24983. +- * scheduled scan (or a WoWLAN net-detect scan) is started, u32
  24984. +- * in seconds.
  24985. ++ * scheduled scan is started. Or the delay before a WoWLAN
  24986. ++ * net-detect scan is started, counting from the moment the
  24987. ++ * system is suspended. This value is a u32, in seconds.
  24988. +
  24989. * @NL80211_ATTR_REG_INDOOR: flag attribute, if set indicates that the device
  24990. * is operating in an indoor environment.
  24991. *
  24992. @@ -41,6 +126,21 @@
  24993. + * thus it must not specify the number of iterations, only the interval
  24994. + * between scans. The scan plans are executed sequentially.
  24995. + * Each scan plan is a nested attribute of &enum nl80211_sched_scan_plan.
  24996. ++ * @NL80211_ATTR_PBSS: flag attribute. If set it means operate
  24997. ++ * in a PBSS. Specified in %NL80211_CMD_CONNECT to request
  24998. ++ * connecting to a PCP, and in %NL80211_CMD_START_AP to start
  24999. ++ * a PCP instead of AP. Relevant for DMG networks only.
  25000. ++ * @NL80211_ATTR_BSS_SELECT: nested attribute for driver supporting the
  25001. ++ * BSS selection feature. When used with %NL80211_CMD_GET_WIPHY it contains
  25002. ++ * attributes according &enum nl80211_bss_select_attr to indicate what
  25003. ++ * BSS selection behaviours are supported. When used with %NL80211_CMD_CONNECT
  25004. ++ * it contains the behaviour-specific attribute containing the parameters for
  25005. ++ * BSS selection to be done by driver and/or firmware.
  25006. ++ *
  25007. ++ * @NL80211_ATTR_STA_SUPPORT_P2P_PS: whether P2P PS mechanism supported
  25008. ++ * or not. u8, one of the values of &enum nl80211_sta_p2p_ps_status
  25009. ++ *
  25010. ++ * @NL80211_ATTR_PAD: attribute used for padding for 64-bit alignment
  25011. + *
  25012. + * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce
  25013. + * transmit power to stay within regulatory limits. u32, dBi.
  25014. @@ -48,7 +148,7 @@
  25015. * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  25016. * @NL80211_ATTR_MAX: highest attribute number currently defined
  25017. * @__NL80211_ATTR_AFTER_LAST: internal use
  25018. -@@ -2130,6 +2155,13 @@ enum nl80211_attrs {
  25019. +@@ -2130,6 +2191,21 @@ enum nl80211_attrs {
  25020. NL80211_ATTR_REG_INDOOR,
  25021. @@ -57,30 +157,147 @@
  25022. + NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS,
  25023. + NL80211_ATTR_SCHED_SCAN_PLANS,
  25024. +
  25025. ++ NL80211_ATTR_PBSS,
  25026. ++
  25027. ++ NL80211_ATTR_BSS_SELECT,
  25028. ++
  25029. ++ NL80211_ATTR_STA_SUPPORT_P2P_PS,
  25030. ++
  25031. ++ NL80211_ATTR_PAD,
  25032. ++
  25033. + NL80211_ATTR_WIPHY_ANTENNA_GAIN,
  25034. +
  25035. /* add attributes here, update the policy in nl80211.c */
  25036. __NL80211_ATTR_AFTER_LAST,
  25037. -@@ -3364,6 +3396,9 @@ enum nl80211_bss_scan_width {
  25038. +@@ -2273,6 +2349,20 @@ enum nl80211_sta_flags {
  25039. + NL80211_STA_FLAG_MAX = __NL80211_STA_FLAG_AFTER_LAST - 1
  25040. + };
  25041. +
  25042. ++/**
  25043. ++ * enum nl80211_sta_p2p_ps_status - station support of P2P PS
  25044. ++ *
  25045. ++ * @NL80211_P2P_PS_UNSUPPORTED: station doesn't support P2P PS mechanism
  25046. ++ * @@NL80211_P2P_PS_SUPPORTED: station supports P2P PS mechanism
  25047. ++ * @NUM_NL80211_P2P_PS_STATUS: number of values
  25048. ++ */
  25049. ++enum nl80211_sta_p2p_ps_status {
  25050. ++ NL80211_P2P_PS_UNSUPPORTED = 0,
  25051. ++ NL80211_P2P_PS_SUPPORTED,
  25052. ++
  25053. ++ NUM_NL80211_P2P_PS_STATUS,
  25054. ++};
  25055. ++
  25056. + #define NL80211_STA_FLAG_MAX_OLD_API NL80211_STA_FLAG_TDLS_PEER
  25057. +
  25058. + /**
  25059. +@@ -2430,6 +2520,9 @@ enum nl80211_sta_bss_param {
  25060. + * TID+1 and the special TID 16 (i.e. value 17) is used for non-QoS frames;
  25061. + * each one of those is again nested with &enum nl80211_tid_stats
  25062. + * attributes carrying the actual values.
  25063. ++ * @NL80211_STA_INFO_RX_DURATION: aggregate PPDU duration for all frames
  25064. ++ * received from the station (u64, usec)
  25065. ++ * @NL80211_STA_INFO_PAD: attribute used for padding for 64-bit alignment
  25066. + * @__NL80211_STA_INFO_AFTER_LAST: internal
  25067. + * @NL80211_STA_INFO_MAX: highest possible station info attribute
  25068. + */
  25069. +@@ -2466,6 +2559,8 @@ enum nl80211_sta_info {
  25070. + NL80211_STA_INFO_BEACON_RX,
  25071. + NL80211_STA_INFO_BEACON_SIGNAL_AVG,
  25072. + NL80211_STA_INFO_TID_STATS,
  25073. ++ NL80211_STA_INFO_RX_DURATION,
  25074. ++ NL80211_STA_INFO_PAD,
  25075. +
  25076. + /* keep last */
  25077. + __NL80211_STA_INFO_AFTER_LAST,
  25078. +@@ -2482,6 +2577,7 @@ enum nl80211_sta_info {
  25079. + * transmitted MSDUs (not counting the first attempt; u64)
  25080. + * @NL80211_TID_STATS_TX_MSDU_FAILED: number of failed transmitted
  25081. + * MSDUs (u64)
  25082. ++ * @NL80211_TID_STATS_PAD: attribute used for padding for 64-bit alignment
  25083. + * @NUM_NL80211_TID_STATS: number of attributes here
  25084. + * @NL80211_TID_STATS_MAX: highest numbered attribute here
  25085. + */
  25086. +@@ -2491,6 +2587,7 @@ enum nl80211_tid_stats {
  25087. + NL80211_TID_STATS_TX_MSDU,
  25088. + NL80211_TID_STATS_TX_MSDU_RETRIES,
  25089. + NL80211_TID_STATS_TX_MSDU_FAILED,
  25090. ++ NL80211_TID_STATS_PAD,
  25091. +
  25092. + /* keep last */
  25093. + NUM_NL80211_TID_STATS,
  25094. +@@ -2927,6 +3024,7 @@ enum nl80211_user_reg_hint_type {
  25095. + * transmitting data (on channel or globally)
  25096. + * @NL80211_SURVEY_INFO_TIME_SCAN: time the radio spent for scan
  25097. + * (on this channel or globally)
  25098. ++ * @NL80211_SURVEY_INFO_PAD: attribute used for padding for 64-bit alignment
  25099. + * @NL80211_SURVEY_INFO_MAX: highest survey info attribute number
  25100. + * currently defined
  25101. + * @__NL80211_SURVEY_INFO_AFTER_LAST: internal use
  25102. +@@ -2942,6 +3040,7 @@ enum nl80211_survey_info {
  25103. + NL80211_SURVEY_INFO_TIME_RX,
  25104. + NL80211_SURVEY_INFO_TIME_TX,
  25105. + NL80211_SURVEY_INFO_TIME_SCAN,
  25106. ++ NL80211_SURVEY_INFO_PAD,
  25107. +
  25108. + /* keep last */
  25109. + __NL80211_SURVEY_INFO_AFTER_LAST,
  25110. +@@ -3364,6 +3463,10 @@ enum nl80211_bss_scan_width {
  25111. * (not present if no beacon frame has been received yet)
  25112. * @NL80211_BSS_PRESP_DATA: the data in @NL80211_BSS_INFORMATION_ELEMENTS and
  25113. * @NL80211_BSS_TSF is known to be from a probe response (flag attribute)
  25114. + * @NL80211_BSS_LAST_SEEN_BOOTTIME: CLOCK_BOOTTIME timestamp when this entry
  25115. + * was last updated by a received frame. The value is expected to be
  25116. + * accurate to about 10ms. (u64, nanoseconds)
  25117. ++ * @NL80211_BSS_PAD: attribute used for padding for 64-bit alignment
  25118. * @__NL80211_BSS_AFTER_LAST: internal
  25119. * @NL80211_BSS_MAX: highest BSS attribute
  25120. */
  25121. -@@ -3383,6 +3418,7 @@ enum nl80211_bss {
  25122. +@@ -3383,6 +3486,8 @@ enum nl80211_bss {
  25123. NL80211_BSS_CHAN_WIDTH,
  25124. NL80211_BSS_BEACON_TSF,
  25125. NL80211_BSS_PRESP_DATA,
  25126. + NL80211_BSS_LAST_SEEN_BOOTTIME,
  25127. ++ NL80211_BSS_PAD,
  25128. /* keep last */
  25129. __NL80211_BSS_AFTER_LAST,
  25130. -@@ -4589,4 +4625,28 @@ enum nl80211_tdls_peer_capability {
  25131. +@@ -3568,11 +3673,15 @@ enum nl80211_txrate_gi {
  25132. + * @NL80211_BAND_2GHZ: 2.4 GHz ISM band
  25133. + * @NL80211_BAND_5GHZ: around 5 GHz band (4.9 - 5.7 GHz)
  25134. + * @NL80211_BAND_60GHZ: around 60 GHz band (58.32 - 64.80 GHz)
  25135. ++ * @NUM_NL80211_BANDS: number of bands, avoid using this in userspace
  25136. ++ * since newer kernel versions may support more bands
  25137. + */
  25138. + enum nl80211_band {
  25139. + NL80211_BAND_2GHZ,
  25140. + NL80211_BAND_5GHZ,
  25141. + NL80211_BAND_60GHZ,
  25142. ++
  25143. ++ NUM_NL80211_BANDS,
  25144. + };
  25145. +
  25146. + /**
  25147. +@@ -4358,12 +4467,18 @@ enum nl80211_feature_flags {
  25148. + /**
  25149. + * enum nl80211_ext_feature_index - bit index of extended features.
  25150. + * @NL80211_EXT_FEATURE_VHT_IBSS: This driver supports IBSS with VHT datarates.
  25151. ++ * @NL80211_EXT_FEATURE_RRM: This driver supports RRM. When featured, user can
  25152. ++ * can request to use RRM (see %NL80211_ATTR_USE_RRM) with
  25153. ++ * %NL80211_CMD_ASSOCIATE and %NL80211_CMD_CONNECT requests, which will set
  25154. ++ * the ASSOC_REQ_USE_RRM flag in the association request even if
  25155. ++ * NL80211_FEATURE_QUIET is not advertized.
  25156. + *
  25157. + * @NUM_NL80211_EXT_FEATURES: number of extended features.
  25158. + * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
  25159. + */
  25160. + enum nl80211_ext_feature_index {
  25161. + NL80211_EXT_FEATURE_VHT_IBSS,
  25162. ++ NL80211_EXT_FEATURE_RRM,
  25163. +
  25164. + /* add new features before the definition below */
  25165. + NUM_NL80211_EXT_FEATURES,
  25166. +@@ -4589,4 +4704,72 @@ enum nl80211_tdls_peer_capability {
  25167. NL80211_TDLS_PEER_WMM = 1<<2,
  25168. };
  25169. @@ -108,4 +325,48 @@
  25170. + __NL80211_SCHED_SCAN_PLAN_AFTER_LAST - 1
  25171. +};
  25172. +
  25173. ++/**
  25174. ++ * struct nl80211_bss_select_rssi_adjust - RSSI adjustment parameters.
  25175. ++ *
  25176. ++ * @band: band of BSS that must match for RSSI value adjustment.
  25177. ++ * @delta: value used to adjust the RSSI value of matching BSS.
  25178. ++ */
  25179. ++struct nl80211_bss_select_rssi_adjust {
  25180. ++ __u8 band;
  25181. ++ __s8 delta;
  25182. ++} __attribute__((packed));
  25183. ++
  25184. ++/**
  25185. ++ * enum nl80211_bss_select_attr - attributes for bss selection.
  25186. ++ *
  25187. ++ * @__NL80211_BSS_SELECT_ATTR_INVALID: reserved.
  25188. ++ * @NL80211_BSS_SELECT_ATTR_RSSI: Flag indicating only RSSI-based BSS selection
  25189. ++ * is requested.
  25190. ++ * @NL80211_BSS_SELECT_ATTR_BAND_PREF: attribute indicating BSS
  25191. ++ * selection should be done such that the specified band is preferred.
  25192. ++ * When there are multiple BSS-es in the preferred band, the driver
  25193. ++ * shall use RSSI-based BSS selection as a second step. The value of
  25194. ++ * this attribute is according to &enum nl80211_band (u32).
  25195. ++ * @NL80211_BSS_SELECT_ATTR_RSSI_ADJUST: When present the RSSI level for
  25196. ++ * BSS-es in the specified band is to be adjusted before doing
  25197. ++ * RSSI-based BSS selection. The attribute value is a packed structure
  25198. ++ * value as specified by &struct nl80211_bss_select_rssi_adjust.
  25199. ++ * @NL80211_BSS_SELECT_ATTR_MAX: highest bss select attribute number.
  25200. ++ * @__NL80211_BSS_SELECT_ATTR_AFTER_LAST: internal use.
  25201. ++ *
  25202. ++ * One and only one of these attributes are found within %NL80211_ATTR_BSS_SELECT
  25203. ++ * for %NL80211_CMD_CONNECT. It specifies the required BSS selection behaviour
  25204. ++ * which the driver shall use.
  25205. ++ */
  25206. ++enum nl80211_bss_select_attr {
  25207. ++ __NL80211_BSS_SELECT_ATTR_INVALID,
  25208. ++ NL80211_BSS_SELECT_ATTR_RSSI,
  25209. ++ NL80211_BSS_SELECT_ATTR_BAND_PREF,
  25210. ++ NL80211_BSS_SELECT_ATTR_RSSI_ADJUST,
  25211. ++
  25212. ++ /* keep last */
  25213. ++ __NL80211_BSS_SELECT_ATTR_AFTER_LAST,
  25214. ++ NL80211_BSS_SELECT_ATTR_MAX = __NL80211_BSS_SELECT_ATTR_AFTER_LAST - 1
  25215. ++};
  25216. ++
  25217. #endif /* __LINUX_NL80211_H */
  25218. 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
  25219. index 574c490318d03d09f6c6762be892b0814718dbbe..2cdf360cc57a512680e7f9f0b2450055c2c81d35 100644
  25220. --- a/package/network/utils/iw/patches/300-display_interface_TX_power.patch
  25221. +++ b/package/network/utils/iw/patches/300-display_interface_TX_power.patch
  25222. @@ -12,11 +12,9 @@ Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  25223. interface.c | 7 +++++++
  25224. 1 file changed, 7 insertions(+)
  25225. -diff --git a/interface.c b/interface.c
  25226. -index 73ccecd..4f0821d 100644
  25227. --- a/interface.c
  25228. +++ b/interface.c
  25229. -@@ -368,6 +368,13 @@ static int print_iface_handler(struct nl_msg *msg, void *arg)
  25230. +@@ -368,6 +368,13 @@ static int print_iface_handler(struct nl
  25231. printf("\n");
  25232. }
  25233. diff --git a/package/network/utils/iw/patches/301-ibss_add_VHT80.patch b/package/network/utils/iw/patches/301-ibss_add_VHT80.patch
  25234. index 709fbb29146b3fe80f7af240d04dec8f5e96795a..0627bccb468cd31f8357a4b0fe3f3bee879230c6 100644
  25235. --- a/package/network/utils/iw/patches/301-ibss_add_VHT80.patch
  25236. +++ b/package/network/utils/iw/patches/301-ibss_add_VHT80.patch
  25237. @@ -14,8 +14,6 @@ Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  25238. ibss.c | 49 +++++++++++++++++++++++++++++++++++++++++--------
  25239. 1 file changed, 41 insertions(+), 8 deletions(-)
  25240. -diff --git a/ibss.c b/ibss.c
  25241. -index 7a0b707..a99a262 100644
  25242. --- a/ibss.c
  25243. +++ b/ibss.c
  25244. @@ -16,6 +16,39 @@
  25245. @@ -58,7 +56,7 @@ index 7a0b707..a99a262 100644
  25246. static int join_ibss(struct nl80211_state *state,
  25247. struct nl_msg *msg,
  25248. int argc, char **argv,
  25249. -@@ -30,12 +63,8 @@ static int join_ibss(struct nl80211_state *state,
  25250. +@@ -30,12 +63,8 @@ static int join_ibss(struct nl80211_stat
  25251. int bintval;
  25252. int i;
  25253. unsigned long freq;
  25254. @@ -73,7 +71,7 @@ index 7a0b707..a99a262 100644
  25255. { .name = "HT20",
  25256. .width = NL80211_CHAN_WIDTH_20,
  25257. .freq1_diff = 0,
  25258. -@@ -60,6 +89,10 @@ static int join_ibss(struct nl80211_state *state,
  25259. +@@ -60,6 +89,10 @@ static int join_ibss(struct nl80211_stat
  25260. .width = NL80211_CHAN_WIDTH_10,
  25261. .freq1_diff = 0,
  25262. .chantype = -1 },
  25263. @@ -84,7 +82,7 @@ index 7a0b707..a99a262 100644
  25264. };
  25265. if (argc < 2)
  25266. -@@ -90,7 +123,7 @@ static int join_ibss(struct nl80211_state *state,
  25267. +@@ -90,7 +123,7 @@ static int join_ibss(struct nl80211_stat
  25268. NLA_PUT_U32(msg, NL80211_ATTR_CHANNEL_WIDTH,
  25269. chanmode_selected->width);
  25270. NLA_PUT_U32(msg, NL80211_ATTR_CENTER_FREQ1,
  25271. 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
  25272. index fc4442792d4e55d14cfd85823202755b3c4678c0..f96d5eafdac4942f5e418dfba15242c83659d572 100644
  25273. --- a/package/network/utils/iw/patches/302-ibss_use_MHz_instead_MHZ.patch
  25274. +++ b/package/network/utils/iw/patches/302-ibss_use_MHz_instead_MHZ.patch
  25275. @@ -7,11 +7,9 @@ Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  25276. ibss.c | 8 ++++----
  25277. 1 file changed, 4 insertions(+), 4 deletions(-)
  25278. -diff --git a/ibss.c b/ibss.c
  25279. -index a99a262..23bda70 100644
  25280. --- a/ibss.c
  25281. +++ b/ibss.c
  25282. -@@ -81,15 +81,15 @@ static int join_ibss(struct nl80211_state *state,
  25283. +@@ -81,15 +81,15 @@ static int join_ibss(struct nl80211_stat
  25284. .width = NL80211_CHAN_WIDTH_20_NOHT,
  25285. .freq1_diff = 0,
  25286. .chantype = NL80211_CHAN_NO_HT },
  25287. diff --git a/package/network/utils/iw/patches/303-mesh_add_VHT80.patch b/package/network/utils/iw/patches/303-mesh_add_VHT80.patch
  25288. index fe8dc21a19db12b056efcaa79b30987d0c1f8e10..956b0505e662b29c24cbdf18c17b1d5c6ed106f8 100644
  25289. --- a/package/network/utils/iw/patches/303-mesh_add_VHT80.patch
  25290. +++ b/package/network/utils/iw/patches/303-mesh_add_VHT80.patch
  25291. @@ -15,8 +15,6 @@ Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
  25292. util.c | 26 ++++++++++++++++++++++++++
  25293. 4 files changed, 43 insertions(+), 41 deletions(-)
  25294. -diff --git a/ibss.c b/ibss.c
  25295. -index 23bda70..ac06fc5 100644
  25296. --- a/ibss.c
  25297. +++ b/ibss.c
  25298. @@ -16,39 +16,6 @@
  25299. @@ -59,8 +57,6 @@ index 23bda70..ac06fc5 100644
  25300. static int join_ibss(struct nl80211_state *state,
  25301. struct nl_msg *msg,
  25302. int argc, char **argv,
  25303. -diff --git a/iw.h b/iw.h
  25304. -index cef9da8..8e1a37a 100644
  25305. --- a/iw.h
  25306. +++ b/iw.h
  25307. @@ -59,6 +59,13 @@ struct cmd {
  25308. @@ -77,7 +73,7 @@ index cef9da8..8e1a37a 100644
  25309. #define ARRAY_SIZE(ar) (sizeof(ar)/sizeof(ar[0]))
  25310. #define DIV_ROUND_UP(x, y) (((x) + (y - 1)) / (y))
  25311. -@@ -174,6 +181,8 @@ void print_ies(unsigned char *ie, int ielen, bool unknown,
  25312. +@@ -174,6 +181,8 @@ void print_ies(unsigned char *ie, int ie
  25313. void parse_bitrate(struct nlattr *bitrate_attr, char *buf, int buflen);
  25314. void iw_hexdump(const char *prefix, const __u8 *data, size_t len);
  25315. @@ -86,11 +82,9 @@ index cef9da8..8e1a37a 100644
  25316. #define SCHED_SCAN_OPTIONS "interval <in_msecs> [delay <in_secs>] " \
  25317. "[freqs <freq>+] [matches [ssid <ssid>]+]] [active [ssid <ssid>]+|passive] [randomise[=<addr>/<mask>]]"
  25318. int parse_sched_scan(struct nl_msg *msg, int *argc, char ***argv);
  25319. -diff --git a/mesh.c b/mesh.c
  25320. -index 0090530..930d58f 100644
  25321. --- a/mesh.c
  25322. +++ b/mesh.c
  25323. -@@ -439,12 +439,8 @@ static int join_mesh(struct nl80211_state *state,
  25324. +@@ -439,12 +439,8 @@ static int join_mesh(struct nl80211_stat
  25325. int bintval, dtim_period, i, n_rates = 0;
  25326. char *end, *value = NULL, *sptr = NULL;
  25327. unsigned long freq = 0;
  25328. @@ -105,7 +99,7 @@ index 0090530..930d58f 100644
  25329. { .name = "HT20",
  25330. .width = NL80211_CHAN_WIDTH_20,
  25331. .freq1_diff = 0,
  25332. -@@ -461,6 +457,10 @@ static int join_mesh(struct nl80211_state *state,
  25333. +@@ -461,6 +457,10 @@ static int join_mesh(struct nl80211_stat
  25334. .width = NL80211_CHAN_WIDTH_20_NOHT,
  25335. .freq1_diff = 0,
  25336. .chantype = NL80211_CHAN_NO_HT },
  25337. @@ -116,7 +110,7 @@ index 0090530..930d58f 100644
  25338. };
  25339. if (argc < 1)
  25340. -@@ -497,7 +497,7 @@ static int join_mesh(struct nl80211_state *state,
  25341. +@@ -497,7 +497,7 @@ static int join_mesh(struct nl80211_stat
  25342. NLA_PUT_U32(msg, NL80211_ATTR_CHANNEL_WIDTH,
  25343. chanmode_selected->width);
  25344. NLA_PUT_U32(msg, NL80211_ATTR_CENTER_FREQ1,
  25345. @@ -125,7 +119,7 @@ index 0090530..930d58f 100644
  25346. if (chanmode_selected->chantype != -1)
  25347. NLA_PUT_U32(msg,
  25348. NL80211_ATTR_WIPHY_CHANNEL_TYPE,
  25349. -@@ -599,7 +599,7 @@ static int join_mesh(struct nl80211_state *state,
  25350. +@@ -599,7 +599,7 @@ static int join_mesh(struct nl80211_stat
  25351. nla_put_failure:
  25352. return -ENOBUFS;
  25353. }
  25354. @@ -134,11 +128,9 @@ index 0090530..930d58f 100644
  25355. " [basic-rates <rate in Mbps,rate2,...>]], [mcast-rate <rate in Mbps>]"
  25356. " [beacon-interval <time in TUs>] [dtim-period <value>]"
  25357. " [vendor_sync on|off] [<param>=<value>]*",
  25358. -diff --git a/util.c b/util.c
  25359. -index 4efc4c8..d75ffe0 100644
  25360. --- a/util.c
  25361. +++ b/util.c
  25362. -@@ -728,3 +728,29 @@ void iw_hexdump(const char *prefix, const __u8 *buf, size_t size)
  25363. +@@ -728,3 +728,29 @@ void iw_hexdump(const char *prefix, cons
  25364. }
  25365. printf("\n\n");
  25366. }
  25367. 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
  25368. index d382453b1918502240738b33c10cb08b113c7026..20bb06e4867a78aae60485d0c6c7a38e82c2997c 100644
  25369. --- a/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.c
  25370. +++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.c
  25371. @@ -39,6 +39,18 @@ __init void ap9x_pci_setup_wmac_led_pin(unsigned wmac, int pin)
  25372. }
  25373. }
  25374. +__init void ap9x_pci_setup_wmac_led_name(unsigned wmac, const char *led_name)
  25375. +{
  25376. + switch (wmac) {
  25377. + case 0:
  25378. + ap9x_wmac0_data.led_name = led_name;
  25379. + break;
  25380. + case 1:
  25381. + ap9x_wmac1_data.led_name = led_name;
  25382. + break;
  25383. + }
  25384. +}
  25385. +
  25386. __init struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac)
  25387. {
  25388. switch (wmac) {
  25389. @@ -81,6 +93,20 @@ __init void ap9x_pci_setup_wmac_leds(unsigned wmac, struct gpio_led *leds,
  25390. }
  25391. }
  25392. +__init void ap9x_pci_setup_wmac_btns(unsigned wmac,
  25393. + struct gpio_keys_button *btns,
  25394. + unsigned num_btns, unsigned poll_interval)
  25395. +{
  25396. + struct ath9k_platform_data *ap9x_wmac_data;
  25397. +
  25398. + if (!(ap9x_wmac_data = ap9x_pci_get_wmac_data(wmac)))
  25399. + return;
  25400. +
  25401. + ap9x_wmac_data->btns = btns;
  25402. + ap9x_wmac_data->num_btns = num_btns;
  25403. + ap9x_wmac_data->btn_poll_interval = poll_interval;
  25404. +}
  25405. +
  25406. static int ap91_pci_plat_dev_init(struct pci_dev *dev)
  25407. {
  25408. switch (PCI_SLOT(dev->devfn)) {
  25409. 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
  25410. index ad288cbdf90e1a93f914ee7c4d5edbc10a2dbdd1..d7c018565ea9248fd69cd9ec37083c4d5887a6ca 100644
  25411. --- a/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.h
  25412. +++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.h
  25413. @@ -12,6 +12,7 @@
  25414. #define _ATH79_DEV_AP9X_PCI_H
  25415. struct gpio_led;
  25416. +struct gpio_keys_button;
  25417. struct ath9k_platform_data;
  25418. #if defined(CONFIG_ATH79_DEV_AP9X_PCI)
  25419. @@ -19,6 +20,9 @@ void ap9x_pci_setup_wmac_led_pin(unsigned wmac, int pin);
  25420. void ap9x_pci_setup_wmac_gpio(unsigned wmac, u32 mask, u32 val);
  25421. void ap9x_pci_setup_wmac_leds(unsigned wmac, struct gpio_led *leds,
  25422. int num_leds);
  25423. +void ap9x_pci_setup_wmac_led_name(unsigned wmac, const char *led_name);
  25424. +void ap9x_pci_setup_wmac_btns(unsigned wmac, struct gpio_keys_button *btns,
  25425. + unsigned num_btns, unsigned poll_interval);
  25426. struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac);
  25427. void ap91_pci_init(u8 *cal_data, u8 *mac_addr);
  25428. @@ -33,6 +37,12 @@ static inline void ap9x_pci_setup_wmac_gpio(unsigned wmac,
  25429. static inline void ap9x_pci_setup_wmac_leds(unsigned wmac,
  25430. struct gpio_led *leds,
  25431. int num_leds) {}
  25432. +static inline void ap9x_pci_setup_wmac_led_name(unsigned wmac,
  25433. + const char *led_name) {}
  25434. +static inline void ap9x_pci_setup_wmac_btns(unsigned wmac,
  25435. + struct gpio_keys_button *btns,
  25436. + unsigned num_btns,
  25437. + unsigned poll_interval) {}
  25438. static inline struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac)
  25439. {
  25440. return NULL;
  25441. diff --git a/target/linux/generic/files/include/linux/ath9k_platform.h b/target/linux/generic/files/include/linux/ath9k_platform.h
  25442. index 30ce2165cb4fbd8513ef045930f6a4a5dbb59a3a..2c19f3b494582144806e175783efbc2e124ca873 100644
  25443. --- a/target/linux/generic/files/include/linux/ath9k_platform.h
  25444. +++ b/target/linux/generic/files/include/linux/ath9k_platform.h
  25445. @@ -31,6 +31,10 @@ struct ath9k_platform_data {
  25446. u32 gpio_mask;
  25447. u32 gpio_val;
  25448. + u32 bt_active_pin;
  25449. + u32 bt_priority_pin;
  25450. + u32 wlan_active_pin;
  25451. +
  25452. bool endian_check;
  25453. bool is_clk_25mhz;
  25454. bool tx_gain_buffalo;
  25455. @@ -45,6 +49,11 @@ struct ath9k_platform_data {
  25456. int num_leds;
  25457. const struct gpio_led *leds;
  25458. + const char *led_name;
  25459. +
  25460. + unsigned num_btns;
  25461. + const struct gpio_keys_button *btns;
  25462. + unsigned btn_poll_interval;
  25463. };
  25464. #endif /* _LINUX_ATH9K_PLATFORM_H */